@eigenpal/docx-js-editor 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +6 -5
  2. package/dist/{ClipboardManager-Bbo5MM_U.d.cts → ClipboardManager-BzgQ-SOi.d.cts} +1 -1
  3. package/dist/{ClipboardManager-CR843H7H.d.ts → ClipboardManager-D0D4aUKE.d.ts} +1 -1
  4. package/dist/{DocumentAgent-cHf96hwL.d.cts → DocumentAgent-B9FUoSVS.d.cts} +1 -1
  5. package/dist/{DocumentAgent-lHtXgMFN.d.ts → DocumentAgent-CRCXiBT7.d.ts} +1 -1
  6. package/dist/{agentApi-DmDuQm0e.d.cts → agentApi-BVHzyk2l.d.cts} +11 -1
  7. package/dist/{agentApi-DmDuQm0e.d.ts → agentApi-BVHzyk2l.d.ts} +11 -1
  8. package/dist/chunk-2FYTKTQL.cjs +111 -0
  9. package/dist/chunk-2KHL5RSD.js +4 -0
  10. package/dist/chunk-3YHC2RAO.js +258 -0
  11. package/dist/chunk-63YB7DGI.js +59 -0
  12. package/dist/chunk-7OCUAFPO.cjs +258 -0
  13. package/dist/chunk-HE3SUXOQ.cjs +4 -0
  14. package/dist/{chunk-6TUCNECX.js → chunk-HRUPO723.js} +1 -1
  15. package/dist/{chunk-5ILXHRJS.cjs → chunk-JMR5HNJP.cjs} +3 -3
  16. package/dist/chunk-JO2CKU4O.js +1 -0
  17. package/dist/{chunk-KL2RYY6G.cjs → chunk-MSV5LTHM.cjs} +2 -2
  18. package/dist/chunk-NLYEW36R.js +26 -0
  19. package/dist/chunk-OJ7NJK46.cjs +1 -0
  20. package/dist/{chunk-CLDB6TL7.js → chunk-PRBTINOW.js} +20 -19
  21. package/dist/chunk-PVV7DV3L.cjs +59 -0
  22. package/dist/{chunk-JIKVCUR6.js → chunk-TOGKKPIW.js} +1 -1
  23. package/dist/chunk-VPDOOMUJ.cjs +26 -0
  24. package/dist/chunk-XGL3EGKF.js +111 -0
  25. package/dist/{chunk-B7TICMXD.cjs → chunk-XKBIFFAS.cjs} +20 -19
  26. package/dist/{clipboard-CU-zASXS.d.ts → clipboard-B7N7Kx2X.d.ts} +1 -1
  27. package/dist/{clipboard-DBabJ6mU.d.cts → clipboard-Cm7udEnb.d.cts} +1 -1
  28. package/dist/{colorResolver-yl7Xh_Qg.d.cts → colorResolver-Bu7uJqpw.d.cts} +2 -2
  29. package/dist/{colorResolver-BTTqW66Q.d.ts → colorResolver-Dlmk3itT.d.ts} +2 -2
  30. package/dist/core-plugins-reexport.cjs +1 -1
  31. package/dist/core-plugins-reexport.d.cts +4 -4
  32. package/dist/core-plugins-reexport.d.ts +4 -4
  33. package/dist/core-plugins-reexport.js +1 -1
  34. package/dist/core-reexport.cjs +1 -1
  35. package/dist/core-reexport.d.cts +10 -10
  36. package/dist/core-reexport.d.ts +10 -10
  37. package/dist/core-reexport.js +1 -1
  38. package/dist/{fontLoader-DQJOS1sb.d.ts → fontLoader-BI9ZoACv.d.ts} +1 -1
  39. package/dist/{fontLoader-Daq8y8C2.d.cts → fontLoader-X8ocGzeD.d.cts} +1 -1
  40. package/dist/headless-reexport.cjs +2 -2
  41. package/dist/headless-reexport.d.cts +7 -7
  42. package/dist/headless-reexport.d.ts +7 -7
  43. package/dist/headless-reexport.js +1 -1
  44. package/dist/index.cjs +2 -2
  45. package/dist/index.d.cts +11 -11
  46. package/dist/index.d.ts +11 -11
  47. package/dist/index.js +1 -1
  48. package/dist/lib-SPXD4LFI.cjs +1 -0
  49. package/dist/lib-U35UU4OU.js +1 -0
  50. package/dist/mcp-reexport.cjs +3 -3
  51. package/dist/mcp-reexport.d.cts +2 -2
  52. package/dist/mcp-reexport.d.ts +2 -2
  53. package/dist/mcp-reexport.js +1 -1
  54. package/dist/{processTemplate-3HN7Q3KT.js → processTemplate-CGIQEJ26.js} +1 -1
  55. package/dist/processTemplate-FOYV6BC5.cjs +1 -0
  56. package/dist/{react-CFPWe7nV.d.ts → react-BgZObIoP.d.ts} +10 -4
  57. package/dist/{react-CKqhN17E.d.cts → react-D9JDP3cV.d.cts} +10 -4
  58. package/dist/react.cjs +1 -1
  59. package/dist/react.d.cts +5 -5
  60. package/dist/react.d.ts +5 -5
  61. package/dist/react.js +1 -1
  62. package/dist/{registry-CXGC344v.d.cts → registry-Bxb5ZI1z.d.cts} +1 -1
  63. package/dist/{registry-C2DPl-QW.d.ts → registry-CgWNVTk9.d.ts} +1 -1
  64. package/dist/selectionRects-BMXJJCPJ.cjs +1 -0
  65. package/dist/selectionRects-TWK7CAC3.js +1 -0
  66. package/dist/styles.css +1 -1
  67. package/dist/{types-COQvtZji.d.cts → types-D03hsi5t.d.cts} +1 -1
  68. package/dist/{types-BpokDLqL.d.ts → types-igZ1x_e4.d.ts} +1 -1
  69. package/dist/ui.cjs +1 -1
  70. package/dist/ui.d.cts +4 -4
  71. package/dist/ui.d.ts +4 -4
  72. package/dist/ui.js +1 -1
  73. package/dist/{variableDetector-BYzE_RXw.d.ts → variableDetector-CkYvLv62.d.ts} +1 -1
  74. package/dist/{variableDetector-C8ST_dnq.d.cts → variableDetector-iGl52A6q.d.cts} +1 -1
  75. package/package.json +1 -1
  76. package/dist/chunk-3X3LTNK4.js +0 -26
  77. package/dist/chunk-4CUGBNL2.cjs +0 -1
  78. package/dist/chunk-5GFXHUMP.js +0 -1
  79. package/dist/chunk-FUK46DWH.js +0 -111
  80. package/dist/chunk-MUIREXKH.js +0 -3
  81. package/dist/chunk-OWMG5MW5.cjs +0 -3
  82. package/dist/chunk-PGEORVCG.js +0 -59
  83. package/dist/chunk-PIVLDW7B.cjs +0 -26
  84. package/dist/chunk-PUVSVHHB.cjs +0 -59
  85. package/dist/chunk-S36T7OK5.cjs +0 -258
  86. package/dist/chunk-Y62HOQL2.cjs +0 -111
  87. package/dist/chunk-YYBSUBRG.js +0 -258
  88. package/dist/lib-GD2QD2JK.js +0 -1
  89. package/dist/lib-HOLGQI5K.cjs +0 -1
  90. package/dist/processTemplate-BXZKWRQD.cjs +0 -1
  91. package/dist/selectionRects-7QU337P5.cjs +0 -1
  92. package/dist/selectionRects-V5RC2BYX.js +0 -1
  93. /package/dist/{chunk-USRMBYI6.js → chunk-IFPN3NT3.js} +0 -0
  94. /package/dist/{chunk-XQNCLN4T.cjs → chunk-QDNL7NWN.cjs} +0 -0
@@ -1,258 +0,0 @@
1
- 'use strict';var chunk4CUGBNL2_cjs=require('./chunk-4CUGBNL2.cjs'),chunkOWMG5MW5_cjs=require('./chunk-OWMG5MW5.cjs'),chunkVTAS7VZ6_cjs=require('./chunk-VTAS7VZ6.cjs'),chunkXS2AQFMF_cjs=require('./chunk-XS2AQFMF.cjs'),chunk2VHQ7YOQ_cjs=require('./chunk-2VHQ7YOQ.cjs'),chunkKL2RYY6G_cjs=require('./chunk-KL2RYY6G.cjs'),chunkIA4LPH2A_cjs=require('./chunk-IA4LPH2A.cjs'),chunkP7ZF45KZ_cjs=require('./chunk-P7ZF45KZ.cjs'),chunkPIVLDW7B_cjs=require('./chunk-PIVLDW7B.cjs'),chunkKR32M3S4_cjs=require('./chunk-KR32M3S4.cjs'),chunkPCJ5ACUV_cjs=require('./chunk-PCJ5ACUV.cjs'),Ap=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'),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 Ap__default=/*#__PURE__*/_interopDefault(Ap);function Tf(){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 ns({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function wf(e){return e.replace(/\.docx$/i,"")}function tc({value:e,onChange:t,placeholder:n="Untitled",editable:o=true}){let r=wf(e);return o?jsxRuntime.jsx("input",{type:"text",value:r,onChange:i=>{let a=i.target.value;t?.(a.endsWith(".docx")?a:a+".docx");},placeholder:n,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":"Document name"}):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:r||n})}function os({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function rs(){let e=chunkOWMG5MW5_cjs.x(),{disabled:t=false,onFormat:n,onPrint:o,showPrintButton:r=true,onPageSetup:i,onInsertImage:a,onInsertTable:s,showTableInsert:l=true,onInsertPageBreak:u,onInsertTOC:d,onRefocusEditor:c}=e,f=Ap.useCallback(b=>{!t&&n&&n(b);},[t,n]),p=Ap.useCallback((b,g)=>{!t&&s&&(s(b,g),requestAnimationFrame(()=>c?.()));},[t,s,c]);return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":"Menu bar",children:[(r&&o||i)&&jsxRuntime.jsx(chunkOWMG5MW5_cjs.e,{label:"File",disabled:t,items:[...r&&o?[{icon:"print",label:"Print",shortcut:"Ctrl+P",onClick:o}]:[],...i?[{icon:"settings",label:"Page setup",onClick:i}]:[]]}),jsxRuntime.jsx(chunkOWMG5MW5_cjs.e,{label:"Format",disabled:t,items:[{icon:"format_textdirection_l_to_r",label:"Left-to-right text",onClick:()=>f("setLtr")},{icon:"format_textdirection_r_to_l",label:"Right-to-left text",onClick:()=>f("setRtl")}]}),jsxRuntime.jsx(chunkOWMG5MW5_cjs.e,{label:"Insert",disabled:t,items:[...a?[{icon:"image",label:"Image",onClick:a}]:[],...l&&s?[{icon:"grid_on",label:"Table",submenuContent:b=>jsxRuntime.jsx(chunkOWMG5MW5_cjs.f,{onInsert:(g,S)=>{p(g,S),b();}})}]:[],...a||l&&s?[{type:"separator"}]:[],{icon:"page_break",label:"Page break",onClick:u,disabled:!u},{icon:"format_list_numbered",label:"Table of contents",onClick:d,disabled:!d}]})]})}function nc({children:e}){let t=null,n=null,o=[],r=[];Ap.Children.forEach(e,a=>{Ap.isValidElement(a)&&(a.type===ns?t=a:a.type===os?n=a:a.type===rs?r.push(a):o.push(a));});let i=Ap.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",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(Tf,{})}),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 vf({children:e,className:t,...n}){return jsxRuntime.jsx(chunkOWMG5MW5_cjs.w.Provider,{value:n,children:jsxRuntime.jsx("div",{className:chunkOWMG5MW5_cjs.a("flex flex-col bg-white shadow-sm flex-shrink-0",t),"data-testid":"editor-toolbar",children:e})})}var Ht=vf;Ht.TitleBar=nc;Ht.Logo=ns;Ht.DocumentName=tc;Ht.MenuBar=rs;Ht.TitleBarRight=os;Ht.FormattingBar=chunkOWMG5MW5_cjs.y;var ic=Ap.createContext(null);function iS(){let e=Ap.useContext(ic);if(!e)throw new Error("useErrorNotifications must be used within an ErrorProvider");return e}function ac({children:e}){let t=Ap.useMemo(()=>new chunk2VHQ7YOQ_cjs.H,[]),n=Ap.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Ap.useCallback((u,d)=>{t.showError(u,d);},[t]),r=Ap.useCallback((u,d)=>{t.showWarning(u,d);},[t]),i=Ap.useCallback((u,d)=>{t.showInfo(u,d);},[t]),a=Ap.useCallback(u=>{t.dismiss(u);},[t]),s=Ap.useCallback(()=>{t.clearAll();},[t]),l=Ap.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[n.notifications,o,r,i,a,s]);return jsxRuntime.jsxs(ic.Provider,{value:l,children:[e,jsxRuntime.jsx(Ff,{notifications:n.notifications,onDismiss:a})]})}function Ff({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(Bf,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function Bf({notification:e,onDismiss:t}){let[n,o]=Ap.useState(false),i=(m=>{switch(m){case "error":return {bg:"var(--doc-error-bg)",border:"#f5c6cb",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"#ffeeba",text:"#856404",icon:"var(--doc-warning)"};case "info":return {bg:"#e8f4fd",border:"#b8daff",text:"#0c5460",icon:"var(--doc-primary)"}}})(e.severity),a={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out"},s={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},u={flex:1,minWidth:0},d={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},c={marginTop:"8px",padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},f={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},p=m=>{switch(m){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:a,children:[jsxRuntime.jsx("style",{children:`
2
- @keyframes slideIn {
3
- from {
4
- opacity: 0;
5
- transform: translateX(100%);
6
- }
7
- to {
8
- opacity: 1;
9
- transform: translateX(0);
10
- }
11
- }
12
- `}),jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("span",{style:l,children:p(e.severity)}),jsxRuntime.jsxs("div",{style:u,children:[jsxRuntime.jsx("div",{style:d,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!n),style:{...f,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n?"Hide details":"Show details"}),n&&jsxRuntime.jsx("div",{style:c,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:f,title:"Dismiss",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var _r=class extends Ap.Component{constructor(n){super(n);chunkPCJ5ACUV_cjs.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(Lf,{error:r,errorInfo:i,showDetails:o,onReset:this.resetError})}return this.props.children}};function Lf({error:e,errorInfo:t,showDetails:n,onReset:o}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},u={padding:"10px 20px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:a,children:"Something went wrong"}),jsxRuntime.jsx("p",{style:s,children:"An error occurred while rendering this component. Please try again or contact support if the problem persists."}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:"Error:"})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
13
-
14
- `,jsxRuntime.jsx("strong",{children:"Component Stack:"}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:u,children:"Try Again"})]})}function aS({message:e,details:t,onRetry:n,className:o=""}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={marginBottom:"16px",padding:"12px",background:"var(--doc-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",maxWidth:"100%",overflow:"auto",textAlign:"left"},u={padding:"8px 16px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"13px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:`docx-parse-error ${o}`,style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 10h20v20H10z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M25 10l-10 20M15 10l10 20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h3",{style:a,children:"Unable to Parse Document"}),jsxRuntime.jsx("p",{style:s,children:e}),t&&jsxRuntime.jsx("div",{style:l,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:u,children:"Try Again"})]})}function sS({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 lS(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function cS(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 lc({document:e,onChange:t,onSelectionChange:n}){let o=Ap.useMemo(()=>new chunk2VHQ7YOQ_cjs.C,[]),[r,i]=Ap.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a=Ap.useCallback((d,c,f)=>{if(!e)return;let p=chunk2VHQ7YOQ_cjs.z(e,d);if(!p){o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}o.selectCell({tableIndex:d,rowIndex:c,columnIndex:f});let b=chunkOWMG5MW5_cjs.K(p,{tableIndex:d,rowIndex:c,columnIndex:f});i({context:b,table:p,tableIndex:d,rowIndex:c,columnIndex:f}),n?.(b);},[e,o,n]),s=Ap.useCallback(()=>{o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[o,n]),l=Ap.useCallback(d=>{if(!e||!r.context||r.tableIndex===null||r.rowIndex===null||r.columnIndex===null)return;let c=r.table;if(!c)return;let f=null,p=null,m=r.rowIndex,b=r.columnIndex;switch(d){case "addRowAbove":f=chunkOWMG5MW5_cjs.N(c,r.rowIndex,"before"),m=r.rowIndex+1;break;case "addRowBelow":f=chunkOWMG5MW5_cjs.N(c,r.rowIndex,"after");break;case "addColumnLeft":f=chunkOWMG5MW5_cjs.P(c,r.columnIndex,"before"),b=r.columnIndex+1;break;case "addColumnRight":f=chunkOWMG5MW5_cjs.P(c,r.columnIndex,"after");break;case "deleteRow":c.rows.length>1&&(f=chunkOWMG5MW5_cjs.O(c,r.rowIndex),m>=f.rows.length&&(m=f.rows.length-1));break;case "deleteColumn":{if(chunkOWMG5MW5_cjs.L(c)>1){f=chunkOWMG5MW5_cjs.Q(c,r.columnIndex);let S=chunkOWMG5MW5_cjs.L(f);b>=S&&(b=S-1);}break}case "mergeCells":r.context.selection.selectedCells&&(f=chunkOWMG5MW5_cjs.R(c,r.context.selection));break;case "splitCell":r.context.canSplitCell&&(f=chunkOWMG5MW5_cjs.S(c,r.rowIndex,r.columnIndex));break;case "deleteTable":p=chunk2VHQ7YOQ_cjs.B(e,r.tableIndex),s(),t?.(p);return}f&&(p=chunk2VHQ7YOQ_cjs.A(e,r.tableIndex,f),t?.(p),p&&a(r.tableIndex,m,b));},[e,r,t,s,a]),u=Ap.useCallback((d,c,f)=>o.isCellSelected(d,c,f),[o,r]);return {state:r,handleCellClick:a,handleAction:l,clearSelection:s,isCellSelected:u,tableContext:r.context}}var dc=({headings:e,onHeadingClick:t,onClose:n,topOffset:o=0})=>{let[r,i]=Ap.useState(false);return Ap.useEffect(()=>{requestAnimationFrame(()=>i(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":"Document outline",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:r?"translateX(0)":"translateX(-270px)",transition:"transform 0.15s ease-out"},onMouseDown:a=>a.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close outline",style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"#444746"},title:"Close outline",children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"#1f1f1f",letterSpacing:"0.01em"},children:"Outline"})]}),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:"No headings found. Add headings to your document to see them here."}):e.map((a,s)=>jsxRuntime.jsx("div",{style:{marginLeft:a.level*12},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>t(a.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:a.text,children:a.text})},`${a.pmPos}-${s}`))})]})};function pc(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 as(e){return e?new Date(e).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function ss(e){return e.split(/\s+/).map(t=>t[0]).join("").toUpperCase().slice(0,2)}var fc=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function Of(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return fc[Math.abs(t)%fc.length]}var $f=340,_f=8,Ur={background:"none",border:"none",cursor:"pointer",padding:4,color:"#5f6368",display:"flex",borderRadius:"50%"},mc={padding:"6px 16px",fontSize:14,border:"none",background:"none",color:"#1a73e8",cursor:"pointer",fontWeight:500,fontFamily:"inherit"},gc=({comments:e,trackedChanges:t,onCommentClick:n,onCommentReply:o,onCommentResolve:r,onCommentDelete:i,onAddComment:a,onCancelAddComment:s,onAcceptChange:l,onRejectChange:u,onTrackedChangeReply:d,topOffset:c=0,showResolved:f=false,isAddingComment:p=false,addCommentYPosition:m=null,pageWidth:b=816,editorContainerRef:g})=>{let[S,C]=Ap.useState(null),[x,E]=Ap.useState(""),[w,B]=Ap.useState(""),[_,V]=Ap.useState(null),[z,A]=Ap.useState(null),[Q,de]=Ap.useState(new Map),[H,I]=Ap.useState(false),F=Ap.useRef(new Set),me=Ap.useRef(null),pe=Ap.useRef(new Map),He=Ap.useMemo(()=>e.filter(M=>!(M.parentId!=null||M.done&&!f)),[e,f]),Ie=Ap.useMemo(()=>{let M=new Map;for(let W of e)if(W.parentId!=null){let O=M.get(W.parentId);O?O.push(W):M.set(W.parentId,[W]);}return M},[e]),je=M=>Ie.get(M)??[],R=Ap.useCallback(()=>{let M=g?.current;if(!M)return;let W=M.querySelector(".paged-editor__pages");if(!W)return;let O=M.getBoundingClientRect(),X=M.scrollTop,ue=[];for(let ge of He){let Ee=W.querySelector(`[data-comment-id="${ge.id}"]`);if(Ee){let be=Ee.getBoundingClientRect();ue.push({id:`comment-${ge.id}`,targetY:be.top-O.top+X,height:pe.current.get(`comment-${ge.id}`)?.offsetHeight||80});}}t.forEach((ge,Ee)=>{let be=`tc-${ge.revisionId}-${Ee}`,tt=W.querySelector(`[data-revision-id="${ge.revisionId}"]`);if(tt){let Je=tt.getBoundingClientRect();ue.push({id:be,targetY:Je.top-O.top+X,height:pe.current.get(be)?.offsetHeight||80});}}),p&&m!=null&&ue.push({id:"new-comment-input",targetY:m,height:pe.current.get("new-comment-input")?.offsetHeight||120}),ue.sort((ge,Ee)=>ge.targetY-Ee.targetY);let fe=new Map,Fe=0;for(let ge of ue){let Ee=Math.max(ge.targetY,Fe+_f);fe.set(ge.id,Ee),Fe=Ee+ge.height;}de(fe);},[He,t,g,p,m]);Ap.useEffect(()=>{let M=g?.current;if(!M)return;let W=M.querySelector(".paged-editor__pages");if(!W)return;let O=X=>{let ue=X.target;if(!me.current?.contains(ue)){if(W.contains(ue)){let fe=ue.closest("[data-comment-id]");if(fe?.dataset.commentId){V(`comment-${fe.dataset.commentId}`),n?.(Number(fe.dataset.commentId));return}let Fe=ue.closest(".docx-insertion")||ue.closest(".docx-deletion");if(Fe?.dataset.revisionId){let ge=Number(Fe.dataset.revisionId),Ee=t.findIndex(be=>be.revisionId===ge);if(Ee>=0){V(`tc-${t[Ee].revisionId}-${Ee}`);return}}}V(null),A(null);}};return M.addEventListener("click",O),()=>M.removeEventListener("click",O)},[g,t,n]),Ap.useEffect(()=>{let M=g?.current;if(!M)return;let W=setTimeout(R,50),O=setTimeout(()=>{R(),I(true);},400),X=new ResizeObserver(()=>{requestAnimationFrame(R);});return X.observe(M),()=>{clearTimeout(W),clearTimeout(O),X.disconnect();}},[R,g]),Ap.useEffect(()=>{let M=requestAnimationFrame(R);return ()=>cancelAnimationFrame(M)},[_,p,R]),Ap.useEffect(()=>{let M=[];if(_){let ue=pe.current.get(_);ue&&M.push(ue);}let W=pe.current.get("new-comment-input");if(W&&M.push(W),M.length===0)return;let O,X=new ResizeObserver(()=>{cancelAnimationFrame(O),O=requestAnimationFrame(R);});for(let ue of M)X.observe(ue);return ()=>{cancelAnimationFrame(O),X.disconnect();}},[_,R]);let L=()=>{w.trim()&&(a?.(w.trim()),B(""));},k=(M,W)=>{V(_===M?null:M),A(null),W!==void 0&&n?.(W);},P=Q.size>0,N=(M,W=32)=>({width:W,height:W,borderRadius:"50%",backgroundColor:Of(M),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:W===32?13:11,fontWeight:500,flexShrink:0}),v=M=>({padding:"6px 16px",fontSize:14,border:"none",borderRadius:20,background:M?"#1a73e8":"#f1f3f4",color:M?"#fff":"#80868b",cursor:M?"pointer":"default",fontWeight:500,fontFamily:"inherit"}),q=(M,W,O)=>{let X=F.current.has(M);return O!==void 0&&F.current.add(M),{...P?O!==void 0?{position:"absolute",top:O,left:0,right:0,opacity:1}:{position:"absolute",top:0,left:0,right:0,opacity:0,visibility:"hidden"}:{marginBottom:6},padding:W?"10px 12px":"8px 10px",borderRadius:8,backgroundColor:W?"#fff":"#f8fbff",cursor:"pointer",boxShadow:W?"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)":"0 1px 3px rgba(60,64,67,0.2), 0 2px 6px rgba(60,64,67,0.08)",transition:P&&O===void 0?"none":!X&&O!==void 0?"opacity 0.2s ease, box-shadow 0.2s ease":H?"opacity 0.2s ease, box-shadow 0.2s ease, top 0.15s ease":"none"}},ae=(M,W)=>M.length===0?null:jsxRuntime.jsxs("div",{style:{marginTop:8},children:[(W?M:M.slice(-1)).map(O=>jsxRuntime.jsxs("div",{style:{marginBottom:W?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:N(O.author||"U",28),children:ss(O.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:O.author||"Unknown"}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:as(O.date)})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:4,...W?{}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},children:pc(O.content)})]},O.id)),!W&&M.length>1&&jsxRuntime.jsxs("div",{style:{fontSize:12,color:"#5f6368",marginTop:4},children:[M.length-1," more ",M.length-1===1?"reply":"replies"]})]}),$=(M,W)=>jsxRuntime.jsx("div",{onClick:O=>O.stopPropagation(),style:{marginTop:12},children:S===M?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{ref:O=>O?.focus({preventScroll:true}),type:"text",value:x,onChange:O=>E(O.target.value),onMouseDown:O=>O.stopPropagation(),onKeyDown:O=>{O.stopPropagation(),O.key==="Enter"&&(O.preventDefault(),x.trim()&&W&&W(M,x.trim()),E(""),C(null)),O.key==="Escape"&&(C(null),E(""));},placeholder:"Reply or add others with @",style:{width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",boxSizing:"border-box",color:"#202124"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:O=>{O.stopPropagation(),C(null),E("");},style:mc,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:O=>{O.stopPropagation(),x.trim()&&W&&W(M,x.trim()),E(""),C(null);},disabled:!x.trim(),style:v(!!x.trim()),children:"Reply"})]})]}):jsxRuntime.jsx("input",{readOnly:true,onMouseDown:O=>O.stopPropagation(),onClick:O=>{O.stopPropagation(),C(M);},placeholder:"Reply or add others with @",style:{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"}})}),U=M=>{let W=je(M.id),O=`comment-${M.id}`,X=_===O,ue=Q.get(O);return jsxRuntime.jsxs("div",{ref:fe=>{fe?pe.current.set(O,fe):pe.current.delete(O);},"data-comment-id":M.id,className:"docx-comment-card",onClick:()=>k(O,M.id),onMouseDown:fe=>fe.stopPropagation(),style:{...q(O,X,ue),opacity:P&&ue===void 0?0:M.done?.6:1},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:N(M.author||"U"),children:ss(M.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:M.author||"Unknown"}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:as(M.date)})]}),X&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2,position:"relative"},children:[jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),r?.(M.id);},title:"Resolve",style:Ur,children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),A(z===O?null:O);},title:"More options",style:Ur,children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"more_vert",size:20})}),z===O&&jsxRuntime.jsx("div",{onClick:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.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:()=>{A(null),i?.(M.id);},style:{display:"block",width:"100%",padding:"8px 16px",border:"none",background:"none",textAlign:"left",fontSize:14,color:"#202124",cursor:"pointer",fontFamily:"inherit"},onMouseOver:fe=>{fe.target.style.backgroundColor="#f1f3f4";},onMouseOut:fe=>{fe.target.style.backgroundColor="transparent";},children:"Delete"})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:6},children:pc(M.content)}),ae(W,X),X&&!M.done&&$(M.id,o)]},M.id)},Z=M=>Ie.get(M)??[],xe=(M,W)=>{let O=M.author||"Unknown",X=`tc-${M.revisionId}-${W}`,ue=_===X,fe=Q.get(X),Fe=Z(M.revisionId);return jsxRuntime.jsxs("div",{ref:ge=>{ge?pe.current.set(X,ge):pe.current.delete(X);},className:"docx-tracked-change-card",onClick:()=>k(X),onMouseDown:ge=>ge.stopPropagation(),style:q(X,ue,fe),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:N(O),children:ss(O)}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:O}),M.date&&jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:as(M.date)})]}),ue&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),l?.(M.from,M.to);},title:"Accept",style:Ur,children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),u?.(M.from,M.to);},title:"Reject",style:Ur,children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"close",size:20})})]})]}),jsxRuntime.jsxs("div",{style:{fontSize:13,lineHeight:"20px",color:"#202124",marginTop:6},children:[M.type==="insertion"?"Added":"Deleted"," ",jsxRuntime.jsxs("span",{style:{color:M.type==="insertion"?"#137333":"#c5221f",fontWeight:500},children:['"',M.text.length>50?M.text.slice(0,50)+"...":M.text,'"']})]}),ae(Fe,ue),ue&&$(M.revisionId,d)]},X)};return jsxRuntime.jsx("aside",{ref:me,className:"docx-comments-sidebar",role:"complementary","aria-label":"Comments and changes",style:{position:"absolute",top:c,left:`calc(50% - 120px + ${b/2+12}px)`,bottom:0,width:$f,fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,backgroundColor:"transparent",overflowY:P?"visible":"auto",overflowX:"visible",opacity:P?1:0,transition:"opacity 0.15s ease"},onMouseDown:M=>M.stopPropagation(),children:jsxRuntime.jsxs("div",{style:{position:"relative"},children:[p&&jsxRuntime.jsxs("div",{ref:M=>{M?pe.current.set("new-comment-input",M):pe.current.delete("new-comment-input");},style:{...P?Q.get("new-comment-input")!==void 0?{position:"absolute",top:Q.get("new-comment-input"),left:0,right:0}:{position:"absolute",top:0,left:0,right:0,visibility:"hidden"}:{marginBottom:8},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:M=>M?.focus({preventScroll:true}),value:w,onChange:M=>B(M.target.value),onMouseDown:M=>M.stopPropagation(),onKeyDown:M=>{M.stopPropagation(),M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),L()),M.key==="Escape"&&(s?.(),B(""));},placeholder:"Add a comment...",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:()=>{s?.(),B("");},style:mc,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:L,disabled:!w.trim(),style:v(!!w.trim()),children:"Comment"})]})]}),He.map(M=>U(M)),t.map((M,W)=>xe(M,W)),He.length===0&&t.length===0&&!p&&jsxRuntime.jsx("div",{style:{padding:"24px 16px",textAlign:"center",color:"#80868b",fontSize:13},children:"No comments or changes yet."})]})})};var Uf=15840,bc=1440,jf=1440,Kf=567,xc=20,Gf="var(--doc-text-muted)",Yf="var(--doc-text-subtle)",Xf="var(--doc-primary)",qf="var(--doc-primary)",Zf="var(--doc-primary-hover)";function Sc({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let[l,u]=Ap.useState(null),[d,c]=Ap.useState(null),f=Ap.useRef(null),p=e?.pageHeight??Uf,m=e?.marginTop??bc,b=e?.marginBottom??bc,g=chunkKR32M3S4_cjs.a(p)*t,S=chunkKR32M3S4_cjs.a(m)*t,C=chunkKR32M3S4_cjs.a(b)*t,x=Ap.useCallback((V,z)=>{n&&(V.preventDefault(),u(z));},[n]),E=Ap.useCallback(V=>{if(!l||!f.current)return;let z=f.current.getBoundingClientRect(),A=V.clientY-z.top,Q=chunkKR32M3S4_cjs.b(A/t);if(l==="topMargin"){let de=p-b-720,H=Math.max(0,Math.min(Q,de));o?.(Math.round(H));}else if(l==="bottomMargin"){let de=p-Q,H=p-m-720,I=Math.max(0,Math.min(de,H));r?.(Math.round(I));}},[l,t,p,m,b,o,r]),w=Ap.useCallback(()=>{u(null);},[]);Ap.useEffect(()=>{if(l)return document.addEventListener("mousemove",E),document.addEventListener("mouseup",w),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",w);}},[l,E,w]);let B=Qf(p,t,i),_={position:"relative",width:xc,height:chunkKR32M3S4_cjs.k(g),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:l?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:f,className:`docx-vertical-ruler ${a}`,style:_,role:"slider","aria-label":"Vertical ruler","aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:B.map((V,z)=>jsxRuntime.jsx(Jf,{tick:V},z))}),jsxRuntime.jsx(yc,{type:"topMargin",position:S,editable:n,isDragging:l==="topMargin",isHovered:d==="topMargin",onMouseEnter:()=>c("topMargin"),onMouseLeave:()=>c(null),onMouseDown:V=>x(V,"topMargin")}),jsxRuntime.jsx(yc,{type:"bottomMargin",position:g-C,editable:n,isDragging:l==="bottomMargin",isHovered:d==="bottomMargin",onMouseEnter:()=>c("bottomMargin"),onMouseLeave:()=>c(null),onMouseDown:V=>x(V,"bottomMargin")})]})}function Jf({tick:e}){let t={position:"absolute",top:chunkKR32M3S4_cjs.k(e.position),right:0,height:1,width:e.width,backgroundColor:Yf},n={position:"absolute",top:chunkKR32M3S4_cjs.k(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Gf,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 yc({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let l=o?Zf:r?qf:Xf,u={position:"absolute",top:chunkKR32M3S4_cjs.k(t-5),right:0,width:xc,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},d={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:u,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="topMargin"?"Top margin":"Bottom margin","aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function Qf(e,t,n){let o=[];if(n==="inch"){let r=jf/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkKR32M3S4_cjs.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=Kf/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkKR32M3S4_cjs.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 pn={High:50,Default:100,Low:150};function Ct(e){return t=>{let n={...e.defaultOptions,...t};return {type:"extension",config:{name:e.name,priority:e.priority??pn.Default,options:n},onSchemaReady(o){return e.onSchemaReady(o,n)}}}}function Ye(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??pn.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}function Ae(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??pn.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}var Cc=Ye({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table | textBox)+"}});var Tc=Ye({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}});function wc(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=chunk4CUGBNL2_cjs.a(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkKR32M3S4_cjs.i(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunkIA4LPH2A_cjs.a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=chunkIA4LPH2A_cjs.n(e.highlight)),e.shading){let a=Rc(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=tm(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunkIA4LPH2A_cjs.a(e.underline.color,t));}if(e.strike&&o.push("line-through"),e.doubleStrike&&o.push("line-through"),o.length>0&&(n.textDecoration=o.join(" "),r.length>0&&(n.textDecorationStyle=r[0]),i.length>0&&(n.textDecorationColor=i[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let a=chunkKR32M3S4_cjs.h(e.position);n.position="relative",n.top=chunkKR32M3S4_cjs.k(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.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 vc(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=nm(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkKR32M3S4_cjs.a(e.lineSpacing);o>0&&(n.lineHeight=chunkKR32M3S4_cjs.k(o));break}case "atLeast":{let o=chunkKR32M3S4_cjs.a(e.lineSpacing);o>0&&(n.minHeight=chunkKR32M3S4_cjs.k(o),n.lineHeight=chunkKR32M3S4_cjs.k(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.indentFirstLine)):n.textIndent=chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,Po(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,Po(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,Po(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,Po(e.borders.right,"Right",t))),e.shading){let o=Rc(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 Po(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkKR32M3S4_cjs.j(e.size):1,i=e.color?chunkIA4LPH2A_cjs.a(e.color,n):"#000000",a=om(e.style),s=`border${t}Width`,l=`border${t}Style`,u=`border${t}Color`;return o[s]=chunkKR32M3S4_cjs.k(Math.max(1,r)),o[l]=a,o[u]=i,o}function Rc(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunkIA4LPH2A_cjs.c(e.fill,t):e.pattern==="solid"&&e.color?chunkIA4LPH2A_cjs.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunkIA4LPH2A_cjs.c(e.color,t):""}function tm(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 nm(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function om(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 Eo(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 im(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=vc(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function am(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 sm(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${am(n)} docx-list-level-${o}`}var lm={content:"inline*",group:"block",attrs:{paraId:{default:null},textId:{default:null},alignment:{default:null},spaceBefore:{default:null},spaceAfter:{default:null},lineSpacing:{default:null},lineSpacingRule:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:false},numPr:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},bidi:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e;return {paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0}}}],toDOM(e){let t=e.attrs,n=im(t),o=sm(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 Nt(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 Pc(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 Qo(e){return (t,n)=>Nt("alignment",e)(t,n)}function jr(e,t="auto"){return (n,o)=>Pc({lineSpacing:e,lineSpacingRule:t})(n,o)}function cm(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 dm(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,d=Math.max(0,u-e);i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:d>0?d:null});}}),n(i.scrollIntoView()),true}}function um(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 c=n.runFormatting;c.bold&&u.push(e.marks.bold.create()),c.italic&&u.push(e.marks.italic.create()),c.fontSize&&u.push(e.marks.fontSize.create({size:c.fontSize})),c.fontFamily&&u.push(e.marks.fontFamily.create({ascii:c.fontFamily.ascii,hAnsi:c.fontFamily.hAnsi,asciiTheme:c.fontFamily.asciiTheme})),c.color&&!c.color.auto&&u.push(e.marks.textColor.create({rgb:c.color.rgb,themeColor:c.color.themeColor,themeTint:c.color.themeTint,themeShade:c.color.themeShade})),c.underline&&c.underline.style!=="none"&&u.push(e.marks.underline.create({style:c.underline.style,color:c.underline.color})),(c.strike||c.doubleStrike)&&u.push(e.marks.strike.create({double:c.doubleStrike||false}));}let d=[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,(c,f)=>{if(c.type.name==="paragraph"&&!l.has(f)){l.add(f);let p={...c.attrs,styleId:t};if(n?.paragraphFormatting){let m=n.paragraphFormatting;m.alignment!==void 0&&(p.alignment=m.alignment),m.spaceBefore!==void 0&&(p.spaceBefore=m.spaceBefore),m.spaceAfter!==void 0&&(p.spaceAfter=m.spaceAfter),m.lineSpacing!==void 0&&(p.lineSpacing=m.lineSpacing),m.lineSpacingRule!==void 0&&(p.lineSpacingRule=m.lineSpacingRule),m.indentLeft!==void 0&&(p.indentLeft=m.indentLeft),m.indentRight!==void 0&&(p.indentRight=m.indentRight),m.indentFirstLine!==void 0&&(p.indentFirstLine=m.indentFirstLine);}if(s=s.setNodeMarkup(f,void 0,p),n){let m=f+1,b=f+c.nodeSize-1;if(b>m){for(let g of d)s=s.removeMark(m,b,g);for(let g of u)s=s.addMark(m,b,g);}}}}),u.length>0&&(s=s.setStoredMarks(u)),r(s.scrollIntoView()),true}}var Ec=Ye({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:lm,onSchemaReady(e){let t=um(e.schema);return {commands:{setAlignment:n=>Qo(n),alignLeft:()=>Qo("left"),alignCenter:()=>Qo("center"),alignRight:()=>Qo("right"),alignJustify:()=>Qo("both"),setLineSpacing:(n,o)=>jr(n,o),singleSpacing:()=>jr(240),oneAndHalfSpacing:()=>jr(360),doubleSpacing:()=>jr(480),setSpaceBefore:n=>Nt("spaceBefore",n),setSpaceAfter:n=>Nt("spaceAfter",n),increaseIndent:n=>cm(n),decreaseIndent:n=>dm(n),setIndentLeft:n=>Nt("indentLeft",n>0?n:null),setIndentRight:n=>Nt("indentRight",n>0?n:null),setIndentFirstLine:(n,o)=>Pc({indentFirstLine:n>0?n:null,hangingIndent:o??false}),applyStyle:(n,o)=>t(n,o),clearStyle:()=>Nt("styleId",null),insertSectionBreak:n=>Nt("sectionBreakType",n),removeSectionBreak:()=>Nt("sectionBreakType",null),generateTOC:()=>(n,o)=>{let r=Eo(n.doc);if(r.length===0)return false;if(!o)return true;let{schema:i}=n,a=n.tr,s=[];for(let d of r){let c=`_Toc${Math.floor(1e8+Math.random()*9e8)}`;s.push({name:c,level:d.level,text:d.text});let f=a.mapping.map(d.pmPos),m=a.doc.resolve(f).nodeAfter;if(m&&m.type.name==="paragraph"){let S=[...(m.attrs.bookmarks||[]).filter(C=>!C.name.startsWith("_Toc")),{id:Math.floor(Math.random()*2147483647),name:c}];a.setNodeMarkup(f,void 0,{...m.attrs,bookmarks:S});}}let l=[];l.push(i.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let d of s){let c=d.level*720,f=`TOC${d.level+1}`,p=i.marks.hyperlink.create({href:`#${d.name}`});l.push(i.node("paragraph",{styleId:f,indentLeft:c>0?c:null},[i.text(d.text,[p])]));}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 Nt("bidi",a?null:true)(n,o)},setRtl:()=>Nt("bidi",true),setLtr:()=>Nt("bidi",null),setTabs:n=>Nt("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 c=[...(l.attrs.tabs||[]).filter(f=>f.position!==n),{position:n,alignment:o,leader:r}].sort((f,p)=>f.position-p.position);return Nt("tabs",c)(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 Nt("tabs",l.length>0?l:null)(o,r)}}}}});var Ic=Ct({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 Bc=Ae({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2})$/.test(e)?null:false}],toDOM(){return ["strong",0]}},onSchemaReady(e){return {commands:{toggleBold:()=>prosemirrorCommands.toggleMark(e.schema.marks.bold)},keyboardShortcuts:{"Mod-b":prosemirrorCommands.toggleMark(e.schema.marks.bold)}}}});var Dc=Ae({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 fm(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 Ac(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=fm(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function fn(e,t){return (n,o)=>{let{from:r,to:i,empty:a}=n.selection,s=e.create(t);if(a){if(o){let l=e.isInSet(n.storedMarks||n.selection.$from.marks())?(n.storedMarks||n.selection.$from.marks()).filter(d=>d.type!==e):n.storedMarks||n.selection.$from.marks(),u=n.tr.setStoredMarks([...l,s]);u=Ac(n,u),o(u);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function mn(e){return (t,n)=>{let{from:o,to:r,empty:i}=t.selection;if(i){if(n){let a=(t.storedMarks||t.selection.$from.marks()).filter(l=>l.type!==e),s=t.tr.setStoredMarks(a);s=Ac(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}function ds(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 er=(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 d of a.marks)i=i.removeMark(l,u,d.type);}}),t(i.scrollIntoView());}return true};var Nc=Ae({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)=>fn(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":prosemirrorCommands.toggleMark(e.schema.marks.underline)}}}});var zc=Ae({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 Oc=Ae({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=wc({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return {commands:{setTextColor:t=>!t.rgb&&!t.themeColor?mn(e.schema.marks.textColor):fn(e.schema.marks.textColor,t),clearTextColor:()=>mn(e.schema.marks.textColor)}}}});var $c=Ae({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: ${chunkIA4LPH2A_cjs.n(t)}`},0]}},onSchemaReady(e){return {commands:{setHighlight:t=>!t||t==="none"?mn(e.schema.marks.highlight):fn(e.schema.marks.highlight,{color:t}),clearHighlight:()=>mn(e.schema.marks.highlight)}}}});var _c=Ae({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=>fn(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>mn(e.schema.marks.fontSize)}}}});var Wc=Ae({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},asciiTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:e=>{let n=e.split(",")[0].trim().replace(/['"]/g,"");return n?{ascii:n}:false}}],toDOM(e){let t=e.attrs,n=t.ascii||t.hAnsi;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},onSchemaReady(e){return {commands:{setFontFamily:t=>fn(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>mn(e.schema.marks.fontFamily)}}}});var Vc=Ae({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 Uc=Ae({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 Mo(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 Io(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}var jc=Ae({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:d,empty:c}=s.selection;if(c)return false;if(l){let f=t.create({href:i,tooltip:a||null}),p=s.tr.addMark(u,d,f),m=s.schema.marks.textColor;m&&(p=p.removeMark(u,d,m)),l(p.scrollIntoView());}return true},o=(i,a)=>{let{from:s,to:l,empty:u}=i.selection;if(u){let d=i.selection.$from;if(!d.marks().find(g=>g.type===t))return false;let p=d.pos,m=d.pos;return d.parent.forEach((g,S)=>{if(g.isText){let C=d.start()+S,x=C+g.nodeSize;C<=d.pos&&d.pos<=x&&g.marks.some(w=>w.type===t)&&(p=Math.min(p,C),m=Math.max(m,x));}}),a&&a(i.tr.removeMark(p,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 d=t.create({href:a,tooltip:s||null}),c=l.schema.text(i,[d]);u(l.tr.replaceSelectionWith(c,false).scrollIntoView());}return true}}}}});var Kc=Ae({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}}});var Gc=Ae({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 Yc=Ae({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]),d=a.tr.replaceSelectionWith(u,false);return s(d.scrollIntoView()),true}}let o=(r,i)=>{let{$from:a,$to:s}=r.selection;if(!i)return true;let l=r.tr,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 bm(e){return e/2*(96/72)}var Xc=Ae({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: ${chunkKR32M3S4_cjs.k(chunkKR32M3S4_cjs.a(t.spacing))}`),o["data-spacing"]=String(t.spacing)),t.position!=null&&t.position!==0){let r=bm(t.position);n.push(`vertical-align: ${chunkKR32M3S4_cjs.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 qc=Ae({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 Zc=Ae({name:"insertion",schemaMarkName:"insertion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-insertion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-insertion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #2e7d32; text-decoration: underline; text-decoration-color: #2e7d32;"},0]}}}),Jc=Ae({name:"deletion",schemaMarkName:"deletion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-deletion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-deletion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #c62828; text-decoration: line-through; text-decoration-color: #c62828;"},0]}}});var Qc=Ae({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]}}}),ed=Ae({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]}}}),td=Ae({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]}}}),nd=Ae({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]}}}),od=Ae({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 rd=Ye({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 id=Ye({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 ad=Ye({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 sd=Ye({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 ym(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 xm(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(c=>`<stop offset="${Math.round(c.position/1e3)}%" stop-color="${c.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 ld=Ye({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,g=t.shadowBlur||4;i.push(`filter: drop-shadow(${m}px ${b}px ${g}px ${t.shadowColor})`);}if(t.glowColor&&t.glowRadius){let m=i.find(g=>g.startsWith("filter:")),b=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(m){let g=i.indexOf(m);i[g]=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=xm(m,t);}else s=t.fillType==="none"?"none":t.fillColor||"#ffffff";let l=t.outlineWidth||1,u=t.outlineColor||"#000000",d=t.outlineStyle==="dashed"?' stroke-dasharray="8 4"':t.outlineStyle==="dotted"?' stroke-dasharray="2 2"':"",c=ym(t.shapeType||"rect",n,o),f=`<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}${d}">`+(a?`<defs>${a}</defs>`:"")+c+"</svg>",p=document.createElement("span");return Object.entries(r).forEach(([m,b])=>{p.setAttribute(m,b);}),p.innerHTML=f,{dom:p}}}});var cd=Ye({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}}});var dd=Ye({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 ud=Ye({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 pd=Ye({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 fd=Ye({name:"math",schemaNodeName:"math",nodeSpec:{inline:true,group:"inline",atom:true,selectable:true,attrs:{display:{default:"inline"},ommlXml:{default:""},plainText:{default:""}},parseDOM:[{tag:"span.docx-math",getAttrs(e){let t=e;return {display:t.dataset.display||"inline",ommlXml:t.dataset.ommlXml||"",plainText:t.textContent||""}}}],toDOM(e){let{display:t,ommlXml:n,plainText:o}=e.attrs,r=o||"[equation]";return ["span",{class:`docx-math docx-math-${t}`,"data-display":t,"data-omml-xml":n,style:'font-style: italic; font-family: "Cambria Math", "Latin Modern Math", serif; background: rgba(200,200,255,0.1); padding: 0 2px; border-radius: 2px;'},r]}}});var Em={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]]}},Mm={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]}},Im={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 md(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=Im[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 gd(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 hd(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 bd(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 Fm={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){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-cell"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=[];return o.push(...gd(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...bd(t)),o.push(...md(t)),o.push(...hd(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]}},Bm={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){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-header"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=["font-weight: bold"];return o.push(...gd(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...bd(t)),o.push(...md(t)),o.push(...hd(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 Ke(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 g=n.node(m-1);if(g&&g.type.name==="tableRow"){let S=0,C=false;g.forEach((x,E,w)=>{C||(w===n.index(m-1)?(s=S,C=true):S+=x.attrs.colspan||1);});}}else if(b.type.name==="tableRow"){let g=n.node(m-1);g&&g.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,d=0;r.forEach(m=>{if(m.type.name==="tableRow"){u++;let b=0;m.forEach(g=>{b+=g.attrs.colspan||1;}),d=Math.max(d,b);}});let c=l&&((l.attrs.colspan||1)>1||(l.attrs.rowspan||1)>1),f,p;if(l){let m=l.attrs;m.backgroundColor&&typeof m.backgroundColor=="string"&&(p=m.backgroundColor);let b=m.borders;if(b)for(let g of ["top","right","bottom","left"]){let S=b[g];if(S?.color&&S.style&&S.style!=="none"&&S.style!=="nil"){f=S.color;break}}}return {isInTable:true,table:r,tablePos:i,rowIndex:a,columnIndex:s,rowCount:u,columnCount:d,hasMultiCellSelection:o,canSplitCell:!!c,cellBorderColor:f,cellBackgroundColor:p}}function tr(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 yd(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 xd(){return (e,t)=>{if(!tr(e))return false;let n=yd(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,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u)));t(d.scrollIntoView());}return true}if(s<r.childCount-1){let u=o.before(n.rowDepth)+i.nodeSize;if(t){let d=u+1+1+1,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d)));t(c.scrollIntoView());}return true}return false}}function Sd(){return (e,t)=>{if(!tr(e))return false;let n=yd(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 d=u+l.nodeSize-2,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(c.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),u=o.before(n.rowDepth)-s.nodeSize;if(t){let c=u+s.nodeSize-1-1,f=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c),-1));t(f.scrollIntoView());}return true}return false}}var Lm=Ye({name:"table",schemaNodeName:"table",nodeSpec:Em}),Dm=Ye({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:Mm}),Am=Ye({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:Fm}),Hm=Ye({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:Bm}),Nm=Ct({name:"tablePlugin",onSchemaReady(e){let{schema:t}=e;function n(...R){return (L,k,P)=>{for(let N of R)if(N(L,k,P))return true;return false}}function o(R,L={}){let k=R?.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,...L}}function r(R,L,k="000000",P=9360){let N=[],v=Math.floor(P/L),q=360,ae="atLeast",$={style:"single",size:4,color:{rgb:k}},U={top:$,bottom:$,left:$,right:$};for(let xe=0;xe<R;xe++){let M=[];for(let W=0;W<L;W++){let O=t.nodes.paragraph.create(),X={colspan:1,rowspan:1,borders:U,width:v,widthType:"dxa"};M.push(t.nodes.tableCell.create(X,O));}N.push(t.nodes.tableRow.create({height:q,heightRule:ae},M));}let Z=Array(L).fill(v);return t.nodes.table.create({columnWidths:Z,width:P,widthType:"dxa"},N)}function i(R,L){return (k,P)=>{let{$from:N}=k.selection,v="000000",q=k.storedMarks||N.marks();for(let $ of q)if($.type.name==="textColor"&&$.attrs.rgb){v=$.attrs.rgb;break}let ae=N.pos;for(let $=N.depth;$>0;$--){let U=N.node($);if(U.type.name==="paragraph"||U.type.name==="table"){ae=N.after($);break}}if(P){let $=9360;for(let Fe=N.depth;Fe>0;Fe--){let ge=N.node(Fe);if(ge.type.name==="tableCell"||ge.type.name==="tableHeader"){let Ee=ge.attrs.width;Ee&&Ee>0&&($=Math.max(Ee-216,360));break}}let U=r(R,L,v,$),Z=t.nodes.paragraph.create(),M=k.doc.resolve(ae).nodeBefore?.type.name==="table",W=M?[Z,U,Z]:[U,Z],O=k.tr.insert(ae,W),X=ae+1;M&&(X+=Z.nodeSize);let fe=X+1+1;O.setSelection(prosemirrorState.TextSelection.create(O.doc,fe)),P(O.scrollIntoView());}return true}}function a(R,L){let k=Ke(R);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(L){let P=R.tr,N=k.table.child(k.rowIndex),v=[];N.forEach($=>{let U=t.nodes.paragraph.create(),Z=o($);v.push(t.nodes.tableCell.create(Z,U));});let q=t.nodes.tableRow.create({height:N.attrs.height??360,heightRule:N.attrs.heightRule??"atLeast"},v),ae=k.tablePos+1;for(let $=0;$<k.rowIndex;$++)ae+=k.table.child($).nodeSize;P.insert(ae,q),L(P.scrollIntoView());}return true}function s(R,L){let k=Ke(R);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(L){let P=R.tr,N=k.table.child(k.rowIndex),v=[];N.forEach($=>{let U=t.nodes.paragraph.create(),Z=o($);v.push(t.nodes.tableCell.create(Z,U));});let q=t.nodes.tableRow.create({height:N.attrs.height??360,heightRule:N.attrs.heightRule??"atLeast"},v),ae=k.tablePos+1;for(let $=0;$<=k.rowIndex;$++)ae+=k.table.child($).nodeSize;P.insert(ae,q),L(P.scrollIntoView());}return true}function l(R,L){let k=Ke(R);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0||(k.rowCount||0)<=1)return false;if(L){let P=R.tr,N=k.tablePos+1;for(let q=0;q<k.rowIndex;q++)N+=k.table.child(q).nodeSize;let v=N+k.table.child(k.rowIndex).nodeSize;P.delete(N,v),L(P.scrollIntoView());}return true}function u(R,L){let k=Ke(R);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(L){let P=R.tr,N=(k.columnCount||1)+1,v=Math.floor(100/N),q=k.tablePos+1;k.table.forEach(U=>{if(U.type.name==="tableRow"){let Z=q+1,xe=0;if(U.forEach(M=>{if(xe===k.columnIndex){let W=t.nodes.paragraph.create(),O=o(M,{colspan:1,rowspan:1});O.width=v,O.widthType="pct";let X=t.nodes.tableCell.create(O,W);P=P.insert(Z,X);}Z+=M.nodeSize,xe+=M.attrs.colspan||1;}),xe<=k.columnIndex){let M=t.nodes.paragraph.create(),W=o(U.child(U.childCount-1)??null,{colspan:1,rowspan:1});W.width=v,W.widthType="pct";let O=t.nodes.tableCell.create(W,M);P=P.insert(Z,O);}}q+=U.nodeSize;});let $=P.doc.nodeAt(k.tablePos);if($&&$.type.name==="table"){let U=$.child(0);if(U&&U.type.name==="tableRow"){let W=k.tablePos+2;U.forEach(O=>{(O.type.name==="tableCell"||O.type.name==="tableHeader")&&(P=P.setNodeMarkup(W,void 0,{...O.attrs,width:v,widthType:"pct"})),W+=O.nodeSize;});}let Z=U?.childCount??N,xe=$.attrs.width||9360,M=Math.floor(xe/Math.max(1,Z));P=P.setNodeMarkup(k.tablePos,void 0,{...$.attrs,columnWidths:Array(Z).fill(M)});}L(P.scrollIntoView());}return true}function d(R,L){let k=Ke(R);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(L){let P=R.tr,N=(k.columnCount||1)+1,v=Math.floor(100/N),q=k.tablePos+1;k.table.forEach(U=>{if(U.type.name==="tableRow"){let Z=q+1,xe=0,M=false;if(U.forEach(W=>{if(Z+=W.nodeSize,xe+=W.attrs.colspan||1,!M&&xe>k.columnIndex){let O=t.nodes.paragraph.create(),X=o(W,{colspan:1,rowspan:1});X.width=v,X.widthType="pct";let ue=t.nodes.tableCell.create(X,O);P=P.insert(Z,ue),M=true;}}),!M){let W=t.nodes.paragraph.create(),O=o(U.child(U.childCount-1)??null,{colspan:1,rowspan:1});O.width=v,O.widthType="pct";let X=t.nodes.tableCell.create(O,W);P=P.insert(Z,X);}}q+=U.nodeSize;});let $=P.doc.nodeAt(k.tablePos);if($&&$.type.name==="table"){let U=$.child(0);if(U&&U.type.name==="tableRow"){let W=k.tablePos+2;U.forEach(O=>{(O.type.name==="tableCell"||O.type.name==="tableHeader")&&(P=P.setNodeMarkup(W,void 0,{...O.attrs,width:v,widthType:"pct"})),W+=O.nodeSize;});}let Z=U?.childCount??N,xe=$.attrs.width||9360,M=Math.floor(xe/Math.max(1,Z));P=P.setNodeMarkup(k.tablePos,void 0,{...$.attrs,columnWidths:Array(Z).fill(M)});}L(P.scrollIntoView());}return true}function c(R,L){let k=Ke(R);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0||(k.columnCount||0)<=1)return false;if(L){let P=R.tr,N=(k.columnCount||2)-1,v=Math.floor(100/N),q=[],ae=k.tablePos+1;k.table.forEach(U=>{if(U.type.name==="tableRow"){let Z=ae+1,xe=0;U.forEach(M=>{let W=Z,O=Z+M.nodeSize,X=M.attrs.colspan||1;xe<=k.columnIndex&&k.columnIndex<xe+X&&q.push({start:W,end:O}),Z=O,xe+=X;});}ae+=U.nodeSize;}),q.reverse().forEach(({start:U,end:Z})=>{P=P.delete(U,Z);});let $=P.doc.nodeAt(k.tablePos);if($&&$.type.name==="table"){let U=$.child(0);if(U&&U.type.name==="tableRow"){let W=k.tablePos+2;U.forEach(O=>{(O.type.name==="tableCell"||O.type.name==="tableHeader")&&(P=P.setNodeMarkup(W,void 0,{...O.attrs,width:v,widthType:"pct"})),W+=O.nodeSize;});}let Z=U?.childCount??N,xe=$.attrs.width||9360,M=Math.floor(xe/Math.max(1,Z));P=P.setNodeMarkup(k.tablePos,void 0,{...$.attrs,columnWidths:Array(Z).fill(M)});}L(P.scrollIntoView());}return true}function f(R,L){let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(L){let P=R.tr;P.delete(k.tablePos,k.tablePos+k.table.nodeSize),L(P.scrollIntoView());}return true}function p(R,L){let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(L){let P=k.tablePos+1,N=R.doc.resolve(P),v=R.doc.resolve(k.tablePos+k.table.nodeSize-2),q=prosemirrorTables.CellSelection.create(R.doc,N.pos,v.pos);L(R.tr.setSelection(q));}return true}function m(R,L){let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table||k.rowIndex===void 0)return false;if(L){let N=k.tablePos+1;for(let U=0;U<k.rowIndex;U++){let Z=k.table.child(U);N+=Z.nodeSize;}let v=k.table.child(k.rowIndex),q=N+1,ae=N+v.nodeSize-2,$=prosemirrorTables.CellSelection.create(R.doc,q,ae);L(R.tr.setSelection($));}return true}function b(R,L){let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table||k.columnIndex===void 0)return false;if(L){let P=k.tablePos+1,N=k.table.child(0),v=k.table.child(k.table.childCount-1),q=P+1;for(let Z=0;Z<k.columnIndex&&Z<N.childCount;Z++)q+=N.child(Z).nodeSize;let ae=P;for(let Z=0;Z<k.table.childCount-1;Z++)ae+=k.table.child(Z).nodeSize;let $=ae+1;for(let Z=0;Z<k.columnIndex&&Z<v.childCount;Z++)$+=v.child(Z).nodeSize;let U=prosemirrorTables.CellSelection.create(R.doc,q,$);L(R.tr.setSelection(U));}return true}function g(R){let L=R.selection,k=[];if(L instanceof prosemirrorTables.CellSelection)return L.forEachCell((N,v)=>{k.push({pos:v,node:N});}),k;let{$from:P}=L;for(let N=P.depth;N>0;N--){let v=P.node(N);if(v.type.name==="tableCell"||v.type.name==="tableHeader"){k.push({pos:P.before(N),node:v});break}}return k}function S(R,L){let k=new Map,P=new Map,N=R.childCount,v=0;return R.forEach((q,ae,$)=>{if(q.type.name!=="tableRow")return;let U=0;q.forEach((Z,xe)=>{let M=L+ae+xe+2,W=Z.attrs.colspan||1;k.set(M,{rowIdx:$,colIdx:U,colspan:W,pos:M,node:Z}),P.set(`${$},${U}`,M),U+=W;}),v=Math.max(v,U);}),{cellByPos:k,cellByRC:P,totalRows:N,totalCols:v}}function C(R,L){return (k,P)=>{let N=Ke(k);if(!N.isInTable||N.tablePos===void 0||!N.table)return false;if(P){let v=k.tr,q=N.table,ae=N.tablePos,$=L??{style:"single",size:4,color:{rgb:"000000"}},U={style:"none"},{cellByPos:Z,cellByRC:xe}=S(q,ae),M=g(k),W=1/0,O=-1,X=1/0,ue=-1;for(let{pos:Ee}of M){let be=Z.get(Ee);be&&(W=Math.min(W,be.rowIdx),O=Math.max(O,be.rowIdx),X=Math.min(X,be.colIdx),ue=Math.max(ue,be.colIdx+be.colspan-1));}let fe=new Map,Fe=(Ee,be)=>fe.get(Ee)??{...be.attrs},ge=(Ee,be)=>{fe.set(Ee,be);};for(let{pos:Ee}of M){let be=Z.get(Ee);if(!be)continue;let tt=be.rowIdx===W,Je=be.rowIdx===O,We=be.colIdx===X,nt=be.colIdx+be.colspan-1===ue,qe;switch(R){case "all":qe={top:$,bottom:$,left:$,right:$};break;case "outside":qe={top:tt?$:U,bottom:Je?$:U,left:We?$:U,right:nt?$:U};break;case "inside":qe={top:tt?U:$,bottom:Je?U:$,left:We?U:$,right:nt?U:$};break;case "none":qe={top:U,bottom:U,left:U,right:U};break}let pt=Fe(Ee,be.node),bt=pt.borders||{};if(ge(Ee,{...pt,borders:{...bt,...qe}}),qe.top){let De=xe.get(`${be.rowIdx-1},${be.colIdx}`);if(De!==void 0){let it=Z.get(De),Ve=Fe(De,it.node),Tt=Ve.borders||{};ge(De,{...Ve,borders:{...Tt,bottom:qe.top}});}}if(qe.bottom){let De=xe.get(`${be.rowIdx+1},${be.colIdx}`);if(De!==void 0){let it=Z.get(De),Ve=Fe(De,it.node),Tt=Ve.borders||{};ge(De,{...Ve,borders:{...Tt,top:qe.bottom}});}}if(qe.left){let De=xe.get(`${be.rowIdx},${be.colIdx-1}`);if(De!==void 0){let it=Z.get(De),Ve=Fe(De,it.node),Tt=Ve.borders||{};ge(De,{...Ve,borders:{...Tt,right:qe.left}});}}if(qe.right){let De=xe.get(`${be.rowIdx},${be.colIdx+be.colspan}`);if(De!==void 0){let it=Z.get(De),Ve=Fe(De,it.node),Tt=Ve.borders||{};ge(De,{...Ve,borders:{...Tt,left:qe.right}});}}}for(let[Ee,be]of fe)v.setNodeMarkup(v.mapping.map(Ee),void 0,be);P(v.scrollIntoView());}return true}}function x(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L),q=R?R.replace(/^#/,""):null;for(let{pos:ae,node:$}of v)N.setNodeMarkup(N.mapping.map(ae),void 0,{...$.attrs,backgroundColor:q});k(N.scrollIntoView());}return true}}function E(R,L,k){return (P,N)=>{let v=Ke(P);if(!v.isInTable||v.tablePos===void 0||!v.table)return false;if(N){let q=P.tr,ae=g(P),$=L||{style:"none"},U={style:"none"},Z=["top","bottom","left","right"],{cellByPos:xe,cellByRC:M}=S(v.table,v.tablePos),W=new Map,O=(fe,Fe)=>W.get(fe)??{...Fe.attrs},X=(fe,Fe)=>W.set(fe,Fe),ue={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:fe,node:Fe}of ae){let ge=xe.get(fe),Ee=O(fe,Fe),be=Ee.borders||{},tt=R==="all"?Z:[R],Je=k?{top:U,bottom:U,left:U,right:U}:{...be};for(let We of tt)Je[We]=$;if(ge){let We=k?Z:tt;for(let nt of We){let qe=Je[nt],pt=ue[nt],bt=nt==="right"?ge.colIdx+ge.colspan:ge.colIdx+pt.dCol,De=M.get(`${ge.rowIdx+pt.dRow},${bt}`);if(De!==void 0){let it=xe.get(De),Ve=O(De,it.node),Tt=Ve.borders||{};X(De,{...Ve,borders:{...Tt,[pt.adjSide]:qe}});}}}X(fe,{...Ee,borders:Je});}for(let[fe,Fe]of W)q.setNodeMarkup(q.mapping.map(fe),void 0,Fe);N(q.scrollIntoView());}return true}}function w(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L);for(let{pos:q,node:ae}of v)N.setNodeMarkup(N.mapping.map(q),void 0,{...ae.attrs,verticalAlign:R});k(N.scrollIntoView());}return true}}function B(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L);for(let{pos:q,node:ae}of v){let U={...ae.attrs.margins||{},...R};N.setNodeMarkup(N.mapping.map(q),void 0,{...ae.attrs,margins:U});}k(N.scrollIntoView());}return true}}function _(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L);for(let{pos:q,node:ae}of v)N.setNodeMarkup(N.mapping.map(q),void 0,{...ae.attrs,textDirection:R});k(N.scrollIntoView());}return true}}function V(){return (R,L)=>{let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(L){let P=R.tr,N=g(R);for(let{pos:v,node:q}of N)P.setNodeMarkup(P.mapping.map(v),void 0,{...q.attrs,noWrap:!q.attrs.noWrap});L(P.scrollIntoView());}return true}}function z(R,L){return (k,P)=>{let N=Ke(k);if(!N.isInTable||N.tablePos===void 0||!N.table)return false;if(P){let v=k.tr,{$from:q}=k.selection;for(let ae=q.depth;ae>0;ae--){let $=q.node(ae);if($.type.name==="tableRow"){let U=q.before(ae),Z={...$.attrs,height:R,heightRule:R?L||"atLeast":null};return v.setNodeMarkup(U,void 0,Z),P(v.scrollIntoView()),true}}}return true}}function A(){return (R,L)=>{let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table||!k.columnCount)return false;if(L){let P=R.tr,N=k.table,v=k.columnCount,q=N.attrs.columnWidths,ae=q?q.reduce((xe,M)=>xe+M,0):9360,$=Math.floor(ae/v),U=k.tablePos+1;N.forEach(xe=>{if(xe.type.name==="tableRow"){let M=U+1;xe.forEach(W=>{(W.type.name==="tableCell"||W.type.name==="tableHeader")&&(P=P.setNodeMarkup(M,void 0,{...W.attrs,width:$,widthType:"dxa",colwidth:null})),M+=W.nodeSize;});}U+=xe.nodeSize;});let Z=Array(v).fill($);P=P.setNodeMarkup(k.tablePos,void 0,{...N.attrs,columnWidths:Z}),L(P.scrollIntoView());}return true}}function Q(){return (R,L)=>{let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(L){let P=R.tr,N=k.table,v=k.tablePos+1;N.forEach(q=>{if(q.type.name==="tableRow"){let ae=v+1;q.forEach($=>{($.type.name==="tableCell"||$.type.name==="tableHeader")&&(P=P.setNodeMarkup(ae,void 0,{...$.attrs,width:null,widthType:null,colwidth:null})),ae+=$.nodeSize;});}v+=q.nodeSize;}),P=P.setNodeMarkup(k.tablePos,void 0,{...N.attrs,columnWidths:null,width:null,widthType:"auto"}),L(P.scrollIntoView());}return true}}function de(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=P.table,q=P.tablePos,ae=v.childCount,$=R.look??{firstRow:true,lastRow:false,noHBand:false},U=R.conditionals??{},Z=R.tableBorders;N=N.setNodeMarkup(q,void 0,{...v.attrs,styleId:R.styleId});let xe=0,M=q+1;for(let W=0;W<ae;W++){let O=v.child(W),X=W===0&&!!$.firstRow,ue=W===ae-1&&!!$.lastRow,fe=$.noHBand!==true,Fe=O.childCount,ge;X?ge="firstRow":ue?ge="lastRow":(fe&&(ge=xe%2===0?"band1Horz":"band2Horz"),xe++);let Ee=M+1;for(let be=0;be<Fe;be++){let tt=O.child(be),Je=N.mapping.map(Ee),We=ge,nt=be===0&&!!$.firstCol,qe=be===Fe-1&&!!$.lastCol;X&&nt&&U.nwCell?We="nwCell":X&&qe&&U.neCell?We="neCell":ue&&nt&&U.swCell?We="swCell":ue&&qe&&U.seCell?We="seCell":nt?We="firstCol":qe&&(We="lastCol");let pt=We?U[We]:void 0,bt={...tt.attrs};pt?.backgroundColor?bt.backgroundColor=pt.backgroundColor:bt.backgroundColor=null;let De={},it=["top","bottom","left","right"];for(let Ve of it)pt?.borders&&pt.borders[Ve]!==void 0?De[Ve]=pt.borders[Ve]:Z&&(Ve==="top"&&W>0||Ve==="bottom"&&W<ae-1?De[Ve]=Z.insideH??Z[Ve]:Ve==="left"&&be>0||Ve==="right"&&be<Fe-1?De[Ve]=Z.insideV??Z[Ve]:De[Ve]=Z[Ve]);Object.keys(De).length>0?bt.borders=De:bt.borders=null,N=N.setNodeMarkup(Je,void 0,bt),Ee+=tt.nodeSize;}M+=O.nodeSize;}k(N.scrollIntoView());}return true}}function H(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v={...P.table.attrs};"width"in R&&(v.width=R.width),"widthType"in R&&(v.widthType=R.widthType),"justification"in R&&(v.justification=R.justification),N.setNodeMarkup(P.tablePos,void 0,v),k(N.scrollIntoView());}return true}}function I(){return (R,L)=>{let k=Ke(R);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(L){let P=R.tr,{$from:N}=R.selection;for(let v=N.depth;v>0;v--){let q=N.node(v);if(q.type.name==="tableRow"){let ae=N.before(v),$={...q.attrs,isHeader:!q.attrs.isHeader};return P.setNodeMarkup(ae,void 0,$),L(P.scrollIntoView()),true}}}return true}}function F(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L),q=R.replace(/^#/,""),ae={style:"single",size:4},{cellByPos:$,cellByRC:U}=S(P.table,P.tablePos),Z=new Map,xe=(O,X)=>Z.get(O)??{...X.attrs},M=(O,X)=>Z.set(O,X),W={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:O,node:X}of v){let ue=$.get(O),fe=xe(O,X),Fe=fe.borders||{},ge={};for(let Ee of ["top","bottom","left","right"]){let be={...ae,...Fe[Ee],color:{rgb:q}};if(ge[Ee]=be,ue){let tt=W[Ee],Je=Ee==="right"?ue.colIdx+ue.colspan:ue.colIdx+tt.dCol,We=U.get(`${ue.rowIdx+tt.dRow},${Je}`);if(We!==void 0){let nt=$.get(We),qe=xe(We,nt.node),pt=qe.borders||{};M(We,{...qe,borders:{...pt,[tt.adjSide]:be}});}}}M(O,{...fe,borders:{...Fe,...ge}});}for(let[O,X]of Z)N.setNodeMarkup(N.mapping.map(O),void 0,X);k(N.scrollIntoView());}return true}}function me(R){return (L,k)=>{let P=Ke(L);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let N=L.tr,v=g(L),q={style:"single",color:{rgb:"000000"}},{cellByPos:ae,cellByRC:$}=S(P.table,P.tablePos),U=new Map,Z=(W,O)=>U.get(W)??{...O.attrs},xe=(W,O)=>U.set(W,O),M={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:W,node:O}of v){let X=ae.get(W),ue=Z(W,O),fe=ue.borders||{},Fe={};for(let ge of ["top","bottom","left","right"]){let Ee={...q,...fe[ge],size:R};if(Fe[ge]=Ee,X){let be=M[ge],tt=ge==="right"?X.colIdx+X.colspan:X.colIdx+be.dCol,Je=$.get(`${X.rowIdx+be.dRow},${tt}`);if(Je!==void 0){let We=ae.get(Je),nt=Z(Je,We.node),qe=nt.borders||{};xe(Je,{...nt,borders:{...qe,[be.adjSide]:Ee}});}}}xe(W,{...ue,borders:{...fe,...Fe}});}for(let[W,O]of U)N.setNodeMarkup(N.mapping.map(W),void 0,O);k(N.scrollIntoView());}return true}}function pe(){return (R,L)=>{let k=R.selection;if(!("$anchorCell"in k&&typeof k.forEachCell=="function"))return false;let N=Ke(R);if(!N.isInTable||N.tablePos===void 0||!N.table)return false;let v=0;N.table.descendants($=>{($.type.name==="tableCell"||$.type.name==="tableHeader")&&(v+=1);});let q=0;if(k.forEachCell(()=>{q+=1;}),!(v>0&&q>=v))return false;if(L){let $=R.tr.delete(N.tablePos,N.tablePos+N.table.nodeSize);L($.scrollIntoView());}return true}}function He(){return R=>{let{$from:L,empty:k}=R.selection;if(!k)return false;let P=L.parent;if(P.type.name!=="paragraph"||P.textContent.length>0)return false;let N=L.depth;if(N<1)return false;let v=L.node(N-1),q=L.index(N-1),ae=q>0?v.child(q-1):null,$=q+1<v.childCount?v.child(q+1):null,U=ae?.type.name==="table",Z=$?.type.name==="table";return !!(U||Z)}}let Ie=new prosemirrorState.PluginKey("activeCell"),je=new prosemirrorState.Plugin({key:Ie,props:{decorations(R){let{selection:L}=R;if(L instanceof prosemirrorTables.CellSelection)return prosemirrorView.DecorationSet.empty;let{$from:k}=L;for(let P=k.depth;P>0;P--){let N=k.node(P);if(N.type.name==="tableCell"||N.type.name==="tableHeader"){let v=k.before(P);return prosemirrorView.DecorationSet.create(R.doc,[prosemirrorView.Decoration.node(v,v+N.nodeSize,{class:"activeCell"})])}}return prosemirrorView.DecorationSet.empty}}});return {plugins:[prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing(),je],keyboardShortcuts:{Backspace:n(pe(),He()),Delete:n(pe(),He())},commands:{insertTable:(R,L)=>i(R,L),addRowAbove:()=>a,addRowBelow:()=>s,deleteRow:()=>l,addColumnLeft:()=>u,addColumnRight:()=>d,deleteColumn:()=>c,deleteTable:()=>f,selectTable:()=>p,selectRow:()=>m,selectColumn:()=>b,mergeCells:()=>prosemirrorTables.mergeCells,splitCell:()=>prosemirrorTables.splitCell,setCellBorder:(R,L,k)=>E(R,L,k),setTableBorders:(R,L)=>C(R,L),setCellVerticalAlign:R=>w(R),setCellMargins:R=>B(R),setCellTextDirection:R=>_(R),toggleNoWrap:()=>V(),setRowHeight:(R,L)=>z(R,L),toggleHeaderRow:()=>I(),distributeColumns:()=>A(),autoFitContents:()=>Q(),setTableProperties:R=>H(R),applyTableStyle:R=>de(R),setCellFillColor:R=>x(R),setTableBorderColor:R=>F(R),setTableBorderWidth:R=>me(R),removeTableBorders:()=>C("none"),setAllTableBorders:R=>C("all",R),setOutsideTableBorders:R=>C("outside",R),setInsideTableBorders:R=>C("inside",R)}}}});function kd(){return [Lm(),Dm(),Am(),Hm(),Nm()]}function fs(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Cd(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,(d,c)=>{if(d.type.name==="paragraph"&&!u.has(c))if(u.add(c),s)l=l.setNodeMarkup(c,void 0,{...d.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});else {let f=e===1;l=l.setNodeMarkup(c,void 0,{...d.attrs,numPr:{numId:e,ilvl:d.attrs.numPr?.ilvl||0},listIsBullet:f,listNumFmt:f?null:"decimal",listMarker:null});}}),n(l.scrollIntoView()),true}}var zm=(e,t)=>Cd(1)(e,t),Om=(e,t)=>Cd(2)(e,t),$m=(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},_m=(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},Wm=(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 Vm(){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 Um(){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 jm(){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 Km(){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 Gm(){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 Ym(){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 Td=Ct({name:"list",priority:pn.High,onSchemaReady(){return {commands:{toggleBulletList:()=>zm,toggleNumberedList:()=>Om,increaseListLevel:()=>$m,decreaseListLevel:()=>_m,removeList:()=>Wm},keyboardShortcuts:{Tab:fs(xd(),Km(),Ym()),"Shift-Tab":fs(Sd(),Gm()),"Shift-Enter":()=>false,Enter:fs(Vm(),Um()),Backspace:jm()}}}});function vd(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}var tg=(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},ng=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],Rd=new Set(["fontFamily","fontSize","textColor"]),og=(e,t,n)=>{let{$from:o}=e.selection,r=o.parent.type.name==="paragraph"?o.parent:null,a=(e.storedMarks||o.marks()).filter(u=>Rd.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:d}=u.selection,c=d.parent;if(c.type.name==="paragraph"){let f={...c.attrs},p=false;if(r)for(let m of ng){let b=r.attrs[m];b!=null&&f[m]==null&&(f[m]=b,p=true);}if(f.borders&&(f.borders=null,p=true),p&&u.setNodeMarkup(d.before(),void 0,f),c.textContent.length===0){let m=a;if(m.length===0&&r){let b=r.attrs.defaultTextFormatting;b&&(m=ds(b,e.schema).filter(S=>Rd.has(S.type.name)));}if(m.length>0){let b={...f.defaultTextFormatting??{}},g=false;for(let S of m)if(S.type.name==="fontSize"&&S.attrs.size!==b.fontSize&&(b.fontSize=S.attrs.size,g=true),S.type.name==="fontFamily"){let C=S.attrs.ascii;C&&(!b.fontFamily||b.fontFamily.ascii!==C)&&(b.fontFamily={...b.fontFamily,ascii:C,hAnsi:S.attrs.hAnsi},g=true);}g&&u.setNodeMarkup(d.before(),void 0,{...f,defaultTextFormatting:b}),u.setStoredMarks(m);}}}t(u.scrollIntoView());}return true},Pd=Ct({name:"baseKeymap",priority:pn.Low,onSchemaReady(e){return {keyboardShortcuts:{...prosemirrorCommands.baseKeymap,Enter:og,Backspace:vd(prosemirrorCommands.deleteSelection,tg,prosemirrorCommands.joinBackward),Delete:vd(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinForward),"Mod-a":prosemirrorCommands.selectAll,Escape:prosemirrorCommands.selectParentNode}}}});var Gr=new prosemirrorState.PluginKey("selectionTracker");function Bo(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((E,w,B)=>{if(w>r)return false;w<=o&&(s=B),w<=r&&(l=B);});let u=ag(e),d=a.parent,c={};d.type.name==="paragraph"&&(d.attrs.alignment&&(c.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(c.lineSpacing=d.attrs.lineSpacing,c.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.indentLeft&&(c.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(c.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(c.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(c.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(c.tabs=d.attrs.tabs),d.attrs.numPr&&(c.numPr=d.attrs.numPr));let f=d.attrs?.numPr,p=!!f?.numId,m=f?.numId===1?"bullet":f?.numId?"numbered":void 0,b=f?.ilvl,g=e.storedMarks||(i?a.marks():[]),S=[],C=false,x=false;for(let E of g)E.type.name==="comment"&&E.attrs.commentId&&S.push(E.attrs.commentId),E.type.name==="insertion"&&(C=true),E.type.name==="deletion"&&(x=true);return {hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:c,startParagraphIndex:s,endParagraphIndex:l,inList:p,listType:m,listLevel:b,activeCommentIds:S,inInsertion:C,inDeletion:x}}function ag(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 Yr(e){return new prosemirrorState.Plugin({key:Gr,state:{init(t,n){return Bo(n)},apply(t,n,o,r){if(!t.selectionSet&&!t.docChanged)return n;let i=Bo(r);return e&&!lg(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=Gr.getState(t.state);o&&e(o);}}}})}function sg(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 lg(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&&sg(e.activeCommentIds,t.activeCommentIds)&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var Ed=Ct({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return {plugins:[Yr(t.onSelectionChange)],commands:{extractSelectionContext:()=>(n,o)=>(Bo(n),true)}}}});var ug=new prosemirrorState.PluginKey("imageDrag"),Id=Ct({name:"imageDrag",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({key:ug,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 Fd=Ct({name:"dropCursor",onSchemaReady(){return {plugins:[prosemirrorDropcursor.dropCursor({color:"var(--doc-primary, #4285f4)",width:2})]}}});var Xr=new prosemirrorState.PluginKey("paragraphChangeTracker");function Bd(e){let t=0;return e.descendants(n=>{n.type.name==="paragraph"&&t++;}),t}function gg(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 hg(){return new prosemirrorState.Plugin({key:Xr,state:{init(e,t){return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:Bd(t.doc)}},apply(e,t){if(e.getMeta(Xr)==="clear")return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:t.paragraphCount};if(!e.docChanged)return t;let n=Bd(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)r.getMap().forEach((a,s,l,u)=>{let{ids:d,hasUntracked:c}=gg(e.doc,l,u);for(let f of d)o.changedParaIds.add(f);c&&(o.hasUntrackedChanges=true);});return o}}})}function ms(e){return Xr.getState(e)}function Ld(e){return ms(e)?.changedParaIds??new Set}function Dd(e){return ms(e)?.structuralChange??false}function Ad(e){return ms(e)?.hasUntrackedChanges??false}function Hd(e){return e.tr.setMeta(Xr,"clear")}var Nd=Ct({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return {plugins:[hg()]}}});var zd=Ct({name:"bidiShortcut",priority:pn.High,onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({props:{handleKeyDown(t,n){if(n.key!=="Shift"||!(n.metaKey||n.ctrlKey))return false;let r=vn.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 Lo(e={}){let t=new Set(e.disable||[]),n=[];function o(r,i){t.has(r)||n.push(i);}return o("doc",Cc()),o("text",Tc()),o("paragraph",Ec()),o("history",Ic({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),o("bold",Bc()),o("italic",Dc()),o("underline",Nc()),o("strike",zc()),o("textColor",Oc()),o("highlight",$c()),o("fontSize",_c()),o("fontFamily",Wc()),o("superscript",Vc()),o("subscript",Uc()),o("hyperlink",jc()),o("allCaps",Kc()),o("smallCaps",Gc()),o("footnoteRef",Yc()),o("characterSpacing",Xc()),o("emboss",Qc()),o("imprint",ed()),o("textShadow",td()),o("emphasisMark",nd()),o("textOutline",od()),o("comment",qc()),o("insertion",Zc()),o("deletion",Jc()),o("hardBreak",rd()),o("tab",id()),o("image",ad()),o("textBox",sd()),o("shape",ld()),o("imageDrag",Id()),o("dropCursor",Fd()),o("horizontalRule",cd()),o("pageBreak",dd()),o("field",ud()),o("sdt",pd()),o("math",fd()),t.has("table")||n.push(...kd()),o("list",Td()),o("baseKeymap",Pd()),o("selectionTracker",Ed({onSelectionChange:e.onSelectionChange})),o("paragraphChangeTracker",Nd()),o("bidiShortcut",zd()),n}var Nn=class{constructor(t){chunkPCJ5ACUV_cjs.d(this,"extensions");chunkPCJ5ACUV_cjs.d(this,"schema",null);chunkPCJ5ACUV_cjs.d(this,"plugins",[]);chunkPCJ5ACUV_cjs.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 qr=new Nn(Lo());qr.buildSchema();qr.initializeRuntime();var vn=qr,Se=qr.getSchema();var Sg={styleId:"Normal",type:"paragraph",name:"Normal",default:true,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},nr=class{constructor(t){chunkPCJ5ACUV_cjs.d(this,"stylesById");chunkPCJ5ACUV_cjs.d(this,"docDefaults");chunkPCJ5ACUV_cjs.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")??Sg}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 zn(e){return new nr(e)}function Qr(e,t){let n=e.package.document.content,o=[],r=t?.styles?zn(t.styles):null;for(let i of n)if(i.type==="paragraph")o.push(...Od(i,r)),Dg(i)&&o.push(Se.node("pageBreak"));else if(i.type==="table"){let a=hs(i,r);o.push(a);}return o.length===0&&o.push(Se.node("paragraph",{},[])),Se.node("doc",null,o)}function gs(e,t,n,o){let r=Cg(e,t),i=[],a,s=new Set,l;t&&(l=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let u=hn(l,o);for(let d of e.content){if(d.type==="commentRangeStart")s.add(d.id);else if(d.type==="commentRangeEnd")s.delete(d.id);else if(d.type==="run"){let c=bs(d,u,t);s.size>0&&(c=kg(c,s)),i.push(...c);}else if(d.type==="hyperlink"){let c=ys(d,u,t);i.push(...c);}else if(d.type==="simpleField"||d.type==="complexField"){let c=Rg(d,u);c&&i.push(c);}else if(d.type==="inlineSdt"){let c=Eg(d,u,t);c&&i.push(c);}else if(d.type==="insertion"){let c=Zr(d,"insertion",u,t);i.push(...c);}else if(d.type==="deletion"){let c=Zr(d,"deletion",u,t);i.push(...c);}else if(d.type==="moveFrom"){let c=Zr(d,"deletion",u,t);i.push(...c);}else if(d.type==="moveTo"){let c=Zr(d,"insertion",u,t);i.push(...c);}else if(d.type==="mathEquation"){let c=Pg(d);c&&i.push(c);}d.type==="bookmarkStart"&&(a||(a=[]),a.push({id:d.id,name:d.name}));}return a&&(r.bookmarks=a),Se.node("paragraph",r,i)}function kg(e,t){if(t.size===0)return e;let n=[...t][0],o=Se.marks.comment.create({commentId:n});return e.map(r=>r.isText?r.mark(o.addToSet(r.marks)):r)}function Zr(e,t,n,o){let r=[];for(let a of e.content)a.type==="run"?r.push(...bs(a,n,o)):a.type==="hyperlink"&&r.push(...ys(a,n,o));let i=Se.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 Cg(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,_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=Jr(n?.runProperties,t);if(r.defaultTextFormatting=hn(s,l),e.sectionProperties?.sectionStart){let u=e.sectionProperties.sectionStart;(u==="nextPage"||u==="continuous"||u==="oddPage"||u==="evenPage")&&(r.sectionBreakType=u);}!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=Jr(n?.runProperties,t);if(e.sectionProperties?.sectionStart){let i=e.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(r.sectionBreakType=i);}return r}function Vt(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=Jr(r.pPr?.runProperties,e),a=Jr(r.rPr,e),s=hn(i,a);return {tcPr:r.tcPr,rPr:s}}function gn(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=hn(e.rPr,t.rPr),n}function Jr(e,t){if(!e)return;if(!e.styleId||!t)return e;let n=t.resolveRunStyle(e.styleId);return hn(n,e)}function Tg(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,d=l.formatting?.vMerge,c=`${r}-${a}`;if(d==="restart")o.set(a,r),t.set(c,{rowSpan:1,skip:false});else if(d==="continue"){let f=o.get(a);if(f!==void 0){let p=`${f}-${a}`,m=t.get(p);m&&m.rowSpan++;}t.set(c,{rowSpan:1,skip:true});}else o.delete(a),t.set(c,{rowSpan:1,skip:false});a+=u;}}return t}function hs(e,t){let n=Tg(e),o=e.columnWidths,r=o?.reduce((x,E)=>x+E,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,d=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,c={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:d,look:e.formatting?.look,_originalFormatting:e.formatting||void 0},f={wholeTable:Vt(t,i,"wholeTable"),firstRow:Vt(t,i,"firstRow"),lastRow:Vt(t,i,"lastRow"),firstCol:Vt(t,i,"firstCol"),lastCol:Vt(t,i,"lastCol"),band1Horz:Vt(t,i,"band1Horz"),band2Horz:Vt(t,i,"band2Horz"),band1Vert:Vt(t,i,"band1Vert"),band2Vert:Vt(t,i,"band2Vert"),nwCell:Vt(t,i,"nwCell"),neCell:Vt(t,i,"neCell"),swCell:Vt(t,i,"swCell"),seCell:Vt(t,i,"seCell")},p=a?.noHBand!==true,m=a?.noVBand!==true,b=0,g=e.rows.length,S=o?.length??e.rows[0]?.cells.reduce((x,E)=>x+(E.formatting?.gridSpan??1),0)??0,C=e.rows.map((x,E)=>{let w=E===0&&!!a?.firstRow,B=E===g-1&&!!a?.lastRow,_=p&&!w&&!B?b%2===0?f.band1Horz:f.band2Horz:void 0;return p&&!w&&!B&&b++,wg(x,t,w,o,r,f,_,m,a,l,E,g,S,n,d)});return Se.node("table",c,C)}function wg(e,t,n,o,r,i,a,s,l,u,d,c,f,p,m){let b={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:n||e.formatting?.header,_originalFormatting:e.formatting||void 0},g=e.cells.length,S=d===0,C=d===(c??1)-1,x=e.formatting?.conditionalFormat,E=x?.firstRow??S,w=x?.lastRow??C,B=f??g,_=0,V=[];for(let z=0;z<e.cells.length;z++){let A=e.cells[z],Q=A.formatting?.gridSpan??1,de=`${d??0}-${_}`,H=p?.get(de),I=H?.skip??false,F=H?.rowSpan??1,me;if(o&&r&&r>0){let q=0;for(let ae=0;ae<Q&&_+ae<o.length;ae++)q+=o[_+ae];me=Math.round(q/r*100);}if(_+=Q,I)continue;let pe=_-Q===0,He=_===B,Ie=A.formatting?.conditionalFormat,je=Ie?.firstRow??E,R=Ie?.lastRow??w,L=Ie?.firstColumn??pe,k=Ie?.lastColumn??He,P;if(s){let q=l?.firstColumn?1:0,ae=_-Q-q;ae>=0&&!(l?.lastColumn&&k)&&!(l?.firstColumn&&L)&&(P=ae%2===0?i?.band1Vert:i?.band2Vert);}Ie?.oddVBand?P=i?.band1Vert:Ie?.evenVBand&&(P=i?.band2Vert);let N=a;x?.oddHBand?N=i?.band1Horz:x?.evenHBand&&(N=i?.band2Horz),Ie?.oddHBand?N=i?.band1Horz:Ie?.evenHBand&&(N=i?.band2Horz);let v=i?.wholeTable;v=gn(v,N),v=gn(v,P),je&&(l?.firstRow||x?.firstRow||Ie?.firstRow)&&(v=gn(v,i?.firstRow)),R&&(l?.lastRow||x?.lastRow||Ie?.lastRow)&&(v=gn(v,i?.lastRow)),L&&(l?.firstColumn||x?.firstColumn||Ie?.firstColumn)&&(v=gn(v,i?.firstCol)),k&&(l?.lastColumn||x?.lastColumn||Ie?.lastColumn)&&(v=gn(v,i?.lastCol)),je&&L&&(l?.firstRow||x?.firstRow||Ie?.firstRow)&&(l?.firstColumn||x?.firstColumn||Ie?.firstColumn)&&(v=gn(v,i?.nwCell)),je&&k&&(l?.firstRow||x?.firstRow||Ie?.firstRow)&&(l?.lastColumn||x?.lastColumn||Ie?.lastColumn)&&(v=gn(v,i?.neCell)),R&&L&&(l?.lastRow||x?.lastRow||Ie?.lastRow)&&(l?.firstColumn||x?.firstColumn||Ie?.firstColumn)&&(v=gn(v,i?.swCell)),R&&k&&(l?.lastRow||x?.lastRow||Ie?.lastRow)&&(l?.lastColumn||x?.lastColumn||Ie?.lastColumn)&&(v=gn(v,i?.seCell)),V.push(vg(A,t,n,me,v,u,S,C,pe,He,F,m));}return Se.node("tableRow",b,V)}function vg(e,t,n,o,r,i,a,s,l,u,d,c){let f=e.formatting,p=d??1,m=f?.width?.value,b=f?.width?.type;m===void 0&&o!==void 0&&(m=o,b="pct");let g=f?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,S=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,x=f?.borders,E=S||C||x?{...S??{},...C??{},...x??{}}:void 0,w={colspan:f?.gridSpan??1,rowspan:p,width:m,widthType:b,verticalAlign:f?.verticalAlign,backgroundColor:g,textDirection:f?.textDirection,noWrap:f?.noWrap,borders:E,margins:f?.margins?{top:f.margins.top?.value,bottom:f.margins.bottom?.value,left:f.margins.left?.value,right:f.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}:c,_originalFormatting:f||void 0},B=[];for(let V of e.content)V.type==="paragraph"?B.push(gs(V,t,void 0,r?.rPr)):V.type==="table"&&B.push(hs(V,t));B.length===0&&B.push(Se.node("paragraph",{},[]));let _=n?"tableHeader":"tableCell";return Se.node(_,w,B)}function Rg(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=hn(t,o),a=xs(i);return Se.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 Pg(e){return Se.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function Eg(e,t,n){let o=e.properties,r=[];for(let i of e.content)if(i.type==="run"){let a=bs(i,t,n);r.push(...a);}else if(i.type==="hyperlink"){let a=ys(i,t,n);r.push(...a);}return Se.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 bs(e,t,n){let o=[],r=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=hn(hn(t,r),e.formatting),a=xs(i);for(let s of e.content){let l=Mg(s,a);o.push(...l);}return o}function hn(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 Mg(e,t){switch(e.type){case "text":return e.text?[Se.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[Se.node("hardBreak")]:[];case "tab":return [Se.node("tab")];case "drawing":return e.image?[Ig(e.image)]:[];case "shape":{let r=e.shape;return r.textBody&&r.textBody.content.length>0?[]:[Fg(r)]}case "footnoteRef":let n=Se.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [Se.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=Se.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [Se.text(e.id.toString(),[...t,o])];default:return []}}function Ig(e){let t=e.size?.width?chunkKR32M3S4_cjs.c(e.size.width):void 0,n=e.size?.height?chunkKR32M3S4_cjs.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 S=[];e.transform.rotation&&S.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&S.push("scaleX(-1)"),e.transform.flipV&&S.push("scaleY(-1)"),S.length>0&&(l=S.join(" "));}let u=e.wrap.distT?chunkKR32M3S4_cjs.c(e.wrap.distT):void 0,d=e.wrap.distB?chunkKR32M3S4_cjs.c(e.wrap.distB):void 0,c=e.wrap.distL?chunkKR32M3S4_cjs.c(e.wrap.distL):void 0,f=e.wrap.distR?chunkKR32M3S4_cjs.c(e.wrap.distR):void 0,p;e.position&&(p={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0});let m,b,g;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 S={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};g=e.outline.style&&S[e.outline.style]||"solid";}return Se.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:d,distLeft:c,distRight:f,position:p,borderWidth:m,borderColor:b,borderStyle:g,wrapText:r,hlinkHref:e.hlinkHref})}function ys(e,t,n){let o=[],r=e.href||(e.anchor?`#${e.anchor}`:""),i=Se.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=hn(hn(t,s),a.formatting),d=[...xs(l),i];for(let c of a.content)c.type==="text"&&c.text&&o.push(Se.text(c.text,d));}return o}function xs(e){if(!e)return [];let t=[];return e.bold&&t.push(Se.mark("bold")),e.italic&&t.push(Se.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(Se.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(Se.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(Se.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(Se.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(Se.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(Se.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"?t.push(Se.mark("superscript")):e.vertAlign==="subscript"&&t.push(Se.mark("subscript")),e.allCaps&&t.push(Se.mark("allCaps")),e.smallCaps&&t.push(Se.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&t.push(Se.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(Se.mark("emboss")),e.imprint&&t.push(Se.mark("imprint")),e.shadow&&t.push(Se.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(Se.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(Se.mark("textOutline")),t}function Fg(e){let t=e.size?.width?chunkKR32M3S4_cjs.c(e.size.width):100,n=e.size?.height?chunkKR32M3S4_cjs.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 f=e.fill.gradient;i=f.type,a=f.angle,s=JSON.stringify(f.stops.map(p=>({position:p.position,color:p.color.rgb?`#${p.color.rgb}`:"#000000"})));}let l,u,d;e.outline&&(e.outline.width&&(l=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`),d=e.outline.style||"solid");let c;if(e.transform){let f=[];e.transform.rotation&&f.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&f.push("scaleX(-1)"),e.transform.flipV&&f.push("scaleY(-1)"),f.length>0&&(c=f.join(" "));}return Se.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:d,transform:c})}function Od(e,t){let n=Bg(e),o=gs(e,t),r=[];n.length>0&&o.content.size===0||r.push(o);for(let a of n)r.push(Lg(a,t));return r}function Bg(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 Lg(e,t){let n=e.size?.width?chunkKR32M3S4_cjs.c(e.size.width):200,o=e.size?.height?chunkKR32M3S4_cjs.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?chunkKR32M3S4_cjs.c(e.margins.top):4,u=e.margins?.bottom!=null?chunkKR32M3S4_cjs.c(e.margins.bottom):4,d=e.margins?.left!=null?chunkKR32M3S4_cjs.c(e.margins.left):7,c=e.margins?.right!=null?chunkKR32M3S4_cjs.c(e.margins.right):7,f=[];for(let p of e.content)f.push(gs(p,t));return f.length===0&&f.push(Se.node("paragraph",{},[])),Se.node("textBox",{width:n,height:o,textBoxId:e.id,fillColor:r,outlineWidth:i,outlineColor:a,outlineStyle:s,marginTop:l,marginBottom:u,marginLeft:d,marginRight:c},f)}function Ss(e,t){let n=[],o=t?.styles?zn(t.styles):null;for(let r of e)r.type==="paragraph"?n.push(...Od(r,o)):r.type==="table"&&n.push(hs(r,o));return n.length===0&&n.push(Se.node("paragraph",{},[])),Se.node("doc",null,n)}function Dg(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 ei(){return Se.node("doc",null,[Se.node("paragraph",{},[])])}function ti(e,t){let o={content:_d(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 _d(e){let t=[],n=Vd(e);return e.forEach(o=>{o.type.name==="paragraph"?t.push(ks(o,n)):o.type.name==="table"?t.push(jd(o,n)):o.type.name==="textBox"?t.push(th(o)):o.type.name==="pageBreak"&&t.push(Ag());}),t}function Ag(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function ks(e,t){let n=e.attrs,o=Hg(Wd(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:Ng(n),content:o};return n.sectionBreakType&&(i.sectionProperties={sectionStart:n.sectionBreakType}),i}function Hg(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 Ng(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 Wd(e,t){let n=[],o=t??Vd(e),r=null,i=null,a=null;return e.forEach(s=>{let l=s.marks.find(f=>f.type.name==="footnoteRef");if(l){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let p={type:l.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(l.attrs.id,10)||0};n.push({type:"run",content:[p]});return}let u=s.marks.find(f=>f.type.name==="insertion"),d=s.marks.find(f=>f.type.name==="deletion");if(u||d){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let f=u||d,p=s.marks.filter(w=>w.type.name!=="insertion"&&w.type.name!=="deletion"),m=Cs(p),b={type:"run",content:s.isText&&s.text?[{type:"text",text:s.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}},g={id:f.attrs.revisionId,author:f.attrs.author||"Unknown",date:f.attrs.date||void 0},S=g.id,C=(o.insertionById.get(S)??0)>0,x=(o.deletionById.get(S)??0)>0,E=C&&x;u?E?n.push({type:"moveTo",info:g,content:[b]}):n.push({type:"insertion",info:g,content:[b]}):E?n.push({type:"moveFrom",info:g,content:[b]}):n.push({type:"deletion",info:g,content:[b]});return}let c=s.marks.find(f=>f.type.name==="hyperlink");if(c){let f=zg(c),p=a?.href||(a?.anchor?`#${a.anchor}`:"");a&&p===f||(r&&(n.push(r),r=null,i=null),a&&n.push(a),a=$g(c)),$d(a,s);return}if(a&&(n.push(a),a=null),s.isText){let f=Og(s.marks);r&&i===f?_g(r,s.text||""):(r&&n.push(r),r=Ud(s.text||"",s.marks),i=f);}else s.type.name==="hardBreak"?(r&&(n.push(r),r=null,i=null),n.push(Wg())):s.type.name==="image"?(r&&(n.push(r),r=null,i=null),n.push(Gg(s))):s.type.name==="shape"?(r&&(n.push(r),r=null,i=null),n.push(Yg(s))):s.type.name==="tab"?(r&&(n.push(r),r=null,i=null),n.push(Vg())):s.type.name==="field"?(r&&(n.push(r),r=null,i=null),n.push(Ug(s,s.marks))):s.type.name==="sdt"?(r&&(n.push(r),r=null,i=null),n.push(Kg(s))):s.type.name==="math"&&(r&&(n.push(r),r=null,i=null),n.push(jg(s)));}),r&&n.push(r),a&&n.push(a),n}function Vd(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 zg(e){return e.attrs.href||""}function Og(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 $g(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 $d(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Ud(t.text,n);e.children.push(o);}}function Ud(e,t){let n=Cs(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function _g(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 Wg(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function Vg(){return {type:"run",content:[{type:"tab"}]}}function Ug(e,t){let n=e.attrs,o=t&&t.length>0?Cs(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 jg(e){let t=e.attrs;return {type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function Kg(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=Wd(e).filter(i=>i.type==="run"||i.type==="hyperlink");return {type:"inlineSdt",properties:n,content:r}}function Gg(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:chunkKR32M3S4_cjs.d(t.width||0),height:chunkKR32M3S4_cjs.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 Yg(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 Cs(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,cs:o.ascii||void 0,asciiTheme:o.asciiTheme};break}case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break;case "allCaps":t.allCaps=true;break;case "smallCaps":t.smallCaps=true;break;case "characterSpacing":{n.attrs.spacing!=null&&(t.spacing=n.attrs.spacing),n.attrs.position!=null&&(t.position=n.attrs.position),n.attrs.scale!=null&&(t.scale=n.attrs.scale),n.attrs.kerning!=null&&(t.kerning=n.attrs.kerning);break}case "emboss":t.emboss=true;break;case "imprint":t.imprint=true;break;case "textShadow":t.shadow=true;break;case "emphasisMark":t.emphasisMark=n.attrs.type||"dot";break;case "textOutline":t.outline=true;break}return t}function Xg(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 jd(e,t){let n=e.attrs,o=[];e.forEach(i=>{i.type.name==="tableRow"&&o.push(Zg(i,t));});let r=qg(n)||void 0;if(!r?.borders){let i=Xg(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 qg(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 Zg(e,t){let n=e.attrs,o=[];return e.forEach(r=>{(r.type.name==="tableCell"||r.type.name==="tableHeader")&&o.push(Qg(r,t));}),{type:"tableRow",formatting:Jg(n),cells:o}}function Jg(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 Qg(e,t){let n=e.attrs,o=[];return e.forEach(r=>{r.type.name==="paragraph"?o.push(ks(r,t)):r.type.name==="table"&&o.push(jd(r,t));}),{type:"tableCell",formatting:eh(n),content:o}}function eh(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 th(e){let t=e.attrs,n=[];e.forEach(a=>{a.type.name==="paragraph"&&n.push(ks(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 or(e){return _d(e)}function Do(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((g,S,C)=>{S<=o&&(s=C),S<=r&&(l=C);});let u={},d=a.parent,c=d.type.name==="paragraph"&&d.textContent.length===0,f=d.attrs?.defaultTextFormatting,p=e.storedMarks||t.$from.marks();c&&p.length===0&&f&&(u={...f});for(let g of p)switch(g.type.name){case "bold":u.bold=true;break;case "italic":u.italic=true;break;case "underline":u.underline={style:g.attrs.style||"single",color:g.attrs.color};break;case "strike":g.attrs.double?u.doubleStrike=true:u.strike=true;break;case "textColor":u.color={rgb:g.attrs.rgb,themeColor:g.attrs.themeColor};break;case "highlight":u.highlight=g.attrs.color;break;case "fontSize":u.fontSize=g.attrs.size;break;case "fontFamily":u.fontFamily={ascii:g.attrs.ascii,hAnsi:g.attrs.hAnsi};break;case "superscript":u.vertAlign="superscript";break;case "subscript":u.vertAlign="subscript";break}let m={},b=null;return d.type.name==="paragraph"&&(d.attrs.alignment&&(m.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(m.lineSpacing=d.attrs.lineSpacing,m.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.numPr&&(m.numPr=d.attrs.numPr),d.attrs.indentLeft&&(m.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(m.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(m.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(m.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(m.tabs=d.attrs.tabs),d.attrs.bidi&&(m.bidi=true),d.attrs.styleId&&(b=d.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:m,styleId:b,startParagraphIndex:s,endParagraphIndex:l}}var Rt=vn.getCommands(),ni=Rt.toggleBold(),oi=Rt.toggleItalic(),ri=Rt.toggleUnderline(),ii=Rt.toggleStrike(),ai=Rt.toggleSuperscript(),si=Rt.toggleSubscript();function rr(e){return Rt.setTextColor(e)}var li=Rt.clearTextColor();function ci(e){return Rt.setHighlight(e)}Rt.clearHighlight();function di(e){return Rt.setFontSize(e)}Rt.clearFontSize();function ui(e){return Rt.setFontFamily(e)}Rt.clearFontFamily();function pi(e,t){return Rt.setHyperlink(e,t)}var fi=Rt.removeHyperlink();function ir(e,t,n){return Rt.insertHyperlink(e,t,n)}var rt=vn.getCommands();function mi(e){return rt.setAlignment(e)}rt.alignLeft();rt.alignCenter();rt.alignRight();rt.alignJustify();function gi(e,t="auto"){return rt.setLineSpacing(e,t)}rt.singleSpacing();rt.oneAndHalfSpacing();rt.doubleSpacing();function hi(e=720){return rt.increaseIndent(e)}function bi(e=720){return rt.decreaseIndent(e)}function yi(e){return rt.setIndentLeft(e)}function xi(e){return rt.setIndentRight(e)}function ar(e,t){return rt.setIndentFirstLine(e,t)}var Si=rt.toggleBulletList(),ki=rt.toggleNumberedList(),Ci=rt.increaseListLevel(),Ti=rt.decreaseListLevel();rt.removeList();function sr(e,t){return rt.applyStyle(e,t)}rt.clearStyle();rt.removeSectionBreak();function wi(e){return rt.removeTabStop(e)}var vi=rt.setRtl(),Ri=rt.setLtr(),Pi=rt.generateTOC();var Xe=vn.getCommands();function Ei(e,t){return Xe.insertTable(e,t)}function Mi(e,t){return Xe.addRowAbove()(e,t)}function Ao(e,t){return Xe.addRowBelow()(e,t)}function Ii(e,t){return Xe.deleteRow()(e,t)}function Fi(e,t){return Xe.addColumnLeft()(e,t)}function Ho(e,t){return Xe.addColumnRight()(e,t)}function Bi(e,t){return Xe.deleteColumn()(e,t)}function lr(e,t){return Xe.deleteTable()(e,t)}function Li(e,t){return Xe.selectTable()(e,t)}function Di(e,t){return Xe.selectRow()(e,t)}function Ai(e,t){return Xe.selectColumn()(e,t)}function Hi(e,t){return Xe.mergeCells()(e,t)}function Ni(e,t){return Xe.splitCell()(e,t)}function On(e,t,n){return Xe.setCellBorder(e,t,n)}function zi(e,t){return Xe.removeTableBorders()(e,t)}function Oi(e,t,n){return Xe.setAllTableBorders(n)(e,t)}function $i(e,t,n){return Xe.setOutsideTableBorders(n)(e,t)}function _i(e,t,n){return Xe.setInsideTableBorders(n)(e,t)}function Wi(e){return Xe.setCellVerticalAlign(e)}function Vi(e){return Xe.setCellMargins(e)}function Ui(e){return Xe.setCellTextDirection(e)}function ji(){return Xe.toggleNoWrap()}function Ki(e,t){return Xe.setRowHeight(e,t)}function Gi(){return Xe.toggleHeaderRow()}function Yi(){return Xe.distributeColumns()}function Xi(){return Xe.autoFitContents()}function cr(e){return Xe.setTableProperties(e)}function qi(e){return Xe.applyTableStyle(e)}function Zi(e){return Xe.setCellFillColor(e)}function Ji(e){return Xe.setTableBorderColor(e)}function Qi(e){return Xe.setTableBorderWidth(e)}var ea=(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 d=a.mapping.map(i.pos);a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}else if(i.parentOffset===i.parent.content.size){let d=i.after();a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}else {let d=i.before();a.insert(d,s),u=d+l+1;}else {let d=i.pos;a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}a.setSelection(prosemirrorState.TextSelection.create(a.doc,u)),t(a.scrollIntoView());}return true};function lu(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,d=[];o.doc.nodesBetween(e,t,(c,f)=>{if(!c.isText)return;let p=f+c.nodeSize,m=Math.max(e,f),b=Math.min(t,p);l&&c.marks.some(g=>g.type===l)&&d.push({from:m,to:b}),s&&c.marks.some(g=>g.type===s)&&u.removeMark(m,b,s);});for(let c of d.reverse())u.delete(c.from,c.to);u.steps.length>0&&r(u);}return true}}function ws(e,t){return lu(e,t,"accept")}function vs(e,t){return lu(e,t,"reject")}var du={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 0",fontSize:11,color:"#4285f4",userSelect:"none"},uu={fontWeight:500,letterSpacing:.3},xh={background:"none",border:"none",color:"#4285f4",cursor:"pointer",fontSize:11,padding:"2px 6px",borderRadius:3},Sh={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"},ta={display:"block",width:"100%",padding:"6px 12px",border:"none",background:"none",textAlign:"left",cursor:"pointer",fontSize:12,color:"#3c4043"},fu=Ap.forwardRef(function({headerFooter:t,position:n,styles:o,targetElement:r,parentElement:i,onSave:a,onClose:s,onSelectionChange:l,onRemove:u},d){let c=Ap.useRef(null),f=Ap.useRef(null),[p,m]=Ap.useState(false),[b,g]=Ap.useState(false),S=Ap.useRef(null),[C,x]=Ap.useState(null);Ap.useLayoutEffect(()=>{let V=()=>{let A=i.getBoundingClientRect(),Q=r.getBoundingClientRect();x({top:Q.top-A.top+i.scrollTop,left:Q.left-A.left+i.scrollLeft,width:Q.width});};V();let z=i.closest('[style*="overflow"]')||i;return z.addEventListener("scroll",V),window.addEventListener("resize",V),()=>{z.removeEventListener("scroll",V),window.removeEventListener("resize",V);}},[r,i]),Ap.useEffect(()=>{if(!c.current||f.current)return;let V=Ss(t.content,{styles:o||void 0}),z=new Nn(Lo());z.buildSchema(),z.initializeRuntime();let A=z.getPlugins(),Q=prosemirrorState.EditorState.create({doc:V,schema:Se,plugins:A}),de=new prosemirrorView.EditorView(c.current,{state:Q,dispatchTransaction(H){let I=de.state.apply(H);if(de.updateState(I),H.docChanged&&m(true),H.selectionSet||H.docChanged){let F=Do(I);l?.(F);}}});return f.current=de,requestAnimationFrame(()=>{de.focus();let H=Do(de.state);l?.(H);}),()=>{de.destroy(),f.current=null;}},[C]);let E=Ap.useCallback(()=>{if(!f.current)return;let V=or(f.current.state.doc);a(V);},[a]),w=Ap.useCallback(()=>{p?E():s();},[p,E,s]);Ap.useEffect(()=>{function V(z){z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),w());}return document.addEventListener("keydown",V,true),()=>document.removeEventListener("keydown",V,true)},[w]),Ap.useEffect(()=>{if(!b)return;function V(z){S.current&&!S.current.contains(z.target)&&g(false);}return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[b]),Ap.useImperativeHandle(d,()=>({getView:()=>f.current,focus:()=>f.current?.focus(),undo:()=>{let V=f.current;return V?prosemirrorHistory.undo(V.state,V.dispatch):false},redo:()=>{let V=f.current;return V?prosemirrorHistory.redo(V.state,V.dispatch):false}}));let B=n==="header"?"Header":"Footer";if(!C)return null;let _={position:"absolute",top:C.top,left:C.left,width:C.width,zIndex:10};return jsxRuntime.jsxs("div",{className:"hf-inline-editor",style:_,onMouseDown:V=>{V.stopPropagation();},children:[n==="footer"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:du,children:[jsxRuntime.jsx("span",{style:uu,children:B}),jsxRuntime.jsx(pu,{label:B,showOptions:b,setShowOptions:g,optionsRef:S,onRemove:u,onClose:w,viewRef:f})]}),jsxRuntime.jsx("div",{ref:c,className:"hf-editor-pm",style:{minHeight:40,outline:"none"}}),n==="header"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:du,children:[jsxRuntime.jsx("span",{style:uu,children:B}),jsxRuntime.jsx(pu,{label:B,showOptions:b,setShowOptions:g,optionsRef:S,onRemove:u,onClose:w,viewRef:f})]})]})});function pu({label:e,showOptions:t,setShowOptions:n,optionsRef:o,onRemove:r,onClose:i,viewRef:a}){let s=l=>{let u=a.current;if(!u)return;let{$from:d,from:c}=u.state.selection,f=u.state.storedMarks||d.marks(),p=Se.nodes.field.create({fieldType:l,instruction:` ${l} \\* MERGEFORMAT `,fieldKind:"simple",dirty:true}),m=u.state.tr.insert(c,p.mark(f));u.dispatch(m),u.focus();};return jsxRuntime.jsxs("div",{style:{position:"relative"},ref:o,children:[jsxRuntime.jsx("button",{type:"button",style:xh,onClick:l=>{l.stopPropagation(),n(u=>!u);},onMouseDown:l=>l.stopPropagation(),children:"Options \u25BE"}),t&&jsxRuntime.jsxs("div",{style:Sh,children:[jsxRuntime.jsx("button",{type:"button",style:ta,onClick:()=>{n(false),s("PAGE");},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:"Insert current page number"}),jsxRuntime.jsx("button",{type:"button",style:ta,onClick:()=>{n(false),s("NUMPAGES");},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:"Insert total page count"}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid #e8eaed",margin:"4px 0"}}),r&&jsxRuntime.jsxs("button",{type:"button",style:ta,onClick:()=>{n(false),r();},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:["Remove ",e.toLowerCase()]}),jsxRuntime.jsxs("button",{type:"button",style:ta,onClick:()=>{n(false),i();},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:["Close ",e.toLowerCase()," editing"]})]})]})}var bu={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"},Ch={...bu,padding:"8px 12px",display:"flex",alignItems:"center",gap:"8px",maxWidth:"400px"},Th={...bu,padding:"12px",width:"320px"},Fs={width:"20px",height:"20px",flexShrink:0,color:"#5f6368",display:"flex",alignItems:"center",justifyContent:"center"},wh={color:"#1a73e8",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"220px",fontSize:"14px",lineHeight:"20px",cursor:"pointer"},vh={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"none",borderRadius:"4px",cursor:"pointer",color:"#5f6368",padding:0,flexShrink:0},Rh={width:"1px",height:"20px",background:"#dadce0",flexShrink:0},gu={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},hu={flex:1,padding:"6px 8px",border:"1px solid #dadce0",borderRadius:"4px",fontSize:"14px",outline:"none",lineHeight:"20px"},Ph={color:"#1a73e8",fontWeight:600,fontSize:"14px",border:"none",background:"none",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",flexShrink:0},No={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function Eh(){return jsxRuntime.jsxs("svg",{...No,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 Mh(){return jsxRuntime.jsxs("svg",{...No,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 Ih(){return jsxRuntime.jsx("svg",{...No,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 Fh(){return jsxRuntime.jsxs("svg",{...No,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 Bh(){return jsxRuntime.jsxs("svg",{...No,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 Lh(){return jsxRuntime.jsxs("svg",{...No,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 Bs({title:e,onClick:t,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"ep-hyperlink-popup__icon-btn",style:vh,title:e,onClick:t,children:n})}function yu({data:e,onNavigate:t,onCopy:n,onEdit:o,onRemove:r,onClose:i,readOnly:a}){let[s,l]=Ap.useState("view"),[u,d]=Ap.useState(""),[c,f]=Ap.useState(""),p=Ap.useRef(null),m=Ap.useRef(null);Ap.useEffect(()=>{e&&(l("view"),d(e.displayText),f(e.href));},[e]),Ap.useEffect(()=>{s==="edit"&&requestAnimationFrame(()=>{m.current?.focus(),m.current?.select();});},[s]),Ap.useEffect(()=>{if(!e)return;let B=false,_=z=>{p.current&&!p.current.contains(z.target)&&i();},V=setTimeout(()=>{B||document.addEventListener("mousedown",_);},0);return ()=>{B=true,clearTimeout(V),document.removeEventListener("mousedown",_);}},[e,i]),Ap.useEffect(()=>{if(!e)return;let B=_=>{_.key==="Escape"&&(s==="edit"?l("view"):i());};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,s,i]);let b=Ap.useCallback(()=>{e&&(n(e.href),sonner.toast("Link copied to clipboard"));},[e,n]),g=Ap.useCallback(()=>{e&&(d(e.displayText),f(e.href),l("edit"));},[e]),S=Ap.useCallback(()=>{let B=c.trim();B&&o(u.trim()||B,B);},[u,c,o]),C=Ap.useCallback(B=>{B.key==="Enter"&&(B.preventDefault(),S());},[S]);if(!e)return null;let{anchorRect:x}=e,E=x.bottom+4,w=x.left;return s==="edit"?jsxRuntime.jsxs("div",{ref:p,className:"ep-hyperlink-popup ep-hyperlink-popup--edit",style:{...Th,top:E,left:w},onMouseDown:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:gu,children:[jsxRuntime.jsx("span",{style:Fs,children:jsxRuntime.jsx(Bh,{})}),jsxRuntime.jsx("input",{ref:m,type:"text",style:hu,value:u,onChange:B=>d(B.target.value),onKeyDown:C,placeholder:"Display text",onFocus:B=>B.target.style.borderColor="#1a73e8",onBlur:B=>B.target.style.borderColor="#dadce0"})]}),jsxRuntime.jsxs("div",{style:{...gu,marginBottom:0},children:[jsxRuntime.jsx("span",{style:Fs,children:jsxRuntime.jsx(Lh,{})}),jsxRuntime.jsx("input",{type:"text",style:hu,value:c,onChange:B=>f(B.target.value),onKeyDown:C,placeholder:"https://example.com",onFocus:B=>B.target.style.borderColor="#1a73e8",onBlur:B=>B.target.style.borderColor="#dadce0"}),jsxRuntime.jsx("button",{type:"button",style:{...Ph,opacity:c.trim()?1:.5,cursor:c.trim()?"pointer":"default"},onClick:S,disabled:!c.trim(),children:"Apply"})]})]}):jsxRuntime.jsxs("div",{ref:p,className:"ep-hyperlink-popup",style:{...Ch,top:E,left:w},onMouseDown:B=>B.stopPropagation(),children:[jsxRuntime.jsx("span",{style:Fs,children:jsxRuntime.jsx(Eh,{})}),jsxRuntime.jsx("a",{href:e.href,style:wh,title:e.href,target:"_blank",rel:"noopener noreferrer",onClick:B=>{B.preventDefault(),t(e.href);},children:e.href}),jsxRuntime.jsx("span",{style:Rh}),jsxRuntime.jsx(Bs,{title:"Copy link",onClick:b,children:jsxRuntime.jsx(Mh,{})}),!a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bs,{title:"Edit link",onClick:g,children:jsxRuntime.jsx(Ih,{})}),jsxRuntime.jsx(Bs,{title:"Remove link",onClick:r,children:jsxRuntime.jsx(Fh,{})})]})]})}var ve=e=>({style:"single",size:4,color:{rgb:e}}),Ah=[{id:"TableNormal",name:"Normal Table",look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:ve("000000"),bottom:ve("000000"),left:ve("000000"),right:ve("000000"),insideH:ve("000000"),insideV:ve("000000")},look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:ve("BFBFBF"),bottom:ve("BFBFBF"),left:ve("BFBFBF"),right:ve("BFBFBF"),insideH:ve("BFBFBF"),insideV:ve("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ve("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:ve("BFBFBF"),bottom:ve("BFBFBF"),insideH:ve("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:ve("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:ve("B4C6E7"),bottom:ve("B4C6E7"),left:ve("B4C6E7"),right:ve("B4C6E7"),insideH:ve("B4C6E7"),insideV:ve("B4C6E7")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ve("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:ve("4472C4"),bottom:ve("4472C4"),left:ve("4472C4"),right:ve("4472C4"),insideH:ve("4472C4"),insideV:ve("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:ve("FFFFFF"),bottom:ve("FFFFFF"),left:ve("FFFFFF"),right:ve("FFFFFF"),insideH:ve("FFFFFF"),insideV:ve("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:ve("ED7D31"),bottom:ve("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:ve("A5A5A5"),bottom:ve("A5A5A5"),insideH:ve("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:ve("5B9BD5"),bottom:ve("5B9BD5"),left:ve("5B9BD5"),right:ve("5B9BD5"),insideH:ve("5B9BD5"),insideV:ve("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:ve("70AD47"),bottom:ve("70AD47"),left:ve("70AD47"),right:ve("70AD47"),insideH:ve("70AD47"),insideV:ve("70AD47")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function xu(e){return Ah.find(t=>t.id===e)}function Su(){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
- @keyframes docx-spin {
16
- to { transform: rotate(360deg); }
17
- }
18
- `}),jsxRuntime.jsx("div",{style:{fontSize:"14px"},children:"Loading document..."})]})}function ku(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[jsxRuntime.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"No document loaded"})]})}function Cu({message:e}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",marginBottom:"16px"},children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 8v4M12 16v.01"})]})}),jsxRuntime.jsx("h3",{style:{color:"var(--doc-error)",marginBottom:"8px"},children:"Failed to Load Document"}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function Nh(e,t){return JSON.stringify(e)===JSON.stringify(t)}function zh(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=Nh,onUndo:a,onRedo:s,containerRef:l}=t,[u,d]=Ap.useState(e),[c,f]=Ap.useState([]),[p,m]=Ap.useState([]),b=Ap.useRef(0),g=Ap.useRef(false),S=Ap.useCallback((z,A)=>{if(i(u,z))return;if(g.current){d(z);return}let Q=Date.now();Q-b.current<o&&c.length>0?f(H=>{let I=[...H];return I[I.length-1]={state:u,timestamp:Q,description:A||I[I.length-1].description},I}):f(H=>{let I={state:u,timestamp:Q,description:A},F=[...H,I];return F.length>n?F.slice(F.length-n):F}),m([]),d(z),b.current=Q;},[u,i,o,n,c.length]),C=Ap.useCallback(()=>{if(c.length===0)return;g.current=true;let z=c[c.length-1];return f(A=>A.slice(0,-1)),m(A=>[...A,{state:u,timestamp:Date.now()}]),d(z.state),setTimeout(()=>{g.current=false;},0),a?.(z.state),z.state},[c,u,a]),x=Ap.useCallback(()=>{if(p.length===0)return;g.current=true;let z=p[p.length-1];return m(A=>A.slice(0,-1)),f(A=>[...A,{state:u,timestamp:Date.now()}]),d(z.state),setTimeout(()=>{g.current=false;},0),s?.(z.state),z.state},[p,u,s]),E=Ap.useCallback(()=>{f([]),m([]);},[]),w=Ap.useCallback(z=>{d(z??e),f([]),m([]),b.current=0;},[e]),B=Ap.useCallback(()=>[...c],[c]),_=Ap.useCallback(()=>[...p],[p]),V=Ap.useCallback(z=>{d(A=>z(A)),f(A=>A.map(Q=>({...Q,state:z(Q.state)}))),m(A=>A.map(Q=>({...Q,state:z(Q.state)})));},[]);return Ap.useEffect(()=>{if(!r)return;let z=Q=>{if((Q.ctrlKey||Q.metaKey)&&Q.key==="z"&&!Q.shiftKey){Q.preventDefault(),C();return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="y"||(Q.ctrlKey||Q.metaKey)&&Q.key==="z"&&Q.shiftKey){Q.preventDefault(),x();return}},A=l?.current||document;return A.addEventListener("keydown",z),()=>{A.removeEventListener("keydown",z);}},[r,C,x,l]),{state:u,canUndo:c.length>0,canRedo:p.length>0,undoCount:c.length,redoCount:p.length,push:S,undo:C,redo:x,clear:E,reset:w,getUndoStack:B,getRedoStack:_,transformAll:V}}function wu(e,t={}){let n=Ap.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 zh(e,{...t,isEqual:n})}var $n=new prosemirrorState.PluginKey("suggestionMode"),ra="suggestionModeApplied",_h=Date.now();function ia(e){return {revisionId:_h++,author:e.author,date:new Date().toISOString()}}function As(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 Pu(e,t,n,o,r,i,a){let s=[];if(t.nodesBetween(n,o,(u,d)=>{if(!u.isText)return;let c=Math.max(d,n),f=Math.min(d+u.nodeSize,o);if(c>=f)return;let p=u.marks.some(m=>m.type===r&&m.attrs.author===a.author);s.push({from:c,to:f,isOwnInsert:p});}),s.length===0)return;let l=As(t,n,"deletion",a.author)||ia(a);for(let u=s.length-1;u>=0;u--){let d=s[u];d.isOwnInsert?e.delete(d.from,d.to):e.addMark(d.from,d.to,i.create(l));}}function vu(e,t,n,o,r){let i=e.state.schema.marks.insertion;if(!i)return false;let a=e.state.tr;a.setMeta(ra,true);let s=As(e.state.doc,t,"insertion",r.author)||ia(r);if(t!==n){let u=e.state.schema.marks.deletion;u&&Pu(a,e.state.doc,t,n,i,u,r);}let l=a.mapping.map(n);return a.insertText(o,l,l),a.addMark(l,l+o.length,i.create(s)),e.dispatch(a.scrollIntoView()),true}function Ru(e,t,n){let o=$n.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(ra,true),!a){Pu(u,e.doc,r.pos,i.pos,s,l,o);let S=u.mapping.map(i.pos);return u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(S))),t(u.scrollIntoView()),true}let d=n==="backward",c=d?r.pos-1:r.pos,f=d?r.pos:r.pos+1;if(c<0||f>e.doc.content.size)return true;let m=e.doc.resolve(c).nodeAfter;if(!m?.isText)return false;let b=m.marks.some(S=>S.type===s&&S.attrs.author===o.author);if(m.marks.some(S=>S.type===l)){let S=d?c:f;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(S)));}else if(b)u.delete(c,f);else {let S=As(e.doc,c,"deletion",o.author)||ia(o);u.addMark(c,f,l.create(S));let C=d?c:f;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(C)));}return t(u.scrollIntoView()),true}function Eu(e=false,t="User"){return new prosemirrorState.Plugin({key:$n,state:{init(){return {active:e,author:t}},apply(n,o){let r=n.getMeta($n);return r?{...o,...r}:o}},props:{handleDOMEvents:{beforeinput(n,o){let r=$n.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 vu(n,i,a,o.data,r)}return false}},handleKeyDown(n,o){return $n.getState(n.state)?.active?o.key==="Backspace"?Ru(n.state,n.dispatch,"backward"):o.key==="Delete"?Ru(n.state,n.dispatch,"forward"):false:false},handleTextInput(n,o,r,i){let a=$n.getState(n.state);return a?.active?vu(n,o,r,i,a):false}},appendTransaction(n,o,r){let i=$n.getState(r);if(!i?.active)return null;let a=n.find(c=>c.docChanged&&!c.getMeta(ra));if(!a)return null;let s=r.schema.marks.insertion;if(!s)return null;let l=ia(i),u=r.tr;u.setMeta(ra,true);let d=r.schema.marks.deletion;return a.steps.forEach(c=>{c.getMap().forEach((p,m,b,g)=>{g>b&&r.doc.nodesBetween(b,g,(S,C)=>{if(!S.isText)return;if(!S.marks.some(E=>E.type===s||d&&E.type===d)){let E=Math.max(C,b),w=Math.min(C+S.nodeSize,g);u.addMark(E,w,s.create(l));}});});}),u.steps.length>0?u:null}})}function Mu(e,t,n,o){if(n){let r={active:e};o!==void 0&&(r.author=o);let i=t.tr.setMeta($n,r);n(i);}return true}var qh={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function Lu(e,t,n,o=[]){let r=n?.getSchema()??Se,i=e?Qr(e,{styles:t??void 0}):ei(),a=[...o,...n?.getPlugins()??[]];return prosemirrorState.EditorState.create({doc:i,schema:r,plugins:a})}function Zh(e,t){return t?ti(e.doc,t):null}var Jh=Ap.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:l,onSelectionChange:u,externalPlugins:d=[],extensionManager:c,onEditorViewReady:f,onEditorViewDestroy:p,onKeyDown:m}=t,b=Ap.useRef(null),g=Ap.useRef(null),S=Ap.useRef(o),C=Ap.useRef(false),x=Ap.useRef(null),E=Ap.useRef(false),w=Ap.useRef(l),B=Ap.useRef(u),_=Ap.useRef(f),V=Ap.useRef(p),z=Ap.useRef(m);w.current=l,B.current=u,_.current=f,V.current=p,z.current=m,S.current=o;let A=Ap.useCallback(()=>{if(!b.current||C.current)return;let H={state:Lu(o,r,c,d),editable:()=>!s,dispatchTransaction:I=>{if(!g.current||C.current)return;let F=g.current.state.apply(I);g.current.updateState(F),w.current?.(I,F),(I.selectionSet||I.docChanged)&&B.current?.(F);},handleKeyDown:(I,F)=>z.current?.(I,F)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};g.current=new prosemirrorView.EditorView(b.current,H),_.current?.(g.current);},[o,r,d,c,s]),Q=Ap.useCallback(()=>{g.current&&!C.current&&(C.current=true,V.current?.(),g.current.destroy(),g.current=null,C.current=false);},[]);return Ap.useEffect(()=>(A(),()=>Q()),[]),Ap.useEffect(()=>{if(!g.current||C.current)return;let H=(F=>{if(!F)return "empty";let me=F.package?.properties;return `${me?.created||""}-${me?.modified||""}-${me?.title||""}`})(o);if(E.current&&H===x.current)return;E.current=true,x.current=H;let I=Lu(o,r,c,d);g.current.updateState(I),B.current?.(I);},[o,r,c,d]),Ap.useEffect(()=>{g.current;},[s]),Ap.useImperativeHandle(n,()=>({getState(){return g.current?.state??null},getView(){return g.current??null},getDocument(){return g.current?Zh(g.current.state,S.current):null},focus(){g.current?.focus();},blur(){g.current?.hasFocus()&&g.current.dom.blur();},isFocused(){return g.current?.hasFocus()??false},dispatch(de){g.current&&!C.current&&g.current.dispatch(de);},executeCommand(de){return g.current?de(g.current.state,g.current.dispatch,g.current):false},undo(){return g.current?prosemirrorHistory.undo(g.current.state,g.current.dispatch):false},redo(){return g.current?prosemirrorHistory.redo(g.current.state,g.current.dispatch):false},canUndo(){return g.current?prosemirrorHistory.undo(g.current.state):false},canRedo(){return g.current?prosemirrorHistory.redo(g.current.state):false},setSelection(de,H){if(!g.current)return;let{state:I,dispatch:F}=g.current,me=I.doc.resolve(de),pe=H!==void 0?I.doc.resolve(H):me,He=prosemirrorState.TextSelection.between(me,pe);F(I.tr.setSelection(He));},setNodeSelection(de){if(!g.current)return;let{state:H,dispatch:I}=g.current;try{let F=prosemirrorState.NodeSelection.create(H.doc,de);I(H.tr.setSelection(F));}catch{this.setSelection(de);}},setCellSelection(de,H){if(!g.current)return;let{state:I,dispatch:F}=g.current;try{let me=prosemirrorTables.CellSelection.create(I.doc,de,H);F(I.tr.setSelection(me));}catch{this.setSelection(de,H);}},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:b,className:"paged-editor__hidden-pm",style:{...qh,width:a>0?`${a}px`:void 0}})}),Du=Ap.memo(Jh);var nb="#000",ob="rgba(66, 133, 244, 0.3)",rb=2,ib=530,ab={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},sb=(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"}),lb=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),cb=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=Ap.useState(r),s=Ap.useRef(null);return Ap.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]),Ap.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:sb(e,t,n,i),"data-testid":"caret"})},db=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:lb(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),Hu=({selectionRects:e,caretPosition:t,isFocused:n,readOnly:o=false,caretColor:r=nb,selectionColor:i=ob,caretWidth:a=rb,blinkInterval:s=ib})=>{if(o)return null;let l=e.length>0,u=t!==null&&!l;return jsxRuntime.jsxs("div",{style:ab,"data-testid":"selection-overlay",children:[l&&e.map((d,c)=>jsxRuntime.jsx(db,{rect:d,color:i,index:c},`sel-${d.pageIndex}-${d.x}-${d.y}-${c}`)),u&&t&&jsxRuntime.jsx(cb,{position:t,color:r,width:a,blinkInterval:s,isFocused:n})]})};var zs=10,_n=zs/2,pr=2,$u="#2563eb",zu={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:15,overflow:"visible"},pb={position:"absolute",border:`${pr}px solid ${$u}`,pointerEvents:"none",boxSizing:"border-box"},fb={position:"absolute",width:`${zs}px`,height:`${zs}px`,backgroundColor:$u,border:"1px solid white",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.3)",boxSizing:"border-box",pointerEvents:"auto",zIndex:16},mb={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%)"},gb={nw:"nw-resize",ne:"ne-resize",se:"se-resize",sw:"sw-resize"};function hb(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 d=Math.max(l/o,u/r);l=o*d,u=r*d;}return {width:Math.max(20,Math.min(2e3,l)),height:Math.max(20,Math.min(2e3,u))}}function _u({imageInfo:e,zoom:t,isFocused:n,onResize:o,onResizeStart:r,onResizeEnd:i,onDragMove:a,onDragStart:s,onDragEnd:l}){let[u,d]=Ap.useState(false),[c,f]=Ap.useState(false),[p,m]=Ap.useState(0),[b,g]=Ap.useState(0),[S,C]=Ap.useState(null),x=Ap.useRef(null),E=Ap.useRef(null),w=Ap.useRef(o),B=Ap.useRef(r),_=Ap.useRef(i),V=Ap.useRef(a),z=Ap.useRef(s),A=Ap.useRef(l);w.current=o,B.current=r,_.current=i,V.current=a,z.current=s,A.current=l;let Q=Ap.useRef(e),de=Ap.useRef(t);Q.current=e,de.current=t;let H=Ap.useCallback(()=>{if(!e||!E.current){C(null);return}let R=E.current.offsetParent;if(!R){C(null);return}let L=R.getBoundingClientRect(),k=e.element.getBoundingClientRect();C({left:(k.left-L.left)/t,top:(k.top-L.top)/t,width:k.width/t,height:k.height/t});},[e,t]);Ap.useEffect(()=>{H();},[H]),Ap.useEffect(()=>{if(!e)return;let R=E.current?.closest('[style*="overflow"]')??E.current?.closest(".paged-editor__container");if(!R)return;let L=()=>{x.current&&cancelAnimationFrame(x.current),x.current=requestAnimationFrame(H);};return R.addEventListener("scroll",L,{passive:true}),window.addEventListener("resize",L,{passive:true}),()=>{R.removeEventListener("scroll",L),window.removeEventListener("resize",L),x.current&&cancelAnimationFrame(x.current);}},[e,H]);let I=Ap.useCallback((R,L)=>{if(!e||!S)return;L.preventDefault(),L.stopPropagation();let k=S.width,P=S.height,N=L.clientX,v=L.clientY,q=Math.round(k),ae=Math.round(P);d(true),m(q),g(ae),B.current?.();let $=Z=>{let xe=de.current,M=(Z.clientX-N)/xe,W=(Z.clientY-v)/xe,O=!Z.shiftKey,X=hb(R,M,W,k,P,O);q=Math.round(X.width),ae=Math.round(X.height),m(q),g(ae),C(ue=>{if(!ue)return ue;let fe={...ue};return R.includes("w")&&(fe.left=ue.left+(ue.width-X.width)),R.includes("n")&&(fe.top=ue.top+(ue.height-X.height)),fe.width=X.width,fe.height=X.height,fe});},U=()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",U),d(false);let Z=Q.current;Z&&w.current?.(Z.pmPos,q,ae),_.current?.();};window.addEventListener("mousemove",$),window.addEventListener("mouseup",U);},[e,S]),F=Ap.useCallback(R=>{if(!e||!S)return;R.preventDefault(),R.stopPropagation();let L=4,k=R.clientX,P=R.clientY,N=false,v=null,q=$=>{let U=$.clientX-k,Z=$.clientY-P;!N&&Math.sqrt(U*U+Z*Z)<L||(N||(N=true,f(true),z.current?.(),v=document.createElement("div"),v.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);",v.style.width=`${S.width}px`,v.style.height=`${S.height}px`,document.body.appendChild(v)),v&&(v.style.left=`${$.clientX-S.width/2}px`,v.style.top=`${$.clientY-S.height/2}px`));},ae=$=>{if(window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",ae),v&&(v.remove(),v=null),f(false),N){let U=Q.current;U&&V.current?.(U.pmPos,$.clientX,$.clientY),A.current?.();}};window.addEventListener("mousemove",q),window.addEventListener("mouseup",ae);},[e,S]);if(!!!(e&&S&&n))return jsxRuntime.jsx("div",{ref:E,style:{...zu,visibility:"hidden"},className:"image-selection-overlay"});let{left:pe,top:He,width:Ie,height:je}=S;return jsxRuntime.jsxs("div",{ref:E,style:zu,className:"image-selection-overlay",children:[jsxRuntime.jsx("div",{style:{...pb,left:pe-pr,top:He-pr,width:Ie+pr*2,height:je+pr*2}}),jsxRuntime.jsx("div",{style:{position:"absolute",left:pe,top:He,width:Ie,height:je,cursor:c?"grabbing":"grab",pointerEvents:"auto",zIndex:15},onMouseDown:F}),jsxRuntime.jsx(sa,{handle:"nw",style:{left:pe-_n,top:He-_n},onMouseDown:I}),jsxRuntime.jsx(sa,{handle:"ne",style:{left:pe+Ie-_n,top:He-_n},onMouseDown:I}),jsxRuntime.jsx(sa,{handle:"se",style:{left:pe+Ie-_n,top:He+je-_n},onMouseDown:I}),jsxRuntime.jsx(sa,{handle:"sw",style:{left:pe-_n,top:He+je-_n},onMouseDown:I}),u&&jsxRuntime.jsxs("div",{style:{...mb,left:pe+Ie/2,top:He+je+12},children:[p," \xD7 ",b]})]})}function sa({handle:e,style:t,onMouseDown:n}){return jsxRuntime.jsx("div",{style:{...fb,...t,cursor:gb[e]},onMouseDown:o=>n(e,o),"data-handle":e})}function bb(e,t,n,o){let r=e-t-n,i=(o.count-1)*o.gap;return (r-i)/o.count}function Os(e){let{pageSize:t,margins:n,columns:o={count:1,gap:0}}=e,r=[],i=[],a=n.top,s=t.h-n.bottom;if(s-a<=0)throw new Error("Paginator: page size and margins yield no content area");let u=bb(t.w,n.left,n.right,o);function d(E){return n.left+E*(u+o.gap)}function c(){let E=r.length+1,w=e.footnoteReservedHeights?.get(E)??0,B=s-w,_={number:E,fragments:[],margins:{...n},size:{...t},footnoteReservedHeight:w>0?w:void 0},V={page:_,cursorY:a,columnIndex:0,topMargin:a,contentBottom:B,trailingSpacing:0};return r.push(_),i.push(V),e.onNewPage&&e.onNewPage(V),V}function f(){return i.length===0?c():i[i.length-1]}function p(E){return E.contentBottom-E.cursorY}function m(E,w){let B=w||f();return p(B)>=E}function b(E){return E.columnIndex<o.count-1?(E.columnIndex+=1,E.cursorY=E.topMargin,E.trailingSpacing=0,E):c()}function g(E){let w=f(),B=Number.isFinite(E)&&E>0?E:0,_=w.contentBottom-w.topMargin;if(B>_)return w.cursorY!==w.topMargin&&(w=b(w)),w;for(;!m(B,w);)w=b(w);return w}function S(E,w,B=0,_=0){let V=Math.max(B,f().trailingSpacing),z=V+w,A=g(z),de=A.cursorY===A.topMargin?0:V,H=d(A.columnIndex),I=A.cursorY+de;return E.x=H,E.y=I,A.page.fragments.push(E),A.cursorY=I+w,A.trailingSpacing=_,{state:A,x:H,y:I}}function C(){return c()}function x(){let E=f();return b(E)}return {pages:r,states:i,columnWidth:u,getCurrentState:f,getAvailableHeight:()=>p(f()),fits:E=>m(E),ensureFits:g,addFragment:S,forcePageBreak:C,forceColumnBreak:x,getColumnX:d}}function $s(e){let t=new Map,n=new Set;for(let o=0;o<e.length;o++){if(n.has(o))continue;let r=e[o];if(r.kind!=="paragraph"||!r.attrs?.keepNext)continue;let a=[o],s=o;for(let d=o+1;d<e.length;d++){let c=e[d];if(c.kind==="sectionBreak"||c.kind==="pageBreak"||c.kind==="columnBreak"||c.kind!=="paragraph")break;if(c.attrs?.keepNext)a.push(d),s=d,n.add(d);else break}let l=s+1,u=-1;if(l<e.length){let d=e[l];d.kind!=="sectionBreak"&&d.kind!=="pageBreak"&&d.kind!=="columnBreak"&&(u=l);}t.set(o,{startIndex:o,endIndex:s,memberIndices:a,anchorIndex:u});}return t}function _s(e,t,n){let o=0;for(let r of e.memberIndices){let i=t[r],a=n[r];if(i.kind!=="paragraph"||a.kind!=="paragraph")continue;let s=i,l=a,u=s.attrs?.spacing?.before??0;o+=u,o+=l.totalHeight;let d=s.attrs?.spacing?.after??0;o+=d;}if(e.anchorIndex!==-1){let r=n[e.anchorIndex];if(r?.kind==="paragraph"){let i=r;i.lines.length>0&&(o+=i.lines[0].lineHeight);}}return o}function Ws(e){let t=new Set;for(let n of e.values())for(let o=1;o<n.memberIndices.length;o++)t.add(n.memberIndices[o]);return t}function Vs(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var En={top:4,bottom:4,left:7,right:7},fr=200;var yb={w:816,h:1056},zo={top:96,right:96,bottom:96,left:96};function Wu(e){return e.attrs?.spacing?.before??0}function Vu(e){return e.attrs?.spacing?.after??0}function xb(e){for(let t=0;t<e.length-1;t++){let n=e[t],o=e[t+1];if(n.kind!=="paragraph"||o.kind!=="paragraph")continue;let r=n.attrs,i=o.attrs;r?.contextualSpacing&&i?.contextualSpacing&&r.styleId&&r.styleId===i.styleId&&(r.spacing&&(r.spacing={...r.spacing,after:0}),i.spacing&&(i.spacing={...i.spacing,before:0}));}}function la(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let o=n.pageSize??yb,r={top:n.margins?.top??zo.top,right:n.margins?.right??zo.right,bottom:n.margins?.bottom??zo.bottom,left:n.margins?.left??zo.left,header:n.margins?.header??n.margins?.top??zo.top,footer:n.margins?.footer??n.margins?.bottom??zo.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...r},a=o.w-i.left-i.right;if(a<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s=Os({pageSize:o,margins:i,columns:n.columns,footnoteReservedHeights:n.footnoteReservedHeights});xb(e);let l=$s(e),u=Ws(l);for(let d=0;d<e.length;d++){let c=e[d],f=t[d];Vs(c)&&s.forcePageBreak();let p=l.get(d);if(p&&!u.has(d)){let m=_s(p,e,t),b=s.getCurrentState(),g=s.getAvailableHeight(),S=b.contentBottom-b.topMargin;m<=S&&m>g&&b.page.fragments.length>0&&s.forcePageBreak();}switch(c.kind){case "paragraph":Sb(c,f,s,a);break;case "table":c.floating?Cb(c,f,s,a):kb(c,f,s);break;case "image":Tb(c,f,s);break;case "textBox":vb(c,f,s);break;case "pageBreak":s.forcePageBreak();break;case "columnBreak":s.forceColumnBreak();break;case "sectionBreak":Rb(c,s);break}}return s.pages.length===0&&s.getCurrentState(),{pageSize:o,pages:s.pages,columns:n.columns,pageGap:n.pageGap}}function Sb(e,t,n,o){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let r=t.lines;if(r.length===0){let l=Wu(e),u=Vu(e),d=n.getCurrentState(),c={kind:"paragraph",blockId:e.id,x:n.getColumnX(d.columnIndex),y:d.cursorY+l,width:o,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(c,0,l,u);return}let i=Wu(e),a=Vu(e),s=0;for(;s<r.length;){let l=n.getCurrentState(),u=n.getAvailableHeight(),d=0,c=0;for(let C=s;C<r.length;C++){let x=r[C].lineHeight,E=d+x;if((s===0&&C===s?E+i:E)<=u||c===0)d=E,c++;else break}let f=s===0,p=s+c>=r.length,m=f?i:0,b=p?a:0,g={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:o,height:d,fromLine:s,toLine:s+c,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!f,continuesOnNext:!p},S=n.addFragment(g,d,m,b);g.y=S.y,s+=c,s<r.length&&n.ensureFits(r[s].lineHeight);}}function kb(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let o=t.rows;if(o.length===0)return;let r=0;for(;r<o.length;){let i=n.getCurrentState(),a=n.getAvailableHeight(),s=0,l=0;for(let m=r;m<o.length;m++){let b=o[m].height,g=s+b;if(g<=a||l===0)s=g,l++;else break}let u=r===0,d=r+l>=o.length,c=n.getColumnX(i.columnIndex);e.justification==="center"?c=c+(n.columnWidth-t.totalWidth)/2:e.justification==="right"&&(c=c+n.columnWidth-t.totalWidth);let f={kind:"table",blockId:e.id,x:c,y:0,width:t.totalWidth,height:s,fromRow:r,toRow:r+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!d},p=n.addFragment(f,s,0,0);f.y=p.y,f.x=c,r+=l,r<o.length&&n.ensureFits(o[r].height);}}function Cb(e,t,n,o){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let r=n.getCurrentState(),i=e.floating,a=r.page,s=a.margins,l=t.totalWidth,u=t.totalHeight,d=a.size.h-s.top-s.bottom,c=s.left,f=s.top;i?.horzAnchor==="page"&&(c=0),i?.vertAnchor==="page"&&(f=0);let p=n.getColumnX(r.columnIndex);if(i?.tblpX!==void 0)p=c+i.tblpX;else if(i?.tblpXSpec){let x=i.tblpXSpec;x==="left"||x==="inside"?p=c:x==="right"||x==="outside"?p=c+o-l:x==="center"&&(p=c+(o-l)/2);}else e.justification==="center"?p=c+(o-l)/2:e.justification==="right"&&(p=c+o-l);let m=r.cursorY,b=false;if(i?.tblpY!==void 0)m=f+i.tblpY,b=true;else if(i?.tblpYSpec){b=true;let x=i.tblpYSpec;x==="top"?m=f:x==="bottom"?m=f+d-u:x==="center"&&(m=f+(d-u)/2);}b||(m=n.ensureFits(u).cursorY);let g=s.left,S=s.left+o-l;Number.isFinite(S)&&(p=Math.max(g,Math.min(p,S)));let C={kind:"table",blockId:e.id,x:p,y:m,width:l,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};r.page.fragments.push(C);}function Tb(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){wb(e,t,n);return}let o=n.ensureFits(t.height),r={kind:"image",blockId:e.id,x:n.getColumnX(o.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(r,t.height,0,0);r.y=i.y;}function wb(e,t,n){let o=n.getCurrentState(),r=e.anchor,i=r.offsetH??n.getColumnX(o.columnIndex),a=r.offsetV??o.cursorY,s={kind:"image",blockId:e.id,x:i,y:a,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:r.behindDoc?-1:1};o.page.fragments.push(s);}function vb(e,t,n){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");let o=n.ensureFits(t.height),r={kind:"textBox",blockId:e.id,x:n.getColumnX(o.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(r,t.height,0,0);r.y=i.y;}function Rb(e,t){switch(e.type??"continuous"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}}var Pb="Calibri";function Us(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 Eb=11;function gt(e){return e/1440*96}var Mb=0;function fo(){return `block-${++Mb}`}function Ib(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 ca(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?chunkIA4LPH2A_cjs.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=chunkIA4LPH2A_cjs.a({rgb:r.rgb,themeColor:r.themeColor,themeTint:r.themeTint,themeShade:r.themeShade},t));break}case "highlight":n.highlight=chunkIA4LPH2A_cjs.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 Fb(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=ca(a.marks,i),d={kind:"text",text:a.text,...u,pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}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 d={kind:"tab",...ca(a.marks,i),pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="image"){let u=a.attrs,d=Us(u.width||100,u.height||100,n.pageContentHeight),c={kind:"image",src:u.src,width:d.width,height:d.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(c);}else if(a.type.name==="field"){let u=a.attrs.fieldType,c={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(c);}else if(a.type.name==="math"){let d={kind:"text",text:a.attrs.plainText||"[equation]",italic:true,fontFamily:"Cambria Math",pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="sdt"){let u=l+1;a.forEach((d,c)=>{let f=u+c;if(d.isText&&d.text){let p=ca(d.marks,i),m={kind:"text",text:d.text,...p,pmStart:f,pmEnd:f+d.nodeSize};o.push(m);}else if(d.type.name==="hardBreak"){let p={kind:"lineBreak",pmStart:f,pmEnd:f+d.nodeSize};o.push(p);}else if(d.type.name==="tab"){let m={kind:"tab",...ca(d.marks,i),pmStart:f,pmEnd:f+d.nodeSize};o.push(m);}else if(d.type.name==="image"){let p=d.attrs,m=Us(p.width||100,p.height||100,n.pageContentHeight),b={kind:"image",src:p.src,width:m.width,height:m.height,alt:p.alt,transform:p.transform,wrapType:p.wrapType,displayMode:p.displayMode,cssFloat:p.cssFloat,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight,position:p.position,pmStart:f,pmEnd:f+d.nodeSize};o.push(b);}});}}),o}function Bb(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=gt(e.spaceBefore)),e.spaceAfter!=null&&(n.spacing.after=gt(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(n.spacing.line=gt(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=gt(o)),e.indentRight!=null&&(n.indent.right=gt(e.indentRight)),r!=null&&(i?n.indent.hanging=Math.abs(gt(r)):n.indent.firstLine=gt(r))),e.styleId&&(n.styleId=e.styleId),e.borders){let s=e.borders;n.borders={};let l=u=>u?da(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:Lb(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);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 Lb(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 js(e,t,n){let o=e.attrs,r=Fb(e,t,n),i=Bb(o,n.theme);return {kind:"paragraph",id:fo(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function Db(e){return Math.max(1,Math.round(e/8*1.333))}var Ab={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 da(e,t){if(!e||!e.style||e.style==="none"||e.style==="nil")return;let n={style:Ab[e.style]||"solid",width:Db(e.size??0),color:e.color?chunkIA4LPH2A_cjs.a(e.color,t):"#000000"};return e.space!==void 0&&(n.space=chunkKR32M3S4_cjs.g(e.space)),n}function Hb(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?da(a,t):void 0;o[i]=s??{width:0,style:"none"};}return Object.keys(o).length>0?o:void 0}function Nb(e,t,n){let o=[],r=t+1;e.forEach(l=>{l.type.name==="paragraph"?o.push(js(l,r,n)):l.type.name==="table"&&o.push(Uu(l,r,n)),r+=l.nodeSize;});let i=e.attrs,a=i.margins,s={top:a?.top!=null?gt(a.top):1,right:a?.right!=null?gt(a.right):7,bottom:a?.bottom!=null?gt(a.bottom):1,left:a?.left!=null?gt(a.left):7};return {id:fo(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?gt(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:Hb(i,n.theme),padding:s}}function zb(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(Nb(a,r,n)),r+=a.nodeSize;});let i=e.attrs;return {id:fo(),cells:o,height:i.height?gt(i.height):void 0,heightRule:i.heightRule??void 0,isHeader:i.isHeader}}function Uu(e,t,n){let o=[],r=t+1;e.forEach(f=>{f.type.name==="tableRow"&&o.push(zb(f,r,n)),r+=f.nodeSize;});let a=e.attrs.columnWidths?.map(gt),s=e.attrs.width,l=e.attrs.widthType;if(!a&&o.length>0){let p=o[0].cells.map(m=>m.width);p.every(m=>m!==void 0&&m>0)&&(a=p);}let u=e.attrs.justification,d=e.attrs.floating,c=d?{horzAnchor:d.horzAnchor,vertAnchor:d.vertAnchor,tblpX:d.tblpX!==void 0?gt(d.tblpX):void 0,tblpXSpec:d.tblpXSpec,tblpY:d.tblpY!==void 0?gt(d.tblpY):void 0,tblpYSpec:d.tblpYSpec,topFromText:d.topFromText!==void 0?gt(d.topFromText):void 0,bottomFromText:d.bottomFromText!==void 0?gt(d.bottomFromText):void 0,leftFromText:d.leftFromText!==void 0?gt(d.leftFromText):void 0,rightFromText:d.rightFromText!==void 0?gt(d.rightFromText):void 0}:void 0;return {kind:"table",id:fo(),rows:o,columnWidths:a,width:s,widthType:l,justification:u,floating:c,pmStart:t,pmEnd:t+e.nodeSize}}function Ob(e,t,n){let o=e.attrs,r=o.wrapType,i=r==="behind"||r==="inFront",a=Us(o.width||100,o.height||100,n);return {kind:"image",id:fo(),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 $b(e,t,n){let o=e.attrs,r=[];return e.forEach((i,a)=>{if(i.type.name==="paragraph"){let s=js(i,t+1+a,n);r.push(s);}}),{kind:"textBox",id:fo(),width:o.width??fr,height:o.height??void 0,fillColor:o.fillColor,outlineWidth:o.outlineWidth,outlineColor:o.outlineColor,outlineStyle:o.outlineStyle,margins:{top:o.marginTop??En.top,bottom:o.marginBottom??En.bottom,left:o.marginLeft??En.left,right:o.marginRight??En.right},content:r,pmStart:t,pmEnd:t+e.nodeSize}}function ju(e,t={}){let n={...t,defaultFont:t.defaultFont??Pb,defaultSize:t.defaultSize??Eb},o=[],r=0,i=new Map;return e.forEach((a,s)=>{let l=r+s;switch(a.type.name){case "paragraph":{let u=js(a,l,n),d=a.attrs;if(d.numPr&&!d.listMarker){let c=d.numPr.numId;if(c==null||c===0)break;let f=d.numPr.ilvl??0,p=i.get(c)??new Array(9).fill(0);p[f]=(p[f]??0)+1;for(let b=f+1;b<p.length;b+=1)p[b]=0;i.set(c,p);let m=d.listIsBullet?"\u2022":Ib(p,f);u.attrs={...u.attrs,listMarker:m};}o.push(u);}break;case "table":o.push(Uu(a,l,n));break;case "image":o.push(Ob(a,l,n.pageContentHeight));break;case "textBox":o.push($b(a,l,n));break;case "horizontalRule":case "pageBreak":{let u={kind:"pageBreak",id:fo(),pmStart:l,pmEnd:l+a.nodeSize};o.push(u);break}}}),o}var Mn=11,mr="Calibri",ua=1,Oo=.5;function Ku(e){return {fontFamily:e.fontFamily??mr,fontSize:e.fontSize??Mn,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function qu(e,t,n){let o=chunk4CUGBNL2_cjs.h(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*ua;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*ua;return {ascent:r,descent:i,lineHeight:l}}function Gu(e,t,n){let o=chunk4CUGBNL2_cjs.d({fontSize:e,fontFamily:n??mr});return qu(e,t,o)}function Yu(e){return e.kind==="text"}function Wb(e){return e.kind==="tab"}function Vb(e){return e.kind==="image"}function Ub(e){return e.kind==="lineBreak"}function jb(e){return e.kind==="field"}function Kb(e){return !e.text||e.text.length===0}function Gb(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 Yb=48;function Xu(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 $o(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,d=l?.right??0,c=(l?.firstLine??0)-(l?.hanging??0),f=Math.max(1,t-u-d),p=Math.max(1,f-c),m=0,b=chunk4CUGBNL2_cjs.h(Mn)*ua,g=Xu(0,b,a,s),S=Math.max(1,p-g.leftMargin-g.rightMargin),C=[];if(o.length===0){let z=r?.defaultFontSize??Mn,A=r?.defaultFontFamily??mr,Q=Gu(z,i,A);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...Q}),{kind:"paragraph",lines:C,totalHeight:Q.lineHeight}}if(o.length===1&&Yu(o[0])&&Kb(o[0])){let z=o[0],A=z.fontSize??r?.defaultFontSize??Mn,Q=z.fontFamily??r?.defaultFontFamily??mr,de=Gu(A,i,Q);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...de}),{kind:"paragraph",lines:C,totalHeight:de.lineHeight}}let x={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:Mn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:S,leftOffset:g.leftMargin,rightOffset:g.rightMargin},E=()=>{let z=qu(x.maxFontSize,i,x.maxFontMetrics),A={...z};x.maxImageHeightPx>A.lineHeight&&(A.lineHeight=x.maxImageHeightPx,A.ascent=x.maxImageHeightPx*.8,A.descent=x.maxImageHeightPx*.2);let Q={fromRun:x.fromRun,fromChar:x.fromChar,toRun:x.toRun,toChar:x.toChar,width:x.width,...A};x.leftOffset>0&&(Q.leftOffset=x.leftOffset),x.rightOffset>0&&(Q.rightOffset=x.rightOffset),C.push(Q),m+=z.lineHeight;},w=(z,A)=>{E();let Q=chunk4CUGBNL2_cjs.h(Mn)*ua,de=Xu(m,Q,a,s),H=Math.max(1,f-de.leftMargin-de.rightMargin);x={fromRun:z,fromChar:A,toRun:z,toChar:A,width:0,maxFontSize:Mn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:H,leftOffset:de.leftMargin,rightOffset:de.rightMargin};},B=z=>{let A=z.fontSize??Mn;(!x.maxFontMetrics||A>x.maxFontSize)&&(x.maxFontSize=A,x.maxFontMetrics=chunk4CUGBNL2_cjs.d(z));};for(let z=0;z<o.length;z++){let A=o[z];if(Ub(A)){x.toRun=z,x.toChar=0,w(z+1,0);continue}if(Wb(A)){let Q=Ku(A);B(Q);let de=A.width??Yb;x.width+de>x.availableWidth+Oo&&(w(z,0),B(Q)),x.width+=de,x.toRun=z,x.toChar=1;continue}if(Vb(A)){let Q=A.wrapType,de=A.displayMode==="float"||Q&&["square","tight","through"].includes(Q);if(A.position&&de){x.toRun=z,x.toChar=1;continue}if(Q==="topAndBottom"||A.displayMode==="block"){x.width>0&&w(z,0);let F=A.height,me=A.distTop??6,pe=A.distBottom??6;x.toRun=z,x.toChar=1,x.maxImageHeightPx=F+me+pe,w(z+1,0);continue}let H=A.width,I=A.height;I>x.maxImageHeightPx&&(x.maxImageHeightPx=I),x.width+H>x.availableWidth+Oo&&w(z,0),x.width+=H,x.toRun=z,x.toChar=1;continue}if(jb(A)){let Q=A.fallback||"1",de={fontFamily:A.fontFamily??mr,fontSize:A.fontSize??Mn,bold:A.bold,italic:A.italic};B(de);let H=chunk4CUGBNL2_cjs.e(Q,de);x.width>0&&x.width+H>x.availableWidth+Oo&&(w(z,0),B(de)),x.width+=H,x.toRun=z,x.toChar=1;continue}if(Yu(A)){let Q=A,de=Q.text,H=Ku(Q);if(B(H),!de||de.length===0){x.toRun=z,x.toChar=0;continue}let I=Gb(de),F=0;for(;F<de.length;){let me=de.length;for(let Ie of I)if(Ie>F){me=Ie;break}let pe=de.slice(F,me),He=chunk4CUGBNL2_cjs.e(pe,H);if(He>x.availableWidth+Oo){x.width>0&&(w(z,F),B(H));let{charWidths:Ie}=chunk4CUGBNL2_cjs.f(pe,H),je=0;for(;je<pe.length;){let R=0,L=je;for(;L<pe.length;){let k=Ie[L]??0;if(R+k>x.availableWidth+Oo)break;R+=k,L+=1;}L===je&&(L=Math.min(pe.length,je+1),R=Ie[je]??0),x.width+=R,x.toRun=z,x.toChar=F+L,je=L,je<pe.length&&(w(z,F+je),B(H));}F=me;continue}x.width>0&&x.width+He>x.availableWidth+Oo&&(w(z,F),B(H)),x.width+=He,x.toRun=z,x.toChar=me,F=me;}}}E();let V=C.reduce((z,A)=>z+A.lineHeight,0);return i?.before&&(V+=i.before),i?.after&&(V+=i.after),{kind:"paragraph",lines:C,totalHeight:V}}var Xb=new Map;function Zu(){Xb.clear();}var qb=new Map;function Ju(){qb.clear();}var Zb=5e3,Jb=Zb,Vn=new Map;function Ks(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 Qb(){for(;Vn.size>Jb;){let e=Vn.keys().next().value;if(e===void 0)break;Vn.delete(e);}}function Gs(e,t){let n=Ks(e),o=Vn.get(n);if(o!==void 0&&o.maxWidth===t)return Vn.delete(n),Vn.set(n,o),o.measure}function Ys(e,t,n){let o=Ks(e);Vn.set(o,{measure:n,maxWidth:t}),Qb();}function Qu(){Vn.clear();}function Xs(){Zu(),Ju(),Qu();}function ey(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function ty(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,d=i.slice(l,u);d.length>0&&n.push({...r,text:d});}else n.push(r);}}}return n}function ny(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??"",d=s===t.fromRun?t.fromChar:0,c=s===t.toRun?t.toChar:u.length;a+=c-d;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function oy(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 ry(e,t,n,o){let{pmStart:r,pmEnd:i}=ny(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=ty(e,t);if(u.length===0)return {charOffset:0,pmPosition:r};let d=0,c=0;for(let p of u){if(p.kind==="tab"){let m=p.width??48,b=d+m;if(l<=b){let g=d+m/2;return l<g?{charOffset:c,pmPosition:r+c}:{charOffset:c+1,pmPosition:r+c+1}}d=b,c+=1;continue}if(p.kind==="image"){let m=p.width,b=d+m;if(l<=b){let g=d+m/2;return l<g?{charOffset:c,pmPosition:r+c}:{charOffset:c+1,pmPosition:r+c+1}}d=b,c+=1;continue}if(p.kind==="lineBreak"){if(l>=d)return {charOffset:c,pmPosition:r+c};c+=1;continue}if(p.kind==="text"){let m=p.text??"";if(m.length===0)continue;let b=ey(p),g=chunk4CUGBNL2_cjs.f(m,b),S=d+g.width;if(l<=S){let C=l-d,x=chunk4CUGBNL2_cjs.g(C,g.charWidths),E=c+x;return {charOffset:E,pmPosition:r+E}}d=S,c+=m.length;}}return {charOffset:i-r,pmPosition:i}}function ep(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=oy(l,i,a.fromLine,a.toLine);if(u===null)return null;let d=l.lines[u];if(!d)return null;let c=0;for(let x=a.fromLine;x<u;x++)c+=l.lines[x]?.lineHeight??0;let f=s.attrs?.indent,p=f?.left??0,m=f?.right??0,b=Math.max(0,t.width-p-m),g=r-p,{charOffset:S,pmPosition:C}=ry(s,d,g,b);return {pmPosition:C,charOffset:S,lineIndex:u}}function iy(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 ep(i)?.pmPosition??null}function qs(e,t){if(t)return iy(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?ep(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function np(e,t,n,o=1){let r=document.elementsFromPoint(t,n),i=r.find(d=>d.classList.contains("layout-page"));if(!i)return null;let a=r.find(d=>d.tagName==="SPAN"&&d.dataset.pmStart!==void 0&&d.dataset.pmEnd!==void 0);if(a)return Zs(a,t);let s=r.find(d=>d.classList.contains("layout-empty-run"));if(s){let d=s.closest(".layout-paragraph");if(d&&d.dataset.pmStart)return Number(d.dataset.pmStart)}let l=r.find(d=>d.classList.contains("layout-paragraph")&&d.dataset.pmStart!==void 0);if(l&&l.dataset.pmStart){let d=tp(l,t,n);return d!==null?d:Number(l.dataset.pmStart)}let u=r.find(d=>d.classList.contains("layout-table-cell"));return u?tp(u,t,n):ay(e,i,t,n)}function Zs(e,t,n){let o=Number(e.dataset.pmStart),r=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let c=e.getBoundingClientRect(),f=(c.left+c.right)/2;return t<f?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,d=s;for(;u<d;){let c=Math.floor((u+d)/2),f=l.createRange();f.setStart(a,c),f.setEnd(a,c);let m=f.getBoundingClientRect().left;t<m?d=c:u=c+1;}if(u>0&&u<=s){let c=l.createRange();c.setStart(a,u-1),c.setEnd(a,u-1);let f=c.getBoundingClientRect();c.setStart(a,Math.min(u,s)),c.setEnd(a,Math.min(u,s));let p=c.getBoundingClientRect(),m=Math.abs(t-f.left),b=Math.abs(t-p.left);if(m<b)return o+(u-1)}return o+Math.min(u,r-o)}function tp(e,t,n){let o=e.querySelector(".layout-empty-run");if(o){let c=o.closest(".layout-paragraph");if(c&&c.dataset.pmStart)return Number(c.dataset.pmStart)}let r=e.querySelectorAll(".layout-line"),i=null,a=1/0;for(let c of Array.from(r)){let f=c,p=f.getBoundingClientRect(),m=(p.top+p.bottom)/2,b=Math.abs(n-m);b<a&&(a=b,i=f);}if(!i){let c=e.querySelector(".layout-paragraph[data-pm-start]");return c?.dataset.pmStart?Number(c.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 c=i.closest(".layout-paragraph");return c?.dataset.pmStart?Number(c.dataset.pmStart):null}let l=null,u=1/0;for(let c of Array.from(s)){let f=c,p=f.getBoundingClientRect();if(t>=p.left&&t<=p.right)return Zs(f,t);let m=t<p.left?p.left-t:t-p.right;m<u&&(u=m,l=f);}if(!l)return null;let d=l.getBoundingClientRect();return t<d.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function ay(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let p=t.querySelectorAll(".layout-paragraph");if(p.length>0){let m=p[0];return Number(m.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,l=1/0;for(let p of Array.from(a)){let m=p,b=m.getBoundingClientRect(),g=(b.top+b.bottom)/2,S=Math.abs(o-g);S<l&&(l=S,s=m);}if(!s)return null;let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let p=s.closest(".layout-paragraph");return p?.dataset.pmStart?Number(p.dataset.pmStart):null}let d=null,c=1/0;for(let p of Array.from(u)){let m=p,b=m.getBoundingClientRect();if(n>=b.left&&n<=b.right)return Zs(m,n);let g=n<b.left?b.left-n:n-b.right;g<c&&(c=g,d=m);}if(!d)return null;let f=d.getBoundingClientRect();return n<f.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)}var Un={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function sy(e){return e.kind==="paragraph"}function ly(e){return e.kind==="table"}function cy(e){return e.kind==="image"}function pa(e){e.style.position="absolute",e.style.overflow="hidden";}function dy(e,t,n){let o=n.createElement("div");return o.className=`${Un.fragment} ${Un.paragraph}`,pa(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 uy(e,t,n){let o=n.createElement("div");return o.className=`${Un.fragment} ${Un.table}`,pa(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 py(e,t,n){let o=n.createElement("div");return o.className=`${Un.fragment} ${Un.image}`,pa(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 gr(e,t,n={}){let o=n.document??document;if(sy(e))return dy(e,t,o);if(ly(e))return uy(e,t,o);if(cy(e))return py(e,t,o);let r=o.createElement("div");r.className=Un.fragment,pa(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function Js(e){return e/1440*96}function fy(e){return e/96*1440}function my(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:o=0}=e,r=t.filter(c=>c.val!=="clear").filter(c=>c.pos>=o),i=t.filter(c=>c.val==="clear").map(c=>c.pos),a=r.reduce((c,f)=>Math.max(c,f.pos),0),s=[...r];o>0&&!r.some(c=>c.pos<=o)&&(i.some(f=>Math.abs(f-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let u=a>0?Math.max(a,o):o,d=o+14400;for(;u<d;){u+=n;let c=r.some(m=>Math.abs(m.pos-u)<20),f=i.some(m=>Math.abs(m-u)<20),p=o>0&&Math.abs(u-o)<20;!c&&!f&&!p&&s.push({val:"start",pos:u,leader:"none"});}return s.sort((c,f)=>c.pos-f.pos)}function op(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=fy(e),l=my(t).find(c=>c.pos>a);if(!l){let c=Js(i),f=c-e%c;return f<=0&&(f=c),{width:f,alignment:"default"}}let d=Js(l.pos)-e;if(l.val==="center"||l.val==="end"){let c=o?o(n):0;l.val==="center"?d-=c/2:d-=c;}else if(l.val==="decimal"){let c=n.indexOf(r);if(c>=0&&o){let f=n.slice(0,c),p=o(f);d-=p;}}else if(l.val==="bar")return {width:0,leader:l.leader,alignment:"bar"};if(d<1){let c=Js(i),f=c-e%c;return f<=0&&(f=c),{width:f,alignment:"default"}}return {width:d,leader:l.leader,alignment:l.val}}var Zt={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 br(e){return e.kind==="text"}function fa(e){return e.kind==="tab"}function Qs(e){return e.kind==="image"}function el(e){return e.kind==="lineBreak"}function tl(e){return e.kind==="field"}function gy(e,t){if(t.fontFamily&&(e.style.fontFamily=chunk4CUGBNL2_cjs.a(t.fontFamily).cssFallback),t.fontSize){let o=t.fontSize*96/72;e.style.fontSize=`${o}px`;}t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];t.underline&&(n.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&n.push("line-through"),t.commentIds&&t.commentIds.length>0&&(e.style.backgroundColor="rgba(255, 212, 0, 0.25)",e.style.borderBottom="2px solid rgba(255, 212, 0, 0.6)",e.dataset.commentId=String(t.commentIds[0])),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",n.includes("line-through")||n.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))),n.length>0&&(e.style.textDecorationLine=n.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function _o(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function nl(e,t){let n=t.createElement("span");if(n.className=`${Zt.run} ${Zt.text}`,gy(n,e),_o(n,e.pmStart,e.pmEnd),e.hyperlink){let o=t.createElement("a");o.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(o.target="_blank",o.rel="noopener noreferrer"),e.hyperlink.tooltip&&(o.title=e.hyperlink.tooltip),o.textContent=e.text;let r=e.color||"#0563c1";o.style.color=r,o.style.textDecoration="underline",n.style.color=r,n.appendChild(o);}else n.textContent=e.text;return n}function ap(e,t,n,o){let r=t.createElement("span");if(r.className=`${Zt.run} ${Zt.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,_o(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=hy(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 hy(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";case "heavy":return "_";default:return null}}function by(e,t){let n=t.createElement("img");return n.className=`${Zt.run} ${Zt.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",_o(n,e.pmStart,e.pmEnd),n}function rp(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),_o(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function sp(e,t){let n=e.displayMode,o=e.wrapType;return n==="float"||o&&["square","tight","through"].includes(o)||n==="block"||o==="topAndBottom"?rp(e,t):by(e,t)}function lp(e,t){let n=t.createElement("br");return n.className=`${Zt.run} ${Zt.lineBreak}`,_o(n,e.pmStart,e.pmEnd),n}function cp(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break;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 nl(r,t)}function yy(e,t,n){if(br(e))return nl(e,t);if(fa(e))return ap(e,t,48,void 0);if(Qs(e))return sp(e,t);if(el(e))return lp(e,t);if(tl(e)&&n)return cp(e,t,n);let o=t.createElement("span");return o.className=Zt.run,o}function dp(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(br(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 xy(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function Sy(e){return {val:e.val,pos:e.pos,leader:e.leader}}function ky(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(br(i))o+=i.text;else if(tl(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(fa(i)||el(i))break}return o}function Cy(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=chunk4CUGBNL2_cjs.a(i).cssFallback,s=r*96/72;return n.font=`${s}px ${a}`,n.measureText(o).width}}function up(e,t,n,o,r){let i=o.createElement("div");i.className=Zt.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=dp(e,t);if(a.length===0){let b=o.createElement("span");return b.className=`${Zt.run} layout-empty-run`,b.innerHTML="&nbsp;",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=>br(b)&&b.highlight);i.style.overflow=u?"hidden":"visible";let d=a.some(fa),c,f=Cy(o);if(d){let b=r?.tabStops?.map(Sy),g=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;c={explicitStops:b,leftIndent:g};}let p=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;p=m+b;}else p=m;for(let b=0;b<a.length;b++){let g=a[b];if(fa(g)&&c){let S=ky(a,b,r?.context),C=op(p,c,S,f),x=ap(g,o,C.width,C.leader);i.appendChild(x),p+=C.width;}else if(br(g)){let S=nl(g,o);if(g.highlight){let w=(g.fontSize?g.fontSize*96/72:14.67)*1.2,B=Math.max(0,t.lineHeight-w);if(B>0){let _=B/2;S.style.paddingTop=`${_}px`,S.style.paddingBottom=`${_}px`;}}i.appendChild(S);let C=g.fontSize||11,x=g.fontFamily||"Calibri";p+=f(g.text,C,x);}else if(Qs(g)){if(g.displayMode==="float"||g.wrapType&&["square","tight","through"].includes(g.wrapType))continue;let C=xy(g);if(r?.renderedInlineImageKeys?.has(C))continue;r?.renderedInlineImageKeys?.add(C);let x=sp(g,o);i.appendChild(x),g.displayMode!=="block"&&g.wrapType!=="topAndBottom"&&(p+=g.width);}else if(el(g)){let S=lp(g,o);i.appendChild(S);}else if(tl(g)&&r?.context){let S=cp(g,o,r.context);i.appendChild(S);let C=g.fallback??"";g.fieldType==="PAGE"?C=String(r.context.pageNumber):g.fieldType==="NUMPAGES"&&(C=String(r.context.totalPages));let x=g.fontSize||11,E=g.fontFamily||"Calibri";p+=f(C,x,E);}else {let S=yy(g,o,r?.context);i.appendChild(S);}}return i}function hr(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function ip(e,t){return !e&&!t||!e||!t?false:hr(e.top,t.top)&&hr(e.bottom,t.bottom)&&hr(e.left,t.left)&&hr(e.right,t.right)&&hr(e.between,t.between)}function In(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=Zt.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),_o(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");for(let w of t.runs)Qs(w)&&(w.displayMode==="float"||w.wrapType&&["square","tight","through"].includes(w.wrapType));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 d=t.attrs?.indent,c=0,f=0;d&&(u?(d.left&&d.left>0&&(f=d.left),d.right&&d.right>0&&(c=d.right)):(d.left&&d.left>0&&(c=d.left),d.right&&d.right>0&&(f=d.right)));let p=t.attrs?.borders;if(p){let w=A=>{switch(A){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 B=A=>`${A.width}px ${w(A.style)} ${A.color}`,_=ip(r.prevBorders,p),V=ip(p,r.nextBorders);if(_&&p.between?a.style.borderTop=B(p.between):p.top&&!_&&(a.style.borderTop=B(p.top)),p.bottom&&!V&&(a.style.borderBottom=B(p.bottom)),p.left&&(a.style.borderLeft=B(p.left)),p.right&&(a.style.borderRight=B(p.right)),p.bar){let A=i.createElement("div");A.style.position="absolute",A.style.left="-8px",A.style.top="0",A.style.bottom="0",A.style.borderLeft=B(p.bar),a.style.position="relative",a.appendChild(A);}if(p.top||p.bottom||p.left||p.right||p.between){let A=p.top||p.between;a.style.paddingLeft=p.left?`${p.left.space??4}px`:"0",a.style.paddingRight=p.right?`${p.right.space??4}px`:"0",a.style.paddingTop=A?`${A.space??2}px`:"0",a.style.paddingBottom=p.bottom?`${p.bottom.space??6}px`:"0";}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let m=e.width-c-f,g=t.runs[t.runs.length-1]?.kind==="lineBreak",S=n.lines.length,C=0;d?.hanging&&d.hanging>0?C=-d.hanging:d?.firstLine&&d.firstLine>0&&(C=d.firstLine);let x=0,E=r.renderedInlineImageKeys??new Set;for(let w=0;w<s.length;w++){let B=s[w],_=e.fromLine+w,V=_===S-1,z=_===0&&!e.continuesFromPrev,A=B.leftOffset??0,Q=B.rightOffset??0,de=m;if(z){let me=d?.hanging&&d.hanging>0,pe=d?.firstLine&&d.firstLine>0;me&&d?.hanging?de=m+d.hanging:pe&&d?.firstLine&&(de=m-d.firstLine);}let H=up(t,B,l,i,{availableWidth:de-A-Q,isLastLine:V,isFirstLine:z,paragraphEndsWithLineBreak:g,tabStops:t.attrs?.tabs,leftIndentPx:c,firstLineIndentPx:z?C:0,context:o,renderedInlineImageKeys:E});A>0&&(H.style.marginLeft=`${A}px`),Q>0&&(H.style.marginRight=`${Q}px`),x+=B.lineHeight;let I=d?.hanging&&d.hanging>0,F=d?.firstLine&&d.firstLine>0;if(z?c>0&&I?(H.style.paddingLeft=`${c}px`,H.style.textIndent=`-${d.hanging}px`):c>0&&F?(H.style.paddingLeft=`${c}px`,H.style.textIndent=`${d.firstLine}px`):c>0?H.style.paddingLeft=`${c}px`:F&&(H.style.textIndent=`${d.firstLine}px`):c>0?H.style.paddingLeft=`${c}px`:I&&(H.style.paddingLeft=`${d.hanging}px`),f>0&&(H.style.paddingRight=`${f}px`),z&&t.attrs?.listMarker){let me=Math.max(0,c-(d?.hanging??0));H.style.paddingLeft=`${me}px`,H.style.textIndent="0";let pe=Ty(t.attrs.listMarker,d,i);H.insertBefore(pe,H.firstChild);}a.appendChild(H);}return a}function Ty(e,t,n){let o=n.createElement("span");o.className="layout-list-marker",o.style.display="inline-block",o.textContent=e;let r=t?.hanging??24;return o.style.minWidth=`${r}px`,o.style.textAlign="left",o.style.boxSizing="border-box",o}var xn={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 wy(e,t,n,o){let r=o.createElement("div");r.className=xn.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`;for(let l=0;l<e.blocks.length;l++){let u=e.blocks[l],d=t.blocks[l];if(u?.kind==="paragraph"&&d?.kind==="paragraph"){let c=u,f=d,p={blockId:c.id,width:s,height:f.totalHeight,fromLine:0,toLine:f.lines.length,pmStart:c.pmStart,pmEnd:c.pmEnd},m=In(p,c,f,n,{document:o});m.style.position="relative",r.appendChild(m);}else if(u?.kind==="table"&&d?.kind==="table"){let p=vy(u,d,n,o);p.style.position="relative",r.appendChild(p);}}return r}function vy(e,t,n,o){let r=o.createElement("div");r.className=`${xn.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"),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 d=e.rows[u],c=t.rows[u];if(!d||!c)continue;let f=pp(d,c,u,l,t.columnWidths,e.rows.length,n,o,s,i);r.appendChild(f),l+=c.height;}return r.style.height=`${l}px`,r}function ma(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 Ry(e,t,n,o,r,i,a){let s=a.createElement("div");s.className=xn.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,d=e.padding?.bottom??1,c=e.padding?.left??7;if(s.style.padding=`${l}px ${u}px ${d}px ${c}px`,e.borders&&(r.isFirstRow&&ma(s,"top",e.borders.top),ma(s,"right",e.borders.right),ma(s,"bottom",e.borders.bottom),r.isFirstCol&&ma(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 f=wy(e,t,i,a);if(s.appendChild(f),e.blocks.length>0){let p=e.blocks[0],m=e.blocks[e.blocks.length-1];p&&"pmStart"in p&&p.pmStart!==void 0&&(s.dataset.pmStart=String(p.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(s.dataset.pmEnd=String(m.pmEnd));}return s}function pp(e,t,n,o,r,i,a,s,l,u,d){let c=s.createElement("div");c.className=xn.row,c.style.position="absolute",c.style.left="0",c.style.top=`${o}px`,c.style.width="100%",c.style.height=`${t.height}px`,c.dataset.rowIndex=String(n);let f=new Set;if(l){for(let[,b]of l)if(b.startRow<n&&b.startRow+b.rowSpan>n)for(let g=0;g<b.colSpan;g++)f.add(b.columnIndex+g);}let p=0,m=0;for(;f.has(m);)p+=r[m]??0,m++;for(let b=0;b<e.cells.length;b++){let g=e.cells[b],S=t.cells[b];if(!g||!S)continue;let C=g.colSpan??1,x=g.rowSpan??1,E=t.height;if(x>1&&u){E=0;for(let A=n;A<n+x&&A<u.length-1;A++)E+=(u[A+1]??0)-(u[A]??0);E===0&&(E=t.height*x);}let w=n===0||d===true,_=m===0;m+C>=r.length;let z=Ry(g,S,p,E,{isFirstRow:w,isFirstCol:_},a,s);if(z.dataset.cellIndex=String(b),z.dataset.columnIndex=String(m),x>1&&(z.dataset.rowSpan=String(x)),c.appendChild(z),x>1&&l){let A=`${n}-${m}`;l.set(A,{cell:g,cellMeasure:S,columnIndex:m,startRow:n,rowSpan:x,colSpan:C,x:p,totalHeight:E});}for(let A=0;A<C&&m+A<r.length;A++)p+=r[m+A]??0;for(m+=C;f.has(m);)p+=r[m]??0,m++;}return c}function ga(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=xn.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 p=0;p<n.columnWidths.length-1;p++){s+=n.columnWidths[p]??0;let m=i.createElement("div");m.className=xn.resizeHandle,m.style.position="absolute",m.style.left=`${s-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(p),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}let l=[],u=0;for(let p=0;p<n.rows.length;p++)l.push(u),u+=n.rows[p]?.height??0;l.push(u);let d=new Map,c=0;for(let p=e.fromRow;p<e.toRow;p++){let m=t.rows[p],b=n.rows[p];if(!m||!b)continue;let g=e.continuesFromPrev&&p===e.fromRow,S=pp(m,b,p,c,n.columnWidths,t.rows.length,o,i,d,l,g);a.appendChild(S),c+=b.height;}let f=0;for(let p=e.fromRow;p<e.toRow;p++)if(f+=n.rows[p]?.height??0,p<e.toRow-1){let m=i.createElement("div");m.className=xn.rowResizeHandle,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(p),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let p=i.createElement("div");p.className=xn.tableEdgeHandleBottom,p.style.position="absolute",p.style.left="0",p.style.top=`${f-3}px`,p.style.width="100%",p.style.height="6px",p.style.cursor="row-resize",p.style.zIndex="10",p.dataset.rowIndex=String(t.rows.length-1),p.dataset.tableBlockId=String(e.blockId),p.dataset.isEdge="bottom",e.pmStart!==void 0&&(p.dataset.tablePmStart=String(e.pmStart)),a.appendChild(p);}if(e.toRow===t.rows.length){let p=n.columnWidths.reduce((b,g)=>b+g,0),m=i.createElement("div");m.className=xn.tableEdgeHandleRight,m.style.position="absolute",m.style.left=`${p-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(n.columnWidths.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="right",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}return a}var ol={image:"layout-image",imageAnchored:"layout-image-anchored"};function ha(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=ol.image,e.isAnchored&&a.classList.add(ol.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=i.createElement("img");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 fp={textBox:"layout-textbox"};function ba(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");if(a.className=fp.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 d=t.outlineStyle||"solid",c=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${d} ${c}`;}let s=t.margins??En;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 d=0;d<t.content.length;d++){let c=t.content[d],f=n.innerMeasures[d];if(!f)continue;let p={blockId:c.id,width:l,height:f.totalHeight,pmStart:c.pmStart,pmEnd:c.pmEnd,fromLine:0,toLine:f.lines.length},m=In(p,c,f,o,{document:i});m.style.position="relative",m.style.left="0",m.style.top="0",a.appendChild(m),u+=f.totalHeight;}return a}var jn={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function xa(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=Po(l,a[s],o.theme);for(let[d,c]of Object.entries(u))e.style[d]=String(c);}}}}function Py(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 Ey(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 ka(e){return e===void 0?0:Math.round(e*96/914400)}function My(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function Iy(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!My(i))continue;let a=i.position,s=i.distTop??0,l=i.distBottom??0,u=i.distLeft??12,d=i.distRight??12,c="left",f=0;if(a?.horizontal){let m=a.horizontal;m.align==="right"?(c="right",f=n-i.width):m.align==="left"?(c="left",f=0):m.align==="center"?(c="left",f=(n-i.width)/2):m.posOffset!==void 0&&(f=ka(m.posOffset),c=f>n/2?"right":"left");}else i.cssFloat==="right"&&(c="right",f=n-i.width);let p=0;if(a?.vertical){let m=a.vertical;m.align==="top"?p=0:m.align==="bottom"?p=t:m.posOffset!==void 0?p=ka(m.posOffset):p=t,m.relativeTo==="margin"&&(m.align==="top"||m.posOffset!==void 0)||m.relativeTo==="paragraph"&&(p=t+p);}else p=t;o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:c,x:f,y:p,distTop:s,distBottom:l,distLeft:u,distRight:d,pmStart:i.pmStart,pmEnd:i.pmEnd});}return o}function Fy(e,t){let n=[],o=0,r=0,i=1/0,a=0;for(let s of e){let l=s.x-s.distLeft,u=s.x+s.width+s.distRight,d=s.y-s.distTop,c=s.y+s.height+s.distBottom;s.side==="left"?o=Math.max(o,u):r=Math.max(r,t-l),i=Math.min(i,d),a=Math.max(a,c);}return (o>0||r>0)&&n.push({leftMargin:o,rightMargin:r,topY:i===1/0?0:i,bottomY:a}),n}function By(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.width=o.width,i.height=o.height,o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function mp(e,t,n){let o=n.document??document,r=o.createElement("div");r.style.position="relative";let i=t.contentWidth??600,a=[],s=0;for(let l=0;l<e.blocks.length;l++){let u=e.blocks[l],d=e.measures[l];if(u?.kind==="paragraph"&&d?.kind==="paragraph"){let c=u,f=d,p=s,m=[];for(let C of c.runs)if(C.kind==="image"&&"position"in C&&C.position){let x=C;a.push({src:x.src,width:x.width,height:x.height,alt:x.alt,paragraphY:p,position:x.position});}else m.push(C);let b={...c,runs:m},g={blockId:c.id,width:i,height:f.totalHeight,fromLine:0,toLine:f.lines.length},S=In(g,b,f,t,{document:o});S.style.position="relative",S.style.marginBottom="0",r.appendChild(S),s+=f.totalHeight;}}for(let l of a){let u=o.createElement("img");u.src=l.src,u.width=l.width,u.height=l.height,l.alt&&(u.alt=l.alt),u.style.position="absolute";let d=l.position.horizontal;d&&(d.align==="right"?u.style.right="0":d.align==="center"?(u.style.left="50%",u.style.transform="translateX(-50%)"):d.posOffset!==void 0?u.style.left=`${ka(d.posOffset)}px`:u.style.left="0");let c=l.position.vertical;if(c){let f=l.paragraphY;c.align==="bottom"?u.style.bottom="0":c.align==="center"?(u.style.top="50%",u.style.transform=(u.style.transform||"")+" translateY(-50%)"):c.posOffset!==void 0?u.style.top=`${f+ka(c.posOffset)}px`:u.style.top=`${f}px`;}else u.style.top=`${l.paragraphY}px`;r.appendChild(u);}return r}function Ly(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 Ca(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??jn.page,r.dataset.pageNumber=String(e.number),xa(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=jn.content,Py(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[],l=[];for(let p of e.fragments)if(p.kind==="paragraph"&&n.blockLookup){let m=n.blockLookup.get(String(p.blockId));if(m?.block.kind==="paragraph"){let b=m.block,g=p.y-e.margins.top,S=Iy(b,g,a);s.push(...S);}}for(let p of s)l.push({side:p.side,x:p.x,y:p.y,width:p.width,height:p.height,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight});if(n.blockLookup)for(let p of e.fragments){if(p.kind!=="table")continue;let m=n.blockLookup.get(String(p.blockId));if(m?.block.kind!=="table")continue;let g=m.block.floating;if(!g)continue;let S=p.x-e.margins.left,C=p.y-e.margins.top,x=g.topFromText??0,E=g.bottomFromText??0,w=g.leftFromText??12,B=g.rightFromText??12,_=S<a/2?"left":"right";l.push({side:_,x:S,y:C,width:p.width,height:p.height,distTop:x,distBottom:E,distLeft:w,distRight:B});}Fy(l,a);if(s.length>0){let p=By(s,o);i.appendChild(p);}let d=p=>{if(p.kind!=="paragraph"||!n.blockLookup||!p.blockId)return;let m=n.blockLookup.get(String(p.blockId));if(m?.block.kind==="paragraph")return m.block.attrs?.borders},c,f=new Map;for(let p=0;p<e.fragments.length;p++){let m=e.fragments[p],b,g={...t,section:"body",contentWidth:a};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 x=C.block,E=p+1<e.fragments.length?d(e.fragments[p+1]):void 0,w=String(m.blockId),B=f.get(w);B||(B=new Set,f.set(w,B)),b=In(m,x,C.measure,g,{document:o,prevBorders:c,nextBorders:E,renderedInlineImageKeys:B}),c=x.attrs?.borders;}else m.kind==="table"&&C?.block.kind==="table"&&C?.measure.kind==="table"?(b=ga(m,C.block,C.measure,g,{document:o}),c=void 0):m.kind==="image"&&C?.block.kind==="image"&&C?.measure.kind==="image"?(b=ha(m,C.block,C.measure,g,{document:o}),c=void 0):m.kind==="textBox"&&C?.block.kind==="textBox"&&C?.measure.kind==="textBox"?(b=ba(m,C.block,C.measure,g,{document:o}),c=void 0):(b=gr(m,g,{document:o}),c=void 0);}else b=gr(m,g,{document:o}),c=void 0;Ey(b,m,{left:e.margins.left,top:e.margins.top}),i.appendChild(b);}if(n.footnoteArea&&n.footnoteArea.length>0){let p=Ly(n.footnoteArea,a,o);p.style.position="absolute";let m=e.footnoteReservedHeight??0,b=e.size.h-e.margins.bottom-e.margins.top;p.style.top=`${b-m}px`,p.style.left="0",p.style.right="0",i.appendChild(p);}r.appendChild(i);{let m=n.headerDistance??e.margins.header??48,b=e.size.w-e.margins.left-e.margins.right,g=Math.max(e.margins.top-m,48),C=(n.headerContent?.height??0)>g,x=o.createElement("div");x.className=jn.header,x.style.position="absolute",x.style.top=`${m}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${b}px`,x.style.minHeight="24px";let E=!C;if(n.headerContent&&n.headerContent.blocks.length>0){let w=mp(n.headerContent,{...t,section:"header",contentWidth:b},n);w.querySelector("img")&&(E=false),x.appendChild(w);}E&&(x.style.maxHeight=`${g}px`,x.style.overflow="hidden"),r.appendChild(x);}{let m=n.footerDistance??e.margins.footer??48,b=e.size.w-e.margins.left-e.margins.right,g=Math.max(e.margins.bottom-m,48),C=(n.footerContent?.height??0)>g,x=o.createElement("div");x.className=jn.footer,x.style.position="absolute",x.style.bottom=`${m}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${b}px`,x.style.minHeight="24px";let E=!C;if(n.footerContent&&n.footerContent.blocks.length>0){let w=mp(n.footerContent,{...t,section:"footer",contentWidth:b},n);w.querySelector("img")&&(E=false),x.appendChild(w);}E&&(x.style.maxHeight=`${g}px`,x.style.overflow="hidden"),r.appendChild(x);}return r}function rl(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body"},r={...n};if(n.footnotesByPage){let i=n.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:o,pageOptions:r}}function gp(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 Dy(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height}`),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 Ay(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 ya=2,Hy=8;function il(e,t,n={}){let o=e.length,r=n.pageGap??24,i=t,a=i.__pageRenderState,s=Dy(n),l=o>=Hy;if(a&&a.optionsHash===s&&l){let g=a.pageStates,S=a.pageDataMap,C=i.__pageObserver,x=[];for(let B of e)x.push(gp(B));let E=a.totalPages!==o,w=Math.min(g.length,e.length);for(let B=0;B<w;B++){let _=g[B],V=x[B];if(_.fingerprint===V&&!E){let Q=S.get(_.element);Q&&(Q.page=e[B]);continue}let z=_.element,A=S.get(z);A&&(A.page=e[B],A.rendered&&Ny(z,S,o,n)),_.fingerprint=V,xa(z,e[B].size.w,e[B].size.h,n),z.dataset.pageNumber=String(e[B].number);}if(e.length>g.length){let B=n.document??document;for(let _=g.length;_<e.length;_++){let V=e[_],z=B.createElement("div");z.className=n.pageClassName??jn.page,z.dataset.pageNumber=String(V.number),z.dataset.pageIndex=String(_),xa(z,V.size.w,V.size.h,n),t.appendChild(z),g.push({element:z,fingerprint:x[_]}),S.set(z,{page:V,index:_,rendered:false}),C&&C.observe(z);}}if(e.length<g.length){for(let B=g.length-1;B>=e.length;B--){let _=g[B].element;C&&C.unobserve(_),S.delete(_),t.removeChild(_);}g.length=e.length;}for(let B=0;B<g.length;B++){let _=S.get(g[B].element);_&&(_.index=B);}a.totalPages=o,a.currentOptions=n;return}let d=i.__pageObserver;d&&(d.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,Ay(t,r);let c=[],f=[];for(let g=0;g<e.length;g++){let S=e[g];if(f.push(gp(S)),l){let x=(n.document??document).createElement("div");x.className=n.pageClassName??jn.page,x.dataset.pageNumber=String(S.number),x.dataset.pageIndex=String(g),xa(x,S.size.w,S.size.h,n),t.appendChild(x),c.push(x);}else {let{context:C,pageOptions:x}=rl(S,o,n),E=Ca(S,C,x);t.appendChild(E),c.push(E);}}if(!l)return;let p=new Map;for(let g=0;g<e.length;g++)p.set(c[g],{page:e[g],index:g,rendered:false});let m=new IntersectionObserver(g=>{let S=i.__pageRenderState;if(!S)return;let{currentOptions:C,totalPages:x,pageDataMap:E}=S;for(let V of g){let z=V.target,A=E.get(z);if(A&&V.isIntersecting){Sa(z,E,x,C);for(let Q=-ya;Q<=ya;Q++){let de=A.index+Q;de>=0&&de<S.pageStates.length&&de!==A.index&&Sa(S.pageStates[de].element,E,x,C);}}}let w=window.innerHeight,B=w*3,_=new Set;for(let[V,z]of E){if(!z.rendered)continue;let A=V.getBoundingClientRect();A.bottom>-B&&A.top<w+B&&_.add(z.index);}for(let[V,z]of E){if(!z.rendered)continue;let A=false;for(let Q of _)if(Math.abs(z.index-Q)<=ya+1){A=true;break}!A&&_.size>0&&zy(V,E);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let g of c)m.observe(g);i.__pageObserver=m,i.__pageRenderState={pageStates:c.map((g,S)=>({element:g,fingerprint:f[S]})),totalPages:o,optionsHash:s,pageDataMap:p,currentOptions:n};let b=Math.min(e.length,ya+3);for(let g=0;g<b;g++)Sa(c[g],p,o,n);}function Sa(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=rl(r.page,n,o),s=Ca(r.page,i,a);for(;s.firstChild;)e.appendChild(s.firstChild);r.rendered=true;}function Ny(e,t,n,o){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=rl(r.page,n,o),l=Ca(r.page,i,a).querySelector(`.${jn.content}`),u=e.querySelector(`.${jn.content}`);l&&u?e.replaceChild(l,u):(e.innerHTML="",r.rendered=false,Sa(e,t,n,o));}function zy(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}var Ta=class{constructor(t={}){chunkPCJ5ACUV_cjs.d(this,"container",null);chunkPCJ5ACUV_cjs.d(this,"blockLookup",new Map);chunkPCJ5ACUV_cjs.d(this,"pageStates",[]);chunkPCJ5ACUV_cjs.d(this,"totalPages",0);chunkPCJ5ACUV_cjs.d(this,"options");chunkPCJ5ACUV_cjs.d(this,"doc");this.options=t,this.doc=t.document??document;}setBlockLookup(t){this.blockLookup=t;}mount(t){this.container=t,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let t=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${t}px`,this.container.style.padding=`${t}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(t){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:n}=t;this.totalPages=n.length,this.container.innerHTML="",this.pageStates=[];for(let o=0;o<n.length;o++){let r=n[o],i={pageNumber:r.number,totalPages:this.totalPages,section:"body"},a=this.renderPageWithLookup(r,i);this.container.appendChild(a),this.pageStates.push({element:a,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(t,n){let o=this.doc.createElement("div");o.className="layout-page",o.dataset.pageNumber=String(t.number),o.style.position="relative",o.style.width=`${t.size.w}px`,o.style.height=`${t.size.h}px`,o.style.backgroundColor=this.options.pageBackground??"#ffffff",o.style.overflow="hidden",this.options.showShadow&&(o.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${t.margins.top}px`,r.style.left=`${t.margins.left}px`,r.style.right=`${t.margins.right}px`,r.style.bottom=`${t.margins.bottom}px`,r.style.overflow="visible";for(let i of t.fragments){let a=this.renderFragmentWithLookup(i,n);this.applyFragmentPosition(a,i),r.appendChild(a);}return o.appendChild(r),o}renderFragmentWithLookup(t,n){let o=this.blockLookup.get(String(t.blockId));if(t.kind==="paragraph"&&o){let r=o.block,i=o.measure;return In(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return ga(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return ha(t,r,i,n,{document:this.doc})}if(t.kind==="textBox"&&o){let r=o.block,i=o.measure;return ba(t,r,i,n,{document:this.doc})}return gr(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 Fn,Kn,Gn,Bn,Wo,mo,hp,al,wa=class{constructor(){chunkPCJ5ACUV_cjs.f(this,mo);chunkPCJ5ACUV_cjs.f(this,Fn,0);chunkPCJ5ACUV_cjs.f(this,Kn,0);chunkPCJ5ACUV_cjs.f(this,Gn,false);chunkPCJ5ACUV_cjs.f(this,Bn,null);chunkPCJ5ACUV_cjs.f(this,Wo,new Set);}setStateSeq(t){chunkPCJ5ACUV_cjs.g(this,Fn,t);}incrementStateSeq(){return ++chunkPCJ5ACUV_cjs.i(this,Fn)._}getStateSeq(){return chunkPCJ5ACUV_cjs.e(this,Fn)}getRenderSeq(){return chunkPCJ5ACUV_cjs.e(this,Kn)}onLayoutStart(){chunkPCJ5ACUV_cjs.g(this,Gn,true);}onLayoutComplete(t){chunkPCJ5ACUV_cjs.g(this,Kn,t),chunkPCJ5ACUV_cjs.g(this,Gn,false),chunkPCJ5ACUV_cjs.h(this,mo,hp).call(this);}isSafeToRender(){return !chunkPCJ5ACUV_cjs.e(this,Gn)&&chunkPCJ5ACUV_cjs.e(this,Kn)>=chunkPCJ5ACUV_cjs.e(this,Fn)}requestRender(){this.isSafeToRender()?chunkPCJ5ACUV_cjs.h(this,mo,al).call(this):chunkPCJ5ACUV_cjs.g(this,Bn,()=>chunkPCJ5ACUV_cjs.h(this,mo,al).call(this));}onRender(t){return chunkPCJ5ACUV_cjs.e(this,Wo).add(t),()=>{chunkPCJ5ACUV_cjs.e(this,Wo).delete(t);}}reset(){chunkPCJ5ACUV_cjs.g(this,Fn,0),chunkPCJ5ACUV_cjs.g(this,Kn,0),chunkPCJ5ACUV_cjs.g(this,Gn,false),chunkPCJ5ACUV_cjs.g(this,Bn,null);}getDebugInfo(){return {stateSeq:chunkPCJ5ACUV_cjs.e(this,Fn),renderSeq:chunkPCJ5ACUV_cjs.e(this,Kn),layoutUpdating:chunkPCJ5ACUV_cjs.e(this,Gn),hasPendingRender:chunkPCJ5ACUV_cjs.e(this,Bn)!==null,isSafe:this.isSafeToRender()}}};Fn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,Bn=new WeakMap,Wo=new WeakMap,mo=new WeakSet,hp=function(){if(chunkPCJ5ACUV_cjs.e(this,Bn)&&this.isSafeToRender()){let t=chunkPCJ5ACUV_cjs.e(this,Bn);chunkPCJ5ACUV_cjs.g(this,Bn,null),t();}},al=function(){for(let t of chunkPCJ5ACUV_cjs.e(this,Wo))try{t();}catch(n){console.error("LayoutSelectionGate: render callback error",n);}};var yp=".layout-page-content .layout-line";function Oy(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 $y(e){let t=Oy(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 xp({pagesContainerRef:e}){let t=Ap.useRef(null),n=Ap.useRef(-1),o=Ap.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let d of Array.from(l)){let c=d,f=Number(c.dataset.pmStart),p=Number(c.dataset.pmEnd);if(c.classList.contains("layout-run-tab")){if(s>=f&&s<p)return c.getBoundingClientRect().left;continue}if(s>=f&&s<=p&&d.firstChild?.nodeType===Node.TEXT_NODE){let m=d.firstChild,b=Math.min(s-f,m.length),g=c.ownerDocument;if(!g)continue;let S=g.createRange();return S.setStart(m,b),S.setEnd(m,b),S.getBoundingClientRect().left}}let u=e.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(u)){let c=d.closest(".layout-paragraph");if(!c)continue;let f=Number(c.dataset.pmStart),p=Number(c.dataset.pmEnd);if(s>=f&&s<=p)return d.getBoundingClientRect().left}return null},[e]),r=Ap.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll(yp);for(let u of Array.from(l)){let d=u,c=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let f of Array.from(c)){let p=f,m=Number(p.dataset.pmStart),b=Number(p.dataset.pmEnd);if(s>=m&&s<=b)return d}}for(let u of Array.from(l)){let d=u,c=d.closest(".layout-paragraph");if(!c)continue;let f=Number(c.dataset.pmStart),p=Number(c.dataset.pmEnd);if(s>=f&&s<=p&&c.querySelector(".layout-line")===d)return d}return null},[e]),i=Ap.useCallback((s,l)=>{let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let p=s.closest(".layout-paragraph");return p?.dataset.pmStart?Number(p.dataset.pmStart)+1:null}for(let p of Array.from(u)){let m=p,b=m.getBoundingClientRect(),g=Number(m.dataset.pmStart),S=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?g:S}continue}if(l>=b.left&&l<=b.right){let C=m.firstChild;if(!C||C.nodeType!==Node.TEXT_NODE)return g;let x=C,E=m.ownerDocument;if(!E)return g;let w=0,B=x.length;for(;w<B;){let _=Math.floor((w+B)/2),V=E.createRange();V.setStart(x,_),V.setEnd(x,_),l<V.getBoundingClientRect().left?B=_:w=_+1;}if(w>0&&w<=x.length){let _=E.createRange();_.setStart(x,w-1),_.setEnd(x,w-1);let V=_.getBoundingClientRect().left;_.setStart(x,Math.min(w,x.length)),_.setEnd(x,Math.min(w,x.length));let z=_.getBoundingClientRect().left;if(Math.abs(l-V)<Math.abs(l-z))return g+(w-1)}return g+Math.min(w,S-g)}}let d=null,c=1/0;for(let p of Array.from(u)){let m=p,b=m.getBoundingClientRect(),g=l<b.left?b.left-l:l-b.right;g<c&&(c=g,d=m);}if(!d)return null;let f=d.getBoundingClientRect();return l<f.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),a=Ap.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(yp));if(u.length===0)return false;let{from:d,anchor:c}=s.state.selection;if(t.current===null){let x=o(d);if(x===null)return false;t.current=x;}let f;if(n.current>=0&&n.current<u.length)f=n.current;else {let x=r(d);if(!x||(f=u.indexOf(x),f===-1))return false}let p=l.key==="ArrowUp"?f-1:f+1;if(p<0||p>=u.length)return n.current=-1,false;let m=u[p],b=i(m,t.current);if(b===null)return false;n.current=p;let{state:g,dispatch:S}=s,C=Math.max(0,Math.min(b,g.doc.content.size));try{let x=l.shiftKey?prosemirrorState.TextSelection.create(g.doc,c,C):prosemirrorState.TextSelection.create(g.doc,C);S(g.tr.setSelection(x));}catch{let x=g.doc.resolve(C),E=l.shiftKey?prosemirrorState.TextSelection.between(g.doc.resolve(c),x):prosemirrorState.TextSelection.near(x);S(g.tr.setSelection(E));}return $y(m),true},[e,o,r,i]);return {stickyXRef:t,lastVisualLineIndexRef:n,getCaretClientX:o,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}var _y=12,Pa=8;function Sp(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 sl(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 Wy(e,t,n){let o=[];for(let a=0;a<e.content.length;a++){let s=e.content[a],l=[];if(a===0){let d={kind:"text",text:`${t} `,fontSize:Pa,superscript:true};l.push(d);}for(let d of s.content){let c=d;if(c.type==="run"&&Array.isArray(c.content)){let f=c.formatting,p={};if(f){if(f.bold&&(p.bold=true),f.italic&&(p.italic=true),f.underline&&(p.underline=true),f.strike&&(p.strike=true),f.color){let m=f.color;m.val?p.color=`#${m.val}`:m.rgb&&(p.color=`#${m.rgb}`);}if(f.fontSize&&(p.fontSize=f.fontSize/2),f.fontFamily){let m=f.fontFamily;p.fontFamily=m.ascii||m.hAnsi;}}p.fontSize||(p.fontSize=Pa);for(let m of c.content){let b=m;b.type==="text"&&typeof b.text=="string"?l.push({kind:"text",text:b.text,...p}):b.type==="tab"?l.push({kind:"tab",...p}):b.type==="break"?l.push({kind:"lineBreak"}):b.type;}}}l.length===0&&l.push({kind:"text",text:"",fontSize:Pa});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:Pa}]});let r=[];for(let a of o)if(a.kind==="paragraph"){let s=$o(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 kp(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=Wy(l,i,n);o.set(s.footnoteId,u),i++;}return o}function Cp(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+=_y,n.set(o,i));}return n}var ll=class{constructor(t,n=1){chunkPCJ5ACUV_cjs.d(this,"pagesContainer");chunkPCJ5ACUV_cjs.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(),d=a.closest(".layout-line"),c=d?d.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:c/this.zoom}}continue}if(t>=s&&t<=l&&i.firstChild?.nodeType===Node.TEXT_NODE){let u=i.firstChild,d=Math.min(t-s,u.length),c=a.ownerDocument;if(!c)continue;let f=c.createRange();f.setStart(u,d),f.setEnd(u,d);let p=f.getBoundingClientRect(),m=a.closest(".layout-line"),b=m?m.offsetHeight:16;return {x:(p.left-n.left)/this.zoom,y:(p.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(),d=i.closest(".layout-line"),c=d?d.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:c/this.zoom}}}return null}findElementsForRange(t,n){let o=[],r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(r)){let a=i,s=Number(a.dataset.pmStart);Number(a.dataset.pmEnd)>t&&s<n&&o.push(a);}return o}getRectsForRange(t,n){let o=this.pagesContainer.getBoundingClientRect(),r=[],i=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(i)){let s=a,l=Number(s.dataset.pmStart);if(Number(s.dataset.pmEnd)>t&&l<n){if(s.classList.contains("layout-run-tab")){let m=s.getBoundingClientRect();r.push({x:(m.left-o.left)/this.zoom,y:(m.top-o.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let d=a.firstChild,c=s.ownerDocument;if(!c)continue;let f=Math.max(0,t-l),p=Math.min(d.length,n-l);if(f<p){let m=c.createRange();m.setStart(d,f),m.setEnd(d,p);let b=m.getClientRects();for(let g of Array.from(b))r.push({x:(g.left-o.left)/this.zoom,y:(g.top-o.top)/this.zoom,width:g.width/this.zoom,height:g.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 Tp(e,t=1){return new ll(e,t)}var Gy=816,Ep=1056,Ea={top:96,right:96,bottom:96,left:96},Yy=24,qn=30,Xy=200,qy=[],Zy={position:"relative",width:"100%",minHeight:"100%",overflow:"visible",backgroundColor:"var(--doc-bg, #f8f9fa)"},Jy={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:24,paddingBottom:24},Qy={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},ex={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function Sn(e){return Math.round(e/1440*96)}function tx(e){return {w:e?.pageWidth?Sn(e.pageWidth):Gy,h:e?.pageHeight?Sn(e.pageHeight):Ep}}function nx(e){let t=e?.marginTop?Sn(e.marginTop):Ea.top,n=e?.marginBottom?Sn(e.marginBottom):Ea.bottom;return {top:t,right:e?.marginRight?Sn(e.marginRight):Ea.right,bottom:n,left:e?.marginLeft?Sn(e.marginLeft):Ea.left,header:e?.headerDistance?Sn(e.headerDistance):48,footer:e?.footerDistance?Sn(e.footerDistance):48}}function ox(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function vp(e){return e===void 0?0:Math.round(e*96/914400)}function rx(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 Mp(e,t){let i=e.columnWidths??[],a=rx(e.width,e.widthType,t);if(i.length===0&&e.rows.length>0){let c=e.rows[0].cells.reduce((m,b)=>m+(b.colSpan??1),0),p=(a??t)/Math.max(1,c);i=Array(c).fill(p);}else if(i.length>0&&a){let c=i.reduce((f,p)=>f+p,0);if(c>0&&Math.abs(c-a)>1){let f=a/c;i=i.map(p=>p*f);}}let s=new Map;for(let c=0;c<e.rows.length;c++){let f=e.rows[c];if(!f)continue;let p=0,m=s.get(c)??new Set;for(;m.has(p);)p++;for(let b of f.cells){let g=b.colSpan??1,S=b.rowSpan??1;if(S>1)for(let C=c+1;C<c+S;C++){s.has(C)||s.set(C,new Set);let x=s.get(C);for(let E=0;E<g;E++)x.add(p+E);}for(p+=g;m.has(p);)p++;}}let l=e.rows.map((c,f)=>{let p=0,m=s.get(f)??new Set;for(;m.has(p);)p++;return {cells:c.cells.map(b=>{let g=b.colSpan??1,S=0;for(let w=0;w<g&&p+w<i.length;w++)S+=i[p+w]??0;for(S===0&&(S=b.width??100),p+=g;m.has(p);)p++;let C=b.padding?.left??7,x=b.padding?.right??7,E=Math.max(1,S-C-x);return {blocks:b.blocks.map(w=>Ip(w,E)),width:S,height:0,colSpan:b.colSpan,rowSpan:b.rowSpan}}),height:0}});for(let c=0;c<l.length;c++){let f=l[c],p=e.rows[c]?.cells,m=0;for(let C=0;C<f.cells.length;C++){let x=f.cells[C],E=p?.[C];x.height=x.blocks.reduce((_,V)=>"totalHeight"in V?_+V.totalHeight:_,0);let w=E?.padding?.top??1,B=E?.padding?.bottom??1;x.height+=w+B,m=Math.max(m,x.height);}let b=e.rows[c],g=b?.height,S=b?.heightRule;g&&S==="exact"?f.height=g:g&&S==="atLeast"?f.height=Math.max(m,g):f.height=Math.max(m,24);}let u=l.reduce((c,f)=>c+f.height,0),d=i.reduce((c,f)=>c+f,0)||a||t;return {kind:"table",rows:l,columnWidths:i,totalWidth:d,totalHeight:u}}function ix(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(!ox(s))continue;let l=0,u=s.position,d=s.distTop??0,c=s.distBottom??0,f=s.distLeft??12,p=s.distRight??12;if(u?.vertical){let S=u.vertical;S.align==="top"&&S.relativeTo==="margin"?l=0:S.posOffset!==void 0&&(l=vp(S.posOffset));}let m=l+s.height,b=0,g=0;if(u?.horizontal){let S=u.horizontal;if(S.align==="left")b=s.width+p;else if(S.align==="right")g=s.width+f;else if(S.posOffset!==void 0){let C=vp(S.posOffset);C<t/2?b=C+s.width+p:g=t-C+f;}}else s.cssFloat==="left"?b=s.width+p:s.cssFloat==="right"&&(g=s.width+f);if(b>0||g>0){let S=u?.vertical?.relativeTo==="margin"||u?.vertical?.relativeTo==="page";n.push({leftMargin:b,rightMargin:g,topY:l-d,bottomY:m+c,anchorBlockIndex:o,isMarginRelative:S});}}}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=Mp(i,t),l=s.totalWidth,u=s.totalHeight,d=a.leftFromText??12,c=a.rightFromText??12,f=a.topFromText??0,p=a.bottomFromText??0,m=0,b=0,g=0;a.tblpX!==void 0?g=a.tblpX:a.tblpXSpec?a.tblpXSpec==="left"||a.tblpXSpec==="inside"?g=0:a.tblpXSpec==="right"||a.tblpXSpec==="outside"?g=t-l:a.tblpXSpec==="center"&&(g=(t-l)/2):i.justification==="center"?g=(t-l)/2:i.justification==="right"&&(g=t-l),g<t/2?m=g+l+c:b=t-g+d;let S=a.tblpY??0,C=S+u;n.push({leftMargin:m,rightMargin:b,topY:S-f,bottomY:C+p,anchorBlockIndex:o});}return n}function Ip(e,t,n,o){switch(e.kind){case "paragraph":{let r=e;if(!n||n.length===0){let a=Gs(r,t);if(a)return a}let i=$o(r,t,{floatingZones:n,paragraphYOffset:o??0});return (!n||n.length===0)&&Ys(r,t,i),i}case "table":return Mp(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??En,a=(r.width??fr)-i.left-i.right,s=r.content.map(d=>$o(d,a)),l=s.reduce((d,c)=>d+c.totalHeight,0),u=r.height??l+i.top+i.bottom;return {kind:"textBox",width:r.width??fr,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 Fp(e,t){let n=ix(e,t),o=n.filter(c=>c.isMarginRelative),r=n.filter(c=>!c.isMarginRelative),i=new Map;for(let c of o){let f=i.get(c.topY)??[];f.push(c),i.set(c.topY,f);}let a=[...r];for(let c of i.values()){let f=Math.min(...c.map(p=>p.anchorBlockIndex));for(let p of c)a.push({...p,anchorBlockIndex:f});}let s=new Map;for(let c of a){let f=s.get(c.anchorBlockIndex)??[];f.push({leftMargin:c.leftMargin,rightMargin:c.rightMargin,topY:c.topY,bottomY:c.bottomY}),s.set(c.anchorBlockIndex,f);}let l=new Set(a.map(c=>c.anchorBlockIndex)),u=0,d=[];return e.map((c,f)=>{l.has(f)&&(u=0,d=s.get(f)??[]);let p=d.length>0?d:void 0;try{let m=performance.now(),b=Ip(c,t,p,u),g=performance.now()-m;return g>500&&console.warn(`[measureBlocks] Block ${f} (${c.kind}) took ${Math.round(g)}ms`),"totalHeight"in b&&(c.kind==="table"&&c.floating||(u+=b.totalHeight)),b}catch(m){return console.error(`[measureBlocks] Error measuring block ${f} (${c.kind}):`,m),{totalHeight:20}}})}function Ma(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,d=m=>Math.round(m/914400*96),c=u?.width?d(u.width):100,f=u?.height?d(u.height):100,p=l.position;t.push({kind:"image",src:l.src||"",width:c,height:f,alt:l.alt||void 0,position:p?{horizontal:p.horizontal,vertical:p.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=Ma(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=Ma(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=Ma(o.children);t.push(...r);}}return t}function Rp(e,t){if(!e||!e.content||e.content.length===0)return;let n=[];for(let a of e.content){let s=a;if(s.type==="paragraph"&&Array.isArray(s.content)){let l=s.formatting,u={};if(l){if(l.alignment){let c=l.alignment;c==="both"?u.alignment="justify":["left","center","right","justify"].includes(c)&&(u.alignment=c);}if(l.borders){let c=l.borders,f={};for(let p of ["top","bottom","left","right","between"]){let m=c[p];if(m){let b=da(m);b&&(f[p]=b);}}Object.keys(f).length>0&&(u.borders=f);}(l.spaceAfter!=null||l.spaceBefore!=null)&&(u.spacing={before:l.spaceBefore,after:l.spaceAfter});}let d=Ma(s.content);if(d.length>0){let c={kind:"paragraph",id:String(n.length),runs:d,attrs:Object.keys(u).length>0?u:void 0};n.push(c);}}}if(n.length===0)return;let o=n.map(a=>{if(a.kind!=="paragraph")return a;let s=a;if(!s.runs.some(d=>d.kind==="image"&&"position"in d&&d.position))return a;let u=s.runs.filter(d=>!(d.kind==="image"&&"position"in d&&d.position));return u.length===0&&u.push({kind:"text",text:""}),{...s,runs:u}}),r=Fp(o,t),i=r.reduce((a,s)=>s.kind==="paragraph"?a+s.totalHeight:a,0);return {blocks:n,measures:r,height:i}}function ax(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 c=t.get(l)?.displayNumber??0,f=chunkPIVLDW7B_cjs.b(u);s.push({displayNumber:String(c),text:f});}s.length>0&&o.set(i,s);}return o}var sx=Ap.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:l,readOnly:u=false,pageGap:d=Yy,zoom:c=1,onDocumentChange:f,onSelectionChange:p,externalPlugins:m=qy,extensionManager:b,onReady:g,onRenderedDomContextReady:S,pluginOverlays:C,onHeaderFooterDoubleClick:x,hfEditMode:E,onBodyClick:w,className:B,style:_,commentsSidebarOpen:V=false,sidebarOverlay:z,scrollContainerRef:A,onHyperlinkClick:Q}=t,de=Ap.useCallback(()=>A&&typeof A=="object"?A.current:H.current,[A]),H=Ap.useRef(null),I=Ap.useRef(null),F=Ap.useRef(null),me=Ap.useRef(null),{handlePMKeyDown:pe}=xp({pagesContainerRef:I}),He=Ap.useRef(p),Ie=Ap.useRef(f),je=Ap.useRef(g),R=Ap.useRef(S);He.current=p,Ie.current=f,je.current=g,R.current=S;let[L,k]=Ap.useState(null),[P,N]=Ap.useState([]),[v,q]=Ap.useState([]),[ae,$]=Ap.useState(false),[U,Z]=Ap.useState([]),[xe,M]=Ap.useState(null),[W,O]=Ap.useState(null),X=Ap.useRef(false),ue=Ap.useCallback((T,G)=>{let Y=T.tagName==="IMG"?T:T.querySelector("img"),j=(Y??T).getBoundingClientRect();return {element:Y??T,pmPos:G,width:Math.round(j.width/c),height:Math.round(j.height/c)}},[c]),fe=Ap.useRef(false),Fe=Ap.useRef(null),ge=Ap.useRef(false),Ee=Ap.useRef(0),be=Ap.useRef(0),tt=Ap.useRef(0),Je=Ap.useRef({left:0,right:0}),We=Ap.useRef(null),nt=Ap.useRef(false),qe=Ap.useRef(0),pt=Ap.useRef(0),bt=Ap.useRef(0),De=Ap.useRef(0),it=Ap.useRef(null),Ve=Ap.useRef(false),Tt=Ap.useRef(false),to=Ap.useRef(0),Tr=Ap.useRef(0),Uo=Ap.useRef(0),kn=Ap.useRef(0),Cn=Ap.useRef(null),ft=Ap.useRef(false),zt=Ap.useRef(null),ln=Ap.useRef(null),Lt=Ap.useRef(null),Ln=5,[se,jt]=Ap.useState(null),cn=Ap.useRef(null),Tn=Ap.useCallback(()=>{cn.current&&(clearTimeout(cn.current),cn.current=null);},[]);Ap.useEffect(()=>()=>{cn.current&&clearTimeout(cn.current);},[]);let Jt=Ap.useMemo(()=>new wa,[]),ze=Ap.useMemo(()=>tx(a),[a]),ct=Ap.useMemo(()=>nx(a),[a]),Ot=ze.w-ct.left-ct.right,Qt=Ap.useMemo(()=>new Ta({pageGap:d,showShadow:true,pageBackground:"#fff"}),[d]);me.current=Qt;let Dt=Ap.useCallback(T=>{let G=performance.now(),Y=Jt.getStateSeq();Jt.onLayoutStart();try{let j=performance.now(),re=ze.h-ct.top-ct.bottom,K=ju(T.doc,{theme:i,pageContentHeight:re}),te=performance.now()-j;te>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(te)}ms (${K.length} blocks)`),N(K),j=performance.now();let ee=Fp(K,Ot);te=performance.now()-j,te>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(te)}ms (${K.length} blocks)`),q(ee);let ce=Sp(K),ke=ce.length>0&&o?.package?.footnotes,he=Rp(s,Ot),Ce=Rp(l,Ot),Me=ct.header??48,Te=ct.footer??48,Be=ct.top-Me,Ue=ct.bottom-Te,at=he?.height??0,st=Ce?.height??0,Et=ct;(at>Be||st>Ue)&&(Et={...ct},at>Be&&(Et.top=Me+at),st>Ue&&(Et.bottom=Te+st)),j=performance.now();let Xt,ro=new Map,Ko=new Map;if(ke){let An=la(K,ee,{pageSize:ze,margins:Et});ro=sl(An.pages,ce),Ko=kp(o.package.footnotes,ce,Ot);let io=Cp(ro,Ko);if(io.size>0){Xt=la(K,ee,{pageSize:ze,margins:Et,footnoteReservedHeights:io}),ro=sl(Xt.pages,ce);for(let[wt,ao]of ro){let so=Xt.pages.find(Ha=>Ha.number===wt);so&&(so.footnoteIds=ao);}}else Xt=An;}else Xt=la(K,ee,{pageSize:ze,margins:Et});if(te=performance.now()-j,te>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(te)}ms (${Xt.pages.length} pages)`),k(Xt),I.current&&me.current){j=performance.now();let An=new Map;for(let wt=0;wt<K.length;wt++){let ao=K[wt],so=ee[wt];ao&&so&&An.set(String(ao.id),{block:ao,measure:so});}me.current.setBlockLookup(An);let io=ke?ax(ro,Ko,o):void 0;if(il(Xt.pages,I.current,{pageGap:d,showShadow:!0,pageBackground:"#fff",blockLookup:An,headerContent:he,footerContent:Ce,headerDistance:a?.headerDistance?Sn(a.headerDistance):void 0,footerDistance:a?.footerDistance?Sn(a.footerDistance):void 0,pageBorders:a?.pageBorders,theme:i,footnotesByPage:io?.size?io:void 0}),te=performance.now()-j,te>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(te)}ms`),S){let wt=Tp(I.current,c);S(wt);}}let Mr=performance.now()-G;Mr>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(Mr)}ms total (${K.length} blocks, ${ee.length} measures)`);}catch(j){console.error("[PagedEditor] Layout pipeline error:",j);}Jt.onLayoutComplete(Y);},[Ot,ze,ct,d,c,Jt,s,l,a,S,o]),en=Ap.useRef(null),xo=Ap.useCallback(T=>{if(en.current){en.current.state=T;return}let G=requestAnimationFrame(()=>{let Y=en.current;en.current=null,Y&&Dt(Y.state);});en.current={rafId:G,state:T};},[Dt]);Ap.useEffect(()=>()=>{en.current&&(cancelAnimationFrame(en.current.rafId),en.current=null);},[]);let Dn=Ap.useCallback((T,G=1)=>{if(!I.current)return null;let Y=I.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!Y)return null;let j=Y.getBoundingClientRect(),re=I.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let te of Array.from(re)){let ee=te,ce=Number(ee.dataset.pmStart),ke=Number(ee.dataset.pmEnd);if(ee.classList.contains("layout-run-tab")){if(T>=ce&&T<ke){let he=ee.getBoundingClientRect(),Ce=ee.closest(".layout-page"),Me=Ce?Number(Ce.dataset.pageNumber)-1:0,Te=ee.closest(".layout-line"),Be=Te?Te.offsetHeight:16;return {x:(he.left-j.left)/G,y:(he.top-j.top)/G,height:Be,pageIndex:Me}}continue}if(T>=ce&&T<=ke&&te.firstChild?.nodeType===Node.TEXT_NODE){let he=te.firstChild,Ce=Math.min(T-ce,he.length),Me=ee.ownerDocument;if(!Me)continue;let Te=Me.createRange();Te.setStart(he,Ce),Te.setEnd(he,Ce);let Be=Te.getBoundingClientRect(),Ue=ee.closest(".layout-page"),at=Ue?Number(Ue.dataset.pageNumber)-1:0,st=ee.closest(".layout-line"),Et=st?st.offsetHeight:16;return {x:(Be.left-j.left)/G,y:(Be.top-j.top)/G,height:Et,pageIndex:at}}}let K=I.current.querySelectorAll(".layout-empty-run");for(let te of Array.from(K)){let ee=te.closest(".layout-paragraph");if(!ee)continue;let ce=Number(ee.dataset.pmStart),ke=Number(ee.dataset.pmEnd);if(T>=ce&&T<=ke){let he=te.getBoundingClientRect(),Ce=ee.closest(".layout-page"),Me=Ce?Number(Ce.dataset.pageNumber)-1:0,Te=te.closest(".layout-line"),Be=Te?Te.offsetHeight:16;return {x:(he.left-j.left)/G,y:(he.top-j.top)/G,height:Be,pageIndex:Me}}}return null},[]),$t=Ap.useCallback(T=>{let{from:G,to:Y}=T.selection;if(He.current?.(G,Y),I.current){let j=I.current.querySelectorAll(".layout-table-cell-selected");for(let te of Array.from(j))te.classList.remove("layout-table-cell-selected");let re=T.selection;if("$anchorCell"in re&&typeof re.forEachCell=="function"){let te=[];re.forEachCell((ce,ke)=>{te.push([ke,ke+ce.nodeSize]);});let ee=I.current.querySelectorAll(".layout-table-cell");for(let ce of Array.from(ee)){let ke=ce,he=ke.dataset.pmStart;if(he!==void 0){let Ce=Number(he);for(let[Me,Te]of te)if(Ce>=Me&&Ce<Te){ke.classList.add("layout-table-cell-selected");break}}}}}if(!(!L||P.length===0))if(G===Y){let j=Dn(G,c);if(j)M(j);else {let re=I.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),K=I.current?.querySelector(".layout-page");if(re&&K){let te=re.getBoundingClientRect(),ee=K.getBoundingClientRect(),ce=chunk4CUGBNL2_cjs.l(L,P,v,G);M(ce?{...ce,x:ce.x+(ee.left-te.left)/c,y:ce.y+(ee.top-te.top)/c}:null);}else M(null);}Z([]);}else {let j=I.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(j&&I.current){let re=j.getBoundingClientRect(),K=[],te=I.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let ee of Array.from(te)){let ce=ee,ke=Number(ce.dataset.pmStart);if(Number(ce.dataset.pmEnd)>G&&ke<Y){if(ce.classList.contains("layout-run-tab")){let Ue=ce.getBoundingClientRect(),at=ce.closest(".layout-page"),st=at?Number(at.dataset.pageNumber)-1:0;K.push({x:(Ue.left-re.left)/c,y:(Ue.top-re.top)/c,width:Ue.width/c,height:Ue.height/c,pageIndex:st});continue}let Ce=null;if(ee.firstChild?.nodeType===Node.TEXT_NODE?Ce=ee.firstChild:ee.firstChild?.nodeType===Node.ELEMENT_NODE&&ee.firstChild.tagName==="A"&&ee.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(Ce=ee.firstChild.firstChild),!Ce)continue;let Me=ce.ownerDocument;if(!Me)continue;let Te=Math.max(0,G-ke),Be=Math.min(Ce.length,Y-ke);if(Te<Be){let Ue=Me.createRange();Ue.setStart(Ce,Te),Ue.setEnd(Ce,Be);let at=Ue.getClientRects();for(let st of Array.from(at)){let Et=ce.closest(".layout-page"),Xt=Et?Number(Et.dataset.pageNumber)-1:0;K.push({x:(st.left-re.left)/c,y:(st.top-re.top)/c,width:st.width/c,height:st.height/c,pageIndex:Xt});}}}}if(K.length>0)Z(K);else {let ee=I.current.querySelector(".layout-page");if(ee){let ce=ee.getBoundingClientRect(),ke=(ce.left-re.left)/c,he=(ce.top-re.top)/c,Me=chunk4CUGBNL2_cjs.k(L,P,v,G,Y).map(Te=>({...Te,x:Te.x+ke,y:Te.y+he}));Z(Me);}else Z([]);}}else Z([]);M(null);}},[L,P,v,Dn,c]),no=Ap.useCallback((T,G)=>{if(T.docChanged){Jt.incrementStateSeq(),xo(G);let Y=F.current?.getDocument();Y&&Ie.current?.(Y);}Jt.requestRender(),T.docChanged||$t(G);},[xo,$t,Jt]),wr=Ap.useCallback(T=>{let{selection:G}=T;G instanceof prosemirrorState.NodeSelection&&G.node.type.name==="image"?(Z([]),M(null)):Jt.isSafeToRender()&&$t(T),requestAnimationFrame(()=>{let Y=F.current?.getView();if(!Y){O(null);return}let{selection:j}=Y.state;if(j instanceof prosemirrorState.NodeSelection&&j.node.type.name==="image"){let re=j.from,K=I.current?.querySelector(`[data-pm-start="${re}"]`);if(K){O(ue(K,re));return}}X.current||O(null);});},[$t,c,ue,Jt]),_t=Ap.useCallback((T,G)=>{if(!I.current||!L)return null;let Y=np(I.current,T,G,c);if(Y!==null)return Y;let j=I.current.querySelectorAll(".layout-page"),re=-1,K=null;for(let Ce=0;Ce<j.length;Ce++){let Te=j[Ce].getBoundingClientRect();if(T>=Te.left&&T<=Te.right&&G>=Te.top&&G<=Te.bottom){re=Ce,K=Te;break}}if(re<0||!K)return null;let te=(T-K.left)/c,ee=(G-K.top)/c,ce=L.pages[re];if(!ce)return null;let ke={pageIndex:re,page:ce,pageY:ee},he=chunk4CUGBNL2_cjs.i(ke,P,v,{x:te,y:ee});if(!he)return null;if(he.fragment.kind==="table"){let Ce=chunk4CUGBNL2_cjs.j(ke,P,v,{x:te,y:ee});return qs(he,Ce)}return qs(he)},[L,P,v,c]),dn=Ap.useCallback(T=>{let G=F.current?.getView();if(!G)return null;try{let Y=G.state.doc.resolve(T);for(let j=Y.depth;j>0;j--){let re=Y.node(j);if(re.type.name==="tableCell"||re.type.name==="tableHeader")return Y.before(j)}}catch{}return null},[]),Pt=Ap.useCallback(T=>{let G=["layout-block-image","layout-image","layout-page-floating-image"],Y=j=>!!j.dataset.pmStart&&G.some(re=>j.classList.contains(re));return T.tagName==="IMG"&&T.classList.contains("layout-run-image")?T:T.tagName==="IMG"&&T.parentElement&&Y(T.parentElement)?T.parentElement:Y(T)?T:null},[]),Kt=Ap.useCallback(T=>{let G=I.current;if(!G)return;let Y=G.querySelector(`[data-pm-start="${T}"]`);Y&&Y.scrollIntoView({behavior:"smooth",block:"center"});},[]),vr=Ap.useCallback(T=>{if(!F.current||T.button!==0||(jt(null),Tn(),T.target.closest("a[href]")&&T.preventDefault(),u))return;if(E&&w){let K=T.target;if(!(K.closest(".layout-page-header")||K.closest(".layout-page-footer")||K.closest(".hf-inline-editor"))){T.preventDefault(),T.stopPropagation(),w();return}}if(!E){let K=T.target;if(K.closest(".layout-page-header")||K.closest(".layout-page-footer")){T.preventDefault(),F.current&&(F.current.setSelection(0),F.current.focus(),$(true));return}}let Y=T.target;if(Y.classList.contains("layout-table-resize-handle")){T.preventDefault(),T.stopPropagation(),ge.current=true,Ee.current=T.clientX,We.current=Y,Y.classList.add("dragging");let K=parseInt(Y.dataset.columnIndex??"0",10);be.current=K,tt.current=parseInt(Y.dataset.tablePmStart??"0",10);let te=F.current.getView();if(te){let ee=te.state.doc.resolve(tt.current+1);for(let ce=ee.depth;ce>=0;ce--){let ke=ee.node(ce);if(ke.type.name==="table"){let he=ke.attrs.columnWidths;he&&he[K]!==void 0&&he[K+1]!==void 0&&(Je.current={left:he[K],right:he[K+1]});break}}}return}if(Y.classList.contains("layout-table-row-resize-handle")||Y.classList.contains("layout-table-edge-handle-bottom")){T.preventDefault(),T.stopPropagation(),nt.current=true,qe.current=T.clientY,it.current=Y,Ve.current=Y.dataset.isEdge==="bottom",Y.classList.add("dragging");let K=parseInt(Y.dataset.rowIndex??"0",10);pt.current=K,bt.current=parseInt(Y.dataset.tablePmStart??"0",10);let te=F.current.getView();if(te){let ee=te.state.doc.resolve(bt.current+1);for(let ce=ee.depth;ce>=0;ce--){let ke=ee.node(ce);if(ke.type.name==="table"){let he=null,Ce=0;if(ke.forEach(Me=>{Ce===K&&(he=Me),Ce++;}),he){let Me=he.attrs.height;if(Me)De.current=Me;else {let Be=Y.closest(".layout-table")?.querySelector(`[data-row-index="${K}"]`),Ue=Be?Be.getBoundingClientRect().height:30;De.current=Math.round(Ue*15);}}break}}}return}if(Y.classList.contains("layout-table-edge-handle-right")){T.preventDefault(),T.stopPropagation(),Tt.current=true,to.current=T.clientX,Cn.current=Y,Y.classList.add("dragging");let K=parseInt(Y.dataset.columnIndex??"0",10);Tr.current=K,Uo.current=parseInt(Y.dataset.tablePmStart??"0",10);let te=F.current.getView();if(te){let ee=te.state.doc.resolve(Uo.current+1);for(let ce=ee.depth;ce>=0;ce--){let ke=ee.node(ce);if(ke.type.name==="table"){let he=ke.attrs.columnWidths;he&&he[K]!==void 0&&(kn.current=he[K]);break}}}return}let j=Pt(Y);if(j){T.preventDefault(),T.stopPropagation();let K=j.dataset.pmStart;if(K!==void 0){let te=parseInt(K,10);F.current.setNodeSelection(te),O(ue(j,te)),Z([]),M(null);}F.current.focus(),$(true);return}O(null),T.preventDefault();let re=_t(T.clientX,T.clientY);if(re!==null){let K=dn(re);zt.current=K,ft.current=false,ln.current=null,Lt.current=null,fe.current=true,Fe.current=re,F.current.setSelection(re);}else {zt.current=null,ft.current=false;let K=F.current.getView();if(K){let te=Math.max(0,K.state.doc.content.size-1);F.current.setSelection(te),Fe.current=te,fe.current=true;}}F.current.focus(),$(true);},[_t,dn,u,E,w,c,Q,Tn]),wn=Ap.useCallback(T=>{if(ge.current){T.preventDefault();let j=T.clientX-Ee.current;if(We.current){let re=parseFloat(We.current.style.left);We.current.style.left=`${re+j}px`,Ee.current=T.clientX;let K=Math.round(j*15),te=300,ee=Je.current.left+K,ce=Je.current.right-K;ee>=te&&ce>=te&&(Je.current={left:ee,right:ce});}return}if(nt.current){T.preventDefault();let j=T.clientY-qe.current;if(it.current){let re=parseFloat(it.current.style.top);it.current.style.top=`${re+j}px`,qe.current=T.clientY;let K=Math.round(j*15),te=200,ee=De.current+K;ee>=te&&(De.current=ee);}return}if(Tt.current){T.preventDefault();let j=T.clientX-to.current;if(Cn.current){let re=parseFloat(Cn.current.style.left);Cn.current.style.left=`${re+j}px`,to.current=T.clientX;let K=Math.round(j*15),te=300,ee=kn.current+K;ee>=te&&(kn.current=ee);}return}if(!fe.current||Fe.current===null||!F.current||!I.current)return;let G=_t(T.clientX,T.clientY);if(G===null)return;if(zt.current!==null){if(ft.current){let re=dn(G);if(re!==null){F.current.setCellSelection(zt.current,re);return}}let j=dn(G);if(j!==null&&j!==zt.current){ft.current=true,F.current.setCellSelection(zt.current,j),Lt.current=null;return}if(ln.current!==null&&G===ln.current){if(Lt.current===null)Lt.current=T.clientX;else if(Math.abs(T.clientX-Lt.current)>=Ln){ft.current=true,F.current.setCellSelection(zt.current,zt.current),Lt.current=null;return}}else Lt.current=null,ln.current=G;}let Y=Fe.current;F.current.setSelection(Y,G);},[_t,dn]),jo=Ap.useCallback(()=>{if(ge.current){ge.current=false,We.current&&(We.current.classList.remove("dragging"),We.current=null);let T=F.current?.getView();if(T){let G=tt.current,Y=be.current,{left:j,right:re}=Je.current,K=T.state.doc.resolve(G+1);for(let te=K.depth;te>=0;te--){let ee=K.node(te);if(ee.type.name==="table"){let ce=K.before(te),ke=T.state.tr,he=[...ee.attrs.columnWidths];he[Y]=j,he[Y+1]=re,ke.setNodeMarkup(ce,void 0,{...ee.attrs,columnWidths:he});let Ce=ce+1;ee.forEach(Me=>{let Te=Ce+1,Be=0;Me.forEach(Ue=>{let at=Ue.attrs.colspan||1;if(Be===Y||Be===Y+1){let st=Be===Y?j:re;ke.setNodeMarkup(ke.mapping.map(Te),void 0,{...Ue.attrs,width:st,widthType:"dxa",colwidth:null});}Te+=Ue.nodeSize,Be+=at;}),Ce+=Me.nodeSize;}),T.dispatch(ke);break}}}return}if(nt.current){nt.current=false,it.current&&(it.current.classList.remove("dragging"),it.current=null);let T=F.current?.getView();if(T){let G=bt.current,Y=pt.current,j=De.current,re=T.state.doc.resolve(G+1);for(let K=re.depth;K>=0;K--){let te=re.node(K);if(te.type.name==="table"){let ee=re.before(K),ce=T.state.tr,ke=ee+1,he=0;te.forEach(Ce=>{he===Y&&ce.setNodeMarkup(ce.mapping.map(ke),void 0,{...Ce.attrs,height:j,heightRule:"atLeast"}),ke+=Ce.nodeSize,he++;}),T.dispatch(ce);break}}}return}if(Tt.current){Tt.current=false,Cn.current&&(Cn.current.classList.remove("dragging"),Cn.current=null);let T=F.current?.getView();if(T){let G=Uo.current,Y=Tr.current,j=kn.current,re=T.state.doc.resolve(G+1);for(let K=re.depth;K>=0;K--){let te=re.node(K);if(te.type.name==="table"){let ee=re.before(K),ce=T.state.tr,ke=[...te.attrs.columnWidths];ke[Y]=j,ce.setNodeMarkup(ee,void 0,{...te.attrs,columnWidths:ke});let he=ee+1;te.forEach(Ce=>{let Me=he+1,Te=0;Ce.forEach(Be=>{let Ue=Be.attrs.colspan||1;Te===Y&&ce.setNodeMarkup(ce.mapping.map(Me),void 0,{...Be.attrs,width:j,widthType:"dxa",colwidth:null}),Me+=Be.nodeSize,Te+=Ue;}),he+=Ce.nodeSize;}),T.dispatch(ce);break}}}return}fe.current=false,ft.current=false,ln.current=null,Lt.current=null;},[]);Ap.useEffect(()=>(window.addEventListener("mousemove",wn),window.addEventListener("mouseup",jo),()=>{window.removeEventListener("mousemove",wn),window.removeEventListener("mouseup",jo);}),[wn,jo]);let Ne=Ap.useCallback(T=>{if(u||fe.current||ge.current||nt.current||Tt.current||ft.current)return;let G=I.current;if(!G)return;let Y=T.clientX,j=T.clientY,re=T.target.closest(".layout-table");if(!re){let Me=G.querySelectorAll(".layout-table");for(let Te of Array.from(Me)){let Be=Te.getBoundingClientRect(),Ue=Y>=Be.left-qn&&Y<Be.left,at=j>=Be.top-qn&&j<Be.top,st=Y>=Be.left-qn&&Y<=Be.right,Et=j>=Be.top-qn&&j<=Be.bottom;if(Ue&&Et||at&&st){re=Te;break}}}if(!re){jt(null);return}let K=re.getBoundingClientRect(),te=Y<K.left+qn&&Y>=K.left-qn,ee=j<K.top+qn&&j>=K.top-qn;if(!te&&!ee){jt(null);return}let ce=re.querySelectorAll(":scope > .layout-table-row");if(ce.length===0){jt(null);return}let ke=G.parentElement;if(!ke)return;let he=ke.getBoundingClientRect(),Ce=Me=>Me&&Number(Me.dataset.pmStart)||0;if(te)for(let Me=0;Me<ce.length;Me++){let Te=ce[Me].getBoundingClientRect();if(j>=Te.top&&j<=Te.bottom){let Be=ce[Me].querySelector(".layout-table-cell"),Ue=Ce(Be);if(!Ue)break;let at=Te.top+Te.height/2;jt({type:"row",x:K.left-he.left-24,y:at-he.top-10,cellPmPos:Ue}),Tn();return}}if(ee){let Me=ce[0].querySelectorAll(":scope > .layout-table-cell");for(let Te=0;Te<Me.length;Te++){let Be=Me[Te].getBoundingClientRect();if(Y>=Be.left&&Y<=Be.right){let Ue=Ce(Me[Te]);if(!Ue)break;let at=Be.left+Be.width/2;jt({type:"column",x:at-he.left-10,y:K.top-he.top-24,cellPmPos:Ue}),Tn();return}}}cn.current||(cn.current=setTimeout(()=>{jt(null),cn.current=null;},Xy));},[u,Tn]),Qe=Ap.useCallback(T=>{if(T.preventDefault(),T.stopPropagation(),!se||!F.current)return;let G=F.current.getView();if(!G)return;let{type:Y,cellPmPos:j}=se,re=G.state.tr.setSelection(prosemirrorState.TextSelection.create(G.state.doc,j+1));G.dispatch(re),Y==="row"?Ao(G.state,G.dispatch):Ho(G.state,G.dispatch),jt(null),F.current.focus();},[se]),La=Ap.useCallback(T=>{let G=T.target.closest("a[href]");if(G){T.preventDefault();let Y=G.getAttribute("href")||"";if(Y.startsWith("#")){let j=Y.substring(1);if(j&&F.current){let re=F.current.getView();if(re){let K=null;re.state.doc.descendants((te,ee)=>{if(K!==null)return false;if(te.type.name==="paragraph"&&te.attrs.bookmarks?.some(ke=>ke.name===j))return K=ee,false}),K!==null&&(Kt(K),F.current.setSelection(K+1));}}}else if(Q){let j=F.current?.getView();if(!(j&&j.state.selection.from!==j.state.selection.to)){let K=G.textContent||"",te=G.getAttribute("title")||void 0,ee=G.getBoundingClientRect();Q({href:Y,displayText:K,tooltip:te,anchorRect:ee});}}return}if(T.detail===2&&x){let Y=T.target,j=Y.closest(".layout-page-header"),re=Y.closest(".layout-page-footer");if(j){T.preventDefault(),T.stopPropagation(),x("header");return}if(re){T.preventDefault(),T.stopPropagation(),x("footer");return}}if(T.detail===2&&F.current){let Y=_t(T.clientX,T.clientY);if(Y!==null){let j=dn(Y);if(j!==null){T.preventDefault(),T.stopPropagation(),F.current.setCellSelection(j,j);return}let re=F.current.getView();if(re){let{doc:K}=re.state,te=K.resolve(Y),ee=te.parent;if(ee.isTextblock){let ce=ee.textContent,ke=te.parentOffset,he=ke;for(;he>0&&/\w/.test(ce[he-1]);)he--;let Ce=ke;for(;Ce<ce.length&&/\w/.test(ce[Ce]);)Ce++;let Me=te.start()+he,Te=te.start()+Ce;Me<Te&&F.current.setSelection(Me,Te);}}}}if(T.detail===3&&F.current){let Y=_t(T.clientX,T.clientY);if(Y!==null){let j=F.current.getView();if(j){let{doc:re}=j.state,K=re.resolve(Y),te=K.start(K.depth),ee=K.end(K.depth);F.current.setSelection(te,ee);}}}},[_t,x,Q]),Da=Ap.useCallback(T=>{u||T.target.closest(".docx-comments-sidebar")||(F.current?.focus(),$(true));},[u]),yt=Ap.useCallback(T=>{let G=T.relatedTarget;G&&H.current?.contains(G)||$(false);},[]),xt=Ap.useCallback((T,G,Y)=>{let j=F.current?.getView();if(j)try{let re=j.state.doc.nodeAt(T);if(!re||re.type.name!=="image")return;let K=j.state.tr.setNodeMarkup(T,void 0,{...re.attrs,width:G,height:Y});j.dispatch(K),F.current?.setNodeSelection(T);}catch{}},[]),Rr=Ap.useCallback(()=>{X.current=true;},[]),Pr=Ap.useCallback(()=>{X.current=false;},[]),Aa=Ap.useCallback((T,G,Y)=>{let j=F.current?.getView();if(j)try{let re=j.state.doc.nodeAt(T);if(!re||re.type.name!=="image")return;if(re.attrs.displayMode==="float"||re.attrs.wrapType&&["square","tight","through"].includes(re.attrs.wrapType)){let te=I.current?.querySelectorAll(".layout-page");if(!te||te.length===0)return;let ee=null;for(let at of te){let st=at.getBoundingClientRect();if(Y>=st.top&&Y<=st.bottom){ee=at.querySelector(".layout-page-content");break}}if(ee||(ee=te[te.length-1].querySelector(".layout-page-content")),!ee)return;let ce=ee.getBoundingClientRect(),ke=(G-ce.left)/c,he=(Y-ce.top)/c,Ce=914400/96,Me=Math.round(ke*Ce),Te=Math.round(he*Ce),Be={horizontal:{posOffset:Me,relativeTo:"margin"},vertical:{posOffset:Te,relativeTo:"margin"}},Ue=j.state.tr.setNodeMarkup(T,void 0,{...re.attrs,position:Be});j.dispatch(Ue),F.current?.setNodeSelection(T);}else {let te=_t(G,Y);if(te===null||te===T||te===T+1)return;let ee=j.state.tr;if(te<=T)ee=ee.delete(T,T+re.nodeSize),ee=ee.insert(te,re),F.current?.setNodeSelection(te);else {ee=ee.delete(T,T+re.nodeSize);let ce=te-re.nodeSize;ee=ee.insert(Math.min(ce,ee.doc.content.size),re),F.current?.setNodeSelection(Math.min(ce,ee.doc.content.size-1));}j.dispatch(ee);}}catch{}},[_t,c]),So=Ap.useCallback(()=>{X.current=true;},[]),ko=Ap.useCallback(()=>{X.current=false;},[]),Er=Ap.useCallback(T=>{if(!u){if(F.current?.isFocused()||(F.current?.focus(),$(true)),T.key===" "&&!T.ctrlKey&&!T.metaKey){T.preventDefault();let G=F.current?.getView();if(G){let{from:Y,to:j}=G.state.selection;G.someProp("handleTextInput",K=>K(G,Y,j," "))||G.dispatch(G.state.tr.insertText(" "));}return}if(["PageUp","PageDown"].includes(T.key)&&!T.metaKey&&T.ctrlKey,T.key==="Home"&&(T.metaKey||T.ctrlKey)){let G=de();G&&(G.scrollTop=0);}if(T.key==="End"&&(T.metaKey||T.ctrlKey)){let G=de();G&&(G.scrollTop=G.scrollHeight);}}},[u,de]),Gt=Ap.useCallback(T=>{u||T.target.closest(".docx-comments-sidebar")||F.current?.isFocused()||(F.current?.focus(),$(true));},[u]),Yt=Ap.useCallback(T=>{Dt(T.state),$t(T.state),u||requestAnimationFrame(()=>{T.focus(),$(true);});},[Dt,$t,u]);Ap.useEffect(()=>{let T=()=>{let G=F.current?.getView();G&&(chunk4CUGBNL2_cjs.c(),Xs(),Dt(G.state),$t(G.state));};return window.document.fonts.addEventListener("loadingdone",T),()=>{window.document.fonts.removeEventListener("loadingdone",T);}},[]);let Co=Ap.useRef(0);Ap.useEffect(()=>{if(Co.current===0){Co.current=1;return}let T=F.current?.getView();T&&Dt(T.state);},[s,l,Dt]),Ap.useEffect(()=>{let T=H.current;if(!T)return;let G=new ResizeObserver(()=>{let Y=F.current?.getState();Y&&$t(Y);});return G.observe(T),()=>G.disconnect()},[$t]),Ap.useImperativeHandle(n,()=>({getDocument(){return F.current?.getDocument()??null},getState(){return F.current?.getState()??null},getView(){return F.current?.getView()??null},focus(){F.current?.focus(),$(true);},blur(){F.current?.blur(),$(false);},isFocused(){return F.current?.isFocused()??false},dispatch(T){F.current?.dispatch(T);},undo(){return F.current?.undo()??false},redo(){return F.current?.redo()??false},setSelection(T,G){F.current?.setSelection(T,G);},getLayout(){return L},relayout(){let T=F.current?.getState();T&&Dt(T);},scrollToPosition:Kt}),[L,Dt,Kt]),Ap.useEffect(()=>{let T=F.current?.getState();L&&T&&$t(T);},[L,$t]),Ap.useEffect(()=>{je.current&&F.current&&je.current({getDocument:()=>F.current?.getDocument()??null,getState:()=>F.current?.getState()??null,getView:()=>F.current?.getView()??null,focus:()=>{F.current?.focus(),$(true);},blur:()=>{F.current?.blur(),$(false);},isFocused:()=>F.current?.isFocused()??false,dispatch:T=>F.current?.dispatch(T),undo:()=>F.current?.undo()??false,redo:()=>F.current?.redo()??false,setSelection:(T,G)=>F.current?.setSelection(T,G),getLayout:()=>L,relayout:()=>{let T=F.current?.getState();T&&Dt(T);},scrollToPosition:Kt});},[L,Dt]);let oo=Ap.useMemo(()=>{if(!L)return Ep+48;let T=L.pages.length;return T*ze.h+(T-1)*d+48},[L,ze.h,d]);return jsxRuntime.jsxs("div",{ref:H,className:`ep-root paged-editor ${B??""}`,style:{...Zy,..._},tabIndex:0,onFocus:Da,onBlur:yt,onKeyDown:Er,onMouseDown:Gt,children:[jsxRuntime.jsx(Du,{ref:F,document:o,styles:r,widthPx:Ot,readOnly:u,onTransaction:no,onSelectionChange:wr,externalPlugins:m,extensionManager:b,onEditorViewReady:Yt,onKeyDown:pe}),jsxRuntime.jsxs("div",{style:{...Jy,minHeight:oo,transform:(()=>{let T=[];return V&&T.push("translateX(-120px)"),c!==1&&T.push(`scale(${c})`),T.length>0?T.join(" "):void 0})(),transformOrigin:"top center",transition:"transform 0.2s ease"},children:[jsxRuntime.jsx("div",{ref:I,className:`paged-editor__pages${u?" paged-editor--readonly":""}${E?` paged-editor--hf-editing paged-editor--editing-${E}`:""}`,style:Qy,onMouseDown:vr,onMouseMove:Ne,onClick:La,"aria-hidden":"true"}),jsxRuntime.jsx(Hu,{selectionRects:U,caretPosition:xe,isFocused:ae,pageGap:d,readOnly:u}),jsxRuntime.jsx(_u,{imageInfo:W,zoom:c,isFocused:ae,onResize:xt,onResizeStart:Rr,onResizeEnd:Pr,onDragMove:Aa,onDragStart:So,onDragEnd:ko}),se&&jsxRuntime.jsx("button",{type:"button",onMouseDown:Qe,onMouseEnter:Tn,onMouseLeave:()=>jt(null),style:{position:"absolute",left:se.x,top:se.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:se.type==="row"?"Insert row below":"Insert column to the right","aria-label":se.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"})})}),C&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:ex,children:C})]}),z]})}),Bp=Ap.memo(sx);var ux=Ap.lazy(()=>import('./FindReplaceDialog-J3DI3U5I.cjs')),px=Ap.lazy(()=>import('./HyperlinkDialog-PEPS3C2G.cjs')),fx=Ap.lazy(()=>import('./TablePropertiesDialog-A36OXG3A.cjs').then(e=>({default:e.TablePropertiesDialog}))),mx=Ap.lazy(()=>import('./ImagePositionDialog-UYXYHSP4.cjs').then(e=>({default:e.ImagePositionDialog}))),gx=Ap.lazy(()=>import('./ImagePropertiesDialog-V6SVKINO.cjs').then(e=>({default:e.ImagePropertiesDialog}))),hx=Ap.lazy(()=>import('./FootnotePropertiesDialog-DO5DCAW6.cjs').then(e=>({default:e.FootnotePropertiesDialog}))),bx=Ap.lazy(()=>import('./PageSetupDialog-RLMYJ3BA.cjs').then(e=>({default:e.PageSetupDialog}))),Lp=[{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 Sx({mode:e,onModeChange:t}){let[n,o]=Ap.useState(false),[r,i]=Ap.useState(false),a=Ap.useRef(null),s=Ap.useRef(null),[l,u]=Ap.useState({top:0,left:0}),d=Lp.find(c=>c.value===e);return Ap.useEffect(()=>{let c=window.matchMedia("(max-width: 1400px)");i(c.matches);let f=p=>i(p.matches);return c.addEventListener("change",f),()=>c.removeEventListener("change",f)},[]),Ap.useEffect(()=>{if(!n||!a.current)return;let c=a.current.getBoundingClientRect();u({top:c.bottom+2,left:c.right-220});},[n]),Ap.useEffect(()=>{if(!n)return;let c=p=>{!a.current?.contains(p.target)&&!s.current?.contains(p.target)&&o(false);},f=p=>{p.key==="Escape"&&o(false);};return document.addEventListener("mousedown",c),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",f);}},[n]),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:a,type:"button",onMouseDown:c=>c.preventDefault(),onClick:()=>o(!n),title:`${d.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(chunkOWMG5MW5_cjs.d,{name:d.icon,size:18}),!r&&jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:s,onMouseDown:c=>c.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:Lp.map(c=>jsxRuntime.jsxs("button",{type:"button",onMouseDown:f=>f.preventDefault(),onClick:()=>{t(c.value),o(false);},onMouseOver:f=>{f.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)";},onMouseOut:f=>{f.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(chunkOWMG5MW5_cjs.d,{name:c.icon,size:20}),jsxRuntime.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:c.label}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted, #9ca3af)"},children:c.desc})]}),c.value===e&&jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"check",size:18,style:{marginLeft:"auto",color:"#1a73e8"}})]},c.value))})]})}var kx=Date.now(),cl=-1;function dl(e,t,n){return {id:kx++,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 Dp=Ap.forwardRef(function({documentBuffer:t,document:n,onSave:o,author:r="User",onChange:i,onSelectionChange:a,onError:s,onFontsLoaded:l,theme:u,showToolbar:d=true,showZoomControl:c=true,showMarginGuides:f=false,marginGuideColor:p,showRuler:m=false,rulerUnit:b="inch",initialZoom:g=1,readOnly:S=false,toolbarExtra:C,className:x="",style:E,placeholder:w,loadingIndicator:B,showOutline:_=false,showPrintButton:V=true,printOptions:z,onPrint:A,onCopy:Q,onCut:de,onPaste:H,mode:I,onModeChange:F,externalPlugins:me,onEditorViewReady:pe,onRenderedDomContextReady:He,pluginOverlays:Ie,renderLogo:je,documentName:R,onDocumentNameChange:L,documentNameEditable:k=true,renderTitleBarRight:P},N){let[v,q]=Ap.useState({isLoading:!!t,parseError:null,zoom:g,selectionFormatting:{},paragraphIndentLeft:0,paragraphIndentRight:0,paragraphFirstLineIndent:0,paragraphHangingIndent:false,paragraphTabs:null,pmTableContext:null,pmImageContext:null}),[ae,$]=Ap.useState(false),[U,Z]=Ap.useState(false),[xe,M]=Ap.useState(false),[W,O]=Ap.useState(false),[X,ue]=Ap.useState(null),[fe,Fe]=Ap.useState(_),ge=Ap.useRef(false);ge.current=fe;let[Ee,be]=Ap.useState([]),[tt,Je]=Ap.useState(false),[We,nt]=Ap.useState([]),[qe,pt]=Ap.useState([]),[bt,De]=Ap.useState(false),[it,Ve]=Ap.useState(null),[Tt,to]=Ap.useState(null),[Tr,Uo]=Ap.useState(I??"editing"),kn=I??Tr,Cn=y=>{I||Uo(y),F?.(y);},ft=S||kn==="viewing",[zt,ln]=Ap.useState(null),Lt=Ap.useRef(null),Ln=Ap.useCallback(()=>{let y=ze.current?.getView();if(!y)return;let{doc:h,schema:D}=y.state,J=D.marks.insertion,ne=D.marks.deletion;if(!J&&!ne)return;let ie=[];h.descendants((le,ye)=>{if(le.isText)for(let Pe of le.marks)(Pe.type===J||Pe.type===ne)&&ie.push({type:Pe.type===J?"insertion":"deletion",text:le.text||"",author:Pe.attrs.author||"",date:Pe.attrs.date,from:ye,to:ye+le.nodeSize,revisionId:Pe.attrs.revisionId});});let oe=[];for(let le of ie){let ye=oe[oe.length-1];ye&&ye.revisionId===le.revisionId&&ye.type===le.type&&ye.to===le.from?(ye.text+=le.text,ye.to=le.to):oe.push({...le});}pt(oe);},[]);Ap.useEffect(()=>()=>{Lt.current&&clearTimeout(Lt.current);},[]),Ap.useEffect(()=>{if(Fe(_),_){let y=ze.current?.getView();y&&be(Eo(y.state.doc));}},[_]);let se=wu(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),jt=Ap.useRef(false);Ap.useEffect(()=>{if(jt.current)return;let y=se.state;if(!y)return;let h=y.package?.document?.comments;h&&h.length>0&&(nt(h),Je(true),jt.current=true);},[se.state]);let cn=Ap.useMemo(()=>{let y=new Nn(Lo());return y.buildSchema(),y.initializeRuntime(),y},[]),Tn=Ap.useMemo(()=>Eu(false,r),[]),Jt=Ap.useMemo(()=>[Tn,...me??[]],[Tn,me]),ze=Ap.useRef(null),ct=Ap.useRef(null),Ot=Ap.useRef(null),Qt=Ap.useRef(null),Dt=Ap.useRef(null),en=Ap.useRef(null),xo=Ap.useRef(null),Dn=Ap.useRef(null),$t=Ap.useRef(null),no=Ap.useRef(null),[wr,_t]=Ap.useState(0),dn=Ap.useRef(se.state);dn.current=se.state;let Pt=Ap.useRef({style:"single",size:4,color:{rgb:"000000"}}),[Kt,vr]=Ap.useState({currentPage:1,totalPages:1,visible:false}),wn=Ap.useRef(null),jo=Ap.useCallback(y=>{if($t.current=y,no.current&&(no.current.disconnect(),no.current=null),!y){_t(0);return}_t(y.offsetHeight);let h=new ResizeObserver(()=>{_t(y.offsetHeight);});h.observe(y),no.current=h;},[]);Ap.useEffect(()=>()=>{no.current?.disconnect();},[]);let Ne=Ap.useCallback(()=>X&&ct.current?ct.current.getView():ze.current?.getView(),[X]),Qe=Ap.useCallback(()=>{X&&ct.current?ct.current.focus():ze.current?.focus();},[X]),La=Ap.useCallback(()=>{X&&ct.current?ct.current.undo():ze.current?.undo();},[X]),Da=Ap.useCallback(()=>{X&&ct.current?ct.current.redo():ze.current?.redo();},[X]),yt=chunkVTAS7VZ6_cjs.m(),xt=chunkXS2AQFMF_cjs.m(),[Rr,Pr]=Ap.useState(false),Aa=Ap.useCallback(()=>Pr(true),[]),[So,ko]=Ap.useState(null);Ap.useEffect(()=>{if(!t){n&&(se.reset(n),q(h=>({...h,isLoading:false})),chunkPIVLDW7B_cjs.l(n).catch(h=>{console.warn("Failed to load document fonts:",h);}));return}q(h=>({...h,isLoading:true,parseError:null})),(async()=>{try{let h=await chunkPIVLDW7B_cjs.n(t);se.reset(h),q(D=>({...D,isLoading:!1,parseError:null})),chunkPIVLDW7B_cjs.l(h).catch(D=>{console.warn("Failed to load document fonts:",D);});}catch(h){let D=h instanceof Error?h.message:"Failed to parse document";q(J=>({...J,isLoading:false,parseError:D})),s?.(h instanceof Error?h:new Error(D));}})();},[t,n,s]),Ap.useEffect(()=>{n&&!t&&se.reset(n);},[n,t]),Ap.useEffect(()=>{se.state?Ot.current=new chunkKL2RYY6G_cjs.f(se.state):Ot.current=null;},[se.state]);let Er=Ap.useRef(false);Ap.useEffect(()=>{if(!v.isLoading&&se.state){let y=setTimeout(()=>{Ln(),Er.current||(Er.current=true,pt(h=>(h.length>0&&Je(true),h)));},200);return ()=>clearTimeout(y)}},[v.isLoading,se.state,Ln]),Ap.useEffect(()=>chunkPIVLDW7B_cjs.h(()=>{l?.();}),[l]),Ap.useEffect(()=>{let y=ze.current?.getView();y&&Mu(kn==="suggesting",y.state,y.dispatch,r);},[kn,r]);let Gt=Ap.useCallback(y=>(se.push(y),y),[se]),Yt=Ap.useCallback(y=>{if(Gt(y),i?.(y),ge.current){let h=ze.current?.getView();h&&be(Eo(h.state.doc));}Lt.current&&clearTimeout(Lt.current),Lt.current=setTimeout(Ln,300);},[i,Gt,Ln]),Co=Ap.useCallback(y=>{let h=Ne();if(h){let{from:Le,to:et}=h.state.selection;Dt.current={from:Le,to:et};}let D=null;if(h&&(D=Ke(h.state),D.isInTable||(D=null)),D?.cellBorderColor){let Le=D.cellBorderColor,et=Le.rgb;(!et||et==="auto")&&(et=chunkIA4LPH2A_cjs.a(Le,u).replace(/^#/,"")),Pt.current={...Pt.current,color:{rgb:et}};}let J=null;if(h){let Le=h.state.selection,et=Le.node;et?.type.name==="image"&&(J={pos:Le.from,wrapType:et.attrs.wrapType??"inline",displayMode:et.attrs.displayMode??"inline",cssFloat:et.attrs.cssFloat??null,transform:et.attrs.transform??null,alt:et.attrs.alt??null,borderWidth:et.attrs.borderWidth??null,borderColor:et.attrs.borderColor??null,borderStyle:et.attrs.borderStyle??null});}if(!y){ln(null),q(Le=>({...Le,selectionFormatting:{},pmTableContext:D,pmImageContext:J}));return}let{textFormatting:ne,paragraphFormatting:ie}=y,oe=ne.fontFamily?.ascii||ne.fontFamily?.hAnsi,le=ne.color?.rgb?`#${ne.color.rgb}`:void 0,ye=ie.numPr,Pe=ye?{type:ye.numId===1?"bullet":"numbered",level:ye.ilvl??0,isInList:true,numId:ye.numId}:void 0,ot={bold:ne.bold,italic:ne.italic,underline:!!ne.underline,strike:ne.strike,superscript:ne.vertAlign==="superscript",subscript:ne.vertAlign==="subscript",fontFamily:oe,fontSize:ne.fontSize,color:le,highlight:ne.highlight,alignment:ie.alignment,lineSpacing:ie.lineSpacing,listState:Pe,styleId:y.styleId??void 0,indentLeft:ie.indentLeft,bidi:!!ie.bidi};if(q(Le=>({...Le,selectionFormatting:ot,paragraphIndentLeft:ie.indentLeft??0,paragraphIndentRight:ie.indentRight??0,paragraphFirstLineIndent:ie.indentFirstLine??0,paragraphHangingIndent:ie.hangingIndent??false,paragraphTabs:ie.tabs??null,pmTableContext:D,pmImageContext:J})),h&&y.hasSelection&&!bt&&!ft){let Le=Dn.current,et=xo.current;if(Le&&et){let{from:Wt}=h.state.selection,tn=Le.querySelector(".paged-editor__pages");if(tn){let qt=tn.querySelector(".layout-page"),wo=tn.querySelectorAll("span[data-pm-start]");for(let Br of wo){let vo=Br,gl=Number(vo.dataset.pmStart),Lr=Number(vo.dataset.pmEnd);if(Wt>=gl&&Wt<=Lr){let yf=vo.getBoundingClientRect(),za=et.getBoundingClientRect(),xf=yf.top-za.top+Le.scrollTop,Sf=qt?qt.getBoundingClientRect().right-za.left:za.width/2+408;ln({top:xf,left:Sf});break}}}}}else ln(null);a?.(y);},[a,bt,ft]),oo=lc({document:se.state,onChange:Yt,onSelectionChange:y=>{}});Ap.useEffect(()=>{let y=h=>{let J=navigator.platform.toUpperCase().indexOf("MAC")>=0?h.metaKey:h.ctrlKey;if(!J&&!h.shiftKey&&!h.altKey&&(h.key==="Delete"||h.key==="Backspace")){let ne=ze.current?.getView();if(ne){let ie=ne.state.selection;if("$anchorCell"in ie&&typeof ie.forEachCell=="function"){let le=Ke(ne.state);if(le.isInTable&&le.table){let ye=0;le.table.descendants(ot=>{(ot.type.name==="tableCell"||ot.type.name==="tableHeader")&&(ye+=1);});let Pe=0;if(ie.forEachCell(()=>{Pe+=1;}),ye>0&&Pe>=ye){h.preventDefault(),lr(ne.state,ne.dispatch);return}}}}if(oo.state.tableIndex!==null){h.preventDefault(),oo.handleAction("deleteTable");return}}if(J&&!h.shiftKey&&!h.altKey){if(h.key.toLowerCase()==="f"){h.preventDefault();let ne=window.getSelection(),ie=ne&&!ne.isCollapsed?ne.toString():"";yt.openFind(ie);}else if(h.key.toLowerCase()==="h"){h.preventDefault();let ne=window.getSelection(),ie=ne&&!ne.isCollapsed?ne.toString():"";yt.openReplace(ie);}else if(h.key.toLowerCase()==="k"){h.preventDefault();let ne=ze.current?.getView();if(ne){let ie=Io(ne.state),oe=Mo(ne.state);oe?xt.openEdit({url:oe.href,displayText:ie,tooltip:oe.tooltip}):xt.openInsert(ie);}}}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y);}},[yt,xt,oo]);let T=Ap.useCallback((y,h)=>{let D=Ne();D&&(Ei(y,h)(D.state,D.dispatch),Qe());},[Ne,Qe]),G=Ap.useCallback(()=>{let y=Ne();y&&(ea(y.state,y.dispatch),Qe());},[Ne,Qe]),Y=Ap.useCallback(()=>{let y=Ne();y&&(Pi(y.state,y.dispatch),Qe());},[Ne,Qe]),j=Ap.useCallback(()=>{Fe(y=>{if(!y){let h=ze.current?.getView();h&&be(Eo(h.state.doc));}return !y});},[]),re=Ap.useCallback(y=>{ze.current?.scrollToPosition(y),ze.current?.setSelection(y+1),ze.current?.focus();},[]),K=Ap.useCallback(()=>{en.current?.click();},[]),te=Ap.useCallback(y=>{let h=y.target.files?.[0];if(!h)return;let D=Ne();if(!D)return;let J=new FileReader;J.onload=()=>{let ne=J.result,ie=new Image;ie.onload=()=>{let oe=ie.naturalWidth,le=ie.naturalHeight,ye=612;if(oe>ye){let Wt=ye/oe;oe=ye,le=Math.round(le*Wt);}let Pe=`rId_img_${Date.now()}`,ot=D.state.schema.nodes.image.create({src:ne,alt:h.name,width:oe,height:le,rId:Pe,wrapType:"inline",displayMode:"inline"}),{from:Le}=D.state.selection,et=D.state.tr.insert(Le,ot);D.dispatch(et.scrollIntoView()),Qe();},ie.src=ne;},J.readAsDataURL(h),y.target.value="";},[Ne,Qe]),ee=Ap.useCallback(y=>{let h=Ne();if(!h||!v.pmImageContext)return;let D=v.pmImageContext.pos,J=h.state.doc.nodeAt(D);if(!J||J.type.name!=="image")return;let ne="inline",ie=null;switch(y){case "inline":ne="inline",ie=null;break;case "square":case "tight":case "through":ne="float",ie="left";break;case "topAndBottom":ne="block",ie=null;break;case "behind":case "inFront":ne="float",ie="none";break;case "wrapLeft":ne="float",ie="right",y="square";break;case "wrapRight":ne="float",ie="left",y="square";break}let oe=h.state.tr.setNodeMarkup(D,void 0,{...J.attrs,wrapType:y,displayMode:ne,cssFloat:ie});h.dispatch(oe.scrollIntoView()),Qe();},[Ne,Qe,v.pmImageContext]),ce=Ap.useCallback(y=>{let h=Ne();if(!h||!v.pmImageContext)return;let D=v.pmImageContext.pos,J=h.state.doc.nodeAt(D);if(!J||J.type.name!=="image")return;let ne=J.attrs.transform||"",ie=ne.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),oe=ie?parseFloat(ie[1]):0,le=/scaleX\(-1\)/.test(ne),ye=/scaleY\(-1\)/.test(ne);switch(y){case "rotateCW":oe=(oe+90)%360;break;case "rotateCCW":oe=(oe-90+360)%360;break;case "flipH":le=!le;break;case "flipV":ye=!ye;break}let Pe=[];oe!==0&&Pe.push(`rotate(${oe}deg)`),le&&Pe.push("scaleX(-1)"),ye&&Pe.push("scaleY(-1)");let ot=Pe.length>0?Pe.join(" "):null,Le=h.state.tr.setNodeMarkup(D,void 0,{...J.attrs,transform:ot});h.dispatch(Le.scrollIntoView()),Qe();},[Ne,Qe,v.pmImageContext]),ke=Ap.useCallback(y=>{let h=Ne();if(!h||!v.pmImageContext)return;let D=v.pmImageContext.pos,J=h.state.doc.nodeAt(D);if(!J||J.type.name!=="image")return;let ne=h.state.tr.setNodeMarkup(D,void 0,{...J.attrs,position:{horizontal:y.horizontal,vertical:y.vertical},distTop:y.distTop??J.attrs.distTop,distBottom:y.distBottom??J.attrs.distBottom,distLeft:y.distLeft??J.attrs.distLeft,distRight:y.distRight??J.attrs.distRight});h.dispatch(ne.scrollIntoView()),Qe();},[Ne,Qe,v.pmImageContext]),he=Ap.useCallback(()=>{M(true);},[]),Ce=Ap.useCallback(y=>{let h=Ne();if(!h||!v.pmImageContext)return;let D=v.pmImageContext.pos,J=h.state.doc.nodeAt(D);if(!J||J.type.name!=="image")return;let ne=h.state.tr.setNodeMarkup(D,void 0,{...J.attrs,alt:y.alt??null,borderWidth:y.borderWidth??null,borderColor:y.borderColor??null,borderStyle:y.borderStyle??null});h.dispatch(ne.scrollIntoView()),Qe();},[Ne,Qe,v.pmImageContext]),Me=Ap.useCallback((y,h)=>{if(!se.state?.package)return;let D={...se.state.package.document,finalSectionProperties:{...se.state.package.document.finalSectionProperties,footnotePr:y,endnotePr:h}};Gt({...se.state,package:{...se.state.package,document:D}});},[se,Gt]),Te=Ap.useCallback(y=>{let h=Ne();if(h){switch(y){case "addRowAbove":Mi(h.state,h.dispatch);break;case "addRowBelow":Ao(h.state,h.dispatch);break;case "addColumnLeft":Fi(h.state,h.dispatch);break;case "addColumnRight":Ho(h.state,h.dispatch);break;case "deleteRow":Ii(h.state,h.dispatch);break;case "deleteColumn":Bi(h.state,h.dispatch);break;case "deleteTable":lr(h.state,h.dispatch);break;case "selectTable":Li(h.state,h.dispatch);break;case "selectRow":Di(h.state,h.dispatch);break;case "selectColumn":Ai(h.state,h.dispatch);break;case "mergeCells":Hi(h.state,h.dispatch);break;case "splitCell":Ni(h.state,h.dispatch);break;case "borderAll":Oi(h.state,h.dispatch,Pt.current);break;case "borderOutside":$i(h.state,h.dispatch,Pt.current);break;case "borderInside":_i(h.state,h.dispatch,Pt.current);break;case "borderNone":zi(h.state,h.dispatch);break;case "borderTop":On("top",Pt.current,true)(h.state,h.dispatch);break;case "borderBottom":On("bottom",Pt.current,true)(h.state,h.dispatch);break;case "borderLeft":On("left",Pt.current,true)(h.state,h.dispatch);break;case "borderRight":On("right",Pt.current,true)(h.state,h.dispatch);break;default:if(typeof y=="object"){if(y.type==="cellFillColor")Zi(y.color)(h.state,h.dispatch);else if(y.type==="borderColor"){let D=y.color.replace(/^#/,"");Pt.current={...Pt.current,color:{rgb:D}},Ji(y.color)(h.state,h.dispatch);}else if(y.type==="borderWidth")Pt.current={...Pt.current,size:y.size},Qi(y.size)(h.state,h.dispatch);else if(y.type==="cellBorder")On(y.side,{style:y.style,size:y.size,color:{rgb:y.color.replace(/^#/,"")}})(h.state,h.dispatch);else if(y.type==="cellVerticalAlign")Wi(y.align)(h.state,h.dispatch);else if(y.type==="cellMargins")Vi(y.margins)(h.state,h.dispatch);else if(y.type==="cellTextDirection")Ui(y.direction)(h.state,h.dispatch);else if(y.type==="toggleNoWrap")ji()(h.state,h.dispatch);else if(y.type==="rowHeight")Ki(y.height,y.rule)(h.state,h.dispatch);else if(y.type==="toggleHeaderRow")Gi()(h.state,h.dispatch);else if(y.type==="distributeColumns")Yi()(h.state,h.dispatch);else if(y.type==="autoFitContents")Xi()(h.state,h.dispatch);else if(y.type==="openTableProperties")$(true);else if(y.type==="tableProperties")cr(y.props)(h.state,h.dispatch);else if(y.type==="applyTableStyle"){let D=xu(y.styleId),J=dn.current;if(!D&&J?.package.styles){let ie=zn(J.package.styles).getStyle(y.styleId);if(ie){if(D={id:ie.styleId,name:ie.name??ie.styleId},ie.tblPr?.borders){let oe=ie.tblPr.borders;D.tableBorders={};for(let le of ["top","bottom","left","right","insideH","insideV"]){let ye=oe[le];ye&&(D.tableBorders[le]={style:ye.style,size:ye.size,color:ye.color?.rgb?{rgb:ye.color.rgb}:void 0});}}if(ie.tblStylePr){D.conditionals={};for(let oe of ie.tblStylePr){let le={};if(oe.tcPr?.shading?.fill&&(le.backgroundColor=`#${oe.tcPr.shading.fill}`),oe.tcPr?.borders){let ye={};for(let Pe of ["top","bottom","left","right"]){let ot=oe.tcPr.borders[Pe];ot&&(ye[Pe]={style:ot.style,size:ot.size,color:ot.color?.rgb?{rgb:ot.color.rgb}:void 0});}le.borders=ye;}oe.rPr?.bold&&(le.bold=true),oe.rPr?.color?.rgb&&(le.color=`#${oe.rPr.color.rgb}`),D.conditionals[oe.type]=le;}}D.look={firstRow:true,lastRow:false,noHBand:false,noVBand:true};}}D&&qi({styleId:D.id,tableBorders:D.tableBorders,conditionals:D.conditionals,look:D.look})(h.state,h.dispatch);}}else oo.handleAction(y);}Qe();}},[oo,Ne,Qe]),Be=Ap.useCallback(y=>{let h=Ne();if(!h)return;h.focus();let D=h===ze.current?.getView(),{from:J,to:ne}=h.state.selection,ie=Dt.current;if(D&&ie&&(J!==ie.from||ne!==ie.to))try{let oe=h.state.tr.setSelection(prosemirrorState.TextSelection.create(h.state.doc,ie.from,ie.to));h.dispatch(oe);}catch(oe){console.warn("Could not restore selection:",oe);}if(y==="bold"){ni(h.state,h.dispatch);return}if(y==="italic"){oi(h.state,h.dispatch);return}if(y==="underline"){ri(h.state,h.dispatch);return}if(y==="strikethrough"){ii(h.state,h.dispatch);return}if(y==="superscript"){ai(h.state,h.dispatch);return}if(y==="subscript"){si(h.state,h.dispatch);return}if(y==="bulletList"){Si(h.state,h.dispatch);return}if(y==="numberedList"){ki(h.state,h.dispatch);return}if(y==="indent"){Ci(h.state,h.dispatch)||hi()(h.state,h.dispatch);return}if(y==="outdent"){Ti(h.state,h.dispatch)||bi()(h.state,h.dispatch);return}if(y==="clearFormatting"){er(h.state,h.dispatch);return}if(y==="setRtl"){vi(h.state,h.dispatch);return}if(y==="setLtr"){Ri(h.state,h.dispatch);return}if(y==="insertLink"){let oe=Io(h.state),le=Mo(h.state);le?xt.openEdit({url:le.href,displayText:oe,tooltip:le.tooltip}):xt.openInsert(oe);return}if(typeof y=="object")switch(y.type){case "alignment":mi(y.value)(h.state,h.dispatch);break;case "textColor":{let oe=y.value;typeof oe=="string"?rr({rgb:oe.replace("#","")})(h.state,h.dispatch):oe.auto?li(h.state,h.dispatch):rr(oe)(h.state,h.dispatch);break}case "highlightColor":{let oe=y.value?chunkOWMG5MW5_cjs.z(y.value):"";ci(oe||y.value)(h.state,h.dispatch);break}case "fontSize":di(chunkOWMG5MW5_cjs.i(y.value))(h.state,h.dispatch);break;case "fontFamily":ui(y.value)(h.state,h.dispatch);break;case "lineSpacing":gi(y.value)(h.state,h.dispatch);break;case "applyStyle":{let oe=dn.current,le=oe?.package.styles?zn(oe.package.styles):null;if(le){let ye=le.resolveParagraphStyle(y.value);sr(y.value,{paragraphFormatting:ye.paragraphFormatting,runFormatting:ye.runFormatting})(h.state,h.dispatch);}else sr(y.value)(h.state,h.dispatch);break}}},[Ne]),Ue=Ap.useCallback(y=>{q(h=>({...h,zoom:y}));},[]),at=Ap.useCallback(y=>{let h=Ne();if(!h)return;let D=y.url||"",J=y.tooltip,{empty:ne}=h.state.selection;ne&&y.displayText?ir(y.displayText,D,J)(h.state,h.dispatch):ne?y.displayText&&ir(y.displayText,D,J)(h.state,h.dispatch):pi(D,J)(h.state,h.dispatch),xt.close(),Qe();},[xt,Ne,Qe]),st=Ap.useCallback(()=>{let y=Ne();y&&(fi(y.state,y.dispatch),Qe());},[Ne,Qe]),Et=Ap.useCallback(()=>{st(),xt.close();},[xt,st]),Xt=Ap.useCallback(y=>ko(y),[]),ro=Ap.useCallback(y=>{window.open(y,"_blank","noopener,noreferrer");},[]),Ko=Ap.useCallback(y=>{navigator.clipboard.writeText(y).catch(()=>{let h=document.createElement("textarea");h.value=y,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h);});},[]),Mr=Ap.useCallback((y,h)=>{let D=Ne();if(!D)return;let J=D.state.schema.marks.hyperlink;if(!J)return;let{$from:ne}=D.state.selection,ie=ne.marks().find(oe=>oe.type===J);if(ie){let oe=ne.parent,le=ne.start(),ye=[],Pe=null;oe.forEach((qt,wo)=>{let Br=le+wo,vo=Br+qt.nodeSize;(qt.isText?qt.marks.find(Lr=>Lr.type===J&&Lr.attrs.href===ie.attrs.href):null)?Pe?Pe.end=vo:Pe={start:Br,end:vo}:Pe&&(ye.push(Pe),Pe=null);}),Pe&&ye.push(Pe);let ot=ne.pos,Le=ye.find(qt=>qt.start<=ot&&ot<=qt.end);if(!Le)return;let et=D.state.tr,Wt=J.create({href:h,tooltip:ie.attrs.tooltip}),tn=D.state.schema.text(y,[...ne.marks().filter(qt=>qt.type!==J),Wt]);et.replaceWith(Le.start,Le.end,tn),D.dispatch(et.scrollIntoView());}ko(null),Qe();},[Ne,Qe]),An=Ap.useCallback(()=>{let y=Ne();if(!y)return;let h=y.state.schema.marks.hyperlink;if(!h)return;let{$from:D}=y.state.selection,J=D.marks().find(Le=>Le.type===h);if(!J&&D.nodeAfter&&(J=D.nodeAfter.marks.find(Le=>Le.type===h)),!J&&D.nodeBefore&&(J=D.nodeBefore.marks.find(Le=>Le.type===h)),!J&&So&&D.parent.forEach(et=>{if(!J&&et.isText){let Wt=et.marks.find(tn=>tn.type===h&&tn.attrs.href===So.href);Wt&&(J=Wt);}}),!J)return;let ne=D.parent,ie=D.start(),oe=[],le=null;ne.forEach((Le,et)=>{let Wt=ie+et,tn=Wt+Le.nodeSize;(Le.isText?Le.marks.find(wo=>wo.type===h&&wo.attrs.href===J.attrs.href):null)?le?le.end=tn:le={start:Wt,end:tn}:le&&(oe.push(le),le=null);}),le&&oe.push(le);let ye=D.pos,Pe=oe.find(Le=>Le.start<=ye&&ye<=Le.end);if(!Pe)return;let ot=y.state.tr;ot.removeMark(Pe.start,Pe.end,h),y.dispatch(ot.scrollIntoView()),ko(null),Qe(),sonner.toast("Link removed");},[Ne,Qe,So]),io=Ap.useCallback(()=>{ko(null);},[]),wt=Ap.useCallback(y=>h=>{if(!se.state||ft)return;let D={...se.state,package:{...se.state.package,document:{...se.state.package.document,finalSectionProperties:{...se.state.package.document.finalSectionProperties,[y]:h}}}};Yt(D);},[se.state,ft,Yt]),ao=Ap.useMemo(()=>wt("marginLeft"),[wt]),so=Ap.useMemo(()=>wt("marginRight"),[wt]),Ha=Ap.useMemo(()=>wt("marginTop"),[wt]),Jp=Ap.useMemo(()=>wt("marginBottom"),[wt]),Qp=Ap.useCallback(y=>{if(!se.state||ft)return;let h={...se.state,package:{...se.state.package,document:{...se.state.package.document,finalSectionProperties:{...se.state.package.document.finalSectionProperties,...y}}}};Yt(h);},[se.state,ft,Yt]),ef=Ap.useCallback(y=>{let h=Ne();h&&yi(y)(h.state,h.dispatch);},[Ne]),tf=Ap.useCallback(y=>{let h=Ne();h&&xi(y)(h.state,h.dispatch);},[Ne]),nf=Ap.useCallback(y=>{let h=Ne();h&&(y<0?ar(-y,true)(h.state,h.dispatch):ar(y,false)(h.state,h.dispatch));},[Ne]),of=Ap.useCallback(y=>{let h=Ne();h&&wi(y)(h.state,h.dispatch);},[Ne]),To=Dn.current;Ap.useEffect(()=>{if(!To)return;let y=()=>{let h=ze.current?.getLayout();if(!h||h.pages.length===0)return;let D=To.scrollTop,J=h.pages.length,ne=24,ie=24,oe=D+To.clientHeight/2,le=ie,ye=1;for(let Pe=0;Pe<h.pages.length;Pe++){let ot=h.pages[Pe].size.h,Le=le+ot;if(oe<Le){ye=Pe+1;break}le=Le+ne,ye=Pe+2;}ye=Math.min(ye,J),vr({currentPage:ye,totalPages:J,visible:true}),wn.current&&clearTimeout(wn.current),wn.current=setTimeout(()=>{vr(Pe=>({...Pe,visible:false}));},600);};return To.addEventListener("scroll",y,{passive:true}),()=>{To.removeEventListener("scroll",y),wn.current&&clearTimeout(wn.current);}},[To]);let ml=Ap.useCallback(async y=>{if(!Ot.current)return null;try{let h=Ot.current.getDocument(),D=ze.current?.getDocument();D?.package?.document&&(h.package.document.content=D.package.document.content),h.package.document.comments=We;let J=y?.selective!==!1,ne=ze.current?.getView(),ie;if(J&&ne){let le=ne.state;ie={selective:{changedParaIds:Ld(le),structuralChange:Dd(le),hasUntrackedChanges:Ad(le)}};}let oe=await Ot.current.toBuffer(ie);return ne&&ne.dispatch(Hd(ne.state)),o?.(oe),oe}catch(h){return s?.(h instanceof Error?h:new Error("Failed to save document")),null}},[o,s,We]),rf=Ap.useCallback(y=>{s?.(y);},[s]),Ir=Ap.useCallback(()=>{let y=Qt.current?.querySelector(".paged-editor__pages");if(!y){window.print(),A?.();return}let h=window.open("","_blank");if(!h){window.print(),A?.();return}let D=[];for(let ne of Array.from(document.styleSheets))try{for(let ie of Array.from(ne.cssRules))ie instanceof CSSFontFaceRule&&D.push(ie.cssText);}catch{}let J=y.cloneNode(true);J.style.cssText="display: block; margin: 0; padding: 0;";for(let ne of Array.from(J.querySelectorAll(".layout-page"))){let ie=ne;ie.style.boxShadow="none",ie.style.margin="0";}h.document.write(`<!DOCTYPE html>
19
- <html><head><title>Print</title>
20
- <style>
21
- ${D.join(`
22
- `)}
23
- * { margin: 0; padding: 0; }
24
- body { background: white; }
25
- .layout-page { break-after: page; }
26
- .layout-page:last-child { break-after: auto; }
27
- @page { margin: 0; size: auto; }
28
- </style>
29
- </head><body>${J.outerHTML}</body></html>`),h.document.close(),h.onload=()=>{h.print(),h.close();},setTimeout(()=>{h.closed||(h.print(),h.close());},1e3),A?.();},[A]),At=Ap.useRef(null),af=Ap.useCallback((y,h)=>{if(!se.state||!y.trim())return At.current=null,null;let D=chunkVTAS7VZ6_cjs.j(se.state,y,h),J={matches:D,totalCount:D.length,currentIndex:0};return At.current=J,yt.setMatches(D,0),D.length>0&&Qt.current&&chunkVTAS7VZ6_cjs.l(Qt.current,D[0]),J},[se.state,yt]),sf=Ap.useCallback(()=>{if(!At.current||At.current.matches.length===0)return null;let y=yt.goToNextMatch(),h=At.current.matches[y];return h&&Qt.current&&chunkVTAS7VZ6_cjs.l(Qt.current,h),h||null},[yt]),lf=Ap.useCallback(()=>{if(!At.current||At.current.matches.length===0)return null;let y=yt.goToPreviousMatch(),h=At.current.matches[y];return h&&Qt.current&&chunkVTAS7VZ6_cjs.l(Qt.current,h),h||null},[yt]),cf=Ap.useCallback(y=>{if(!se.state||!At.current||At.current.matches.length===0)return false;let h=At.current.matches[At.current.currentIndex];if(!h)return false;try{let D=chunkP7ZF45KZ_cjs.a(se.state,{type:"replaceText",range:{start:{paragraphIndex:h.paragraphIndex,offset:h.startOffset},end:{paragraphIndex:h.paragraphIndex,offset:h.endOffset}},text:y});return Yt(D),!0}catch(D){return console.error("Replace failed:",D),false}},[se.state,Yt]),df=Ap.useCallback((y,h,D)=>{if(!se.state||!y.trim())return 0;let J=chunkVTAS7VZ6_cjs.j(se.state,y,D);if(J.length===0)return 0;let ne=se.state,ie=[...J].sort((oe,le)=>oe.paragraphIndex!==le.paragraphIndex?le.paragraphIndex-oe.paragraphIndex:le.startOffset-oe.startOffset);for(let oe of ie)try{ne=chunkP7ZF45KZ_cjs.a(ne,{type:"replaceText",range:{start:{paragraphIndex:oe.paragraphIndex,offset:oe.startOffset},end:{paragraphIndex:oe.paragraphIndex,offset:oe.endOffset}},text:h});}catch(le){console.error("Replace failed for match:",oe,le);}return Yt(ne),At.current=null,yt.setMatches([],0),J.length},[se.state,Yt,yt]);Ap.useImperativeHandle(N,()=>({getAgent:()=>Ot.current,getDocument:()=>se.state,getEditorRef:()=>ze.current,save:ml,setZoom:y=>q(h=>({...h,zoom:y})),getZoom:()=>v.zoom,focus:()=>{ze.current?.focus();},getCurrentPage:()=>Kt.currentPage,getTotalPages:()=>Kt.totalPages,scrollToPage:y=>{},openPrintPreview:Ir,print:Ir}),[se.state,v.zoom,Kt,ml,Ir]);let{headerContent:Go,footerContent:Yo}=Ap.useMemo(()=>{if(!se.state?.package)return {headerContent:null,footerContent:null};let y=se.state.package,h=y.document?.finalSectionProperties,D=y.headers,J=y.footers,ne=null,ie=null;if(D&&h?.headerReferences){let oe=h.headerReferences.find(le=>le.type==="default");oe?.rId&&(ne=D.get(oe.rId)??null);}if(J&&h?.footerReferences){let oe=h.footerReferences.find(le=>le.type==="default");oe?.rId&&(ie=J.get(oe.rId)??null);}return {headerContent:ne,footerContent:ie}},[se.state]),uf=Ap.useCallback(y=>{if(y==="header"?Go:Yo){ue(y);return}if(!se.state?.package)return;let D=se.state.package,J=D.document?.finalSectionProperties;if(!J)return;let ne=`rId_new_${y}`,ie={type:y==="header"?"header":"footer",hdrFtrType:"default",content:[{type:"paragraph",content:[]}]},oe=y==="header"?"headers":"footers",le=new Map(D[oe]??[]);le.set(ne,ie);let ye=y==="header"?"headerReferences":"footerReferences",Pe=J[ye]??[],ot={type:"default",rId:ne},Le={...se.state,package:{...D,[oe]:le,document:D.document?{...D.document,finalSectionProperties:{...J,[ye]:[...Pe,ot]}}:D.document}};Gt(Le),ue(y);},[Go,Yo,se,Gt]),Na=Ap.useCallback(y=>{if(!X||!se.state?.package){ue(null);return}let h=se.state.package,D=h.document?.finalSectionProperties,ne=(X==="header"?D?.headerReferences:D?.footerReferences)?.find(le=>le.type==="default"),ie=X==="header"?"headers":"footers",oe=h[ie];if(ne?.rId&&oe){let le=oe.get(ne.rId),ye={type:X,hdrFtrType:"default",...le,content:y},Pe=new Map(oe);Pe.set(ne.rId,ye);let ot={...se.state,package:{...h,[ie]:Pe}};Gt(ot);}ue(null);},[X,se,Gt]),pf=Ap.useCallback(()=>{if(!X)return;let y=ct.current?.getView();if(y){let h=or(y.state.doc);Na(h);}else ue(null);},[X,Na]),ff=Ap.useCallback(()=>{if(!X||!se.state?.package){ue(null);return}let y=se.state.package,h=y.document?.finalSectionProperties,D=X==="header"?"headerReferences":"footerReferences",J=X==="header"?"headers":"footers",ne=h?.[D],ie=ne?.find(oe=>oe.type==="default");if(ie?.rId){let oe=new Map(y[J]??[]);oe.delete(ie.rId);let le=(ne??[]).filter(Pe=>Pe.rId!==ie.rId),ye={...se.state,package:{...y,[J]:oe,document:y.document?{...y.document,finalSectionProperties:{...h,[D]:le}}:y.document}};Gt(ye);}ue(null);},[X,se,Gt]),mf=Ap.useCallback(y=>{let h=Qt.current?.querySelector(".paged-editor__pages");if(!h)return null;let D=y==="header"?".layout-page-header":".layout-page-footer";return h.querySelector(D)},[]),Fr={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...E},gf={display:"flex",flex:1,minHeight:0,minWidth:0,flexDirection:"row"},hf={flex:1,minHeight:0,minWidth:0,overflow:"auto",position:"relative"};if(v.isLoading)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-loading ${x}`,style:Fr,"data-testid":"docx-editor",children:B||jsxRuntime.jsx(Su,{})});if(v.parseError)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-error ${x}`,style:Fr,"data-testid":"docx-editor",children:jsxRuntime.jsx(Cu,{message:v.parseError})});if(!se.state)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-empty ${x}`,style:Fr,"data-testid":"docx-editor",children:w||jsxRuntime.jsx(ku,{})});let bf=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunkOWMG5MW5_cjs.C,{}),jsxRuntime.jsx(chunkOWMG5MW5_cjs.A,{onClick:()=>Je(!tt),active:tt,title:"Toggle comments sidebar",ariaLabel:"Toggle comments sidebar",children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"comment",size:20})}),jsxRuntime.jsx(chunkOWMG5MW5_cjs.C,{}),jsxRuntime.jsx(Sx,{mode:kn,onModeChange:y=>{Cn(y),y==="suggesting"&&Je(true);}}),C]});return jsxRuntime.jsx(ac,{children:jsxRuntime.jsx(_r,{onError:rf,children:jsxRuntime.jsxs("div",{ref:Qt,className:`ep-root docx-editor ${x}`,style:Fr,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:gf,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[d&&!S&&jsxRuntime.jsxs("div",{ref:jo,className:"z-50 flex flex-col gap-0 bg-white shadow-sm flex-shrink-0",children:[jsxRuntime.jsxs(Ht,{currentFormatting:v.selectionFormatting,onFormat:Be,onUndo:La,onRedo:Da,canUndo:true,canRedo:true,disabled:ft,documentStyles:se.state?.package.styles?.styles,theme:se.state?.package.theme||u,showPrintButton:V,onPrint:Ir,showZoomControl:c,zoom:v.zoom,onZoomChange:Ue,onRefocusEditor:Qe,onInsertTable:T,showTableInsert:true,onInsertImage:K,onInsertPageBreak:G,onInsertTOC:Y,imageContext:v.pmImageContext,onImageWrapType:ee,onImageTransform:ce,onOpenImageProperties:he,onPageSetup:Aa,tableContext:v.pmTableContext,onTableAction:Te,children:[jsxRuntime.jsxs(Ht.TitleBar,{children:[je&&jsxRuntime.jsx(Ht.Logo,{children:je()}),R!==void 0&&jsxRuntime.jsx(Ht.DocumentName,{value:R,onChange:L,editable:k}),P&&jsxRuntime.jsx(Ht.TitleBarRight,{children:P()}),jsxRuntime.jsx(Ht.MenuBar,{})]}),jsxRuntime.jsx(Ht.FormattingBar,{children:bf})]}),m&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",style:{paddingRight:tt?"calc(20px + 240px)":void 0,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.E,{sectionProps:se.state?.package.document?.finalSectionProperties,zoom:v.zoom,unit:b,editable:!ft,onLeftMarginChange:ao,onRightMarginChange:so,indentLeft:v.paragraphIndentLeft,indentRight:v.paragraphIndentRight,onIndentLeftChange:ef,onIndentRightChange:tf,showFirstLineIndent:true,firstLineIndent:v.paragraphFirstLineIndent,hangingIndent:v.paragraphHangingIndent,onFirstLineIndentChange:nf,tabStops:v.paragraphTabs,onTabStopRemove:of})})]}),jsxRuntime.jsx("div",{ref:Dn,style:hf,children:jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative"},children:jsxRuntime.jsxs("div",{ref:xo,style:{position:"relative",flex:1,minWidth:0},onMouseDown:y=>{y.target===y.currentTarget&&(y.preventDefault(),ze.current?.focus());},children:[m&&!S&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:10,paddingTop:48},children:jsxRuntime.jsx(Sc,{sectionProps:se.state?.package.document?.finalSectionProperties,zoom:v.zoom,unit:b,editable:!ft,onTopMarginChange:Ha,onBottomMarginChange:Jp})}),jsxRuntime.jsx(Bp,{ref:ze,document:se.state,styles:se.state?.package.styles,theme:se.state?.package.theme||u,sectionProperties:se.state?.package.document?.finalSectionProperties,headerContent:Go,footerContent:Yo,onHeaderFooterDoubleClick:uf,hfEditMode:X,onBodyClick:pf,zoom:v.zoom,readOnly:ft,extensionManager:cn,onDocumentChange:Yt,onSelectionChange:(y,h)=>{let D=ze.current?.getView();if(D){let J=Do(D.state);Co(J);}else Co(null);},externalPlugins:Jt,onReady:y=>{pe?.(y.getView());},onRenderedDomContextReady:He,pluginOverlays:Ie,onHyperlinkClick:Xt,commentsSidebarOpen:tt,scrollContainerRef:Dn,sidebarOverlay:tt?jsxRuntime.jsx(gc,{comments:We,trackedChanges:qe,pageWidth:(()=>{let y=se.state?.package?.document?.finalSectionProperties;return y?.pageWidth?Math.round(y.pageWidth/15):816})(),editorContainerRef:Dn,onCommentResolve:y=>{nt(h=>h.map(D=>D.id===y?{...D,done:true}:D));},onCommentDelete:y=>{nt(h=>h.filter(D=>D.id!==y&&D.parentId!==y));},onCommentReply:(y,h)=>{nt(D=>[...D,dl(h,r,y)]);},onAddComment:y=>{let h=dl(y,r),D=ze.current?.getView();if(D&&it){let{from:J,to:ne}=it,ie=D.state.schema.marks.comment.create({commentId:cl}),oe=D.state.schema.marks.comment.create({commentId:h.id}),le=D.state.tr.removeMark(J,ne,ie).addMark(J,ne,oe);D.dispatch(le);}nt(J=>[...J,h]),De(false),Ve(null),to(null);},onTrackedChangeReply:(y,h)=>{nt(D=>[...D,dl(h,r,y)]);},onCancelAddComment:()=>{let y=ze.current?.getView();if(y&&it){let{from:h,to:D}=it,J=y.state.schema.marks.comment.create({commentId:cl});y.dispatch(y.state.tr.removeMark(h,D,J));}De(false),Ve(null),to(null);},onAcceptChange:(y,h)=>{let D=ze.current?.getView();D&&(ws(y,h)(D.state,D.dispatch),Ln());},onRejectChange:(y,h)=>{let D=ze.current?.getView();D&&(vs(y,h)(D.state,D.dispatch),Ln());},isAddingComment:bt,addCommentYPosition:Tt,topOffset:0}):void 0}),zt!=null&&!bt&&!ft&&jsxRuntime.jsx(chunkOWMG5MW5_cjs.c,{content:"Add comment",side:"bottom",delayMs:300,children:jsxRuntime.jsx("button",{type:"button",onMouseDown:y=>{y.preventDefault(),y.stopPropagation();let h=ze.current?.getView();if(h){let{from:D,to:J}=h.state.selection;if(D!==J){Ve({from:D,to:J});let ne=h.state.schema.marks.comment.create({commentId:cl}),ie=h.state.tr.addMark(D,J,ne);ie.setSelection(prosemirrorState.TextSelection.create(ie.doc,J)),h.dispatch(ie);}}to(zt.top),tt||Je(true),De(true),ln(null);},style:{position:"absolute",top:zt.top,left:zt.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(chunkOWMG5MW5_cjs.d,{name:"add_comment",size:16})})}),X&&(X==="header"?Go:Yo)&&(()=>{let y=mf(X),h=xo.current;return !y||!h?null:jsxRuntime.jsx(fu,{ref:ct,headerFooter:X==="header"?Go:Yo,position:X,styles:se.state?.package.styles,targetElement:y,parentElement:h,onSave:Na,onClose:()=>ue(null),onSelectionChange:Co,onRemove:ff})})()]})})}),Kt.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:Kt.visible?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:[Kt.currentPage," of ",Kt.totalPages]}),fe&&jsxRuntime.jsx(dc,{headings:Ee,onHeadingClick:re,onClose:()=>Fe(false),topOffset:wr}),!fe&&jsxRuntime.jsx("button",{className:"docx-outline-nav",onClick:j,onMouseDown:y=>y.stopPropagation(),title:"Show document outline",style:{position:"absolute",left:48,top:wr+12,zIndex:20,background:"transparent",border:"none",borderRadius:"50%",padding:6,cursor:"pointer",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(chunkOWMG5MW5_cjs.d,{name:"format_list_bulleted",size:20,style:{color:"#444746"}})})]})}),jsxRuntime.jsx(yu,{data:So,onNavigate:ro,onCopy:Ko,onEdit:Mr,onRemove:An,onClose:io,readOnly:ft}),jsxRuntime.jsx(sonner.Toaster,{position:"bottom-right"}),jsxRuntime.jsxs(Ap.Suspense,{fallback:null,children:[yt.state.isOpen&&jsxRuntime.jsx(ux,{isOpen:yt.state.isOpen,onClose:yt.close,onFind:af,onFindNext:sf,onFindPrevious:lf,onReplace:cf,onReplaceAll:df,initialSearchText:yt.state.searchText,replaceMode:yt.state.replaceMode,currentResult:At.current}),xt.state.isOpen&&jsxRuntime.jsx(px,{isOpen:xt.state.isOpen,onClose:xt.close,onSubmit:at,onRemove:xt.state.isEditing?Et:void 0,initialData:xt.state.initialData,selectedText:xt.state.selectedText,isEditing:xt.state.isEditing}),ae&&jsxRuntime.jsx(fx,{isOpen:ae,onClose:()=>$(false),onApply:y=>{let h=Ne();h&&cr(y)(h.state,h.dispatch);},currentProps:v.pmTableContext?.table?.attrs}),U&&jsxRuntime.jsx(mx,{isOpen:U,onClose:()=>Z(false),onApply:ke}),xe&&jsxRuntime.jsx(gx,{isOpen:xe,onClose:()=>M(false),onApply:Ce,currentData:v.pmImageContext?{alt:v.pmImageContext.alt??void 0,borderWidth:v.pmImageContext.borderWidth??void 0,borderColor:v.pmImageContext.borderColor??void 0,borderStyle:v.pmImageContext.borderStyle??void 0}:void 0}),Rr&&jsxRuntime.jsx(bx,{isOpen:Rr,onClose:()=>Pr(false),onApply:Qp,currentProps:se.state?.package.document?.finalSectionProperties}),W&&jsxRuntime.jsx(hx,{isOpen:W,onClose:()=>O(false),onApply:Me,footnotePr:se.state?.package.document?.finalSectionProperties?.footnotePr,endnotePr:se.state?.package.document?.finalSectionProperties?.endnotePr})]}),jsxRuntime.jsx("input",{ref:en,type:"file",accept:"image/*",style:{display:"none"},onChange:te})]})})})});function XP(e,t,n={}){return new Promise((o,r)=>{let i=Ap__default.default.createRef(),a=null;try{a=client.createRoot(t);}catch(d){r(d);return}let s={save:async()=>{let d=await(i.current?.save()??Promise.resolve(null));return d?new Blob([d],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}):null},getDocument:()=>i.current?.getDocument()??null,focus:()=>i.current?.focus(),setZoom:d=>i.current?.setZoom(d),destroy:()=>{a?.unmount(),a=null;}},l=false,u=Ap__default.default.createElement(Dp,{...n,documentBuffer:e,onError:d=>{n.onError?.(d),l||(l=true,r(d));},onChange:d=>{n.onChange?.(d),l||(l=true,o(s));},ref:i});a.render(u);})}function rE(e,t={}){let{storageKey:n,interval:o,enabled:r=true,maxAge:i,onSave:a,onError:s,onRecoveryAvailable:l,saveOnChange:u,debounceDelay:d}=t,c=Ap.useMemo(()=>new chunk2VHQ7YOQ_cjs.r({storageKey:n,interval:o,maxAge:i,saveOnChange:u,debounceDelay:d,onSave:a,onError:s,onRecoveryAvailable:l}),[n]);Ap.useEffect(()=>{r?(c.enable(),c.startInterval()):c.disable();},[c,r]),Ap.useEffect(()=>{c.onDocumentChanged(e??null);},[c,e]),Ap.useEffect(()=>()=>{c.destroy();},[c]);let f=Ap.useSyncExternalStore(c.subscribe,c.getSnapshot),p=Ap.useCallback(()=>c.save(),[c]),m=Ap.useCallback(()=>c.clear(),[c]),b=Ap.useCallback(()=>c.getRecoveryData(),[c]),g=Ap.useCallback(()=>c.acceptRecovery(),[c]),S=Ap.useCallback(()=>c.dismissRecovery(),[c]),C=Ap.useCallback(()=>c.enable(),[c]),x=Ap.useCallback(()=>c.disable(),[c]);return {status:f.status,lastSaveTime:f.lastSaveTime,save:p,clearAutoSave:m,hasRecoveryData:f.hasRecoveryData,getRecoveryData:b,acceptRecovery:g,dismissRecovery:S,isEnabled:f.isEnabled,enable:C,disable:x}}var Ex=1,Hp=.25,Np=4,Mx=.1,an=[.25,.5,.75,1,1.25,1.5,2,3,4];function zp(e,t,n){return Math.max(t,Math.min(n,e))}function Op(e){return Math.round(e*100)/100}function Ix(e){let t=an[0],n=Math.abs(e-t);for(let o of an){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function Fx(e){for(let t of an)if(t>e+.01)return t;return an[an.length-1]}function Bx(e){for(let t=an.length-1;t>=0;t--)if(an[t]<e-.01)return an[t];return an[0]}function sE(e={}){let{initialZoom:t=Ex,minZoom:n=Hp,maxZoom:o=Np,zoomStep:r=Mx,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:l=true,preventDefault:u=true}=e,[d,c]=Ap.useState(t),f=Ap.useRef(d);Ap.useEffect(()=>{f.current=d;},[d]);let p=Ap.useCallback(w=>{let B=Op(zp(w,n,o));B!==f.current&&(c(B),s?.(B));},[n,o,s]),m=Ap.useCallback(()=>{p(f.current+r);},[r,p]),b=Ap.useCallback(()=>{p(f.current-r);},[r,p]),g=Ap.useCallback(()=>{p(t);},[t,p]),S=Ap.useCallback(()=>{p(1);},[p]),C=Ap.useCallback((w,B)=>{if(B>0){let _=w/B;p(_);}},[p]),x=Ap.useCallback(w=>{if(!i||!(w.ctrlKey||w.metaKey))return;u&&w.preventDefault();let _=w.deltaY;_<0?p(f.current+r):_>0&&p(f.current-r);},[i,u,r,p]),E=Ap.useCallback(w=>{if(!(!i||!l||!(w.ctrlKey||w.metaKey))){if(w.key==="0"){w.preventDefault(),S();return}if(w.key==="+"||w.key==="="){w.preventDefault(),m();return}if(w.key==="-"){w.preventDefault(),b();return}}},[i,l,m,b,S]);return Ap.useEffect(()=>{if(!i)return;let w=a?.current;if(w)return w.addEventListener("wheel",x,{passive:false}),()=>{w.removeEventListener("wheel",x);}},[i,a,x]),Ap.useEffect(()=>{if(!(!i||!l))return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E);}},[i,l,E]),{zoom:d,setZoom:p,zoomIn:m,zoomOut:b,resetZoom:g,zoomTo100:S,zoomToFit:C,isMinZoom:d<=n,isMaxZoom:d>=o,zoomPercent:Math.round(d*100),handleWheel:x,handleKeyDown:E}}function lE(){return [...an]}function cE(e){return Ix(e)}function dE(e){return Fx(e)}function uE(e){return Bx(e)}function pE(e){return `${Math.round(e*100)}%`}function fE(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function mE(e){return an.some(t=>Math.abs(t-e)<.01)}function gE(e,t=Hp,n=Np){return Op(zp(e,t,n))}var Vo={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},bE={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},yE={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function $p(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 Lx(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 fl(e){let t=$p(e);return Lx(t)}function xE(e,t=Vo){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 SE(e,t=Vo){let n=t.backgroundColor;return `
30
- ${e}::selection,
31
- ${e} *::selection {
32
- background-color: ${n} !important;
33
- color: inherit !important;
34
- }
35
-
36
- ${e}::-moz-selection,
37
- ${e} *::-moz-selection {
38
- background-color: ${n} !important;
39
- color: inherit !important;
40
- }
41
- `}function _p(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function Wp(){let e=window.getSelection();return e?e.toString():""}function Vp(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function kE(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function CE(e,t,n,o,r){try{let i=document.createRange();return i.setStart(t,n),i.setEnd(o,r),i}catch{return null}}function TE(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function wE(){let e=window.getSelection();e&&e.removeAllRanges();}function Dx(){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 vE(){let e=window.getSelection();if(!e||e.rangeCount===0||!Dx())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 eo=null;function Up(e=Vo){Ax();let t=`
42
- /* DOCX Editor Selection Highlighting */
43
-
44
- /* Base selection style for all editable content */
45
- .docx-editor [contenteditable="true"]::selection,
46
- .docx-editor [contenteditable="true"] *::selection,
47
- .docx-run-editable::selection,
48
- .docx-run-editable *::selection {
49
- background-color: ${e.backgroundColor} !important;
50
- color: inherit !important;
51
- }
52
-
53
- /* Firefox selection */
54
- .docx-editor [contenteditable="true"]::-moz-selection,
55
- .docx-editor [contenteditable="true"] *::-moz-selection,
56
- .docx-run-editable::-moz-selection,
57
- .docx-run-editable *::-moz-selection {
58
- background-color: ${e.backgroundColor} !important;
59
- color: inherit !important;
60
- }
61
-
62
- /* Ensure selection is visible against all backgrounds */
63
- .docx-run-highlighted::selection,
64
- .docx-run-highlighted *::selection {
65
- /* For highlighted (yellow background) text, use darker selection */
66
- background-color: rgba(26, 115, 232, 0.5) !important;
67
- }
68
-
69
- .docx-run-highlighted::-moz-selection,
70
- .docx-run-highlighted *::-moz-selection {
71
- background-color: rgba(26, 115, 232, 0.5) !important;
72
- }
73
-
74
- /* Selection in dark text */
75
- .docx-run-dark-bg::selection,
76
- .docx-run-dark-bg *::selection {
77
- /* Use lighter selection for dark backgrounds */
78
- background-color: rgba(100, 181, 246, 0.5) !important;
79
- }
80
-
81
- .docx-run-dark-bg::-moz-selection,
82
- .docx-run-dark-bg *::-moz-selection {
83
- background-color: rgba(100, 181, 246, 0.5) !important;
84
- }
85
-
86
- /* Programmatic highlight class */
87
- .docx-selection-highlight {
88
- background-color: ${e.backgroundColor};
89
- ${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
90
- ${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
91
- }
92
-
93
- /* Find/replace highlight */
94
- .docx-find-highlight {
95
- background-color: rgba(255, 235, 59, 0.5);
96
- border-radius: 2px;
97
- }
98
-
99
- .docx-find-highlight-current {
100
- background-color: rgba(255, 152, 0, 0.6);
101
- border-radius: 2px;
102
- outline: 2px solid rgba(255, 152, 0, 0.8);
103
- }
104
-
105
- /* AI action selection preview */
106
- .docx-ai-selection-preview {
107
- background-color: rgba(156, 39, 176, 0.2);
108
- border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
109
- }
110
- `;eo=document.createElement("style"),eo.id="docx-selection-styles",eo.textContent=t,document.head.appendChild(eo);}function Ax(){eo&&(eo.remove(),eo=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function jp(){return eo!==null||document.getElementById("docx-selection-styles")!==null}function RE(e,t,n=true){return ()=>{if(!e){t([]);return}let o=n?fl(e):$p(e);t(o);}}function BE(e){let{containerRef:t,enabled:n=true,config:o=Vo,useOverlay:r=false,debounceMs:i=16,onSelectionChange:a}=e,[s,l]=Ap.useState(false),[u,d]=Ap.useState(""),[c,f]=Ap.useState([]),[p,m]=Ap.useState(false),b=Ap.useRef(null),g=Ap.useRef(0),S=Ap.useCallback(()=>{let w=t.current,B=_p(),_=Wp(),V=w?Vp(w):false;if(l(B),d(_),m(V),r&&V){let z=fl(w);f(z);}else f([]);a&&a(B&&V,_);},[t,r,a]),C=Ap.useCallback(()=>{let w=performance.now();if(w-g.current<i){b.current!==null&&clearTimeout(b.current),b.current=window.setTimeout(()=>{g.current=performance.now(),S(),b.current=null;},i);return}g.current=w,S();},[i,S]),x=Ap.useCallback(()=>{S();},[S]),E=Ap.useCallback(w=>({position:"absolute",left:`${w.left}px`,top:`${w.top}px`,width:`${w.width}px`,height:`${w.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 Ap.useEffect(()=>(n&&!jp()&&Up(o),()=>{}),[n,o]),Ap.useEffect(()=>{if(!n)return;let w=()=>{C();};return document.addEventListener("selectionchange",w),document.addEventListener("mouseup",w),S(),()=>{document.removeEventListener("selectionchange",w),document.removeEventListener("mouseup",w),b.current!==null&&clearTimeout(b.current);}},[n,C,S]),{hasSelection:s,selectedText:u,highlightRects:c,isSelectionInContainer:p,refresh:x,getOverlayStyle:E}}function LE(e,t=Vo){return e.map((n,o)=>Ap__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 OE(e={}){let{onCopy:t,onCut:n,onPaste:o,cleanWordFormatting:r=true,editable:i=true,onError:a}=e,s=Ap.useRef(false),l=Ap.useRef(null),u=Ap.useCallback(async g=>{if(s.current)return false;s.current=true;try{let S=await chunkOWMG5MW5_cjs.V(g.runs,{onError:a});return S&&t?.(g),S}finally{s.current=false;}},[t,a]),d=Ap.useCallback(async g=>{if(s.current||!i)return false;s.current=true;try{let S=await chunkOWMG5MW5_cjs.V(g.runs,{onError:a});return S&&n?.(g),S}finally{s.current=false;}},[n,i,a]),c=Ap.useCallback(async(g=false)=>{if(s.current||!i)return null;s.current=true;try{if(navigator.clipboard&&navigator.clipboard.read){let S=await navigator.clipboard.read(),C="",x="";for(let w of S)w.types.includes("text/html")&&(C=await(await w.getType("text/html")).text()),w.types.includes("text/plain")&&(x=await(await w.getType("text/plain")).text());g&&(C="");let E=chunkOWMG5MW5_cjs.aa(C,x,r);return l.current=E,o?.(E,g),E}return null}catch(S){return a?.(S),null}finally{s.current=false;}},[i,r,o,a]),f=Ap.useCallback(g=>{let S=chunk2VHQ7YOQ_cjs.F();if(!S)return;g.preventDefault();let C=chunkOWMG5MW5_cjs.X(S.runs);g.clipboardData&&(g.clipboardData.setData("text/plain",C.plainText),g.clipboardData.setData("text/html",C.html),C.internal&&g.clipboardData.setData("application/x-docx-editor",C.internal)),t?.(S);},[t]),p=Ap.useCallback(g=>{if(!i)return;let S=chunk2VHQ7YOQ_cjs.F();if(!S)return;g.preventDefault();let C=chunkOWMG5MW5_cjs.X(S.runs);g.clipboardData&&(g.clipboardData.setData("text/plain",C.plainText),g.clipboardData.setData("text/html",C.html),C.internal&&g.clipboardData.setData("application/x-docx-editor",C.internal)),n?.(S);},[i,n]),m=Ap.useCallback(g=>{if(!i)return;g.preventDefault();let S=chunkOWMG5MW5_cjs.$(g,{cleanWordFormatting:r});if(S){l.current=S;let C=g.shiftKey??false;o?.(S,C);}},[i,r,o]),b=Ap.useCallback(g=>{},[]);return {copy:u,cut:d,paste:c,handleCopy:f,handleCut:p,handlePaste:m,handleKeyDown:b,isProcessing:s.current,lastPastedContent:l.current}}var Ba={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},qp=chunk2VHQ7YOQ_cjs.I,Zp=`
111
- .plugin-host {
112
- display: flex;
113
- width: 100%;
114
- height: 100%;
115
- overflow: visible;
116
- position: relative;
117
- }
118
-
119
- .plugin-host-editor {
120
- flex: 1;
121
- display: flex;
122
- flex-direction: column;
123
- min-width: 0;
124
- overflow: visible;
125
- }
126
-
127
-
128
- .plugin-panels-left,
129
- .plugin-panels-right {
130
- display: flex;
131
- flex-direction: column;
132
- flex-shrink: 0;
133
- background: #f8f9fa;
134
- border-color: #e9ecef;
135
- }
136
-
137
- .plugin-panels-left {
138
- border-right: 1px solid #e9ecef;
139
- }
140
-
141
- .plugin-panels-right {
142
- border-left: 1px solid #e9ecef;
143
- }
144
-
145
- .plugin-panels-bottom {
146
- border-top: 1px solid #e9ecef;
147
- background: #f8f9fa;
148
- }
149
-
150
- .plugin-panel {
151
- position: relative;
152
- display: flex;
153
- flex-direction: column;
154
- overflow: hidden;
155
- transition: width 0.2s ease, height 0.2s ease;
156
- }
157
-
158
- .plugin-panel.collapsed {
159
- overflow: visible;
160
- }
161
-
162
- .plugin-panel-toggle {
163
- display: flex;
164
- align-items: center;
165
- gap: 4px;
166
- padding: 6px 8px;
167
- background: transparent;
168
- border: none;
169
- cursor: pointer;
170
- font-size: 12px;
171
- color: #6c757d;
172
- white-space: nowrap;
173
- }
174
-
175
- .plugin-panel.collapsed .plugin-panel-toggle {
176
- writing-mode: vertical-rl;
177
- text-orientation: mixed;
178
- flex-direction: column;
179
- height: 100%;
180
- padding: 8px 6px;
181
- }
182
-
183
- .plugin-panel-toggle:hover {
184
- background: #e9ecef;
185
- color: #495057;
186
- }
187
-
188
- .plugin-panel-toggle-icon {
189
- font-weight: bold;
190
- font-size: 14px;
191
- }
192
-
193
- .plugin-panel.collapsed .plugin-panel-toggle-icon {
194
- transform: rotate(90deg);
195
- }
196
-
197
- .plugin-panel-toggle-label {
198
- font-weight: 500;
199
- }
200
-
201
- .plugin-panel-content {
202
- flex: 1;
203
- overflow: auto;
204
- }
205
-
206
- /* Right panel rendered inside viewport - scrolls with content */
207
- .plugin-panel-in-viewport {
208
- position: absolute;
209
- top: 0;
210
- /* Position is set dynamically via inline styles based on page edge */
211
- width: 220px;
212
- pointer-events: auto;
213
- z-index: 10;
214
- overflow: visible;
215
- }
216
-
217
- .plugin-panel-in-viewport.collapsed {
218
- width: 32px;
219
- }
220
-
221
- .plugin-panel-in-viewport .plugin-panel-toggle {
222
- position: sticky;
223
- top: 0;
224
- background: rgba(255, 255, 255, 0.95);
225
- border-radius: 4px;
226
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
227
- }
228
-
229
- .plugin-panel-in-viewport-content {
230
- overflow: visible;
231
- position: relative;
232
- }
233
-
234
- /* Plugin overlay container for rendering highlights/decorations */
235
- .plugin-overlays-container {
236
- position: absolute;
237
- top: 0;
238
- left: 0;
239
- right: 0;
240
- bottom: 0;
241
- pointer-events: none;
242
- overflow: visible;
243
- z-index: 5;
244
- }
245
-
246
- .plugin-overlay {
247
- position: absolute;
248
- top: 0;
249
- left: 0;
250
- right: 0;
251
- bottom: 0;
252
- pointer-events: none;
253
- }
254
-
255
- /* Individual overlay children manage their own pointer-events.
256
- Do NOT set pointer-events: auto here \u2014 it overrides overlay containers
257
- that need pointer-events: none to let clicks pass through to the editor. */
258
- `,Wx=Ap.forwardRef(function({plugins:t,children:n,className:o=""},r){let[i,a]=Ap.useState(null),s=Ap.useRef(n.props);s.current=n.props;let[l,u]=Ap.useState(null),d=Ap.useMemo(()=>new chunk2VHQ7YOQ_cjs.J,[]),c=Ap.useSyncExternalStore(d.subscribe,d.getSnapshot),[f,p]=Ap.useState(()=>{let H=new Set;for(let I of t)({...Ba,...I.panelConfig}).defaultCollapsed&&H.add(I.id);return H}),[m]=Ap.useState(()=>{let H=new Map;for(let I of t){let F={...Ba,...I.panelConfig};H.set(I.id,F.defaultSize);}return H});Ap.useEffect(()=>{if(!i)return;let H=t.map(I=>({id:I.id,styles:I.styles,initialize:I.initialize,onStateChange:I.onStateChange,destroy:I.destroy}));return d.initialize(H,i),()=>{d.destroy();}},[d,i,t]),Ap.useEffect(()=>{let H=t.filter(I=>I.styles).map(I=>qp(I.id,I.styles));return ()=>H.forEach(I=>I())},[t]),Ap.useEffect(()=>{if(!i?.dom)return;let H=()=>{d.updateStates(i);},I=null,F=()=>{I&&cancelAnimationFrame(I),I=requestAnimationFrame(H);};H();let me=i.dom;me.addEventListener("input",F),me.addEventListener("focus",H),me.addEventListener("click",H);let pe=i.dispatch.bind(i);return i.dispatch=He=>{pe(He),F();},()=>{me.removeEventListener("input",F),me.removeEventListener("focus",H),me.removeEventListener("click",H),I&&cancelAnimationFrame(I),i.dispatch=pe;}},[i,d]),Ap.useEffect(()=>qp("plugin-host-base",Zp),[]);let b=Ap.useCallback(H=>{if(!i)return;if(i.coordsAtPos(H)){i.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:F}=i,me=F.doc.resolve(Math.min(H,F.doc.content.size)),pe=F.tr.setSelection(prosemirrorState.TextSelection.near(me));i.dispatch(pe),i.focus();}},[i]),g=Ap.useCallback((H,I)=>{if(!i)return;let{state:F}=i,me=F.doc.content.size,pe=Math.max(0,Math.min(H,me)),He=Math.max(0,Math.min(I,me)),Ie=F.tr.setSelection(prosemirrorState.TextSelection.create(F.doc,pe,He));i.dispatch(Ie),i.focus();},[i]),S=Ap.useCallback(H=>d.getPluginState(H),[d]),C=Ap.useCallback((H,I)=>{d.setPluginState(H,I);},[d]),x=Ap.useCallback(()=>{i&&d.updateStates(i);},[i,d]);Ap.useImperativeHandle(r,()=>({getPluginState:S,setPluginState:C,getEditorView:()=>i,refreshPluginStates:x}),[S,C,i,x]);let E=Ap.useMemo(()=>{let H=[];for(let I of t)I.proseMirrorPlugins&&H.push(...I.proseMirrorPlugins);return H},[t]),w=Ap.useCallback(H=>{p(I=>{let F=new Set(I);return F.has(H)?F.delete(H):F.add(H),F});},[]),[B,_]=Ap.useState(null);Ap.useEffect(()=>{if(!l){_(null);return}let H=()=>{let me=l.pagesContainer,pe=me.querySelector(".layout-page");if(!pe){_(null);return}let He=l.getContainerOffset(),Ie=pe.getBoundingClientRect(),je=me.getBoundingClientRect(),R=(Ie.right-je.left)/l.zoom,L=He.x+R+5;_(L);};H();let I=()=>{requestAnimationFrame(H);};window.addEventListener("resize",I);let F=new ResizeObserver(()=>{requestAnimationFrame(H);});return F.observe(l.pagesContainer),()=>{window.removeEventListener("resize",I),F.disconnect();}},[l]);let V=Ap.useMemo(()=>{let H=[];if(l){for(let I of t)if(I.renderOverlay){let F=c.states.get(I.id);H.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":I.id,children:I.renderOverlay(l,F,i)},`overlay-${I.id}`));}}for(let I of t){if(!I.Panel||(I.panelConfig?.position??"right")!=="right")continue;let me={...Ba,...I.panelConfig},pe=f.has(I.id),He=m.get(I.id)??me.defaultSize,Ie=I.Panel,je=c.states.get(I.id),R=B!==null?`${B}px`:"calc(50% + 428px)";H.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${pe?"collapsed":""}`,style:{width:pe?"32px":`${He}px`,left:R},"data-plugin-id":I.id,children:[me.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>w(I.id),title:pe?`Show ${I.name}`:`Hide ${I.name}`,"aria-label":pe?`Show ${I.name}`:`Hide ${I.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:pe?"\u2039":"\u203A"})}),!pe&&l&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(Ie,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:g,pluginState:je,panelWidth:He,renderedDomContext:l})})]},`panel-overlay-${I.id}`));}return H.length>0?H:null},[l,t,c.version,i,f,m,b,g,w,B]),z=Ap.useCallback(H=>{u(H);let I=s.current?.onRenderedDomContextReady;typeof I=="function"&&I(H);},[]),A=Ap.useMemo(()=>Ap.cloneElement(n,{externalPlugins:E,pluginOverlays:V,onRenderedDomContextReady:z,onEditorViewReady:H=>{a(H);let I=s.current?.onEditorViewReady;typeof I=="function"&&I(H);}}),[n,E,V,z]),Q=Ap.useMemo(()=>{let H=[],I=[],F=[];for(let me of t){if(!me.Panel)continue;let pe=me.panelConfig?.position??"right";pe==="left"?H.push(me):pe==="bottom"?F.push(me):I.push(me);}return {left:H,right:I,bottom:F}},[t]),de=H=>{if(!H.Panel)return null;let I={...Ba,...H.panelConfig},F=f.has(H.id),me=m.get(H.id)??I.defaultSize,pe=H.Panel,He=c.states.get(H.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${I.position} ${F?"collapsed":""}`,style:{[I.position==="bottom"?"height":"width"]:F?"32px":`${me}px`,minWidth:I.position!=="bottom"?F?"32px":`${I.minSize}px`:void 0,maxWidth:I.position!=="bottom"?`${I.maxSize}px`:void 0,minHeight:I.position==="bottom"?F?"32px":`${I.minSize}px`:void 0,maxHeight:I.position==="bottom"?`${I.maxSize}px`:void 0},"data-plugin-id":H.id,children:[I.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>w(H.id),title:F?`Show ${H.name}`:`Hide ${H.name}`,"aria-label":F?`Show ${H.name}`:`Hide ${H.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:F?"\u203A":"\u2039"}),F&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:H.name})]}),!F&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(pe,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:g,pluginState:He,panelWidth:me,renderedDomContext:l??null})})]},H.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${o}`,children:[Q.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:Q.left.map(de)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[A,Q.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:Q.bottom.map(de)})]})]})});exports.A=Lx;exports.B=fl;exports.C=xE;exports.D=SE;exports.E=_p;exports.F=Wp;exports.G=Vp;exports.H=kE;exports.I=CE;exports.J=TE;exports.K=wE;exports.L=Dx;exports.M=vE;exports.N=Up;exports.O=Ax;exports.P=jp;exports.Q=RE;exports.R=BE;exports.S=LE;exports.T=OE;exports.U=Zp;exports.V=Wx;exports.a=Ht;exports.b=iS;exports.c=ac;exports.d=_r;exports.e=aS;exports.f=sS;exports.g=lS;exports.h=cS;exports.i=lc;exports.j=Dp;exports.k=XP;exports.l=rE;exports.m=an;exports.n=sE;exports.o=lE;exports.p=cE;exports.q=dE;exports.r=uE;exports.s=pE;exports.t=fE;exports.u=mE;exports.v=gE;exports.w=Vo;exports.x=bE;exports.y=yE;exports.z=$p;