@docx-editor.dev/core 2.30.0 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +24 -0
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +18 -27
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +17 -16
  7. package/dist/binding.js +1 -1
  8. package/dist/bookmark-names-DDuAra_V.d.ts +37 -0
  9. package/dist/{chrome-print-BM3Js-6X.d.ts → chrome-print-CznJ0ucN.d.ts} +361 -41
  10. package/dist/chunk-25EXMBV2.cjs +5 -0
  11. package/dist/chunk-2CWQY27B.cjs +1 -0
  12. package/dist/chunk-3IEXDEFH.cjs +7 -0
  13. package/dist/chunk-65XBN67F.cjs +2 -0
  14. package/dist/chunk-6NVZNB7O.cjs +3 -0
  15. package/dist/chunk-6UDJUI3W.cjs +2 -0
  16. package/dist/chunk-ACLR4DMK.js +1 -0
  17. package/dist/{chunk-RJCQGJR7.js → chunk-B2BEELUE.js} +1 -1
  18. package/dist/chunk-DDFHKQFU.js +30 -0
  19. package/dist/chunk-E4IAO4CY.cjs +2 -0
  20. package/dist/chunk-ETDZFNMI.js +2 -0
  21. package/dist/chunk-FDSL5OJU.cjs +30 -0
  22. package/dist/chunk-FS7CMYLT.js +4 -0
  23. package/dist/chunk-GDS24SZN.js +30 -0
  24. package/dist/chunk-GIY6NT2X.js +5 -0
  25. package/dist/chunk-GWM3AKUD.js +18 -0
  26. package/dist/chunk-HDOXACHP.js +2 -0
  27. package/dist/chunk-IILEENID.js +1 -0
  28. package/dist/chunk-L5TYBFDB.js +1 -0
  29. package/dist/chunk-MNF2K7NN.cjs +30 -0
  30. package/dist/chunk-O324RB6R.cjs +1 -0
  31. package/dist/chunk-OKMEMSKB.cjs +1 -0
  32. package/dist/chunk-QXJKYNYZ.js +1 -0
  33. package/dist/chunk-RALTVLB6.js +2 -0
  34. package/dist/chunk-SRVKFUFI.js +3 -0
  35. package/dist/chunk-TELQ52LG.cjs +1 -0
  36. package/dist/chunk-TJHE5EET.cjs +1 -0
  37. package/dist/chunk-UMMRURPE.js +7 -0
  38. package/dist/chunk-WN7ICTA5.js +1 -0
  39. package/dist/{chunk-FLBEJC6X.cjs → chunk-XJYZVGQR.cjs} +1 -1
  40. package/dist/chunk-ZGTIE3QJ.cjs +4 -0
  41. package/dist/chunk-ZOZI27AW.cjs +18 -0
  42. package/dist/collaboration/replication.cjs +1 -1
  43. package/dist/collaboration/replication.d.ts +20 -5
  44. package/dist/collaboration/replication.js +1 -1
  45. package/dist/collaboration.cjs +1 -1
  46. package/dist/collaboration.d.ts +5 -6
  47. package/dist/collaboration.js +1 -1
  48. package/dist/contracts/document.d.ts +3 -3
  49. package/dist/contracts/editor.d.ts +13 -10
  50. package/dist/contracts/interaction.d.ts +2 -2
  51. package/dist/contracts/modules.d.ts +15 -13
  52. package/dist/contracts/types.d.ts +135 -2
  53. package/dist/{custom-node-writes-0v0Kgw1T.d.ts → custom-node-writes-CLJKGD9t.d.ts} +7 -2
  54. package/dist/{diagnostic-context-CcAO4q1s.d.ts → diagnostic-context-BtDUY3v2.d.ts} +3 -2
  55. package/dist/{diagnostic-hints-2Bke6H_w.d.ts → diagnostic-hints-DK8-V0fk.d.ts} +2 -2
  56. package/dist/{document-protection-8eyMWIJ0.d.ts → document-protection-NaniLHWF.d.ts} +1 -1
  57. package/dist/{editor-DaEJd2so.d.ts → editor-DZwOTmlR.d.ts} +386 -279
  58. package/dist/editor-fonts-D_-vjuJi.d.ts +53 -0
  59. package/dist/{editor-scope-7o9xweiJ.d.ts → editor-scope-B3L-1ALc.d.ts} +57 -4
  60. package/dist/editor.cjs +1 -1
  61. package/dist/editor.css +6 -4
  62. package/dist/editor.d.ts +646 -31
  63. package/dist/editor.js +1 -1
  64. package/dist/export.cjs +2 -2
  65. package/dist/export.d.ts +9 -16
  66. package/dist/export.js +2 -2
  67. package/dist/{failure-NS2lsya4.d.ts → failure-6KGFrDO9.d.ts} +1 -1
  68. package/dist/{font-resolver-CL9BVKZo.d.ts → font-resolver-BlQNGdvR.d.ts} +1 -1
  69. package/dist/{headless-document-view-DZQN8Bnx.d.ts → headless-document-view-Bcz9_Qva.d.ts} +115 -4
  70. package/dist/index.cjs +1 -1
  71. package/dist/index.d.ts +27 -26
  72. package/dist/index.js +1 -1
  73. package/dist/{layout-shaping-cEnVrhWg.d.ts → layout-shaping-E5J4Z1Gf.d.ts} +1 -1
  74. package/dist/layout.cjs +1 -1
  75. package/dist/layout.d.ts +95 -23
  76. package/dist/layout.js +1 -1
  77. package/dist/{note-properties-9FH8zAeG.d.ts → note-properties-Ds5R2_3F.d.ts} +1 -1
  78. package/dist/output.cjs +1 -1
  79. package/dist/output.d.ts +24 -10
  80. package/dist/output.js +1 -1
  81. package/dist/{protocol-CZ1uUlPO.d.ts → protocol-DKa4qt7F.d.ts} +167 -5
  82. package/dist/{review-paragraph-order-CqVelc5A.d.ts → review-paragraph-order-Dc17w_6v.d.ts} +1 -1
  83. package/dist/revision-projection-Cn6rZJ7H.d.ts +258 -0
  84. package/dist/{semantic-cell-selection-Dr9yxFZt.d.ts → semantic-cell-selection-BaUR0iJ4.d.ts} +2 -2
  85. package/dist/{semantic-interaction-Dc3pf3hr.d.ts → semantic-interaction-CJoHLoOl.d.ts} +1 -1
  86. package/dist/{semantic-paint-Bz3FBAoH.d.ts → semantic-paint-BPw_n0li.d.ts} +7 -4
  87. package/dist/{semantic-record-queries-Bx0pl6kL.d.ts → semantic-record-queries-C0rJ3sB4.d.ts} +1 -1
  88. package/dist/{semantic-records-CjcF26ZL.d.ts → semantic-records-BvN-WWst.d.ts} +365 -512
  89. package/dist/store.cjs +1 -1
  90. package/dist/store.d.ts +47 -22
  91. package/dist/store.js +1 -1
  92. package/dist/{types-barrel-CA0xB8kH.d.ts → tree-op-types-C_S2niXW.d.ts} +1239 -747
  93. package/dist/{tree-package-store-DKhdEVym.d.ts → tree-package-store-CRHvMyNj.d.ts} +676 -646
  94. package/dist/{tree-session-contract-CwnTEVLF.d.ts → tree-session-contract-D1awo_dA.d.ts} +26 -13
  95. package/dist/unsupported-elements-CVos5cqe.d.ts +23 -0
  96. package/docs/accept-reject-without-scrolling.md +95 -0
  97. package/docs/comment-on-found-text.md +72 -0
  98. package/docs/custom-review-cards.md +178 -0
  99. package/docs/highlight-ranges.md +48 -0
  100. package/docs/index.md +36 -0
  101. package/docs/propose-rewrite.md +247 -0
  102. package/docs/tracked-replacement.md +68 -0
  103. package/package.json +3 -2
  104. package/dist/chunk-2PV5L5NJ.js +0 -5
  105. package/dist/chunk-5OTS2EJ7.js +0 -7
  106. package/dist/chunk-5P4223J4.cjs +0 -27
  107. package/dist/chunk-5RRAZMBU.cjs +0 -1
  108. package/dist/chunk-5SPITS5F.js +0 -18
  109. package/dist/chunk-6JIJOZDW.js +0 -1
  110. package/dist/chunk-7ATNKARV.js +0 -2
  111. package/dist/chunk-BGCUTKWE.cjs +0 -5
  112. package/dist/chunk-BTQKU64Q.cjs +0 -1
  113. package/dist/chunk-EBCXSH2W.js +0 -3
  114. package/dist/chunk-ERECKTIR.cjs +0 -2
  115. package/dist/chunk-HYASLE2G.cjs +0 -1
  116. package/dist/chunk-JC47NRJC.cjs +0 -3
  117. package/dist/chunk-KJRTNY2Q.cjs +0 -2
  118. package/dist/chunk-NKPUH3QJ.js +0 -1
  119. package/dist/chunk-PF5NJWS3.js +0 -2
  120. package/dist/chunk-PWTRJSES.cjs +0 -18
  121. package/dist/chunk-QFKGI242.cjs +0 -30
  122. package/dist/chunk-RPPV4S6T.cjs +0 -4
  123. package/dist/chunk-T32MGBJS.js +0 -1
  124. package/dist/chunk-UM26GH5B.js +0 -30
  125. package/dist/chunk-VRCZBFLH.js +0 -27
  126. package/dist/chunk-WF7JZ755.cjs +0 -1
  127. package/dist/chunk-WK5X2MMA.cjs +0 -7
  128. package/dist/chunk-WPDD2Y32.js +0 -2
  129. package/dist/chunk-YBMWBXST.cjs +0 -2
  130. package/dist/chunk-YZGUBCHP.js +0 -1
  131. package/dist/chunk-ZOS2PM4A.js +0 -4
  132. package/dist/image-resources-Bipz8toD.d.ts +0 -211
  133. package/dist/omml-equation-DP2WpUbK.d.ts +0 -97
@@ -1,27 +0,0 @@
1
- import {a as a$2}from'./chunk-4HENIAFG.js';import {n,k as k$1,f as f$1,e as e$1,q as q$1,r as r$1,i as i$1,g as g$1,j as j$3,o,l as l$1,b as b$1,c,a as a$6,d as d$2}from'./chunk-ZOS2PM4A.js';import {p,q,j,g as g$2,a as a$4,y as y$1,n as n$1,b as b$2,z as z$1,f as f$2,w as w$1,A as A$1,B as B$2,v as v$2,t as t$2,r as r$4,c as c$2}from'./chunk-7ATNKARV.js';import {k,e,r,S,da as da$1,ia as ia$1,ga,j as j$4,X,Z,ka,T,U,V,ja,la as la$1,ca,ma,ea as ea$2,ha,Y,fa,P,t as t$1,ba}from'./chunk-EBCXSH2W.js';import {s,m,i,k as k$2,j as j$2,b,w,A,z,u,y,B,r as r$2,v,t,C,D,a as a$8}from'./chunk-5OTS2EJ7.js';import {a as a$3}from'./chunk-NKPUH3QJ.js';import {d,Ua,a as a$1,l,ge,He,Hf,Ne,af,bf,Ya,gf,uc as uc$1,ef,pe,mb,oe,Oa,ie,re,wd as wd$1,Rc as Rc$1,Gc as Gc$1,Le,Za,_a,ab,$a,Va,Ce as Ce$1,xa,gd as gd$1,Ze as Ze$1,Oc as Oc$1,Nc as Nc$1,zb,df,ve,xe,we,Be,Sa,Ae,ec as ec$1,qe as qe$1,je,vd as vd$1,se,Qa,vc as vc$1,jd as jd$1,xd as xd$1,zd as zd$1,Pe,Wd as Wd$1,$,Ed as Ed$2,ea as ea$1,ae,Yd as Yd$1,Te,Qe,Re,Se,Fd as Fd$2,yd as yd$1,Me,Pc as Pc$1,rd,td,cd,le,Lc as Lc$2,Mc as Mc$1,Ra,Ma,ne,ue,v as v$1,u as u$1,H as H$1,S as S$1,O,bd as bd$2,od,qc as qc$1,qd as qd$1,_d as _d$1,$d as $d$1,ce,De,ya,Fa,wa,ud as ud$2,Na,Ga,Td as Td$1,Pa,id,sc as sc$1,cf,lc as lc$1,hd as hd$1,Ib,jb,mc as mc$1,wc as wc$1,Gf as Gf$1,h,ed,Fe as Fe$2}from'./chunk-UM26GH5B.js';import {j as j$1,d as d$1,i as i$2,k as k$3}from'./chunk-2PV5L5NJ.js';import {a as a$7}from'./chunk-RJCQGJR7.js';import {va,H,G,N,K,M}from'./chunk-PF5NJWS3.js';import {a as a$5}from'./chunk-6JIJOZDW.js';import {c as c$1}from'./chunk-YZGUBCHP.js';import {f,Tg as Tg$1,rk as rk$1,Ed as Ed$1,Ni as Ni$1,Oi,Pi,g,Rf,wg as wg$1,Tf,Yk as Yk$1,th as th$1,yj,ug as ug$1,ch as ch$1,Hb,Mh as Mh$1,Ta,Lk as Lk$1,Nd as Nd$1,Fd as Fd$1,Gd as Gd$1,Id as Id$1,Q,Pk as Pk$1,Rk as Rk$1,Mk as Mk$1,Qk as Qk$1,ll,jl,wb,kk as kk$1,Rh as Rh$1,Eh as Eh$1,Dh,Da,hj,Si,Ri,kj,xj,Ce,Nj,Pj,lb,Aj,il,pc as pc$1,Hk as Hk$1,Fh,kb,Uc as Uc$1,Fg as Fg$1,Lg as Lg$1,oc as oc$1,Dj,Pf,Lc as Lc$1,Ug as Ug$1,Vg as Vg$1,Rg as Rg$1,Sg as Sg$1,Wg as Wg$1,Xg as Xg$1,Oh as Oh$1,Ch,Bh,zh,Li as Li$1,oh as oh$1,vk as vk$1,mi,Rc as Rc$2,Vi as Vi$1,sj,aj,Ek as Ek$1,lf,Qf as Qf$1,jg as jg$1,uh as uh$1,Hh,Ah as Ah$1,vb,mj,Ki as Ki$1,jj,Mi,oj,bd as bd$1,gi,Ua as Ua$1,pe as pe$1,lg as lg$1,Ik as Ik$1,Jk as Jk$1,nd,Oc as Oc$2,Re as Re$1,ji as ji$1,Jc as Jc$1,Ac as Ac$1,yc as yc$1,Fj,sh as sh$1,qh,mg as mg$1,ng as ng$1,_f as _f$1,Zb,r as r$3,Nh,la as la$2,Vc as Vc$1,Yc as Yc$1,ud as ud$1,ia as ia$2,ra as ra$1,ka as ka$1,Zi,_i as _i$1,kf,pk as pk$1,uj,$j,lk as lk$1,Kg as Kg$1,Qc as Qc$1,Ia,ag as ag$1,Zf as Zf$1,Gk as Gk$1,Fk as Fk$1,dh as dh$1,hg as hg$1,uc as uc$2,Ze as Ze$2,Te as Te$1,Ve,qj,rj,de as de$1,Tj,Qi as Qi$1,Dk as Dk$1,mk as mk$1,wj,Tb,Qb,wa as wa$1,xa as xa$1,ya as ya$1,rh as rh$1,dl,He as He$1,cb,Ti,S as S$2,kg as kg$1,B as B$1,Yf as Yf$1,R,ie as ie$1,vf,l as l$2,Td as Td$2,Sd as Sd$1,Ye,Wc as Wc$1,ua,Xe as Xe$1,_e,V as V$1,sa as sa$1,G as G$1,Bd as Bd$1,jb as jb$1,tf,fb,pb,Ig as Ig$1,zb as zb$1,Hf as Hf$1,Ra as Ra$1,Ya as Ya$1,Fe as Fe$1,Pe as Pe$1,Ne as Ne$1,Oe,$b,De as De$1,Pa as Pa$1}from'./chunk-5SPITS5F.js';import {a}from'./chunk-S6J4O5XP.js';import {zipSync,strToU8}from'fflate';import {createT,en,isApplePlatform,locales,deepMerge}from'@docx-editor.dev/i18n';function dx(e){return e===void 0?void 0:Object.freeze({maxFontBytes:j$4(e).maxFontBytes})}function QA(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var lx=false;function cx(e){if(lx)return;lx=true;let t=e.diagnostic?`: ${e.diagnostic}`:".";console.error(`[@docx-editor.dev/core] text shaping is disabled${t}
2
- Text is being measured with fallback metrics, so line and page breaks will not match Word.`);}function Li(e$1){if(e$1 instanceof a)return e$1;if(e$1 instanceof d)return new a(e$1.code,e$1.message,{request:QA(e$1.request),diagnostic:e$1.diagnostic});if(e$1 instanceof k)return new a("overLimit",e$1.message,{diagnostic:e$1.message});if(e$1 instanceof e){let t=e$1.code==="wasmUnavailable"||e$1.code==="shapingLibraryMismatch"?"wasmUnavailable":"initializationFailed";return new a(t,e$1.message,{diagnostic:e$1.diagnostic??e$1.message,cause:e$1})}return new a("initializationFailed",e$1 instanceof Error?e$1.message:"Font initialization failed",{diagnostic:e$1 instanceof Error?e$1.message:String(e$1)})}async function fs(e,t,n){try{return await r(e,t,n)}catch(r){throw Li(r)}}var ud=Object.freeze({opening:"auto",overflow:"float",revisionsIn:"pane",commentMarkers:"icon"}),_f={opening:["auto","manual"],overflow:["float","shrinkPage","scroll"],revisionsIn:["pane","balloons"],commentMarkers:["initials","icon"]};function fd(e,t=ud){if(e===void 0)return t;if(e===null||typeof e!="object")throw new TypeError("review pane settings must be an object");let n=t;for(let[r,o]of Object.entries(e)){if(o===void 0)continue;if(!Object.hasOwn(_f,r))throw new TypeError(`unknown review pane setting ${r}`);let i=r;if(typeof o!="string"||!_f[i].includes(o))throw new TypeError(`review pane ${i} must be ${_f[i].join(" or ")}`);n[i]!==o&&(n={...n,[i]:o});}return n===t?t:Object.freeze(n)}function Bf(e,t){return e==="pane"?true:t.kind==="revision"?false:!(t.kind==="comment"&&t.parentRevisionId!==void 0)}var JA=Object.freeze({revisionMarkup:Ua,reviewPane:ud,scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false,collaborationStatus:"inactive"});var ux="http://schemas.openxmlformats.org/wordprocessingml/2006/main",tF="http://schemas.openxmlformats.org/package/2006/content-types",fx="http://schemas.openxmlformats.org/package/2006/relationships",nF="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",rF="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",oF=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${tF}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/></Types>`,iF=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${fx}"><Relationship Id="rId1" Type="${nF}" Target="word/document.xml"/></Relationships>`,aF=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${fx}"><Relationship Id="rId1" Type="${rF}" Target="styles.xml"/></Relationships>`,sF=[{level:1,before:240,color:"2F5496",halfPoints:32,italic:false},{level:2,before:40,color:"2F5496",halfPoints:26,italic:false},{level:3,before:40,color:"1F3763",halfPoints:24,italic:false},{level:4,before:40,color:"2F5496",halfPoints:null,italic:true},{level:5,before:40,color:"2F5496",halfPoints:null,italic:false},{level:6,before:40,color:"1F3763",halfPoints:null,italic:false},{level:7,before:40,color:"1F3763",halfPoints:null,italic:true},{level:8,before:40,color:"272727",halfPoints:21,italic:false},{level:9,before:40,color:"272727",halfPoints:21,italic:true}],lF=e=>`<w:style w:type="paragraph" w:styleId="Heading${e.level}"><w:name w:val="heading ${e.level}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="${e.before}" w:after="0"/><w:outlineLvl w:val="${e.level-1}"/></w:pPr><w:rPr>`+(e.italic?"<w:i/><w:iCs/>":"")+`<w:color w:val="${e.color}"/>`+(e.halfPoints===null?"":`<w:sz w:val="${e.halfPoints}"/><w:szCs w:val="${e.halfPoints}"/>`)+"</w:rPr></w:style>",dF=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${ux}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>`+sF.map(lF).join("")+'<w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="table" w:default="1" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style><w:style w:type="numbering" w:default="1" w:styleId="NoList"><w:name w:val="No List"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="10"/><w:qFormat/><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/><w:contextualSpacing/></w:pPr><w:rPr><w:spacing w:val="-10"/><w:kern w:val="28"/><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Subtitle"><w:name w:val="Subtitle"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="11"/><w:qFormat/><w:rPr><w:color w:val="5A5A5A"/><w:spacing w:val="15"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="29"/><w:qFormat/><w:pPr><w:spacing w:before="160"/><w:jc w:val="center"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Caption"><w:name w:val="caption"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="35"/><w:semiHidden/><w:unhideWhenUsed/><w:pPr><w:spacing w:after="0"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/><w:sz w:val="18"/><w:szCs w:val="18"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="NoSpacing"><w:name w:val="No Spacing"/><w:uiPriority w:val="1"/><w:qFormat/><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/></w:pPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:uiPriority w:val="34"/><w:qFormat/><w:pPr><w:ind w:left="720"/><w:contextualSpacing/></w:pPr></w:style></w:styles>',cF=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${ux}"><w:body><w:p/><w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr></w:body></w:document>`;function $f(){return zipSync({"[Content_Types].xml":strToU8(oF),"_rels/.rels":strToU8(iF),"word/_rels/document.xml.rels":strToU8(aF),"word/document.xml":strToU8(cF),"word/styles.xml":strToU8(dF)})}var px="http://schemas.microsoft.com/office/2004/12/omml",uF="http://www.w3.org/1998/Math/MathML",fF=4096,mx=32;function gx(e,t){return e.failed||t>mx||e.left<=0?(e.failed=true,false):(e.left-=1,true)}function ms(e,t){return e.kind!=="textValue"&&e.namespaceUri===Re$1&&(t===void 0||e.localName===t)}function qf(e,t){if(e.kind!=="textValue")return e.attributes.find(n=>n.localName==="val"&&n.namespaceUri===t)?.value}function hx(e,t,n){if(!gx(t,n))return "";if(e.kind==="textValue")return e.value;let r="";for(let o of e.children)r+=hx(o,t,n+1);return r}function pF(e,t,n){if(e.kind==="textValue")return "";let r="",o,i=false,a;for(let c of e.children)if(ms(c,"t"))r+=hx(c,t,n+1);else if(ms(c,"rPr")&&c.kind!=="textValue")for(let u of c.children)ms(u,"sty")&&(o=qf(u,Re$1)),ms(u,"nor")&&(i=true);else if(c.kind!=="textValue"&&c.namespaceUri===la$2&&c.localName==="rPr"){let u=c.children.find(m=>m.kind!=="textValue"&&m.localName==="color"),p=u?qf(u,la$2):void 0;p&&/^[0-9A-Fa-f]{6}$/.test(p)&&(a=p.toUpperCase());}if(r.length===0)return "";let s=`<m:r>${R(r)}</m:r>`;a!==void 0&&(s=`<span style="color:#${a}">${s}</span>`);let l=!i&&(o===void 0||o==="i"||o==="bi"),d=o==="b"||o==="bi";return l&&(s=`<i>${s}</i>`),d&&(s=`<b>${s}</b>`),s}function yx(e,t,n){if(e.kind==="textValue"||!ms(e)||!gx(t,n))return "";if(e.localName==="r")return pF(e,t,n);if(e.localName==="ctrlPr")return "";let r=qf(e,Re$1),o=r===void 0?"":` m:val="${S$2(r)}"`,i="";for(let a of e.children)i+=yx(a,t,n+1);return i.length>0?`<m:${e.localName}${o}>${i}</m:${e.localName}>`:`<m:${e.localName}${o}/>`}function mF(e){let t="";for(let n of e.match(/\d+(?:\.\d+)?|\p{L}|\s+|./gu)??[]){if(/^\s+$/.test(n))continue;let r=R(n);/^\d/.test(n)?t+=`<mn>${r}</mn>`:/^\p{L}$/u.test(n)?t+=`<mi>${r}</mi>`:t+=`<mo>${r}</mo>`;}return t}function Vf(e,t){if(t>mx)return "";let n=r=>`<mrow>${Vf(r,t+1)}</mrow>`;switch(e.kind){case "text":return e.format?.normalText?`<mtext>${R(e.value)}</mtext>`:mF(e.value);case "fallback":return `<mtext>${R(e.text)}</mtext>`;case "row":return e.items.map(r=>Vf(r,t+1)).join("");case "bar":return e.position==="top"?`<mover accent="true">${n(e.body)}<mo>\xAF</mo></mover>`:`<munder accentunder="true">${n(e.body)}<mo>\xAF</mo></munder>`;case "fraction":return `<mfrac>${n(e.numerator)}${n(e.denominator)}</mfrac>`;case "radical":return e.degree===void 0?`<msqrt>${n(e.radicand)}</msqrt>`:`<mroot>${n(e.radicand)}${n(e.degree)}</mroot>`;case "script":{let r=n(e.base);return e.subscript&&e.superscript?`<msubsup>${r}${n(e.subscript)}${n(e.superscript)}</msubsup>`:e.subscript?`<msub>${r}${n(e.subscript)}</msub>`:e.superscript?`<msup>${r}${n(e.superscript)}</msup>`:r}case "nary":{let r=`<mo>${R(e.operator)}</mo>`,o=e.lowerLimit?n(e.lowerLimit):"",i=e.upperLimit?n(e.upperLimit):"";return `<mrow>${o&&i?`<munderover>${r}${o}${i}</munderover>`:o?`<munder>${r}${o}</munder>`:i?`<mover>${r}${i}</mover>`:r}${n(e.body)}</mrow>`}}}function bx(e){if(!Ye(e))return "";let t=Xe$1(e),n=t?_e(e):Te$1(e),r={left:fF,failed:false},o=yx(e,r,0),i=n===null?"":`<math xmlns="${uF}"${t?' display="block"':""}>${Vf(n.expression,0)}</math>`;return r.failed||o.length===0?i:`<!--[if gte msEquation 12]>${o}<![endif]--><![if !msEquation]>${i}<![endif]>`}function vx(e){return e.includes("<!--[if gte msEquation 12]>")}var Ni="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gF=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<Ni.length;t+=1)e[Ni.charCodeAt(t)]=t;return e})();function pd(e,t){if(e.length===0)return null;let n=e.length%4;if(n===1)return null;let r=n===0?e:e+"=".repeat(4-n),o=r.endsWith("==")?2:r.endsWith("=")?1:0,i=r.length/4*3-o;if(i<=0||i>t)return null;let a=new Uint8Array(i),s=0;for(let l=0;l<r.length;l+=4){let d=0,c=0;for(let u=0;u<4;u+=1){let p=r.charCodeAt(l+u);if(p===61){if(l+u<r.length-o)return null;continue}let m=p<128?gF[p]:-1;if(m<0)return null;d=d<<6|m,c+=6;}d<<=24-c,c>=12&&(a[s++]=d>>>16&255),c>=18&&(a[s++]=d>>>8&255),c>=24&&(a[s++]=d&255);}return s===i?a:null}function md(e){let t=[],n="";for(let r=0;r<e.length;r+=3){let o=e[r],i=r+1<e.length?e[r+1]:0,a=r+2<e.length?e[r+2]:0;n+=Ni[o>>2]+Ni[(o&3)<<4|i>>4],n+=r+1<e.length?Ni[(i&15)<<2|a>>6]:"=",n+=r+2<e.length?Ni[a&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var hF=16*1024*1024,Sx=64*1024*1024,wx="data-docx-fragment",Ix="data-docx-fragment-end",yF=md;function kx(e,t){let n=t?.lastMarkCovered?"covered":"open",r=t?`<div ${wx}="${yF(t.bytes)}" ${Ix}="${n}">${e}</div>`:`<div>${e}</div>`;return vx(e)?`<html xmlns:m="${px}"><body>${r}</body></html>`:r}function xx(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>Sx)return null;let o=r+n.length,i=e.indexOf('"',o);return i===-1?null:e.slice(o,i)}function Di(e,t=hF){if(e.length>Sx)return null;let n=xx(e,wx);if(n===null||n.length===0)return null;let r=pd(n,t);if(r===null||r.byteLength===0)return null;let o=xx(e,Ix);return {bytes:r,lastMarkCovered:o==="covered"}}function qo(e){if(e==null)return null;let t=e.trim();return /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8}){0,3}$/.test(t)?t:null}var jf=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],Kf={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText"},Wf=new Map([...Object.entries(Kf).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function Rx(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(Kf,e)?Kf[e]:null}var Zf=Object.fromEntries(n),Uf={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function Px(e){let t=e.trim();if(t.length===0||t.length>255)return null;let n=t.replace(/[^\p{L}\p{N} _.,-]/gu,"");return n.length===0?null:`"${V$1(n)}"`}var bF=new Map([["single","solid"],["thick","solid"],["double","double"],["triple","double"],["dotted","dotted"],["dashed","dashed"],["dashSmallGap","dashed"],["dotDash","dashed"],["dotDotDash","dashed"],["wave","solid"],["hairline","solid"],["inset","solid"],["outset","solid"]]);function Vo(e){if(e===null)return null;let t=Yf$1(e,"val",la$2);if(t===void 0||t==="nil"||t==="none")return null;let n=bF.get(t)??"solid",r=Yf$1(e,"sz",la$2),o=r!==void 0&&/^\d{1,4}$/.test(r)?Number.parseInt(r,10):0,i=o>0?o/8:.5,a=`${Math.round(i*100)/100}pt`,s=Yf$1(e,"color",la$2),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${a} ${n} ${l.toLowerCase()}`}function Tx(e,t){return e===null||e<=0?[]:t==="exact"||t==="atLeast"?[`line-height:${`${Math.round(e/20*100)/100}pt`}`,`mso-line-height-rule:${t==="exact"?"exactly":"at-least"}`]:[`line-height:${Math.round(e/240*100)/100}`]}var vF=new Map([["double","double"],["wavyDouble","double"],["dotted","dotted"],["dottedHeavy","dotted"],["dash","dashed"],["dashedHeavy","dashed"],["dashLong","dashed"],["dashLongHeavy","dashed"],["dotDash","dashed"],["dashDotHeavy","dashed"],["dotDotDash","dashed"],["dashDotDotHeavy","dashed"],["wave","wavy"],["wavyHeavy","wavy"]]),xF=new Set(jf);function Cx(e){if(e===null)return [];let t=Yf$1(e,"val",la$2),n=[],r=t===void 0?void 0:vF.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&xF.has(t)&&n.push(`text-underline:${t}`);let o=Yf$1(e,"color",la$2);return o!==void 0&&/^[0-9A-Fa-f]{6}$/.test(o)&&n.push(`text-decoration-color:#${o.toLowerCase()}`),t==="thick"&&n.push("text-decoration-thickness:2px"),n}function Ex(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function Ox(e,t,n,r){if(e.namespaceUri!==la$2)return "";let o=e.localName==="footnoteRef"?"footnote":e.localName==="endnoteRef"?"endnote":null,i=e.localName==="footnoteReference"?"footnote":e.localName==="endnoteReference"?"endnote":null,a=o??i;if(a===null)return "";let s=Yf$1(e,"id",la$2),l=o===null?s!==void 0&&/^\d{1,10}$/.test(s)?Number.parseInt(s,10):void 0:t?.id;if(l===void 0||!Number.isInteger(l)||l<1||o!==null&&t?.kind!==o||l>2147483647||o===null&&!r(a,l))return "";let d=a==="footnote",c=o!==null,u=d?"MsoFootnoteReference":"MsoEndnoteReference",p=d?"ftn":"edn",m=c?`#_${p}ref${l}`:`#_${p}${l}`,h=c?`_${p}${l}`:`_${p}ref${l}`;return `<a style="mso-${d?"footnote":"endnote"}-id:${p}${l}" href="${m}" name="${h}"><span class="${u}"><span style="mso-special-character:footnote">[${n(a,l)}]</span></span></a>`}function Mx(e){if(e.namespaceUri!==la$2||e.localName!=="ptab")return "";let t=Yf$1(e,"alignment",la$2),n=Yf$1(e,"relativeTo",la$2),r=Yf$1(e,"leader",la$2)??"none";if(t!=="left"&&t!=="center"&&t!=="right")return "";let o=n==="margin"||n==="leftMargin"?"margin":n==="indent"?"indent":null;return o===null||r!=="none"&&r!=="dot"&&r!=="hyphen"&&r!=="underscore"&&r!=="middleDot"&&r!=="heavy"?"":`<w:PTab Alignment="${t.toUpperCase()}" RelativeTo="${o.toUpperCase()}" Leader="${r.toUpperCase()}"></w:PTab>`}function St(e){let t=e.trim().toLowerCase();if(/^-?0+(\.0+)?$/.test(t))return 0;let n=/^(-?(?:\d+(?:\.\d+)?|\.\d+))(px|pt|in|cm|mm|pc)$/.exec(t);if(!n)return null;let r=Number.parseFloat(n[1]);if(!Number.isFinite(r))return null;switch(n[2]){case "px":return r*.75;case "in":return r*72;case "cm":return r*72/2.54;case "mm":return r*72/25.4;case "pc":return r*12;default:return r}}function Lx(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("<o:p")||e.includes("class=Mso")||e.includes('class="Mso')||e.includes("class='Mso")}function Nx(e,t){for(let r of e.classList){let o=/^MsoHeading([1-9])$/.exec(r);if(o)return `Heading${o[1]}`;let i=/^Heading([1-9])$/.exec(r);if(i)return `Heading${i[1]}`;let a=Wf.get(r);if(a!==void 0)return a}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(Xe(e)):null;return n?`Heading${n[1]}`:void 0}var Dx=262144,SF=4096,wF=256,IF=2048,kF=8,RF=new Set(["MsoNormal",...Wf.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),PF=new Map([["left","left"],["start","start"],["center","center"],["right","right"],["end","end"],["justify","both"]]),TF=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function CF(e){let t="";for(let n=0;n<e.length;n+=1){if(e.startsWith("<!--",n)){n+=3;continue}if(e.startsWith("-->",n)){n+=2;continue}t+=e[n];}return t}function EF(e,t){let n=0;for(let r=t;r<e.length;r+=1){let o=e[r];if(o==="{"){if(n+=1,n>4)return null}else if(o==="}"&&(n-=1,n===0))return r+1}return null}function OF(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return EF(e,n)}return null}function MF(e){let t=e.split(",");if(t.length===0||t.length>kF)return null;let n=[];for(let r of t){let o=TF.exec(r);if(!o)return null;let i=o[2];if(!RF.has(i))return null;n.includes(i)||n.push(i);}return n}function AF(e){let t;for(let n of e.split(";")){let r=n.indexOf(":");if(r<=0||n.slice(0,r).trim().toLowerCase()!=="text-align")continue;let i=n.slice(r+1).trim().toLowerCase();if(i.length===0||i.length>32||i.includes("("))continue;let a=0;for(;a<i.length&&i.charCodeAt(a)>32;)a+=1;let s=PF.get(i.slice(0,a));s!==void 0&&(t=s);}return t}function FF(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>Dx)return n();let r=CF(e),o=0,i=0;for(;o<r.length&&i<SF;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let p=OF(r,o);if(p===null)return n();o=p;continue}let a=r.indexOf("{",o);if(a<0)return n();let s=r.slice(o,a),l=r.indexOf("}",a+1);if(l<0)return n();let d=r.slice(a+1,l);if(i+=1,o=l+1,s.length>wF||d.length>IF||d.includes("{"))return n();let c=MF(s),u=AF(d);if(!(!c||u===void 0))for(let p of c)t.set(p,u);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function Hx(e){let t=new Map,n=e.getElementsByTagName("style");if(n.length>16)return new Map;for(let r=0;r<n.length;r+=1){let o=n[r]?.textContent??"";if(o.length>Dx)return new Map;let i=FF(o);if(!i.ok)return new Map;for(let[a,s]of i.alignments)t.set(a,s);}return t}var LF=262144;function _x(e,t=LF){let n=e.getElementsByTagName("style"),r="";for(let o=0;o<n.length&&o<16;o+=1){let i=n[o]?.textContent??"";i.length>t||r.length+i.length>t||(r+=`
3
- ${i}`);}return r}function Bx(e,t,n){for(let o of t.classList){let i=n.get(o);if(i!==void 0){e.jc=i;break}}let r=t.getAttribute("align")?.trim().toLowerCase();r==="left"||r==="center"||r==="right"?e.jc=r:r==="justify"&&(e.jc="both");}function zf(e,t,n,r){let o=St(t.get(n)??"");if(o!==null&&o>0)return o/.75;let i=e.getAttribute(n)?.trim()??"";if(!/^[1-9]\d{0,4}$/.test(i))return null;let a=Number.parseInt(i,10);return r?a/.75:a}function Hi(e){return e.nodeType===1}function Xe(e){return e.tagName.toLowerCase()}var NF=new Map("black:000000 white:FFFFFF red:FF0000 green:008000 blue:0000FF yellow:FFFF00 gray:808080 grey:808080 silver:C0C0C0 maroon:800000 navy:000080 purple:800080 orange:FFA500 aqua:00FFFF cyan:00FFFF fuchsia:FF00FF magenta:FF00FF lime:00FF00 olive:808000 windowtext:000000".split(" ").map(e=>e.split(":"))),DF=new Map([["yellow","yellow"],["aqua","cyan"],["cyan","cyan"],["fuchsia","magenta"],["magenta","magenta"],["lime","green"],["green","green"],["olive","darkYellow"],["red","red"],["blue","blue"],["black","black"],["white","white"],["darkblue","darkBlue"],["darkcyan","darkCyan"],["darkgray","darkGray"],["darkgrey","darkGray"],["darkgreen","darkGreen"],["darkmagenta","darkMagenta"],["darkred","darkRed"],["darkyellow","darkYellow"],["lightgray","lightGray"],["lightgrey","lightGray"]]),HF=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,_F=new Map(jf.map(e=>[e.toLowerCase(),e])),Ax=new WeakMap;function lt(e){let t=Ax.get(e);if(t!==void 0)return t;let n=new Map;Ax.set(e,n);let r=e.getAttribute("style");if(!r||r.length>8192)return n;for(let o of r.split(";")){let i=o.indexOf(":");if(i<=0)continue;let a=o.slice(0,i).trim().toLowerCase(),s=o.slice(i+1).trim();a.length>0&&s.length>0&&(n.delete(a),n.set(a,s));}return n}function no(e){let t=e.trim().toLowerCase(),n=NF.get(t);if(n)return n;let r=/^#([0-9a-f]{6})$/.exec(t);if(r)return r[1].toUpperCase();let o=/^#([0-9a-f]{3})$/.exec(t);if(o){let[a,s,l]=o[1];return `${a}${a}${s}${s}${l}${l}`.toUpperCase()}let i=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,[^)]*)?\)$/.exec(t);if(i){let a=s=>Math.min(255,Number.parseInt(s,10)).toString(16).padStart(2,"0");return `${a(i[1])}${a(i[2])}${a(i[3])}`.toUpperCase()}return null}function BF(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return DF.get(t)}function Fx(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||HF.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:no(t)}function xn(e,t,n){return Math.min(n,Math.max(t,e))}function hd(e){let t=null;for(let[n,r]of e)if(n==="background")t=Fx(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let i=Fx(r);i!==null&&(t=i);}return t}var $F=new Set(["left","center","right","decimal","bar"]),qF=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function VF(e){if(e===void 0||e.length===0||e.length>512)return;let t="left",n,r=[];for(let o of e.trim().toLowerCase().split(/\s+/)){if($F.has(o)){t=o;continue}if(o==="list"){t="left";continue}let i=qF.get(o);if(i!==void 0){n=i;continue}let a=St(o);if(!(a===null||a<0)){if(r.push({val:t,posTwips:xn(Math.round(a*20),0,31680),...n===void 0?{}:{leader:n}}),r.length>=32)break;t="left",n=void 0;}}return r.length>0?r:void 0}var KF=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function Gf(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var jF=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function gd(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let i of Gf(e)){let a=i.toLowerCase();if(a==="none"||a==="hidden"){n=true;continue}let s=KF.get(a);if(s!==void 0){t=s;continue}let l=jF.get(i.toLowerCase())??St(i);if(l!==null){r=l;continue}let d=no(i);if(d!==null){o=d;continue}return}if(n)return "suppressed";if(t!==void 0)return r===void 0?{val:t,szEighthPoints:4,color:o??"000000"}:r<=0?"suppressed":{val:t,szEighthPoints:xn(Math.round(r*8),2,96),color:o??"000000"}}function yd(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function gs(e,t){return t==="b"||t==="strong"?{...e,bold:true}:t==="i"||t==="em"?{...e,italic:true}:t==="u"||t==="ins"?{...e,underline:true}:t==="s"||t==="strike"||t==="del"?{...e,strike:true}:t==="sub"?{...e,vertAlign:"subscript"}:t==="sup"?{...e,vertAlign:"superscript"}:t==="code"||t==="tt"||t==="kbd"||t==="samp"?{...e,font:"Courier New"}:e}function Xf(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let v=Number.parseInt(r,10);r==="bold"||v>=600?n.bold=true:(r==="normal"||v<600)&&(n.bold=false);}let o=t.get("font-style");o!==void 0&&(n.italic=o.toLowerCase().includes("italic"));let i=(t.get("text-decoration")??t.get("text-decoration-line"))?.toLowerCase();i!==void 0&&(i.includes("underline")&&(n.underline=true),i.includes("line-through")&&(n.strike=true),i.includes("none")&&(n.underline=n.strike=false));let a=t.get("font-variant")?.toLowerCase();a!==void 0&&(a.includes("small-caps")?n.smallCaps=true:(a.includes("normal")||a.includes("none"))&&(n.smallCaps=false));let s=t.get("text-transform")?.trim().toLowerCase();s==="uppercase"?n.caps=true:s==="none"&&(n.caps=false);let l=t.get("text-underline");if(l!==void 0&&l.length<=128)for(let v of l.trim().split(/\s+/)){let k=v.toLowerCase(),P=_F.get(k);if(P!==void 0)n.underline=true,n.underlineVal=P;else {let T=no(v);T!==null&&(n.underlineColor=T);}}let d=t.get("text-decoration-style")?.trim().toLowerCase();if(d==="double"&&n.strike&&!n.underline&&(n.doubleStrike=true),n.underline){d==="double"?n.underlineVal="double":d==="dotted"?n.underlineVal="dotted":d==="dashed"?n.underlineVal="dash":d==="wavy"&&(n.underlineVal="wave");let v=no(t.get("text-decoration-color")??"");v!==null&&(n.underlineColor=v);}let c=no(t.get("color")??"");c&&(n.color=c);let u=BF(t.get("mso-highlight"));if(u)n.highlight=u,delete n.shdFill;else {let v=hd(t);v&&(n.shdFill=v);}let p=St(t.get("font-size")??"");p!==null&&p>0&&(n.szHalfPoints=xn(Math.round(p*2),2,3276));let m=t.get("font-family");if(m!==void 0){let v=m.split(",")[0].trim().replace(/^['"]|['"]$/g,"");v.length>0&&v.length<=64&&(n.font=v);}let h=St(t.get("letter-spacing")??"");h!==null&&(n.charSpacingTwentieths=xn(Math.round(h*20),-31680,31680));let b=t.get("vertical-align")?.trim().toLowerCase();b==="sub"?n.vertAlign="subscript":b==="super"&&(n.vertAlign="superscript");let y=qo(t.get("mso-ansi-language")),g=qo(t.get("mso-fareast-language")),x=qo(t.get("mso-bidi-language"));return y!==null&&(n.langVal=y),g!==null&&(n.langEastAsia=g),x!==null&&(n.langBidi=x),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function Ko(e,t){let n=Xf(e,lt(t)),r=qo(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function $x(e,t){let n=t.get("text-align")?.toLowerCase();n==="left"||n==="right"||n==="start"||n==="end"?e.jc=n:n==="center"?e.jc="center":n==="justify"&&(e.jc="both"),t.get("direction")?.trim().toLowerCase()==="rtl"&&(e.bidi=true);let r={top:null,right:null,bottom:null,left:null},o=t.get("margin");if(o!==void 0&&o.length<=128){let g=o.trim().split(/\s+/).map(x=>St(x));if(g.length>=1&&g.length<=4&&!g.some(x=>x===null)){let[x,v=x,k=x,P=v]=g.length===2?[g[0],g[1],g[0],g[1]]:g.length===3?[g[0],g[1],g[2],g[1]]:g;r.top=x??null,r.right=v??null,r.bottom=k??null,r.left=P??null;}}let i=St(t.get("margin-left")??"")??r.left;i!==null&&(i>0||i===0&&!e.numPr)&&(e.indLeftTwips=xn(Math.round(i*20),0,31680));let a=St(t.get("margin-right")??"")??r.right;a!==null&&a>=0&&(e.indRightTwips=xn(Math.round(a*20),0,31680));let s=St(t.get("text-indent")??"");if(s!==null&&s!==0){let g=xn(Math.round(s*20),-31680,31680);g!==0&&(e.firstLineTwips=g);}let l=St(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=xn(Math.round(l*20),0,31680));let d=St(t.get("margin-bottom")??"")??r.bottom;d!==null&&d>=0&&(e.spacingAfterTwips=xn(Math.round(d*20),0,31680));let c=t.get("line-height")?.trim()??"",u=t.get("mso-line-height-rule")?.trim().toLowerCase(),p=St(c);if(p!==null&&p>0)e.lineTwentieths=xn(Math.round(p*20),24,31680),e.lineRule=u==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(c)&&Number.parseFloat(c)>0)e.lineTwentieths=xn(Math.round(240*Number.parseFloat(c)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(c)){let g=Number.parseFloat(c);g>0&&(e.lineTwentieths=xn(Math.round(2.4*g),24,9600),e.lineRule="auto");}(t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page")&&(e.pageBreakBefore=true),t.get("page-break-after")?.trim().toLowerCase()==="avoid"&&(e.keepNext=true),t.get("page-break-inside")?.trim().toLowerCase()==="avoid"&&(e.keepLines=true),(/^[2-9]\d?$/.test(t.get("widows")?.trim()??"")||/^[2-9]\d?$/.test(t.get("orphans")?.trim()??""))&&(e.widowControl=true);let m=hd(t);m&&(e.shdFill=m);let h=VF(t.get("tab-stops"));h!==void 0&&(e.tabs=h);let b=gd(t.get("mso-border-alt"))??gd(t.get("border")),y={};for(let g of ["top","left","bottom","right"]){let x=gd(t.get(`mso-border-${g}-alt`))??gd(t.get(`border-${g}`))??b;x!==void 0&&x!=="suppressed"&&(y[g]=x);}Object.keys(y).length>0&&(e.borders=y);}var WF="http://schemas.openxmlformats.org/drawingml/2006/picture",ZF=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,UF=new Map([["image/png","png"],["image/jpeg","jpeg"],["image/gif","gif"],["image/bmp","bmp"],["image/webp","webp"],["image/svg+xml","svg"],["image/tiff","tiff"],["image/x-emf","emf"],["image/x-wmf","wmf"]]);function qx(e,t,n){return Math.min(n,Math.max(t,e))}function Vx(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let i=ZF.exec(o);if(!i)return;let a=n.mediaBySrc.get(o),s=a===void 0?void 0:n.media.get(a),l=s??pd(i[1],n.maxImageBytes);if(l==null)return;let d=de$1(l),c=UF.get(d);if(c===void 0)return;let u=d==="image/png"||d==="image/jpeg"||d==="image/gif"||d==="image/bmp"||d==="image/webp"?ie$1(l,d):null,p=lt(e),m=zf(e,p,"width",n.wordHtml),h=zf(e,p,"height",n.wordHtml);u!==null?m===null&&h===null?(m=u.pixelWidth*96/(u.dpiX??96),h=u.pixelHeight*96/(u.dpiY??96)):m!==null&&h===null?h=m*u.pixelHeight/u.pixelWidth:m===null&&h!==null&&(m=h*u.pixelWidth/u.pixelHeight):m!==null&&h===null?h=m*2/3:m===null&&h!==null&&(m=h*3/2);let b=m===null?381e4:qx(Math.round(m*9525),9525,3e7),y=h===null?254e4:qx(Math.round(h*9525),9525,3e7),g=s===void 0?void 0:a;g===void 0&&(n.imageCount+=1,g=`word/media/image${n.imageCount}.${c}`,n.media.set(g,l),n.mediaBySrc.set(o,g),n.mediaExtensions.has(c)||n.mediaExtensions.set(c,d));let x=r(g.replace("word/",""));n.docPrId+=1,t.push(`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${b}" cy="${y}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${WF}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${x}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${b}" cy="${y}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`);}var zF="http://schemas.openxmlformats.org/wordprocessingml/2006/main",GF='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',Kx=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function jx(e,t,n){let r=720*(n+1);if(e==="bullet"){let i=Kx[n%Kx.length];return `<w:lvl w:ilvl="${n}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${S$2(i.text)}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${r}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${i.font}" w:hAnsi="${i.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=e==="lowerRoman"||e==="upperRoman";return `<w:lvl w:ilvl="${n}"><w:start w:val="${t}"/><w:numFmt w:val="${e}"/><w:lvlText w:val="%${n+1}."/><w:lvlJc w:val="${o?"right":"left"}"/><w:pPr><w:ind w:left="${r}" w:hanging="${o?180:360}"/></w:pPr></w:lvl>`}var XF=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),YF=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),Wx=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function Zx(e){let t=new Map;if(e.length===0||e.length>262200)return t;Wx.lastIndex=0;let n,r=0;for(;(n=Wx.exec(e))!==null&&r<512;){r+=1;let o="decimal",i=null;for(let s of n[4].split(";")){let l=s.indexOf(":");if(l<=0)continue;let d=s.slice(0,l).trim().toLowerCase(),c=s.slice(l+1).trim().toLowerCase();d==="mso-level-number-format"?o=YF.get(c)??null:d==="mso-level-start-at"&&/^\d{1,5}$/.test(c)&&(i=Math.min(32767,Number.parseInt(c,10)));}if(o===null)continue;let a=n[3]===void 0?`l${n[1]}:level${n[2]}`:`l${n[1]}:level${n[2]}:lfo${n[3]}`;t.has(a)||t.set(a,{kind:o,start:i});}return t}function Ux(e,t){let n=e.trim().replace(/^\(/,"");if(t==="decimal"){let r=/^(\d{1,5}(?:\.\d{1,5})*)/.exec(n);if(!r)return null;let o=r[1].split(".");return Math.min(32767,Number.parseInt(o[o.length-1],10))}if(t==="lowerRoman"||t==="upperRoman"){let r=/^([A-Za-z]{1,8})/.exec(n);return r?zx(r[1]):null}if(t==="lowerLetter"||t==="upperLetter"){let r=/^(([A-Za-z])\2{0,4})(?![A-Za-z])/.exec(n);if(!r)return null;let o=r[2].toLowerCase().charCodeAt(0);return Math.min(32767,(r[1].length-1)*26+(o-96))}return null}var QF=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function zx(e){let t=e.toLowerCase();if(!QF.test(t))return null;let n=0,r=0;for(let o of t){let i=XF.get(o);if(i===void 0)return null;n+=i,r>0&&r<i&&(n-=2*r),r=i;}return n>0&&n<=32767?n:null}function Gx(e){let t=e.trim().replace(/^\(/,""),n=/^(\d{1,5}(?:\.\d{1,5})*)[.)]/.exec(t);if(n){let a=n[1].split(".");return {kind:"decimal",start:Math.min(32767,Number.parseInt(a[a.length-1],10))}}let r=/^([A-Za-z])[.)]/.exec(t);if(r){let a=r[1].toLowerCase();if(a==="i"||a==="v"||a==="x"){let l=a==="i"?1:a==="v"?5:10;return {kind:r[1]===a?"lowerRoman":"upperRoman",start:l}}let s=r[1].charCodeAt(0);return s>=97?{kind:"lowerLetter",start:s-96}:{kind:"upperLetter",start:s-64}}let o=/^([A-Za-z]{2,8})[.)]/.exec(t);if(o){let a=o[1],s=a===a.toLowerCase(),l=/^([A-Za-z])\1+$/.test(a);if(!l||/^[iI]+$/.test(a)){let d=zx(a);if(d!==null)return {kind:s?"lowerRoman":"upperRoman",start:d}}if(l){let d=a.toLowerCase().charCodeAt(0),c=Math.min(32767,(a.length-1)*26+(d-96));return {kind:s?"lowerLetter":"upperLetter",start:c}}}let i=/\d{1,5}/.exec(t);return i?{kind:"decimal",start:Math.min(32767,Number.parseInt(i[0],10))}:{kind:"bullet",start:1}}var JF=new Map([["none","none"],["decimal","decimal"],["upper-alpha","upperLetter"],["upper-latin","upperLetter"],["lower-alpha","lowerLetter"],["lower-latin","lowerLetter"],["upper-roman","upperRoman"],["lower-roman","lowerRoman"]]);function Xx(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=lt(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:JF.get(t);if(n!==void 0)return n;let r=e.getAttribute("type");return r==="A"?"upperLetter":r==="a"?"lowerLetter":r==="I"?"upperRoman":r==="i"?"lowerRoman":"decimal"}function Yf(e){let t=e.getAttribute("start")?.trim();return t!==void 0&&/^\d{1,5}$/.test(t)?Math.min(32767,Number.parseInt(t,10)):1}function Yx(e){let t=e.map((r,o)=>{let i=r.levels.get(0)??r.levels.values().next().value??{kind:"decimal"},a=Array.from({length:9},(s,l)=>{let d=r.levels.get(l);return d?jx(d.kind,d.start,l):jx(i.kind==="bullet"?"bullet":"decimal",1,l)}).join("");return `<w:abstractNum w:abstractNumId="${o}"><w:multiLevelType w:val="hybridMultilevel"/>${a}</w:abstractNum>`}).join(""),n=e.map((r,o)=>`<w:num w:numId="${r.numId}"><w:abstractNumId w:val="${o}"/></w:num>`).join("");return `${GF}<w:numbering xmlns:w="${zF}">${t}${n}</w:numbering>`}function Kn(e){if(e==null)return null;let t=e.trim();if(t.length===0||t.length>256)return null;if(/^[A-Za-z_][A-Za-z0-9_]{0,39}$/.test(t))return t;let n=t.replace(/[^A-Za-z0-9_]/g,"_");if(n.replace(/_/g,"").length===0)return null;let r=5381;for(let a=0;a<t.length;a+=1)r=(Math.imul(r,33)^t.charCodeAt(a))>>>0;let o=`_${r.toString(36)}`,i=n.slice(0,40-o.length);return /^[A-Za-z_]/.test(i)||(i=`_${i.slice(0,39-o.length)}`),`${i}${o}`}function Qx(e){if(e===null)return false;if(e.startsWith("#"))return Kn(e.slice(1))!==null;let t=Q(e);return t?.ok===true&&t.href.length>0}function Jx(e,t){if(e!==void 0&&e.startsWith("#")){let o=Kn(e.slice(1)),i=Kn(t)??o;return i===null?null:`#${i}`}let n=e===void 0?null:Q(e),r=Kn(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function eS(){let e=null;return (t,n,r)=>{if(e!==null&&e.html===t&&e.key===n){let a=e.value;return e=null,a}let o=r(),i={html:t,key:n,value:o};return e=i,setTimeout(()=>{e===i&&(e=null);},0),o}}var e1=/^(ftn|edn)([1-9]\d{0,9})$/i,t1={footnote:"ftn",endnote:"edn"};function tS(e,t){let n=e===null?null:e1.exec(e);if(!n||n[1].toLowerCase()!==t1[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function Qf(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=tS(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function n1(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=tS(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function nS(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],i=n1(o,lt(o));i!==null&&t.push({...i,element:o});}return t}function rS(e,t,n){let r=new Map(t.map(a=>[a.element,a])),o=a=>{let s=a.parentElement;for(let l=0;s!==null&&l<128;l+=1){let d=r.get(s);if(d!==void 0)return d;s=s.parentElement;}return null},i=e.getElementsByTagName("a");for(let a=0;a<i.length&&a<2e4;a+=1){let s=i[a],l=Qf(lt(s));if(l===null)continue;let d=o(s);d!==null&&d.kind===l.kind&&d.id===l.id||n[l.kind].add(l.id);}}function oS(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var r1=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function _i(e,t,n){return e.replace(r1,(r,o,i)=>{let a=`${o}:${i}`;return t.has(a)?n?.get(a)??"":r})}function Jf(e,t){let n="";for(let[r,o]of t)n+=`<w:${e} w:id="${r}">${o.join("")}</w:${e}>`;return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${e}s xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">${n}</w:${e}s>`}function iS(e,t,n,r){let o=new Set,i={footnote:new Set,endnote:new Set},a=()=>{i.footnote.clear(),i.endnote.clear();let s=[],l=(d,c)=>{o.has(`${d}:${c}`)||!e.notes[d].has(c)||i[d].has(c)||(i[d].add(c),s.push({kind:d,id:c}));};for(let d of ["footnote","endnote"])for(let c of e.bodyNoteRefs[d])l(d,c);for(let d of o)for(let c of e.noteNoteRefs.get(d)??[])l(c.kind,c.id);for(;s.length>0;){let d=s.pop();for(let c of e.noteNoteRefs.get(`${d.kind}:${d.id}`)??[])l(c.kind,c.id);}};for(;;){a();let s=false;for(let l of ["footnote","endnote"]){for(let d of e.notes[l].keys()){let c=`${l}:${d}`;if(!(i[l].has(d)||o.has(c))){o.add(c),s=true;break}}if(s)break}if(!s)break}if(o.size>0)for(let s of ["footnote","endnote"])for(let[l,d]of e.notes[s])o.has(`${s}:${l}`)||e.notes[s].set(l,d.map(c=>_i(c,o,e.noteMarkFallbacks)));for(let s of ["footnote","endnote"])for(let[l,d]of [...e.notes[s]]){if(!o.has(`${s}:${l}`))continue;e.notes[s].delete(l),t[s].delete(l);let c=new Map;for(let u of d){let p=_i(u.replace(/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(?:footnote|endnote)Ref\/><\/w:r>/g,""),o,e.noteMarkFallbacks).replace(/ r:(id|embed)="([^"]{1,32})"/g,(m,h,b)=>{let y=c.get(b);if(y===void 0){let g=e.noteRels[s].find(x=>x.id===b);if(g===void 0)return m;y=r(e,g.type,g.target,g.external),c.set(b,y);}return ` r:${h}="${y}"`});n.push(p),e.lastMarkCovered=false;}}}function ep(e,t,n,r=1,o=0){let i=e.lists.get(t);if(i)return i.levels.has(o)||i.levels.set(o,{kind:n,start:r}),i.numId;let a=String(1001+e.lists.size),s={numId:a,levels:new Map([[o,{kind:n,start:r}]])};return e.lists.set(t,s),e.listsByNumId.set(a,s),a}function aS(e,t,n,r){let o=t.get("mso-list");if(o===void 0)return;let i=/\bl(\d{1,4})\s+level(\d{1,2})\b/i.exec(o);if(!i)return;let a=Math.min(Math.max(Number.parseInt(i[2],10)-1,0),8),s=o1(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),d=(l!==null?n.listDefinitions.get(`l${i[1]}:level${i[2]}:lfo${l[1]}`):void 0)??n.listDefinitions.get(`l${i[1]}:level${i[2]}`),c,u;d!==void 0?(c=d.kind,u=Ux(s,c)??d.start??1):{kind:c,start:u}=Gx(s);let m=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${i[1]}${l?`:lfo${l[1]}`:""}`;return {numId:ep(n,m,c,u,a),ilvl:a}}function o1(e,t){let n="",r=(o,i)=>{if(!(n.length>0||i>8||t.nodesLeft<=0)&&Hi(o)){if(yd(o)){n=(o.textContent??"").slice(0,16);return}for(let a of Array.from(o.childNodes))r(a,i+1);}};for(let o of Array.from(e.childNodes))r(o,0);return n}var i1="http://schemas.openxmlformats.org/package/2006/relationships",a1="http://schemas.openxmlformats.org/package/2006/content-types",s1="application/vnd.openxmlformats-package.relationships+xml",rp='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',l1="http://schemas.openxmlformats.org/wordprocessingml/2006/main",np="http://schemas.openxmlformats.org/officeDocument/2006/relationships",d1="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",c1="http://schemas.openxmlformats.org/drawingml/2006/main",u1="http://schemas.openxmlformats.org/drawingml/2006/picture",f1="http://schemas.openxmlformats.org/officeDocument/2006/math",sS={document:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",numbering:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",footnotes:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",endnotes:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"};function tp(e){let t=e.map(n=>`<Relationship Id="${S$2(n.id)}" Type="${S$2(n.type)}" Target="${S$2(n.target)}"${n.external?' TargetMode="External"':""}/>`).join("");return `${rp}<Relationships xmlns="${i1}">${t}</Relationships>`}function p1(e){let t=new Map;t.set("word/document.xml",Td$2(e.documentXml)),t.set("word/_rels/document.xml.rels",Td$2(tp(e.rels))),t.set("_rels/.rels",Td$2(tp([{id:"rId1",type:`${np}/officeDocument`,target:"word/document.xml",external:false}])));let n=[["numbering",e.numberingXml],["footnotes",e.footnotesXml],["endnotes",e.endnotesXml]],r=`<Override PartName="/word/document.xml" ContentType="${sS.document}"/>`;for(let[i,a]of n)a!==void 0&&(t.set(`word/${i}.xml`,Td$2(a)),r+=`<Override PartName="/word/${i}.xml" ContentType="${sS[i]}"/>`);for(let[i,a]of [["footnotes",e.footnotesRels],["endnotes",e.endnotesRels]])a!==void 0&&a.length>0&&t.set(`word/_rels/${i}.xml.rels`,Td$2(tp(a)));for(let[i,a]of e.media)t.set(i,a);let o=`<Default Extension="rels" ContentType="${s1}"/><Default Extension="xml" ContentType="application/xml"/>`;for(let[i,a]of e.mediaExtensions)o+=`<Default Extension="${S$2(i)}" ContentType="${S$2(a)}"/>`;return t.set("[Content_Types].xml",Td$2(`${rp}<Types xmlns="${a1}">${o}${r}</Types>`)),Sd$1(t)}function lS(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${np}/${o}`,target:`${o}.xml`,external:false});};e.lists.length>0&&n("numbering");for(let o of ["footnote","endnote"])e.notes[o].size>0&&n(`${o}s`);let r=`${rp}<w:document xmlns:w="${l1}" xmlns:r="${np}" xmlns:wp="${d1}" xmlns:a="${c1}" xmlns:pic="${u1}" xmlns:m="${f1}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return p1({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:Yx(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:Jf("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:Jf("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}function Ar(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(!(r!==9&&(r<32||r===65534||r===65535))){if(r>=55296&&r<=56319){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(t+=e[n]+e[n+1],n+=1);continue}r>=56320&&r<=57343||(t+=e[n]);}}return t}function lr(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${S$2(e.rStyle)}"/>`),e.font!==void 0){let a=S$2(Ar(e.font));t+=e.rtl?`<w:rFonts w:cs="${a}"/>`:`<w:rFonts w:ascii="${a}" w:hAnsi="${a}"/>`;}e.bold?t+="<w:b/>":e.bold===false&&(t+='<w:b w:val="0"/>'),e.italic?t+="<w:i/>":e.italic===false&&(t+='<w:i w:val="0"/>'),e.caps?t+="<w:caps/>":e.caps===false&&(t+='<w:caps w:val="0"/>'),e.smallCaps?t+="<w:smallCaps/>":e.smallCaps===false&&(t+='<w:smallCaps w:val="0"/>'),e.doubleStrike?t+="<w:dstrike/>":e.strike?t+="<w:strike/>":e.strike===false&&(t+='<w:strike w:val="0"/>'),e.color!==void 0&&(t+=`<w:color w:val="${e.color}"/>`),e.charSpacingTwentieths!==void 0&&(t+=`<w:spacing w:val="${e.charSpacingTwentieths}"/>`),e.szHalfPoints!==void 0&&(t+=`<w:sz w:val="${e.szHalfPoints}"/>`),e.highlight!==void 0&&(t+=`<w:highlight w:val="${S$2(e.highlight)}"/>`),e.underline?t+=`<w:u w:val="${e.underlineVal??"single"}"${e.underlineColor===void 0?"":` w:color="${e.underlineColor}"`}/>`:e.underline===false&&(t+='<w:u w:val="none"/>'),e.shdFill!==void 0&&(t+=`<w:shd w:val="clear" w:color="auto" w:fill="${e.shdFill}"/>`),e.vertAlign!==void 0&&(t+=`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&(t+="<w:rtl/>");let n=e.langVal,r=e.langEastAsia,o=e.langBidi;e.lang!==void 0&&(e.rtl?o??=e.lang:/^(?:zh|ja|ko)(?:-|$)/i.test(e.lang)?r??=e.lang:n??=e.lang);let i=`${n===void 0?"":` w:val="${S$2(n)}"`}${r===void 0?"":` w:eastAsia="${S$2(r)}"`}${o===void 0?"":` w:bidi="${S$2(o)}"`}`;return i.length>0&&(t+=`<w:lang${i}/>`),t.length>0?`<w:rPr>${t}</w:rPr>`:""}function bd(e,t){return `<w:r>${lr(t)}<w:t xml:space="preserve">${R(Ar(e))}</w:t></w:r>`}function m1(e){let t="";if(e.styleId!==void 0&&(t+=`<w:pStyle w:val="${S$2(e.styleId)}"/>`),e.keepNext&&(t+="<w:keepNext/>"),e.keepLines&&(t+="<w:keepLines/>"),e.pageBreakBefore&&(t+="<w:pageBreakBefore/>"),e.widowControl&&(t+="<w:widowControl/>"),e.numPr&&(t+=`<w:numPr><w:ilvl w:val="${e.numPr.ilvl}"/><w:numId w:val="${S$2(e.numPr.numId)}"/></w:numPr>`),e.borders!==void 0){let a="";for(let s of ["top","left","bottom","right"]){let l=e.borders[s];l!==void 0&&(a+=`<w:${s} w:val="${l.val}" w:sz="${l.szEighthPoints}" w:space="0" w:color="${l.color}"/>`);}a.length>0&&(t+=`<w:pBdr>${a}</w:pBdr>`);}if(e.shdFill!==void 0&&(t+=`<w:shd w:val="clear" w:color="auto" w:fill="${e.shdFill}"/>`),e.tabs!==void 0&&e.tabs.length>0&&(t+=`<w:tabs>${e.tabs.map(a=>`<w:tab w:val="${a.val}" w:pos="${a.posTwips}"`+(a.leader===void 0?"/>":` w:leader="${a.leader}"/>`)).join("")}</w:tabs>`),e.bidi&&(t+="<w:bidi/>"),e.spacingBeforeTwips!==void 0||e.spacingAfterTwips!==void 0||e.lineTwentieths!==void 0){let a="<w:spacing";e.spacingBeforeTwips!==void 0&&(a+=` w:before="${e.spacingBeforeTwips}"`),e.spacingAfterTwips!==void 0&&(a+=` w:after="${e.spacingAfterTwips}"`),e.lineTwentieths!==void 0&&(a+=` w:line="${e.lineTwentieths}" w:lineRule="${e.lineRule??"auto"}"`),t+=`${a}/>`;}let n=e.firstLineTwips,[r,o]=e.bidi?[e.indRightTwips,e.indLeftTwips]:[e.indLeftTwips,e.indRightTwips];if(r!==void 0||o!==void 0||n!==void 0){let a="<w:ind";r!==void 0&&(a+=` w:left="${r}"`),o!==void 0&&(a+=` w:right="${o}"`),n!==void 0&&(a+=n>=0?` w:firstLine="${n}"`:` w:hanging="${-n}"`),t+=`${a}/>`;}let i=e.jc==="start"?"left":e.jc==="end"?"right":e.bidi&&(e.jc==="left"||e.jc==="right")?e.jc==="left"?"right":"left":e.jc;return i!==void 0&&(t+=`<w:jc w:val="${i}"/>`),t.length>0?`<w:pPr>${t}</w:pPr>`:""}function jo(e,t){return `<w:p>${m1(e)}${t.join("")}</w:p>`}var cS={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function vd(e){let t=e[e.length-1];if(t?.endsWith("</w:p>")){e[e.length-1]=`${t.slice(0,-6)}<w:r><w:br w:type="page"/></w:r></w:p>`;return}e.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>');}var g1=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,dS=new WeakMap;function op(e){let t=dS.get(e);for(t||(t={checked:0,furniture:true},dS.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=g1.test(e[t.checked]),t.checked+=1;return t.furniture}var Wo=32;function Sn(e){return e.left<=0?(e.truncated=true,false):(e.left-=1,e.visited+=1,true)}var uS=Object.freeze({});function fS(e,t){let n={...t};return e.bold!==void 0&&(n.bold=e.bold),e.italic!==void 0&&(n.italic=e.italic),e.color!==void 0&&(n.color=e.color),e.highlight!==void 0&&(n.highlight=e.highlight),e.shdFill!==void 0&&(n.shdFill=e.shdFill),e.szHalfPoints!==void 0&&(n.szHalfPoints=e.szHalfPoints),n}function h1(e){return e.replace(/ /g," ").replace(/[⁡-⁤]/g,"").replace(/[ \t\r\n\f\v]+/g," ")}function Fr(e,t,n){let r=R(Ar(h1(e)));if(r.length===0)return "";let i=n.uprightUnlessItalic===true&&n.italic!==true?n.bold?"b":"p":n.bold?"bi":null,a=t.length>0?t:i?`<m:sty m:val="${i}"/>`:"",s=lr({...n.color!==void 0?{color:n.color}:{},...n.highlight!==void 0?{highlight:n.highlight}:{},...n.shdFill!==void 0?{shdFill:n.shdFill}:{},...n.szHalfPoints!==void 0?{szHalfPoints:n.szHalfPoints}:{}});return `<m:r>${a.length>0?`<m:rPr>${a}</m:rPr>`:""}${s}<m:t xml:space="preserve">${r}</m:t></m:r>`}var y1=512,pS=new Set(["\u2211","\u220F","\u2210","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"]),b1=new Map([["^","\u0302"],["\u02C6","\u0302"],["\u0302","\u0302"],["~","\u0303"],["\u02DC","\u0303"],["\u0303","\u0303"],["\u02D9","\u0307"],["\u0307","\u0307"],["\xA8","\u0308"],["\u0308","\u0308"],["\u2192","\u20D7"],["\u20D7","\u20D7"],["\xB4","\u0301"],["`","\u0300"],["\u02C7","\u030C"],["\u02D8","\u0306"]]),mS=new Set(["\xAF","\u203E","_","\u2015","\u2014","\u0305","-"]),gS=new Map([["(",")"],["[","]"],["{","}"],["|","|"],["\u2016","\u2016"],["\u27E8","\u27E9"],["\u2329","\u232A"],["\u230A","\u230B"],["\u2308","\u2309"]]),v1=new Set(["annotation","annotation-xml","none","mprescripts","mspace","maligngroup","malignmark","mphantom"]),x1=new Set(["msub","msup","msubsup","munder","mover","munderover"]);function Lr(e){return e.localName.toLowerCase()}function ys(e){return Array.from(e.children)}function ro(e){return (e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim().slice(0,y1)}function Zo(e){return S$2(Ar(e))}function qe(e,t){return t.length>0?`<m:${e}>${t}</m:${e}>`:`<m:${e}/>`}function hS(e,t){let n=t,r=e.getAttribute("mathcolor")?.trim()??"",o=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(r)?.[1];if(o!==void 0){let a=o.length===3?o.replace(/./g,s=>s+s):o;n={...n,color:a.toUpperCase()};}let i=e.getAttribute("mathvariant")?.trim().toLowerCase();return (i==="bold"||i==="bold-italic")&&(n={...n,bold:true}),n}function hs(e){if(e===void 0||Lr(e)!=="mo")return null;let t=ro(e);return [...t].length===1?t:null}var ip=class{constructor(t){this.state=t;}state;node(t,n,r){if(n>Wo)return this.state.truncated=true,"";if(!Sn(this.state))return "";let o=Lr(t),i=hS(t,r),a=ys(t),s=l=>a[l]?this.node(a[l],n+1,i):"";if(v1.has(o))return "";switch(o){case "semantics":return s(0);case "mi":return this.identifier(t,i);case "mn":case "mo":return Fr(ro(t),"",i);case "mtext":return Fr(ro(t),"<m:nor/>",i);case "ms":return Fr(`"${ro(t)}"`,"<m:nor/>",i);case "msub":return `<m:sSub>${qe("e",s(0))}${qe("sub",s(1))}</m:sSub>`;case "msup":return `<m:sSup>${qe("e",s(0))}${qe("sup",s(1))}</m:sSup>`;case "msubsup":return `<m:sSubSup>${qe("e",s(0))}${qe("sub",s(1))}${qe("sup",s(2))}</m:sSubSup>`;case "mfrac":return this.fraction(t,s(0),s(1));case "msqrt":return `<m:rad><m:radPr><m:degHide m:val="1"/></m:radPr><m:deg/>${qe("e",this.row(a,n+1,i))}</m:rad>`;case "mroot":return `<m:rad>${qe("deg",s(1))}${qe("e",s(0))}</m:rad>`;case "munder":return this.under(a[1],s(0),s(1));case "mover":return this.over(t,a[1],s(0),s(1));case "munderover":return `<m:limUpp>${qe("e",`<m:limLow>${qe("e",s(0))}${qe("lim",s(1))}</m:limLow>`)}${qe("lim",s(2))}</m:limUpp>`;case "mfenced":return this.fenced(t,a,n,i);case "menclose":return `<m:borderBox>${qe("e",this.row(a,n+1,i))}</m:borderBox>`;case "mtable":return this.table(a,n,i);case "mmultiscripts":return this.multiscripts(a,n,i);default:return this.row(a,n+1,i)}}identifier(t,n){let r=ro(t),o=t.getAttribute("mathvariant")?.trim().toLowerCase(),i="";return o==="normal"||o===void 0&&[...r].length>1?i='<m:sty m:val="p"/>':o==="bold"?i='<m:sty m:val="b"/>':o==="bold-italic"&&(i='<m:sty m:val="bi"/>'),Fr(r,i,n)}fraction(t,n,r){let o=t.getAttribute("linethickness")?.trim().toLowerCase(),i=t.getAttribute("bevelled")?.trim().toLowerCase()==="true",a=o!==void 0&&/^0(?:\.0*)?(?:px|pt|em|ex|%)?$/.test(o)?"noBar":i?"skw":null;return `<m:f>${a===null?"":`<m:fPr><m:type m:val="${a}"/></m:fPr>`}${qe("num",n)}${qe("den",r)}</m:f>`}under(t,n,r){let o=hs(t);return o!==null&&mS.has(o)?`<m:bar><m:barPr><m:pos m:val="bot"/></m:barPr>${qe("e",n)}</m:bar>`:`<m:limLow>${qe("e",n)}${qe("lim",r)}</m:limLow>`}over(t,n,r,o){let i=hs(n);if(i!==null&&mS.has(i))return `<m:bar><m:barPr><m:pos m:val="top"/></m:barPr>${qe("e",r)}</m:bar>`;let a=i===null?void 0:b1.get(i);return a!==void 0||i!==null&&t.getAttribute("accent")?.trim()==="true"?`<m:acc><m:accPr><m:chr m:val="${Zo(a??i)}"/></m:accPr>${qe("e",r)}</m:acc>`:`<m:limUpp>${qe("e",r)}${qe("lim",o)}</m:limUpp>`}fenced(t,n,r,o){let i=[...t.getAttribute("open")??"("].slice(0,1).join(""),a=[...t.getAttribute("close")??")"].slice(0,1).join(""),s=[...(t.getAttribute("separators")??",").trim()][0]??"",l=n.map(d=>qe("e",this.node(d,r+1,o)));return `<m:d><m:dPr><m:begChr m:val="${Zo(i)}"/>${s.length>0?`<m:sepChr m:val="${Zo(s)}"/>`:""}<m:endChr m:val="${Zo(a)}"/></m:dPr>${l.join("")||"<m:e/>"}</m:d>`}table(t,n,r){let o="";for(let i of t){if(!Sn(this.state))break;let a=Lr(i);if(a!=="mtr"&&a!=="mlabeledtr")continue;let s=ys(i).slice(a==="mlabeledtr"?1:0);o+="<m:mr>"+s.map(l=>qe("e",Lr(l)==="mtd"?this.row(ys(l),n+2,r):this.node(l,n+2,r))).join("")+"</m:mr>";}return o.length>0?`<m:m>${o}</m:m>`:""}multiscripts(t,n,r){let o=d=>d===void 0||Lr(d)==="none"?"":this.node(d,n+1,r),i=t.findIndex(d=>Lr(d)==="mprescripts"),a=i<0?t.slice(1):t.slice(1,i),s=i<0?[]:t.slice(i+1),l=o(t[0]);return a.length>0&&(l=`<m:sSubSup>${qe("e",l)}${qe("sub",o(a[0]))}${qe("sup",o(a[1]))}</m:sSubSup>`),s.length>0?`<m:sPre>${qe("sub",o(s[0]))}${qe("sup",o(s[1]))}${qe("e",l)}</m:sPre>`:l}nary(t,n,r,o){let i=Lr(t),a=ys(t),s=ro(i==="mo"?t:a[0]),l=h=>a[h]?this.node(a[h],r+1,o):"",d="",c="";i==="msub"||i==="munder"?d=l(1):i==="msup"||i==="mover"?c=l(1):(i==="msubsup"||i==="munderover")&&(d=l(1),c=l(2));let u=i==="munder"||i==="mover"||i==="munderover"?"undOvr":"subSup",p=`<m:chr m:val="${Zo(s)}"/><m:limLoc m:val="${u}"/>${d.length===0?'<m:subHide m:val="1"/>':""}${c.length===0?'<m:supHide m:val="1"/>':""}`,m=n?this.node(n,r+1,o):"";return `<m:nary><m:naryPr>${p}</m:naryPr>${qe("sub",d)}${qe("sup",c)}${qe("e",m)}</m:nary>`}isNary(t){let n=Lr(t);if(n==="mo")return pS.has(ro(t));if(!x1.has(n))return false;let r=t.children[0];return r!==void 0&&pS.has(hs(r)??"")}row(t,n,r){if(n>Wo)return this.state.truncated=true,"";let o=hs(t[0]),i=hs(t[t.length-1]);if(t.length>=2&&o!==null&&i!==null&&gS.has(o)&&[...gS.values()].includes(i)){let l=this.row(t.slice(1,-1),n+1,r);return `<m:d><m:dPr><m:begChr m:val="${Zo(o)}"/><m:endChr m:val="${Zo(i)}"/></m:dPr>${qe("e",l)}</m:d>`}let a="";for(let s=0;s<t.length;s+=1){let l=t[s];if(this.isNary(l)){let d=t[s+1];a+=this.nary(l,d,n,r),d!==void 0&&(s+=1);continue}a+=this.node(l,n,r);}return a}};function ap(e){return Lr(e)==="math"}function yS(e){return e.getAttribute("display")?.trim().toLowerCase()==="block"||e.getAttribute("mode")?.trim().toLowerCase()==="display"}function bS(e,t,n){return new ip(t).row(ys(e),1,hS(e,n))}var S1="acc accPr aln alnScr argPr argSz bar barPr baseJc begChr borderBox borderBoxPr box boxPr brk brkBin brkBinSub cGp cGpRule chr count cSp ctrlPr d defJc deg degHide den diff dispDef dPr e endChr eqArr eqArrPr f fName fPr func funcPr groupChr groupChrPr grow hideBot hideLeft hideRight hideTop interSp intLim intraSp jc lim limLoc limLow limLowPr limUpp limUppPr lit lMargin m mathFont mathPr maxDist mc mcJc mcPr mcs mPr mr nary naryLim naryPr noBreak nor num objDist oMath oMathPara oMathParaPr opEmu phant phantPr plcHide pos postSp preSp r rad radPr rMargin rPr rSp rSpRule scr sepChr show shp smallFrac sPre sPrePr sSub sSubPr sSubSup sSubSupPr sSup sSupPr strikeBLTR strikeH strikeTLBR strikeV sty sub subHide sup supHide t transp type vertJc wrapIndent wrapRight zeroAsc zeroDesc zeroWid".split(" "),xS=new Map(S1.map(e=>[`m:${e.toLowerCase()}`,e])),w1=new Set(["oMath","e","num","den","sub","sup","deg","lim","fName"]),I1=512,k1=512,R1=64,P1=64,T1=2,C1=256,vS=/^\[if\s+gte\s+msEquation\b[^\]]*\]>([\s\S]*)<!\[endif\]$/i,E1=/^\[if\s+!msEquation\s*\]$/i,O1=/^\[if\b[^\]]*\]$/i,M1=/^\[endif\]$/i,A1=Object.freeze({byElement:new Map,visited:0,truncated:false});function SS(e){return /<m:omath|msEquation|<math[\s>]/i.test(e)}function bs(e){return e.nodeType===1?xS.get(Xe(e)):void 0}function wS(e,t,n,r){if(!(n>Wo||!Sn(t))){if(e.nodeType===3){r.push(e.nodeValue??"");return}if(!(e.nodeType!==1||Xe(e)==="o:p"))for(let o of Array.from(e.childNodes))wS(o,t,n+1,r);}}function sp(e,t){return fS(Ko(gs({},Xe(e)),e),t)}function F1(e,t,n,r){let o="",i=[],a=r;for(let s of Array.from(e.childNodes)){let l=bs(s);if(l==="rPr")o+=xd(s,"rPr",t,n+1,r);else {if(s.nodeType===1&&Xe(s)==="w:rpr")continue;s.nodeType===1&&l===void 0&&(a=sp(s,a)),wS(s,t,n+1,i);}}return Fr(i.join(""),o,a)}function xd(e,t,n,r,o){let i="",a="",s=w1.has(t);for(let l of Array.from(e.childNodes)){if(l.nodeType===3){if(!Sn(n))break;s&&(a+=l.nodeValue??"");continue}l.nodeType===1&&(a.trim().length>0&&(i+=Fr(a,"",o)),a="",i+=IS(l,t,n,r+1,o));}return a.trim().length>0&&(i+=Fr(a,"",o)),i}function IS(e,t,n,r,o){if(r>Wo)return n.truncated=true,"";if(!Sn(n))return "";let i=xS.get(Xe(e));if(i===void 0)return Xe(e)==="o:p"?"":xd(e,t,n,r,sp(e,o));if(i==="ctrlPr"||i==="oMathPara"||i==="oMath")return "";if(i==="r"||i==="t")return F1(e,n,r,o);let a=e.getAttribute("m:val"),s=a!==null&&a.length<=R1?` m:val="${S$2(Ar(a))}"`:"",l=xd(e,i,n,r,o);return l.length>0?`<m:${i}${s}>${l}</m:${i}>`:`<m:${i}${s}/>`}function kS(e,t,n){if(!Sn(t))return null;let r=xd(e,"oMath",t,1,n);return r.length>0?`<m:oMath>${r}</m:oMath>`:null}function RS(e,t,n,r,o){if(!(n>Wo||!Sn(t)))for(let i of Array.from(e.children)){let a=bs(i);if(a==="oMath"){let s=kS(i,t,r);s!==null&&o.equations.push(s);}else a==="oMathParaPr"&&o.properties.length===0?o.properties=IS(i,"oMathPara",t,n+1,r):a===void 0&&RS(i,t,n+1,sp(i,r),o);}}function L1(e){let t=bs(e);return t==="oMath"||t==="oMathPara"||ap(e)}function N1(e){let t=0;for(let n=e.parentElement;n!==null;n=n.parentElement)if((t+=1)>C1||L1(n))return true;return false}function D1(e,t){if(typeof e.createTreeWalker!="function")return;let n=e.createTreeWalker(e.body,128),r=[];for(let o=n.nextNode();o!==null;o=n.nextNode()){if(!Sn(t))return;let i=o.data;if(/<m:omath|<math[\s>]/i.test(i)&&vS.test(i)){if(r.length>=k1){t.truncated=true;break}r.push(o);}}for(let o of r){let i=vS.exec(o.data)?.[1]??"",a;try{a=new DOMParser().parseFromString(i,"text/html");}catch{continue}let s=o.parentNode;if(!(s===null||a.body===null)){for(let l of Array.from(a.body.childNodes))s.insertBefore(e.importNode(l,true),o);s.removeChild(o);}}}function H1(e){return e.nodeType===3?(e.nodeValue??"").replace(/[\s ]/g,"").length>0:e.nodeType===1||e.nodeType===8}function _1(e){let t=e;for(let n=0;n<=T1;n+=1){let r=t.nextSibling;for(;r!==null&&!H1(r);)r=r.nextSibling;if(r!==null){if(r.nodeType!==8||!E1.test(r.data.trim()))return;let a=[r],s=1;for(let l=r.nextSibling;l!==null&&a.length<=P1;l=l.nextSibling)if(a.push(l),l.nodeType===8){let d=l.data.trim();if(M1.test(d)?s-=1:O1.test(d)&&(s+=1),s===0){for(let c of a)c.parentNode?.removeChild(c);return}}return}let o=t.parentElement;if(o===null||bs(o)!==void 0)return;let i=Xe(o);if(i!=="span"&&i!=="i"&&i!=="b"&&i!=="font")return;t=o;}}function B1(e,t){let n=e.getElementsByTagName("i").length>0?{uprightUnlessItalic:true}:uS;if(ap(e)){if(!Sn(t))return null;let r=bS(e,t,n);return r.length===0?null:yS(e)?`<m:oMathPara><m:oMath>${r}</m:oMath></m:oMathPara>`:`<m:oMath>${r}</m:oMath>`}if(bs(e)==="oMathPara"){let r={properties:"",equations:[]};return RS(e,t,1,n,r),r.equations.length===0?null:`<m:oMathPara>${r.properties}${r.equations.join("")}</m:oMathPara>`}return kS(e,t,n)}function PS(e,t){if(e.body===null||t<=0)return A1;let n={left:t,visited:0,truncated:false};D1(e,n);let r=new Map,o=[];for(let i of ["m:omathpara","m:omath","math"]){let a=e.body.getElementsByTagName(i);for(let s=0;s<a.length;s+=1){if(o.length>=I1){n.truncated=true;break}if(!Sn(n))break;let l=a[s];N1(l)||o.push(l);}}for(let i of o){if(n.left<=0){n.truncated=true;break}let a=B1(i,n);a===null||n.truncated||(r.set(i,[a]),_1(i));}return {byElement:r,visited:n.visited,truncated:n.truncated}}function lp(e){return e.startsWith("<m:oMath>")||e.startsWith("<m:oMathPara>")}function jn(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var oo=31680;function Nr(e,t,n){return Math.min(n,Math.max(t,e))}function TS(e){let t=St(lt(e).get("width")??"");if(t!==null&&t>0)return t;let n=e.getAttribute("width")?.trim();if(n===void 0||!/^\d{1,6}(\.\d+)?$/.test(n))return null;let r=Number.parseFloat(n);return Number.isFinite(r)&&r>0?r*.75:null}function $1(e){return Uo(e,"colspan",63)}function CS(e){return Array.from(e.children).flatMap(t=>{let n=Xe(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>Xe(r)==="tr")})}function Uo(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:Nr(Number.parseInt(r,10),1,n)}function ES(e,t){let n=(lt(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${Nr(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=TS(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let i=Nr(Math.round(o*20),1,oo);return {xml:`<w:tblW w:w="${i}" w:type="dxa"/>`,twips:i}}function OS(e){let n=lt(e).get("mso-table-left")?.trim().toLowerCase(),r=(n==="left"||n==="center"||n==="right"?n:void 0)??e.getAttribute("align")?.trim().toLowerCase();return r==="left"||r==="center"||r==="right"?r:void 0}function MS(e){let t=lt(e),n=t.get("mso-table-anchor-horizontal")?.trim().toLowerCase(),r=t.get("mso-table-anchor-vertical")?.trim().toLowerCase();if(n===void 0&&r===void 0)return "";let o=l=>l==="margin"||l==="page"?l:"text",i=` w:horzAnchor="${o(n)}" w:vertAnchor="${o(r)}"`,a=t.get("mso-table-left")?.trim().toLowerCase();if(a==="left"||a==="center"||a==="right")i+=` w:tblpXSpec="${a}"`;else {let l=St(a??"");l!==null&&(i+=` w:tblpX="${Nr(Math.round(l*20),-oo,oo)}"`);}let s=St(t.get("mso-table-top")??"");return s!==null&&(i+=` w:tblpY="${Nr(Math.round(s*20),-oo,oo)}"`),`<w:tblpPr${i}/>`}function AS(e,t,n){let r=Math.max(1,Math.floor(n/t)),o=-1,i=Array.from({length:t},()=>r),a=new Array(t).fill(null);for(let c of e){let u=Array.from({length:t},()=>r),p=0,m=0,h=a.map(g=>g?g.span:null);for(let g=0;g<t;g+=1){let x=a[g];x&&(x.remaining-=1,x.remaining<=0&&(a[g]=null));}let b=Array.from(c.children).filter(g=>/^t[dh]$/.test(Xe(g))),y=0;for(;m<t;){let g=h[m];if(g!==null){m+=g;continue}let x=b[y];if(x===void 0)break;y+=1;let v=Math.min($1(x),t-m);for(let T=m+1;T<m+v;T+=1)if(h[T]!==null){v=T-m;break}let k=Uo(x,"rowspan",1e3);k>1&&(a[m]={remaining:k-1,span:v});let P=TS(x);if(P!==null){let T=Nr(Math.round(P*20/v),1,oo);for(let C=0;C<v;C+=1)u[m+C]=T;p+=v;}m+=v;}p>o&&(o=p,i=u);}let s=i.reduce((c,u)=>c+u,0);if(s<=0)return i;let l=i.map(c=>Math.max(1,Math.round(c*n/s))),d=n-l.reduce((c,u)=>c+u,0);return l[l.length-1]=Math.max(1,l[l.length-1]+d),l}function dp(e,t,n){let r=0;for(let o=0;o<n;o+=1)r+=e[t+o]??0;return Math.max(1,r)}var FS=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),LS=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function NS(e){return Nr(Math.round(e*8),2,96)}function dr(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of Gf(e)){let i=FS.get(o.toLowerCase());if(i!==void 0){t=i;continue}let a=LS.get(o.toLowerCase())??St(o);if(a!==null){n=a;continue}let s=no(o);if(s!==null){r=s;continue}return}if(t!==void 0){if(t==="nil")return {val:t,size:0,color:r??"auto"};if(n===void 0)return {val:t,size:4,color:r??"000000"};if(!(n<=0))return {val:t,size:NS(n),color:r??"000000"}}}function Sd(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=FS.get(n.split(/\s+/)[0].toLowerCase());if(r===void 0)return;if(r==="nil")return {val:r,size:0,color:"auto"};let o=e.get(`${t}-width`)?.trim().split(/\s+/)[0],i=o===void 0||o.length>64?null:LS.get(o.toLowerCase())??St(o);if(i!==null&&i<=0)return;let a=e.get(`${t}-color`)?.trim().split(/\s+/)[0],s=a===void 0||a.length>64?null:no(a);return {val:r,size:i===null?4:NS(i),color:s??"000000"}}function DS(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function HS(e,t=false){let n=lt(e),o=dr(n.get("mso-border-alt"))??dr(n.get("border"))??Sd(n,"border")??(e.getAttribute("border")?.trim()&&e.getAttribute("border")?.trim()!=="0"?{val:"single",size:4,color:"auto"}:void 0),i=[["top","top"],["left","left"],["bottom","bottom"],["right","right"],["insideH","insideh"],["insideV","insidev"]],a="";for(let[s,l]of i){let d=jn(l,t),c=dr(n.get(`mso-border-${d}-alt`))??dr(n.get(`mso-border-${d}`))??dr(n.get(`border-${d}`))??Sd(n,`border-${d}`)??o;c!==void 0&&(a+=DS(s,c));}return a.length>0?`<w:tblBorders>${a}</w:tblBorders>`:""}function _S(e){let t=lt(e),n=St(t.get("height")??"");if(n===null||n<=0)return "";let r=Nr(Math.round(n*20),1,oo),i=t.get("mso-height-rule")?.trim().toLowerCase()==="exactly"?"exact":"atLeast";return `<w:trPr><w:trHeight w:val="${r}" w:hRule="${i}"/></w:trPr>`}function q1(e,t){let n={top:null,right:null,bottom:null,left:null},r=e.get("padding");if(r!==void 0&&r.length<=128){let i=r.trim().split(/\s+/).map(a=>St(a));if(i.length>=1&&i.length<=4&&!i.some(a=>a===null||a<0)){let[a,s=a,l=a,d=s]=i.length===2?[i[0],i[1],i[0],i[1]]:i.length===3?[i[0],i[1],i[2],i[1]]:i;n.top=a??null,n.right=s??null,n.bottom=l??null,n.left=d??null;}}for(let i of ["top","right","bottom","left"]){let a=St(e.get(`padding-${i}`)??"");a!==null&&a>=0&&(n[i]=a);}let o="";for(let i of ["top","left","bottom","right"]){let a=jn(i,t),s=n[a];s!==null&&(o+=`<w:${i} w:w="${Nr(Math.round(s*20),0,oo)}" w:type="dxa"/>`);}return o.length>0?`<w:tcMar>${o}</w:tcMar>`:""}function BS(e,t=false){let n=lt(e),r=dr(n.get("mso-border-alt"))??dr(n.get("border"))??Sd(n,"border"),o="";for(let l of ["top","left","bottom","right"]){let d=jn(l,t),c=dr(n.get(`mso-border-${d}-alt`))??dr(n.get(`mso-border-${d}`))??dr(n.get(`border-${d}`))??Sd(n,`border-${d}`)??r;c!==void 0&&(o+=DS(l,c));}let i=o.length>0?`<w:tcBorders>${o}</w:tcBorders>`:"",a=hd(n);a&&(i+=`<w:shd w:val="clear" w:color="auto" w:fill="${a}"/>`),i+=q1(n,t);let s=n.get("vertical-align")?.toLowerCase()??e.getAttribute("valign")?.toLowerCase();return s==="top"?i+='<w:vAlign w:val="top"/>':s==="middle"||s==="center"?i+='<w:vAlign w:val="center"/>':s==="bottom"&&(i+='<w:vAlign w:val="bottom"/>'),i}var V1=9360;function $S(e,t,n,r,o,i){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let C of Array.from(e.children))Xe(C)==="caption"&&i(Array.from(C.childNodes),t+1,n,r,o,true);let a=CS(e);if(a.length===0)return;let s=1,l=r.nodesLeft,d=[];for(let C of a){if(l<=0||s>=63)break;let E=d.map(A=>A?A.span:null);for(let A=0;A<d.length;A+=1){let B=d[A];B&&(B.remaining-=1,B.remaining<=0&&(d[A]=null));}let w=Array.from(C.children).filter(A=>/^t[dh]$/.test(Xe(A))),I=0,L=0;for(;L<63&&(l-=1,!(l<=0));){let A=L<E.length?E[L]:null;if(A!=null){L+=A;continue}let B=w[I];if(B===void 0)break;I+=1;let $=Math.min(Uo(B,"colspan",63),63-L);for(let R=L+1;R<L+$;R+=1)if(R<E.length&&E[R]!=null){$=R-L;break}let j=Uo(B,"rowspan",1e3);if(j>1){for(;d.length<=L;)d.push(null);d[L]={remaining:j-1,span:$};}L+=$;}for(let A=L;A<E.length&&A<63;A+=1){let B=E[A];B!=null&&(L=Math.max(L,A+B));}s=Math.max(s,L);}s=Math.min(Math.max(s,1),63);let c=ES(e,V1),u=c.twips,p=a.length>r.nodesLeft?a.slice(0,Math.max(1,r.nodesLeft)):a,m=AS(p,s,u),b=(lt(e).get("direction")??e.getAttribute("dir"))?.trim().toLowerCase()==="rtl",y=HS(e,b),g=MS(e),x=OS(e)??(b?"left":void 0),v=x===void 0?"":`<w:jc w:val="${jn(x,b)}"/>`,k=m.map(C=>`<w:gridCol w:w="${C}"/>`).join(""),P=new Array(s).fill(null),T=[];for(let C of a){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let E=P.map($=>$?$.span:null);for(let $=0;$<s;$+=1){let j=P[$];j&&(j.remaining-=1,j.remaining<=0&&(P[$]=null));}let w=Array.from(C.children).filter($=>/^t[dh]$/.test(Xe($))),I=0,L=[],A=0,B=true;for(;A<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,B=false;break}let $=E[A];if($!==null){let X=$>1?`<w:gridSpan w:val="${$}"/>`:"";L.push(`<w:tc><w:tcPr><w:tcW w:w="${dp(m,A,$)}" w:type="dxa"/>${X}<w:vMerge/></w:tcPr><w:p/></w:tc>`),A+=$;continue}let j=w[I];if(j===void 0){L.push(`<w:tc><w:tcPr><w:tcW w:w="${m[A]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),A+=1;continue}I+=1;let R=Math.min(Uo(j,"colspan",63),s-A);for(let X=A+1;X<A+R;X+=1)if(E[X]!==null){R=X-A;break}let G=Uo(j,"rowspan",1e3);G>1&&(P[A]={remaining:G-1,span:R}),L.push(K1(j,R,dp(m,A,R),G>1,t,n,r,i,b)),A+=R;}if(!B)break;T.push(`<w:tr>${_S(C)}${L.join("")}</w:tr>`);}T.length!==0&&(o.push(`<w:tbl><w:tblPr>${b?"<w:bidiVisual/>":""}${g}${c.xml}${v}${y}</w:tblPr><w:tblGrid>${k}</w:tblGrid>${T.join("")}</w:tbl>`),r.lastMarkCovered=false);}function K1(e,t,n,r,o,i,a,s,l){let d=Xe(e)==="th",c=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(c+=`<w:gridSpan w:val="${t}"/>`),r&&(c+='<w:vMerge w:val="restart"/>'),c+=BS(e,l);let u={run:d?{...i.run,bold:true}:i.run,para:d?{jc:"center"}:{},paragraphMarkCovered:false,pre:false,list:null,...i.noteBody?{noteBody:i.noteBody}:{},...i.rels?{rels:i.rels}:{}},p=[];return s(Array.from(e.childNodes),o+2,u,a,p,true),(p.length===0||p[p.length-1].endsWith("</w:tbl>"))&&p.push("<w:p/>"),`<w:tc><w:tcPr>${c}</w:tcPr>${p.join("")}</w:tc>`}function qS(e){if(e===void 0)return "";let t=e.trim();return /^\d{1,4}$/.test(t)?"<w:tab/>".repeat(Math.min(Number.parseInt(t,10),64)):""}function VS(e){let t=e.getAttribute("alignment")?.trim().toLowerCase(),n=e.getAttribute("relativeto")?.trim().toLowerCase(),r=e.getAttribute("leader")?.trim().toLowerCase();return t!=="left"&&t!=="center"&&t!=="right"||n!=="margin"&&n!=="indent"||r!=="none"&&r!=="dot"&&r!=="hyphen"&&r!=="underscore"&&r!=="middledot"?"":`<w:ptab w:alignment="${t}" w:relativeTo="${n}" w:leader="${r==="middledot"?"middleDot":r}"/>`}function KS(e){if(Xe(e)!=="br")return false;let t=lt(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function jS(e){if(KS(e))return true;if(Xe(e)!=="span"||e.childNodes.length>8)return false;let t=false;for(let n=0;n<e.childNodes.length;n+=1){let r=e.childNodes[n];if(!(r.nodeType===3&&(r.nodeValue??"").trim().length===0)){if(r.nodeType!==1||t||!KS(r))return false;t=true;}}return t}function WS(e){if(Xe(e)!=="p")return false;let t=null;for(let o=0;o<e.childNodes.length;o+=1){let i=e.childNodes[o];if(i.nodeType===3){if((i.nodeValue??"").replace(/[\s\u00a0]/g,"").length===0)continue;return false}if(i.nodeType!==1||t!==null)return false;t=i;}if(t===null)return false;let n=lt(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(Xe(t)!=="o:p"||t.childNodes.length>3)return false;let r="";for(let o=0;o<t.childNodes.length;o+=1){let i=t.childNodes[o];if(i.nodeType!==3)return false;r+=i.nodeValue??"";}return r.includes("\xA0")&&r.replace(/[\s\u00a0]/g,"").length===0}function cp(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var up=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),fp=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),pp=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),j1=new Set([...fp,...pp,"table","ol","ul","w:sdt"]);function mp(e){for(let t=0;t<e.children.length;t+=1)if(j1.has(Xe(e.children[t])))return true;return false}var W1=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function ZS(e){if(Xe(e)!=="w:sdt")return null;let t=[e],n=0;for(let r=0;r<t.length&&n<64;r+=1){let o=t[r];for(let i=0;i<o.children.length&&n<64;i+=1){let a=o.children[i];n+=1;let s=Xe(a);if(W1.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(a);}}return null}var Z1=4*1024*1024,U1=1e5,z1=64,G1=2*1024*1024,US="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function gp(e,t,n,r,o=e.rels){let i=`rId${o.length+1}`;return o.push({id:i,type:t,target:n,external:r}),i}function wd(e,t,n,r,o){if(o.nodesLeft<=0){o.truncated=true;return}if(t>o.maxDepth)return;if(o.nodesLeft-=1,e.nodeType===3){let b=e.nodeValue??"";if(n.pre){let g=b.replace(/\r\n?/g,`
4
- `).split(`
5
- `);for(let x=0;x<g.length;x+=1){if(x>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${lr(n.run)}<w:br/></w:r>`);}let v=g[x];v.length>0&&r.push(bd(v,n.run));}return}let y=b.replace(/[ \t\r\n\f\v]+/g," ");if(y.length===0||y===" "&&op(r))return;r.push(bd(y,n.run));return}if(!Hi(e))return;let i=o.equations.get(e);if(i!==void 0){for(let b of i)r.push(b);return}let a=Xe(e);if(up.has(a))return;let s=lt(e);if(yd(e)&&n.para.numPr!==void 0||s.get("mso-element")?.trim().toLowerCase()==="comment-reference"||s.get("mso-special-character")?.trim().toLowerCase()==="comment"||e.classList.contains("msocomanchor")||o.definedNoteElements.has(e))return;if(a==="w:ptab"){let b=VS(e);b.length>0&&r.push(`<w:r>${lr(n.run)}${b}</w:r>`);return}let d=qS(s.get("mso-tab-count"));if(d.length>0){if(o.nodesLeft-=d.split("<w:tab/>").length-2,o.nodesLeft<=0){o.truncated=true;return}let b=Xf(gs(n.run,a),s);if(r.push(`<w:r>${lr(b)}${d}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let b=s.get("page-break-before")?.trim().toLowerCase()==="always"||s.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${lr(n.run)}${b?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){Vx(e,r,o,b=>gp(o,`${US}/image`,b,false,n.rels??o.rels));return}let c=gs(n.run,a),u=a==="a"?e.getAttribute("href"):null,p=a==="a"?Qf(s):null;p===null&&Qx(u)&&(c={...c,rStyle:"Hyperlink"});let m=Ko(c,e),h={...n,run:m,pre:n.pre||a==="pre"};if(p!==null){let b={...h.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===p.kind&&n.noteBody.id===p.id){let y=p.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${lr(b)}<w:${y}/></w:r>`);return}if(o.definedNotes[p.kind].has(p.id)){let y=p.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${lr(b)}<w:${y} w:id="${p.id}"/></w:r>`);let g=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),x=`${p.kind}:${p.id}`;if(g.length>0&&!o.noteMarkFallbacks.has(x)&&o.noteMarkFallbacks.set(x,bd(g,b)),n.noteBody===void 0)o.bodyNoteRefs[p.kind].add(p.id);else {let v=`${n.noteBody.kind}:${n.noteBody.id}`,k=o.noteNoteRefs.get(v)??[];k.push({kind:p.kind,id:p.id}),o.noteNoteRefs.set(v,k);}return}for(let y of Array.from(e.childNodes))wd(y,t+1,h,r,o);return}if(a==="a"){let b=e.getAttribute("href"),y=Kn(e.getAttribute("name")||e.getAttribute("id")),g=[];for(let k of Array.from(e.childNodes))wd(k,t+1,h,g,o);let x=b?.startsWith("#")?Kn(b.slice(1)):null,v=g.join("");if(x!==null)v=`<w:hyperlink w:anchor="${S$2(x)}">${v}</w:hyperlink>`;else if(b!==null&&!b.startsWith("#")){let k=Q(b);k.ok&&k.href.length>0&&(v=`<w:hyperlink r:id="${gp(o,`${US}/hyperlink`,k.href,true,n.rels??o.rels)}">${v}</w:hyperlink>`);}if(y!==null){let k=String(o.nextBookmarkId++);v=`<w:bookmarkStart w:id="${k}" w:name="${S$2(y)}"/>${v}<w:bookmarkEnd w:id="${k}"/>`;}v.length>0&&r.push(v);return}for(let b of Array.from(e.childNodes))wd(b,t+1,h,r,o);}function zS(e,t,n,r){let o=Xe(e),i=lt(e),a={};r&&(a.pageBreakBefore=true);let s=Nx(e,n.wordHtml);s!==void 0&&(a.styleId=s),t.para.numPr&&(a.numPr=t.para.numPr),t.para.jc&&(a.jc=t.para.jc),t.para.bidi&&(a.bidi=true);let l={...t.run},d=cS[o];d!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=d);let c=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let u=aS(e,i,n,t.noteBody);return u&&(a.numPr=u),Bx(a,e,n.classAlignments),$x(a,i),l=Ko(l,e),e.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(a.bidi=true),{run:l,para:a,paragraphMarkCovered:a.styleId!==void 0||a.numPr!==void 0,pre:c,list:t.list,...t.noteBody?{noteBody:t.noteBody}:{},...t.rels?{rels:t.rels}:{}}}function GS(e,t,n,r,o,i=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;let a=zS(e,n,r,i);io(Array.from(e.childNodes),t+1,a,r,o,true,void 0,false);}function XS(e,t,n,r,o,i=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;let a=Xx(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:ep(r,`sem:${r.semanticListCount}`,a,Yf(e)),level:0};if(n.list){let c=r.listsByNumId.get(s.numId);c!==void 0&&!c.levels.has(s.level)&&c.levels.set(s.level,{kind:a,start:Yf(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},d=i;for(let c of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!Hi(c))continue;let u=Xe(c);if(u==="li")r.nodesLeft-=1,GS(c,t+1,l,r,o,d),d=false;else if(u==="ol"||u==="ul"){let p=o.length;XS(c,t+1,{...n,list:s},r,o,d),o.length>p&&(d=false);}}}function io(e,t,n,r,o,i=false,a,s=true){if(t>r.maxDepth)return;let l=o.length,d=a===void 0,c=[],u=[],p=n.para,m=a??{pending:false,skipSpacer:false},h=()=>({...p,pageBreakBefore:void 0,numPr:void 0}),b=()=>{if(c.length===0)return;if(!c.some(g=>g.includes("<w:r")||lp(g))){if(o.length===l){u=u.concat(c),c=[];return}let g=o[o.length-1];g?.endsWith("</w:p>")?(o[o.length-1]=`${g.slice(0,-6)}${c.join("")}</w:p>`,c=[]):g!==void 0&&c.length>0&&(o.push(jo(h(),c)),c=[],r.lastMarkCovered=false);return}let y=m.pending?{...p,pageBreakBefore:true}:p;o.push(jo(y,c)),p.pageBreakBefore&&(p={...p,pageBreakBefore:void 0}),m.pending=false,m.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered,c=[];};for(let y of e){if(r.nodesLeft<=0){r.truncated=true;break}if(Hi(y)){let g=Xe(y),x=g==="w:sdt"?ZS(y):null;if(s&&jS(y)){b(),r.nodesLeft-=1,m.pending&&vd(o),m.pending=true,m.skipSpacer=true;continue}if(up.has(g)&&!r.equations.has(y)){r.nodesLeft-=1;continue}let v=lt(y);if(v.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(oS(v)){b(),r.nodesLeft-=1,io(Array.from(y.childNodes),t+1,n,r,o,false,m,s);continue}if(r.definedNoteElements.has(y)){r.nodesLeft-=1;continue}if(fp.has(g)){if(b(),r.nodesLeft-=1,m.pending&&m.skipSpacer&&WS(y)){m.skipSpacer=false;continue}if(g==="div"&&mp(y)){let P=zS(y,n,r,false);P.para.pageBreakBefore&&(m.pending=true),io(Array.from(y.childNodes),t+1,P,r,o,false,m,s);continue}let k=o.length;GS(y,t,n,r,o,m.pending),o.length>k&&(m.pending=false,m.skipSpacer=false);continue}if(g==="ol"||g==="ul"){b();let k=o.length;XS(y,t,n,r,o,m.pending),o.length>k&&(m.pending=false,m.skipSpacer=false);continue}if(g==="table"){b(),m.pending&&vd(o),X1(y,t,n,r,o),m.pending=false,m.skipSpacer=false;continue}if(pp.has(g)||x!==null||g==="span"&&mp(y)){b(),r.nodesLeft-=1,io(x??Array.from(y.childNodes),t+1,n,r,o,false,m,s);continue}}if(y.nodeType===3&&/^[\s\u00a0]+$/.test(y.nodeValue??"")&&op(c)){r.nodesLeft-=1;continue}wd(y,t,n,c,r);}if(i&&o.length===l&&c.length>0&&!c.some(y=>y.includes("<w:r")||lp(y))&&(o.push(jo(p,c)),c=[],r.lastMarkCovered=n.paragraphMarkCovered),b(),u.length>0){let y=o[l];y!==void 0&&y.startsWith("<w:p>")?o[l]=y.replace(/^(<w:p>(?:<w:pPr>(?:(?!<\/w:pPr>)[\s\S])*?<\/w:pPr>)?)/,`$1${u.join("")}`):y!==void 0?o.splice(l,0,jo(h(),u)):c=u.concat(c),u=[];}c.length>0&&(o.push(jo(h(),c)),c=[],r.lastMarkCovered=false),d&&m.pending&&(vd(o),m.pending=false,m.skipSpacer=false,r.lastMarkCovered=false),i&&o.length===l&&(o.push(jo(p,c)),c=[],r.lastMarkCovered=n.paragraphMarkCovered);}function X1(e,t,n,r,o){$S(e,t,n,r,o,io);}function Y1(e,t){return lS({blocks:t,rels:e.rels,lists:[...e.lists.values()],notes:e.notes,noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function Q1(e,t){let n=t.maxHtmlBytes??Z1;if(e.length>n)return {ok:false,reason:"too-large"};if(e.length*3>n&&new TextEncoder().encode(e).byteLength>n)return {ok:false,reason:"too-large"};if(typeof DOMParser>"u")return {ok:false,reason:"parse-unavailable"};let r;try{r=new DOMParser().parseFromString(e,"text/html");}catch{return {ok:false,reason:"parse-unavailable"}}let o=r.body;if(!o)return {ok:false,reason:"no-content"};let i=t.maxNodes??U1,a=SS(e)?PS(r,i):null,s=nS(r),l={footnote:new Set,endnote:new Set},d=new Set,c={footnote:new Set,endnote:new Set};rS(r,s,c);let u={nodesLeft:i-(a?.visited??0),maxDepth:t.maxDepth??z1,maxImageBytes:t.maxImageBytes??G1,wordHtml:Lx(e),truncated:false,lastMarkCovered:false,rels:[],media:new Map,mediaExtensions:new Map,mediaBySrc:new Map,lists:new Map,listsByNumId:new Map,semanticListCount:0,imageCount:0,docPrId:0,nextBookmarkId:1,classAlignments:Hx(r),listDefinitions:Zx(_x(r)),notes:{footnote:new Map,endnote:new Map},noteRels:{footnote:[],endnote:[]},definedNotes:l,bodyNoteRefs:{footnote:new Set,endnote:new Set},noteNoteRefs:new Map,noteMarkFallbacks:new Map,definedNoteElements:d,equations:a?.byElement??new Map},p={};p=Ko(p,r.documentElement),p=Ko(p,o);let m={run:p,para:p.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},h=[];for(let v of s)c[v.kind].has(v.id)&&(l[v.kind].has(v.id)||(l[v.kind].add(v.id),d.add(v.element),h.push(v)));h.sort((v,k)=>cp(k.element)-cp(v.element)),u.lastMarkCovered=false;let b=[];io(Array.from(o.childNodes),0,m,u,b);let y=u.lastMarkCovered,g=u.truncated,x=false;for(let v=0;v<h.length;v+=1){let k=h[v];u.truncated=false;let P=u.nodesLeft,T=[];if(io(Array.from(k.element.childNodes),0,{...m,noteBody:{kind:k.kind,id:k.id},rels:u.noteRels[k.kind]},u,T,true),u.truncated||T.length===0){x=true;let C=new Set;for(let E=v;E<h.length;E+=1){let w=h[E];l[w.kind].delete(w.id),d.delete(w.element),u.notes[w.kind].delete(w.id),u.bodyNoteRefs[w.kind].delete(w.id),C.add(`${w.kind}:${w.id}`);}if(C.size>0){for(let E=0;E<b.length;E+=1)b[E]=_i(b[E],C,u.noteMarkFallbacks);for(let E of ["footnote","endnote"])for(let[w,I]of u.notes[E])u.notes[E].set(w,I.map(L=>_i(L,C,u.noteMarkFallbacks)));}u.nodesLeft=P;for(let E=v;E<h.length&&u.nodesLeft>0;E+=1)io(Array.from(h[E].element.childNodes),0,m,u,b);break}u.notes[k.kind].set(k.id,T);}return u.truncated=g||x,u.lastMarkCovered=y,iS(u,l,b,gp),b.length===0?{ok:false,reason:"no-content"}:{ok:true,projection:u,blocks:b}}var J1=eS();function YS(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return J1(e,n,()=>Q1(e,t))}function QS(e,t={}){let n=YS(e,t);return n.ok?{ok:true,fragmentBytes:Y1(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function JS(e,t={}){let n=YS(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var eL={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function ew(e){return e.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(t,n)=>{if(n.startsWith("#")){let r=n.startsWith("#x")?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return !Number.isFinite(r)||r<0||r>1114111||r>=55296&&r<=57343?t:String.fromCodePoint(r)}return eL[n.toLowerCase()]??t})}var tL=new Set(["script","style","title","template"]),nL=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),rL=new Set(["td","th"]),tw=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),oL=e=>tw(e)||e!==void 0&&e>="0"&&e<="9",nw=e=>e===" "||e===" "||e===`
6
- `||e==="\r"||e==="\f";function iL(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!tw(e[n]))return null;let o=n;for(;n<e.length&&oL(e[n]);)n+=1;let i=e.slice(o,n).toLowerCase(),a="",s=false;for(;n<e.length;){let l=e[n];if(a!=="")l===a&&(a="");else if(l==="=")s=true;else if(s&&(l==='"'||l==="'"))a=l,s=false;else {if(l===">")return {name:i,closing:r,end:n+1};nw(l)||(s=false);}n+=1;}return {name:i,closing:r,end:e.length}}function aL(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===9;)t-=1;return t===e.length?e:e.slice(0,t)}function sL(e,t,n){for(let r=n;r<e.length;){let o=e.indexOf("</",r);if(o===-1)return e.length;let i=o+2;if(e.slice(i,i+t.length).toLowerCase()===t){for(i+=t.length;i<e.length&&nw(e[i]);)i+=1;if(e[i]===">")return i+1}r=o+2;}return e.length}function*rw(e){let t=0;for(;t<e.length;){let n=e.indexOf("<",t);if(n===-1){yield e.slice(t);break}if(n>t&&(yield e.slice(t,n)),e.startsWith("<!--",n)){if(e[n+4]===">"){t=n+5;continue}if(e[n+4]==="-"&&e[n+5]===">"){t=n+6;continue}let o=e.indexOf("-->",n+4);t=o===-1?e.length:o+3;continue}if(e[n+1]==="!"||e[n+1]==="?"){let o=e.indexOf(">",n+1);t=o===-1?e.length:o+1;continue}let r=iL(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&tL.has(r.name)?t=sL(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
7
- `:r.closing&&rL.has(r.name)?yield " ":r.closing&&nL.has(r.name)&&(yield `
8
- `);}}function lL(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of rw(t))n+=r;return ew(n).replace(/\r\n?/g,`
9
- `).split(`
10
- `).map(aL).join(`
11
- `).replace(/\n{3,}/g,`
12
-
13
- `).trim()}function ow(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===12){t+=`
14
- `;continue}if(r===13){t+=`
15
- `,e.charCodeAt(n+1)===10&&(n+=1);continue}if(r===9||r===10){t+=e[n];continue}if(!(r<32||r===65534||r===65535)){if(r>=55296&&r<=56319){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(t+=e[n]+e[n+1],n+=1);continue}r>=56320&&r<=57343||(t+=e[n]);}}return t}var iw=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function aw(e){return iw.test(e)}function hp(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of rw(t)){let r=n.includes("&")?ew(n):n;if(iw.test(r))return true}return false}function yp(e){if(!e)return "";let t=e.getData("text/plain");if(t.length>0)return t;let n=e.getData("text/html");return n.length>0?lL(n):""}function bp(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function dL(e){if(!e)return false;if(aw(bp(e,"text/plain")))return true;let t=bp(e,"text/html");if(t.length===0)return false;if(hp(t))return true;let n=Di(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:JS(t).imageCount>0}function cL(e){return e?hp(bp(e,"text/html")):false}var uL=Object.freeze({kind:"body"});function Fe(e,t){let n=t?.indexOf("#")??-1;if(n===-1)return null;let r=t.slice(0,n);return r.length===0?null:e.currentPackage().parts.get(r)??null}function Rt(e,t,n){let r=t?.indexOf("#")??-1,o=r===-1?"":t.slice(0,r);if(o.length===0||o===e.part().name)return {kind:"body"};for(let i of e.headerFooterResolutionBySection())for(let a of [i.headers,i.footers])for(let s of a.values())if(s.partName===o)return {kind:"headerFooter",rId:s.rId};for(let i of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:i})?.name===o)return {kind:"notesPart",noteKind:i};return n}function Id(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=pc$1(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function lw(e,t){return e?e.scope:t||uL}function fL(e,t,n){if(n){let o=[];for(let i of [e.footnotes,e.endnotes])if(i)for(let a of i.notes)a.scopeId===n&&o.push(...sw(a.fragments));return o}if(!t)return xa(e);let r=Bi(e,t);return r?sw(r.fragments):[]}function Bi(e,t){let n=t.kind==="header"?e.header:e.footer;if(n&&(n.rId&&n.rId===t.scope.rId||!n.rId&&n.partName===t.partName))return n}function dw(e,t){for(let n of e.pages)for(let r of ["header","footer"]){let o=n[r];if(o?.rId===t)return {pageIndex:n.index,kind:r,story:o}}return null}function kd(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function vp(e,t,n){let r=Yd$1(e,t.y),o=e.pages[r];if(!o)return false;let i=t.x-n(r),a=t.y,s=o.contentBox;return i>=s.x&&i<s.x+s.width&&a>=s.y&&a<s.y+s.height}function xp(e,t,n,r,o={}){return ae(e,t,n.fragments,r,o)}function pL(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=Bi(r,t);return o?ne(e,t.pageIndex,o.fragments,n):null}function mL(e,t,n){let r=[];for(let o of e.pages)for(let i of [o.footnotes,o.endnotes]){let a=i?.notes.find(s=>s.scopeId===t);a&&r.push(...ne(e,o.index,a.fragments,n));}return r.length>0?r:null}function cw(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function uw(e,t,n){let r=e.querySelectorAll("[data-docx-note-scope]"),o=null;for(let i of r){if(i.dataset.docxNoteScope!==t||!i.matches("[data-docx-note]"))continue;o??=i;let a=Number(i.closest("[data-page-index]")?.dataset.pageIndex);if(n!==null&&a===n)return i}return o}function fw(e,t,n){if((i=>{let a=e.pages[i];return !!a&&!!Bi(a,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let i of e.pages)if(Bi(i,t)&&(o===null&&(o=i.index),n===void 0||n.has(i.index)))return i.index;return o??t.pageIndex}function pw(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function mw(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Sp(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function wp(e,t,n,r,o,i,a,s){let l=o?pL(e,o,a):i?mL(e,i,a):null,d=se(e,t,n,r,{...a?{measurer:a}:{},...l?{stops:l}:{},...s!==void 0?{lineId:s}:{}});if(!d)return null;let u=(l?.find(m=>m.position.paragraphId===d.position.paragraphId&&m.position.offset===d.position.offset&&(d.lineId===void 0||m.lineId===d.lineId))??l?.find(m=>m.position.paragraphId===d.position.paragraphId&&m.position.offset===d.position.offset))?.pageIndex,p=d.lineId===void 0?null:oe(e,d.position,{...a?{measurer:a}:{},...u!==void 0?{preferredPageIndex:u}:{},preferredLineId:d.lineId});return {position:d.position,desiredX:d.desiredX,...u!==void 0?{pageIndex:u}:{},...p?{caret:p}:{}}}function Rd(e,t,n){for(let r of e.pages){let o=n(r.index);for(let i of [r.footnotes,r.endnotes])if(i)for(let a of i.notes){let s=a.box,l=s.x+o,d=s.y;if(t.x>=l&&t.x<l+s.width&&t.y>=d&&t.y<d+s.height)return {pageIndex:r.index,scopeId:a.scopeId,noteKind:a.noteKind,noteId:a.noteId,local:{x:t.x-l,y:t.y-d},fragments:a.fragments}}}return null}function gw(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let d=o.y,c=r.y,u=n?Math.max(c,n.box.y+n.box.height):c,p=n?Math.min(d,n.box.y):d;return u<=p?null:{x:r.x,y:p,width:r.width,height:u-p}}let i=r.y+r.height,a=o.y+o.height,s=n?Math.min(i,n.box.y):i,l=n?Math.max(a,n.box.y+n.box.height):a;return l<=s?null:{x:r.x,y:s,width:r.width,height:l-s}}function Ip(e,t,n){for(let r of e.pages){if(r.parityBlank)continue;let o=n(r.index);for(let i of ["header","footer"]){if(r[i])continue;let a=gw(r,i);if(!a)continue;let s=a.x+o;if(t.x>=s&&t.x<s+a.width&&t.y>=a.y&&t.y<a.y+a.height)return {pageIndex:r.index,kind:i}}}return null}function kp(e,t,n){for(let r of e.pages){let o=n(r.index);for(let i of ["header","footer"]){let a=r[i];if(!a)continue;let s=a.box,l=gw(r,i)??s,d=l.x+o,c=l.y;if(t.x>=d&&t.x<d+l.width&&t.y>=c&&t.y<c+l.height)return {pageIndex:r.index,kind:i,story:a,local:{x:t.x-(s.x+o),y:t.y-s.y}}}}return null}function hw(e,t,n,r,o,i){let a=e.pages[t.pageIndex];if(!a)return false;let s=a.contentBox,l=n.x-r(a.index)-s.x,d=n.y-s.y;if(l<0||l>=s.width||d<0||d>=s.height)return false;let c=i?{measurer:i}:{},{story:u,local:p}=t,m=_d$1(u.anchoredDrawings,p,a.index)!==null||ae(e,a.index,u.fragments,p,c)?.onGlyphs===true;if(o&&m)return false;let h=$d$1(e,a.index,{x:l,y:d},c),b=Rd(e,n,r),y=h?.onGlyphs===true&&h.pageIndex===a.index||b?.pageIndex===a.index&&ae(e,a.index,b.fragments,b.local,c)?.onGlyphs===true;return o?y:y||!m}function $i(e,t,n){if(!t&&!n)return Ra(e);let r=new Set,o=[];for(let i of e.pages)for(let a of fL(i,t,n)){for(let s of a.lines)for(let l of Ma(s))r.has(l.paragraphId)||(r.add(l.paragraphId),o.push(l.paragraphId));a.lines.length===0&&!r.has(a.paragraphId)&&(r.add(a.paragraphId),o.push(a.paragraphId));}return o}function Pd(e,t,n,r){let o=$i(e,n,r);if(o.length===0)return t;let i=new Set(o),a=s=>i.has(s.paragraphId)?s:{paragraphId:o[0],offset:0};return {anchor:a(t.anchor),head:a(t.head)}}function sw(e){let t=[],n=r=>{for(let o of r){if(o.kind==="paragraph"){t.push(o);continue}for(let i of o.rows)if(!i.isHeaderRepeat)for(let a of i.cells)n(a.blocks);}};return n(e),t}function yw(e){return e.family.trim().length===0?"font family must not be empty":!Number.isInteger(e.weight)||e.weight<1||e.weight>1e3?"font weight must be an integer from 1 through 1000":e.style!=="normal"&&e.style!=="italic"?"font style must be normal or italic":null}function gL(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function hL(e,t){if(!e)return null;try{let n=await e.match(t);return n?new Uint8Array(await n.arrayBuffer()):null}catch{return null}}async function yL(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function bL(e,t){if(e)try{await e.delete(t);}catch{}}async function Rp(e){let t=()=>{if(e.signal?.aborted)throw e.signal.reason};t();let n=e.fetcher??fetch,r=e.maxFontBytes??a$1,o=await gL(e.cacheName??"docx-editor-fonts");t();async function i(d){t();let c=Object.freeze({family:d.family,weight:d.weight,style:d.style}),u=yw(c);if(u)return {failure:{url:d.url,request:c,reason:"invalidRequest",diagnostic:u}};let p=(g,x)=>{if(g.byteLength===0)return {url:d.url,request:c,reason:"emptyResponse"};if(g.byteLength>r)return {url:d.url,request:c,reason:"overLimit"};let v=l(g,d.faceIndex??0);if(!v.valid)return {url:d.url,request:c,reason:"malformed",diagnostic:v.diagnostic};let k=f(g);return d.hash!==void 0&&d.hash!==k?{url:d.url,request:c,reason:"hashMismatch",expectedHash:d.hash,actualHash:k,...x?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:c,id:`url:${d.url}`,bytes:g,hash:k,faceIndex:d.faceIndex??0}},m=await hL(o,d.url);if(t(),m){let g=p(m,true);if(!("reason"in g))return {source:g};await bL(o,d.url),t();}let h;try{h=e.signal?await n(d.url,{signal:e.signal}):await n(d.url),t();}catch(g){return t(),{failure:{url:d.url,request:c,reason:"networkError",diagnostic:g instanceof Error?g.message:String(g)}}}if(!h.ok)return {failure:{url:d.url,request:c,reason:"httpError",status:h.status}};let b;try{b=new Uint8Array(await h.arrayBuffer()),t();}catch(g){return t(),{failure:{url:d.url,request:c,reason:"networkError",diagnostic:g instanceof Error?g.message:String(g)}}}let y=p(b,false);return "reason"in y?{failure:y}:(await yL(o,d.url,b),t(),{source:y})}let a=await Promise.all(e.sources.map(d=>i(d)));t();let s=[],l$1=[];for(let d of a)"source"in d?s.push(d.source):l$1.push(d.failure);return {sources:s,failures:l$1}}function vL(e,t,n={}){let r=Object.freeze({family:t.family,weight:t.weight,style:t.style}),o=n.id??`bytes:${r.family}#${r.weight}#${r.style}`,i=yw(r);if(i)return {failure:{url:o,request:r,reason:"invalidRequest",diagnostic:i}};if(e.byteLength===0)return {failure:{url:o,request:r,reason:"emptyResponse"}};if(e.byteLength>(n.maxFontBytes??a$1))return {failure:{url:o,request:r,reason:"overLimit"}};let a=t.faceIndex??0,s=l(e,a);return s.valid?{source:{request:r,id:o,bytes:e,hash:f(e),faceIndex:a}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:s.diagnostic}}}var xL=e=>e.trim().toLowerCase(),bw=e=>JSON.stringify([xL(e.family),e.weight,e.style]);function SL(e){return j(async t=>{if(t.signal?.aborted)throw t.signal.reason;let n=new Set((t.resolvedFaces??[]).map(bw)),r=e.sources.filter(s=>!n.has(bw(s)));if(r.length===0)return {sources:[],failures:[]};let{onFailure:o,...i}=e,a=await Rp({...i,sources:r,signal:t.signal});if(t.signal?.aborted)throw t.signal.reason;for(let s of a.failures)o?o(s):console.warn(`[fonts] ${s.request.family} (${s.url}): ${s.reason}`);return a})}var wL=96,vw=37.79527559055118;function IL(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let a=Math.floor(e/12);for(let s=0;s<=a;s+=1){let l=s*12;if(s%8===0){let d=s/8;n.push({position:l,height:10,...d>0?{label:String(d)}:{}});}else s%4===0?n.push({position:l,height:6}):s%2===0?n.push({position:l,height:4}):n.push({position:l,height:2});}return n}let r=vw/10,o=Math.floor(e/r);for(let i=0;i<=o;i+=1){let a=i*r;if(i%10===0){let s=i/10;n.push({position:a,height:10,...s>0?{label:String(s)}:{}});}else i%5===0?n.push({position:a,height:6}):n.push({position:a,height:3});}return n}function kL(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var RL=1440,PL=567,TL=180,CL=56.7,xw=e=>({pageWidth:e.pageWidth,leftMargin:e.rightMargin,rightMargin:e.leftMargin}),Td=(e,t,n)=>n<t||e<t?t:e>n?n:e;function Sw(e,t,n){if(t.rtl)return n.pageWidth-Sw(e,{...t,rtl:false},xw(n));switch(e){case "firstLine":return n.leftMargin+t.left+t.firstLine;case "hanging":case "left":return n.leftMargin+t.left;case "right":return n.pageWidth-n.rightMargin-t.right}}function ww(e,t,n){if(n)return Math.round(e);let r=t==="cm"?56.7:180;return Math.round(Math.round(e/r)*r)}function Iw(e,t,n,r,o={}){if(n.rtl)return {...Iw(e,r.pageWidth-t,{...n,rtl:false},xw(r),o),rtl:true};let i=ww(t,o.unit??"inch",o.precise??false),a=r.pageWidth-r.rightMargin-n.right,s=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let l=Td(i,0,a);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),d=a-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:Td(i-r.leftMargin,l,d)}}case "hanging":{let l=Td(i-r.leftMargin,-r.leftMargin,a-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=Td(i,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}function kw(e,t){let n=e.snapshot().formatting;if(n)switch(t){case "text.color":return n.color?.kind==="hex"?n.color.value.replace(/^#/,""):void 0;case "text.highlight":return n.highlight;case "styles.style":return n.styleId;case "font.family":return n.fontFamily;case "font.size":return n.fontSizePt===void 0?void 0:String(n.fontSizePt*2);case "list.lineSpacing":return n.lineSpacing?.rule==="multiple"?String(n.lineSpacing.value):void 0;default:return}}function EL(e){if(!(!e||typeof e!="object"||"preventDefault"in e))return e}var Rw="no formatting has been copied",Cd="there is nothing at the selection to copy",Pp="the selection has nothing to paint",Ed=Object.freeze({mode:"off",level:"none"});function Pw(e,t){let n=Math.round(t*12700),r=1143e3,o=`<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r>
16
- <w:drawing xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
17
- <wp:anchor distT="0" distB="0" distL="91440" distR="91440" simplePos="0" relativeHeight="251658240" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1">
18
- <wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>
19
- <wp:extent cx="${n}" cy="${r}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${e}" name="Text Box ${e}"/><wp:cNvGraphicFramePr/>
20
- <a:graphic><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${n}" cy="${r}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill><a:ln w="12700"><a:solidFill><a:srgbClr val="000000"/></a:solidFill></a:ln></wps:spPr><wps:txbx><w:txbxContent><w:p/></w:txbxContent></wps:txbx><wps:bodyPr lIns="91440" rIns="91440" tIns="45720" bIns="45720" anchor="t"><a:noAutofit/></wps:bodyPr></wps:wsp></a:graphicData></a:graphic>
21
- </wp:anchor></w:drawing></w:r></w:p></w:body></w:document>`,i=Ia(o,{name:"/word/document.xml",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"});if(!i.ok)throw new Error("Cannot build textbox drawing");let a=l=>{if(l.kind==="drawing")return l;if(l.kind==="textValue")return null;for(let d of l.children){let c=a(d);if(c)return c}return null},s=a(i.part.root);if(!s)throw new Error("Textbox drawing is missing");return s}function Tp(e){let t=e.activeScope();if(e.editingMode()!=="edit"||t.kind!=="body"&&t.kind!=="frame")return {ok:false,code:"unsupported",reason:"Textboxes can only be inserted in body editing mode"};let n=t.kind==="frame"?t.hostParagraphId:e.state().selection.head.paragraphId;return e.layout().pages.some(r=>r.fragments.some(o=>o.kind==="paragraph"&&o.paragraphId===n))?null:{ok:false,code:"unsupported",reason:"Select a body paragraph outside a table to insert a textbox"}}function Tw(e){let t=Tp(e);if(t)return t;let n=e.activeScope(),r=n.kind==="frame"?n.hostParagraphId:e.state().selection.head.paragraphId,o=e.session.part(),i=Ta(o,r);if(!i||i.kind!=="paragraph")return {ok:false,code:"notFound",reason:"Textbox anchor is missing"};let a=pe$1(e.session.currentPackage(),e.collaborationSession()?.identity.actorId);if(!a.ok)return {ok:false,code:"invalidArgs",reason:"Cannot allocate textbox identity"};let s=new Set(mi(o).map(m=>m.root.id)),l=e.layout().pages.flatMap(m=>m.fragments).find(m=>m.kind==="paragraph"&&m.paragraphId===r),d=Math.min(300,l?.box.width??300);n.kind==="frame"&&e.setActiveScope({kind:"body"});let c=lg$1(i);e.setSelection({anchor:{paragraphId:r,offset:c},head:{paragraphId:r,offset:c}});let u=e.applyDrawingOps([{op:"insertDrawing",paragraphId:r,offset:c,drawing:Pw(a.id,d)}]);if(u.rejected)return {ok:false,code:"invalidArgs",reason:u.reason??"Textbox insertion was refused"};let p=mi(e.session.part()).find(m=>!s.has(m.root.id));return p&&e.setActiveScope({kind:"frame",id:p.root.id,drawingNodeId:p.drawingNodeId,hostParagraphId:p.hostParagraphId}),e.focus(),{ok:true,changed:u.committed}}var Cp=new WeakMap;function Dr(e){let t=Cp.get(e);if(t)return t;let n=Rf(e);if(n.length===0)return Cp.set(e,[]),[];let r=[];for(let o of n){let i=Qf$1(o);for(let a of new Set([o.beginParagraphId,...o.resultParagraphIds,o.endParagraphId])){let s=Ta(e,a);if(s?.kind!=="paragraph")continue;let l=jg$1(s),d=a===o.beginParagraphId,c=a===o.endParagraphId;r.push({toc:o,paragraphId:a,length:l.length,startsHere:d,endsHere:c,start:d?l.spanOf(o.beginNodeId)?.start??0:0,end:c&&i?l.spanOf(i.endNodeId)?.end??l.length:l.length});}}return Cp.set(e,r),r}function Od(e){return new Set(Dr(e).filter(t=>t.start===0&&t.end===t.length&&!(t.endsHere&&!t.startsHere&&t.end===0)).map(t=>t.paragraphId))}function Ep(e,t){return e.endsHere&&!e.startsHere&&e.end===0||e.startsHere&&e.start>0&&t<=e.start||e.endsHere&&e.end<e.length&&t>=e.end?false:t>=e.start&&t<=e.end}function wn(e,t){return Dr(e).find(n=>n.paragraphId===t.paragraphId&&Ep(n,t.offset))?.toc}function Cw(e,t){let{anchor:n,head:r}=t;if(n.paragraphId===r.paragraphId){let o=Math.min(n.offset,r.offset),i=Math.max(n.offset,r.offset);return Dr(e).some(a=>a.paragraphId===n.paragraphId&&(o===i?Ep(a,o):o<a.end&&i>a.start))}return wn(e,n)!==void 0||wn(e,r)!==void 0}function Ew(e,t){let n=Dr(e);if(n.length===0)return false;let r=pk$1(t);if(r.kind==="nodes")return r.targets.some(a=>n.some(s=>{if(a.nodeId!==s.paragraphId)return false;if(a.range){let{start:l,end:d}=a.range;return l===d?Ep(s,l):l<s.end&&d>s.start}return t.op==="joinParagraphs"&&t.firstId===s.paragraphId&&s.endsHere&&s.end===0?false:a.removes||a.structural?true:s.end>s.start||s.length===0&&!s.endsHere}));let o=new Set(n.map(a=>a.paragraphId)),i=(a,s="")=>typeof a=="string"?/(?:Id|Ids)$/.test(s)&&o.has(a):Array.isArray(a)?a.some(l=>i(l,s)):!!a&&typeof a=="object"&&Object.entries(a).some(([l,d])=>i(d,l));return i(t)}function Ow(e,t,n){let r=wn(e,t);if(!r)return null;let o=Dr(e).find(i=>i.toc.id===r.id&&(n?i.startsHere&&i.start>0:i.endsHere&&i.end<i.length));return o?{paragraphId:o.paragraphId,offset:n?o.start:o.end}:null}function Mw(e,t){return !Dr(t).some(r=>r.toc.id===e.id&&(r.start>0||r.end<r.length))&&e.contentControlId?e.contentControlId:`toc:${e.id}`}function Aw(e,t,n){if(!t)return;let r=n?.closest("[data-start]");return Dr(e).find(o=>o.paragraphId===t&&(r?Number(r.dataset.start)<o.end&&Number(r.dataset.end)>o.start:Od(e).has(t)))?.toc}var vs=/^[0-9A-Fa-f]{6}$/,Fw={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folhlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedhyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"},OL={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"};function Op(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function Md(e){return Math.max(0,Math.min(1,e))}function Lw(e){let t=e.replace(/^#/,"").padStart(6,"0").slice(0,6);return {r:parseInt(t.slice(0,2),16)||0,g:parseInt(t.slice(2,4),16)||0,b:parseInt(t.slice(4,6),16)||0}}function Nw(e,t,n){let r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return `${r(e)}${r(t)}${r(n)}`.toUpperCase()}function Dw(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-Md(t))*255)))/255,o=Lw(e);return Nw(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Hw(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(Md(t)*255)))/255,o=Lw(e);return Nw(r*o.r,r*o.g,r*o.b)}function Mp(e){return Fw[e]??Fw[e.toLowerCase()]??null}function ML(e,t){let n=Mp(e);if(!n)return null;let r=t.find(i=>i.slot===n)?.hex;if(r&&vs.test(r))return r.toUpperCase();let o=OL[n];return o&&vs.test(o)?o.toUpperCase():null}function Ad(e,t){let n=ML(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Op(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Op(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=Dw(r,Md(e.tint)):e.shade!==void 0&&(r=Hw(r,Md(e.shade))),{ok:true,hex:r}}var AL="000000";function Ap(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return vs.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"border colour requires a six-digit hex value"}}if(e.kind==="auto")return {ok:true,color:{kind:"auto",resolvedHex:AL}};let n=Ad(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Mp(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Fp(e,t){if(e.kind==="auto")return {ok:false,reason:"automatic fill cannot be written without a resolved colour"};if(e.kind==="hex"){let o=e.value.toUpperCase();return vs.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=Ad(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Mp(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function FL(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return vs.test(o)?`#${o}`:`#${n}`}let r=Ad(e,t);return `#${r.ok?r.hex:n}`}function Lp(e,t){return Pe(e).occurrences.some(n=>n.table.tableId===t&&n.row.cells.some(r=>r.logicalGridColumn!==void 0))}function _w(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var HL=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function ao(e){return HL.has(e.type)}function ye(e,t){return {ok:false,code:e,reason:t}}function Np(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return ye("invalidArgs","the table target is no longer valid");case "table-has-merge":return ye("unsupported","this table has merged cells");case "row-hides-cell":return ye("unsupported","this table has a cell the editor cannot place in the grid");case "block-required":return ye("unsupported","the table must keep at least one row or column");case "resource-limit":return ye("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return ye("invalidArgs","the table command arguments are invalid");default:return ye("unsupported",`the table operation was refused (${e})`)}}function _t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pn(e,t){return !_t(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function Vw(e){if(!_t(e))return false;let t=e.kind;if(t==="hex")return pn(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return pn(e,["kind"]);if(t==="theme"){if(typeof e.slot!="string")return false;let n=["kind","slot"];if(e.tint!==void 0){if(typeof e.tint!="number"||!Number.isFinite(e.tint))return false;n.push("tint");}if(e.shade!==void 0){if(typeof e.shade!="number"||!Number.isFinite(e.shade))return false;n.push("shade");}return pn(e,n)}return false}function Kw(e){return _t(e)&&pn(e,["sourceRevision","tableId","rowId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&e.tableId.length>0&&typeof e.rowId=="string"&&e.rowId.length>0&&typeof e.isHeaderRepeat=="boolean"}function jw(e){return _t(e)&&pn(e,["sourceRevision","tableId","gridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&e.tableId.length>0&&typeof e.gridColumnId=="string"&&e.gridColumnId.length>0&&typeof e.isHeaderRepeat=="boolean"}function _L(e){return _t(e)&&pn(e,["sourceRevision","tableId","leftGridColumnId","rightGridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&typeof e.leftGridColumnId=="string"&&typeof e.rightGridColumnId=="string"&&typeof e.isHeaderRepeat=="boolean"}function BL(e){return _t(e)&&pn(e,["sourceRevision","tableId","gridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&typeof e.gridColumnId=="string"&&typeof e.isHeaderRepeat=="boolean"}function $L(e){return !_t(e)||!pn(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&Vw(e.color)}function Bw(e){return !("target"in e)||e.target===void 0||Kw(e.target)}function $w(e){return !("target"in e)||e.target===void 0||jw(e.target)}function qL(e){switch(e.type){case "insertRow":return !_t(e)||e.type!=="insertRow"?ye("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?ye("invalidArgs","insertRow where must be above or below"):Bw(e)?null:ye("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !_t(e)||e.type!=="deleteRow"?ye("invalidArgs","deleteRow command shape is invalid"):Bw(e)?null:ye("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !_t(e)||e.type!=="insertColumn"?ye("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?ye("invalidArgs","insertColumn where must be left or right"):$w(e)?null:ye("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !_t(e)||e.type!=="deleteColumn"?ye("invalidArgs","deleteColumn command shape is invalid"):$w(e)?null:ye("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !_t(e)||!pn(e,["type"])?ye("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !_t(e)||!pn(e,["type","color"])?ye("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!Vw(e.color)?ye("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !_t(e)||!pn(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?ye("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !_t(e)||e.type!=="setTableBorders"?ye("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?ye("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!$L(e.spec)?ye("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !_t(e)||!pn(e,["type","target","leftWidthTwips","rightWidthTwips"])||!_L(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?ye("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !_t(e)||!pn(e,["type","target","columnWidthTwips","tableWidthTwips"])||!BL(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?ye("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function VL(e){return !("target"in e)||e.target===void 0?null:Kw(e.target)?e.target:null}function KL(e){return !("target"in e)||e.target===void 0?null:jw(e.target)?e.target:null}function jL(e,t){let n=aj(e.root,t.tableId);if(!n.ok)return {rowIds:[t.rowId],wholeTable:false};let r=new Set(t.cellIds),o=n.topology.rows.filter(i=>i.cells.some(a=>r.has(a.id))).map(i=>i.row.id);return o.length===0?{rowIds:[t.rowId],wholeTable:false}:{rowIds:o,wholeTable:o.length===n.topology.rows.length}}function WL(e,t){let n=aj(e.root,t.tableId);if(!n.ok||!n.topology.grid)return {gridColumnIds:[],wholeTable:false};let r=new Set(t.cellIds),o=new Set;for(let i of n.topology.rows){let a=0;for(let s of i.cells){let l=Ww(s);if(r.has(s.id))for(let d=0;d<l;d+=1){let c=n.topology.gridColumns[a+d];c&&o.add(c.id);}a+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function qw(e,t,n){let r=aj(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function ZL(e){let t=la$1(e.layout,e.selection.head.paragraphId,e.cellSelection);return t?{tableId:t.tableId,rowId:t.rowId,cellId:t.cellId,cellIds:[...t.cellIds],gridColumnIndex:t.gridColumnIndex,isHeaderRepeat:t.isHeaderRepeat}:null}function Ww(e){let t=Zi(e,"tcPr"),n=t&&Zi(t,"gridSpan"),r=n&&_i$1(n,"val");if(!r||!/^\d{1,7}$/.test(r))return 1;let o=Number(r);return Number.isInteger(o)&&o>1?Math.min(o,1024):1}function UL(e,t,n){let r=e.gridColumns.findIndex(o=>o.id===n);if(r===-1)return null;for(let{row:o,cells:i}of e.rows){let a=0;for(let s of i){let l=Ww(s);if(r>=a&&r<a+l)return {tableId:t,rowId:o.id,cellId:s.id,cellIds:[s.id],gridColumnIndex:r,isHeaderRepeat:false};a+=l;}}return null}function zL(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=aj(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(a=>a.row.id===t.rowId);if(r===-1)return null;let i=n.topology.rows[r].cells[0];return i?{tableId:t.tableId,rowId:t.rowId,cellId:i.id,cellIds:[i.id],gridColumnIndex:0,isHeaderRepeat:false}:null}function GL(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=aj(e.part.root,t.tableId);return n.ok?UL(n.topology,t.tableId,t.gridColumnId):null}function XL(e,t){for(let n of t){let r=Yk$1(e,n);if(r)return Np(r)}return null}function fn(e,t,n){let r=XL(e,t);return r||{ok:true,ops:t,selection:n}}function YL(e,t){if(!Ek$1.includes(e.style))return {ok:false,reason:"border style is not allowlisted"};if(!Number.isInteger(e.size)||e.size<1)return {ok:false,reason:"border size is out of range"};if(e.size>96)return {ok:false,reason:"border size is out of range"};let n=Ap(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function xs(e,t,n){return n!==e.storeRevision?ye("invalidArgs","the table target is stale"):aj(e.part.root,t).ok?null:ye("invalidArgs","the table target is no longer valid")}function QL(e){return e?.isHeaderRepeat?ye("unsupported","repeated header rows cannot be edited"):null}function JL(e,t,n,r){let o=xs(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return ye("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return ye("invalidArgs","column widths must be whole twips");if(n<300||r<300)return ye("invalidArgs","column widths are below the minimum");let i=aj(e.part.root,t.tableId);if(!i.ok){let u=i.reason==="duplicate-node-id"?"unknown-table":i.reason;return Np(u)}let a=i.topology.gridColumns.find(u=>u.id===t.leftGridColumnId),s=i.topology.gridColumns.find(u=>u.id===t.rightGridColumnId);if(!a||!s)return ye("invalidArgs","the table target is no longer valid");let l=i.topology.gridColumns.indexOf(a),d=i.topology.gridColumns.indexOf(s);if(Math.abs(d-l)!==1)return ye("invalidArgs","the column divider target is not adjacent");let c={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:l<d?t.leftGridColumnId:t.rightGridColumnId,rightGridColumnId:l<d?t.rightGridColumnId:t.leftGridColumnId,leftWidthTwips:l<d?n:r,rightWidthTwips:l<d?r:n};return fn(e.part,[c],{kind:"preserveSelection"})}function eN(e,t,n,r){let o=xs(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return ye("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return ye("invalidArgs","column widths must be whole twips");if(n<300)return ye("invalidArgs","column widths are below the minimum");let i=aj(e.part.root,t.tableId);if(!i.ok){let l=i.reason==="duplicate-node-id"?"unknown-table":i.reason;return Np(l)}let a=i.topology.gridColumns[i.topology.gridColumns.length-1];if(!a||a.id!==t.gridColumnId)return ye("invalidArgs","the resize target is not the table right edge");let s={op:"setTableRightEdgeWidth",tableId:t.tableId,gridColumnId:t.gridColumnId,columnWidthTwips:n,tableWidthTwips:r};return fn(e.part,[s],{kind:"preserveSelection"})}function Zw(e,t,n){if(e.viewing||!e.editable)return ye("locked","the document is open for viewing");let r=xs(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return ye("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return ye("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return fn(e.part,[o],{kind:"preserveSelection"})}function Hr(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return ye("locked","the document is open for viewing");switch(t.type){case "mergeCells":return ye("unsupported","cell merge is not supported yet");case "splitCell":return ye("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return ye("unsupported",`command '${t.type}' is not supported by the tree editor`);}let i=qL(t);if(i)return i;let a=VL(t),s=KL(t),l=QL(a??s);if(l)return l;if(a){let c=xs(e,a.tableId,a.sourceRevision);if(c)return c}if(s){let c=xs(e,s.tableId,s.sourceRevision);if(c)return c}let d=a!==null?zL(e,a):s!==null?GL(e,s):ZL(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!d)return a||s?ye("invalidArgs","the table target is no longer valid"):ye("unsupported","the selection is not inside a table");if(d?.isHeaderRepeat)return ye("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!d)return ye("unsupported","the selection is not inside a table");let c={op:"insertTableRow",tableId:d.tableId,rowId:d.rowId,where:t.where};return fn(n,[c],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!d)return ye("unsupported","the selection is not inside a table");let c=jL(n,d),u=c.wholeTable?[{op:"deleteBlock",blockId:d.tableId}]:c.rowIds.map(p=>({op:"deleteTableRow",tableId:d.tableId,rowId:p,...p===d.rowId?{referenceCellId:d.cellId}:{}}));return fn(n,u,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!d)return ye("unsupported","the selection is not inside a table");let c=s?.tableId??d.tableId,u=s?.gridColumnId??qw(n,c,d.gridColumnIndex),p=Lp(e.layout,c)?t.where==="left"?"right":"left":t.where,m=u?{op:"insertTableColumn",tableId:c,where:p,gridColumnId:u}:{op:"insertTableColumn",tableId:c,where:p,referenceCellId:d.cellId};return fn(n,[m],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!d)return ye("unsupported","the selection is not inside a table");let c=s?.tableId??d.tableId,u=s?.gridColumnId??qw(n,c,d.gridColumnIndex);if(!u)return ye("invalidArgs","the table has no grid column to delete");let p=s?.gridColumnId===void 0?WL(n,d):{gridColumnIds:[u],wholeTable:false};if(p.wholeTable)return fn(n,[{op:"deleteBlock",blockId:c}],{kind:"adoptCommittedCaret"});let h=(p.gridColumnIds.length>0?p.gridColumnIds:[u]).map(b=>({op:"deleteTableColumn",tableId:c,gridColumnId:b}));return fn(n,h,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!d)return ye("unsupported","the selection is not inside a table");let c={op:"deleteBlock",blockId:d.tableId};return fn(n,[c],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!d)return ye("unsupported","the selection is not inside a table");let c;if(t.color===null)c=null;else {let p=Fp(t.color,e.themeColors);if(!p.ok)return ye("invalidArgs",p.reason);c=p.color;}let u={op:"setTableCellFill",tableId:d.tableId,cellIds:d.cellIds,color:c};return fn(n,[u],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!d)return ye("unsupported","the selection is not inside a table");let c={op:"setTableCellVerticalAlignment",tableId:d.tableId,cellIds:d.cellIds,alignment:t.alignment};return fn(n,[c],{kind:"preserveSelection"})}case "setTableBorders":{if(!d)return ye("unsupported","the selection is not inside a table");if(t.scope==="none"){let p={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:"none",target:_w(t.target,Lp(e.layout,d.tableId))};return fn(n,[p],{kind:"preserveSelection"})}let c=YL(t.spec,e.themeColors);if(!c.ok)return ye("invalidArgs",c.reason);let u={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:_w(t.scope,Lp(e.layout,d.tableId)),spec:c.spec};return fn(n,[u],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return JL(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return eN(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return ye("unsupported",`command '${t.type}' is not a table command`)}}function Uw(e){if(!ao(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}function Ct(e){if(typeof e!="object"||e===null)return false;let t=e;return typeof t.paraId=="string"&&t.paraId.length>0&&(t.search===void 0||typeof t.search=="string"&&t.search.length>0)&&(t.occurrence===void 0||typeof t.occurrence=="number"&&Number.isInteger(t.occurrence)&&t.occurrence>=1)}function zo(e){if(typeof e!="object"||e===null)return false;let t=e;return Ct(t.from)&&Ct(t.to)}function zw(e,t,n){let r=[],o=e.indexOf(t);for(;o>=0&&r.length<n;)r.push(o),o=e.indexOf(t,o+1);return r}function mn(e,t,n){if(typeof n.paraId!="string"||n.paraId.length===0)return {ok:false,code:"invalidArgs",reason:"paraId must be a non-empty string"};let r=n.paraId.toUpperCase();if(t.ambiguousParaIds.has(r))return {ok:false,code:"ambiguous",reason:`paraId '${n.paraId}' is claimed by more than one story`};let o=t.nodeByParaId.get(r);if(o===void 0)return {ok:false,code:"notFound",reason:`no paragraph with paraId '${n.paraId}'`};let i=Vi$1(t.partByNode.get(o)??e,o)??"";if(n.search===void 0)return {ok:true,span:{nodeId:o,start:0,end:i.length}};if(n.search.length===0)return {ok:false,code:"invalidArgs",reason:"search must be a non-empty phrase"};if(n.occurrence!==void 0){if(!Number.isInteger(n.occurrence)||n.occurrence<1)return {ok:false,code:"invalidArgs",reason:"occurrence must be a positive integer (1-based)"};let s=zw(i,n.search,n.occurrence),l=s[n.occurrence-1];return l===void 0?{ok:false,code:"notFound",reason:`'${n.search}' matches ${s.length} time(s) in paragraph '${n.paraId}'; occurrence ${n.occurrence} does not exist`}:{ok:true,span:{nodeId:o,start:l,end:l+n.search.length}}}let a=zw(i,n.search,2);return a.length===0?{ok:false,code:"notFound",reason:`'${n.search}' does not occur in paragraph '${n.paraId}'`}:a.length>1?{ok:false,code:"ambiguous",reason:`'${n.search}' matches more than once in paragraph '${n.paraId}'; pass occurrence to disambiguate`}:{ok:true,span:{nodeId:o,start:a[0],end:a[0]+n.search.length}}}function Gw(e,t,n){if("anchor"in n){let s=mn(e,t,n.anchor);if(!s.ok)return {ok:false,code:s.code,reason:s.reason,target:n.anchor};let l={paragraphId:s.span.nodeId,offset:s.span.start};return {ok:true,selection:{anchor:l,head:l}}}let{from:r,to:o}=n.range;if(!Ct(r)||!Ct(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let i=mn(e,t,r);if(!i.ok)return {ok:false,code:i.code,reason:i.reason,target:r};let a=mn(e,t,o);return a.ok?{ok:true,selection:{anchor:{paragraphId:i.span.nodeId,offset:i.span.start},head:{paragraphId:a.span.nodeId,offset:a.span.end}}}:{ok:false,code:a.code,reason:a.reason,target:o}}var tN=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function nN(e,t){return e===t?true:!e||!t?false:tN.every(n=>e[n]===t[n])}function Dp(e,t){if(e===t)return true;if(!e||!t||e.bold!==t.bold||e.italic!==t.italic||e.underline!==t.underline||e.strike!==t.strike||e.superscript!==t.superscript||e.subscript!==t.subscript||e.highlight!==t.highlight||e.fontFamily!==t.fontFamily||e.fontSizePt!==t.fontSizePt||e.alignment!==t.alignment||e.direction!==t.direction||e.styleId!==t.styleId||e.spaceBeforePt!==t.spaceBeforePt||e.spaceAfterPt!==t.spaceAfterPt||e.lineSpacing?.rule!==t.lineSpacing?.rule||e.lineSpacing?.value!==t.lineSpacing?.value||e.indent?.left!==t.indent?.left||e.indent?.right!==t.indent?.right||e.indent?.firstLine!==t.indent?.firstLine||e.indent?.mixed.left!==t.indent?.mixed.left||e.indent?.mixed.right!==t.indent?.mixed.right||e.indent?.mixed.firstLine!==t.indent?.mixed.firstLine||e.indent?.rtl!==t.indent?.rtl||e.paragraphFlags?.contextualSpacing!==t.paragraphFlags?.contextualSpacing||e.paragraphFlags?.keepNext!==t.paragraphFlags?.keepNext||e.paragraphFlags?.keepLines!==t.paragraphFlags?.keepLines||e.paragraphFlags?.widowControl!==t.paragraphFlags?.widowControl||e.paragraphFlags?.pageBreakBefore!==t.paragraphFlags?.pageBreakBefore||!nN(e.disagrees,t.disagrees)||e.tabStops?.length!==t.tabStops?.length||(e.tabStops??[]).some((i,a)=>i.positionTwips!==t.tabStops?.[a]?.positionTwips||i.alignment!==t.tabStops?.[a]?.alignment||(i.leader??"none")!==(t.tabStops?.[a]?.leader??"none")))return false;if(e.color===t.color)return true;if(!e.color||!t.color)return false;let n=e.color,r=t.color,o=new Set([...Object.keys(n),...Object.keys(r)]);for(let i of o)if(n[i]!==r[i])return false;return true}function Hp(e,t){return e.current===t.current&&e.total===t.total}function _p(e,t){return e===t?true:!e||!t?false:e.pageWidthTwips===t.pageWidthTwips&&e.pageHeightTwips===t.pageHeightTwips&&e.orientation===t.orientation&&e.marginsTwips.top===t.marginsTwips.top&&e.marginsTwips.right===t.marginsTwips.right&&e.marginsTwips.bottom===t.marginsTwips.bottom&&e.marginsTwips.left===t.marginsTwips.left&&e.gutterTwips===t.gutterTwips}function Xw(e,t){if(e===t)return true;if(!e||!t)return false;let n=e,r=t;return n.paraId===r.paraId&&n.search===r.search&&n.occurrence===r.occurrence}function Bp(e,t){return e===t?true:!e||!t||!zo(e)||!zo(t)?false:Xw(e.from,t.from)&&Xw(e.to,t.to)}function $p(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var rN={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",editable:"compared",zoom:"compared",zoomMode:"compared",selection:"compared",selectionCollapsed:"compared",formatting:"compared",table:"compared",tocContext:"compared",image:"compared",page:"compared",canUndo:"compared",canRedo:"compared",pageSetup:"compared",reviewPaneOpen:"compared",reviewPane:"compared",showParagraphMarks:"compared",documentProtection:"compared",reviewDisplayMode:"compared",revisionMarkup:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},oN=Object.keys(rN);function qp(e,t){return oN.every(n=>e[n]===t[n])}function Fd(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Fd(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Fd(t[n]);return Object.freeze(e)}var Vp=new Map([["bold",{localName:"b"}],["italic",{localName:"i"}],["underline",{localName:"u",attributes:{val:"single"}}],["strike",{localName:"strike"}],["superscript",{localName:"vertAlign",attributes:{val:"superscript"}}],["subscript",{localName:"vertAlign",attributes:{val:"subscript"}}]]),iN=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),aN=/^[0-9A-Fa-f]{6}$/;function Kp(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||a$7(n)===null?{ok:false,code:"invalidArgs",reason:"fontFamily requires a family name of 1-64 letters, digits, or [ -.+_,;]"}:{ok:true,localName:"rFonts",attributes:{ascii:n,hAnsi:n}};case "fontSize":return typeof n!="number"||!Number.isInteger(n)||n<2||n>3276?{ok:false,code:"invalidArgs",reason:"fontSize requires an integer half-point value between 2 and 3276"}:{ok:true,localName:"sz",attributes:{val:String(n)}};case "color":return typeof n!="string"||n!=="auto"&&!aN.test(n)?{ok:false,code:"invalidArgs",reason:"color requires a six-digit hex value like FF0000, or 'auto'"}:{ok:true,localName:"color",attributes:{val:n}};case "highlight":return typeof n!="string"||!iN.has(n)?{ok:false,code:"invalidArgs",reason:"highlight requires an ST_HighlightColor name (yellow, cyan, ...)"}:{ok:true,localName:"highlight",attributes:{val:n}};default:return {ok:false,code:"unsupported",reason:`mark '${t}' is not supported by setMarkAttr`}}}function eI(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function jp(e){return typeof e=="object"&&e!==null&&eI(e.anchor)&&eI(e.head)}function gn(e,t){let n=new Error(t);return n.code=e,n}function Ld(e,t){return e===t?true:!e||!t?false:e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function Wp(e){return e==="blank"?$f():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Zp(e){return typeof e=="string"?`'${e}' is not a document; pass DOCX bytes, or 'blank' for an empty one`:"a DocumentHandle cannot be re-loaded; pass DOCX bytes"}function Go(e){switch(e.type){case "toggleMark":return Vp.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=Kp(e);return t.ok?{supported:true,mutating:true}:{supported:false,reason:t.reason,code:t.code}}case "setAlignment":return {supported:true,mutating:true};case "setParagraphDirection":return e.direction==="ltr"||e.direction==="rtl"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"setParagraphDirection requires a direction of 'ltr' or 'rtl'"};case "clearFormatting":return {supported:true,mutating:true};case "copyFormatting":return {supported:true,mutating:false};case "pasteFormatting":return {supported:true,mutating:true};case "setLineSpacing":{if(!["multiple","exact","atLeast"].includes(e.rule))return {supported:false,code:"invalidArgs",reason:"setLineSpacing requires a rule of 'multiple', 'exact' or 'atLeast'"};let n=e.rule==="multiple"?e.value*240:e.value*20;return !Number.isFinite(e.value)||e.value<=0||Math.round(n)>31680?{supported:false,code:"invalidArgs",reason:"setLineSpacing requires a positive value no taller than 1584pt"}:{supported:true,mutating:true}}case "setParagraphSpacing":{for(let t of ["beforePt","afterPt"]){let n=e[t];if(n!=null&&(!Number.isFinite(n)||n<0||n>1584))return {supported:false,code:"invalidArgs",reason:`setParagraphSpacing requires ${t} between 0 and 1584 points`}}return {supported:true,mutating:true}}case "setParagraphStyle":return e.target!==void 0?{supported:false,reason:"DocTarget addressing is not supported; the style applies at the selection"}:typeof e.styleId!="string"||e.styleId.length===0||e.styleId.length>128||/[\u0000-\u001f\u007f-\u009f]/.test(e.styleId)?{supported:false,code:"invalidArgs",reason:"setParagraphStyle requires a styleId of 1-128 printable characters"}:{supported:true,mutating:true};case "insertHyperlink":return e.target!==void 0?{supported:false,reason:"DocTarget addressing is not supported; a link applies at the selection"}:typeof e.href!="string"||e.href.length===0?{supported:false,code:"invalidArgs",reason:"insertHyperlink requires an href"}:{supported:true,mutating:true};case "removeHyperlink":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; unlink acts at the selection"};case "setParagraphFormat":{let t=[e.indentLeftTwips,e.indentRightTwips,e.indentFirstLineTwips];for(let r of t)if(r!=null&&(!Number.isInteger(r)||Math.abs(r)>gd$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${gd$1}`};for(let r of ["spaceBeforePt","spaceAfterPt"]){let o=e[r];if(o!=null&&(!Number.isFinite(o)||o<0||o>1584))return {supported:false,code:"invalidArgs",reason:`setParagraphFormat requires ${r} between 0 and 1584 points`}}let n=e.lineSpacing;if(n!=null){if(n.rule!=="multiple"&&n.rule!=="exact"&&n.rule!=="atLeast")return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a rule of 'multiple', 'exact' or 'atLeast'"};let r=n.rule==="multiple"?n.value*240:n.value*20;if(!Number.isFinite(n.value)||n.value<=0||Math.round(r)>31680)return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a positive value no taller than 1584pt"}}if(e.alignment!==void 0&&!["left","center","right","justify"].includes(e.alignment))return {supported:false,code:"invalidArgs",reason:"unknown alignment"};if(e.direction!==void 0&&!["ltr","rtl"].includes(e.direction))return {supported:false,code:"invalidArgs",reason:"unknown direction"};if(e.tabStops!==void 0){if(e.tabStops.length>64)return {supported:false,code:"invalidArgs",reason:"setParagraphFormat accepts at most 64 tab stops"};let r=new Set;for(let o of e.tabStops){if(typeof o!="object"||o===null)return {supported:false,code:"invalidArgs",reason:"a tab stop must be an object"};if(!Number.isInteger(o.positionTwips)||o.positionTwips<0||o.positionTwips>31680)return {supported:false,code:"invalidArgs",reason:"tab stop positions must be whole twips between 0 and 31680"};if(!["left","center","right","decimal"].includes(o.alignment))return {supported:false,code:"invalidArgs",reason:"unknown tab alignment"};if(o.leader!==void 0&&!["none","dot","hyphen","underscore","heavy","middleDot"].includes(o.leader))return {supported:false,code:"invalidArgs",reason:"unknown tab leader"};if(r.has(o.positionTwips))return {supported:false,code:"invalidArgs",reason:"two tab stops cannot share a position"};r.add(o.positionTwips);}}return {supported:true,mutating:true}}case "setIndent":{let t=[e.left,e.right,e.firstLine];if(t.every(n=>n===void 0))return {supported:false,reason:"setIndent requires at least one indent field"};for(let n of t)if(n!=null){if(!Number.isInteger(n))return {supported:false,reason:"indent values must be whole twips"};if(Math.abs(n)>gd$1)return {supported:false,reason:`indent values must be within \xB1${gd$1} twips`}}return {supported:true,mutating:true}}case "toggleList":return e.kind==="bullet"||e.kind==="ordered"?{supported:true,mutating:true}:{supported:false,reason:`list kind '${e.kind}' is not supported`};case "adjustIndent":return e.direction==="increase"||e.direction==="decrease"?{supported:true,mutating:true}:{supported:false,reason:`indent direction '${e.direction}' is not supported`};case "insertBreak":return e.kind==="line"||e.kind==="page"||e.kind==="section"||e.kind==="sectionContinuous"?{supported:true,mutating:true}:{supported:false,reason:`break kind '${e.kind}' is not supported`};case "insertText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; text inserts at the selection"};case "deleteText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; deletion removes the selection"};case "proposeInsertion":case "proposeReplacement":{let t=e.type==="proposeInsertion"?e.text:e.replaceWith;return typeof t!="string"||t.length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires non-empty text`}:/[\r\n\v\f\u2028\u2029]/.test(t)?{supported:false,code:"invalidArgs",reason:`${e.type} requires text without a paragraph mark`}:e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires a non-empty author`}:{supported:true,mutating:true}}case "proposeDeletion":return e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:"proposeDeletion requires a non-empty author"}:{supported:true,mutating:true};case "setPageSetup":{let t=[e.pageWidth,e.pageHeight],n=[e.marginTop,e.marginRight,e.marginBottom,e.marginLeft];if(t.every(r=>r===void 0)&&n.every(r=>r===void 0)&&e.orientation===void 0)return {supported:false,reason:"setPageSetup requires at least one field"};for(let r of t)if(r!==void 0&&(!Number.isInteger(r)||r<1||r>63360))return {supported:false,code:"invalidArgs",reason:"page dimensions must be integer twips between 1 and 63360"};for(let r of n)if(r!==void 0&&(!Number.isInteger(r)||r<0||r>31680))return {supported:false,code:"invalidArgs",reason:"margins must be integer twips between 0 and 31680"};return e.orientation!==void 0&&e.orientation!=="portrait"&&e.orientation!=="landscape"?{supported:false,code:"invalidArgs",reason:"orientation must be 'portrait' or 'landscape'"}:e.scope!==void 0&&e.scope!=="document"&&e.scope!=="section"?{supported:false,code:"invalidArgs",reason:"scope must be 'document' or 'section'"}:{supported:true,mutating:true}}case "undo":case "redo":return {supported:true,mutating:true};case "insertTable":return Number.isInteger(e.rows)&&Number.isInteger(e.cols)&&e.rows>=1&&e.cols>=1&&e.rows<=32767&&e.cols<=63&&e.rows*e.cols<=2e4?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:`insertTable needs whole rows and cols of at least 1, at most ${32767}\xD7${63}, and at most ${2e4} cells`};case "insertToc":return {supported:true,mutating:true};case "editTextFormField":return {supported:true,mutating:false};case "refreshToc":return e.mode!==void 0&&e.mode!=="entire"&&e.mode!=="pageNumbers"?{supported:false,code:"invalidArgs",reason:"refreshToc mode must be 'entire' or 'pageNumbers'"}:e.tocId!==void 0&&(typeof e.tocId!="string"||e.tocId.length===0)?{supported:false,code:"invalidArgs",reason:"refreshToc tocId must be a non-empty string"}:{supported:true,mutating:true};case "editHeaderFooter":return e.position!=="header"&&e.position!=="footer"?{supported:false,reason:"editHeaderFooter requires position 'header' or 'footer'"}:e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"editHeaderFooter variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "exitHeaderFooter":return {supported:true,mutating:false};case "removeHeaderFooter":case "linkHeaderFooterToPrevious":case "unlinkHeaderFooterFromPrevious":return "variant"in e&&e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"furniture variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "setHeaderFooterOptions":return e.titlePage===void 0&&e.evenAndOddHeaders===void 0&&e.headerDistanceTwips===void 0&&e.footerDistanceTwips===void 0?{supported:false,reason:"setHeaderFooterOptions requires at least one option"}:{supported:true,mutating:true};case "insertPageField":return e.field==="PAGE"||e.field==="NUMPAGES"||e.field==="SECTIONPAGES"||e.field==="PAGE_X_OF_Y"?{supported:true,mutating:true}:{supported:false,reason:"insertPageField field must be 'PAGE', 'NUMPAGES', 'SECTIONPAGES', or 'PAGE_X_OF_Y'"};case "insertNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"insertNote noteKind must be 'footnote' or 'endnote'"};case "deleteNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"deleteNote noteKind must be 'footnote' or 'endnote'"};case "convertNote":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertNote fromKind must be 'footnote' or 'endnote'"};case "convertAllNotes":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertAllNotes fromKind must be 'footnote' or 'endnote'"};case "setNoteProperties":return e.endnote?.position==="pageBottom"?{supported:false,reason:"endnote-pageBottom"}:e.footnote!==void 0||e.endnote!==void 0?{supported:true,mutating:true}:{supported:false,reason:"setNoteProperties requires footnote and/or endnote fields"};case "selectAll":case "copy":return {supported:true,mutating:false};case "cut":return {supported:true,mutating:true};case "paste":case "pasteWithoutFormatting":{if(typeof e.text!="string")return {supported:false,code:"invalidArgs",reason:"paste requires text"};let t=e.type==="paste"?e.html:void 0;return t!==void 0&&typeof t!="string"?{supported:false,code:"invalidArgs",reason:"paste html must be a string"}:e.text===""&&(t===void 0||t==="")?{supported:false,code:"invalidArgs",reason:"there is nothing to paste"}:{supported:true,mutating:true}}case "insertRow":case "deleteRow":case "insertColumn":case "deleteColumn":case "deleteTable":case "setCellFill":case "setTableCellVerticalAlignment":case "setTableBorders":case "commitTableColumnDividerResize":case "commitTableRightEdgeResize":case "mergeCells":case "splitCell":case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":{let t=Uw(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(jp(e.range)||zo(e.range))||"anchor"in e&&Ct(e.anchor)?{supported:true,mutating:false}:{supported:false,reason:"setSelection accepts { anchor: { paraId } }, a { range } whose from/to are paraId anchors, or a { range } carrying a semantic { anchor: { paragraphId, offset }, head } selection"};case "insertTextBox":return {supported:true,mutating:true};case "insertImage":return e.data instanceof Uint8Array&&(e.mime==="image/png"||e.mime==="image/jpeg"||e.mime==="image/gif")&&Number.isFinite(e.widthPoints)&&Number.isFinite(e.heightPoints)&&e.widthPoints>0&&e.heightPoints>0?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"insertImage requires png/jpeg/gif bytes and finite dimensions"};case "replaceImage":return e.data instanceof Uint8Array?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};case "deleteImage":return {supported:true,mutating:true};case "setImageWrapType":return ["inline","square","squareLeft","squareRight","tight","through","topAndBottom","behind","inFront"].includes(e.target)?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported wrap target"};case "transformImage":return e.action==="rotateCW"||e.action==="rotateCCW"||e.action==="flipH"||e.action==="flipV"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported transform action"};case "setImagePosition":return {supported:true,mutating:true};case "setImageProperties":return {supported:true,mutating:true};default:return {supported:false,reason:Up(e.type)}}}function Up(e){return `command '${e}' is not supported by the tree editor`}var Qt="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",tI="realtime collaboration requires the pro collaboration module (@docx-editor.dev/pro)",cr="suggesting mode needs an author; configure author before enabling it",sN="this document asks for tracked changes, but no author is configured",Nd="this document is protected for filling in forms, which does not track changes",Gp="this document permits editing only as tracked changes",Ss="image changes are not supported in suggesting mode",qi="this revision kind has no structural accept/reject yet",Xo="this document is protected against editing; open it in Word to change that",Yo="this document is protected for comments only",zp={mode:null,rejection:null};function Xp(e,t){if(e===void 0||e==="view")return zp;if(e==="edit")return {mode:"editing",rejection:null};let n=Yp(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function Yp(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:cr}:{ok:false,code:"unsupported",reason:Qt}}function nI(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==cr||t||n!==null||(n=setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let i=`${cr}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(gn("suggestingNeedsAuthor",i)),r(`[@docx-editor.dev/core] ${i}`);},0));},dispose(){n!==null&&clearTimeout(n),n=null;}}}function Qp(e){if(e.restrictedToReadOnly)return e.currentMode==="viewing"?zp:{mode:"viewing",rejection:Xo};let t=e.currentMode,n=null;e.engineAdoptedViewing&&t==="viewing"&&!e.viewOnly&&(n="editing",t="editing");let r=n===null?zp:{mode:n,rejection:null};return e.restrictedToComments?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:Yo}:r:e.restrictedToForms?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:Nd}:r:e.viewOnly||t!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?r:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:n,rejection:sN}}function rI(e){return e===null?{enter:true,rejection:null}:{enter:false,rejection:e.reason}}function Jp(e,t){return t!=="viewing"&&e.restrictedToReadOnly?{ok:false,code:"locked",reason:Xo}:t==="suggesting"&&e.restrictedToComments?{ok:false,code:"locked",reason:Yo}:t==="suggesting"&&e.restrictedToForms?{ok:false,code:"locked",reason:Nd}:t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:Gp}}function oI(e,t,n,r,o,i=false){let a=Xp(e,t),s=e==="view"?"viewing":a.mode??o,l=Qp({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:s,engineAdoptedViewing:i});l.mode!==null&&(s=l.mode);let d=Jp(n,s),c=n.restrictedToReadOnly?"viewing":r;return {mode:d===null?s:c,rejection:l.rejection??d?.reason??null,configurationRejection:a.rejection}}var iI=new WeakMap;function aI(e,t){iI.set(e,t);}var sI=new WeakMap;function lI(e,t){let n=kj(t);n&&sI.set(e,n);}var em="this document is protected for tracked changes; their authors cannot change",Qo="this document is protected; only form fields can be filled";function Wn(e,t){if(e.type==="undo"||e.type==="redo"||e.type==="toggleDocumentProtection")return null;let n=Tg$1(t.session.currentPackage()),r=Lg$1(n?.root);if(!r.enforced)return null;if(r.edit==="readOnly"||r.edit==="comments")return {ok:false,code:"locked",reason:r.edit==="comments"?Yo:Xo};if(r.edit==="trackedChanges"&&e.type==="setReviewChangesAuthor")return {ok:false,code:"locked",reason:em};if(r.edit!=="forms"||ao(e))return null;let o="structure",i,a=false;switch(e.type){case "insertText":o="text",i=e.text;break;case "paste":case "pasteWithoutFormatting":o="text",i=e.text,a=true;break;case "deleteText":case "cut":o="text";break;case "toggleMark":case "setMarkAttr":case "pasteFormatting":o="runFormat";break;case "clearFormatting":case "setAlignment":case "setParagraphDirection":case "setLineSpacing":case "setParagraphSpacing":case "setIndent":case "adjustIndent":case "toggleList":case "setParagraphStyle":case "setParagraphFormat":case "removeTabMark":o="paragraph";break;case "setPageSetup":case "setHeaderFooterOptions":case "convertAllNotes":case "insertToc":case "refreshToc":case "replaceAllMatches":case "resolveAllReviewChanges":case "setReviewChangesAuthor":case "acceptRevision":case "rejectRevision":case "acceptAllRevisions":case "rejectAllRevisions":o="document";break}let s=t.state().selection,l=t.session.storyParts().find(p=>s.head.paragraphId.startsWith(`${p.name}#`));if(!l)return {ok:false,code:"locked",reason:Qo};let d=t.state().cellSelection;return (d&&(o==="runFormat"||o==="paragraph")?[...ga(t.layout(),d.cellIds)].map(p=>({anchor:{paragraphId:p,offset:0},head:{paragraphId:p,offset:(Vi$1(l,p)??"").length}})):[s]).some(p=>sj(l,n,{selection:p,intent:o,text:i,paste:a,fieldId:iI.get(t)?.()??void 0,contentLockPolicy:sI.get(t)}))?{ok:false,code:"locked",reason:Qo}:null}function dI(e,t){if(e!=="locked")return e;let n=Lg$1(t);return n.enforced?n.edit==="comments"?Yo:n.edit==="forms"?Qo:Xo:"this content is locked"}function cI(e){return e!==null&&Wn({type:"resolveAllReviewChanges"},e)!==null}function uI(e,t){return ()=>e()??(t()?null:"the document is read-only")}function fI(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function pI(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function mI(e){return e.widthEmu!==void 0||e.heightEmu!==void 0||e.alt!==void 0||e.title!==void 0||e.description!==void 0||e.hyperlink!==void 0||e.crop!==void 0||e.wrap!==void 0||e.resetToNaturalSize===true||Pk$1(e)}var gI=new WeakMap;function hI(e,t){gI.set(e,t);}function yI(e,t,n){gI.get(e)?.(t,n);}function lN(e){return [e.left,e.top,e.right,e.bottom]}function tm(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function dN(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function ws(e){return Math.round(e*1e3)}function Is(e){return e/1e3}function nm(e){return Object.freeze({left:ws(e.left),top:ws(e.top),right:ws(e.right),bottom:ws(e.bottom)})}function cN(e){return Object.freeze({left:Is(e.left),top:Is(e.top),right:Is(e.right),bottom:Is(e.bottom)})}function rm(e){return lN(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Dd=12700;function Et(e){return Math.round(e*12700)}function Jo(e){return e/12700}function bI(e,t,n,r,o,i){let a=Jo(e),s=Jo(t),l=a/s,d=n.includes("e")?r:n.includes("w")?-r:0,c=n.includes("s")?o:n.includes("n")?-o:0;if(a=Math.max(1,a+d),s=Math.max(1,s+c),i)if(n.length===2){let p=Math.max(a/Jo(e),s/Jo(t));a=Math.max(1,Jo(e)*p),s=Math.max(1,a/l);}else n==="e"||n==="w"?s=Math.max(1,a/l):a=Math.max(1,s*l);return Object.freeze({cx:Et(a),cy:Et(s)})}function Hd(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+Et(t),verticalEmu:(e.verticalEmu??0)+Et(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+Et(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+Et(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}var uN=new Set(["insertImage","replaceImage"]),fN=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function om(e,t,n){return e.accessibility.hidden||n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function pN(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&om(o,n,r))return o;return null}function mN(e,t,n,r){let o=e.layout();for(let i of o.pages){for(let a of i.anchoredDrawings??[])if(a.anchorParagraphId===t&&om(a,n,r))return a;for(let a of [i.header,i.footer])if(a){for(let s of a.anchoredDrawings??[])if(s.anchorParagraphId===t&&om(s,n,r))return s}}return null}function vI(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function kn(e){if(!e)return null;let t=e.drawingSelectionIntent();if(t.kind==="none")return null;let{anchor:n,head:r}=e.state().selection;if(n.paragraphId!==r.paragraphId||n.offset!==r.offset)return null;let o=wd$1(e.layout(),n.paragraphId,n.offset),i=t.kind==="pointer"?t.drawingNodeId:null;return pN(o,n.paragraphId,n.offset,i)??mN(e,n.paragraphId,n.offset,i)}function xI(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=Ta(r,t.drawingNodeId);return o?o.kind!=="drawing"?Lk$1(r,t.drawingNodeId):Nd$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Gd$1,limits:Fd$1,resolveRelationship:Id$1(e.session.currentPackage(),t.ownerPartName)}):null}function SI(e){if(e.kind!=="anchored"||!e.position)return null;let t=e.position;return e.anchor?.simplePos?Object.freeze({mode:"simple",horizontalEmu:t.simplePosition.xEmu,verticalEmu:t.simplePosition.yEmu}):Object.freeze({mode:"frame",...t.horizontal.offsetEmu!==null?{horizontalEmu:t.horizontal.offsetEmu}:{},...t.vertical.offsetEmu!==null?{verticalEmu:t.vertical.offsetEmu}:{},relativeToH:t.horizontal.relativeFrom,relativeToV:t.vertical.relativeFrom})}function gN(e){let t=e.resource;return t.kind!=="ready"?null:Object.freeze({pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,dpiX:t.dpiX,dpiY:t.dpiY})}function wI(e){let t=e.locks,n=e.kind==="inline"&&e.textboxStory!==null;return Object.freeze({canResize:!n&&!t.resize&&!e.hidden,canMove:!n&&!t.move&&!e.hidden,canChangeWrap:e.picture!==null&&!t.move&&e.kind==="anchored"&&!e.hidden,canCrop:e.picture!==null&&!t.resize&&!t.changeAspect&&!e.hidden})}function hN(e){return e.kind==="inlineDrawing"?"inline":e.wrap}var II=e=>e.placeholderGraphicKind===null||!!e.textboxStory;function ur(e){let t=kn(e);if(!t||!II(t))return null;let n=e?xI(e,t):null;if(!n||n.hidden||n.locks.select)return null;let r=t.transform;return Object.freeze({id:t.drawingNodeId,kind:n.kind,widthEmu:n.extentEmu.cx,heightEmu:n.extentEmu.cy,crop:tm(t.crop),rotationDegrees:r.rotationDegrees,wrap:hN(t),position:SI(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:gN(t),...wI(n)})}function kI(e,t){return e===t?true:!e||!t?false:e.id===t.id&&e.kind===t.kind&&e.widthEmu===t.widthEmu&&e.heightEmu===t.heightEmu&&e.crop.left===t.crop.left&&e.crop.top===t.crop.top&&e.crop.right===t.crop.right&&e.crop.bottom===t.crop.bottom&&e.rotationDegrees===t.rotationDegrees&&e.wrap===t.wrap&&e.name===t.name&&e.title===t.title&&e.description===t.description&&e.hyperlink===t.hyperlink&&e.hidden===t.hidden&&e.resourceStatus===t.resourceStatus&&e.canResize===t.canResize&&e.canMove===t.canMove&&e.canChangeWrap===t.canChangeWrap&&e.canCrop===t.canCrop&&e.locks.select===t.locks.select&&e.locks.move===t.locks.move&&e.locks.resize===t.locks.resize&&e.locks.changeAspect===t.locks.changeAspect&&(e.position?.mode??"frame")===(t.position?.mode??"frame")&&(e.position?.horizontalEmu??null)===(t.position?.horizontalEmu??null)&&(e.position?.verticalEmu??null)===(t.position?.verticalEmu??null)&&(e.position?.relativeToH??null)===(t.position?.relativeToH??null)&&(e.position?.relativeToV??null)===(t.position?.relativeToV??null)&&(e.intrinsic?.pixelWidth??null)===(t.intrinsic?.pixelWidth??null)&&(e.intrinsic?.pixelHeight??null)===(t.intrinsic?.pixelHeight??null)&&(e.intrinsic?.dpiX??null)===(t.intrinsic?.dpiX??null)&&(e.intrinsic?.dpiY??null)===(t.intrinsic?.dpiY??null)}function im(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function RI(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function am(e){return im(e)!==void 0||RI(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function sm(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=RI(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let i=im(t),a=ur(r);if(i!==void 0&&(!a||a.id!==i))return {ok:false,code:"notFound",reason:"stale drawing selection"};if(t.type==="setImageProperties"&&t.selectionParagraphId!==void 0&&t.selectionOffset!==void 0){let{anchor:s,head:l}=r.state().selection;if(s.paragraphId!==t.selectionParagraphId||s.offset!==t.selectionOffset||l.paragraphId!==t.selectionParagraphId||l.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return Vi(e,n,{requireDrawing:i!==void 0||n.drawingNodeId!==null,drawingNodeId:i??n.drawingNodeId??void 0})}function so(e,t){let n=ur(e),r=im(t);return r?!n||n.id!==r?{ok:false,code:"notFound",reason:"stale drawing selection"}:{id:r}:n?{id:n.id}:{ok:false,code:"notFound",reason:"no drawing is selected"}}function yN(e){return e.rejected?{ok:false,code:"invalidArgs",reason:e.reason==="drawing-locked"?"the drawing is locked":e.reason==="unknown-drawing"?"stale drawing selection":typeof e.reason=="string"?e.reason:"the image change was refused"}:null}function _d(e,t){return yN(e.applyDrawingOps(t))}function bN(e){if(!e.intrinsic)return null;let t=Math.round(e.intrinsic.pixelWidth*914400/e.intrinsic.dpiX),n=Math.round(e.intrinsic.pixelHeight*914400/e.intrinsic.dpiY);return !Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{cx:t,cy:n}}function PI(e,t){return t?.position?.mode==="simple"?Object.freeze({mode:"simple",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu}:{}}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function ks(e){return fN.has(e.type)}function vN(e){return uN.has(e.type)}function TI(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function CI(e,t){if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=e.editingMode();return n==="view"?{ok:false,code:"locked",reason:"the document is open for viewing"}:n==="suggest"&&t==="replaceImage"?{ok:false,code:"invalidArgs",reason:Ss}:null}function Rs(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=ur(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function Vi(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};if(e.mountGeneration!==t.mountGeneration)return {ok:false,code:"notFound",reason:"the editor is no longer attached"};let{anchor:o,head:i}=r.state().selection;if(o.paragraphId!==t.selectionParagraphId||o.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(o.paragraphId!==i.paragraphId||o.offset!==i.offset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(n?.requireDrawing){let a=ur(r),s=n.drawingNodeId??t.drawingNodeId;if(!a||!s||a.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}var lm="a picture is selected; place the caret in text to insert a picture";function Ki(e,t){if(!ks(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=Wn(e,t);if(n)return n;if(e.type==="insertImage")return kn(t)?{ok:false,code:"invalidArgs",reason:lm}:!(e.data instanceof Uint8Array)||e.data.byteLength===0?{ok:false,code:"invalidArgs",reason:"insertImage requires image bytes"}:!Number.isFinite(e.widthPoints)||!Number.isFinite(e.heightPoints)?{ok:false,code:"invalidArgs",reason:"insertImage requires finite dimensions"}:e.widthPoints<=0||e.heightPoints<=0?{ok:false,code:"invalidArgs",reason:"insertImage dimensions must be positive"}:null;let r=kn(t);if(r&&"textboxStory"in r&&r.textboxStory&&(e.type==="replaceImage"||e.type==="transformImage"||e.type==="setImageProperties"&&e.hyperlink!==void 0))return {ok:false,code:"unsupported",reason:"this operation is not supported for textboxes"};if(e.type==="replaceImage"){if(!(e.data instanceof Uint8Array)||e.data.byteLength===0)return {ok:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};let s=so(t,e);return "ok"in s?s:null}let i=so(t,e);if("ok"in i)return i;let a=ur(t);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};if(t.editingMode()==="suggest"&&e.type!=="deleteImage")return {ok:false,code:"invalidArgs",reason:Ss};switch(e.type){case "deleteImage":return a.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return a.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return a.locks.changeAspect||a.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!a.canMove||a.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!pI(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let s=a.position?.mode??"frame";return Rk$1(e,s)?Mk$1(PI(e,a))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(fI(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!mI(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!a.intrinsic)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};if(e.widthEmu!==void 0&&(!Number.isFinite(e.widthEmu)||e.widthEmu<=0))return {ok:false,code:"invalidArgs",reason:"widthEmu must be a positive finite number"};if(e.heightEmu!==void 0&&(!Number.isFinite(e.heightEmu)||e.heightEmu<=0))return {ok:false,code:"invalidArgs",reason:"heightEmu must be a positive finite number"};if(e.widthEmu!==void 0&&!a.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!a.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!rm(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!a.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!Q(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!a.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(Pk$1(e)){if(!a.canMove||a.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let l=a.position?.mode??"frame";if(!Rk$1(e,l))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!Mk$1(Qk$1(e,a)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function dm(e,t){let n=CI(t,e.type);if(n)return n;let r=Ki(e,t);return r||{ok:true}}function EI(e,t){let n=Ki(e,t);return n||TI(e)}function cm(e,t,n){if(vN(t))return TI(t);let r=n&&am(t)?Rs(n):null;if(r&&n){let o=sm(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=so(e,t);if("ok"in o)return o;let i=e.deleteImage(o.id);return i.ok?null:{ok:false,code:"invalidArgs",reason:i.detail??i.reason??"deleteImage was refused"}}case "setImageWrapType":{let o=so(e,t);return "ok"in o?o:_d(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=so(e,t);return "ok"in o?o:_d(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=so(e,t);if("ok"in o)return o;let i=ur(e),a=PI(t,i);return _d(e,[{op:"positionDrawing",drawingNodeId:o.id,position:a}])}case "setImageProperties":{let o=so(e,t);if("ok"in o)return o;let i=ur(e);if(!i)return {ok:false,code:"notFound",reason:"no drawing is selected"};let a=[];if(t.resetToNaturalSize){let d=bN(i);if(!d)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};a.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:d});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&a.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??i.widthEmu,cy:t.heightEmu??i.heightEmu}});t.crop!==void 0&&a.push({op:"cropDrawing",drawingNodeId:o.id,crop:nm(t.crop)});let s=t.title??t.alt,l=t.description??t.alt;if((s!==void 0||l!==void 0)&&a.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:s??i.title,description:l??i.description}),t.wrap!==void 0&&a.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),Pk$1(t)){let d=Qk$1(t,i);a.push({op:"positionDrawing",drawingNodeId:o.id,position:d});}if(t.hyperlink!==void 0){let d=e.applyImageProperties({drawingNodeId:o.id,ops:a,hyperlink:t.hyperlink});return d.ok?null:{ok:false,code:"invalidArgs",reason:d.detail??d.reason??"setImageProperties was refused"}}return a.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:_d(e,a)}default:return null}}function xN(e,t,n,r,o){let i=Rc$1(e.sectionPropertiesAt(t)),a=i.width-i.margin.left-i.margin.right,s=Gc$1(i),l=i.height-s.top-s.bottom,d=wd$1(e.layout(),t,n),c=d&&d.box.width>0?Math.min(d.box.width,a):a,u=Math.min(1,c/r,l/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function um(e,t){let n=await SN(e,t);return yI(e,t,n),n}async function SN(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=CI(n,t.type);if(r)return r;let o=Ki(t,n);if(o)return o;let i=Rs(e);if(!i)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:u}=n.state().selection,p=t.expectedPackageRevision??i.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let m=xN(n,u.paragraphId,u.offset,t.widthPoints,t.heightPoints),h=await n.insertImage({paragraphId:u.paragraphId,offset:u.offset,bytes:t.data,mime:t.mime,widthPoints:m.widthPoints,heightPoints:m.heightPoints,expectedPackageRevision:p,commitGuard:()=>Vi(e,i)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),b=Vi(e,i);return b||(h.ok?{ok:true,changed:h.change!==null}:{ok:false,code:"invalidArgs",reason:h.detail==="stale-package-epoch"?"stale package revision":h.detail??h.reason??"insertImage was refused"})}let a=so(n,t);if("ok"in a)return a;let s=t.expectedPackageRevision??i.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let l=t.mime??"image/png",d=await n.replaceImage(a.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>Vi(e,i,{requireDrawing:true,drawingNodeId:a.id})===null}),c=Vi(e,i,{requireDrawing:true,drawingNodeId:a.id});return c||(d.ok?{ok:true,changed:d.change!==null}:{ok:false,code:"invalidArgs",reason:d.detail==="stale-package-epoch"?"stale package revision":d.detail??d.reason??"replaceImage was refused"})}var wN=1,IN=10;function kN(e,t){if(!t||t.hidden||t.locks.select||!II(e))return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=wI(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function RN(e){if(!e)return null;let t=e.activeScope(),{anchor:n,head:r}=e.state().selection;if(t.kind!=="frame"&&(n.paragraphId!==r.paragraphId||n.offset!==r.offset))return null;let o=t.kind==="frame"?ge(e.layout(),t.drawingNodeId)?.record:kn(e);if(!o||o.accessibility.hidden)return null;let i=e.layout(),a=ge(i,o.drawingNodeId);if(!a)return null;let s=xI(e,o);if(!s||s.locks.select)return null;let l=kN(o,s),c=e.editingMode()==="edit"&&e.session.editable?l:{...l,canResize:false,canMove:false},u=o.kind==="anchoredDrawing"?Object.freeze({x:o.horizontalFrameOrigin,y:o.verticalFrameOrigin}):null;return Object.freeze({id:o.drawingNodeId,textbox:"textboxStory"in o&&!!o.textboxStory,pageIndex:a.pageIndex,x:a.x,y:a.y,width:a.width,height:a.height,kind:o.kind==="inlineDrawing"?"inline":"anchored",widthEmu:s.extentEmu.cx,heightEmu:s.extentEmu.cy,position:SI(s),anchorFrameOrigin:u,transform:o.transform,...c})}function PN(e,t){let n=e.surface;return n?n.publishedLayout().revision!==t.layoutRevision?{ok:false,code:"notFound",reason:"stale layout revision"}:n.session.packageRevision()!==t.packageRevision?{ok:false,code:"notFound",reason:"stale package revision"}:Vi(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function OI(e){if(!e)return null;let t=e.formatting();return {bold:t.bold,italic:t.italic,underline:t.underline,strike:t.strikethrough,superscript:t.superscript,subscript:t.subscript,...t.color?{color:{kind:"hex",value:t.color}}:{},...t.highlight?{highlight:t.highlight}:{},...t.fontFamily?{fontFamily:t.fontFamily}:{},...t.fontSizeHalfPoints!==null?{fontSizePt:t.fontSizeHalfPoints/2}:{},...t.alignment?{alignment:t.alignment}:{},...t.direction?{direction:t.direction}:{},...t.styleId?{styleId:t.styleId}:{},...t.lineSpacing?{lineSpacing:t.lineSpacing}:{},...t.spaceBeforePt!==null?{spaceBeforePt:t.spaceBeforePt}:{},...t.spaceAfterPt!==null?{spaceAfterPt:t.spaceAfterPt}:{},...t.indent!==null?{indent:t.indent}:{},paragraphFlags:t.paragraphFlags,disagrees:t.disagrees,...t.tabStops!==null?{tabStops:t.tabStops}:{}}}var fm=new WeakMap;function MI(e,t){let n=e.isScheduled(),r=pm(t);return r?fm.set(e,r):n||fm.delete(e),r??(n?fm.get(e)??null:null)}function pm(e){if(!e)return null;let t=e.sectionPropertiesAt(e.state().selection.head.paragraphId);return {pageWidthTwips:t.pageSize.widthTwips,pageHeightTwips:t.pageSize.heightTwips,orientation:t.landscape?"landscape":"portrait",marginsTwips:{top:t.margins.topTwips,right:t.margins.rightTwips,bottom:t.margins.bottomTwips,left:t.margins.leftTwips},gutterTwips:t.margins.gutterTwips}}function Bd(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let d=e.session.paraIdOf(t.paragraphId);return d===null?null:{from:{paraId:d},to:{paraId:d}}}let r=e.session.paragraphAnchors(),o=r.paraIdByNode.get(t.paragraphId),i=r.paraIdByNode.get(n.paragraphId);if(o===void 0||i===void 0)return null;let a=r.ordinalByNode.get(t.paragraphId)??0,s=r.ordinalByNode.get(n.paragraphId)??0;return s<a||s===a&&n.offset<t.offset?{from:{paraId:i},to:{paraId:o}}:{from:{paraId:o},to:{paraId:i}}}function AI(e){if(!e)return null;let t=e.hyperlinks.linkAtCaret();if(!t)return null;let n=e.session.paraIdOf(t.paragraphId);return n===null?null:{href:t.href??"",range:{from:{paraId:n},to:{paraId:n}},...t.tooltip!==void 0?{tooltip:t.tooltip}:{}}}function FI(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$1(n).map(o=>{let i=r.paraIdByNode.get(o.id),a=o.kind==="textValue"?void 0:i$2(o);return {...i!==void 0?{paraId:i}:{},text:Vi$1(n,o.id)??"",...a!==void 0?{styleId:a}:{}}})}function ji(e){return e?e.state().pageCount:0}function mm(e,t="caret"){return e?e.currentPage(t):1}function TN(e,t){if(!ao(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=$d(e,t);return n.can.ok?{ok:true,tablePlan:n.plan}:{ok:false,refusal:{ok:false,code:n.can.code,reason:n.can.reason}}}function CN(e,t){return {command:e,part:t.session.partFor(t.storyScope())??t.session.part(),layout:t.layout(),storeRevision:t.session.packageRevision(),selection:t.state().selection,cellSelection:t.state().cellSelection,themeColors:t.session.documentThemeColors(),editable:t.session.editable,viewing:t.editingMode()==="view"}}function $d(e,t){let n=CN(e,t),r=Hr(n),o=Tg$1(t.session.currentPackage());return r.ok&&r.ops.some(i=>rk$1(n.part,o,i))&&(r={ok:false,code:"locked",reason:Qo}),r.ok?{can:{ok:true},plan:r}:{can:{ok:false,code:r.code,reason:r.reason},plan:r}}function Ps(e,t,n,r){if(r?.scope){if(r.scope.kind==="all")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"the all scope is read-only"}};if(r.scope.kind==="note"||r.scope.kind==="frame")return {ok:false,refusal:{ok:false,code:"unsupported",reason:`scope kind '${r.scope.kind}' is not supported`}};if(r.scope.kind==="headerFooter"){let s=t?.activeScope?.()??{kind:"body"};if(s.kind!=="headerFooter"||s.rId!==r.scope.rId)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"open that header or footer before dispatching against its scope"}}}}let o=Go(e);if(!o.supported)return {ok:false,refusal:{ok:false,code:o.code??"unsupported",reason:o.reason}};if(!t)return {ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}};if(o.mutating&&(n==="view"||!t.session.editable))return {ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}};let i=o.mutating?Wn(e,t):null;if(i)return {ok:false,refusal:i};if(e.type==="insertTextBox"){let s=Tp(t);return s?{ok:false,refusal:s}:{ok:true}}if(e.type==="adjustIndent"&&!t.canAdjustIndent(e.direction))return {ok:false,refusal:{ok:false,code:"unsupported",reason:e.direction==="decrease"?"the selection is already at the outermost level":"the selection cannot indent any further"}};if(e.type==="deleteText"&&kn(t)){let s=Ki({type:"deleteImage"},t);return s&&!s.ok?{ok:false,refusal:s}:{ok:true}}if(e.type==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:s,head:l}=t.state().selection;if(s.paragraphId===l.paragraphId&&s.offset===l.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(s=>s.type==="paragraph"))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"this document defines no paragraph styles"}};if(e.type==="pasteFormatting"&&t.formatPainter.state().level==="none")return {ok:false,refusal:{ok:false,code:"notFound",reason:Rw}};if(e.type==="undo"&&!t.state().canUndo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.state().canRedo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to redo"}};if(e.type==="insertTable"&&!t.canInsertTable(e.rows,e.cols))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table can only be inserted at a caret in editable body, cell, or note text"}};if(e.type==="insertToc"&&!t.canInsertToc())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table of contents can only be inserted in the editable document body"}};if(e.type==="editTextFormField"&&!t.canEditTextFormField())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"field options are unavailable"}};if(e.type==="refreshToc"&&!t.canRefreshToc(e.tocId))return {ok:false,refusal:{ok:false,code:"notFound",reason:"there is no refreshable table of contents at the selection"}};if(e.type==="insertPageField"&&(t.activeScope?.()??{kind:"body"}).kind!=="headerFooter")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}};if(e.type==="insertNote"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertNote requires body scope"}};if(e.type==="insertBreak"&&(e.kind==="section"||e.kind==="sectionContinuous")){if((t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a section break can only be inserted in the editable document body"}};let l=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(l)return {ok:false,refusal:{ok:false,code:"unsupported",reason:l}}}if(e.type==="insertBreak"&&e.kind==="page"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a page break can only be inserted in the editable document body"}};if(e.type==="linkHeaderFooterToPrevious"){let s=t.headerFooterState?.();if((e.sectionIndex??s?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(ao(e)){let s=TN(e,t);return s.ok?{ok:true,tablePlan:s.tablePlan}:s}let a=Ki(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function LI(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!Ta(n,t))return true;let r=Ua$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=Ua$1(n,r.id);}return false}function NI(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!LI(e,t.selection.head.paragraphId))return null;let r=ka(e.layout(),t.selection.head.paragraphId);return r?{blockId:r.tableId,rowCount:r.rows,columnCount:r.columns,cell:{row:n?n.rows.from:r.rowIndex,column:n?n.columns.from:r.columnIndex}}:null}function qd(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!LI(e,t.selection.head.paragraphId))return null;let r=ka(e.layout(),t.selection.head.paragraphId);return r?{rows:r.rows,columns:r.columns,rowIndex:n?n.rows.from:r.rowIndex,columnIndex:n?n.columns.from:r.columnIndex}:null}function DI(e){return e?{...e.bold!==void 0?{bold:e.bold}:{},...e.italic!==void 0?{italic:e.italic}:{},...e.underline!==void 0?{underline:e.underline}:{},...e.fontFamily?{fontFamily:e.fontFamily}:{},...e.fontSizePt!==void 0?{fontSizeHalfPoints:Math.round(e.fontSizePt*2)}:{},...e.styleId?{styleId:e.styleId}:{},...e.alignment?{alignment:e.alignment}:{}}:null}function HI(e){return !!e&&wn(e.session.part(),e.state().selection.head)!==void 0}var de={undo:["M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"],redo:["M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"],print:["M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"],file_download:["M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],file_upload:["M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],format_bold:["M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"],format_italic:["M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"],format_underlined:["M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"],strikethrough_s:["M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"],superscript:["M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"],subscript:["M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"],link:["M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"],format_clear:["m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"],format_paragraph:["M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"],format_shapes:["M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"],lock:["M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"],format_align_left:["M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"],format_align_center:["M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"],format_align_right:["M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"],format_align_justify:["M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"],format_line_spacing:["M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"],format_list_bulleted:["M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"],format_list_numbered:["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],format_indent_increase:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"],format_indent_decrease:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"],format_color_text:["M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"],ink_highlighter:["M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"],format_color_reset:["M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"],arrow_drop_down:["M480-360 280-560h400L480-360Z"],table:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"],table_chart:["M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"],grid_on:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],table_rows:["M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"],view_column:["M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"],border_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],select_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],border_outer:["M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"],border_inner:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"],border_clear:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],add:["M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"],remove:["M200-440v-80h560v80H200Z"],delete:["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],delete_sweep:["M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"],call_merge:["m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"],call_split:["M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"],drag_indicator:["M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"],image:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"],format_image_left:["M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"],format_image_right:["M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"],horizontal_rule:["M160-440v-80h640v80H160Z"],flip_to_back:["M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],flip_to_front:["M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],open_with:["M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"],tune:["M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"],rotate_right:["M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"],rotate_left:["M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"],swap_horiz:["M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"],swap_vert:["M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"],shapes:["M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"],format_paint:["M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"],expand_more:["M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"],expand_less:["m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"],border_top:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_bottom:["M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_left:["M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_right:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"],border_horizontal:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],border_vertical:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],padding:["M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],text_rotation_none:["M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"],wrap_text:["M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"],height:["M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"],fit_width:["M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],settings:["m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],border_color:["M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"],format_color_fill:["m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"],vertical_align_top:["M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"],vertical_align_center:["M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"],vertical_align_bottom:["M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"],line_weight:["M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"],keyboard_arrow_up:["M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"],keyboard_arrow_down:["M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"],keyboard_arrow_left:["M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"],keyboard_arrow_right:["M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"],more_vert:["M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"],page_break:["M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"],branding_watermark:["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"],arrow_back:["M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"],search:["M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"],toc:["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],done_all:["M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"],check_circle:["m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"],chat_bubble_outline:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],chat_bubble_check:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],check:["M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"],close:["m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"],add_comment:["M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],comment:["M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],edit_note:["M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"],rate_review:["M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],visibility:["M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"],format_textdirection_l_to_r:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"],format_textdirection_r_to_l:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"],"agent-sparkle":["m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"]};var Wi={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},BI=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function gm(e){return createT(en)(e)}function Ts(e){return BI.includes(e)}function MN(e){return e!=null}var $I=[{value:"all",icon:"border_all",labelKey:"table.borders.all"},{value:"outside",icon:"border_outer",labelKey:"table.borders.outside"},{value:"inside",icon:"border_inner",labelKey:"table.borders.inside"},{value:"top",icon:"border_top",labelKey:"table.borders.top"},{value:"bottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{value:"left",icon:"border_left",labelKey:"table.borders.left"},{value:"right",icon:"border_right",labelKey:"table.borders.right"},{value:"none",icon:"border_clear",labelKey:"table.borders.none"}],qI=[{value:"single",labelKey:"table.borderStyles.single",previewClass:"docx-table-line--single"},{value:"dashed",labelKey:"table.borderStyles.dashed",previewClass:"docx-table-line--dashed"},{value:"dotted",labelKey:"table.borderStyles.dotted",previewClass:"docx-table-line--dotted"},{value:"double",labelKey:"table.borderStyles.double",previewClass:"docx-table-line--double"},{value:"triple",labelKey:"table.borderStyles.triple",previewClass:"docx-table-line--triple"},{value:"thick",labelKey:"table.borderStyles.thick",previewClass:"docx-table-line--thick"}],AN=[{size:4,labelKey:"table.borderWidths.halfPt",previewThickness:.5},{size:8,labelKey:"table.borderWidths.onePt",previewThickness:1},{size:12,labelKey:"table.borderWidths.oneHalfPt",previewThickness:1.5},{size:16,labelKey:"table.borderWidths.twoPt",previewThickness:2},{size:24,labelKey:"table.borderWidths.threePt",previewThickness:3}];function FN(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function LN(e){return e==="none"||FN(e)}function _I(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function NN(e){return qI.some(t=>t.value===e)}function ei(e,t,n){switch(t){case "table.borderTarget":return LN(n)?n==="none"?{command:{type:"setTableBorders",scope:"none",target:e.activeTarget},nextDraft:e}:{command:{type:"setTableBorders",scope:n,spec:e.spec},nextDraft:{activeTarget:n,spec:e.spec}}:null;case "table.borderColor":{if(!_I(n))return null;let r={...e.spec,color:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.borderStyle":{if(!NN(n))return null;let r={...e.spec,style:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.borderWidth":{if(typeof n!="number"||!Number.isInteger(n))return null;let r={...e.spec,size:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.cellFill":return n!==null&&!_I(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function hm(e,t=Wi){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return ei(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return ei(t,e,"single")?.command??null;case "table.borderWidth":return ei(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function DN(e){return $I.find(n=>n.value===e)?.labelKey??"table.borders.all"}function HN(e){return de[e]}function lo(e){return e.surface??null}var _N={"review.revisionMarkup":{type:"openRevisionMarkupDialog"},"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.protectDocument":{type:"toggleDocumentProtection"},"review.simpleMarkup":{type:"setReviewDisplayMode",mode:"simple-markup"},"review.allMarkup":{type:"setReviewDisplayMode",mode:"all-markup"},"review.noMarkup":{type:"setReviewDisplayMode",mode:"proposed"},"review.original":{type:"setReviewDisplayMode",mode:"original"},"review.previousChange":{type:"navigateReviewChange",direction:"previous"},"review.nextChange":{type:"navigateReviewChange",direction:"next"},"review.acceptAllChanges":{type:"resolveAllReviewChanges",action:"accept"},"review.rejectAllChanges":{type:"resolveAllReviewChanges",action:"reject"},"history.undo":{type:"undo"},"history.redo":{type:"redo"},"text.bold":{type:"toggleMark",mark:"bold"},"text.italic":{type:"toggleMark",mark:"italic"},"text.underline":{type:"toggleMark",mark:"underline"},"text.strike":{type:"toggleMark",mark:"strike"},"script.super":{type:"toggleMark",mark:"superscript"},"script.sub":{type:"toggleMark",mark:"subscript"},"format.clear":{type:"clearFormatting"},"alignment.left":{type:"setAlignment",align:"left"},"alignment.center":{type:"setAlignment",align:"center"},"alignment.right":{type:"setAlignment",align:"right"},"alignment.justify":{type:"setAlignment",align:"justify"},"direction.ltr":{type:"setParagraphDirection",direction:"ltr"},"direction.rtl":{type:"setParagraphDirection",direction:"rtl"},"list.bullet":{type:"toggleList",kind:"bullet"},"list.numbered":{type:"toggleList",kind:"ordered"},"list.indent":{type:"adjustIndent",direction:"increase"},"list.outdent":{type:"adjustIndent",direction:"decrease"},"insert.textBox":{type:"insertTextBox"},"insert.footnote":{type:"insertNote",noteKind:"footnote"},"insert.endnote":{type:"insertNote",noteKind:"endnote"},"insert.pageNumber":{type:"insertPageField",field:"PAGE"},"insert.totalPages":{type:"insertPageField",field:"NUMPAGES"},"insert.sectionPages":{type:"insertPageField",field:"SECTIONPAGES"},"insert.pageXofY":{type:"insertPageField",field:"PAGE_X_OF_Y"},"insert.pageBreak":{type:"insertBreak",kind:"page"},"insert.sectionBreakNextPage":{type:"insertBreak",kind:"section"},"insert.sectionBreakContinuous":{type:"insertBreak",kind:"sectionContinuous"},"insert.toc":{type:"insertToc"},"contentControl.remove":{type:"removeContentControl"}};function BN(e){return KI[e]??null}var VI=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),KI={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:VI,mime:"image/png",widthPoints:72,heightPoints:72},"image.properties":{type:"setImageProperties",description:"probe"},"table.insert":{type:"insertTable",rows:1,cols:1},"file.pageSetup":{type:"setPageSetup",orientation:"portrait"},"paragraph.dialog":{type:"setParagraphFormat",alignment:"left"}};function Kd(e){return _N[e]??null}var $N={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},jI={"font.family":"Arial","font.size":22,"text.color":"000000","text.highlight":"yellow","styles.style":"Normal","list.lineSpacing":1,"image.wrap":"square","image.altText":"probe alt text"};function WI(e,t,n){return ei(n,e,t)?.command??null}function Vd(e,t){if(e==="review.editingMode")return {type:"setEditingMode",mode:t};if(e==="styles.style")return {type:"setParagraphStyle",styleId:t};if(e==="list.lineSpacing")return {type:"setLineSpacing",rule:"multiple",value:t};if(Ts(e))return WI(e,t,Wi);if(e==="image.wrap")return typeof t!="string"||!Ed$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=$N[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function ZI(e,t,n=Wi){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=hm(t,n);if(!r)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let o=e.can(r);return o.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:o.reason,active:false}}var qN=["editing","suggesting","viewing"];function VN(e){let t="review.addComment",n=o=>({id:t,enabled:false,disabledReason:o,active:false}),r=e.can({type:"toggleReviewPane"});return r.ok?(e.getEditingMode?.()??"editing")==="viewing"?n("the document is open for viewing"):e.getSelectionPlacement()===null?n("a comment needs a selected range"):{id:t,enabled:true,disabledReason:null,active:false}:n(r.reason)}function UI(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(Ts(t))return ZI(e,t);if(t==="review.editingMode"){let i=e.getEditingMode?.()??"editing",a=qN.filter(d=>d!==i).map(d=>e.can(Vd(t,d))),s=a.some(d=>d.ok),l=a.find(d=>!d.ok);return {id:t,enabled:s,disabledReason:!s&&l&&!l.ok?l.reason:null,active:false,value:i}}if(t==="format.painter"){let i=lo(e);if(!i)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let a=i.formatPainter.state();if(a.mode!=="off")return {id:t,enabled:true,disabledReason:null,active:true,value:a.mode};let s=e.can({type:"clearFormatting"});return s.ok?{id:t,enabled:true,disabledReason:null,active:false,value:a.mode}:{id:t,enabled:false,disabledReason:s.reason,active:false,value:a.mode}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let i=lo(e),a=i?.state().contentControls,s=t==="contentControl.showAll"?a?.showAll??false:a?.formFill??false;return {id:t,enabled:i!==null,disabledReason:i?null:"editor is not ready",active:s}}if(t==="contentControl.inspector"){let i=lo(e);return i?i.state().contentControls.activeControlId?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:"no content control at the selection",active:false}:{id:t,enabled:false,disabledReason:"editor is not ready",active:false}}if(t==="review.addComment")return VN(e);if(t==="review.authors"){let i=e.can({type:"toggleReviewPane"});return i.ok?(e.getReviewAuthors?.().length??0)>0?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:"the document has no review authors",active:false}:{id:t,enabled:false,disabledReason:i.reason,active:false}}let n=Kd(t);if(!n){let i=jI[t];if(i!==void 0){let s=Vd(t,i);if(!s)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let l=e.can(s),d=e.getSelectedImage?.()??null,c=t==="image.wrap"?d?.wrap:t==="image.altText"?d?.description:kw(e,t);return l.ok?{id:t,enabled:true,disabledReason:null,active:false,...c!==void 0?{value:c}:{}}:{id:t,enabled:false,disabledReason:l.reason,active:false,...c!==void 0?{value:c}:{}}}let a=KI[t];if(a){if(t==="image.insert"&&a.type==="insertImage"){let l=e.canExecuteImageCommand?.({type:"insertImage",data:VI,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(a);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="image.properties"&&a.type==="setImageProperties"){let l=e.can(a);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="table.insert"&&a.type==="insertTable"){let l=e.can(a);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="paragraph.dialog"&&a.type==="setParagraphFormat"){let l=e.can(a);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}let s=e.can(a);if(!s.ok)return {id:t,enabled:false,disabledReason:s.reason,active:false}}return t==="file.exportMarkdown"||t==="file.exportPdf"?{id:t,enabled:false,active:false,disabledReason:"export is not a command; run it with runChromeExport(editor, format, handlers)"}:t==="file.print"?{id:t,enabled:false,active:false,disabledReason:"print is not a command; run it with runChromePrint(editor, handlers)"}:t==="file.save"?{id:t,enabled:false,disabledReason:"save is not a command; run it with runSave(editor)",active:false}:t==="file.open"?{id:t,enabled:false,disabledReason:"open is not a command; run it with editor.load(bytes)",active:false}:{id:t,enabled:false,disabledReason:"not wired to an editor command",active:false}}let r=e.can(n),o=e.isActive?.(n)??false;return r.ok?{id:t,enabled:true,disabledReason:null,active:o}:{id:t,enabled:false,disabledReason:r.reason,active:o}}function KN(e){if(e==="format.painter")return true;let t=Kd(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="toggleDocumentProtection"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"||t?.type==="setParagraphDirection"}function jN(e,t){return t.map(n=>UI(e,n))}function WN(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=ei(r,t,n);if(!o)return {result:{ok:false,code:"unsupported",reason:"invalid table chrome value"},nextDraft:null};let i=e.can(o.command);if(!i.ok)return {result:{ok:false,code:i.code,reason:i.reason},nextDraft:null};let a=e.exec(o.command);return a.ok?{result:a,nextDraft:o.nextDraft}:{result:a,nextDraft:null}}var ZN=new Set(["format.painter","contentControl.showAll","contentControl.formFill","contentControl.inspector","contentControl.remove"]);function UN(e,t,n,r){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(n&&typeof n=="object"&&("historyGroup"in n||"scope"in n||Object.keys(n).length===0)){if(r||jI[t]!==void 0||Ts(t))return {ok:false,code:"invalidArgs",reason:"pass a toolbar value before command options"};r=n,n=void 0;}if(r?.historyGroup!==void 0&&ZN.has(t))return {ok:false,code:"unsupported",reason:`${t} does not take a history group`};if(t==="format.painter"){let a=lo(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(a.formatPainter.state().mode==="off"){let s=e.can({type:"clearFormatting"});if(!s.ok)return {ok:false,code:s.code,reason:s.reason}}return a.formatPainter.press()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:Cd}}if(t==="contentControl.showAll"){let a=lo(e);return a?(a.contentControls.setShowAll(!a.contentControls.showAll()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.formFill"){let a=lo(e);return a?(a.contentControls.setFormFill(!a.contentControls.formFill()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.inspector"){let a=lo(e);return a?a.state().contentControls.activeControlId?{ok:true,changed:false}:{ok:false,code:"notFound",reason:"no content control at the selection"}:{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.remove"){let a=lo(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let s=a.state().contentControls.activeControlId;if(!s)return {ok:false,code:"notFound",reason:"no content control at the selection"};let l=a.contentControls.disabledReason(s,"remove");return l?{ok:false,code:l==="bound"?"bound":"locked",reason:l}:a.contentControls.remove(s)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let o=n===void 0?Kd(t):Vd(t,n);if(!o)return n!==void 0?{ok:false,code:"unsupported",reason:"invalid value for toolbar command"}:t==="file.exportMarkdown"||t==="file.exportPdf"?{ok:false,code:"unsupported",reason:"export is not a command; run it with runChromeExport(editor, format, handlers)"}:t==="file.print"?{ok:false,code:"unsupported",reason:"print is not a command; run it with runChromePrint(editor, handlers)"}:t==="file.save"?{ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"}:t==="file.open"?{ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"}:{ok:false,code:"unsupported",reason:"not wired to an editor command"};let i=e.can(o,r);return i.ok?e.exec(o,r):{ok:false,code:i.code,reason:i.reason}}function zN(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function GN(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=$d(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function XN(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let r=e.can(t,n);return r.ok?e.exec(t,n):{ok:false,code:r.code,reason:r.reason}}function ym(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(ym):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,ym(e[t])]))}function YN(e){return JSON.stringify(ym(e))}var bm=["zoom","script","format","list","alignment","styles","font","text","history"],QN=new Set(["review"]),GI=24,XI=new Set;function YI(e,t=bm){let n=t.indexOf(e);return n===-1?void 0:(n+1)*10}function JN(e,t=bm,n){let r=[],o=[];return e.forEach((i,a)=>{let s=n?.get(i)??YI(i,t);s===void 0||Number.isNaN(s)?o.push(i):r.push({id:i,priority:s,position:a});}),r.sort((i,a)=>i.priority-a.priority||a.position-i.position),[...o.reverse(),...r.map(i=>i.id)]}function eD(e,t){let n=[...e],r=new Map,o=t.filter(i=>!e.includes(i.id));for(;o.length>0;){let i=[];for(let a of o){let s=a.after;if(s===void 0||s===a.id){n.push(a.id);continue}if(!n.includes(s)){i.push(a);continue}let l=r.get(s)??s;n.splice(n.indexOf(l)+1,0,a.id),r.set(s,a.id);}if(i.length===o.length){n.push(...i.map(a=>a.id));break}o=i;}return n}var vm=8;function tD(e){let t=e.margin??vm,n=Math.max(0,e.viewportWidth-t*2),r=Math.min(e.panelWidth,n),o=t,i=e.viewportWidth-t-r,a=e.triggerRight-r;if(a>=o&&a<=i)return {left:a,maxWidth:n,anchor:"end"};let s=e.triggerLeft;return s>=o&&s<=i?{left:s,maxWidth:n,anchor:"start"}:{left:Math.max(o,Math.min(a,i)),maxWidth:n,anchor:"clamped"}}function zI(e,t){let{widths:n,groups:r,order:o,fixed:i,more:a}=e,s=i;for(let d of r)s+=n.get(d)??0;if(s<=t)return XI;s+=a;let l=new Set;for(let d of o){if(s<=t)break;let c=n.get(d);c===void 0||l.has(d)||(l.add(d),s-=c);}return l}function QI(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}var nD=QI;function rD(e){if(!(e.available>0))return XI;let t=zI(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let r=zI(e,e.available-(e.hysteresis??GI));return QI(r,n)?n:r}function oD(e){let t=e.margin??vm,n=e.viewportWidth-t-e.popupWidth;return Math.max(t,Math.min(e.anchorLeft,n))}function iD(e,t,n,r){return e+t+n+r*2}function aD(e,t){return e+t}function sD(e,t){return e+t}function lD(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function Zn(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function dD(e){return Zn(e.columnGap)}function JI(e){if(!(e.parentContent>0))return e.own;let t=e.parentContent-e.siblings-e.margins;return e.maxWidth!==null&&(t=Math.min(t,e.maxWidth)),Math.max(e.own,t-e.chrome)}function ek(e){return e.position==="absolute"||e.position==="fixed"||e.display==="none"}function tk(e){let t=e.computedStyleMap;if(typeof t!="function")return null;try{return t.call(e)}catch{return null}}function xm(e,t){let n=e?.get(t);return n&&typeof n.value=="string"?n.value:null}var cD=new Set(["auto","max-content","fit-content","min-content"]);function nk(e){return e.display.includes("flex")&&!e.flexDirection.startsWith("column")&&!e.flexWrap.startsWith("wrap")}function Wd(e,t,n){return xm(e,`margin-${n}`)==="auto"?0:Zn(n==="left"?t.marginLeft:t.marginRight)}function uD(e){return /^(input|textarea|select|button|img|video|canvas|iframe|svg)$/i.test(e.tagName)?true:e.children.length>0||(e.textContent??"").trim().length>0}function fD(e,t,n){let r=t.flexBasis.trim(),o=r.endsWith("px")?Zn(r):0,i=xm(n,"min-width")??t.minWidth.trim();return i==="auto"||i===""?uD(e)?null:o:/^[\d.]+px$/.test(i)?Math.max(o,Zn(i)):null}function rk(e,t,n){for(let r of e.childNodes){if(r.nodeType===3&&(r.textContent??"").trim().length>0)return false;if(!(r instanceof Element))continue;let o=getComputedStyle(r);if(o.display==="contents"){if(!rk(r,t,n))return false;continue}if(ek(o)||(n.items+=1,r===t))continue;let i=tk(r),s=Number.parseFloat(o.flexGrow)>0?fD(r,o,i):r.getBoundingClientRect().width;if(s===null)return false;n.width+=s+Wd(i,o,"left")+Wd(i,o,"right");}return true}function pD(e,t){if(!nk(t)||!e.parentElement)return 0;let n={width:0,items:0};return rk(e.parentElement,e,n)?n.width+Math.max(0,n.items-1)*Zn(t.columnGap):null}function mD(e,t,n){let r=e.maxWidth.trim();if(r==="none"||r==="")return null;let o;if(/^-?[\d.]+%$/.test(r))o=Number.parseFloat(r)/100*t;else if(/^-?[\d.]+px$/.test(r))o=Number.parseFloat(r);else return;if(Number.isFinite(o))return e.boxSizing==="border-box"?o:o+n}var gD="[data-toolbar-group], [data-toolbar-fixed], [data-toolbar-more]";function ok(e,t){let n=e.getBoundingClientRect();if(!(n.width>0))return null;let r=n.left+e.clientLeft+Zn(t.paddingLeft),o=n.left+e.clientLeft+e.clientWidth-Zn(t.paddingRight);for(let i of e.querySelectorAll(gD)){let a=i.getBoundingClientRect();if(a.width!==0&&(a.right>o+1||a.left<r-1))return true}return false}var Cs=new WeakMap,jd=new WeakMap;function hD(e,t,n,r){let o=e.parentElement;if(!o||ek(t)||(t.cssFloat||t.getPropertyValue("float")||"none")!=="none")return null;let i=tk(e),a=xm(i,"width");if(a===null||!cD.has(a))return null;let s=getComputedStyle(o),l=nk(s),d=s.display.includes("flex")&&s.flexDirection.startsWith("column"),c=(s.display==="block"||s.display==="flow-root"||d)&&!t.display.startsWith("inline");if(!l&&!c||l&&Number.parseFloat(t.flexGrow)>0)return null;let u=o.clientWidth-Zn(s.paddingLeft)-Zn(s.paddingRight),p=Math.max(0,e.offsetWidth-e.clientWidth)+r,m=pD(e,s),h=mD(t,u,p);return m===null||h===void 0?null:{room:JI({own:n,parentContent:u,siblings:m,margins:Wd(i,t,"left")+Wd(i,t,"right"),chrome:p,maxWidth:h}),parentContent:u}}function yD(e,t){let n=Zn(t.paddingLeft)+Zn(t.paddingRight),r=e.clientWidth-n,o=hD(e,t,r,n);if(!o)return Cs.delete(e),jd.delete(e),r;let i=Cs.get(e);if(i&&i.parentContent!==o.parentContent&&Cs.delete(e),ok(e,t)===true)return jd.get(e)&&Cs.set(e,{parentContent:o.parentContent,cap:r}),jd.set(e,false),r;let a=Cs.get(e)?.cap??Number.POSITIVE_INFINITY,s=Math.max(r,Math.min(o.room,a));return jd.set(e,s>r),s}var bD=/^[a-z]$/;function Sm(e){let t=e.key.toLowerCase();if(bD.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function ik(e){let t=[],n=r=>{for(let o of r)o.kind==="item"?t.push(o.slot):o.kind==="submenu"&&n(o.items);};for(let r of e)n(r.entries);return t}var ak={id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:de.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:de.file_download,state:{kind:"save"}},{id:"exportMarkdown",labelKey:"toolbar.exportMarkdown",paths:de.file_download,state:{kind:"export"}},{id:"exportPdf",labelKey:"toolbar.exportPdf",paths:de.file_download,state:{kind:"export"}},{id:"print",labelKey:"toolbar.print",paths:de.print,state:{kind:"export"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:de.settings,state:{kind:"command"}}]};var sk={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"revisionMarkup",shape:"icon",labelKey:"revisionMarkup.title",defaultToolbar:false,paths:de.edit_note,state:{kind:"command"}},{id:"simpleMarkup",shape:"icon",labelKey:"review.simpleMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:de.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:de.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:de.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:de.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:de.format_paragraph,state:{kind:"command"}},{id:"protectDocument",shape:"icon",labelKey:"review.protectDocument",defaultToolbar:false,paths:de.lock,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:de.comment,state:{kind:"command"}},{id:"addComment",shape:"icon",labelKey:"formattingBar.addComment",defaultToolbar:false,paths:de.add_comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:de.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:de.edit_note,state:{kind:"command"}}]};var wm=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:de.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:de.redo,state:{kind:"command"}}]},{id:"zoom",labelKey:"formattingBar.groups.zoom",controls:[{id:"level",shape:"stepper",valueText:"100%",labelKey:"formattingBar.groups.zoom",paths:null,valueKey:"zoom.zoomLevel",state:{kind:"command"}}]},{id:"styles",labelKey:"formattingBar.groups.styles",controls:[{id:"style",shape:"dropdown",labelKey:"styles.selectAriaLabel",paths:null,valueKey:"styles.normalText",state:{kind:"value"}}]},{id:"font",labelKey:"formattingBar.groups.font",controls:[{id:"family",shape:"dropdown",labelKey:"font.selectAriaLabel",paths:null,valueKey:"font.sansSerif",state:{kind:"value"}},{id:"size",shape:"stepper",valueText:"11",labelKey:"fontSize.listLabel",paths:null,valueKey:"fontSize.label",state:{kind:"value"}}]},{id:"text",labelKey:"formattingBar.groups.textFormatting",controls:[{id:"bold",labelKey:"formattingBar.boldShortcut",paths:de.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:de.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:de.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:de.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:de.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:de.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:de.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:de.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:de.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:de.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:de.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:de.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:de.format_align_justify,state:{kind:"command"}}]},{id:"direction",labelKey:"formattingBar.groups.direction",contextual:true,controls:[{id:"ltr",labelKey:"toolbar.leftToRight",paths:de.format_textdirection_l_to_r,state:{kind:"command"}},{id:"rtl",labelKey:"toolbar.rightToLeft",paths:de.format_textdirection_r_to_l,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:de.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:de.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:de.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:de.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:de.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:de.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:de.format_clear,state:{kind:"command"}}]},sk,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:de.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:de.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:de.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:de.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:de.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:de.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:de.wrap_text,valueKey:"imageWrap.inline",state:{kind:"value"}},{id:"altText",shape:"dropdown",labelKey:"formattingBar.altText",paths:null,valueKey:"imageProperties.altText",state:{kind:"value"}}]},{id:"table",labelKey:"formattingBar.groups.table",contextual:true,controls:[{id:"insert",labelKey:"toolbar.table",paths:de.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:de.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:de.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:de.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:de.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:de.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:de.format_line_spacing,state:{kind:"command"}}]},ak,{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"textBox",labelKey:"toolbar.insertTextBox",paths:de.format_shapes,state:{kind:"command"}},{id:"footnote",labelKey:"toolbar.insertFootnote",paths:de.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:de.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:de.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:de.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:de.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:de.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:de.toc,state:{kind:"command"}}]}],lk=wm;function vD(e,t){return `${e.id}.${t.id}`}function dk(){return lk.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function xD(e){let t=dk();if(!e)return t;let n=lk.find(r=>r.id==="image");return n?[...t,n]:t}var ck=[{id:"file",labelKey:"toolbar.file",entries:[{kind:"item",slot:"file.open",shortcutKey:"toolbar.openShortcut"},{kind:"item",slot:"file.save",labelKey:"toolbar.save",shortcutKey:"toolbar.saveShortcut"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.export",paths:de.file_download,items:[{kind:"item",slot:"file.exportMarkdown"},{kind:"item",slot:"file.exportPdf"}]},{kind:"item",slot:"file.print",shortcutKey:"toolbar.printShortcut"},{kind:"item",slot:"file.pageSetup"}]},{id:"format",labelKey:"toolbar.format",entries:[{kind:"item",slot:"text.bold",labelKey:"formattingBar.bold"},{kind:"item",slot:"text.italic",labelKey:"formattingBar.italic"},{kind:"item",slot:"text.underline",labelKey:"formattingBar.underline"},{kind:"item",slot:"text.strike"},{kind:"separator"},{kind:"item",slot:"alignment.left"},{kind:"item",slot:"alignment.center"},{kind:"item",slot:"alignment.right"},{kind:"item",slot:"alignment.justify"},{kind:"separator"},{kind:"item",slot:"direction.ltr"},{kind:"item",slot:"direction.rtl"},{kind:"separator"},{kind:"item",slot:"paragraph.dialog"},{kind:"separator"},{kind:"item",slot:"format.painter",labelKey:"formattingBar.formatPainter"},{kind:"item",slot:"format.clear"}]},{id:"insert",labelKey:"toolbar.insert",entries:[{kind:"item",slot:"image.insert"},{kind:"item",slot:"insert.textBox"},{kind:"item",slot:"table.insert",picker:"tableGrid"},{kind:"separator"},{kind:"item",slot:"insert.footnote"},{kind:"item",slot:"insert.endnote"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.break",paths:de.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"review",labelKey:"toolbar.review",entries:[{kind:"submenu",labelKey:"review.displayForReview",paths:de.visibility,items:[{kind:"item",slot:"review.simpleMarkup"},{kind:"item",slot:"review.allMarkup"},{kind:"item",slot:"review.noMarkup"},{kind:"item",slot:"review.original"}]},{kind:"separator"},{kind:"item",slot:"review.revisionMarkup"},{kind:"item",slot:"review.previousChange"},{kind:"item",slot:"review.nextChange"},{kind:"separator"},{kind:"item",slot:"review.acceptAllChanges"},{kind:"item",slot:"review.rejectAllChanges"},{kind:"separator"},{kind:"item",slot:"review.paragraphMarks"},{kind:"separator"},{kind:"item",slot:"review.protectDocument"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function SD(){return ik(ck)}function wD(){return wm.reduce((e,t)=>e+t.controls.length,0)}var ID="formattingBar.unavailableInPreview";var Zd=class{constructor(t,n,r,o){this.selection=n;this.part=r;this.revision=o;this.position=t?ll(t):void 0;}selection;part;revision;entries=new WeakMap;position;save(){let t=this.part(),n=o=>{let i=Ta(t,o.paragraphId);return {nodeId:o.paragraphId,stableId:i&&i.kind!=="textValue"?wb(i):null,offset:o.offset}},r=this.selection();return {partName:t.name,anchor:n(r.anchor),head:n(r.head)}}begin(){if(!this.position)return ()=>{};let t=this.revision(),n=this.save();return ()=>{let r=this.position.current();!r||t===this.revision()||this.entries.set(r,{before:this.entries.get(r)?.before??n,after:this.save()});}}step(t,n){let r=this.position?.current(),o=n(),i=t==="undo"?r:this.position?.current(),a=i?this.entries.get(i):void 0,s=t==="undo"?a?.before:a?.after;return {changed:o,selection:s?this.resolve(s):null}}resolve(t){let n=this.part();if(n.name!==t.partName)return null;let r=new Map,o=[n.root];for(;o.length;){let l=o.pop();for(let c of l.children)c.kind!=="textValue"&&o.push(c);if(l.kind!=="paragraph")continue;let d=wb(l);d&&r.set(d,l.id);}let i=l=>{let d=l.stableId?r.get(l.stableId):l.nodeId;return d?{paragraphId:d,offset:l.offset}:null},a=i(t.anchor),s=i(t.head);return a&&s?{anchor:a,head:s}:null}};var kD=new Set(["Shift","Control","Alt","AltGraph","Meta","OS","Hyper","Super","Symbol","Fn","FnLock","CapsLock","NumLock","ScrollLock","SymbolLock"]),RD=["opening","fonts","drawing-resources"];function uk(e){return !kD.has(e.key)}function fk(e){return e.paragraphIds.size>0||!RD.some(t=>e.dependencyKeys.has(t))}var PD=new Set;function Es(e,t){let n=qd$1(e,t.displayMode,t.authorFilter),r=sc$1(n);if(r===n)return PD;let o=new Set(n.map(i=>i.id));return new Set(r.flatMap(i=>o.has(i.id)?[]:[i.id]))}function TD(e,t,n){let r=qd$1(e,n.displayMode,n.authorFilter),o=sc$1(r);if(o===r)return null;let i=new Set(r.map(l=>l.id));if(i.has(t))return null;let a=o.findIndex(l=>l.id===t);if(a===-1)return null;let s=o.slice(a+1).find(l=>i.has(l.id));return s?.kind==="paragraph"?s.id:null}function CD(e,t,n,r){let o=d=>e.findIndex(c=>c.kind!=="textValue"&&c.id===d),i=o(t),a=o(n);if(i===-1||a<=i)return null;let s=[];for(let d=i+1;d<a;d+=1){let c=e[d];if(c.kind==="textValue")return null;s.push(c.id);}if(s.length===0)return s;let l=r();return s.every(d=>l.has(d))?s:null}function pk(e,t,n,r){let o=Ua$1(e,t);if(o===null||Ua$1(e,n)?.id!==o.id)return null;let i=CD(o.children,t,n,()=>Es(o.children,r));return i===null?null:[...i,n].map(a=>({op:"joinParagraphs",firstId:t,secondId:a}))}function mk(e,t,n,r){if(vd$1(e,n.paragraphId).length>0)return n;let o=Ua$1(t,n.paragraphId);if(o===null)return n;let i=TD(o.children,n.paragraphId,r);return i===null?n:{paragraphId:i,offset:0}}function ED(e,t,n,r,o){if(vd$1(e,n.paragraphId).length>0)return null;let i=Ua$1(t,n.paragraphId);if(i===null||!Es(i.children,r).has(n.paragraphId))return null;let a=i.children,s=a.findIndex(c=>c.kind!=="textValue"&&c.id===n.paragraphId),l;for(let c=s-1;c>=0&&l===void 0;c-=1)a[c].kind!=="textValue"&&(l=a[c]);if(l===void 0||l.kind!=="paragraph")return null;let d=o==="backward"?{paragraphId:l.id,offset:(Vi$1(t,l.id)??"").length}:mk(e,t,n,r);return {ops:[{op:"joinParagraphs",firstId:l.id,secondId:n.paragraphId}],caret:d}}function OD(e,t,n){let r=Ua$1(e,t);if(r===null)return null;let o=r.children,i=o.findIndex(l=>l.kind!=="textValue"&&l.id===t);if(i===-1)return null;let a=null,s=[];for(let l=i+1;l<o.length;l+=1){let d=o[l];if(d.kind!=="textValue"){if(a??=Es(o,n),!a.has(d.id))break;s.push({op:"joinParagraphs",firstId:t,secondId:d.id});}}return s.length>0?s:null}function gk(e){let t=n=>mk(e.layout(),e.part(),n,e.view());return {joinOps:(n,r)=>pk(e.part(),n,r,e.view()),forwardJoinOps:(n,r)=>pk(e.part(),n,r,e.view())??OD(e.part(),n,e.view()),shown:t,removedCaretEdit:(n,r)=>ED(e.layout(),e.part(),n,e.view(),r),shownRange:n=>{let{from:r,to:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let i=t(r);return i===r?n:{from:i,to:i}},shownSelection:n=>{let{anchor:r,head:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let i=t(o);return i===o?n:{...n,anchor:i,head:i}}}}var hk="\uFFFC";function MD(e,t){let n=new Map,r=new Set,o=vd$1(e,t),i=o[0],a=i&&e.pages.find(l=>l.index===i.pageIndex),s=i&&[a?.header,a?.footer].some(l=>l?ya(l.fragments).some(d=>d.lines.includes(i.line)):false);for(let{line:l,pageIndex:d}of o)if(!(s&&d!==i.pageIndex)&&!r.has(l)){r.add(l);for(let c of Na(l,t)?.spans??[])!c.fieldAtom&&!c.projected||c.range.end-c.range.start===1&&n.set(c.range.start,(n.get(c.range.start)??"")+c.text);}for(let[l,d]of n)d.length<=1&&n.delete(l);return n}function Os(e,t){let n=new Map,r=i=>{let a=n.get(i);return a||n.set(i,a=MD(e,i)),a},o=i=>{let a=t(e,i).split("");for(let s of r(i).keys())s<a.length&&(a[s]=hk);return a};return {markedText:(i,a)=>o(a).join(""),resultAt:(i,a)=>r(i).get(a)??null,spelledText:(i,a)=>{let s=r(a);return o(a).map((l,d)=>l===hk?s.get(d)??l:l).join("")}}}var AD=/[\p{L}\p{N}_'’]/u,yk=e=>e!==void 0&&AD.test(e);function Ud(e,t,n){let r=qe$1(e,t.paragraphId),o=t.paragraphId,i=Math.max(0,Math.min(t.offset,r.length)),a=-1;if(yk(r[i])?a=i:i>0&&yk(r[i-1])&&(a=i-1),a===-1){let s=i,l=i;for(;s>0&&/\s/.test(r[s-1]??"");)s-=1;for(;l<r.length&&/\s/.test(r[l]??"");)l+=1;return s===l&&l<r.length&&(l+=1),{from:{paragraphId:o,offset:s},to:{paragraphId:o,offset:l}}}return {from:{paragraphId:o,offset:ie(r,a+1,-1,n)},to:{paragraphId:o,offset:ie(r,a,1,n)}}}function We(e){return {anchor:e,head:e}}function ti(e){if(e.anchor.paragraphId!==e.head.paragraphId)return null;let t=Math.min(e.anchor.offset,e.head.offset),n=Math.max(e.anchor.offset,e.head.offset);return {paragraphId:e.head.paragraphId,start:t,end:n}}function zd(e,t,n){let{anchor:r,head:o}=t;if(r.paragraphId===o.paragraphId)return r.offset<=o.offset?{from:r,to:o}:{from:o,to:r};let i=n??Ra(e);return i.indexOf(r.paragraphId)<=i.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function co(e,t,n){let r=t[0],o=i=>{let a=t.includes(i.paragraphId),s=a?i.paragraphId:r??i.paragraphId,l=a?i.offset:0,d=qe$1(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,d))}};return {anchor:o(n.anchor),head:o(n.head)}}function Im(e,t,n,r,o,i=qe$1){let a=(p,m,h)=>o===void 0||!m.includes("\uFFFC")?m:m.replace(/\uFFFC/g,(b,y)=>o(p,h+y)??b);if(t.paragraphId===n.paragraphId)return a(t.paragraphId,i(e,t.paragraphId).slice(t.offset,n.offset),t.offset);let s=r??Ra(e),l=s.indexOf(t.paragraphId),d=s.indexOf(n.paragraphId);if(l===-1||d===-1)return "";let c=s.slice(l,d+1),u=a(t.paragraphId,i(e,t.paragraphId).slice(t.offset),t.offset);for(let p=1;p<c.length;p+=1){let m=c[p],h=i(e,m),b=Oa(e,m).includes(c[p-1])?"":`
22
- `;u+=b+a(m,p===c.length-1?h.slice(0,n.offset):h,0);}return u}function vk(e,t,n,r){let o=Os(e,qe$1);return Im(e,t,n,r,o.resultAt,o.markedText)}function xk(e,t){return ja(e,t,Os(e,qe$1).spelledText)}function km(e){let t=[],n=r=>{if(r.kind!=="textValue"){r.kind==="paragraph"&&t.push(r.id);for(let o of r.children)n(o);}};return n(e),t}function Sk(e){return e.kind}function wk(e){return e.kind!=="textValue"&&Sk(e)==="contentControl"}function bk(e){return e.kind!=="textValue"&&Sk(e)==="contentControlContent"}function FD(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let i=km(o);if(i.length>0&&i.every(a=>t.has(a))){n.set(o.id,i);return}}for(let i of o.children)r(i);}};return r(e.root),n}function LD(e,t,n){let r=new Set,o=(i,a)=>{if(i.kind!=="textValue"){if(i.kind==="table"&&n.has(i.id)){for(let s of i.children)o(s,true);return}if(wk(i)){let s=km(i);!a&&s.length>0&&s.every(l=>t.has(l))&&r.add(i.id);for(let l of i.children)o(l,a);return}for(let s of i.children)o(s,a);}};return o(e.root,false),r}function Ik(e,t,n,r,o,i){let a=new Set;for(let s=n;s<=r;s+=1){let l=t[s];(s===n?o.offset===0&&(s!==r||i.offset===e(l).length):s!==r||i.offset===e(l).length)&&a.add(l);}return a}function ND(e,t,n){let r=[],o=i=>{if(i.kind!=="textValue"){if(i.kind==="table"||wk(i)){let s=km(i).filter(l=>n.has(l));if(s.length>0&&s.every(l=>t.has(l))){r.push(i.id);return}}for(let a of i.children)o(a);}};return o(e.root),r}function kk(e,t,n,r,o){let i=p=>qe$1(e,p);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let a=o??Ra(e),s=a.indexOf(n.paragraphId),l=a.indexOf(r.paragraphId);if(s===-1||l===-1||s>l)return null;let d=a.slice(s,l+1),c=Ik(i,a,s,l,n,r),u=a[l];return {partName:t.name,paragraphIds:d,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...c],fullyCoveredBlockIds:ND(t,c,new Set(a)),lastMarkCovered:r.offset===i(u).length}}function Rk(e,t,n,r,o,i={displayMode:e.displayMode??"all-markup",authorFilter:void 0}){let a=w=>qe$1(e,w);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let s=o??Ra(e),l=s.indexOf(n.paragraphId),d=s.indexOf(r.paragraphId);if(l===-1||d===-1)return {ops:[],collapseTo:n};let c=Ik(a,s,l,d,n,r),u=FD(t,c),p=new Map;for(let[w,I]of u)for(let L of I)p.set(L,w);let m=LD(t,c,u),h=l;if(p.has(n.paragraphId)){h=-1;for(let w=l+1;w<=d;w+=1)if(!p.has(s[w])){h=w;break}if(h===-1){let w=p.get(n.paragraphId);for(let I of u.get(w)??[])p.delete(I);u.delete(w),h=l;}}let b=s[h],y=h===l?n:{paragraphId:b,offset:0},g=[];for(let w=l;w<=d;w+=1){let I=s[w];if(p.has(I))continue;let L=a(I).length,A=w===l?n.offset:0,B=w===d?r.offset:L;A<B&&g.push({op:"deleteText",paragraphId:I,start:A,end:B});}for(let w of u.keys())g.push({op:"deleteBlock",blockId:w});for(let w of m)g.push({op:"removeContentControl",controlId:w});let x=w=>{let I=Ua$1(t,w);for(;I&&bk(I);){let L=Ua$1(t,I.id);if(!L||!m.has(L.id))break;I=Ua$1(t,L.id);}return I},v=new Map,k=w=>{let I=v.get(w.id);return I||v.set(w.id,I=Es(w.children,i)),I},P=w=>{let I=[],L=A=>{for(let B of A)if(B.kind!=="textValue"&&!u.has(B.id)){if(m.has(B.id)){let $=B.children.find(bk);$&&$.kind!=="textValue"&&L($.children);continue}if(B.kind==="paragraph"){I.push(B.id);continue}I.push(`\0barrier:${B.id}`);}};return L(w.children),I},T=(w,I)=>{let L=x(w);if(!L||x(I)!==L)return null;let A=P(L),B=A.indexOf(w),$=A.indexOf(I);if(B===-1||$<=B)return null;let j=A.slice(B+1,$);if(j.length===0)return j;let R=k(L);return j.every(G=>R.has(G))?j:null},C=b,E=b;for(let w=h+1;w<=d;w+=1){let I=s[w];if(p.has(I))continue;let L=T(E,I);if(L)for(let A of [...L,I])g.push({op:"joinParagraphs",firstId:C,secondId:A});else C=I;E=I;}return {ops:g,collapseTo:y}}function Pk(e,t,n,r){return t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset?[]:we(e,t,n(),r)}function Rm(e,t){if(!e)return null;let n=e.position,r=o=>o.paragraphId===n.paragraphId&&o.offset===n.offset;return r(t.anchor)&&r(t.head)?e:null}function Tk(e,t,n,r){if(n===null||n.length===0)return t?null:void 0;let{anchor:o,head:i}=e;if(!(o.paragraphId!==i.paragraphId||o.offset!==i.offset))return {position:i,properties:n,base:Rm(t,e)?.base??r()}}function Ck(e,t,n){let r=co(t,n,e.selection),o=n.includes(e.selection.head.paragraphId);return {selection:r,format:o&&e.format?{...e.format,position:r.head}:null}}var Gd=class{undo=[];redo=[];moving=false;group;position;constructor(t){this.position=ll(t);}get canUndo(){return this.matches(this.undo.at(-1))}get canRedo(){return this.matches(this.redo.at(-1))}matches(t){return !!t&&!!this.position&&t.anchor===this.position.current()}record(t,n,r){if(!this.position)return;let o=this.undo.at(-1);if(r!==void 0&&r===this.group&&this.matches(o)){this.undo[this.undo.length-1]={...o,after:n},jl(r,"extended");return}this.group=r,this.position.split(),this.redo.length=0,this.undo.push({anchor:this.position.current(),before:t,after:n}),this.undo.length>200&&this.undo.shift(),jl(r,"started");}endGroup(){this.group=void 0;}noteEdit(){this.endGroup(),this.moving||(this.redo.length=0);}step(t,n,r){let o=t==="undo"?this.undo:this.redo,i=t==="undo"?this.redo:this.undo;this.endGroup(),this.moving=true;try{if(this.matches(o.at(-1))){let a=o.pop();i.push(a),n(t==="undo"?a.before:a.after);}else r();}finally{this.moving=false;}}};function Ek(e,t,n,r){let o=e??Ua,i,a,s;return {current:()=>o,filter(){let l=t();return (!s||l!==i||o!==a)&&(i=l,a=o,s={...l,hiddenAuthors:l?.hiddenAuthors??new Set,revisionMarkup:o,cacheKey:`${l?.cacheKey??""}|markup:${JSON.stringify(o)}`}),s},set(l){JSON.stringify(l)!==JSON.stringify(o)&&(n(),o=l,r());}}}function Ok(e){return e?.root.children.some(t=>t.kind!=="textValue"&&(t.localName==="mirrorMargins"||t.localName==="evenAndOddHeaders")&&!t.attributes.some(n=>n.localName==="val"&&["0","false","off"].includes(n.value)))??false}function Mk(e,t,n,r){let o=Ta(e,t);if(o?.kind!=="paragraph")return false;if(!qc$1(o,n,r))return true;let i=Ua$1(e,t);return i?qd$1(i.children,n,r).some(a=>a.kind==="paragraph"&&a.id===t):false}var DD=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]);function Ak(e){return {onDrawingPointerGesture(t){if(t instanceof PointerEvent&&t.button!==0||e.surface.editingMode()==="view")return;let n=t.target instanceof Element?t.target:null,o=!e.textbox()?.preparePointer(n)&&n?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");if(o&&n?.closest(".docx-drawing-textbox")){let i;for(let a of e.surface.layout().pages)if(i=zd$1(a,o),i)break;if(i&&e.surface.selectDrawing(o,i.paragraphId)){t.preventDefault(),t.stopImmediatePropagation();return}}e.setIntent(o?{kind:"pointer",drawingNodeId:o}:{kind:"none"});},onDrawingKeyGesture(t){if(t instanceof KeyboardEvent&&DD.has(t.key))return;if(t instanceof KeyboardEvent&&t.key==="Escape"&&e.textbox()?.active()){e.textbox().exit(),t.preventDefault(),t.stopImmediatePropagation();return}if((t instanceof KeyboardEvent&&(t.key==="Delete"||t.key==="Backspace")&&!t.altKey&&!t.ctrlKey&&!t.metaKey||t instanceof InputEvent&&(t.inputType==="deleteContentBackward"||t.inputType==="deleteContentForward"))&&e.intent().kind==="pointer"){let r=kn(e.surface);if(r!==null){t.preventDefault(),t.stopImmediatePropagation(),e.setIntent({kind:"none"}),e.surface.deleteImage(r.drawingNodeId);return}}e.setIntent({kind:"none"});}}}var Nk=32,Fk=new WeakMap,Lk=new WeakMap,HD=new WeakMap,_D=new WeakMap;function Xd(e){let t=Fk.get(e);if(t)return t;let n=[e.fragments];e.header&&n.push(e.header.fragments),e.footer&&n.push(e.footer.fragments);for(let o of [e.footnotes,e.endnotes])if(o)for(let i of o.notes)n.push(i.fragments);let r={stories:n,sparse:new Map,complete:null};return Fk.set(e,r),r}function Dk(e,t){let n=t?_D:HD,r=n.get(e);return r||(r={fragment:e,indent:{indent:e.indent,inTable:t},emptyStyle:e.emptyParagraphStyle},n.set(e,r)),r}function Hk(e,t){return e?!e.emptyStyle&&t.emptyStyle?{...e,emptyStyle:t.emptyStyle}:e:t}function Ms(e,t,n){let r=e.get(t),o=Hk(r,n);o!==r&&e.set(t,o);}function BD(e,t){let n=(r,o)=>{for(let i of r){if(i.kind==="paragraph"){t(i,o);continue}for(let a of i.rows)if(!a.isHeaderRepeat)for(let s of a.cells)n(s.blocks,true);}};for(let r of e)n(r,false);}function Pm(e){if(e.complete)return e.complete;let t=new Map;BD(e.stories,(n,r)=>{let o=Dk(n,r);for(let i of Pa(n))Ms(t,i,o);});for(let[n,r]of e.sparse)r&&t.set(n,r);return e.sparse.clear(),e.complete=t,t}function $D(e,t){if(e.paragraphId===t)return true;for(let n of e.lines??[])if(n.range.paragraphId===t||n.spans.some(r=>r.range.paragraphId===t)||(n.drawings??[]).some(r=>r.paragraphId===t))return Pa(e).includes(t);return false}function _k(e,t){if(e.complete)return e.complete.get(t);let n=e.sparse.get(t);if(n!==void 0)return n??void 0;if(e.sparse.size>=Nk)return Pm(e).get(t);let r,o=(i,a)=>{for(let s of i){if(s.kind==="paragraph"){if(!$D(s,t))continue;if(r=Hk(r,Dk(s,a)),r.emptyStyle)return true;continue}if(cf(s).has(t)){for(let l of s.rows)if(!l.isHeaderRepeat){for(let d of l.cells)if(o(d.blocks,true))return true}}}return false};for(let i of e.stories)if(o(i,false))break;return e.sparse.set(t,r??null),r}function qD(e,t,n){for(let[r,o]of n)Bk(e,t,r,o);for(let r=0;r<t.frontier;r+=1)for(let[o,i]of Pm(Xd(e.pages[r])))n.has(o)||Ms(t.entries,o,i);t.progress=null;}function Bk(e,t,n,r){for(let o=r;o<t.frontier;o+=1){let i=_k(Xd(e.pages[o]),n);i&&Ms(t.entries,n,i);}}function As(e,t,n=false){let r=Lk.get(e);r||(r={frontier:0,entries:new Map,progress:new Map},Lk.set(e,r));let o=()=>{let s=r.entries.get(t);return s&&(!n||s.emptyStyle)?s:void 0},i=r.progress;if(i&&!i.has(t)&&i.size>=Nk&&qD(e,r,i),r.progress){Bk(e,r,t,r.progress.get(t)??0);let s=o();for(;!s&&r.frontier<e.pages.length;){let l=_k(Xd(e.pages[r.frontier++]),t);l&&Ms(r.entries,t,l),s=o();}return r.progress.set(t,r.frontier),s??r.entries.get(t)}let a=o();for(;!a&&r.frontier<e.pages.length;){for(let[s,l]of Pm(Xd(e.pages[r.frontier++])))Ms(r.entries,s,l);a=o();}return a??r.entries.get(t)}var Tm=e=>td(e)?"rtl":"ltr";function VD(e,t){return As(e,t,true)?.emptyStyle}function fr(e,t){return As(e,t)?.fragment.props??[]}function Fs(e,t){return As(e,t)?.fragment.tabStops??null}function Yd(e){return Math.round((e.hanging>0?-e.hanging:e.firstLine)*20)}function Cm(e,t){return As(e,t)?.indent??null}function qk(e,t,n,r,o=th$1,i){let a=Ta(e,t);if(!a||a.kind!=="paragraph")return false;for(let s of uh$1(a,Hh(a),n,r,o,i))if(Ch(Bh(s.run,"runProperties","rPr"),zh).length>0)return true;return false}function zi(e,t,n,r=th$1,o){let i=Ta(e,t);if(!i||i.kind!=="paragraph")return [];let a=Oh$1(i,n,r,o);return a?Ch(Bh(a,"runProperties","rPr"),zh):Eh$1(e,t)}function Ui(e,t,n){let r=e?.find(i=>i.localName===t);if(!r)return null;let o=r.attributes?.val;return t==="vertAlign"?o===n:(t==="u"||o!=="0"&&o!=="false"&&o!=="off")&&o!=="none"}function Vk(e,t){if(!t||t.length===0)return e;let n=e;for(let r of t){let o=r.attributes?.val;switch(r.localName){case "b":n={...n,bold:Ui(t,"b")===true};break;case "i":n={...n,italic:Ui(t,"i")===true};break;case "u":n={...n,underline:Ui(t,"u")===true};break;case "strike":n={...n,strikethrough:Ui(t,"strike")===true};break;case "vertAlign":n={...n,superscript:o==="superscript",subscript:o==="subscript"};break;case "rFonts":n={...n,fontFamily:r.attributes?.ascii??n.fontFamily};break;case "sz":{let i=Number(o);Number.isFinite(i)&&(n={...n,fontSizeHalfPoints:i});break}case "color":n={...n,color:o==="auto"?null:o??n.color};break;case "highlight":n={...n,highlight:o==="none"?null:o??n.highlight};break;}}return n}function Em(e,t,n,r){return (n&&n.length>0?ha(e,n):ue(e,t,r??(t.anchor.paragraphId===t.head.paragraphId?[]:Sa(e)))).map(i=>{let a=v$1(u$1(i.style));return a===i.style?i:{...i,style:a}})}function Qd(e,t){let n=e.indexOf(t.from.paragraphId),r=e.indexOf(t.to.paragraphId);if(n===-1||r===-1)return [];let o=r>n&&t.to.offset===0?r-1:r;return e.slice(n,o+1)}function Jd(e,t,n,r){return Em(e,t,n,r)[0]?.style??null}function Om(e,t,n,r,o,i){let a=Em(e,t,r,i);if(a.length===0)return false;let s=l=>{switch(n){case "b":return l.style.bold;case "i":return l.style.italic;case "u":return l.style.underline!==null;case "strike":return l.style.strike;case "vertAlign":return l.style.verticalAlign===o;default:return false}};return a.every(s)}function Kk(e,t,n,r,o,i,a){let s=Em(e,t,r,i),l=s.length===0?$k(e,t,r,i).map(R=>VD(e,R)).filter(R=>R!==void 0):[],d=l.length>0?l:s.map(R=>R.style),c=R=>{if(d.length===0)return null;let G=R(d[0]);return d.every(X=>R(X)===G)?G:null},u=(R,G=(X,ie)=>X===ie)=>R.length>0&&R.every(X=>G(X,R[0]))?R[0]:null,p=(R,G)=>R.props.some(X=>X.localName===G),m=R=>R.style.fontFamily??n?.(R.range.paragraphId,R.props).fontFamily??null,h=R=>p(R,"sz")?Math.round(R.style.fontSizePt*2):n?.(R.range.paragraphId,R.props).fontSizeHalfPoints??Math.round(R.style.fontSizePt*2),b=l.length>0?{fontFamily:c(R=>R.fontFamily??a??null),fontSizeHalfPoints:c(R=>Math.round(R.fontSizePt*2))}:s.length===0?n?.(t.head.paragraphId,[]):void 0,y=$k(e,t,r,i),g=R=>u(y.map(G=>R(fr(e,G)))),x=(R,G=(X,ie)=>X===ie)=>{if(y.length<2)return false;let X=R(fr(e,y[0]));return y.some((ie,pe)=>pe>0&&!G(R(fr(e,ie)),X))},v=g(R=>bd$2(R)),k=g(Tm),P=g(R=>O(R,"pStyle")?.val??o??void 0)??null,T=R=>O(R,"spacing")??void 0,C=R=>{let G=T(R),X=nd(G?.line);if(X===null)return "";let ie=G?.lineRule??"auto";return ie==="auto"?`multiple:${Math.round(X/240*100)/100}`:`${ie==="exact"?"exact":"atLeast"}:${Math.round(X/20*100)/100}`},E=g(C),w=(()=>{if(!E)return null;let[R,G]=E.split(":");return {rule:R,value:Number(G)}})(),I=(R,G)=>{let X=nd(T(R)?.[G]);return X===null?null:Math.round(X/20*100)/100},L=R=>g(G=>I(G,R)),A=(()=>{let R=F=>Tm(fr(e,F))==="rtl",G=y.map(F=>{let _=Cm(e,F);return !_||!R(F)?_:{..._,indent:{..._.indent,left:_.indent.right,right:_.indent.left}}}),X=G[0];if(!X||G.some(F=>F===null||F.inTable))return null;let ie=R(y[0]),pe=F=>Math.round(F*20),K=G,z=pe(X.indent.left),H=pe(X.indent.right),Z=Yd(X.indent);return {left:z,right:H,firstLine:Z,mixed:{left:K.some(F=>pe(F.indent.left)!==z),right:K.some(F=>pe(F.indent.right)!==H),firstLine:K.some(F=>Yd(F.indent)!==Z)},...ie?{rtl:ie}:{}}})(),B=R=>g(G=>R(od(G))),$=g(H$1),j=g(S$1);return {bold:d.length>0&&d.every(R=>R.bold),italic:d.length>0&&d.every(R=>R.italic),underline:d.length>0&&d.every(R=>R.underline!==null),strikethrough:d.length>0&&d.every(R=>R.strike),superscript:d.length>0&&d.every(R=>R.verticalAlign==="superscript"),subscript:d.length>0&&d.every(R=>R.verticalAlign==="subscript"),fontFamily:s.length>0?u(s.map(m)):b?.fontFamily??null,fontSizeHalfPoints:s.length>0?u(s.map(h)):b?.fontSizeHalfPoints??null,color:c(R=>R.color),highlight:c(R=>R.highlight),alignment:v,direction:k,styleId:P,lineSpacing:w,spaceBeforePt:L("before"),spaceAfterPt:L("after"),disagrees:{alignment:x(R=>bd$2(R)),direction:x(Tm),spaceBeforePt:x(R=>I(R,"before")),spaceAfterPt:x(R=>I(R,"after")),lineSpacing:x(C),tabStops:(()=>{if(y.length<2)return false;let R=JSON.stringify(Fs(e,y[0])?.stops??null);return y.some((G,X)=>X>0&&JSON.stringify(Fs(e,G)?.stops??null)!==R)})()},indent:A,tabStops:u(y.map(R=>Fs(e,R)?.stops??null),(R,G)=>R===null||G===null?R===G:R.length===G.length&&R.every((X,ie)=>Math.round(X.positionPt*20)===Math.round(G[ie].positionPt*20)&&X.alignment===G[ie].alignment&&(X.leader??"none")===(G[ie].leader??"none")))?.map(R=>({positionTwips:Math.round(R.positionPt*20),alignment:R.alignment,...R.leader?{leader:R.leader}:{}}))??null,paragraphFlags:{contextualSpacing:j,keepNext:B(R=>R.keepNext),keepLines:B(R=>R.keepLines),widowControl:B(R=>R.widowControl),pageBreakBefore:$}}}function $k(e,t,n,r){if(n&&n.length>0)return [...ga(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??Sa(e),i=o.indexOf(t.anchor.paragraphId),a=o.indexOf(t.head.paragraphId);return i===-1||a===-1?[t.head.paragraphId]:o.slice(Math.min(i,a),Math.max(i,a)+1)}function jk(e,t,n,r){return t.paragraphId!==n.paragraphId?[]:t.offset!==0||n.offset!==e.length?[]:e.length===0?[]:[{op:"setParagraphMarkProperties",paragraphId:t.paragraphId,properties:r}]}function Wk(e){let t=null,n=null,r=null,o=()=>t&&mi(e.session.part()).find(l=>l.root.id===t.id&&l.drawingNodeId===t.drawingNodeId),i=()=>{if(t&&!o()){a();return}for(let l of e.pagesLayer.querySelectorAll(".docx-drawing-textbox")){let d=l.dataset.drawingNodeId===t?.drawingNodeId;l.dataset.docxTextboxActive=String(d),l.contentEditable=d?"true":"false",l.setAttribute("role",d?"textbox":"img"),d?(l.removeAttribute("aria-hidden"),l.setAttribute("aria-multiline","true")):(l.removeAttribute("aria-multiline"),l.hasAttribute("aria-label")||l.setAttribute("aria-hidden","true"));for(let c of l.querySelectorAll("[data-textbox-paragraph-id]"))d?c.dataset.paragraphId=c.dataset.textboxParagraphId:delete c.dataset.paragraphId;}},a=(l=true)=>{t&&(e.flush(),t=null,r=null,i(),l&&n&&e.setSelection(n),n=null);},s=l=>{if(l.owner||!e.writable())return false;e.flush();let d=mi(e.session.part()).find(P=>P.root.id===l.id&&P.drawingNodeId===l.drawingNodeId&&P.hostParagraphId===l.hostParagraphId),c=d&&Ua$1(e.session.part(),d.root.id),u=c&&Ua$1(e.session.part(),c.id),p=u&&ud$1(u.children,{namespaceUri:ia$2,localName:"spPr"}),m=p&&ud$1(p.children,{namespaceUri:ra$1,localName:"xfrm"}),h=u&&ud$1(u.children,{namespaceUri:ia$2,localName:"bodyPr"}),b=m&&ka$1(m.attributes,"rot"),y=h&&ka$1(h.attributes,"rot"),g=h&&ka$1(h.attributes,"vert");if(b&&Number(b)!==0||y&&Number(y)!==0||g&&g!=="horz")return false;let x;for(let P of e.layout().pages)if(x=zd$1(P,l.drawingNodeId),x)break;if(!d||!x?.textboxStory||x.transform.rotationDegrees!==0||x.textboxStory.fragments.some(P=>P.kind!=="paragraph"))return false;let v=x.textboxStory.fragments[0];if(!v||v.kind!=="paragraph")return false;if(t?.id===l.id)return true;a(),e.leaveOtherStories(),n=e.selection(),t=l,r=null,i();let k={paragraphId:v.paragraphId,offset:v.range.start};return e.setSelection({anchor:k,head:k}),true};return {active:()=>t,replacementFormatOps(l,d,c){let{anchor:u,head:p}=e.selection();if(!t||c===0||u.paragraphId===p.paragraphId&&u.offset===p.offset)return [];let m=zi(e.session.part(),l,d);return m.length?[{op:"setRunProperties",paragraphId:l,start:d,end:d+c,properties:m}]:[]},enter:s,exit:a,syncDom:i,contains:l=>{let d=o();return !!d&&Rc$2(d.root).some(c=>c.id===l)},paragraphIds:()=>{let l=o();return l?Rc$2(l.root).map(d=>d.id):[]},caretInput(l){if(!t)return {};let d=t.drawingNodeId,c;for(let h of l.pages)if(c=zd$1(h,d),c)break;let u=c?.textboxStory,m=[...e.pagesLayer.querySelectorAll(".docx-drawing-textbox")].find(h=>h.dataset.drawingNodeId===d)?.querySelector(".docx-drawing-textbox-content");return !c||!u||!m?{}:{scopedHost:m,scopedHostKind:"textbox",scopedOrigin:{x:c.x+u.contentOffset.x,y:c.y+u.contentOffset.y}}},layout(l){if(!t)return l;if(r?.base===l&&r.id===t.id)return r.layout;let d=t.drawingNodeId,c={...l,pages:l.pages.map(u=>{let p=zd$1(u,d),m=p?.textboxStory;return {...u,header:void 0,footer:void 0,footnotes:void 0,endnotes:void 0,anchoredDrawings:[],fragments:p&&m?m.fragments.flatMap(h=>h.kind==="paragraph"?[Me(h,p.x+m.contentOffset.x,p.y+m.contentOffset.y)]:[]):[]}})};return r={base:l,id:t.id,layout:c},c},preparePointer(l){let c=l?.closest(".docx-drawing-textbox-content")?.closest("[data-drawing-node-id]")?.dataset.drawingNodeId,u=c&&mi(e.session.part()).find(p=>p.drawingNodeId===c);return u&&s({kind:"frame",id:u.root.id,drawingNodeId:u.drawingNodeId,hostParagraphId:u.hostParagraphId})?true:(a(false),false)}}}function Zk(e,t,n){return (r,o)=>{let i=t(),a=n();return Nh(Fe(e,r)??e.part(),r,o,a$8(e.stylesRoot(),e.settingsRoot(),i,a),i,a)}}function Mm(e,t){e.setAttribute("aria-label",t?.("editor.documentContent")??en.editor.documentContent);}var Am=new WeakSet,Uk=new WeakMap,Un=e=>Am.has(e);function uo(e,t){t?Am.add(e):Am.delete(e);}function zk(e,t){Uk.set(e,t);}var Gk=e=>Uk.get(e)?.()??false;function Xk(e){let t="select[data-docx-form-dropdown]",n=d=>d instanceof Element?d.closest(t):null,r=d=>{let c=d.closest("[data-start][data-paragraph-id]"),u=c?.dataset.paragraphId;if(!c||!u)return null;let p=e.part(u),m=Ta(p,u);if(m?.kind!=="paragraph")return null;let h=Number(c.dataset.start),b=Mi(m).find(g=>g.start<=h&&h<g.end);if(!b)return null;let y={op:"setLegacyDropdown",paragraphId:u,fieldNodeId:b.fieldNodeId,selectedIndex:d.selectedIndex};return {field:b,paragraphId:u,op:y,enabled:e.editable()&&e.canApply(y)&&oj(e.settings(),y)===null&&Yk$1(p,y)===null}},o=()=>{for(let d of e.pagesLayer.querySelectorAll(t))d.disabled=!r(d)?.enabled;},i=d=>{let c=n(d.target);c&&(d.stopPropagation(),r(c)?.enabled||d.preventDefault());},a=d=>{let c=n(d.target);c&&(c.disabled=!r(c)?.enabled);},s=d=>{let c=n(d.target);if(!c)return;d.stopPropagation();let u=r(c);if(!u)return;if(!u.enabled||!e.apply(u.op)){c.selectedIndex=u.field.selectedIndex;return}e.select({anchor:{paragraphId:u.paragraphId,offset:u.field.start},head:{paragraphId:u.paragraphId,offset:u.field.end}}),[...e.pagesLayer.querySelectorAll(t)].find(m=>{let h=m.closest("[data-start][data-paragraph-id]");return h?.dataset.paragraphId===u.paragraphId&&Number(h.dataset.start)===u.field.start})?.focus({preventScroll:true});},l=new MutationObserver(d=>{for(let c of d)for(let u of c.addedNodes){if(!(u instanceof Element))continue;let p=u.matches(t)?[u]:u.querySelectorAll(t);for(let m of p)m.disabled=!r(m)?.enabled;}});return l.observe(e.pagesLayer,{childList:true,subtree:true}),e.pagesLayer.addEventListener("pointerdown",i,true),e.pagesLayer.addEventListener("focusin",a),e.pagesLayer.addEventListener("change",s),o(),{sync:o,keydown(d){let c=n(d.target);if(!c)return false;d.stopPropagation();let u=d.key.toLowerCase();return (d.ctrlKey||d.metaKey)&&!d.altKey&&(u==="z"||u==="y")?(d.preventDefault(),e.pagesLayer.focus({preventScroll:true}),e.history(u==="y"||d.shiftKey?"redo":"undo"),true):(!r(c)?.enabled&&d.key!=="Tab"&&d.preventDefault(),true)},destroy(){l.disconnect(),e.pagesLayer.removeEventListener("pointerdown",i,true),e.pagesLayer.removeEventListener("focusin",a),e.pagesLayer.removeEventListener("change",s);}}}function Yk(e,t){let n=Ua$1(e,t.id);for(let i=0;n&&i<64&&(n.namespaceUri===la$2&&n.localName==="customXml"||Uc$1(n)||Vc$1(n));i+=1)n=Ua$1(e,n.id);if(!n)return [];let r=Yc$1(n.children),o=r.findIndex(i=>i.id===t.id);return o>=2?r.slice(o-2,o):[]}function Qk(e){let t=n=>n.kind==="textValue"?/^[ \t\u00a0]*$/.test(n.value):n.namespaceUri!==la$2?false:n.localName==="pPr"?!n.children.some(r=>r.kind!=="textValue"&&r.localName==="sectPr"):n.localName==="rPr"||n.localName==="tab"||["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","proofErr"].includes(n.localName)?true:["p","r","t","hyperlink"].includes(n.localName)?n.children.every(t):false;return t(e)}function Jk(e,t,n,r,o,i,a,s){let l=Ta(e,n.paragraphId);if(l?.kind!=="paragraph")return null;let[d,c]=Yk(e,l);if(c?.kind!=="paragraph"||d?.kind!=="paragraph"||!Qk(c))return null;let u=Qa(t,l.id),p=Qa(t,d.id);if(!u||u.numId!==p?.numId||u.level!==p.level||Qa(t,c.id))return null;let m=(T,C,E,w)=>({id:T,kind:C,localName:E,namespaceUri:la$2,prefix:"w",namespaceBindings:[],attributes:[],children:w}),h=l.children.find(T=>T.kind==="paragraphProperties"),b=h&&{...h,children:h.children.filter(T=>T.localName!=="sectPr")},y=Li$1({localName:"pStyle",attributes:{val:o}},"separator-style"),g=r.map((T,C)=>Li$1(T,`separator-format-${C}`));a&&g.push(Li$1({localName:"ins",attributes:{id:oh$1(e,s)(),author:a.author,...a.date?{date:a.date}:{}}},"separator-insertion"));let x=m("separator-mark","runProperties","rPr",g),v=m("separator-properties","paragraphProperties","pPr",[...y?[y]:[],...g.length?[x]:[]]),k=[...v.children],P=i?.styles.has(o)?v:m("separator-defaults","paragraphProperties","pPr",[]);return i&&vc$1(jd$1(i,P).paragraphPropertyNodes)&&k.splice(y?1:0,0,m("separator-numbering","generic","numPr",[Li$1({localName:"numId",attributes:{val:"0"}},"separator-number-id")])),{op:"insertFragment",paragraphId:l.id,offset:n.offset,blocks:[m("separator-head","paragraph","p",b?[b]:[]),m("separator-blank","paragraph","p",[m("separator-properties-final","paragraphProperties","pPr",k)])],lastMarkCovered:true}}function eR(e,t=true){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:t})??false}function Fm(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}var tR=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve","revision-attribution"]);var jD="list paragraph",WD="ListParagraph";function nR(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function ec(e){let t=null;for(let n of e)if(n.type==="paragraph"){if(n.name.trim().toLowerCase()===jD)return n.styleId;t===null&&n.styleId===WD&&(t=n.styleId);}return t}function rR(e){let{session:t}=e,n;function r(){let o=t.stylesRoot();return (n===void 0||n.root!==o)&&(n={root:o,styleId:id(o,t.documentThemeFonts()).defaultParagraphStyleId}),n.styleId}return {applyOps(o){let i=ec(t.documentStyles());if(i===null)return [];let a=r(),s=e.storyPart(),l=[];for(let d of o){let c=Dh(s,d),u=nR(c);u!==void 0&&u!==a||l.push({op:"setParagraphProperties",paragraphId:d,properties:Fh(c,{localName:"pStyle",attributes:{val:i}})});}return l},clearOp(o){let i=ec(t.documentStyles());if(i===null)return null;let a=Dh(e.storyPart(),o);return nR(a)!==i?null:{op:"setParagraphProperties",paragraphId:o,properties:a.filter(s=>s.localName!=="pStyle")}}}}function oR(e,t){return n=>{let r=bd$1(n),o=r?.name??"/word/styles.xml",i="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",a=r?null:Ia('<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"/>',{name:o,contentType:i}),s=r??(a?.ok?a.part:null);if(!s)throw new Error("Cannot create list paragraph style");if(s.root.children.some(h=>h.kind!=="textValue"&&h.attributes.some(b=>b.localName==="styleId"&&b.value===t)))return n;let l=Ra$1(s),d=(h,b={},y=[])=>({...Li$1({localName:h,attributes:b},l()),children:y,...h==="pPr"?{kind:"paragraphProperties"}:{}}),u={...d("style",{type:"paragraph",styleId:t},[d("name",{val:"List Paragraph"}),...e?[d("basedOn",{val:e})]:[],d("uiPriority",{val:"34"}),d("qFormat"),d("pPr",{},[d("ind",{left:"720"}),d("contextualSpacing")])]),namespaceBindings:[{prefix:"w",namespaceUri:la$2}]};if(r){let h=Ya$1(s,s.root.id,s.root.children.length,[u]);if(!h.ok)throw new Error("Cannot insert list paragraph style");return Fe$1(n,h.part)}let p=Pe$1(n,o,{...s.root,children:[u]},i);p=Ne$1(p,n.mainDocumentPart);let m=Oe(p,n.mainDocumentPart,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",o);if(!m.ok)throw new Error("Cannot link list paragraph style");return m.pkg}}function tc(e,t){let n=e.ownerDocument,r=e.dataset.docxCcId,o=()=>{n.removeEventListener("pointerdown",i,true),n.removeEventListener("keydown",a,true);},i=s=>{if(e.parentNode===null){o();return}let l=s.target,d=l instanceof Element?l.closest("[data-docx-cc-widget]"):null;l&&(e.contains(l)||d?.getAttribute("data-docx-cc-id")===r)||(o(),t());},a=s=>{s.key!=="Escape"||s.isComposing||(s.preventDefault(),o(),e.parentNode!==null&&(s.stopPropagation(),t()));};return n.addEventListener("pointerdown",i,true),n.addEventListener("keydown",a,true),o}function iR(e,t,n,r,o){let a=pe(e).find(u=>u.id===n)?.fragments[0],s=a?e.pages[a.pageIndex]:void 0;if(!a||!s)return null;let l=o?.get(a.pageIndex)??0,d=s.contentBox.x-s.box.x,c=s.contentBox.y-s.box.y;return {left:(s.box.x+l+d+a.box.x)*t,top:(s.box.y+c+a.box.y+a.box.height)*t,element:[...r.querySelectorAll("[data-docx-content-control]")].find(u=>u.dataset.docxContentControl===n)?.querySelector(".docx-content-control-boundary")??void 0,sheetLeft:(s.box.x+l)*t,sheetRight:(s.box.x+l+s.box.width)*t}}function aR(e){return e.kind==="textValue"?e.value:e.localName==="sdtPr"?"":e.children.map(aR).join("")}function Lm(e,t){let n=e?aR(e):"";return t.find(r=>r.displayText===n)?.value??n}function sR(e){let t=e?.children.find(n=>n.kind!=="textValue"&&n.localName==="sdtPr");if(!(!t||t.kind==="textValue")){for(let n of t.children)if(n.kind!=="textValue"){if(n.localName==="dropDownList")return "dropdown";if(n.localName==="comboBox"||n.localName==="date")return n.localName;if(n.localName==="checkbox")return "checkbox";if(n.localName==="picture")return "picture";if(n.localName==="docPartList")return "buildingBlockGallery"}}}var ZD=["dropdown","comboBox","date","checkbox","picture","buildingBlockGallery"];function lR(e){let t=null,n=false,r=()=>{let o=t;t=null,o&&(e.setOpen(o.id,false),o.controller.abort());};return {cancel:r,destroy(){n=true,r();},open(o,i){if(r(),n||!e.request||!ZD.includes(i))return false;let a=new AbortController;t={controller:a,id:o};let s=()=>!n&&t?.controller===a&&!a.signal.aborted,l=()=>s()&&sR(e.find(o))===i&&e.allowed(o),d=e.find(o),c=e.items(o).map(b=>({...b})),u=Lm(d,c),p=i==="picture"?e.picture(o):void 0;if(i==="picture"&&!p)return r(),false;let m=false,h={controlId:o,kind:i,items:c,value:i==="date"?e.date(o)??"":i==="checkbox"?String(e.checked(o)):i==="picture"?p:i==="buildingBlockGallery"?"":u,locale:e.locale(),anchor:[...e.layer.querySelectorAll("[data-docx-content-control]")].find(b=>b.getAttribute("data-docx-content-control")===o)?.querySelector(".docx-content-control-boundary")??null,signal:a.signal,canApply:l,apply(b){return i==="picture"||!l()||!e.apply(o,b)?false:(s()&&r(),true)},cancel(){s()&&r();},...i==="picture"?{async replaceImage(b){if(m||!l())return false;m=true;try{return await e.replaceImage(o,b,()=>l()&&e.picture(o)===p)?(s()&&r(),!0):!1}finally{m=false;}}}:{}};return e.setOpen(o,true),e.request(h)?true:(h.cancel(),false)}}}function dR(e,t){if(!e)return [];if(t&&uR(e))return Fg$1(t(),e).map(n=>({displayText:n.name,value:n.name}));for(let n of e.children)if(n.kind!=="textValue"&&!(n.kind!=="contentControlProperties"&&n.localName!=="sdtPr"))for(let r of n.children){if(r.kind==="textValue"||r.localName!=="dropDownList"&&r.localName!=="comboBox")continue;let o=[];for(let i of r.children){if(i.kind==="textValue"||i.localName!=="listItem")continue;let a=i.attributes.find(l=>l.localName==="value")?.value??"",s=i.attributes.find(l=>l.localName==="displayText")?.value??a;o.push({displayText:s,value:a});}return o}return []}function cR(e){if(e){for(let t of e.children)if(t.kind==="contentControlProperties"){for(let n of t.children)if(n.kind==="contentControlDate")return n.attributes.find(r=>r.localName==="fullDate")?.value}}}function uR(e){return sR(e&&e.kind!=="textValue"?e:null)==="buildingBlockGallery"}function fR(e,t,n,r){if(!e||!uR(e))return [{op:"setContentControlValue",controlId:n,value:r}];let o=Fg$1(t(),e).filter(a=>a.name===r),i=o.length===1?o[0]:void 0;return i?[{op:"insertBuildingBlock",controlId:n,name:i.name,blocks:i.blocks}]:null}function pR(e){let t=-1,n=true;return ()=>{let r=e.packageRevision();return t!==r&&(t=r,n=!ji$1(e.settingsRoot()).doNotShadeFormData),n}}var Gi="switch to field results before editing a form value";function mR(e,t){let{anchor:n,head:r}=t,o=n.paragraphId===r.paragraphId;for(let i of [n,r]){let a=e(i.paragraphId),s=a&&Ta(a,i.paragraphId);if(s?.kind!=="paragraph")continue;let l=o?Math.min(n.offset,r.offset):i.offset,d=o?Math.max(n.offset,r.offset):i.offset,c=jg$1(s);if(Hf$1(s).filter(p=>p.addressing==="editable-result").map(p=>{let m=c.spanOf(p.node)?.start??0,h=m;for(let b of p.removeNodeIds)h=Math.max(h,c.spanOf(b)?.end??h);return {start:m,end:h}}).some(p=>l===d?l>=p.start&&(l<p.end||p.start===p.end):l<p.end&&d>p.start))return true}return false}function gR(e,t,n,r){let o=e.contentControlId?pe(t).find(c=>c.id===e.contentControlId):void 0,i=Dr(n).filter(c=>c.toc.id===e.id),a=i.some(c=>c.start>0||c.end<c.length);if(o&&!a)return {tocId:e.id,boundary:o,additional:false};let s=new Map(i.map(c=>[c.paragraphId,c])),l=i.filter(c=>c.start>0||c.end<c.length).flatMap(c=>ve(t,{anchor:{paragraphId:c.paragraphId,offset:c.start},head:{paragraphId:c.paragraphId,offset:c.end}},[c.paragraphId],r)),d=t.pages.flatMap(c=>{let u=xa(c).filter(y=>{let g=s.get(y.paragraphId);return g&&g.start===0&&g.end===g.length}).map(Fd$2);if(u.push(...l.filter(y=>y.pageIndex===c.index)),u.length===0)return [];let p=Math.min(...u.map(y=>y.x)),m=Math.min(...u.map(y=>y.y)),h=Math.max(...u.map(y=>y.x+y.width)),b=Math.max(...u.map(y=>y.y+y.height));return [{pageIndex:c.index,box:{x:p,y:m,width:h-p,height:b-m}}]});return d.length===0?null:{tocId:e.id,additional:true,boundary:{id:`toc:${e.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:d}}}var hR=new WeakMap;function yR(e,t,n,r){hR.set(e,o=>{let i=t();e.flushPendingInput();try{n(o),r();}catch(a){throw n(i),r(),a}});}function bR(e,t){let n=hR.get(e);if(!n)throw new Error("Surface does not support measurement updates");n(t);}var nc=new WeakMap;function vR(e){if(e.host){e.status.replaceChildren();return}let t=e.status.ownerDocument.createElement("span");t.className="docx-editor__loading-spinner",t.setAttribute("aria-hidden","true"),e.status.replaceChildren(t);}function xR(e,t){let n=t.ownerDocument,r=n.createElement("div");r.className="docx-opening-indicator",r.contentEditable="false";let o=n.createElement("div");o.className="docx-editor__loading-page-status",o.setAttribute("role","status"),r.append(o);let i={frame:r,status:o,host:null};nc.set(e,i),vR(i);let a=()=>{let s=t.querySelector(':scope > .docx-pages > .docx-page[data-page-index="0"]');r.hidden=!s,s&&(r.style.left=s.style.left,r.style.top=s.style.top,r.style.width=s.style.width,r.style.height=s.style.height);};return t.append(r),a(),{place:a,remove:()=>{nc.get(e)===i&&(nc.delete(e),r.remove(),i.host?.publish(null));}}}function Nm(e,t){let n=nc.get(e);if(!n||n.host===t)return;let r=n.host;n.host=t,r?.publish(null),vR(n),t?.publish(n.status);}var rc=new WeakMap;function zD(e,t){rc.set(e,t);}function Dm(e,t){let n=rc.get(e);if(!n)return true;let r=n(t);return r&&rc.delete(e),r}function Ls(e){return rc.has(e)}var GD=40;function SR(e,t,n,r){let o=r,i=null,a=0,s=()=>{let d=i;i=null,d&&gf(d);},l=d=>{let c=n.now()+d;for(;n.limit()!==null&&!n.destroyed();){if(!i){let h=n.limit(),b=n.bodyBlockCount();if(b!==void 0&&h>=b)return n.finish(),true;n.setLimit(h+o),i=n.prefixPass(h+o),a=0;}let u=n.now(),p=false;do p=i.next().done===true;while(!p&&n.now()<c);if(a+=n.now()-u,!p)return false;i=null;let m=Math.max(a,1)/o;if(o=Math.min(4096,Math.max(16,Math.round(GD/m))),n.now()>=c)return false}return true};if(t.removeAttribute("data-docx-opening-preview"),n.limit()!==null){t.setAttribute("data-docx-opening-preview","");let d=xR(e,t);zD(e,c=>{let u=l(c);return u?(t.removeAttribute("data-docx-opening-preview"),d.remove()):d.place(),u});}return s}var XD=40,YD=12,QD=8;function Hm(e){if(typeof MessageChannel=="function"){let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e();},t.port2.postMessage(null);return}setTimeout(e,0);}function e2(e){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>Hm(e));return}Hm(e);}function wR(e){let t=null,n=0,r=(s,l)=>{s&&e.passTimed?.(l);},o=s=>{let l=t===null!=(s===null);t=s,l&&e.pendingChanged?.(s!==null);},i=(s,l)=>{e.revision()===l&&e.publish(s);},a=()=>{let s=t;if(!s)return;let l=e.now(),d=l+YD;for(;;){let c=s.steps.next();if(c.done){o(null),i(c.value,s.revision),r(s.timed,s.spent+e.now()-l);return}if(e.now()>=d)break}s.spent+=e.now()-l,Hm(a);};return {run(s,l,d=true){let c=e.snapshot(),u=e.now(),p=d?n:0;d&&(n=0);let m=u+XD,h=e.pageAfterView(),b=e.current(),y=null;for(;;){let g=s.next();if(g.done)return r(d,p+e.now()-u),g.value;if(g.value&&(y=g.value),h===void 0||!y?.finalize||y.pages.length<=h||e.now()<m||!b||b.pages.length-y.pages.length<QD)continue;let x=[...y.pages,...b.pages.slice(y.pages.length)];return o({steps:s,revision:l,restore:c,spent:p+e.now()-u,timed:d}),e2(a),y.finalize(x)}},finish(){let s=t;if(!s)return;let l=e.now();o(null),i(gf(s.steps),s.revision),r(s.timed,s.spent+e.now()-l);},abandon(){let s=t;s&&(o(null),s.restore(),s.timed&&(n+=s.spent));},pending:()=>t!==null,cancel(){o(null);}}}var t2=1e4;function IR(e){let t=null,n=()=>{let a=[],s=new Set([e.part()]);for(let l of e.headerFooterPartsBySection())for(let d of [l.headers,l.footers])for(let c of d.values())s.has(c)||(s.add(c),a.push(c));for(let l of ["footnote","endnote"]){let d=e.partFor({kind:"notesPart",noteKind:l});!d||s.has(d)||(s.add(d),a.push(d));}return a},r=(a,s)=>a.length===s.length&&a.every((l,d)=>l===s[d]),o=a=>{let s=Ta(e.part(),a);if(!s||s.kind!=="paragraph")return false;let l=0,d=[...s.children];for(;d.length>0;){let c=d.pop();if(++l>t2)return false;if(c.kind!=="textValue"){if(c.namespaceUri===la$2&&c.localName==="p")return false;for(let u of c.children)d.push(u);}}return true},i=(a,s)=>{if(a.splitJoin.length!==1||a.story!==void 0&&a.story.kind!=="body")return false;let l=a.splitJoin[0];if("split"in l){let{from:u,tail:p}=l.split,m=s.get(u);if(m===void 0||s.has(p)||a.deleted.length>0||a.created.length!==1||a.created[0]!==p||!o(u)||!o(p))return false;for(let[h,b]of s)b>m&&s.set(h,b+1);return s.set(p,m+1),true}let{kept:d,removed:c}=l.join;return !s.has(d)||a.created.length>0||a.deleted.length!==1||a.deleted[0]!==c||!o(d)?false:(s.delete(c),true)};return {retain(a){if(!t)return;let s=a.created.length>0||a.deleted.length>0||a.splitJoin.length>0,l=a.impact==="text-local"&&!s?t.otherParts:n();a.impact!=="global"&&(a.impact==="text-local"||r(t.otherParts,l))&&(!s||r(t.otherParts,l)&&i(a,t.index))?t={packageRevision:e.packageRevision(),bodyRoot:e.part().root,index:t.index,otherParts:l}:t=null;},index(){let a=e.packageRevision(),s=e.part().root;if(t&&t.packageRevision===a&&t.bodyRoot===s)return t.index;let l=new Map,d=u=>{let p=l.size;for(let[m,h]of u)l.has(m)||l.set(m,p+h);};d(mj(e.part()));let c=n();for(let u of c)d(mj(u));return t={packageRevision:a,bodyRoot:s,index:l,otherParts:c},l}}}var o2=createT(en);function Rn(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return o2(t)}}var kR=new WeakMap;function oc(e,t){let n=new Map;return kR.set(e,n),(r,o,i="textContent")=>{let a=n.get(r);a||n.set(r,a=new Map),a.set(i,o),i==="textContent"?r.textContent=t(o):r.setAttribute(i,t(o));}}function RR(e,t){let n=kR.get(e);if(n)for(let[r,o]of n){if(r!==e&&!e.contains(r)){n.delete(r);continue}for(let[i,a]of o)i==="textContent"?r.textContent=t(a):r.setAttribute(i,t(a));}}function PR(e,t){let n=e.ownerDocument.defaultView;if(!n)return;if(n.getComputedStyle(e).position==="fixed"){let E=t.getBoundingClientRect();e.style.maxHeight="";let w=Number.parseFloat(n.getComputedStyle(e).maxHeight),I=Number.isFinite(w)?w:n.innerHeight;e.style.maxWidth=`${Math.max(0,n.innerWidth-16)}px`,e.style.maxHeight=`${Math.max(0,Math.min(I,n.innerHeight-16))}px`;let L=e.getBoundingClientRect(),A=Math.max(0,n.innerHeight-8-E.bottom-4),B=Math.max(0,E.top-8-4),$=L.height>A&&B>A,j=Math.min(L.height,$?B:A);e.style.maxHeight=`${j}px`,e.style.left=`${Math.max(8,Math.min(E.left,n.innerWidth-8-L.width))}px`;let R=$?E.top-4-j:E.bottom+4;e.style.top=`${Math.max(8,Math.min(R,n.innerHeight-8-j))}px`,e.dataset.placement=$?"top":"bottom";return}let r=e.offsetParent;if(!r)return;let o=t.getBoundingClientRect(),i=t.closest(".docx-page")?.getBoundingClientRect(),a=t.closest(".docx-editor__scroll-container")?.getBoundingClientRect(),s=Math.max(0,i?.left??0,a?.left??0),l=Math.min(n.innerWidth,i?.right??n.innerWidth,a?.right??n.innerWidth),d=Math.max(0,a?.top??0),c=Math.min(n.innerHeight,a?.bottom??n.innerHeight);e.style.maxWidth=`${Math.max(0,l-s)}px`,e.style.maxHeight=`${Math.max(0,c-d)}px`;let u=e.getBoundingClientRect(),p=c-o.bottom,m=o.top-d,h=u.height>p&&m>p,b=Math.max(0,h?m:p);e.style.maxHeight=`${Math.max(0,Math.min(c-d,b))}px`;let y=Math.min(u.height,b),g=Math.max(s,Math.min(o.left,l-u.width)),x=Math.max(d,h?o.top-y:o.bottom),v=r.getBoundingClientRect(),k=r.offsetWidth?v.width/r.offsetWidth:1,P=r.offsetHeight?v.height/r.offsetHeight:1;e.style.left=`${(g-v.left)/k-r.clientLeft+r.scrollLeft}px`,e.style.top=`${(x-v.top)/P-r.clientTop+r.scrollTop}px`,e.dataset.placement=h?"top":"bottom";}function Ns(e,t){let n=e.ownerDocument.defaultView,r=t.closest(".docx-pages")??e.closest(".docx-editor")?.querySelector(".docx-pages"),o=t.closest("[data-docx-content-control]")?.dataset.docxContentControl,i=t,a=()=>{if(!i.isConnected&&r&&o){let d=[...r.querySelectorAll("[data-docx-content-control]")].find(c=>c.dataset.docxContentControl===o)?.querySelector(".docx-content-control-boundary");d&&(s?.unobserve(i),i=d,s?.observe(i));}i.isConnected&&PR(e,i);},s=typeof ResizeObserver>"u"?null:new ResizeObserver(a);s?.observe(e),s?.observe(i);let l=typeof MutationObserver>"u"?null:new MutationObserver(a);return r&&l?.observe(r,{childList:true,subtree:true}),a(),n?.addEventListener("resize",a),e.ownerDocument.addEventListener("scroll",a,true),()=>{s?.disconnect(),l?.disconnect(),n?.removeEventListener("resize",a),e.ownerDocument.removeEventListener("scroll",a,true);}}function Ds(e,t,n){if(t.stopPropagation(),t.isComposing||(t.key==="Escape"&&(t.preventDefault(),n()),t.key!=="Tab"))return;let r=[...e.querySelectorAll("button,input,select,textarea,[href],[tabindex]")].filter(a=>a.tabIndex>=0&&!a.hasAttribute("disabled")&&!a.closest("[hidden]")&&e.ownerDocument.defaultView?.getComputedStyle(a).display!=="none");if(!r.length){t.preventDefault(),e.focus();return}let o=e.ownerDocument.activeElement,i=t.shiftKey&&(o===r[0]||o===e)?r.at(-1):!t.shiftKey&&(o===r.at(-1)||o===e)?r[0]:null;i&&(t.preventDefault(),i.focus());}function i2(e){let t=e?.ownerDocument??(typeof document>"u"?null:document),n=t?.activeElement;return n&&n!==t?.body?n:e?.closest(".docx-pages")??null}var _m="image/png,image/jpeg,image/gif,image/bmp,image/webp",a2=new Set(_m.split(",")),s2=8;function l2(e){if(!e||e.kind==="textValue")return;let t=(n,r)=>{if(!(n.kind==="textValue"||r>s2)){if(n.kind==="drawing")return n.id;if(n.localName!=="sdtPr")for(let o of n.children){let i=t(o,r+1);if(i)return i}}};return t(e,0)}function TR(e){let t=null,n=null,r=null,o,i,a=0,s=false,l=()=>{a++,o?.(),i?.(),r?.remove(),r=null;let u=n;t?.remove(),t=null,n=null,u&&(e.setOpen(u,false),s||e.layer.focus({preventScroll:true}));},d=u=>l2(e.find(u)),c=async(u,p,m=()=>true)=>{if(s||!m()||!e.allowed(u))return false;if(p.byteLength>r$3.maxEncodedBytes)return e.reject("image-resource-limit"),false;let h=d(u);if(!h)return e.reject("no-picture"),false;let b=de$1(p);if(!a2.has(b))return e.reject("unsupported-image"),false;let y=await e.replaceImage(h,p,b,()=>!s&&m()&&e.allowed(u)&&d(u)===h);return y.ok?true:(e.reject(y.detail??y.reason),false)};return {drawingOf:d,replace:c,cancel:l,select(u){let p=d(u),m=p?ge(e.layout(),p):null;return m?e.selectDrawing(p,m.record.paragraphId):false},pick(u){if(l(),s||!e.allowed(u))return;let p=a,m=()=>!s&&a===p;if(!d(u)){e.reject("no-picture");return}let h=e.document.createElement("input");h.type="file",h.accept=_m,h.className="docx-content-control-picture-picker",h.dataset.docxMarker="",h.dataset.docxCcId=u,h.setAttribute("contenteditable","false"),h.setAttribute("aria-hidden","true"),h.tabIndex=-1;let b=Rn(e.translate),y=e.document.createElement("div");y.className="docx-content-control-menu",y.style.position="absolute",y.style.zIndex="20",y.style.pointerEvents="auto",y.dataset.docxCcId=u,y.dataset.docxMarker="",y.setAttribute("role","dialog"),y.setAttribute("aria-label",b("contentControl.types.picture")),y.setAttribute("contenteditable","false"),y.hidden=true;let g=e.document.createElement("div");g.className="docx-content-control-widget-error",g.setAttribute("role","alert"),g.textContent=b("disabledReason.invalidValue");let x=e.document.createElement("button");x.type="button",x.textContent=b("common.cancel"),x.addEventListener("click",l),y.addEventListener("pointerdown",v=>v.stopPropagation()),y.addEventListener("keydown",v=>{Ds(y,v,l),v.stopPropagation();}),y.append(g,x),h.addEventListener("change",()=>{let v=h.files?.[0];!v||!m()||(h.value="",h.disabled=true,(async()=>{let k=false;try{v.size>r$3.maxEncodedBytes?e.reject("image-resource-limit"):k=await c(u,new Uint8Array(await v.arrayBuffer()),m);}catch{m()&&e.reject("image-read-failed");}if(!m())return;if(k){l();return}h.disabled=false,h.className="docx-content-control-picture-input",h.removeAttribute("aria-hidden"),h.tabIndex=0,h.setAttribute("aria-label",b("contentControl.types.picture")),h.setAttribute("aria-invalid","true"),y.prepend(h),y.hidden=false;let P=[...e.layer.querySelectorAll("[data-docx-content-control]")].find(T=>T.getAttribute("data-docx-content-control")===u)?.querySelector(".docx-content-control-boundary");i?.(),o?.(),P&&(i=Ns(y,P)),o=tc(y,l),h.focus();})());}),h.addEventListener("cancel",l),e.layer.append(h),(e.layer.closest(".docx-editor__scroll-container")??e.layer).append(y),r=y,t=h,n=u,e.setOpen(u,true),h.click();},destroy(){s=true,l();}}}function CR(e,t,n,r){return (vk$1(e,t,n)?.offset??n)+r}function ER(e){if(e&&!(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")&&!e.bound&&!(e.controlType==="checkbox"||e.controlType==="picture"))return e.id}function OR(e,t,n){return {op:"insertText",paragraphId:e.paragraphId,offset:e.offset,text:t,...n===void 0?{}:{inside:n}}}function d2(e,t,n){let r=e.ownerDocument;if(typeof r.elementFromPoint!="function")return null;let o=r.elementFromPoint(t,n)?.closest(".docx-page");if(!o)return null;for(let i of o.querySelectorAll("[data-docx-content-control]:not([data-docx-toc])"))for(let a of i.querySelectorAll(".docx-content-control-boundary")){let s=a.getBoundingClientRect();if(t>=s.left-3&&t<=s.right+22&&n>=s.top-3&&n<=s.bottom+3)return i}return null}function MR(e){let t=null,n=0,r=null,o=l=>{l!==t&&(t?.isConnected&&delete t.dataset.hover,t=l,l&&(l.dataset.hover=""));},i=()=>{n=0,r&&o(d2(e,r.x,r.y));},a=l=>{r={x:l.clientX,y:l.clientY},n===0&&(n=e.ownerDocument.defaultView?.requestAnimationFrame(i)??0),n===0&&i();},s=()=>{r=null,o(null);};return e.addEventListener("pointermove",a),e.addEventListener("pointerleave",s),{destroy(){e.removeEventListener("pointermove",a),e.removeEventListener("pointerleave",s),n&&e.ownerDocument.defaultView?.cancelAnimationFrame(n),o(null);}}}var Hs=.25;function AR(e,t,n){let r=(s,l)=>{let d=oe(e,s,n);return d?le(e,{x:d.x+l,y:d.y+d.height/2,pageIndex:d.pageIndex}):null},o=r(t.head,0);if(o)return o;if(t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset)return r(t.head,-Hs);let a=t.head.paragraphId===t.anchor.paragraphId&&t.head.offset<t.anchor.offset;return r(t.head,a?Hs:-Hs)??r(t.anchor,a?-Hs:Hs)}function FR(e,t,n,r,o){let i=r==="left"?-1:1,a=oe(e,t.from,o),s=oe(e,t.to,o),l=a?je(e,a)??1:1,d=i*l===-1?t.from:t.to;if(!a||!s||a.lineId!==s.lineId||a.pageIndex!==s.pageIndex)return d;let c=vd$1(e,t.from.paragraphId)?.find(({line:h})=>h.id===a.lineId)?.line;if(!c?.spans.some(h=>h.style.shaping))return d;let u=n.indexOf(t.from.paragraphId),p=n.indexOf(t.to.paragraphId),m;for(let h of c.spans){let b=h.range.paragraphId,y=n.indexOf(b);if(y<u||y>p)continue;let g=Math.max(h.range.start,b===t.from.paragraphId?t.from.offset:0),x=Math.min(h.range.end,b===t.to.paragraphId?t.to.offset:1/0);if(!(g>=x))for(let v of [g,x]){let k={paragraphId:b,offset:v},P=oe(e,k,o);if(!P||P.lineId!==a.lineId||P.pageIndex!==a.pageIndex)continue;let T=P.x;(!m||(T-m.x)*i>0)&&(m={position:k,x:T});}}return m?.position??d}function LR(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}function NR(e,t,n,r){let o=Rn(r),i=e.ownerDocument,a=i.createElement("dialog"),s=oc(a,o);a.className="docx-text-form-dialog",a.setAttribute("role","alertdialog"),a.setAttribute("data-docx-modal",""),s(a,"textFormField.invalidTitle","aria-label"),s(a,`textFormField.invalid${t==="number"?"Number":"Date"}`,"aria-description");let l=i.createElement("h2");l.className="docx-text-form-dialog__header",s(l,"textFormField.invalidTitle");let d=i.createElement("div");d.className="docx-text-form-dialog__body",s(d,`textFormField.invalid${t==="number"?"Number":"Date"}`);let c=i.createElement("div");c.className="docx-text-form-dialog__footer";let u=i.createElement("button");u.type="button",u.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(u,"textFormField.apply");let p=false,m=()=>{p||(p=true,n());};return u.addEventListener("click",m),a.addEventListener("keydown",h=>{h.key!=="Enter"||h.isComposing||(h.preventDefault(),h.stopPropagation(),m());}),a.addEventListener("cancel",h=>{h.preventDefault(),m();}),c.append(u),a.append(l,d,c),e.append(a),a.showModal(),u.focus(),a}function DR(e,t,n,r,o){let i=Rn(o),a=e.ownerDocument,s=a.createElement("dialog"),l=oc(s,i);s.className="docx-text-form-dialog",s.setAttribute("data-docx-modal",""),l(s,"textFormField.title","aria-label");let d=a.createElement("h2");d.className="docx-text-form-dialog__header",l(d,"textFormField.title");let c=a.createElement("div");c.className="docx-text-form-dialog__body";let u=a.createElement("div");u.className="docx-text-form-dialog__footer",s.append(d,c,u);let p=(I,L)=>{let A=a.createElement("label");A.className="docx-text-form-dialog__row";let B=a.createElement("span");B.className="docx-text-form-dialog__label",l(B,I),L.className="docx-text-form-dialog__input",A.append(B,L),c.append(A);},m=a.createElement("input");m.type="text",m.value=t.defaultText,p("textFormField.defaultText",m);let h=a.createElement("select"),b=["regular","number","date"];for(let I of b){let L=a.createElement("option");L.value=I,l(L,`textFormField.${I}`),h.append(L);}if(!b.includes(t.type)){let I=a.createElement("option");I.value=t.type,l(I,"textFormField.preservedType"),I.disabled=true,h.append(I);}h.value=t.type,p("textFormField.type",h);let y=a.createElement("input");y.type="number",y.min="0",y.max="32767",y.step="1",y.value=String(t.maxLength),p("textFormField.maxLength",y);let g=a.createElement("select"),x=I=>{g.replaceChildren();let L=Qi$1[h.value]??[];for(let A of L){let B=a.createElement("option");B.value=A;let j={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[A];j||!A?l(B,j??"textFormField.noFormat"):B.textContent=A,g.append(B);}if(!L.includes(I)){let A=a.createElement("option");A.value=I,I?A.textContent=I:l(A,"textFormField.noFormat"),A.disabled=true,g.append(A);}g.value=I;};x(t.format),h.addEventListener("change",()=>x("")),p("textFormField.format",g);let v=a.createElement("input");v.type="checkbox",v.checked=t.enabled;let k=a.createElement("label");k.className="docx-text-form-dialog__checkbox-row";let P=a.createElement("span");l(P,"textFormField.enabled"),k.append(v,P),c.append(k);let T=a.createElement("p");T.className="docx-text-form-dialog__error",T.setAttribute("role","alert"),c.append(T);let C=a.createElement("button");C.type="button",C.className="docx-text-form-dialog__button",l(C,"textFormField.cancel"),C.addEventListener("click",r);let E=a.createElement("button");E.type="button",E.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(E,"textFormField.apply");let w=()=>{if(!y.value||!y.checkValidity()||!n(m.value,{type:h.value,maxLength:Number(y.value),format:g.value,enabled:v.checked})){l(T,"textFormField.invalidOptions");return}r();};return E.addEventListener("click",w),s.addEventListener("keydown",I=>{I.key==="Enter"&&!I.isComposing&&I.target instanceof HTMLInputElement&&(I.preventDefault(),w());}),s.addEventListener("cancel",I=>{I.preventDefault(),r();}),u.append(C,E),e.append(s),s.showModal(),m.focus(),m.select(),s}function HR(e,t,n){let r=[],o=[];for(let a of e)for(let s of mj(a).keys()){let l=Ta(a,s);if(l?.kind==="paragraph")for(let d of hj(l)){let c=t.get(d.fieldNodeId);if(!c)continue;let u=(Vi$1(a,s)??"").slice(d.start,d.end),p=Ri(u,d,"fill",c.locale);if(p===null)return {reason:"invalidArgs"};if(p===u)continue;let m={op:"commitTextFormField",paragraphId:s,fieldNodeId:d.fieldNodeId,locale:c.locale},h=Yk$1(a,m);if(h)return {reason:h};r.push(m),o.push({paragraphId:s,start:d.start,end:d.end,length:p.length});}}let i=a=>{let s=a.offset;for(let l of o)l.paragraphId!==a.paragraphId||a.offset<=l.start||(s+=a.offset>=l.end?l.length-(l.end-l.start):Math.min(a.offset-l.start,l.length)-(a.offset-l.start));return s===a.offset?a:{...a,offset:s}};return {ops:r,selection:{anchor:i(n.anchor),head:i(n.head)}}}var ic=new WeakMap,ac=new WeakMap;function BR(e){return ac.get(e)?.()??null}function _R(e){return [...mj(e).keys()].flatMap(t=>{let n=Ta(e,t);return n?.kind==="paragraph"?hj(n):[]})}function Bm(e){return ic.get(e)?.()}function $R(e,t){let n=Rn(e.translate),r=e.container.ownerDocument,o,i=false,a=new Map,s=()=>e.parts?.()??[e.part()];if(t?.length)for(let H of s()){let Z=t.filter(_=>_.partName===H.name);if(!Z.length)continue;let F=_R(H);for(let _ of Z){let W=F[_.fieldIndex];W&&a.set(W.fieldNodeId,{text:_.text,locale:_.locale});}}let l=new WeakMap,d=new WeakMap,c=(H=e.part())=>{l.set(H,new Map([...a].filter(([Z])=>Z.startsWith(`${H.name}#`))));},u=()=>(a=new Map(s().flatMap(H=>[...l.get(H)??[]])),d.get(e.part())??null),p=H=>{a.delete(H),c();};s().forEach(c);let m=()=>{if(!a.size)return null;if(i)return "invalidState";let H=HR(s(),a,e.selection());if("reason"in H)return H.reason;if(H.ops.length&&!e.editable())return "locked";let Z=s();s().forEach(c);let F=a;H.ops.length&&d.set(e.part(),e.selection()),a=new Map,i=true;try{let _=H.ops.length?e.save?e.save(H.ops,H.selection):"unsupported":null;return _?a=F:(delete z.dataset.fieldError,H.ops.length&&d.set(e.part(),H.selection)),s().forEach(c),_}catch(_){throw s().every(W=>Z.includes(W))&&(a=F),s().forEach(c),_}finally{i=false;}};ac.set(e.container,m);let h=()=>a.size?s().flatMap(H=>_R(H).flatMap((Z,F)=>{let _=a.get(Z.fieldNodeId);return _?[{partName:H.name,fieldIndex:F,..._}]:[]})):[];ic.set(e.container,h);let b,y=(H,Z)=>(Vi$1(e.part(),H)??"").slice(Z.start,Z.end),g=null,x=null,v=null,k=false,P=false,T=()=>{let H=v;v=null,P=false,g?.remove(),g=null,H?.abort();},C=()=>{if(!g&&!v)return;let H=e.selection();T(),!k&&(e.pagesLayer.focus({preventScroll:true}),e.select(H));};function E(H,Z,F="plain"){b={paragraphId:H,fieldNodeId:Z.fieldNodeId},e.select({anchor:{paragraphId:H,offset:Z.start},head:{paragraphId:H,offset:Z.end}},F==="press"?"pressed":void 0);let _=e.selection().head.paragraphId===H&&e.selection().head.offset>=Z.start&&e.selection().head.offset<=Z.end;_&&(x=b??x),b=void 0,_&&F==="travel"&&e.reveal?.({paragraphId:H,offset:Z.start});}function w(H,Z){if(k)return;C();let F=e.locale?.()??"en-US",_=new AbortController;v=_;let W=()=>{if(k||_.signal.aborted||v!==_)return false;let q=Ta(e.part(H),H);return q?.kind==="paragraph"&&hj(q).some(U=>U.fieldNodeId===Z.fieldNodeId)&&e.editable()&&!e.protected(H)},N={field:{...Z},signal:_.signal,canApply:W,apply(q,U){if(!W()||!e.apply({op:"setTextFormFieldDefault",locale:F,paragraphId:H,fieldNodeId:Z.fieldNodeId,text:q,options:U}))return false;if(k||v!==_||_.signal.aborted)return true;let ne=Ta(e.part(H),H),re=ne?.kind==="paragraph"?hj(ne).find(ee=>ee.fieldNodeId===Z.fieldNodeId):null;return re&&E(H,re),C(),true},cancel(){v===_&&!_.signal.aborted&&C();}};e.onRequest?.(N)||_.signal.aborted||(g=DR(e.container,Z,N.apply,N.cancel,n));}let I=H=>{let F=H.target?.closest('[data-field-atom="form"][data-start]'),_=F?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!F||!_||!e.editable())return null;let W=Ta(e.part(),_);if(W?.kind!=="paragraph")return null;let N=Number(F.dataset.start),q=hj(W).find(U=>U.start<=N&&N<U.end);return q?{paragraphId:_,field:q}:null},L=null,A=H=>H.shiftKey||H.altKey||H.ctrlKey||H.metaKey,B=H=>{if(o=void 0,L=null,H.button!==0)return;let Z=I(H);Z&&!A(H)&&!e.protected(Z.paragraphId)&&(L={x:H.clientX,y:H.clientY,paragraphId:Z.paragraphId,fieldNodeId:Z.field.fieldNodeId,moved:false}),b=Z?{paragraphId:Z.paragraphId,fieldNodeId:Z.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",B,{capture:true});let $=H=>{L&&Math.hypot(H.clientX-L.x,H.clientY-L.y)>4&&(L.moved=true);},j=()=>{L=null;},R=(H,Z=false)=>{let F=L;if(L=null,!F||F.moved||g||H.button!==0||H.detail>1||Math.hypot(H.clientX-F.x,H.clientY-F.y)>4||!e.editable()||A(H)||e.protected(F.paragraphId))return;let _=Ta(e.part(),F.paragraphId),W=_?.kind==="paragraph"?hj(_).find(q=>q.fieldNodeId===F.fieldNodeId):null;if(!W)return;let N=e.selection();Z&&(N.anchor.paragraphId!==N.head.paragraphId||N.anchor.offset!==N.head.offset)&&!(N.anchor.paragraphId===F.paragraphId&&N.head.paragraphId===F.paragraphId&&Math.min(N.anchor.offset,N.head.offset)===W.start&&Math.max(N.anchor.offset,N.head.offset)===W.end)||E(F.paragraphId,W,"press");};r.addEventListener("pointermove",$),r.addEventListener("pointercancel",j),e.pagesLayer.addEventListener("click",R);let G=H=>{if(H.shiftKey||H.altKey||H.ctrlKey||H.metaKey||e.pagesLayer.contentEditable==="false")return false;let Z=I(H);if(!Z)return false;let{paragraphId:F,field:_}=Z;return H.preventDefault(),E(F,_,"press"),e.protected(F)||w(F,_),true};e.pagesLayer.addEventListener("dblclick",G);function X(){let H=e.selection();if(H.anchor.paragraphId!==H.head.paragraphId)return null;let Z=H.head.paragraphId,F=Ta(e.part(),Z);if(F?.kind!=="paragraph")return null;let _=Math.min(H.anchor.offset,H.head.offset),W=Math.max(H.anchor.offset,H.head.offset),N=hj(F).filter(U=>U.start<=_&&U.end>=W&&(U.start===U.end||_!==W||_<U.end||e.protected(Z))),q=N.find(U=>x?.paragraphId===Z&&U.fieldNodeId===x.fieldNodeId)??N.find(U=>U.start===_&&U.end===W)??N[0];return q?{paragraphId:Z,field:q}:null}function ie$1(){if(o===void 0)return X();if(!o)return null;let H=Ta(e.part(),o.paragraphId),Z=H?.kind==="paragraph"?hj(H).find(F=>F.fieldNodeId===o.fieldNodeId):null;return Z?{paragraphId:o.paragraphId,field:Z}:null}let pe=H=>{let Z=H.button===-1||H.clientX===0&&H.clientY===0?X():I(H);o=Z?{paragraphId:Z.paragraphId,fieldNodeId:Z.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",pe);let K=()=>{let H=ie$1();return !!H&&e.editable()&&!e.protected(H.paragraphId)&&!Yk$1(e.part(),{op:"setTextFormFieldDefault",paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},z=r.createElement("span");return z.className="docx-text-form-status",e.container.append(z),{doubleClick:G,pointerUp:H=>R(H,true),canEdit:K,edit(){if(!K())return false;let H=ie$1();return E(H.paragraphId,H.field,"travel"),w(H.paragraphId,H.field),true},selectForDeletion(H){let Z=e.selection(),{paragraphId:F,offset:_}=Z.head;if(!e.editable()||e.protected(F)||Z.anchor.paragraphId!==F||Z.anchor.offset!==_)return false;let W=Ta(e.part(),F);if(W?.kind!=="paragraph")return false;let N=hj(W).find(q=>q.start<q.end&&(H==="backward"?q.end===_:q.start===_));return N?(E(F,N),true):false},wordDeletionBoundary(H,Z,F,_){let W=ie(H,Z,F,_),N=e.selection().head.paragraphId;if(e.protected(N))return W;let q=Ta(e.part(N),N);if(q?.kind!=="paragraph")return W;let U=hj(q),ne=U.find(ee=>ee.start<ee.end&&(F===-1?ee.end===Z:ee.start===Z));if(ne)return F===-1?ne.start:ne.end;let re=W;for(let ee of U)for(let oe of [ee.start,ee.end])F===-1&&oe<Z&&oe>re&&(re=oe),F===1&&oe>Z&&oe<re&&(re=oe);return re},beforeSelect(H){let Z=Ce=>{if(b!==void 0)x=b;else if(H.anchor.paragraphId!==H.head.paragraphId||x?.paragraphId!==H.head.paragraphId)x=null;else {let Ve=Ta(e.part(),H.head.paragraphId),Ye=Ve?.kind==="paragraph"?hj(Ve).find($t=>$t.fieldNodeId===x?.fieldNodeId):null;(!Ye||Math.min(H.anchor.offset,H.head.offset)<Ye.start||Math.max(H.anchor.offset,H.head.offset)>Ye.end)&&(x=null);}return b=void 0,delete z.dataset.fieldError,Ce};if(i||P)return null;if(!e.editable())return H;let F=X();if(!F||!e.protected(F.paragraphId)||!F.field.enabled||!Si(F.field))return Z(H);let{field:_,paragraphId:W}=F;if((!b||b.fieldNodeId===_.fieldNodeId)&&H.anchor.paragraphId===W&&H.head.paragraphId===W&&Math.min(H.anchor.offset,H.head.offset)>=_.start&&Math.max(H.anchor.offset,H.head.offset)<=_.end)return Z(H);let N=a.get(_.fieldNodeId),q=N?.text,U=N?.locale??e.locale?.()??"en-US",ne=y(W,_);if(_.type==="date"&&q===void 0)return p(_.fieldNodeId),Z(H);let re=Ri(ne,_,"fill",U);if(re===ne||re===null&&(q===void 0||q===ne))return p(_.fieldNodeId),Z(H);i=true;let ee=e.part();c(ee);let oe=a;a=new Map(oe),a.delete(_.fieldNodeId);let ge;try{ge=e.apply({op:"commitTextFormField",locale:U,paragraphId:W,fieldNodeId:_.fieldNodeId}),ge||(a=oe);}catch(Ce){throw e.part()===ee&&(a=oe),Ce}finally{c(),i=false;}if(!ge){if(b=void 0,z.setAttribute("role","alert"),z.dataset.fieldError="true",z.textContent=n("textFormField.invalidValue"),re===null&&(_.type==="number"||_.type==="date")){T();let Ce=new AbortController;v=Ce,P=true;let Ve=()=>{if(k||Ce.signal.aborted||v!==Ce||(T(),k))return;let $t=e.selection(),Je=()=>{e.pagesLayer.focus({preventScroll:true}),e.select($t);},pt=Ta(e.part(),W),we=pt?.kind==="paragraph"?hj(pt).find(Ue=>Ue.fieldNodeId===_.fieldNodeId):null;if(!we||!e.editable()||!e.protected(W)||y(W,we)!==ne||!we.enabled||!Si(we)||we.type!==_.type||we.format!==_.format||Ri(ne,we,"fill",U)!==null){Je();return}i=true;try{if(e.apply({op:"deleteText",paragraphId:W,start:we.start,end:we.end,textFormFieldId:we.fieldNodeId})){p(we.fieldNodeId),delete z.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let Ue={paragraphId:W,offset:we.start};i=!1,e.select({anchor:Ue,head:Ue}),x={paragraphId:W,fieldNodeId:we.fieldNodeId};}else i=!1,Je();}finally{i=false;}},Ye={type:_.type,signal:Ce.signal,acknowledge:Ve,cancel(){v===Ce&&!Ce.signal.aborted&&C();}};!e.onInvalidRequest?.(Ye)&&!Ce.signal.aborted&&(g=NR(e.container,_.type,Ve,n));}return null}p(_.fieldNodeId);let Ie=Ta(e.part(),W),_e=Ie?.kind==="paragraph"?hj(Ie).find(Ce=>Ce.fieldNodeId===_.fieldNodeId):null,Mt=_e?_e.end-_.end:0,Ne=Ce=>Ce.paragraphId===W&&Ce.offset>=_.end?{...Ce,offset:Ce.offset+Mt}:Ce;return Z({anchor:Ne(H.anchor),head:Ne(H.head)})},update(){g&&RR(g,n);let H=X(),Z=e.selection(),F=!!H&&Z.anchor.offset!==Z.head.offset&&Math.min(Z.anchor.offset,Z.head.offset)===H.field.start&&Math.max(Z.anchor.offset,Z.head.offset)===H.field.end;for(let _ of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let W=_.closest("[data-paragraph-id]")?.dataset.paragraphId,N=Number(_.dataset.start);!!H&&W===H.paragraphId&&N>=H.field.start&&N<H.field.end?_.dataset.textFormSelection=F?"whole":"caret":delete _.dataset.textFormSelection;}if(z.dataset.fieldError){z.textContent=n("textFormField.invalidValue");return}H?z.setAttribute("role","status"):z.removeAttribute("role"),z.textContent=H?n(F?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>X()?.field.fieldNodeId??null,afterApply(H){H?c():u();},restoreAfterHistory:u,annotate(H){(!i||H.some(F=>F.op!=="commitTextFormField"))&&c(),H.some(F=>F.op==="insertText"||F.op==="deleteText")&&delete z.dataset.fieldError;let Z=X();return x=Z?{paragraphId:Z.paragraphId,fieldNodeId:Z.field.fieldNodeId}:null,H.map(F=>{if(!x||F.op!=="insertText"&&F.op!=="deleteText"||F.revision||F.paragraphId!==x.paragraphId||!e.protected(F.paragraphId))return F;let _=Ta(e.part(),F.paragraphId),W=_?.kind==="paragraph"?hj(_).find(U=>U.fieldNodeId===x.fieldNodeId):null,N=F.op==="insertText"?F.offset:F.start,q=F.op==="insertText"?F.offset:F.end;return !W||N<W.start||q>W.end?F:(a.has(W.fieldNodeId)||a.set(W.fieldNodeId,{text:y(F.paragraphId,W),locale:e.locale?.()??"en-US"}),{...F,textFormFieldId:W.fieldNodeId})})},keydown(H){if(H.key==="F10"&&H.shiftKey&&!H.altKey&&!H.ctrlKey&&!H.metaKey)return o=void 0,H.preventDefault(),e.pagesLayer.dispatchEvent(new MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(H.key!=="Tab"||H.altKey||H.ctrlKey||H.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let Z=[],F=[e.part().root];for(;F.length;){let re=F.pop();if(re.kind==="paragraph")for(let ee of hj(re))e.protected(re.id)&&ee.enabled&&Si(ee)&&!Yk$1(e.part(),{op:"insertText",paragraphId:re.id,offset:ee.start,text:"x"})&&Z.push({paragraphId:re.id,field:ee});else for(let ee=re.children.length-1;ee>=0;ee--){let oe=re.children[ee];oe.kind!=="textValue"&&F.push(oe);}}if(!Z.length)return false;let _=e.selection(),W=_.head,N=x?Z.findIndex(re=>re.paragraphId===x.paragraphId&&re.field.fieldNodeId===x.fieldNodeId&&re.field.start<=Math.min(_.anchor.offset,W.offset)&&re.field.end>=Math.max(_.anchor.offset,W.offset)):-1,q=N>=0?N:Z.findIndex(re=>re.paragraphId===W.paragraphId&&re.field.start<=Math.min(_.anchor.offset,W.offset)&&re.field.end>=Math.max(_.anchor.offset,W.offset)),U=q<0?H.shiftKey?Z.length-1:0:(q+(H.shiftKey?-1:1)+Z.length)%Z.length,ne=Z[U];return H.preventDefault(),E(ne.paragraphId,ne.field,"travel"),true},destroy(){k=true,T(),ac.get(e.container)===m&&ac.delete(e.container),ic.get(e.container)===h&&ic.delete(e.container),r.removeEventListener("pointermove",$),r.removeEventListener("pointercancel",j),e.pagesLayer.removeEventListener("click",R),e.pagesLayer.removeEventListener("contextmenu",pe),z.remove(),e.pagesLayer.removeEventListener("dblclick",G),e.pagesLayer.removeEventListener("pointerdown",B,{capture:true}),g?.remove(),g=null;}}}function qR(e,t,n,r=o=>o){let o,i=e.subscribe(a=>{for(let s of a.splitJoin)"split"in s&&s.split.from===t&&(o=s.split.tail);});try{n(()=>{let a=o&&r(o,t);if(!a)return null;let s={paragraphId:a,offset:0};return {anchor:s,head:s}});}finally{i();}}var sc=new WeakMap;function _s(e){let t=sc.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function VR(e){let t=sc.get(e)??{depth:0};return t.depth++,sc.set(e,t),()=>{--t.depth===0&&(sc.delete(e),t.resolve?.());}}async function KR(e,t,n){if(!e)throw gn("notFound","no document is loaded");let r=t?_s(t):void 0;if(r&&(await r,n()!==e))throw gn("invalidState","The document changed before the pending save could finish.");return e.save().slice().buffer}function jR(e,t,n){let r=()=>{if(n())throw gn("destroyed","Cannot save a destroyed surface.")};if(r(),_s(t))throw gn("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),r();let o=BR(t);if(o)throw gn(o,"Cannot save pending text form input. Enter a valid value in each field.");r(),e.refreshRefFieldResults(),r();let i=Un(t);uo(t,true);try{return e.session.save()}finally{uo(t,i);}}function lc(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function WR(e,t,n){let r=n.refusal();if(r)return r;let o=new Map;for(let a of e){if(a.op!=="commitTextFormField")return "invalidArgs";let s=Rt(n.session,a.paragraphId,{kind:"body"}),l=JSON.stringify(s),d=o.get(l)??{scope:s,ops:[]};d.ops.push(a),o.set(l,d);}for(let a of o.values()){let s=n.gate(a.ops,a.scope);if(s)return s}if(n.collaborationActive)return "unsupported";let i;return n.commit(()=>i=n.session.applyTreeOpsAtomic([...o.values()]),()=>t),i?.rejected?i.reason??"invalidArgs":null}function ZR(e,t){let n=Ni$1(e);return {get:()=>n,set(r){let o=Ni$1(r);n!==o&&(t(),n=o);}}}var c2=42,u2=/^(\d{4})-(\d{2})-(\d{2})/,f2=new Set(["AG","AS","BD","BR","BS","BT","BW","BZ","CA","CO","DM","DO","ET","GT","GU","HK","HN","ID","IL","IN","JM","JP","KE","KH","KR","LA","MH","MM","MO","MT","MX","MZ","NI","NP","PA","PE","PH","PK","PR","PT","PY","SA","SG","SV","TH","TT","TW","UM","US","VE","VI","WS","YE","ZA","ZW"]),p2=new Set(["AE","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]);function ni(e){return `${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function _r(e){let t=u2.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),o=Number(t[3]);if(r<1||r>12||o<1||o>31)return null;let i=new Date(n,r-1,o);return i.getFullYear()!==n||i.getMonth()!==r-1||i.getDate()!==o?null:i}function dc(e){let t=Ni$1(e);try{let n=new Intl.Locale(t),r=n,o=r.getWeekInfo?.().firstDay??r.weekInfo?.firstDay;if(typeof o=="number"&&o>=1&&o<=7)return o%7;let i=n.maximize().region;if(i&&f2.has(i))return 0;if(i&&p2.has(i))return 6}catch{}return 1}function UR(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function zR(e,t,n){return new Intl.DateTimeFormat(Ni$1(n),{calendar:"gregory",month:"long",year:"numeric"}).format(new Date(e,t,1))}function GR(e){let t=Ni$1(e),n=new Intl.DateTimeFormat(t,{calendar:"gregory",weekday:"narrow"}),r=dc(t);return Array.from({length:7},(o,i)=>n.format(new Date(2024,0,7+(r+i)%7)))}function $m(e,t,n={}){let r=Ni$1(n.locale),o=n.selected?_r(n.selected):null,i=n.today??new Date,a=new Intl.DateTimeFormat(r,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric"}),s=dc(r),l=(new Date(e,t,1).getDay()-s+7)%7,d=[];for(let c=0;c<c2;c+=1){let u=new Date(e,t,c-l+1);d.push({iso:ni(u),day:u.getDate(),label:a.format(u),otherMonth:u.getMonth()!==t,selected:o!==null&&UR(u,o),today:UR(u,i)});}return {year:e,month:t,title:zR(e,t,r),weekdays:GR(r),days:d}}function cc(e,t,n){let r=new Date(e,t+n,1);return {year:r.getFullYear(),month:r.getMonth()}}function qm(e,t,n,r=false){let o=_r(e);if(!o)return null;let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},a=(o.getDay()-dc(n)+7)%7;if(t==="PageUp"||t==="PageDown"){let s=o.getDate();o.setDate(1),o.setMonth(o.getMonth()+(t==="PageUp"?-1:1)*(r?12:1));let l=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();o.setDate(Math.min(s,l));}else {let s=t==="Home"?-a:t==="End"?6-a:i[t];if(s===void 0)return null;o.setDate(o.getDate()+s);}return o.getFullYear()>=100&&o.getFullYear()<=9999?ni(o):null}function uc(e,t){let n=_r(e);if(!n)return "";let r=Ni$1(t),o=new Intl.NumberFormat(r,{useGrouping:false}).format(0);return new Intl.DateTimeFormat(r,{calendar:"gregory",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(n).map(i=>i.type==="year"?i.value.padStart(4,o):i.value).join("")}function Vm(e,t){if(e.length>100)return null;let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n)){let s=_r(n);return s?ni(s):null}let r=Oi(Ni$1(t)),o=r.pattern.exec(Pi(n,r));if(!o)return null;let i={year:"",month:"",day:""};if(r.order.forEach((s,l)=>{i[s]=o[l+1];}),i.year.length!==4)return null;let a=`${i.year}-${i.month.padStart(2,"0")}-${i.day.padStart(2,"0")}`;return _r(a)?a:null}function Km(e){let t=new Intl.DateTimeFormat(Ni$1(e),{calendar:"gregory",month:"long"});return Array.from({length:12},(n,r)=>t.format(new Date(2e3,r,1)))}function jm(e){let t="",n=0,r=new Intl.Collator(Ni$1(e),{usage:"search",sensitivity:"base"});return {reset(){t="",n=0;},keyDown(o,i){if(o.defaultPrevented||o.isComposing||o.altKey||o.ctrlKey||o.metaKey)return;let a=o.target.tagName==="INPUT",s=[...i.querySelectorAll('[role="option"]')].filter(c=>!c.hasAttribute("disabled"));if(!s.length)return;let l=s.indexOf(i.ownerDocument.activeElement),d;if(o.key==="ArrowDown")d=Math.min(s.length-1,l+1);else if(o.key==="ArrowUp")d=l<0?s.length-1:Math.max(0,l-1);else if(!a&&o.key==="Home")d=0;else if(!a&&o.key==="End")d=s.length-1;else if(!a&&o.key.length===1&&o.key!==" "){let c=Date.now();t=c-n>700?o.key:(t+o.key).slice(-100),n=c;let u=[...t].every(p=>r.compare(p,o.key)===0)?o.key:t;for(let p=1;p<=s.length;p++){let m=(Math.max(-1,l)+p)%s.length;if(r.compare((s[m].textContent??"").slice(0,u.length),u)===0){d=m;break}}}d!==void 0&&(o.preventDefault(),s.forEach((c,u)=>{c.tabIndex=u===d?0:-1;}),s[d]?.focus({preventScroll:true}),s[d]?.scrollIntoView?.({block:"nearest"}));}}}var m2=0;function XR(e,t){let n=e.document.createElement("div");n.className="docx-content-control-menu",n.dataset.docxMarker="",n.dataset.docxPart="popup",n.addEventListener("keydown",r=>Ds(n,r,()=>e.close(n))),n.dataset.docxCcId=t,n.setAttribute("contenteditable","false"),n.style.position="absolute",n.style.zIndex="20",n.style.pointerEvents="auto",n.addEventListener("pointerdown",r=>r.stopPropagation());for(let r of ["keydown","beforeinput","input","compositionstart","compositionupdate","compositionend","copy","cut","paste"])n.addEventListener(r,o=>o.stopPropagation());return n}function YR(e,t,n){if(!n){t.append(e);return}e.style.left=`${n.left}px`,e.style.top=`${n.top}px`;let r=n.element?t.closest(".docx-editor__scroll-container")??t.parentElement??t:t;if(r.append(e),n.element){let a=Ns(e,n.element),s=new MutationObserver(()=>{e.isConnected||(a(),s.disconnect());});s.observe(r,{childList:true});return}let o=e.offsetWidth;if(o<=0)return;let i=n.left+o-n.sheetRight;i>0&&(e.style.left=`${Math.max(n.sheetLeft,n.left-i)}px`);}function fc(e,t,n,r){if(e.setValue(n,r))return e.close(t),true;let o=t.querySelector("[data-docx-part=error]");return o||(o=e.document.createElement("div"),o.dataset.docxPart="error",o.className="docx-content-control-widget-error",o.setAttribute("role","alert"),t.append(o)),o.hidden=false,o.textContent=Rn(e.translate)("disabledReason.invalidValue"),false}function QR(e,t,n,r,o,i){let a=XR(e,t),s=Rn(e.translate);a.setAttribute("role","dialog"),a.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let l=e.document.createElement("div");l.className="docx-content-control-menu-list",l.dataset.docxPart="list",l.id=`docx-engine-cc-list-${++m2}`,l.setAttribute("role","listbox"),l.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let d=jm(e.locale());a.addEventListener("keydown",u=>d.keyDown(u,a));let c=r.findIndex(u=>u.value===i);for(let[u,p]of r.entries()){let m=e.document.createElement("button");m.type="button",m.className="docx-content-control-menu-item",m.dataset.docxPart="item",m.dataset.value=p.value,m.setAttribute("role","option"),m.setAttribute("aria-selected",String(p.value===i)),m.tabIndex=u===Math.max(0,c)?0:-1,m.textContent=p.displayText,m.addEventListener("click",()=>{fc(e,a,t,p.value);}),l.append(m);}if(n==="buildingBlockGallery"&&r.length===0){let u=e.document.createElement("div");u.className="docx-content-control-menu-empty",u.dataset.docxPart="empty",u.setAttribute("role","note"),u.tabIndex=0,u.textContent=s("contentControl.gallery.empty"),l.append(u);}if(n==="comboBox"){let u=e.document.createElement("input");u.type="text",u.className="docx-content-control-menu-input",u.dataset.docxPart="input",u.value=i??"",u.setAttribute("aria-label",o||s("contentControl.types.comboBox")),u.setAttribute("aria-autocomplete","list"),u.setAttribute("role","combobox"),u.setAttribute("aria-expanded","true"),u.setAttribute("aria-controls",l.id),u.addEventListener("keydown",m=>{m.key!=="Enter"||m.isComposing||(m.preventDefault(),fc(e,a,t,u.value));}),a.append(u);let p=e.document.createElement("div");p.className="docx-dialog__footer",p.dataset.docxPart="footer";for(let m of ["cancel","apply"]){let h=e.document.createElement("button");h.type="button",h.className=`docx-dialog__button${m==="apply"?" docx-dialog__button--primary":""}`,h.dataset.docxPart=m,h.textContent=s(`common.${m}`),h.addEventListener("click",()=>{m==="apply"?fc(e,a,t,u.value):e.close(a);}),p.append(h);}a.append(l,p);}else a.append(l);return a}function pc(e,t){let n=(t?e.querySelector(`[data-iso="${t}"]`):null)??e.querySelector("[data-selected]")??e.querySelector("[data-today]:not([data-other-month])")??e.querySelector(".docx-content-control-calendar-day:not([data-other-month])");for(let r of e.querySelectorAll("[data-iso]"))r.tabIndex=r===n?0:-1;n?.focus({preventScroll:true});}function JR(e,t,n,r){let o=Rn(e.translate),i=XR(e,t);i.classList.add("docx-content-control-calendar"),i.setAttribute("role","dialog"),i.setAttribute("aria-label",r||o("contentControl.types.date"));let a=n?_r(n):null,s=a?ni(a):null,l=new Date,d={year:(a??l).getFullYear(),month:(a??l).getMonth()},c=null,u=uc(s??"",e.locale()),p=g=>{fc(e,i,t,g);},m=g=>{g.addEventListener("mousedown",x=>x.stopPropagation());},h=e.document.createElement("div");h.className="docx-content-control-calendar-title docx-content-control-calendar-announcement",h.dataset.docxPart="title",h.setAttribute("aria-live","polite");let b=()=>{let g=e.document.activeElement?.dataset.docxCalendarNav,x=$m(d.year,d.month,{locale:e.locale(),selected:s,today:l}),v=e.document.createElement("div");v.className="docx-content-control-calendar-header",v.dataset.docxPart="header";let k=e.document.createElement("button");k.type="button",k.className="docx-content-control-calendar-nav",k.dataset.docxPart="previousMonth",k.dataset.docxCalendarNav="previous",k.textContent="\u2039",k.setAttribute("aria-label",o("contentControl.calendar.previousMonth")),h.textContent=x.title;let P=e.document.createElement("button");P.type="button",P.className="docx-content-control-calendar-nav",P.dataset.docxPart="nextMonth",P.dataset.docxCalendarNav="next",P.textContent="\u203A",P.setAttribute("aria-label",o("contentControl.calendar.nextMonth")),m(k),m(P),k.addEventListener("click",()=>{d=cc(d.year,d.month,-1),c=null,b();}),P.addEventListener("click",()=>{d=cc(d.year,d.month,1),c=null,b();});let T=e.document.createElement("div");T.className="docx-content-control-calendar-navigation",T.dataset.docxPart="navigation";let C=e.document.createElement("select");C.className="docx-content-control-calendar-month",C.dataset.docxPart="month",C.dataset.docxCalendarNav="month",C.setAttribute("aria-label",o("contentControl.calendar.month"));for(let[G,X]of Km(e.locale()).entries()){let ie=e.document.createElement("option");ie.value=String(G),ie.textContent=X,C.append(ie);}C.value=String(d.month);let E=e.document.createElement("input");E.type="number",E.min="100",E.max="9999",E.value=String(d.year),E.className="docx-content-control-calendar-year",E.dataset.docxPart="year",E.dataset.docxCalendarNav="year",E.addEventListener("keydown",G=>{G.key==="Enter"&&!G.isComposing&&(G.preventDefault(),E.blur());}),E.setAttribute("aria-label",o("contentControl.calendar.year")),C.addEventListener("change",()=>{d.month=Number(C.value),c=null,b();}),E.addEventListener("change",()=>{let G=Number(E.value);if(!Number.isInteger(G)||G<100||G>9999){E.value=String(d.year);return}d.year=G,c=null,b();}),T.append(C,E);let w=e.document.createElement("div");w.className="docx-content-control-calendar-weekdays",w.dataset.docxPart="weekdays";for(let G of x.weekdays){let X=e.document.createElement("span");X.textContent=G,w.append(X);}let I=e.document.createElement("div");I.className="docx-content-control-calendar-grid",I.dataset.docxPart="grid",I.setAttribute("role","grid"),I.setAttribute("aria-label",x.title);for(let G=0;G<x.days.length;G+=7){let X=e.document.createElement("div");X.className="docx-content-control-calendar-week",X.setAttribute("role","row");for(let ie of x.days.slice(G,G+7))X.append(y(ie));I.append(X);}let L=e.document.createElement("div");L.className="docx-content-control-calendar-entry",L.dataset.docxPart="dateEntry";let A=e.document.createElement("button");A.type="button",A.className="docx-content-control-calendar-today",A.dataset.docxPart="today",A.textContent=o("contentControl.calendar.today"),m(A),A.addEventListener("click",()=>p(ni(l)));let B=e.document.createElement("input");B.type="text",B.className="docx-content-control-menu-input",B.dataset.docxPart="input",B.setAttribute("aria-label",o("contentControl.types.date")),B.placeholder=uc("2006-11-22",e.locale()),B.value=u,B.addEventListener("input",()=>{u=B.value,B.removeAttribute("aria-invalid"),$.hidden=true;});let $=e.document.createElement("div");$.className="docx-content-control-widget-error",$.dataset.docxPart="error",$.setAttribute("role","alert"),$.hidden=true,$.textContent=o("disabledReason.invalidValue");let j=()=>{let G=Vm(u,e.locale());G?p(G):($.hidden=false,B.setAttribute("aria-invalid","true"),B.focus());};B.addEventListener("keydown",G=>{G.key==="Enter"&&!G.isComposing&&(G.preventDefault(),j());});let R=e.document.createElement("div");R.className="docx-dialog__footer",R.dataset.docxPart="footer";for(let G of ["cancel","apply"]){let X=e.document.createElement("button");X.type="button",X.dataset.docxPart=G,X.className=`docx-dialog__button${G==="apply"?" docx-dialog__button--primary":""}`,X.textContent=o(`common.${G}`),X.addEventListener("click",G==="apply"?j:()=>e.close(i)),R.append(X);}v.append(k,T,P,h),L.append(A,B),i.replaceChildren(v,w,I,L,$,R),pc(i,c),g==="previous"&&k.focus({preventScroll:true}),g==="next"&&P.focus({preventScroll:true}),g==="month"&&C.focus({preventScroll:true}),g==="year"&&E.focus({preventScroll:true});},y=g=>{let x=e.document.createElement("button");return x.type="button",x.className="docx-content-control-calendar-day",x.dataset.docxPart="day",x.textContent=String(g.day),x.dataset.iso=g.iso,x.setAttribute("role","gridcell"),x.setAttribute("aria-label",g.label),g.otherMonth&&(x.dataset.otherMonth=""),g.selected&&(x.dataset.selected="",x.setAttribute("aria-selected","true")),x.setAttribute("aria-selected",String(g.selected)),g.today&&(x.dataset.today="",x.setAttribute("aria-current","date")),m(x),x.addEventListener("click",()=>p(g.iso)),x.addEventListener("keydown",v=>{if(v.isComposing||v.altKey||v.ctrlKey||v.metaKey)return;let k=qm(g.iso,v.key,e.locale(),v.shiftKey);if(!k)return;v.preventDefault();let P=_r(k);if(c=k,P.getFullYear()!==d.year||P.getMonth()!==d.month){d={year:P.getFullYear(),month:P.getMonth()},b();return}pc(i,c);}),x};return b(),i}function Wm(e,t){let r=(t instanceof Element?t:null)?.closest("[data-docx-form-checkbox][data-start]"),o=r?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!r||!o)return null;let i=Ta(e.part(o),o);if(i?.kind!=="paragraph")return null;let a=Number(r.dataset.start),s=jj(i).find(l=>l.start<=a&&a<l.end);return s?{paragraphId:o,field:s}:null}function eP(e){return e.shiftKey||e.altKey||e.ctrlKey||e.metaKey}function tP(e){let t=(i,a)=>{if(!e.editable()||!a.enabled)return false;let s=e.apply({op:"setLegacyCheckbox",paragraphId:i,fieldNodeId:a.fieldNodeId,checked:!a.checked});return s&&(e.pagesLayer.focus({preventScroll:true}),e.select({anchor:{paragraphId:i,offset:a.start},head:{paragraphId:i,offset:a.end}})),s},n=i=>{if(i.button!==0||eP(i))return;let a=Wm(e,i.target);!a||!e.editable()||!a.field.enabled||(i.preventDefault(),i.stopPropagation(),t(a.paragraphId,a.field));};e.pagesLayer.addEventListener("pointerdown",n,{capture:true});let r=i=>{let a=Wm(e,i.target);a&&i.target instanceof HTMLElement&&i.target.setAttribute("aria-disabled",String(!e.editable()||!a.field.enabled));};e.pagesLayer.addEventListener("focusin",r);let o=()=>{let i=e.selection();if(i.anchor.paragraphId!==i.head.paragraphId)return null;let a=i.head.paragraphId,s=Ta(e.part(a),a);if(s?.kind!=="paragraph")return null;let l=Math.min(i.anchor.offset,i.head.offset),d=Math.max(i.anchor.offset,i.head.offset),c=jj(s).find(u=>u.start===l&&u.end===d||l===d&&l===u.start&&e.protected(a));return c?{paragraphId:a,field:c}:null};return {keydown(i){let a=Wm(e,i.target);if(a&&i.key==="Tab")return true;if(a&&i.key.length===1&&i.key!==" "&&!i.ctrlKey&&!i.metaKey&&!i.altKey)return i.preventDefault(),true;if(i.key!==" "||eP(i)||i.isComposing)return false;let s=a??o();if(!s)return false;if(!e.editable()||!s.field.enabled)return a?(i.preventDefault(),true):false;i.preventDefault();let l=t(s.paragraphId,s.field);return a&&l&&[...e.pagesLayer.querySelectorAll("[data-docx-form-checkbox][data-start]")].find(d=>d.dataset.paragraphId===s.paragraphId&&Number(d.dataset.start)===s.field.start)?.focus({preventScroll:true}),true},destroy(){e.pagesLayer.removeEventListener("pointerdown",n,{capture:true}),e.pagesLayer.removeEventListener("focusin",r);}}}var g2=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTable","insertTableRow","deleteTableRow","setRunProperties","setParagraphProperties","setParagraphMarkProperties"]);function Zm(e){return g2.has(e.op)}function Um(e){if(Zm(e))return e.revision!==void 0;switch(e.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "insertContentControl":case "authorTable":case "setListNumbering":case "setListLevel":case "splitParagraphMany":return e.revision!==void 0;default:return false}}function zm(e){return e?.trim()||void 0}function nP(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function rP(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}function Xi(e,t,n){if(!e)return null;let r=ge(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var oP="docx-field-atom--active",h2="docx-field-atom",iP=new WeakMap;function Gm(e,t,n){let r=iP.get(e);r||(r={caretKey:null,marked:[]},iP.set(e,r));let o=t?`${t.paragraphId}\0${t.offset}`:null;if(!n?.domReplaced&&o===r.caretKey)return;for(let a of r.marked)a.classList.remove(oP);if(r.marked=[],r.caretKey=o,!t)return;let i=e.querySelectorAll(`.${h2}`);for(let a of i){if(a.dataset.paragraphId!==t.paragraphId)continue;let s=Number(a.dataset.fieldResultStart??a.dataset.start),l=Number(a.dataset.fieldResultEnd??a.dataset.end);!Number.isFinite(s)||!Number.isFinite(l)||t.offset<s||t.offset>l||(a.classList.add(oP),r.marked.push(a));}}var y2={kind:"body"};function aP(e){let{session:t}=e;if(e.editingMode==="view"||!t.editable)return true;if(e.collaborationActive)return false;let n,r=e.reviewerFilterActive?l=>(n??=T(e.canonicalUnfilteredLayout()),n(l)):T(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},i=U(t.part(),o),a=V(t.part(),o);if(!i&&a.length===0)return true;let s=[];i&&s.push({scope:y2,ops:[i]});for(let l of a)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function lP(e){let t=0,n=null,r="",o=null,i=true,a=null,s="";return ()=>{let l=e.surface(),d=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,c=e.activeKey(),u=e.paneOpen(),p=e.selectionAnchor(),m=e.authorFilterKey();return (l!==n||d!==r||c!==o||u!==i||p!==a||m!==s)&&(n=l,r=d,o=c,i=u,a=p,s=m,t+=1),t}}function mc(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=ab(t),o=null,i="accept",a=null,s="accept",l=new WeakMap,d=null,c=false,u=0,p=null,m=[],h=null,b=[],y=r,g=t,x=new Set,v="accept",k=new WeakSet,P=new WeakMap,T=new Map,C=()=>{u+=1,p=null,m=[],h=null;},E=L=>JSON.stringify([L.id,xj(L)]),w=(L,A,B)=>{let $=b2(B),j=t,R=r?.hiddenAuthors??$a,G=i,X;j===g&&v2($,x)&&($.size===0||G===v)?X=y:$.size===0&&j.size===0?X=void 0:X=Object.freeze({hiddenAuthors:R,includes:pe=>!j.has(pe.author)&&!$.has(pe.nodeId),includesNode:(pe,K)=>!j.has(K)&&!$.has(pe),excludedNodeMode:(pe,K)=>j.has(K)?"proposed":$.has(pe)&&G==="reject"?"original":"proposed",cacheKey:x2(j,$,G)});let ie=[];for(let pe of L){let K=sP(pe);K!==null&&j.has(K)||pe.kind==="revision"&&A.has(pe)||ie.push(pe);}b=ie.length===L.length?L:kk$1(ie),h=L,k=A,y=X,g=j,x=$,v=G,c=false,a=null,s="accept",l=new WeakMap,d=null;},I=L=>{if(L===h)return;let A=new WeakSet,B=[],$=[];try{for(let R of L){if(R.kind!=="revision")continue;let G=!t.has(R.author),X=P.get(R);X===void 0&&(X=o?.(R)??!0,$.push([R,X])),!(G&&X)&&(A.add(R),X||B.push(R));}}catch(R){if(c)o=a,i=s,P=l,h=d,a=null,s="accept",l=new WeakMap,d=null,u+=1;else {let G=new WeakSet,X=[];for(let ie of L){if(ie.kind!=="revision")continue;let pe=T.get(E(ie))??true;(t.has(ie.author)||!pe)&&G.add(ie),pe||X.push(ie);}w(L,G,X);}throw c=false,R}for(let[R,G]of $)P.set(R,G);let j=new Map;for(let R of L)R.kind==="revision"&&j.set(E(R),P.get(R)??true);T=j,w(L,A,B);};return {get hiddenAuthors(){return r?.hiddenAuthors??$a},get hiddenAuthorList(){return n},get stateKey(){return String(u)},get hasFilter(){return t.size>0||o!==null},filterFor(L){return o?(I(L),y):r},filterForSession(L){return o?(I(L.reviewItems()),y):r},filterItems(L){if(!o){if(t.size===0)return L;if(L===p)return m;let A=L.filter(B=>{let $=sP(B);return $===null||!t.has($)});return p=L,m=A.length===L.length?L:kk$1(A),m}return I(L),b},includesRevisionItem(L){return !k.has(L)},setPredicate(L,A="accept"){return o===null&&L===null?false:L===null?(o=null,i="accept",a=null,s="accept",c=false,P=new WeakMap,l=new WeakMap,T=new Map,d=null,b=[],k=new WeakSet,y=r,g=t,x=new Set,v="accept",C(),true):(a=o,s=i,l=P,d=h,c=true,o=L,i=A,P=new WeakMap,C(),true)},isVisible:L=>!t.has(L),setVisible(L,A){if(A===!t.has(L))return false;let B=new Set(t);return A?B.delete(L):B.add(L),t=B,n=Object.freeze([...B]),r=ab(B),C(),true},setAllVisible(L,A){let B=A?new Set:new Set(L);return B.size===t.size&&[...B].every($=>t.has($))?false:(t=B,n=Object.freeze([...B]),r=ab(B),C(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,C(),true)}}}function Xm(e,t){return t.filterItems(e)}function b2(e){let t=new Set;for(let n of e)for(let r of xj(n))t.add(r);return t}function v2(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function x2(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function sP(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function dP(e,t){let n=r=>{if(!t.enabled)return;let o=t.surface();if(o)return o.setAllRevisionAuthorsVisible(r);!r||!e.showAll()||t.notify();};return {isReviewAuthorVisible:e.isVisible,setReviewAuthorVisible(r,o){if(!t.enabled)return;let i=t.surface();if(i)return i.setRevisionAuthorVisible(r,o);e.setVisible(r,o)&&t.notify();},setAllReviewAuthorsVisible:n,showAllReviewAuthors:()=>n(true)}}var S2=Object.freeze({mode:"atomic",run:e=>e(),wrap:e=>e,methods:e=>e,listeners:()=>{},selectsWholeFieldWhen:()=>{},edits:e=>e});function w2(e){if(e===void 0||e==="atomic")return "atomic";if(e==="editable")return "editable";throw new TypeError('Invalid fieldResults: use "atomic" or "editable"')}var Ym='fieldResults "editable" is not supported in a collaboration session: shared paragraph text keeps each field one unit';function I2(e){if(e==="atomic")return S2;let t=o=>kf(e,o),n=o=>function(...i){return t(()=>o.apply(this,i))},r=()=>false;return {mode:e,run:t,wrap:n,selectsWholeFieldWhen(o){r=o;},edits:o=>function(...i){return r()?lf(()=>o.apply(this,i)):o.apply(this,i)},methods(o){for(let i of Reflect.ownKeys(o)){let a=Object.getOwnPropertyDescriptor(o,i);if(a?.configurable){if(typeof a.value=="function")a.value=n(a.value);else if(a.get||a.set)a.get&&(a.get=n(a.get)),a.set&&(a.set=n(a.set));else continue;Object.defineProperty(o,i,a);}}return o},listeners(o){let i=o.addEventListener,a=o.removeEventListener,s=new WeakMap,l=d=>{let c=s.get(d);return c||(c=typeof d=="function"?function(u){return t(()=>d.call(this,u))}:u=>t(()=>d.handleEvent(u)),s.set(d,c)),c};Object.defineProperty(o,"addEventListener",{configurable:true,writable:true,value(d,c,u){c&&i.call(o,d,l(c),u);}}),Object.defineProperty(o,"removeEventListener",{configurable:true,writable:true,value(d,c,u){c&&a.call(o,d,s.get(c)??c,u);}});}}}function cP(e,t){if(t.mode==="atomic")return e;let n=e,r=n.subscribe.bind(n),o=n.applyTreeOps.bind(n),i=n.applyTreeOpsAtomic.bind(n);return n.subscribe=a=>r(t.wrap(a)),n.applyTreeOps=t.edits(o),n.applyTreeOpsAtomic=t.edits(i),t.methods(e)}function gc(e){let t=w2(e.fieldResults);if(t==="editable"&&e.collaborationModel)throw new TypeError(Ym);return I2(t)}function hc(e,t){let n=e.part(t),r=n?Ta(n,t):null;return r?.kind!=="paragraph"?[]:Ki$1(r).filter(o=>o.start<o.end)}function k2(e,t){return hc(e,t.paragraphId).find(n=>t.offset>n.start&&t.offset<n.end)}function R2(e,t){let n=(i,a)=>{let s=k2(e,i);if(!s||a.paragraphId===i.paragraphId&&a.offset>=s.start&&a.offset<=s.end)return i;let l=e.compare(a,i)<0?s.end:s.start;return {paragraphId:i.paragraphId,offset:l}},r=n(t.anchor,t.head),o=n(t.head,t.anchor);return r===t.anchor&&o===t.head?t:{anchor:r,head:o}}function P2(e,t){if(t.length!==2)return t;let[n,r]=t;if(n?.op!=="deleteText"||r?.op!=="insertText"||r.paragraphId!==n.paragraphId||n.start>=n.end||r.offset!==n.start&&r.offset!==n.end)return t;let{start:o,end:i}=n,a=hc(e,n.paragraphId).find(l=>l.start<=o&&i<=l.end);if(!a||o!==a.start&&i!==a.end)return t;let s=r.text.length;return [{...r,offset:o,...o===a.start?{bias:"right"}:{}},{...n,start:o+s,end:i+s}]}function uP(e,t,n){if(n.mode==="atomic")return e;let{selectForDeletion:r,wordDeletionBoundary:o,beforeSelect:i,annotate:a}=e,s=null,l=c=>s!==null&&c.anchor.paragraphId===s.anchor.paragraphId&&c.head.paragraphId===s.head.paragraphId&&c.anchor.offset===s.anchor.offset&&c.head.offset===s.head.offset;n.selectsWholeFieldWhen(()=>l(t.selection()));let d=c=>{let{anchor:u,head:p}=t.selection();if(!(u.paragraphId!==p.paragraphId||u.offset!==p.offset))return hc(t,p.paragraphId).find(m=>c===-1?m.end===p.offset:m.start===p.offset)};return Object.assign(e,{annotate:n.wrap(c=>a.call(e,l(t.selection())?c:P2(t,c))),selectForDeletion:n.wrap(c=>{let u=t.writable()?d(c==="backward"?-1:1):void 0;if(!u)return r.call(e,c);let{paragraphId:p}=t.selection().head;return s={anchor:{paragraphId:p,offset:u.start},head:{paragraphId:p,offset:u.end}},t.select(s),true}),wordDeletionBoundary:n.wrap((c,u,p,m)=>{let h=o.call(e,c,u,p,m),b=hc(t,t.selection().head.paragraphId),y=b.find(x=>p===-1?x.end===u:x.start===u);if(y)return p===-1?y.start:y.end;let g=h;for(let x of b)for(let v of [x.start,x.end])p===-1&&v<u&&v>g&&(g=v),p===1&&v>u&&v<g&&(g=v);return g}),beforeSelect:n.wrap(c=>(l(c)||(s=null),i.call(e,R2(t,c))))})}function fP(e,t){let n=false,r=()=>{n=false,t();};return ()=>{if(n)return;n=true;let o=e.defaultView?.requestAnimationFrame;o?o(r):queueMicrotask(r);}}function Qm(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function pP(e){let t=null;return {get(){let n=e.layout(),r=e.items(),o=e.styles(),i=t;if(i?.layout===n&&i.items===r&&i.styles===o)return i;let a=e.slots.resolve(d$2(n),(function*(){for(let p of r){let m=Qm(p);m!==null&&(yield m);}})()),s=i?.value,l=s!==void 0&&s.size===a.size&&[...a].every(([u,p])=>s.get(u)===p),d=l?s:a,c$1=i!==null&&l&&i.styles===o?i.resolved:new Map(c(d,o).map(u=>[u.author,u]));return t={layout:n,items:r,styles:o,value:d,resolved:c$1},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function mP(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$5(o.color)??a$6(o.slot);let i=e.slots.resolve(r.value,[n]).get(n);return i===void 0?void 0:a$6(i)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:b$1(r)}),a$5(t.resolved.get(n)?.color)}}}function Yi(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}var gP=new WeakMap;function T2(e){let t=[],n={x:e.box.x,y:e.box.y};for(let r of [e.header,e.footer]){if(!r)continue;let o={x:r.box.x,y:r.box.y};Fa(r,(i,a)=>{a.textboxDepth===0||a.textboxOwner?.accessibility.hidden||t.push(Me(i,a.storyOrigin.x-e.contentBox.x,a.storyOrigin.y-e.contentBox.y));},o,i=>wa(i,o,n));}return t}function ri(e){let t=gP.get(e);if(t)return t;let n=e.pages.map(o=>{let i=yd$1(o).flatMap(a=>{let s=a.textboxStory;return s.fragments.flatMap(l=>l.kind==="paragraph"?[Me(l,a.x+s.contentOffset.x,a.y+s.contentOffset.y)]:[])});return i.push(...T2(o)),i.length?{...o,fragments:[...o.fragments,...i]}:o}),r=n.every((o,i)=>o===e.pages[i])?e:{...e,pages:n};return gP.set(e,r),r}function yP(e,t,n){let r=t(e.anchor.paragraphId),o=t(e.head.paragraphId);return !r||!o?null:{anchor:{paragraphId:r.paragraphId,offset:Math.max(0,e.anchor.offset)},head:{paragraphId:o.paragraphId,offset:Math.max(0,e.head.offset)},...n?{kind:n}:{}}}function bP(e,t){let n=Ta(e,t);if(!n||n.kind==="textValue")return null;let r=wb(n);return !r||!vb(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var Jm=new WeakMap;function C2(e,t,n){return e.map(r=>a$5(n?.(r.name))??a$5(r.color)??a$5(t?.(r.name)))}function E2(e,t){let n="";for(let[r,o]of e.entries())n+=`${o.actorId} ${o.name} ${t[r]??""} ${o.kind??""} `,n+=`${o.anchor.nodeId}:${o.anchor.offset} `,n+=`${o.head.nodeId}:${o.head.offset}
23
- `;return n}function O2(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function M2(e){if(!e||e.size===0)return "";let t=[];for(let[n,r]of e)t.push(`${n}:${r}`);return t.sort(),t.join(",")}function A2(e,t,n){return e.layout===n.layout&&e.fingerprint===n.fingerprint&&e.pagesKey===n.pagesKey&&e.scale===n.scale&&e.offsetKey===n.offsetKey&&e.labelHost===n.labelHost&&e.childCount===t.childElementCount}function hP(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function F2(e,t){let n=ma(e,t.anchor.nodeId),r=ma(e,t.head.nodeId);if(!n||!r)return [];let o=ea$2(e,n,r);return o?ia$1(e,o.cellIds).map(i=>({...i,className:"docx-remote-selection-rect"})):[]}function vP(e,t,n,r){t=ri(t);let{scale:o,pageOffsetX:i,pages:a,colorForAuthor:s,declaredColorFor:l}=r,d=r.labelHost??null,c=C2(n,s,l),u={layout:t,fingerprint:E2(n,c),pagesKey:O2(a),scale:o,offsetKey:M2(i),labelHost:d},p=Jm.get(e);if(p&&A2(p,e,u))return;Jm.delete(e);let m=[],h=[],b=[],y=[];for(let[k,P]of n.entries())P.kind==="cells"||hP(P)||y.push({key:String(k),from:{paragraphId:P.anchor.nodeId,offset:P.anchor.offset},to:{paragraphId:P.head.nodeId,offset:P.head.offset}});let g=y.length>0?Be(t,y,Sa(t),a,r.measurer):null;for(let[k,P]of n.entries()){let T=c[k],C=oe(t,{paragraphId:P.head.nodeId,offset:P.head.offset},r.measurer);if(C){let w=Ae(t,P.head.nodeId,C.pageIndex);b.push({selection:P,...T?{color:T}:{},pageIndex:C.pageIndex,x:C.x+w.x,y:C.y+w.y});}if(P.kind==="cells"){let w=F2(t,P);if(w.length>0){for(let I of w)m.push(I),h.push(T);continue}}if(hP(P)){let w=oe(t,{paragraphId:P.anchor.nodeId,offset:P.anchor.offset},r.measurer);if(!w)continue;let I=Ae(t,P.anchor.nodeId,w.pageIndex);m.push({pageIndex:w.pageIndex,x:w.x+I.x,y:w.y+I.y,width:Math.max(1/o,1),height:w.height,className:"docx-remote-caret"}),h.push(T);continue}let E=g?.get(String(k));if(E)for(let w of E)m.push({...w,className:"docx-remote-selection-rect"}),h.push(T);}r$1(e,t,m,{scale:o,pageOffsetX:i}),[...e.children].forEach((k,P)=>{let T=a$5(h[P]);!T||!(k instanceof HTMLElement)||k.style.setProperty("--doc-remote-color",T);});let x=e.ownerDocument,v=[];for(let k of b){let P=t.pages[k.pageIndex];if(!P)continue;let T=x.createElement("div");T.className="docx-remote-caret-label",d?(T.setAttribute("data-docx-remote-actor",k.selection.actorId),v.push({element:T,selection:k.selection})):T.textContent=k.selection.name,T.style.left=`${(P.contentBox.x+k.x+(i?.get(k.pageIndex)??0))*o}px`,T.style.top=`${(P.contentBox.y+k.y)*o}px`;let C=a$5(k.color);C&&T.style.setProperty("--doc-remote-color",C),e.append(T);}Jm.set(e,{...u,childCount:e.childElementCount}),d&&d.publish(v);}function L2(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var RP=/^[^\s]{1,512}$/,eg=/["\\\u0000-\u001f\u007f]/;function PP(e,t){return !e||t===void 0||!/^\d{1,9}$/.test(t)||!RP.test(e)||e==="__proto__"?null:{paragraphId:e,offset:Number(t)}}function fo(e){let t=PP(e.dataset?.paragraphId,e.dataset?.start);if(!t)return null;let{paragraphId:n,offset:r}=t,o=e.dataset?.end,i=o!==void 0&&/^\d{1,9}$/.test(o)&&Number(o)>=r?Number(o):r+(e.textContent?.length??0);return {paragraphId:n,start:r,end:i}}function Qi(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return null;let t=e;return !t.classList.contains("docx-inline-drawing-advance")||t.parentElement?.dataset.paragraphId===void 0?null:PP(t.dataset.drawingParagraphId,t.dataset.drawingStart)}function N2(e,t){let n=eg.test(t)?"[data-paragraph-id][data-start], .docx-inline-drawing-advance":`[data-paragraph-id="${t}"][data-start], .docx-inline-drawing-advance[data-drawing-paragraph-id="${t}"]`,r=[],o=[];for(let i of e.querySelectorAll(n))i.classList.contains("docx-inline-drawing-advance")?Qi(i)?.paragraphId===t&&o.push(i):r.push(i);return {spans:r,spacers:o}}function bc(e,t,n){return eg.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function TP(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=fo(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function CP(e){return e.querySelector("[data-docx-hf-active]")}function oi(e,t){if(!e||t&&!t.contains(e))return;let o=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest("[data-page-index]")?.dataset?.pageIndex;if(!(o===void 0||!/^\d{1,9}$/.test(o)))return Number(o)}function D2(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function yc(e,t){let n=CP(e);if(n)return [n,e];let r=D2(e,t);return r&&r!==e?[r,e]:[e]}function xP(e,t){let n=l=>({paragraphId:l.paragraphId,offset:t?l.end:l.start}),r=l=>t?{...l,offset:l.offset+1}:l,o=TP(e);if(o)return n(o.identity);let i=Qi(e);if(i)return r(i);if(e.nodeType!==Node.ELEMENT_NODE)return null;let a=e.querySelectorAll("[data-paragraph-id][data-start], .docx-inline-drawing-advance"),s=t?[...a].reverse():[...a];for(let l of s){let d=Qi(l);if(d)return r(d);let c=fo(l);if(c)return n(c)}return null}function SP(e,t,n=false){let r=[...e.childNodes];if(r.length===0)return null;let o=Qi(r[t-1]);if(o)return {paragraphId:o.paragraphId,offset:o.offset+1};for(let i=Math.max(0,t);!n&&i<r.length;i+=1){let a=xP(r[i],false);if(a)return a}for(let i=Math.min(t,r.length)-1;i>=0;i-=1){let a=xP(r[i],true);if(a)return a}return null}function wP(e,t,n){if(!n.contains(e))return null;let r=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(r?.closest("[data-docx-field]"))return null;let o=r?.closest("[data-docx-hf]");if(o&&!o.hasAttribute("data-docx-hf-active")||CP(n)&&r?.closest(".docx-page-content"))return null;let i=r?.closest("[data-docx-marker]"),a=Qi(i??void 0);if(a)return t>0?{...a,offset:a.offset+1}:a;let s=r?.closest(".docx-terminator-seat");if(s?.querySelector(".docx-line-break-mark")&&s.parentElement){let c=s.parentElement,u=[...c.querySelectorAll(".layout-run[data-start]")].filter(h=>h.closest(".docx-line")===c).flatMap(h=>{let b=fo(h);return b?[{run:h,identity:b}]:[]}),p=u.at(-1)?.identity.paragraphId,m;for(let h of u)h.identity.paragraphId===p&&(!m||h.identity.start>m.identity.start)&&(m=h);if(m){let h=m.run.textContent===`
24
- `,{start:b,end:y}=m.identity;return {paragraphId:m.identity.paragraphId,offset:h?b:y}}}let l=s??(i?.classList.contains("docx-wrap-advance")?i:null);if(l?.parentElement){let c=[...l.parentElement.childNodes],u=c.indexOf(l);if(s){let h="[data-start], a, br, .docx-inline-drawing-advance, .docx-wrap-advance";for(;u>0&&!c[u-1].matches?.(h);)u-=1;}let p=!s&&t>0?1:0,m=SP(l.parentElement,u+p,!!s);if(m)return m}if(i)return i.parentElement?EP(i.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let c=e,u=fo(c);if(u)return {paragraphId:u.paragraphId,offset:t>0?u.end:u.start};let p=SP(c,t);return p||$2(c)}let d=TP(e);return d?{paragraphId:d.identity.paragraphId,offset:L2(d.identity,t)}:null}function Ji(e,t){if(!t||t.rangeCount===0)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}=t;if(!n||!o)return null;let a=wP(n,r,e),s=wP(o,i,e);if(!a||!s){let l=a??s;return l?{anchor:l,head:l}:null}return {anchor:a,head:s}}function tg(e,t){if(!t||t.rangeCount===0)return false;let{anchorNode:n,focusNode:r}=t;return !!n&&e.contains(n)||!!r&&e.contains(r)}function IP(e,t,n,r){if(r!==void 0)for(let o of yc(e,n)){let i=eg.test(r)?"[data-line-id]":`[data-line-id="${r}"]`;for(let a of o.querySelectorAll(i)){if(a.dataset.lineId!==r)continue;let s=kP(a,t);if(s)return s}}for(let o of yc(e,n)){let i=kP(o,t);if(i)return i}return null}function H2(e,t){let n=null;for(let r of e){if(!r.hasAttribute("data-docx-field")||!r.parentNode)continue;let o=fo(r);if(o?.paragraphId===t.paragraphId){if(o.start===t.offset)return {node:r.parentNode,offset:[...r.parentNode.childNodes].indexOf(r)};o.end===t.offset&&(n=r);}}if(n){let r=fo(n);for(let o of e){let i=fo(o);i?.paragraphId===t.paragraphId&&i.start===r.start&&i.end===r.end&&(n=o);}}return n?.parentNode?{node:n.parentNode,offset:[...n.parentNode.childNodes].indexOf(n)+1}:null}function kP(e,t){let{spans:n,spacers:r}=N2(e,t.paragraphId),o=H2(n,t);if(o)return o;let i=null,a=false;for(let m of n){let h=fo(m);if(!h||h.paragraphId!==t.paragraphId)continue;let b=_2(m),y=m.textContent?.length??0,g=h.end;if(b){if(m.closest?.("[data-docx-field]")){a=true;continue}if(a=true,t.offset>=h.start&&t.offset<=g){let x={node:b,offset:Math.min(t.offset-h.start,y)};if(t.offset<g)return x;i=x;}}}let s=m=>r.find(h=>Qi(h)?.offset===m)??null,l=s(t.offset);if(i&&l?.parentNode&&!l.parentNode.contains(i.node))return {node:l.parentNode,offset:[...l.parentNode.childNodes].indexOf(l)};if(i)return i;let d=l,c=d?null:s(t.offset-1),u=d??c;if(u?.parentNode)return {node:u.parentNode,offset:[...u.parentNode.childNodes].indexOf(u)+(c?1:0)};if(a||=r.length>0,a)return null;let p=B2(e,t.paragraphId);return p?{node:p,offset:0}:null}function _2(e){let t=e.firstChild;for(;t&&t.nodeType===Node.ELEMENT_NODE;)t=t.firstChild;return t&&t.nodeType===Node.TEXT_NODE?t:null}function B2(e,t){let n=null;for(let r of bc(e,t,""))if(r.dataset?.paragraphId===t&&r.dataset?.start===void 0){if(r.dataset?.lineId!==void 0)return r;n??=r;}return n}function EP(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!RP.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function $2(e){let t=EP(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function OP(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??oi(n.anchorNode,e),a=Ot(t,{anchor:t.head,head:t.head})?r?.preferredLineId:void 0,s=IP(e,t.anchor,o,a),l=IP(e,t.head,o,a);if(!s||!l)return false;let d=Ji(e,n);if(d&&Ot(d,t)){let c=oi(n.anchorNode,e),p=(n.focusNode?.nodeType===Node.ELEMENT_NODE?n.focusNode:n.focusNode?.parentElement)?.closest("[data-line-id]")?.dataset.lineId;if((o===void 0||c===o)&&(a===void 0||p===a))return true}try{return n.setBaseAndExtent(s.node,s.offset,l.node,l.offset),!0}catch{return false}}function Ot(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}var q2='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function MP(e,t,n){let r=e.dataset.end;if(r===void 0||!/^\d{1,9}$/.test(r))return n;let o=Number(r);return o>=t?o:n}function AP(e,t){if(e.dataset.paragraphId!==t)return null;let n=e.dataset.start;return n===void 0||!/^\d{1,9}$/.test(n)?null:Number(n)}function V2(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function K2(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function FP(e,t,n,r){if(e.dataset.docxField!==void 0){let i=MP(e,t,t);return {start:t,end:i,text:n.slice(t,i),seq:r}}let o=e.textContent??"";return {start:t,end:MP(e,t,t+o.length),text:o,seq:r}}function LP(e,t){for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let s=n.textContent??"";s.length>0&&(t.pieces.push({start:t.end,end:t.end,text:s,seq:t.seq}),t.seq+=1);continue}if(n.nodeType!==Node.ELEMENT_NODE)continue;let r=n,o=AP(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0)continue;let s=r.dataset?.drawingStart;if(r.dataset?.drawingParagraphId===t.paragraphId&&s!==void 0&&/^\d{1,9}$/.test(s)){t.end=Math.max(t.end,Number(s)+1);continue}if(r.matches?.(q2))continue;LP(r,t);continue}let i=FP(r,o,t.modelText,t.seq);t.seq+=1,t.end=Math.max(t.end,i.end);let a=`${i.start}:${i.end}`;t.ranges.has(a)||(t.ranges.add(a),t.pieces.push(i));}}function j2(e,t,n,r){let o=[];for(let a of bc(e,t,"")){let s=a;s.dataset.paragraphId===t&&s.dataset.start===void 0&&(o.some(l=>l.contains(s))||o.push(s));}let i=new Map;for(let a of o){let s=a.dataset.fragmentIndex??"",l=K2(a,n,r),d=i.get(s);(!d||l>d.affinity)&&i.set(s,{element:a,affinity:l});}return [...i.values()].map(a=>a.element)}function W2(e,t,n){for(let r of bc(e,n.paragraphId,"[data-start]")){let o=r,i=AP(o,n.paragraphId);if(i===null||t.some(l=>l.contains(o)))continue;let a=FP(o,i,n.modelText,n.seq);n.seq+=1;let s=`${a.start}:${a.end}`;n.ranges.has(s)||(n.ranges.add(s),n.pieces.push(a));}}function Z2(e,t){let n=[...e].sort((i,a)=>i.start-a.start||i.seq-a.seq),r="",o=0;for(let i of n)i.start>o&&(r+=t.slice(o,i.start)),r+=i.text,o=Math.max(o,i.end);return o<t.length&&(r+=t.slice(o)),r}function NP(e,t,n,r){let o=j2(e,t,r,V2(r)),i={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let a of o)LP(a,i);return W2(e,o,i),i.pieces.length===0?null:Z2(i.pieces,n)}var $P={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"};function U2(e){return $P[e.key]||e.key==="PageUp"||e.key==="PageDown"?true:(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="a"}var DP={l:"left",e:"center",r:"right",j:"both"},HP={1:"240",5:"360",2:"480"},_P={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function z2(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}function qP(e,t={}){return n=>{if(n.defaultPrevented||e.editingMode()==="view"&&U2(n))return;if(n.key==="F9"&&n.altKey&&!n.ctrlKey&&!n.metaKey&&!n.shiftKey&&!n.isComposing&&t.onToggleFieldCodes){n.preventDefault(),t.onToggleFieldCodes();return}if(!n.altKey&&!n.isComposing&&(n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.key==="8"||n.ctrlKey&&!n.metaKey&&n.shiftKey&&(n.code==="Digit8"||n.key==="*"))&&t.onToggleParagraphMarks){n.preventDefault(),t.onToggleParagraphMarks();return}if(n.key==="Escape"&&e.formatPainter.state().mode!=="off"){e.formatPainter.disarm(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="headerFooter"){e.exitHeaderFooter(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="note"){e.exitNote(),n.preventDefault();return}let r=Sm(n);if(z2(n,r)&&!n.shiftKey){let a=r;if(a==="f"){n.preventDefault(),e.insertNote("footnote");return}if(a==="d"){n.preventDefault(),e.insertNote("endnote");return}if(a==="c"){n.preventDefault(),e.formatPainter.capture();return}if(a==="v"){n.preventDefault(),e.formatPainter.apply();return}}let o=n.metaKey||n.ctrlKey,i=$P[n.key];if(i){let a=i;n.key==="Home"||n.key==="End"?o&&(a=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?a=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?a=n.key==="ArrowLeft"?"lineStart":"lineEnd":o&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(a=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(a,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(o?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){o||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){o||n.altKey?e.deleteWordForward():e.deleteForward(),n.preventDefault();return}if(n.key==="Tab"){if(e.contentControls.formFill()&&e.contentControls.navigate(n.shiftKey?"previous":"next")){n.preventDefault();return}let a=n.shiftKey?"decrease":"increase";e.isListParagraph()?e.adjustIndent(a):e.indentWithTab(a)||(n.shiftKey?e.adjustIndent("decrease"):e.insertTab()),n.preventDefault();return}if(n.key==="Enter"){o?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(o&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="v"){e.armForcePlainPaste();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){t.onRequestHyperlink(),n.preventDefault();return}if(o&&!n.shiftKey&&_P[n.key.toLowerCase()]){let a=_P[n.key.toLowerCase()];e.toggleRunProperty(a.localName,a.attributes),n.preventDefault();return}if(o&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(o&&!n.shiftKey&&DP[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperties([{localName:"jc",attributes:{val:DP[n.key.toLowerCase()]},physicalAlignment:true}]),n.preventDefault();return}if(o&&!n.shiftKey&&HP[n.key]){e.setParagraphProperty("spacing",{line:HP[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}if(o&&n.key.toLowerCase()==="y"){e.redo(),n.preventDefault();return}(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="z"&&(n.shiftKey?e.redo():e.undo(),n.preventDefault());}}function VP(e){let t=i=>{let a=e.copyFlavours();return a.reason?(i.preventDefault(),false):!a.text||!i.clipboardData?false:(i.clipboardData?.setData("text/plain",a.text),a.html&&i.clipboardData?.setData("text/html",a.html),true)};return {onCopy:i=>{t(i)&&i.preventDefault();},onCut:i=>{t(i)&&(e.deleteSelection(),i.preventDefault());},onPaste:i=>{let a=yp(i.clipboardData),s=i.clipboardData?.getData("text/html")??"";i.preventDefault(),!(!a&&!s)&&e.pasteRich(a,s.length>0?s:null);}}}function BP(e){let t=yp(e.dataTransfer);return t.length>0?t:null}function KP(e,t){return n=>{if(n.preventDefault(),!t.isComposing()){if(n.inputType==="insertText"&&n.data!=null){e.enqueueType(n.data);return}if(n.inputType!=="insertFromPaste"){if(n.inputType==="insertReplacementText"){let r=n.data??BP(n);if(!r)return;Q2(e,X2(n),r),t.onBrowserSelectionFixup?.();return}if(n.inputType==="deleteContentBackward"){e.deleteBackward();return}if(n.inputType==="deleteWordBackward"){e.deleteWordBackward();return}if(n.inputType==="deleteContentForward"){e.deleteForward();return}if(n.inputType==="deleteWordForward"){e.deleteWordForward();return}if(n.inputType==="insertLineBreak"){e.insertLineBreak();return}if(n.inputType==="insertFromDrop"||n.inputType==="insertFromPasteAsQuotation"){let r=BP(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function G2(e){let{startContainer:t,endContainer:n}=e;if(t===n&&t.nodeType===Node.TEXT_NODE)return (t.textContent??"").slice(e.startOffset,e.endOffset);let r=t.ownerDocument;if(!r)return null;try{let o=r.createRange();return o.setStart(t,e.startOffset),o.setEnd(n,e.endOffset),o.toString()}catch{return null}}function X2(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=G2(n);return r?{text:r,paragraphId:Y2(n)}:null}function Y2(e){let t=e.startContainer;return t.isConnected?(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement??null)?.closest("[data-paragraph-id]")?.getAttribute("data-paragraph-id")??null:null}function Q2(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,i=t.text;if(Ot(r.selection,We(o))&&o.offset>=i.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let a=Fe(e.session,o.paragraphId)??e.session.part(),s=Vi$1(a,o.paragraphId);s!==null&&s.slice(o.offset-i.length,o.offset)===i&&e.setSelection({anchor:{paragraphId:o.paragraphId,offset:o.offset-i.length},head:o});}}e.type(n);}function jP(e,t,n,r=null){for(let o of yc(e)){let i=NP(o,t,n,r);if(i!==null)return i}return null}function WP(e,t,n){if(n===t)return null;let r=0;for(;r<n.length&&r<t.length&&n[r]===t[r];)r+=1;let o=0;for(;o<n.length-r&&o<t.length-r&&n[n.length-1-o]===t[t.length-1-o];)o+=1;let i=n.slice(r,n.length-o),a=[];return t.length-o>r&&a.push({op:"deleteText",paragraphId:e,start:r,end:t.length-o}),i.length>0&&a.push({op:"insertText",paragraphId:e,offset:r,text:i}),a.length===0?null:{ops:a,caret:r+i.length}}var J2="equation replacement and removal are not supported in suggesting mode",ZP=new WeakMap,UP=new WeakSet;function ng(e,t){let n=Ta(e,t);if(!n||n.kind!=="paragraph")return [];let r=ZP.get(n);if(r)return r;let o=[];for(let a of hg$1(n))for(let s of Ze$2(a.node)){let l=Te$1(s);if(!l)continue;let d=Object.freeze({id:s.id,paragraphId:t,start:a.start,end:a.end,linear:Ve(l.expression),fallbackText:l.fallbackText,supported:Tn(l.expression)});Pn(l.expression)&&UP.add(d),o.push(d);}let i=Object.freeze(o);return ZP.set(n,i),i}function zP(e,t,n){let r=ng(e,t).filter(o=>o.start===n);return r.length===0?null:r.map(o=>o.linear||o.fallbackText).join(" ")}function Pn(e){switch(e.kind){case "bar":return true;case "text":return e.format!==void 0;case "fallback":return false;case "row":return e.items.some(Pn);case "fraction":return Pn(e.numerator)||Pn(e.denominator);case "radical":return Pn(e.radicand)||e.degree!==void 0&&Pn(e.degree);case "script":return Pn(e.base)||e.subscript!==void 0&&Pn(e.subscript)||e.superscript!==void 0&&Pn(e.superscript);case "nary":return Pn(e.body)||e.lowerLimit!==void 0&&Pn(e.lowerLimit)||e.upperLimit!==void 0&&Pn(e.upperLimit)}}function Tn(e){switch(e.kind){case "fallback":case "bar":return false;case "text":return e.format===void 0;case "row":return e.items.every(Tn);case "fraction":return Tn(e.numerator)&&Tn(e.denominator);case "radical":return Tn(e.radicand)&&(e.degree===void 0||Tn(e.degree));case "script":return Tn(e.base)&&(e.subscript===void 0||Tn(e.subscript))&&(e.superscript===void 0||Tn(e.superscript));case "nary":return Tn(e.body)&&(e.lowerLimit===void 0||Tn(e.lowerLimit))&&(e.upperLimit===void 0||Tn(e.upperLimit))}}function GP(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function XP(e){let t=null,n=a=>{let s=e.pagesLayer.ownerDocument.defaultView;if(!s||!(a instanceof s.Element))return null;let l=a.closest("[data-docx-equation]");return l&&e.pagesLayer.contains(l)?l:null},r=(a,s)=>{let l=e.equationById(a);l&&(e.pagesLayer.contentEditable!=="false"&&e.setSelection({anchor:{paragraphId:l.paragraphId,offset:l.start},head:{paragraphId:l.paragraphId,offset:l.end}}),e.onPopover?.({equation:l,rect:s}));},o=a=>{t=null;let s=n(a.target),l=s?.dataset.docxEquation;if(!s||!l)return;let d=s.getBoundingClientRect();t={equationId:l,rect:{left:d.left,top:d.top,right:d.right,bottom:d.bottom}};},i=a=>{let s=n(a.target),l=s?.dataset.docxEquation,d=t;if(t=null,!s||!l){if(!d)return;a.preventDefault(),r(d.equationId,d.rect);return}let c=s.getBoundingClientRect();a.preventDefault(),r(l,{left:c.left,top:c.top,right:c.right,bottom:c.bottom});};return e.pagesLayer.addEventListener("pointerdown",o,true),e.pagesLayer.addEventListener("click",i),{destroy:()=>{e.pagesLayer.removeEventListener("pointerdown",o,true),e.pagesLayer.removeEventListener("click",i);}}}function YP(e){let t=()=>e.session.partFor(e.storyScope()),n=l=>{let d=t();return d?ng(d,l):[]},r=()=>{let l=e.selection().head;return GP(n(l.paragraphId),l)},o=l=>{let d=n(e.selection().head.paragraphId).find(c=>c.id===l);if(d)return d;for(let c of e.session.storyParts()){let u=Ta(c,l);if(!u||u.kind!=="generic"||u.namespaceUri!==Re$1||u.localName!=="oMath")continue;let p=u;for(;p&&p.kind!=="paragraph";)p=Ua$1(c,p.id);return !p||p.kind!=="paragraph"?null:ng(c,p.id).find(m=>m.id===l)??null}return null},i=(l,d)=>{let c=false,u={paragraphId:l.paragraphId,offset:l.start};return e.commit(()=>{let p=e.session.applyTreeOps([d],e.selectionMark(),{paragraphId:u.paragraphId,start:u.offset,end:u.offset},e.storyScope());return c=p.committed,p},()=>({anchor:u,head:u})),c},a=(l,d)=>{let c=o(l);if(!c)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest")return {ok:false,code:"unsupported",reason:J2};if(d==="replace"&&UP.has(c))return {ok:false,code:"unsupported",reason:"compact linear editing cannot preserve this equation source formatting"};let u=d==="replace"?{op:"setMathEquation",equationId:l,linear:c.linear}:{op:"removeMathEquation",equationId:l},p=e.writeRefusal(u);return p===null?{ok:true}:{ok:false,code:"locked",reason:p}},s=l=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:l.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:a,applyEquation(l,d){let c=o(l);if(!c)return false;let u=a(l,"replace");return u.ok?c.supported&&c.linear===d?true:i(c,{op:"setMathEquation",equationId:l,linear:d}):s(u)},removeEquation(l){let d=o(l);if(!d)return false;let c=a(l,"remove");return c.ok?i(d,{op:"removeMathEquation",equationId:l}):s(c)}}}function QP(e,t){for(let[n,r]of t){let o=Ta(e,n);if(o&&o.kind!=="textValue"&&o.kind==="paragraph"&&r&&r.end>r.start){let i=jg$1(o),a=[...o.children];for(;a.length;){let s=a.pop();if(s.kind!=="textValue"){if(G(s)){let l=i.spanOf(s);if(l?l.end>r.start&&l.start<r.end:r.start===0&&r.end===1/0)return true}for(let l of s.children)a.push(l);}}}}return false}function vc(e){let t=Ce(e);if(!t.ok)return false;for(let n of t.package.parts.values())if(H([n.root]))return true;return false}function Ze(e){return e.kind!=="textValue"}function fe(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Ze(n)&&n.localName===t&&n.namespaceUri===la$2)return n;return null}function rt(e,t="val"){return e?Yf$1(e,t,la$2):void 0}function Cn(e,t,n){return e?Yf$1(e,t,n):void 0}function rg(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=rg(n);return t}function ea(e,t,n){if(e.kind==="textValue")return null;if(e.localName===t&&e.namespaceUri===n)return e;for(let r of e.children){let o=ea(r,t,n);if(o)return o}return null}function po(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function nn(e){return nd(e)}function og(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var pr=og;function xc(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function zn(e){return `${Math.round(e/20*100)/100}pt`}var eH="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",tH=Ib;function Bs(e,t,n){for(let o of He$1(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let i=B$1(o.ownerPart,o.rawTarget);if(i.ok){let a=e.parts.get(i.partName);if(a&&Ze(a.root))return a.root}}let r=e.parts.get(n);return r&&Ze(r.root)?r.root:null}function JP(e){let t=Bs(e,eH,"/word/styles.xml"),n=new Map,r=null,o=null,i=null,a=null,s=null;if(!t)return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:i,defaultCharacterStyleId:a,defaultTableStyleId:s};let l=0,d=null;for(let c of t.children){if(!Ze(c)||c.namespaceUri!==la$2)continue;if(c.localName==="docDefaults"){d=c,r=fe(fe(c,"rPrDefault"),"rPr"),o=fe(fe(c,"pPrDefault"),"pPr");continue}if(c.localName!=="style")continue;if(l>=hd$1)break;l+=1;let u=Yf$1(c,"styleId",la$2);if(!u)continue;n.set(u,c);let p=Yf$1(c,"default",la$2),m=Yf$1(c,"type",la$2);p==="1"||p==="true"||p==="on"?m==="paragraph"?i=u:m==="character"?a=u:m==="table"&&(s=u):(i===u&&(i=null),a===u&&(a=null),s===u&&(s=null));}if(t.namespaceUri===la$2){let c=K(d);c.run&&(r=M("rPr","application")),c.paragraph&&(o=M("pPr","application"));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:i,defaultCharacterStyleId:a,defaultTableStyleId:s}}function Br(e,t,n){let r=[],o=new Set,i=t;for(;i&&!o.has(i)&&r.length<tH;){o.add(i);let a=e.byId.get(i);if(!a)break;if(r.length===0&&n!==void 0){let s=Yf$1(a,"type",la$2);if(s!==void 0&&s!==n)return []}r.unshift(a),i=rt(fe(a,"basedOn"));}return r}function ig(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let i of n)r.push(i);let o=rt(fe(t,"pStyle"));for(let i of Br(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let a=fe(i,"pPr");a&&r.push(a);}return t&&r.push(t),r}function Sc(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let i=[];if(r)for(let u of r)i.push(u);let a=[],s=rt(fe(t,"pStyle"));for(let u of Br(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let p=fe(u,"rPr");p&&a.push(p);}let l=[],d=rt(fe(n,"rStyle"))??e.defaultCharacterStyleId??void 0;for(let u of Br(e,d,"character")){let p=fe(u,"rPr");p&&l.push(p);}let c=[...o,...i,...a,...l];return n&&c.push(n),{all:c,defaults:o,tableLevel:i,paragraphLevel:a,characterLevel:l,direct:n}}function En(e,t){let n=null;for(let r of e){let o=fe(r,t);o&&(n=o);}return n}function wt(e,t,n){let r;for(let o of e){let i=fe(o,t);if(!i)continue;let a=Yf$1(i,n,la$2);a!==void 0&&(r=a);}return r}function wc(e){return !(e==="0"||e==="false"||e==="off")}function mr(e,t){let n=false;for(let r of e){let o=fe(r,t);o&&(n=wc(rt(o)));}return n}function mo(e,t){let n;for(let r of e){let o=fe(r,t);o&&(n=wc(rt(o)));}return n}function Gn(e,t){let n=e.direct?fe(e.direct,t):null;if(n)return wc(rt(n));let r=mo(e.tableLevel,t),o=mo(e.paragraphLevel,t),i=mo(e.characterLevel,t);return i===false||i===void 0&&o===false||i===void 0&&o===void 0&&r===false?false:mo(e.defaults,t)===true?true:r===true!=(o===true)!=(i===true)}function ag(e,t){let n=e.direct?fe(e.direct,t):null;if(n)return wc(rt(n));let r=mo(e.characterLevel,t);if(r!==void 0)return r;let o=mo(e.paragraphLevel,t);if(o!==void 0)return o;let i=mo(e.tableLevel,t);return i!==void 0?i:mo(e.defaults,t)===true}function eT(e){return e.isLgl?"decimal":e.numFmt}function tT(e){let t=lc$1(e),n=new Map,r=new Map,o=new Map,i=new Map,a=new Map,s=new Map;for(let[l,d]of t.abstractNums){d.numStyleLink!==void 0&&s.set(l,d.numStyleLink);let c=new Map,u=new Map;for(let[p,m]of d.levels)c.set(String(p),eT(m)),u.set(String(p),m.start);r.set(l,c),o.set(l,u);}for(let[l,d]of t.nums){n.set(l,d.abstractNumId);for(let[c,u]of d.overrides){let p=`${l}:${c}`,m=u.startOverride??u.level?.start;m!==void 0&&i.set(p,m),u.level!==void 0&&a.set(p,eT(u.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:i,formatOverrides:a,styleLinks:s}}function nT(e,t){return e===null?null:nd(Yf$1(e,t,la$2))}function oT(e,t){if(e===null)return null;let n=Yf$1(e,t,la$2);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function rT(e){return `${Math.round(e/20*100)/100}pt`}var nH=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function ta(e,t,n){if(e===null)return null;let r=Yf$1(e,t,la$2);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Yf$1(e,"val",la$2);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function sg(e,t){let n=new Map,r=new Set(nH);for(let o of e)for(let i of o.children){if(i.kind==="textValue"||i.localName!=="tblStylePr"||i.namespaceUri!==la$2)continue;let a=Yf$1(i,"type",la$2);a===void 0||!r.has(a)||n.set(a,{fill:oT(fe(fe(i,"tcPr"),"shd"),"fill"),rPr:fe(i,"rPr"),pPr:fe(i,"pPr")});}return {byType:n,firstRowEnabled:ta(t,"firstRow",32)??false,lastRowEnabled:ta(t,"lastRow",64)??false,firstColumnEnabled:ta(t,"firstColumn",128)??false,lastColumnEnabled:ta(t,"lastColumn",256)??false,hBandingEnabled:!(ta(t,"noHBand",512)??false),vBandingEnabled:!(ta(t,"noVBand",1024)??false)}}function lg(e,t,n,r,o,i){let a=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,d=e.lastColumnEnabled&&o,c=u=>e.byType.get(u)??null;if(s&&l&&c("swCell"))return c("swCell");if(s&&d&&c("seCell"))return c("seCell");if(a&&l&&c("nwCell"))return c("nwCell");if(a&&d&&c("neCell"))return c("neCell");if(s&&c("lastRow"))return c("lastRow");if(a&&c("firstRow"))return c("firstRow");if(d&&c("lastCol"))return c("lastCol");if(l&&c("firstCol"))return c("firstCol");if(e.hBandingEnabled){let u=t-(e.firstRowEnabled?1:0);if(u>=0){let p=c(u%2===0?"band1Horz":"band2Horz");if(p)return p}}if(e.vBandingEnabled){let u=i-(e.firstColumnEnabled?1:0);if(u>=0){let p=c(u%2===0?"band1Vert":"band2Vert");if(p)return p}}return null}function iT(e,t,n,r,o,i,a,s,l=false,d=[]){let c=[],u=fe(e,"tcBorders"),p={top:n===0?"top":"insideH",bottom:n+o>=r?"bottom":"insideH",left:i?"left":"insideV",right:a?"right":"insideV"};for(let k of ["top","left","bottom","right"]){let P=k==="left"?"start":k==="right"?"end":k,T=fe(u,k)??fe(u,P),C=p[k],E=C==="left"?"start":C==="right"?"end":C,w=T!==null?Vo(T):Vo(fe(t,C)??fe(t,E));w&&c.push(`border-${jn(k,l)}:${w}`);}let m=oT(fe(e,"shd"),"fill")??s;m&&c.push(`background-color:${m}`);let h=fe(e,"vAlign"),b=h===null?void 0:Yf$1(h,"val",la$2);b==="center"?c.push("vertical-align:middle"):(b==="bottom"||b==="top")&&c.push(`vertical-align:${b}`);let y=fe(e,"tcW"),g=nT(y,"w"),x=y===null?void 0:Yf$1(y,"type",la$2);g!==null&&g>0&&(x===void 0||x==="dxa")&&c.push(`width:${rT(g)}`);let v=fe(e,"tcMar");for(let k of ["top","right","bottom","left"]){let P=k==="left"?"start":k==="right"?"end":k,T=fe(v,k)??fe(v,P)??d.map(w=>fe(w,k)??fe(w,P)).find(w=>w!==null)??null,C=nT(T,"w"),E=T===null?void 0:Yf$1(T,"type",la$2);C!==null&&C>=0&&(E===void 0||E==="dxa")&&c.push(`padding-${jn(k,l)}:${rT(C)}`);}return c.join(";")}function rH(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===la$2}function aT(e){return e.localName==="customXml"&&e.namespaceUri===la$2}function sT(e){let t=[],n=[],r=o=>{for(let i of o)if(Ze(i)){if(i.kind==="tableRow"||i.localName==="tr"&&i.namespaceUri===la$2){n.push({row:t.length}),t.push(i);continue}if(i.kind==="contentControl"){let a=i.children.find(s=>s.kind==="contentControlContent");a&&Ze(a)&&r(a.children);continue}if(aT(i)){r(i.children);continue}n.push({skip:i});}};return r(e.children),{rows:t,tableItems:n}}function lT(e){let t=[],n=[],r=new Set;for(let o of e){let i=new Set,a=[],s=[],l=0,d=c=>{for(let u of c)if(Ze(u)){if(rH(u)){let p=fe(u,"tcPr"),m=Math.min(Math.max(po(rt(fe(p,"gridSpan")))??1,1),63),h=fe(p,"vMerge"),b=h===null?null:rt(h)==="restart"?"restart":"continue",y=b==="continue"&&!r.has(l)?"restart":b;b!==null&&i.add(l);let g={cell:u,startColumn:l,span:m,vMerge:y};a.push(g),s.push({placement:g}),l+=m;continue}if(u.kind==="contentControl"){let p=u.children.find(m=>m.kind==="contentControlContent");p&&Ze(p)&&d(p.children);continue}if(aT(u)){d(u.children);continue}s.push({skip:u});}};d(o.children),r=i,t.push(a),n.push(s);}return {placements:t,items:n}}function dT(e){let t=1;for(let n of e)for(let r of n)t=Math.max(t,r.startColumn+r.span);return t}function cT(e,t,n,r){let o=new Map,i=t.byType.get("wholeTable")??null;for(let a=0;a<n.length;a+=1)for(let s of n[a]??[]){if(s.vMerge==="continue")continue;let l=lg(t,a,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),d=[],c=[];i?.rPr&&d.push(i.rPr),i?.pPr&&c.push(i.pPr),l?.rPr&&d.push(l.rPr),l?.pPr&&c.push(l.pPr),o.set(s.cell,d.length>0||c.length>0?{...e,tableRPr:d,tablePPr:c}:e);}return o}function uT(e,t){let n=Br(e.styles,rt(fe(t,"tblStyle")),"table");return n.length>0?n:Br(e.styles,e.styles.defaultTableStyleId??void 0,"table")}function fT(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Ze(n)?n:null,o=uT(e,r),i=sg(o,fe(r,"tblLook")),{rows:a}=sT(t),{placements:s}=lT(a);return cT(e,i,s,dT(s))}function pT(e,t,n,r){let o=t.children.find(w=>w.kind==="tableProperties"),i=o&&Ze(o)?o:null,a=null,s=uT(e,i);for(let w of s){let I=fe(fe(w,"tblPr"),"tblBorders");I&&(a=I);}let l=s.map(w=>fe(w,"tblPr")).filter(w=>w!==null);i&&l.push(i);let d=mr(l,"bidiVisual"),c=[],u;for(let w of l){let I=fe(w,"tblCellMar");I&&c.unshift(I),u=rt(fe(w,"jc"))??u;}let p=fe(i,"tblBorders");p&&(a=p);let m=sg(s,fe(i,"tblLook")),{rows:h,tableItems:b}=sT(t),{placements:y,items:g}=lT(h),x=dT(y),v=cT(e,m,y,x),k=["border-collapse:collapse"],P=fe(i,"tblW"),T=nn(Cn(P,"w",la$2));T!==null&&T>0&&Cn(P,"type",la$2)==="dxa"&&k.push(`width:${zn(T)}`);let C=jn(u==="right"||u==="end"?"right":u==="center"?"center":"left",d);C==="center"?k.push("margin-left:auto","margin-right:auto"):C==="right"?k.push("margin-left:auto","margin-right:0"):k.push("margin-left:0","margin-right:auto");for(let[w,I]of [["insideH","insideh"],["insideV","insidev"]]){let L=Vo(fe(a,w));L&&k.push(`mso-border-${I}-alt:${L}`);}let E=`<table dir="${d?"rtl":"ltr"}" align="${C}" style="${k.join(";")}">`;for(let w of b){if("skip"in w){r.advanceFieldState(w.skip,n);continue}let I=w.row,L=fe(fe(h[I]??null,"trPr"),"trHeight"),A=nn(Cn(L,"val",la$2)),B=Ex(A,Cn(L,"hRule",la$2)),$=B===""?"":` style="${B}"`;E+=`<tr${$}>`;for(let j of g[I]??[]){if("skip"in j){r.advanceFieldState(j.skip,n);continue}let R=j.placement;if(R.vMerge==="continue"){r.advanceFieldState(R.cell,n);continue}let G=1;if(R.vMerge==="restart")for(let F=I+1;F<y.length&&y[F].find(W=>W.startColumn===R.startColumn&&W.vMerge==="continue");F+=1)G+=1;let X=fe(R.cell,"tcPr"),ie=R.startColumn+R.span>=x,pe=lg(m,I,y.length,R.startColumn===0,ie,R.startColumn),K=m.byType.get("wholeTable")??null,z=iT(X,a,I,y.length,G,R.startColumn===0,ie,pe?.fill??K?.fill??null,d,c),H=(R.span>1?` colspan="${R.span}"`:"")+(G>1?` rowspan="${G}"`:"")+(z===""?"":` style="${pr(z)}"`),Z=v.get(R.cell)??e;E+=`<td dir="ltr"${H}>${r.renderBlocks(Z,R.cell.children,n)}</td>`;}E+="</tr>";}return `${E}</table>`}function Ic(e){if(e===void 0||!/^\d{1,10}$/.test(e))return null;let t=Number.parseInt(e,10);return t>=1&&t<=2147483647?t:null}function dg(e){let t=Yf$1(e,"type",la$2);return t==="separator"||t==="continuationSeparator"}function cg(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Ze(r)||r.namespaceUri!==la$2||r.localName!==t||dg(r))continue;let o=Ic(Yf$1(r,"id",la$2));o!==null&&n.add(o);}return n}function $s(e,t,n,r,o,i,a){for(let s of t.children)if(Ze(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){$s(e,s,n,r,o,i,fT(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===la$2&&s.localName==="tc"){let l=a?.get(s);if(l===void 0){r.inert||o(s,r);continue}$s(l,s,n,r,o,i,a);continue}if(s.kind==="paragraph"){let l=s.children.find(d=>d.kind==="paragraphProperties");$s(e,s,n,r,o,l&&Ze(l)?l:null,a);continue}if(s.kind==="run"){if(s.children.some(c=>c.kind==="fldChar")){r.inert||o(s,r);continue}if(s.children.some(c=>c.kind==="instrText")||!r.inert&&r.stack.some(c=>c==="instr"))continue;let l=s.children.find(c=>c.kind==="runProperties"),d=Sc(e.styles,i,l&&Ze(l)?l:null,e.tableRPr);if(Gn(d,"vanish"))continue}if(s.namespaceUri===la$2&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=Ic(Yf$1(s,"id",la$2));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}$s(e,s,n,r,o,i,a);}}function oH(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Ze(r)||r.namespaceUri!==la$2)&&!(r.localName!==t||dg(r))&&Ic(Yf$1(r,"id",la$2))===n)return r;return null}function mT(e,t,n){let r={footnote:new Set(e.noteOrdinals.footnote.keys()),endnote:new Set(e.noteOrdinals.endnote.keys())},o=[];for(let i of ["footnote","endnote"])for(let a of r[i])o.push({kind:i,id:a});for(;o.length>0;){let i=o.pop(),a=oH(t[i.kind],i.kind,i.id);if(a===null)continue;let s={stack:[],inert:false};n(a,s);let l={stack:[],inert:s.stack.length>0},d=[];$s(e,a,d,l,n,null);for(let c of d)e.availableNotes[c.kind].has(c.id)&&(r[c.kind].has(c.id)||(r[c.kind].add(c.id),o.push(c)));}return r}function ug(e,t,n,r,o){if(n===null)return "";let i=`/word/${t}s.xml`;for(let[l,d]of e.pkg.parts)d.root===n&&(i=l);let a=He$1(e.pkg,i),s="";for(let l of n.children){if(!Ze(l)||l.namespaceUri!==la$2||l.localName!==t||dg(l))continue;let d=Yf$1(l,"id",la$2),c=Ic(d);if(d===void 0||c===null||!r.has(c))continue;let u=o({...e,noteBody:{kind:t,id:c},docRels:a},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${c}">${u===""?"<p></p>":u}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}function gT(e){if(!e)return null;let t=[];for(let n of e.children){if(!Ze(n)||n.localName!=="tab")continue;let r=rt(n),o=nn(Yf$1(n,"pos",la$2));if(o===null||o<0||r!=="left"&&r!=="center"&&r!=="right"&&r!=="decimal"&&r!=="bar")continue;let i=rt(n,"leader"),a=i==="dot"?"dotted":i==="hyphen"?"dashed":i==="underscore"?"lined":i==="middleDot"?"middledot":i==="heavy"?"heavy":"";t.push(`${r}${a?` ${a}`:""} ${zn(o)}`);}return t.length>0?`tab-stops:${t.join(" ")}`:null}var fg="http://schemas.openxmlformats.org/officeDocument/2006/relationships",iH=`${fg}/numbering`,aH=`${fg}/footnotes`,sH=`${fg}/endnotes`,lH=2*1024*1024,dH=8*1024*1024,hT=9525,cH=new Map([["image/png","image/png"],["image/jpeg","image/jpeg"],["image/jpg","image/jpeg"],["image/gif","image/gif"],["image/bmp","image/bmp"],["image/x-ms-bmp","image/bmp"],["image/x-bmp","image/bmp"],["image/webp","image/webp"],["image/svg+xml","image/svg+xml"],["image/tiff","image/tiff"],["image/x-emf","image/x-emf"],["image/x-wmf","image/x-wmf"]]);function kc(e,t,n,r){let o=e.direct!==null&&fe(e.direct,r)!==null||En(e.defaults,r)!==null||En(e.tableLevel,r)!==null||En(e.paragraphLevel,r)!==null||En(e.characterLevel,r)!==null;return Gn(e,t&&o?r:n)}function uH(e){let t=e.all;if(Gn(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=mr(t,"rtl"),o=(r?wt(t,"rFonts","cs"):void 0)??wt(t,"rFonts","ascii")??wt(t,"rFonts","hAnsi")??wt(t,"rFonts","eastAsia")??(r?void 0:wt(t,"rFonts","cs"));if(o!==void 0){let k=Px(o);k&&n.push(`font-family:${k}`);}let i=po((r?wt(t,"szCs","val"):void 0)??wt(t,"sz","val")??(r?void 0:wt(t,"szCs","val")));i!==null&&i>0&&n.push(`font-size:${Math.round(i/2*100)/100}pt`);let a={...e,direct:null},s=e.direct?t.slice(0,-1):t;kc(e,r,"b","bCs")?n.push("font-weight:bold"):kc(a,r,"b","bCs")&&n.push("font-weight:normal"),kc(e,r,"i","iCs")?n.push("font-style:italic"):kc(a,r,"i","iCs")&&n.push("font-style:normal");let l=[],d=En(t,"u"),c=d!==null&&rt(d)!=="none";c&&l.push("underline");let u=ag(e,"dstrike");if((Gn(e,"strike")||u)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let k=En(s,"u");(k!==null&&rt(k)!=="none"||Gn(a,"strike")||ag(a,"dstrike"))&&n.push("text-decoration:none");}c&&n.push(...Cx(d)),u&&!c&&n.push("text-decoration-style:double");let p=xc(wt(t,"color","val"));p&&n.push(`color:${p}`);let m=nn(wt(t,"spacing","val"));m!==null&&n.push(`letter-spacing:${Math.round(m/20*100)/100}pt`);let h=rt(En(t,"highlight")),b=h!==void 0&&Object.hasOwn(Zf,h)?Zf[h]:void 0,y=xc(wt(t,"shd","fill"));b?n.push(`background-color:${b}`,`mso-highlight:${h}`):y&&n.push(`background-color:${y}`),Gn(e,"caps")?n.push("text-transform:uppercase"):Gn(a,"caps")&&n.push("text-transform:none"),Gn(e,"smallCaps")?n.push("font-variant:small-caps"):Gn(a,"smallCaps")&&n.push("font-variant:normal");let g=rt(En(t,"vertAlign")),x=g==="superscript"||g==="subscript"?g:null,v=qo((r?wt(t,"lang","bidi"):void 0)??wt(t,"lang","val")??wt(t,"lang","bidi")??wt(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:x,lang:v,rtl:r}}function fH(e,t,n=false){let r=[],o=rt(En(e,"jc")),i=o!==void 0&&Object.hasOwn(Uf,o)?Uf[o]:void 0;i&&r.push(`text-align:${n&&i!=="center"&&i!=="justify"?i==="left"?"right":"left":i}`);let a=nn(wt(e,"spacing","before"));a!==null&&a>=0&&r.push(`margin-top:${zn(a)}`);let s=nn(wt(e,"spacing","after"));s!==null&&s>=0&&r.push(`margin-bottom:${zn(s)}`);let l=nn(wt(e,"spacing","line")),d=wt(e,"spacing","lineRule");r.push(...Tx(l,d));let c=null,u=null,p=null,m=null;for(let g of e){let x=fe(g,"ind");if(!x)continue;let v=nn(Cn(x,"left",la$2)??Cn(x,"start",la$2));v!==null&&(c=v);let k=nn(Cn(x,"right",la$2)??Cn(x,"end",la$2));k!==null&&(u=k);let P=nn(Cn(x,"hanging",la$2)),T=nn(Cn(x,"firstLine",la$2));P!==null?(p=P,m=null):T!==null&&(m=T,p=null);}!t&&c!==null&&r.push(`margin-${n?"right":"left"}:${zn(c)}`),u!==null&&r.push(`margin-${n?"left":"right"}:${zn(u)}`),p!==null&&p!==0?r.push(`text-indent:${zn(-p)}`):m!==null&&m!==0&&r.push(`text-indent:${zn(m)}`);let h=gT(En(e,"tabs"));h&&r.push(h),mr(e,"pageBreakBefore")&&r.push("page-break-before:always"),mr(e,"keepNext")&&r.push("page-break-after:avoid"),mr(e,"keepLines")&&r.push("page-break-inside:avoid"),mr(e,"widowControl")&&r.push("widows:2","orphans:2");let b=xc(wt(e,"shd","fill"));b&&r.push(`background-color:${b}`);let y=En(e,"pBdr");if(y)for(let g of ["top","left","bottom","right"]){let x=Vo(fe(y,g));x&&r.push(`border-${g}:${x}`,`mso-border-${g}-alt:${x}`);}return r.join(";")}function pH(e,t,n){let r=e.noteOrdinals[t],o=r.get(n);if(o!==void 0)return o;let i=r.size+1;return r.set(n,i),i}var yT={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function vT(e,t,n,r){let o=e.numbering.formatOverrides.get(`${t}:${r}`)??e.numbering.levelFormats.get(n)?.get(String(r))??"decimal",i=e.numbering.startOverrides.get(`${t}:${r}`)??e.numbering.levelStarts.get(n)?.get(String(r))??1;return {fmt:o,start:i}}function mH(e,t){let n,r;for(let s of t){let l=fe(s,"numPr");if(!l)continue;let d=rt(fe(l,"numId"));d!==void 0&&(n=d);let c=rt(fe(l,"ilvl"));c!==void 0&&(r=c);}if(n===void 0||n==="0")return null;let o=e.numbering.numToAbstract.get(n);if(o===void 0)return null;for(let s=0;s<8&&!((e.numbering.levelFormats.get(o)?.size??0)>0);s+=1){let l=e.numbering.styleLinks.get(o),d=l===void 0?void 0:e.styles.byId.get(l),c=rt(fe(fe(fe(d??null,"pPr"),"numPr"),"numId")),u=c===void 0?void 0:e.numbering.numToAbstract.get(c);if(u===void 0||u===o)break;o=u;}let i=Math.min(Math.max(po(r)??0,0),8),a=vT(e,n,o,i);return {numId:n,abstractId:o,level:i,fmt:a.fmt,start:a.start}}function gH(e,t){let n=G$1(e.pkg.contentTypes,t);if(n.ok){let i=cH.get(n.contentType.toLowerCase());if(i!==void 0)return i}let r=t.lastIndexOf("."),o=r===-1?"":t.slice(r+1).toLowerCase();return o==="png"?"image/png":o==="jpg"||o==="jpeg"?"image/jpeg":o==="gif"?"image/gif":o==="bmp"?"image/bmp":o==="webp"?"image/webp":o==="svg"?"image/svg+xml":o==="tif"||o==="tiff"?"image/tiff":o==="emf"?"image/x-emf":o==="wmf"?"image/x-wmf":null}function hH(e,t){let n=ea(t,"inline",sa$1)??ea(t,"anchor",sa$1);if(!n)return "";let r=ea(n,"blip",ra$1);if(!r)return "";let o=Yf$1(r,"embed",ua);if(!o)return "";let i=e.docRels.find(b=>b.id===o&&b.targetMode!=="External");if(!i)return "";let a=B$1(i.ownerPart,i.rawTarget);if(!a.ok)return "";let s=e.pkg.partBytes.get(a.partName.replace(/^\//,""))??e.pkg.partBytes.get(a.partName);if(!s)return "";let l=gH(e,a.partName);if(!l||s.byteLength>e.maxImageBytes||e.imageBudget.used+s.byteLength>e.maxTotalImageBytes)return "";e.imageBudget.used+=s.byteLength;let d=e.imageDataUris.get(a.partName);d==null&&(d=`data:${l};base64,${md(s)}`,e.imageDataUris.set(a.partName,d));let c=ea(n,"extent",sa$1),u=c?po(Yf$1(c,"cx","")):null,p=c?po(Yf$1(c,"cy","")):null,m=b=>Math.round(b/12700*100)/100,h=u!==null&&p!==null&&u>0&&p>0?` width="${Math.round(u/hT)}" height="${Math.round(p/hT)}" style="width:${m(u)}pt;height:${m(p)}pt"`:"";return `<img src="${d}"${h}>`}function ai(e,t,n=0){if(n>=wa$1)return;let r=vf(e)?n+1:xa$1(e,n);for(let o of e.children)if(Ze(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let i=o.children.find(a=>a.kind==="contentControlContent");i&&Ze(i)&&ai(i,t,r+1);continue}if(o.kind==="fldChar"){xT(o,t);continue}ai(o,t,r);}}function xT(e,t){let n=Yf$1(e,"fldCharType",la$2);n==="begin"?t.stack.push("instr"):n==="separate"&&t.stack.length>0?t.stack[t.stack.length-1]="result":n==="end"&&t.stack.pop();}function yH(e,t,n,r){let o=t.children.find(d=>d.kind==="runProperties"),i=Sc(e.styles,n,o&&Ze(o)?o:null,e.tableRPr),a=uH(i),s="";for(let d of t.children){if(!Ze(d))continue;if(d.kind==="fldChar"){r.inert||xT(d,r);continue}if(d.kind==="instrText"||!r.inert&&r.stack.some(p=>p==="instr")||a.vanish)continue;let c=Mx(d);if(c!==""){s+=c;continue}let u=Ox(d,e.noteBody,(p,m)=>pH(e,p,m),(p,m)=>e.availableNotes[p].has(m));if(u!==""){s+=u;continue}switch(d.kind){case "text":s+=og(rg(d));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let p=Yf$1(d,"type",la$2);s+=p==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let p=Kn(Yf$1(d,"name",la$2));p!==null&&(s+=`<a id="${pr(p)}"></a>`);break}case "drawing":s+=hH(e,d);break;default:s+=jb(d)?.text??"";break}}if(s==="")return "";a.vertAlign==="superscript"?s=`<sup>${s}</sup>`:a.vertAlign==="subscript"&&(s=`<sub>${s}</sub>`);let l=`${a.lang===null?"":` lang="${a.lang}"`}${a.rtl?' dir="rtl"':""}${a.css===""?"":` style="${pr(a.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function ii(e,t,n,r,o=0){if(o>=wa$1)return "";let i="";for(let a of t)if(Ze(a))switch(vf(a)?"fldSimple":a.kind){case "run":i+=yH(e,a,n,r);break;case "hyperlink":{let s=ii(e,a.children,n,r,o+1);if(s==="")break;let l=Yf$1(a,"id",ua),d=l?e.docRels.find(p=>p.id===l):void 0,c=d===void 0?void 0:d.targetMode==="External"||d.rawTarget.startsWith("#")?d.rawTarget:void 0,u=Jx(c,Yf$1(a,"anchor",la$2));i+=u!==null?`<a href="${pr(u)}">${s}</a>`:s;break}case "bookmarkStart":{let s=Kn(Yf$1(a,"name",la$2));s!==null&&(i+=`<a id="${pr(s)}"></a>`);break}case "fldSimple":i+=ii(e,a.children,n,r,o+1);break;case "contentControl":{let s=a.children.find(l=>l.kind==="contentControlContent");s&&Ze(s)&&(i+=ii(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":i+=ii(e,a.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":ai(a,r,o);break;case "generic":if(Ye(a))i+=bx(a);else if(ya$1(a))i+=ii(e,a.children,n,r,o+1);else {let s=Wc$1(a);s&&(i+=ii(e,s,n,r,o+1));}break}return i}function bH(e,t){let n=rt(fe(t,"pStyle")),r=Br(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let i=Yf$1(r[o],"styleId",la$2),a=i?/^Heading([1-6])$/.exec(i):null;if(a)return {level:Number(a[1]),fromStyle:true}}if(n===void 0){let o=po(rt(fe(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function vH(e,t){let n=Br(e.styles,rt(fe(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=Rx(Yf$1(n[r],"styleId",la$2));if(o!==null)return o}return null}function bT(e,t,n,r){let o=t.children.find(y=>y.kind==="paragraphProperties"),i=o&&Ze(o)?o:null,a=ig(e.styles,i,e.tablePPr),s=fH(a,n.asListItem,mr(a,"bidi")),l=ii(e,t.children,i,r),d=s===""?"":` style="${pr(s)}"`,c=mr(a,"bidi")?' dir="rtl"':"",u=vH(e,i),p=u===null?"":` class="${u}"`,m=bH(e,i);if(n.asListItem)return `<li${m?.fromStyle===true?` class="Heading${m.level}"`:p}${c}${d}>${l}</li>`;let h=m===null?"p":`h${m.level}`,b=m===null?p:m.fromStyle?` class="Heading${m.level}"`:' class="docx-outline"';return `<${h}${b}${c}${d}>${l}</${h}>`}var xH={renderBlocks:(e,t,n)=>Rc(e,t,n),advanceFieldState:ai};function Rc(e,t,n){let r="",o=[],i=null,a=new Map,s=n;if(s===void 0){let p={stack:[]};for(let m of t)Ze(m)&&ai(m,p);s={stack:[],inert:p.stack.length>0};}let l=()=>{let p=o.pop();p&&(r+=`</${p.tag}>`);},d=()=>{for(;o.length>0;)l();i=null;},c=(p,m)=>{for(i!==null&&m.level<i&&d();o.length>0&&o[o.length-1].abstractId!==m.abstractId;)l();o.length===0&&(i=m.level);let h=i??m.level,b=m.level-h+1;for(;o.length>b;)l();for(o.length===b&&o[b-1].numId!==m.numId&&l();o.length<b;){let x=h+o.length,v=vT(e,m.numId,m.abstractId,x),k=a.get(`${m.abstractId}:${m.numId}:${x}`)??0,P=v.start+k,T=v.fmt==="bullet"?"ul":"ol",C=T==="ol"?Object.hasOwn(yT,v.fmt)?yT[v.fmt]:"decimal":null,E=T==="ol"&&P!==1?` start="${P}"`:"";r+=C?`<${T}${E} style="list-style-type:${pr(C)}">`:`<${T}>`,o.push({tag:T,numId:m.numId,abstractId:m.abstractId});}let y=`${m.abstractId}:${m.numId}:${m.level}`;a.set(y,(a.get(y)??0)+1);let g=`${m.abstractId}:`;for(let x of a.keys()){if(!x.startsWith(g))continue;let v=x.slice(x.lastIndexOf(":")+1);/^\d+$/.test(v)&&Number(v)>m.level&&a.delete(x);}r+=bT(e,p,{asListItem:true},s);},u=p=>{for(let m of p)if(Ze(m))switch(m.kind){case "paragraph":{let h=m.children.find(g=>g.kind==="paragraphProperties"),b=h&&Ze(h)?h:null,y=mH(e,ig(e.styles,b));y?c(m,y):(d(),r+=bT(e,m,{asListItem:false},s));break}case "table":d(),r+=pT(e,m,s,xH);break;case "contentControl":{let h=m.children.find(b=>b.kind==="contentControlContent");h&&Ze(h)&&u(h.children);break}case "generic":u(m.children);break;case "bookmarkStart":{let h=Kn(Yf$1(m,"name",la$2));h!==null&&(r+=`<a id="${pr(h)}"></a>`);break}default:s.inert||ai(m,s);break}};return u(t),d(),r}function ST(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Ze(n.root))return "";let r=n.root.children.find(d=>d.kind==="body");if(!r||!Ze(r))return "";let o=Bs(e,aH,"/word/footnotes.xml"),i=Bs(e,sH,"/word/endnotes.xml"),a={pkg:e,styles:JP(e),numbering:tT(Bs(e,iH,"/word/numbering.xml")),docRels:He$1(e,e.mainDocumentPart),maxImageBytes:lH,maxTotalImageBytes:dH,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:cg(o,"footnote"),endnote:cg(i,"endnote")},noteBody:null},s=Rc(a,r.children),l=mT(a,{footnote:o,endnote:i},ai);return s+ug(a,"footnote",o,l.footnote,Rc)+ug(a,"endnote",i,l.endnote,Rc)}var SH=12*1024*1024;function wH(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function IH(e){return `<div><table>${e.split(`
25
- `).map(n=>`<tr>${n.split(" ").map(r=>`<td>${wH(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function pg(e){if(e.cellRectangle)return {text:e.text,html:IH(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=N(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null,...t.reason==="unsupported-content"?{reason:t.reason}:{}};let n=e.maxFragmentBytes??SH,r=t.bytes;if(t.bytes.byteLength>n){let a=N(e.pkg,e.coverage,{omitMedia:true});r=a.ok&&a.bytes.byteLength<=n?a.bytes:null;}let o;try{o=ST(t.package);}catch(a){console.error("docx-editor: copy HTML flavour failed to render",a),o="";}let i=kx(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:i}}function wT(e,t){let n=()=>t.text.length===0?"none":(e.insertPlainText(t.text),"plain");if(t.forcePlain)return n();let r=t.html;if(r===null||r.length===0)return n();let o=Di(r);if(!e.richLaneOpen)return o&&vc(o.bytes)?"unsupported-content":n();if(o){let a=e.pasteFragment(o.bytes,o.lastMarkCovered);if(a==="unsupported-content")return "unsupported-content";if(a)return "fragment"}let i=QS(r);if(i.ok&&i.truncated&&t.text.length>0)return n();if(i.ok){let a=e.pasteFragment(i.fragmentBytes,i.lastMarkCovered);if(a==="unsupported-content")return "unsupported-content";if(a)return "external-html"}return n()}function IT(e,t){let n=qe$1(e,t);if(!n.includes("\xAD"))return n;let r=n.split("");for(let{line:o}of vd$1(e,t)??[])for(let i of Na(o,t)?.spans??[])ed(i)&&i.range.start<r.length&&(r[i.range.start]=cb);return r.join("")}function kT(e){return e.includes(cb)?e.replaceAll(cb,""):e}function RT(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!qj(e.settingsRoot()))return r;let i=Fe(e,t.paragraphId)??e.part();if(!rj(i,t.paragraphId))return r;let a=Ta(i,t.paragraphId);if(a?.kind!=="paragraph")return r;let s=hj(a).find(y=>y.fieldNodeId===o&&y.start<=t.offset&&y.end>=n.offset);if(!s?.enabled||!Si(s)||s.maxLength<=0)return r;let l=(Vi$1(i,t.paragraphId)??"").slice(s.start,s.end),d=l.slice(0,t.offset-s.start),c=l.slice(n.offset-s.start),u=d+c,p=y=>Ti(d+y+c,s,u)<=s.maxLength;if(p(r))return r;let m=[...r],h=s.maxLength-[...u].length;if(s.type==="number"&&s.format)for(let y of u)(y===","&&s.format.includes(",")||y==="%"&&s.format.endsWith("%"))&&h++;let b=new Set;if(s.type==="date"){let y=0;for(let g=0;g<m.length;g++)if(/\S/.test(m[g])){if(++y>18)break;b.add(g+1);}else (g+1===m.length||/\S/.test(m[g+1]))&&b.add(g+1);}else if(s.type==="number"&&s.format)for(let y=1;y<=3;y++)b.add(h+y);for(let y of [...b].sort((g,x)=>x-g)){if(y<=Math.max(0,h)||y>m.length)continue;let g=m.slice(0,y).join("");if(p(g))return g}return m.slice(0,Math.max(0,h)).join("")}var PT=kT,kH=2e3;function TT(e){let{session:t}=e,n=null;function r(s){let l=ow(s),d=e.orderedRange(),c=RT(t,d.from,d.to,l,e.textFormFieldId?.()??null).split(`
26
- `),u=e.deleteSelectionPlan(),p=u.replaceAt??u.collapseTo,m=c.join(""),h=[...u.ops],b=e.consumePendingFormatOps(p.paragraphId,p.offset,m.length);m.length>0&&(h.push({op:"insertText",paragraphId:p.paragraphId,offset:p.offset,text:m}),h.push(...b));let y=[],g=0;for(let T=0;T<c.length-1;T+=1)g+=c[T].length,y.push(p.offset+g);if(y.length>0&&h.push({op:"splitParagraphMany",paragraphId:p.paragraphId,offsets:y}),h.length===0)return;let x=new Set(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())),v=c[c.length-1],k=y.length===0?e.caretMark({paragraphId:p.paragraphId,offset:p.offset+v.length}):void 0,P=h.filter(T=>!b.includes(T));e.commit(()=>e.withoutPendingOnRejection(h,P,e.selectionMark(),k),()=>{if(y.length===0)return We({paragraphId:p.paragraphId,offset:p.offset+v.length});let T=(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())).filter(E=>!x.has(E)),C=T[T.length-1];return C?We({paragraphId:C,offset:v.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection(),l=e.orderedRange(),d=e.paragraphOrder(),c=s?ga(e.layout(),s.cellIds):d.slice(d.indexOf(l.from.paragraphId),d.indexOf(l.to.paragraphId)+1),u=new Map(c.map(C=>[C,{start:!s&&C===l.from.paragraphId?l.from.offset:0,end:!s&&C===l.to.paragraphId?l.to.offset:1/0}])),m=e.storyScope().kind==="body"?t.part():Fe(t,c[0]??l.from.paragraphId);if(m&&QP(m,u))return e.commit(()=>({committed:false,rejected:true,opCount:0,reason:"unsupported-content"})),{text:"",html:null,reason:"unsupported-content"};let h=Os(e.layout(),IT);if(s)return pg({text:PT(ja(e.layout(),s,h.spelledText)),cellRectangle:true,coverage:null,pkg:null});let{from:b,to:y}=e.orderedRange(),g=t.part(),x=PT(Im(e.layout(),b,y,e.paragraphOrder(),(C,E)=>h.resultAt(C,E)??(g?zP(g,C,E):null),h.markedText)),v=e.storyScope();if(b.paragraphId===y.paragraphId&&b.offset===y.offset||v.kind!=="body")return {text:x,html:null};let P=t.part(),T=kk(e.layout(),P,b,y,e.paragraphOrder());return pg({text:x,cellRectangle:false,coverage:T,pkg:t.currentPackage()})}function i(s,l){if(e.editingMode()!=="edit"||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let d=e.deleteSelectionPlan(),c=d.replaceAt??d.collapseTo,u=false,p=false;return e.commit(()=>{let m=e.collaborationGate(d.ops,{kind:"body"});if(m)return {committed:false,rejected:true,opCount:0,reason:m};let h=e.actorId(),b=t.applyFragmentPaste({kind:"body"},{paragraphId:c.paragraphId,offset:c.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:d.ops,...h!==void 0?{actorId:h}:{}});return u=b.ok,p=!b.ok&&b.detail==="fragment-merge:unsupported-content",{committed:b.ok,rejected:!b.ok,opCount:b.ok?1:0,...b.ok?{}:{reason:b.detail??b.reason}}},()=>We(c)),p?"unsupported-content":u}function a(s,l){let d=n!==null&&e.now()-n<kH;n=null;let c=wT({richLaneOpen:(e.richPasteAllowed?.()??true)&&e.editingMode()==="edit"&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(u,p)=>i(u,p),insertPlainText:r},{html:l,text:s,forcePlain:d});return c==="unsupported-content"?(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:"unsupported-content"})),false):c!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:a,armForcePlainPaste:()=>{n=e.now();}}}function CT(e){let{session:t}=e;function n(){return ti(e.selection())}function r(){e.flushPendingInputAndLayout();let h=e.selection(),b=h.anchor.paragraphId===h.head.paragraphId?void 0:e.paragraphOrder();return zd(e.layout(),h,b)}function o(){return r().from}function i(h){return qe$1(e.layout(),h)}function a(h,b){let y=t.partFor(e.storyScope())??t.part(),g=Ta(y,h.paragraphId);if(!g||g.kind!=="paragraph")return null;let x=b==="before"?mg$1(g,h.offset):ng$1(g,h.offset);if(!x)return null;let v=_f$1(y,x.controlId),k=v?Zb(v):null;return k&&(k.lock==="contentLocked"||k.lock==="sdtContentLocked"||k.type==="checkbox"||k.type==="picture")?x:null}function s(h){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let b=r();return b.from.paragraphId===b.to.paragraphId&&b.from.offset===b.to.offset?e.atParagraphEnd(h.paragraphId,h.offset):e.atParagraphEnd(b.to.paragraphId,b.to.offset)}function l(h){let b=h?.trim()||void 0,y=d(),g=e.cellSelection(),x=null;return {...y,get replaceAt(){return x??=p(y,b,g),x}}}function d(){e.flushPendingInputAndLayout();let h=e.cellSelection();if(h){let x=[];for(let v of ga(e.layout(),h.cellIds)){let k=qe$1(e.layout(),v).length;k>0&&x.push({op:"deleteText",paragraphId:v,start:0,end:k});}return {ops:x,collapseTo:o()}}let b=e.selection();if(b.anchor.paragraphId===b.head.paragraphId&&b.anchor.offset===b.head.offset)return {ops:[],collapseTo:xd$1(e.layout(),b.head)};let{from:y,to:g}=r();return Rk(e.layout(),t.partFor(e.storyScope())??t.part(),y,g,e.paragraphOrder(),e.revisionView())}function c(){return l().ops}function u(h,b,y){if(!(y!==void 0||e.editingMode()==="suggest")||h.paragraphId!==b.paragraphId||b.offset<=h.offset)return h.offset;let x=(y??e.author())?.trim();if(!x)return xd$1(e.layout(),b).offset;let v=Fe(t,b.paragraphId)??t.part(),k=Ta(v,b.paragraphId);if(!k||k.kind!=="paragraph")return xd$1(e.layout(),b).offset;let P={start:h.offset,end:b.offset},{past:T,landing:C}=sh$1(k,P,b.offset,x,e.trackedDate()),E=qh(k,h.offset,T,x);return (T-h.offset>E?C:T)-E}function p(h,b,y){let g=h.collapseTo;if(b===void 0&&e.editingMode()!=="suggest")return g;if(y){for(let $ of y.cellIds){let j=fa(e.layout(),[$]),R=j.length>0?j:ga(e.layout(),[$]);if(R.length===0)continue;let G=new Map,X=z=>{let H=G.get(z);return H===void 0&&(H=u({paragraphId:z,offset:0},{paragraphId:z,offset:i(z).length},b),G.set(z,H)),H},ie=(b??e.author())?.trim(),pe=z=>{let H=i(z);if(!ie)return /\S/.test(H);let Z=Ta(Fe(t,z)??t.part(),z);if(!Z||Z.kind!=="paragraph")return /\S/.test(H);let F="",_=0;for(let W of rh$1(Z,0,H.length,ie))F+=H.slice(_,Math.max(_,W.start)),_=Math.max(_,W.end);return F+=H.slice(_),/\S/.test(F)},K=null;for(let z=R.length-1;z>=0;z-=1){let H=R[z];if(pe(H)){K=H;break}}if(K===null)for(let z=R.length-1;z>=0;z-=1){let H=R[z];if(X(H)!==0){K=H;break}}return K??=R[R.length-1],{paragraphId:K,offset:X(K)}}return g}let{from:x,to:v}=r();if(x.paragraphId===v.paragraphId&&x.offset===v.offset)return g;if(x.paragraphId===v.paragraphId)return {paragraphId:v.paragraphId,offset:u(x,v,b)};let k=new Set(h.ops.flatMap($=>$.op==="deleteBlock"?[$.blockId]:[])),P=Fe(t,v.paragraphId)??t.part();if(k.size>0)for(let $=Ua$1(P,v.paragraphId);$;$=Ua$1(P,$.id)){if(!k.has($.id))continue;let j={paragraphId:g.paragraphId,offset:i(g.paragraphId).length};return {paragraphId:g.paragraphId,offset:u(g,j,b)}}let T=(b??e.author())?.trim();if(!T)return g;let C=new Set(h.ops.flatMap($=>$.op==="joinParagraphs"?[$.secondId]:[])),E=e.paragraphOrder(),w=E.indexOf(x.paragraphId),I=E.indexOf(v.paragraphId);if(w===-1||I===-1)return g;let L=$=>{let j=Ta(P,$);return j?.kind==="paragraph"&&dl(j,T)},A=I;for(;A>w&&C.has(E[A])&&L(E[A-1]);)A-=1;let B=0;for(let $=A;$<=I;$+=1){let j=E[$],R={paragraphId:j,offset:j===x.paragraphId?x.offset:0},G=j===v.paragraphId?xd$1(e.layout(),v):{paragraphId:j,offset:i(j).length};$===A&&(B+=R.offset),B+=G.offset-R.offset-m(R,G,T);}return {paragraphId:E[A],offset:B}}function m(h,b,y){let g=y?.trim();if(!g||h.paragraphId!==b.paragraphId)return 0;let x=Fe(t,b.paragraphId)??t.partFor(e.storyScope())??t.part(),v=Ta(x,b.paragraphId);return !v||v.kind!=="paragraph"?0:qh(v,h.offset,b.offset,g)}return {selectionMark:n,orderedRange:r,orderedStart:o,textOf:i,inlineControlBeside:a,splitEndsTheParagraph:s,deleteSelectionPlan:l,deleteSelectionOps:c,replacementOffset:u}}function gg(e,t,n,r){if(r===n)return e;let o=i=>i.paragraphId===t?{...i,offset:c$1(i.offset,n,r)}:i;return {anchor:o(e.anchor),head:o(e.head)}}var OT=[24,16,12,8,6,4],RH=8;function ET(e,t,n,r,o){let i=r.textOf(e.paragraphId)??"",a=n.after.slice(0,RH);if(a&&i.slice(e.offset,e.offset+a.length)===a)return e;let s=new Set;for(let l of [e.paragraphId,t.paragraphId]){let d=o.indexOf(l);if(!(d<0))for(let c of [d,d-1,d+1])o[c]&&s.add(o[c]);}for(let l of OT){if(n.before.length<l)continue;let d=n.before.slice(-l);if(i.slice(Math.max(0,e.offset-l),e.offset)===d)return e;let c=null;for(let u of s){let p=r.textOf(u)??"";for(let m=p.indexOf(d);m>=0;m=p.indexOf(d,m+1)){if(c)return e;c={...e,paragraphId:u,offset:m+d.length};}}if(c)return c}return e}var Pc="stale",PH=16;function mg(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function MT(e){let t=null,n=false,r=o=>{let i=new Set(e.order());return o.filter(a=>i.has(a)).slice(0,PH).map(a=>({id:a,text:e.textOf(a)??""}))};return {expectHistory(o){n=o;},note(o,i,a){let s=n;if(n=false,t!==null){s&&t!==Pc&&t.history.length===0&&(t={...t,history:r(i)});return}if(!a){t=Pc;return}let l=new Map;for(let c of [o.anchor.paragraphId,o.head.paragraphId]){let u=e.textOf(c);u!==null&&l.set(c,u);}let d=c=>{let u=l.get(c.paragraphId)??"",p=OT[0];return {before:u.slice(Math.max(0,c.offset-p),c.offset),after:u.slice(c.offset,c.offset+p)}};t={selection:o,before:l,order:e.order(),context:{anchor:d(o.anchor),head:d(o.head)},history:s?r(i):[]};},noteLocal(){t!==null&&(t=Pc);},discard(){t=null;},map(o){let i=t;if(t=null,!i)return o;let a=e.carried?.()??null,s=v=>a&&mg(a.from,v)&&mg(o,v)&&e.textOf(a.to.anchor.paragraphId)!==null&&e.textOf(a.to.head.paragraphId)!==null?a.to:null;if(i===Pc)return s(o)??o;let l=e.order(),d=new Set(l);for(let{id:v,text:k}of i.history){if(!d.has(v))continue;let P=e.textOf(v)??k;if(P===k)continue;let T=0;for(;T<k.length&&T<P.length&&k[T]===P[T];)T+=1;let C={paragraphId:v,offset:T+Math.max(0,P.length-k.length)};return {anchor:C,head:C}}let c=new Set(l),u=s(i.selection);if(u)return u;let p=new Set(i.order),m=v=>{let k=i.before.get(v.paragraphId),P=e.textOf(v.paragraphId);if(k===void 0||P===null||P.length>=k.length||!k.startsWith(P)||v.offset<=P.length)return null;let T=l[l.indexOf(v.paragraphId)+1];return T===void 0||p.has(T)||!(e.textOf(T)??"").startsWith(k.slice(P.length))?null:{paragraphId:T,offset:v.offset-P.length}},h=m(o.anchor),b=m(o.head),y=o;for(let[v,k]of i.before)c.has(v)&&(y=gg(y,v,k,e.textOf(v)??k));y={anchor:h??y.anchor,head:b??y.head};let g=v=>{if(c.has(v.paragraphId))return v;let k=i.order.indexOf(v.paragraphId),P=null;for(let E=k-1;E>=0&&P===null;E-=1)c.has(i.order[E])&&(P=i.order[E]);let T=i.before.get(v.paragraphId),C=P===null?"":e.textOf(P)??"";if(P!==null&&T!==void 0&&C.endsWith(T)){let E=C.length-T.length+v.offset;return {paragraphId:P,offset:E}}for(let E=k+1;k>=0&&E<i.order.length;E+=1){let w=i.order[E];if(c.has(w))return {paragraphId:w,offset:0}}return P===null?v:{paragraphId:P,offset:C.length}};return !(l.length!==i.order.length||l.some((v,k)=>v!==i.order[k]))||!mg(o,i.selection)?{anchor:g(y.anchor),head:g(y.head)}:{anchor:ET(g(y.anchor),o.anchor,i.context.anchor,e,l),head:ET(g(y.head),o.head,i.context.head,e,l)}}}}function AT(e,t){let n=e?.historySelection?.()??null;return n&&t?TH(n,t):null}function FT(e){let t=e?.remoteSelectionMove?.();if(!t)return null;let n=o=>({paragraphId:o.nodeId,offset:o.offset}),r=o=>({anchor:n(o.anchor),head:n(o.head)});return {from:r(t.from),to:r(t.to)}}function TH(e,t){let n=i=>{let a=t.paragraphByStableId(i.paragraphId);return a?{paragraphId:a.nodeId,offset:Math.min(i.offset,a.text.length)}:null},r=n(e.anchor),o=n(e.head);return r&&o?{anchor:r,head:o}:null}function LT(e){return {atParagraphEnd(t,n){let r=Vi$1(e.partOf(t),t);return r!==null&&n===r.length},followerStyleId(t){let n=e.partOf(t),r=e.styleCascade();if(!r)return;let i=Dh(n,t).find(l=>l.localName==="pStyle")?.attributes?.val??r.defaultParagraphStyleId;if(i==null)return;let a=r.styles.get(i)?.next;if(!a||a===i)return;let s=r.styles.get(a);if(!(!s||s.type!=="paragraph"))return a===r.defaultParagraphStyleId?null:a}}}var NT=Le;function DT(e){let{session:t,...n}=e;return Ze$1({view:t,...n})}function Bt(e){return e.closest(".docx-editor__scroll-container")}function HT(e,t,n){let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();return {top:(t.scrollTop!==0&&r.top===0&&o.top===0?t.scrollTop-e.offsetTop:o.top+t.clientTop-r.top)/n,height:t.clientHeight/n}}function _T(e,t,n){let r=Bt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=HT(e,r,n),i=o.top+o.height/2;for(let a of t.pages)if(i<a.box.y+a.box.height)return a.index+1;return t.pages.length}function BT(e,t,n,r){let o=Bt(e);if(!o||o.clientHeight===0)return;let i=HT(e,o,r),a=[];for(let s of [n.anchor,n.head]){let l=oe(t,s);l&&a.push(l.pageIndex);}return ca({layout:t,viewport:i,overscanPages:1,pinnedPages:a})}function hg(e,t){if(e===t)return true;if(!e||!t||e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function Tc(e,t){let n=e.pages[e.pages.length-1],r=n?n.box.y+n.box.height:0,o=t?e.pages.filter(s=>t.has(s.index)):e.pages,i=0;for(let s of o)i=Math.max(i,s.box.x+s.box.width);let a=new Map;if(new Set(o.map(s=>s.box.width)).size>1)for(let s of e.pages)a.set(s.index,(i-s.box.width)/2-s.box.x);return {width:i,height:r,pageOffsetX:a}}function $T(e,t){if(e.width!==t.width||e.height!==t.height||e.pageOffsetX.size!==t.pageOffsetX.size)return false;for(let[n,r]of e.pageOffsetX)if(t.pageOffsetX.get(n)!==r)return false;return true}function VT(e){if(typeof e.defaultView?.createImageBitmap!="function")return null;let t=e.defaultView;return Object.freeze({async decode(n,r,o){let i=new Blob([new Uint8Array(n)],{type:r}),a;try{a=await t.createImageBitmap(i,{imageOrientation:"from-image"});}catch(s){if(s?.name!=="TypeError")throw s;a=await t.createImageBitmap(i);}try{let s=a.width,l=a.height;if(s<=0||l<=0)throw new Error("image dimensions invalid");if(s*l>o.maxPixels)throw new Error("image dimensions exceed limits");return Object.freeze({pixelWidth:s,pixelHeight:l,dpiX:96,dpiY:96})}finally{a.close();}},convertPreserved(n,r,o){return r==="image/tiff"?OH(e,n,o):CH(n,r)}})}async function CH(e,t,n){let{convertEmfToDataUrl:r,convertWmfToDataUrl:o}=await import('emf-converter'),i=new Uint8Array(e),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),s={maxWidth:4096,maxHeight:4096},l=t==="image/x-emf"?await r(a,s):await o(a,s);if(!l)return null;let d="data:image/png;base64,";if(!l.startsWith(d))return null;let c=atob(l.slice(d.length)),u=new Uint8Array(c.length);for(let p=0;p<c.length;p+=1)u[p]=c.charCodeAt(p);return Object.freeze({bytes:u,mime:"image/png"})}function qT(e,t){let n=e[t];if(!Array.isArray(n)||n.length===0)return null;let r=Number(n[0]);return Number.isSafeInteger(r)&&r>0?r:null}async function EH(e,t){let n=await import('utif2'),r=n.default??n,o=e.slice().buffer,i=r.decode(o)[0];if(!i)return null;let a=qT(i,"t256"),s=qT(i,"t257");if(a===null||s===null||a>t.maxDimension||s>t.maxDimension||a>t.maxPixels/s)return null;let l=a*s;if(l*4>t.maxDecodedBytes||(r.decodeImage(o,i),i.width!==a||i.height!==s))return null;let d=r.toRGBA8(i);return d.length!==l*4?null:Object.freeze({rgba:d,pixelWidth:a,pixelHeight:s})}async function OH(e,t,n){let r=await EH(t,n);if(r===null)return null;let o=await MH(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function MH(e,t,n,r){let o=e.createElement("canvas");if(o.width=n,o.height=r,o.width!==n||o.height!==r)return null;let i=o.getContext("2d");if(!i)return null;let a=i.createImageData(n,r);a.data.set(t),i.putImageData(a,0,0);let s=await new Promise(l=>{o.toBlob(d=>l(d),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function KT(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function jT(e){return typeof URL.createObjectURL!="function"||typeof URL.revokeObjectURL!="function"?null:Object.freeze({create(t,n){let r=e.mintValidatedBytes(t,t.contentId);if(!r)throw new Error(`PaintImageUrlSource: validated bytes unavailable for ${t.resourceKey}`);let o=new Uint8Array(r);return URL.createObjectURL(new Blob([o],{type:n}))},revoke(t){URL.revokeObjectURL(t);}})}var AH="docx-editor-one-surface__caret",yg="docx-editor-one-surface__caret--steady",FH=530;function WT(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=AH,o.dataset.docxCaret="",o.dataset.docxMarker="",o.setAttribute("contenteditable","false"),o.setAttribute("aria-hidden","true"),o.dataset.noColorInvert="",o.style.position="absolute",o.style.pointerEvents="none",o.style.userSelect="none",o.style.setProperty("-webkit-user-select","none");let i=false,a=null,s=null,l=null;function d(){let x=r.activeElement;return x===e||!!x&&e.contains(x)}function c(x){return x.anchor.paragraphId===x.head.paragraphId&&x.anchor.offset===x.head.offset}function u(){s=null,a!==null&&(clearTimeout(a),a=null),o.classList.remove(yg),o.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function p(){o.classList.add(yg),a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,o.classList.remove(yg);},FH);}function m(){if(i||!d()||n().suppress){u();return}let{layout:x,selection:v,scopedHost:k,scopedHostKind:P,scopedOrigin:T,preferredPageIndex:C,preferredLineId:E,measurer:w,typingStyle:I}=n(),L=t();if(!c(v)){u();return}let A=oe(x,v.head,{...w?{measurer:w}:{},...C!==void 0?{preferredPageIndex:C}:{},...E!==void 0?{preferredLineId:E}:{}});if(!A||!Number.isInteger(A.pageIndex)){u();return}if(I&&w){let{pageIndex:G,lineId:X}=A,ie=vd$1(x,v.head.paragraphId)?.find(K=>K.pageIndex===G&&K.line.id===X),pe=ie?.line;if(pe&&!pe.drawings?.length&&!Wd$1(A)&&(pe.spans.length>0||pe.box.height>0)){let K=I();if(K){let z={...Jd(x,v)??$,...K},H=w.lineMetrics(z);if(H.height>0){let Z=Ed$2({...A,width:0,y:pe.spans.length>0?pe.box.y+pe.baseline-H.baseline-ea$1(z):A.y,height:H.height},ie?.clipBox);if(!Z){u();return}A=Z;}}}}let B=k??e.querySelector(`[data-page-index="${A.pageIndex}"] > .docx-page-content`);if(!B){u();return}if(!(A.height>0)){u();return}o.style.left=`${(A.x-(T?.x??0))*L}px`,o.style.top=`${(A.y-(T?.y??0))*L}px`,o.style.height=`${A.height*L}px`;let $$1=Wd$1(A);o.style.transformOrigin=$$1?"0 0":"",o.style.transform=$$1?"rotate(-90deg)":"",o.parentNode!==B&&B.append(o),e.style.caretColor="transparent",l&&l!==k&&l.style.removeProperty("caret-color"),l=k??null,l?.style.setProperty("caret-color","transparent");let j=B===k?P??"scoped":"body",R=`${A.pageIndex}:${j}:${A.x}:${A.y}:${A.height}`;R!==s&&(s=R,p());}let h=()=>{i=true,m();},b=()=>{i=false,m();},y=()=>m(),g=x=>{let v=x.relatedTarget;v&&e.contains(v)||u();};return e.addEventListener("compositionstart",h),e.addEventListener("compositionend",b),e.addEventListener("focusin",y),e.addEventListener("focusout",g),{update:m,destroy(){e.removeEventListener("compositionstart",h),e.removeEventListener("compositionend",b),e.removeEventListener("focusin",y),e.removeEventListener("focusout",g),u();}}}function bg(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function si(e,t){let n=bg(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function vg(e,t){return !e||e.kind==="tableBody"?null:bg(e.tableId)===bg(t)?e:null}function qs(e,t,n){let r=a=>{for(let s of a)if(s.kind==="table"){if(s.tableId===t)return s;for(let l of s.rows)for(let d of l.cells){let c=r(d.blocks);if(c)return c}}return null},o=e.pages[n];if(!o)return null;let i=r(o.fragments);if(i)return {table:i,origin:o.contentBox};for(let a of [o.header,o.footer]){if(!a)continue;let s=r(a.fragments);if(s)return {table:s,origin:a.box}}return null}function xg(e,t){for(let n of e)if(n.kind==="table"){t(n);for(let r of n.rows)for(let o of r.cells)xg(o.blocks,t);}}function LH(e,t){for(let n of e.pages){let r=o=>{for(let i=0;i<o.rows.length;i+=1)t({table:o,row:o.rows[i],rowIndex:i});};xg(n.fragments,r);for(let o of [n.header,n.footer])o&&xg(o.fragments,r);}}function Sg(e,t,n,r){let o=null;return LH(e,i=>{i.table.tableId===t&&i.row.id===n&&i.row.isHeaderRepeat===r&&(o=i);}),o}function wg(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function ZT(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function UT(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function zT(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var DH=120,GT=20;function Cc(e){return nd(_i$1(e,"w"))??0}function HH(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Ig(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function kg(e,t){return t.kind==="insertColumn"?Sg(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Sg(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function XT(e){return Math.min(160,e)}function YT(e){let t=e.furnitureLayer;t.className="docx-table-furniture",t.setAttribute("contenteditable","false"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.pointerEvents="none";let n=null,r=null,o=null,i=null,a=null,s=null,l=false,d=0,c=0,u=null,p=null,m=null;function h(N){return N instanceof HTMLButtonElement&&(N.classList.contains("docx-table-insert-row")||N.classList.contains("docx-table-insert-column"))}function b(){let N=document.activeElement;return N!==null&&h(N)&&N.closest(".docx-table-furniture")===t?N:null}function y(N){for(let q of [...t.children])h(q)&&q!==N&&q.remove();}function g(){p=null,m=null;}function x(){n!==null&&(clearTimeout(n),n=null);}function v(){for(let q of [...t.children])h(q)||q.remove();let N=b();if(!N){y(null),g();return}p=N,y(N);}function k(N){let q=p??b(),U=q!==null&&document.activeElement===q;g(),t.replaceChildren(),N&&U&&e.pagesLayer.focus({preventScroll:true});}function P(){for(let N of [...t.children])h(N)||N.remove();}function T(N,q,U,ne){let ee=e.read().layout.pages[N];if(!ee)return {left:0,top:0};let oe=ne??ee.contentBox,ge=e.scale(),Ie=e.pageOffsetX(N);return {left:(oe.x+q+Ie)*ge,top:(oe.y+U)*ge}}function C(N,q){let U=e.read(),ne=qs(U.layout,q.tableId,q.pageIndex);if(!ne)return;let{table:re,origin:ee}=ne,oe=document.createElement("div");oe.className="docx-table-resize-preview",oe.style.position="absolute",oe.style.pointerEvents="none";let ge=q.kind!=="rowDivider",Ie=T(q.pageIndex,ge?re.box.x+N:re.box.x,ge?re.box.y:re.box.y+N,ee);oe.style.left=`${Ie.left}px`,oe.style.top=`${Ie.top}px`,oe.style.width=ge?"2px":`${re.box.width*e.scale()}px`,oe.style.height=ge?`${re.box.height*e.scale()}px`:"2px",t.append(oe);}function E(){let N=document.createElement("button");return N.type="button",N.textContent="+",N.style.position="absolute",N.style.pointerEvents="auto",N}function w(N){B(N);let q=m;if(!q)return;let U=e.read();q.kind==="insertRow"?j(q,U):q.kind==="insertColumn"&&R(q,U);}function I(){queueMicrotask(()=>{!p||document.activeElement===p||l||r?.kind==="insertRow"||r?.kind==="insertColumn"||(p.remove(),g());});}function L(){if(p&&t.contains(p))return p;let N=b();if(N)return p=N,N;let q=E();return q.addEventListener("pointerenter",()=>{l=true,x();}),q.addEventListener("pointerleave",()=>{l=false;}),q.addEventListener("pointerdown",B),q.addEventListener("mousedown",B),q.addEventListener("click",w),q.addEventListener("blur",I),p=q,q}function A(N,q){let U=qs(q.layout,N.tableId,N.pageIndex);if(!U)return;let{table:ne,origin:re}=U,ee=L();if(y(ee),m=N,ee.dataset.tableId=N.tableId,N.kind==="insertRow"){let oe=ne.rows.find(_e=>_e.id===N.rowId);if(!oe)return;ee.dataset.rowId=N.rowId,delete ee.dataset.gridColumnId,ee.className="docx-table-insert-row",ee.setAttribute("aria-label",e.label("table.insertRowBelow"));let ge=oe.box.y+oe.box.height/2,Ie=T(N.pageIndex,ne.box.x-14,ge,re);ee.style.left=`${Ie.left}px`,ee.style.top=`${Ie.top-8}px`;}else {let oe=ne.rows[0]?.cells.find(Mt=>Mt.gridColumnId===N.gridColumnId);if(!oe)return;ee.dataset.gridColumnId=N.gridColumnId,delete ee.dataset.rowId;let ge=ne.columnEdges[oe.gridColumn]??0,Ie=ne.columnEdges[oe.gridColumn+1]??ne.box.width;ee.className="docx-table-insert-column",ee.setAttribute("aria-label",e.label("table.insertColumnRight"));let _e=T(N.pageIndex,ne.box.x+(ge+Ie)/2-8,ne.box.y-14,re);ee.style.left=`${_e.left}px`,ee.style.top=`${_e.top}px`;}t.contains(ee)||t.append(ee);}function B(N){N.preventDefault(),N.stopPropagation();}function $(N,q){if(P(),y(p??b()),!(s||q.editingMode==="view")){if((N.kind==="columnDivider"||N.kind==="rightEdge")&&!N.isHeaderRepeat){let U=qs(q.layout,N.tableId,N.pageIndex);if(!U)return;let{table:ne,origin:re}=U,ee=document.createElement("div");ee.className=N.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",ee.style.position="absolute",ee.style.pointerEvents="auto",ee.style.cursor="col-resize",ee.dataset.active="true";let oe=T(N.pageIndex,ne.box.x+N.edgeX,ne.box.y,re);ee.style.left=`${oe.left-3}px`,ee.style.top=`${oe.top}px`,ee.style.width="6px",ee.style.height=`${ne.box.height*e.scale()}px`,ee.addEventListener("pointerdown",G),t.append(ee);}if(N.kind==="rowDivider"&&!N.isHeaderRepeat){let U=qs(q.layout,N.tableId,N.pageIndex);if(!U)return;let{table:ne,origin:re}=U,ee=document.createElement("div");ee.className="docx-table-row-divider-handle layout-table-row-resize-handle",ee.style.position="absolute",ee.style.pointerEvents="auto",ee.style.cursor="row-resize",ee.dataset.active="true";let oe=T(N.pageIndex,ne.box.x,ne.box.y+N.edgeY,re);ee.style.left=`${oe.left}px`,ee.style.top=`${oe.top-3}px`,ee.style.width=`${ne.box.width*e.scale()}px`,ee.style.height="6px",ee.addEventListener("pointerdown",G),t.append(ee);}N.kind==="insertRow"&&!N.isHeaderRepeat&&A(N,q),N.kind==="insertColumn"&&!N.isHeaderRepeat&&A(N,q);}}function j(N,q){let U=kg(q.layout,N);if(!U)return;let ne=Ig(q),re=Hr({command:{type:"insertRow",where:"below",target:wg(N.sourceRevision,U)},part:si(e.session(),N.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...ne});e.applyTableCommandPlan(re);}function R(N,q){let U=kg(q.layout,N);if(!U)return;let ne=U.row.cells.find(ge=>ge.gridColumnId===N.gridColumnId);if(!ne)return;let re=ZT(N.sourceRevision,U,ne);if(!re)return;let ee=Ig(q),oe=Hr({command:{type:"insertColumn",where:"right",target:re},part:si(e.session(),N.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...ee});e.applyTableCommandPlan(oe);}function G(N){if(N.button!==0)return;let q=e.read();if(q.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;N.preventDefault(),N.stopPropagation();let U=r,ne=kg(q.layout,U);if(!ne)return;let re=aj(si(e.session(),U.tableId).root,U.tableId);if(!re.ok||U.kind!=="rowDivider"&&Dk$1(re.topology)!==null)return;let ee=0,oe=0,ge=0,Ie=re.topology.gridColumns.reduce((Ne,Ce)=>Ne+Cc(Ce),0),_e;if(U.kind==="columnDivider"){let Ne=re.topology.gridColumns.find(Ve=>Ve.id===U.leftGridColumnId),Ce=re.topology.gridColumns.find(Ve=>Ve.id===U.rightGridColumnId);if(!Ne||!Ce)return;ee=Cc(Ne),oe=Cc(Ce),_e=UT(U.sourceRevision,ne,U.leftGridColumnId,U.rightGridColumnId);}else if(U.kind==="rightEdge"){let Ne=re.topology.gridColumns.find(Ce=>Ce.id===U.gridColumnId);if(!Ne)return;ee=Cc(Ne),oe=0,_e=zT(U.sourceRevision,ne,U.gridColumnId);}else ge=Math.max(20,Math.round(ne.row.box.height*GT)),_e=wg(U.sourceRevision,ne);let Mt=N.currentTarget;Mt.setPointerCapture(N.pointerId),d=N.clientX,c=N.clientY,s={pointerId:N.pointerId,startClientX:N.clientX,startClientY:N.clientY,startEdgePt:U.kind==="rowDivider"?U.edgeY:U.edgeX,leftTwips:ee,rightTwips:oe,tableWidthTwips:Ie,rowHeightTwips:ge,target:U,ref:ne,resizeTarget:_e,captureElement:Mt,rightEdge:U.kind==="rightEdge",vertical:U.kind==="rowDivider",cancelled:false};for(let Ne of [...t.children])Ne!==Mt&&Ne.remove();C(U.kind==="rowDivider"?U.edgeY:U.edgeX,U);}function X(){if(s){try{s.captureElement.hasPointerCapture(s.pointerId)&&s.captureElement.releasePointerCapture(s.pointerId);}catch{}s.cancelled=true,s=null,v(),r=null;}}function ie(){if(!s||s.cancelled){s=null,v();return}let N=s;s=null;try{N.captureElement.hasPointerCapture(N.pointerId)&&N.captureElement.releasePointerCapture(N.pointerId);}catch{}if(N.vertical?c===N.startClientY:d===N.startClientX){v();return}let q=e.read(),U=Ig(q),ne=(N.vertical?c-N.startClientY:d-N.startClientX)/e.scale(),re=Math.round(ne*GT),ee;if(N.target.kind==="rowDivider")ee=Zw({part:si(e.session(),N.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...U},N.resizeTarget,Math.max(XT(N.rowHeightTwips),N.rowHeightTwips+re));else if(N.rightEdge&&N.target.kind==="rightEdge"){let oe=Math.max(300,N.leftTwips+re),ge=Math.max(oe,N.tableWidthTwips+re);ee=Hr({command:{type:"commitTableRightEdgeResize",target:N.resizeTarget,columnWidthTwips:oe,tableWidthTwips:ge},part:si(e.session(),N.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...U});}else if(N.target.kind==="columnDivider"){let oe=N.leftTwips+re,ge=N.rightTwips-re;oe=Math.max(300,oe),ge=Math.max(300,ge);let Ie=N.leftTwips+N.rightTwips;oe+ge!==Ie&&(oe>Ie-300?(oe=Ie-300,ge=300):ge=Ie-oe),ee=Hr({command:{type:"commitTableColumnDividerResize",target:N.resizeTarget,leftWidthTwips:oe,rightWidthTwips:ge},part:si(e.session(),N.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...U});}else {v();return}e.applyTableCommandPlan(ee),v();}function pe(N){if(!u)return null;o??=Pe(N.layout);let q=e.pageOffsetX(u.pageIndex);return Te(o,u.x,u.y,N.layout,q,u.pageIndex)}function K(N){if(!r||s||N.editingMode==="view")return;x();let q=pe(N),U=vg(q,N.selection.head.paragraphId);if(!U){r=null,v();return}if(Re(U)!==Re(r)){r=null,v();return}r=U,$(U,N);}function z(){let N=p??b(),q=N!==null&&document.activeElement===N;g(),N&&t.contains(N)&&N.remove(),q&&e.pagesLayer.focus({preventScroll:true});}function H(N){if(s||N.editingMode==="view")return;let q=p??b();if(!q||!t.contains(q)){m&&g();return}if(p=q,!m||m.kind!=="insertRow"&&m.kind!=="insertColumn")return;o??=Pe(N.layout);let U=Re(m),ne=Se(o,m);if(!ne||Re(ne)!==U){z();return}m=ne,A(ne,N);}function Z(N){let q=e.read();if(s&&N.pointerId===s.pointerId){d=N.clientX,c=N.clientY;let ge=(s.vertical?N.clientY-s.startClientY:N.clientX-s.startClientX)/e.scale();s.target.kind==="rowDivider"&&(ge=Math.max(ge,(XT(s.rowHeightTwips)-s.rowHeightTwips)/20));for(let Ie of [...t.children])Ie!==s.captureElement&&Ie.remove();C(s.startEdgePt+ge,s.target);return}if(q.editingMode==="view"){k(false);return}if(N.target instanceof Node&&p?.contains(N.target)){x();return}let U=HH(e,N.clientX,N.clientY),ne=Yd$1(q.layout,U.y);ne>=0&&(u={x:U.x,y:U.y,pageIndex:ne});let re=ne>=0?e.pageOffsetX(ne):0;o??=Pe(q.layout);let ee=o?Te(o,U.x,U.y,q.layout,re,ne>=0?ne:void 0):null,oe=vg(ee,q.selection.head.paragraphId);if(!oe){if(l)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,v();},DH));return}n&&(clearTimeout(n),n=null),!(r&&Qe(oe)===Qe(r))&&(r=oe,$(oe,q));}function F(N){if(!(!s||N.pointerId!==s.pointerId)){if(e.read().editingMode==="view"){X();return}ie();}}function _(N){!s||N.pointerId!==s.pointerId||X();}function W(N){N.key!=="Escape"||!s||X();}return e.pagesLayer.addEventListener("pointermove",Z),document.addEventListener("pointermove",Z),document.addEventListener("pointerup",F),document.addEventListener("pointercancel",_),e.pagesLayer.addEventListener("keydown",W),{update(){let N=e.read(),q=i,U=a;o=null,i=N.layout.revision,a=N.storeRevision,N.editingMode==="view"?(X(),r=null,x(),k(true)):q!==null&&(q!==N.layout.revision||U!==N.storeRevision)&&(r!==null&&K(N),H(N)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let N=e.read();if(N.editingMode==="view")return;let q=p??b();if(q&&t.contains(q)&&m&&(m.kind==="insertRow"||m.kind==="insertColumn")){A(m,N);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&A(r,N);},destroy(){x(),X(),g(),v(),e.pagesLayer.removeEventListener("pointermove",Z),document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",F),document.removeEventListener("pointercancel",_),e.pagesLayer.removeEventListener("keydown",W),t.remove();}}}var _H=e=>e==="left"||e==="center"||e==="right"||e==="both";function QT(e,t){if(!t.some(r=>r.localName==="bidi"))return e;let n=e.map(r=>r.localName).lastIndexOf("bidi");return n===-1?e:e.filter((r,o)=>o!==n)}function Ec(e,t,n,r=n){let o=()=>td([...t,...n]);if(e.paragraphDirection!==void 0&&e.localName==="bidi"){let a=e.paragraphDirection==="rtl";return o()===a?null:a?td(QT(t,r))?{localName:"bidi",remove:true}:{localName:"bidi"}:td(QT(t,r))?{localName:"bidi",attributes:{val:"0"}}:{localName:"bidi",remove:true}}let i=e.attributes?.val;return !e.physicalAlignment||e.localName!=="jc"||!_H(i)?e:{localName:"jc",attributes:{val:cd(i,o())}}}function JT(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=b(()=>e.session.stylesRoot(),()=>e.session.settingsRoot(),()=>e.displayMode(),()=>e.authorFilter()),{session:r,commit:o,orderedRange:i,selectionMark:a,textOf:s}=e,l=()=>e.displayMode(),d=()=>e.authorFilter(),c=()=>r.partFor(e.storyScope())??r.part(),u=(v,k,P)=>{let T=C=>r.applyTreeOps(C,k,P,e.storyScope());return e.applyOutsideToc?e.applyOutsideToc(v,T):T(v)},p=()=>{let v=e.runFormatRefusal?.();return v?(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:v})),true):false},m={get value(){return e.layout()}},h={get value(){return e.selection()}},b$1=(v,k,P)=>{let T=c();if(v.paragraphId===k.paragraphId){let L=t(T,v.paragraphId,v.offset,k.offset,P,l(),d());if(L.length===0)return;let A=n(T,v.paragraphId,P);o(()=>u([...L.map(B=>({op:"setRunProperties",paragraphId:v.paragraphId,start:B.start,end:B.end,properties:B.properties,...B.targetRunIds?{targetRunIds:B.targetRunIds}:{}})),...e.paragraphMarkVisible(v.paragraphId)?jk(s(v.paragraphId),v,k,A):[]],a()));return}let C=e.paragraphOrder(),E=C.indexOf(v.paragraphId),w=C.indexOf(k.paragraphId);if(E===-1||w===-1)return;let I=[];for(let L=E;L<=w;L+=1){let A=C[L],B=s(A),$=L===E?v.offset:0,j=L===w?k.offset:B.length,R=$<j?t(T,A,$,j,P,l(),d()):[];for(let X of R)I.push({op:"setRunProperties",paragraphId:A,start:X.start,end:X.end,properties:X.properties,...X.targetRunIds?{targetRunIds:X.targetRunIds}:{}});(L<w||$===0&&j===B.length&&B.length>0)&&e.paragraphMarkVisible(A)&&I.push({op:"setParagraphMarkProperties",paragraphId:A,properties:n(T,A,P)});}I.length!==0&&o(()=>u(I,a()));},y=(v,k)=>{let P=c(),T=[];for(let C of ga(m.value,v)){let E=s(C);for(let w of t(P,C,0,E.length,k,l(),d()))T.push({op:"setRunProperties",paragraphId:C,start:w.start,end:w.end,properties:w.properties,...w.targetRunIds?{targetRunIds:w.targetRunIds}:{}});e.paragraphMarkVisible(C)&&T.push({op:"setParagraphMarkProperties",paragraphId:C,properties:n(P,C,k)});}return T.length===0?false:(o(()=>u(T,a()),void 0,{keepCellSelection:true}),true)},g=v=>{Ah$1(v.localName)&&e.setPendingFormats(Fh(e.pendingFormats()??[],v));},x=v=>{if(v.length===0)return;let k=e.selectedCells?.(),P=k&&k.length>0?[...ga(m.value,k)]:null,{from:T,to:C}=i(),E=P??e.paragraphOrder(),w=P?0:E.indexOf(T.paragraphId),I=P?E.length-1:E.indexOf(C.paragraphId);if(w===-1||I===-1)return;let L=c(),A=E.slice(w,I+1).filter(B=>e.paragraphMarkVisible(B)).flatMap(B=>{let $=Dh(L,B),j=$,R=fr(m.value,B),G=false;for(let X of v){let ie=Ec(X,R,j,$);if(!ie)continue;if(G=true,ie.remove){j=j.filter(z=>z.localName!==ie.localName);continue}let pe=ie.mergeAttributes?{...j.find(z=>z.localName===ie.localName)?.attributes??{},...ie.attributes}:ie.attributes??{},K=Object.fromEntries(Object.entries(pe).filter(([,z])=>z!=null));j=Fh(j,{localName:ie.localName,...Object.keys(K).length>0?{attributes:K}:{}});}return G?[{op:"setParagraphProperties",paragraphId:B,properties:j}]:[]});A.length!==0&&o(()=>u(A,a()),void 0,{keepCellSelection:P!==null});};return {setRunProperty(v,k){if(p())return;let P={localName:v,...k?{attributes:k}:{}},T=e.selectedCells?.();if(T&&T.length>0){y(T,P);return}let{from:C,to:E}=i();if(C.paragraphId===E.paragraphId&&C.offset===E.offset){g(P);return}b$1(C,E,P);},setParagraphProperty(v,k,P){x([{localName:v,...k?{attributes:k}:{},...P??{}}]);},setParagraphProperties:x,formatting:()=>Vk(Kk(m.value,h.value,(v,k)=>{let P=r.effectiveRunDefaults(v,k);if(P.fontFamily!==null)return P;let T=e.defaultFontFamily?.()??null;return T===null?P:{...P,fontFamily:T}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,h.value.anchor.paragraphId===h.value.head.paragraphId?[h.value.head.paragraphId]:e.paragraphOrder(),e.defaultFontFamily?.()??null),e.pendingFormats()),toggleRunProperty(v,k){if(p())return;let P=e.selectedCells?.(),T=k?.val,C=Ui(e.pendingFormats(),v,T)??Om(m.value,h.value,v,P,T,e.paragraphOrder()),E=C?{localName:v,attributes:{val:BH[v]??"0"}}:{localName:v,...k?{attributes:k}:{}};if(P&&P.length>0){y(P,E);return}let{from:w,to:I}=i();if(w.paragraphId===I.paragraphId&&w.offset===I.offset){let L=e.pendingFormats()??[],A=Om(m.value,h.value,v,void 0,T,e.paragraphOrder());if(!C===A){let B=L.filter($=>$.localName!==v);e.setPendingFormats(B.length>0?B:null);}else g(E);return}b$1(w,I,E);},clearFormatting(){if(p())return;e.setPendingFormats(null);let v=m.value,k=e.paragraphOrder(),P=e.selectedCells?.(),T=P&&P.length>0?[...ga(v,P)]:Qd(k,i());if(T.length===0)return;let{from:C,to:E}=i(),w=P!==void 0&&P.length>0,I=c(),L=[];for(let A of T){let B=s(A),$=w||A!==C.paragraphId?0:C.offset,j=w||A!==E.paragraphId?B.length:E.offset;for(let X of Rh$1(I,A,$,j,l(),d()))qk(I,A,X.start,X.end,l(),d())&&L.push({op:"setRunProperties",paragraphId:A,start:X.start,end:X.end,properties:[]});e.paragraphMarkVisible(A)&&Eh$1(I,A).length>0&&L.push({op:"setParagraphMarkProperties",paragraphId:A,properties:[]});let R=Dh(I,A),G=R.filter(X=>X.localName==="bidi");e.paragraphMarkVisible(A)&&R.length>G.length&&L.push({op:"setParagraphProperties",paragraphId:A,properties:G});}L.length!==0&&o(()=>u(L,a()),void 0,{keepCellSelection:w});}}}var BH={u:"none",vertAlign:"baseline"};var $H=new Set,eC=500;function qH(e){let t=l=>({val:l?"1":"0"}),n=l=>String(Math.max(2,Math.min(3276,Math.round(l*2)))),r=e.latinLane??e,o=e.complexLane??e,i=n(r.fontSizePt),a=[{localName:"b",attributes:t(r.bold)},{localName:"i",attributes:t(r.italic)},{localName:"bCs",attributes:t(o.bold)},{localName:"iCs",attributes:t(o.italic)},{localName:"u",attributes:{val:e.underline?e.underline.variant:"none",color:e.underline?.color??"auto",themeColor:"none"}},{localName:"strike",attributes:t(e.strike)},{localName:"dstrike",attributes:t(e.doubleStrike)},{localName:"caps",attributes:t(e.caps)},{localName:"smallCaps",attributes:t(e.smallCaps)},{localName:"vertAlign",attributes:{val:e.verticalAlign}},{localName:"color",attributes:{val:e.color??"auto"}},{localName:"highlight",attributes:{val:e.highlight??"none"}},{localName:"sz",attributes:{val:i}},{localName:"szCs",attributes:{val:n(o.fontSizePt)}},{localName:"spacing",attributes:{val:String(Math.round(e.characterSpacingPt*20))}},{localName:"position",attributes:{val:String(Math.round(e.baselineShiftPt*2))}},{localName:"w",attributes:{val:String(Math.round(e.horizontalScalePercent))}},{localName:"kern",attributes:{val:String(Math.round(e.kerningMinPt*2))}}],s=e.complexLane?.fontFamily??null;return (r.fontFamily||r.fontFamilyEastAsia||s)&&a.push({localName:"rFonts",attributes:{...r.fontFamily?{ascii:r.fontFamily,hAnsi:r.fontFamily}:{},...r.fontFamilyEastAsia?{eastAsia:r.fontFamilyEastAsia}:{},...s?{cs:s}:{}}}),a}function tC(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=b(()=>e.session.stylesRoot(),()=>e.session.settingsRoot(),()=>e.displayMode(),()=>e.authorFilter()),r=e.session,o=()=>r.partFor(e.storyScope())??r.part(),i="off",a=null,s=null,l=null,d=Ed,c=()=>{let x=a===null?"none":a.paragraphProperties?"paragraph":"run";return (d.mode!==i||d.level!==x)&&(d={mode:i,level:x}),d},u=(x,v,k)=>{if(k||x.paragraphId!==v.paragraphId||x.offset===v.offset)return true;let P=e.textOf(x.paragraphId);return x.offset===0&&v.offset===P.length&&P.length>0},p=()=>{let x=e.selectedCells?.(),v=x!==void 0&&x.length>0,{from:k,to:P}=e.orderedRange();if(!e.paragraphOrder().includes(k.paragraphId))return false;let T=Jd(e.layout(),e.selection(),x,e.paragraphOrder()),C=u(k,P,v)?Dh(o(),k.paragraphId):null;return !T&&C===null?false:(a={runProperties:T?qH(T):[],paragraphProperties:C},true)},m=()=>p()?(e.publish(),true):false,h=()=>{let x=a;if(!x)return {wrote:false,armed:false,built:false};let v=e.selectedCells?.(),k=v!==void 0&&v.length>0,{from:P,to:T}=e.orderedRange(),C=!k&&P.paragraphId===T.paragraphId&&P.offset===T.offset,E=C?Ud(e.layout(),P,$H):null,w=E?.from??P,I=E?.to??T,L=C&&w.offset===I.offset,A=k?[...ga(e.layout(),v)]:Qd(e.paragraphOrder(),{from:w,to:I});if(A.length===0)return {wrote:false,armed:false,built:false};let B=o(),$=e.displayMode(),j=[];for(let ie of A){let pe=e.textOf(ie),K=k||ie!==w.paragraphId?0:w.offset,z=k||ie!==I.paragraphId?pe.length:I.offset;if(K<z&&x.runProperties.length>0)for(let F of t(B,ie,K,z,x.runProperties,$,e.authorFilter()))j.push({op:"setRunProperties",paragraphId:ie,start:F.start,end:F.end,properties:F.properties,...F.targetRunIds?{targetRunIds:F.targetRunIds}:{}});let H=x.paragraphProperties!==null||k||ie!==I.paragraphId||K===0&&z===pe.length&&pe.length>0,Z=e.paragraphMarkVisible(ie);H&&Z&&x.runProperties.length>0&&j.push({op:"setParagraphMarkProperties",paragraphId:ie,properties:n(B,ie,x.runProperties)}),x.paragraphProperties&&Z&&j.push({op:"setParagraphProperties",paragraphId:ie,properties:[...x.paragraphProperties]});}let R=r.packageRevision();j.length>0&&e.commit(()=>r.applyTreeOps(j,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:k});let G=r.packageRevision()!==R,X=L&&x.runProperties.length>0&&(G||j.length===0);return X&&e.armPendingFormats(x.runProperties),{wrote:G,armed:X,built:j.length>0}},b$1=()=>{let x=h();return x.wrote&&i==="once"&&g(),x.wrote?"painted":x.armed?"armed":x.built?"refused":"nothingToPaint"},y=()=>{i!=="off"&&(i="off",e.publish());},g=()=>{s=null,l=null,y();};return {state:c,capture:m,apply:b$1,disarm:g,press(){let x=e.now(),v=s!==null&&x-s<eC,k=i;s=x;let P=()=>(s=null,false);return k==="once"&&v?p()?(i="locked",e.publish(),true):(y(),P()):k!=="off"?(y(),l=k==="locked"?x:null,true):l!==null&&x-l<eC?(l=null,true):p()?(i="once",l=null,e.publish(),true):P()},applyIfArmed(){i==="off"||a===null||h().wrote&&i==="once"&&g();}}}var nC=new WeakMap;function VH(e){let t=nC.get(e);if(t!==void 0)return t;let n=[e],r=false;for(;n.length>0&&!r;){let o=n.pop();if(o.kind!=="textValue"){(o.localName==="bidi"||o.localName==="rtl")&&(r=true);for(let i of o.children)n.push(i);}}return nC.set(e,r),r}function rC(e,t=()=>null){let n=null;return {keydown(r){if(r.key==="Shift"&&(r.location===1||r.location===2)&&r.ctrlKey&&!r.altKey&&!r.metaKey&&!r.isComposing&&!r.defaultPrevented){n=r.location===2?"rtl":"ltr";return}r.key!=="Control"&&(n=null);},keyup(r){if(n===null||r.key!=="Shift"&&r.key!=="Control")return;let o=n;if(n=null,r.defaultPrevented)return;let i=t();i===null||!VH(i)||e.setParagraphProperties([{localName:"bidi",paragraphDirection:o}]);},disarm(){n=null;}}}function oC(e,t){return e.addEventListener("keyup",t.keyup),e.addEventListener("pointerdown",t.disarm,{capture:true}),e.addEventListener("focusout",t.disarm),()=>{e.removeEventListener("keyup",t.keyup),e.removeEventListener("pointerdown",t.disarm,{capture:true}),e.removeEventListener("focusout",t.disarm);}}function KH(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),o=Math.min(e.x+e.width,t.x+t.width),i=Math.min(e.y+e.height,t.y+t.height);return o<=n||i<=r?0:(o-n)*(i-r)}function jH(e,t){return KH(e,t)>0?true:e.width===0?t.x<=e.x&&e.x<=t.x+t.width&&!(e.y+e.height<t.y||t.y+t.height<e.y):false}function gr(e,t,n){if(t.paragraphId===n.paragraphId)return t.offset-n.offset;let r=Ra(e);return r.indexOf(t.paragraphId)-r.indexOf(n.paragraphId)}function aC(e,t,n){if(!(t>Td$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Td$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let i of o.cells)aC(i.blocks,t+1,n);}}}function Rg(e,t){if(t.range){let{paragraphId:o,start:i,end:a}=t.range;return {from:{paragraphId:o,offset:i},to:{paragraphId:o,offset:a}}}if(t.level==="inline"||t.fragments.length===0)return null;let n=null,r=null;for(let o of t.fragments){let i=e.pages[o.pageIndex];i&&aC(i.fragments,0,a=>{if(!jH(o.box,a.box))return;let s={paragraphId:a.paragraphId,offset:0},l={paragraphId:a.paragraphId,offset:qe$1(e,a.paragraphId).length};(!n||gr(e,s,n)<0)&&(n=s),(!r||gr(e,l,r)>0)&&(r=l);});}return n&&r?{from:n,to:r}:null}function Vs(e,t){return t.placeholder?Rg(e,t):null}function sC(e){return !e.placeholder&&e.level==="inline"&&e.range!==void 0&&(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")}function WH(e){return e.placeholder}var iC=new WeakMap;function ZH(e,t){let n=iC.get(e);if(!n){n=new Map;for(let r of e.contentControls??[]){if(!sC(r))continue;let o=Rg(e,r),i=n.get(o.from.paragraphId)??[];i.push(o),n.set(o.from.paragraphId,i);}iC.set(e,n);}return n.get(t)??[]}function Pg(e,t){let n=null;for(let r of ZH(e,t.paragraphId))t.offset<=r.from.offset||t.offset>=r.to.offset||(!n||r.from.offset<n.from.offset||r.from.offset===n.from.offset&&r.to.offset>n.to.offset)&&(n=r);return n}function lC(e,t,n){let r=Pg(e,n);if(!r)return n;let o=t.paragraphId===n.paragraphId?n.offset-t.offset:0;if(o>0)return r.to;if(o<0)return r.from;let i=(r.from.offset+r.to.offset)/2;return n.offset<i?r.from:r.to}function Ks(e,t,n={}){let r=e.contentControls??[];if(r.length===0)return t;let o=gr(e,t.anchor,t.head)<=0,i=o?t.anchor:t.head,a=o?t.head:t.anchor,s=true;for(;s;){s=false;for(let l of r){let d=n.atomic===true&&sC(l);if(!l.placeholder&&!d)continue;let c=Rg(e,l);if(!c)continue;let u=gr(e,i,a)===0,p=gr(e,i,c.from);(u?(WH(l)?p>=0:p>0)&&gr(e,i,c.to)<0:gr(e,i,c.to)<0&&gr(e,a,c.from)>0)&&(gr(e,c.from,i)<0&&(i=c.from,s=true),gr(e,c.to,a)>0&&(a=c.to,s=true));}}return o?{anchor:i,head:a}:{anchor:a,head:i}}var UH=500,dC=4,na=40,Oc=12;function zH(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function cC(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},i=ce(e,t.pageIndex,o);return i?.placeholder?i:null}let r=zH(e,n);return r?.placeholder?r:null}var GH=new Set(["dropdown","comboBox","date","buildingBlockGallery"]);function uC(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=t.atomicInlineControls===true,i=n.ownerDocument,a=i.defaultView,s=null,l=null,d=0,c=0,u=0,p=0,m=null;function h(F,_){if(!l){let N=n.getBoundingClientRect();l={left:N.left,top:N.top};}let W=e.scale()||1;return {x:(F-l.left)/W,y:(_-l.top)/W}}function b(F){return {scope:{kind:"headerFooter",rId:F.rId},pageIndex:F.pageIndex,kind:F.kind,partName:F.partName,variant:F.variant}}function y(F,_){let W=e.layout(),N=h(F,_),q=Yd$1(W,N.y),U=W.pages[q];if(!U)return null;let ne=e.measurer();return $d$1(W,q,{x:N.x-U.contentBox.x-e.pageOffsetX(q),y:N.y-U.contentBox.y},ne?{measurer:ne}:{})}function g(F,_){let W=e.activeNote?.()??null;if(W){let re=e.layout(),ee=Rd(re,h(F,_),e.pageOffsetX);if(!ee||ee.scopeId!==W.scopeId)return null;let oe=e.measurer();return ae(re,ee.pageIndex,ee.fragments,ee.local,{...oe?{measurer:oe}:{}})}let N=e.activeHeaderFooter?.()??null;if(!N)return y(F,_);let q=e.layout(),U=h(F,_),ne=kp(q,U,e.pageOffsetX);if(ne&&kd(ne.story,b(N))){let re=e.measurer();return xp(q,ne.pageIndex,ne.story,ne.local,re?{measurer:re}:{})}return null}function x(F,_){let{story:W,pageIndex:N,kind:q}=F;return {rId:W.rId,pageIndex:N,kind:q,partName:W.partName,variant:W.variant,..._?{position:_}:{}}}function v(F){let _=e.measurer();return xp(e.layout(),F.pageIndex,F.story,F.local,_?{measurer:_}:{})?.position??void 0}let k=new WeakMap;function P(F,_){let W=e.activeNote?.();if(W){let ne=$i(F,null,W.scopeId).indexOf(_);return ne===-1?-1:ne}let N=e.activeHeaderFooter?.();if(N){let ne=$i(F,b(N)).indexOf(_);return ne===-1?-1:ne}let q=k.get(F);return q||(q=new Map(Ra(F).map((U,ne)=>[U,ne])),k.set(F,q)),q.get(_)??-1}function T(F,_,W){let N=P(F,_.paragraphId),q=P(F,W.paragraphId);return N!==q?N<q:_.offset<W.offset}function C(F,_,W){if(W==="character")return {from:_,to:_};let N=_.paragraphId;if(W==="paragraph"){let q=qe$1(F,N);return {from:{paragraphId:N,offset:0},to:{paragraphId:N,offset:q.length}}}return Ud(F,_,re(F,N))}function E(F,_,W,N,q){let U=q?cC(F,q):null,ne=U?Vs(F,U)??C(F,W,N):C(F,W,N),re=T(F,ne.from,_.from)?{anchor:_.to,head:ne.from}:{anchor:_.from,head:ne.to};return Ks(F,re,{atomic:o})}let w=r.closest(".docx-editor__scroll-container");function I(){return r.closest(".docx-editor__scroll-container")}function L(F,_,W){if(W<F+na){let N=Math.max(0,F+na-W);return -Math.min(Oc,N/na*Oc)}if(W>_-na){let N=Math.max(0,W-(_-na));return Math.min(Oc,N/na*Oc)}return 0}function A(){m!==null&&(a?.cancelAnimationFrame(m),m=null);}function B(){m=null;let F=s,_=I();if(!F||!_||!a)return;let W=_.getBoundingClientRect(),N=L(W.top,W.bottom,F.clientY);N!==0&&(_.scrollTop+=N,l=null,j(F.clientX,F.clientY),m=a.requestAnimationFrame(B));}function $(){if(m!==null||!a||!s)return;let F=I();if(!F)return;let _=F.getBoundingClientRect();L(_.top,_.bottom,s.clientY)!==0&&(m=a.requestAnimationFrame(B));}function j(F,_){let W=s;if(!W)return;let N=g(F,_);N&&((e.isReadOnlyPosition?.(N.position)??e.isReadOnlyParagraph?.(N.position.paragraphId))||R(W,N)||(W.caret=N.caret,e.setSelection(E(e.layout(),W.anchorRange,N.position,W.granularity,N),N.caret)));}function R(F,_){let W=F.anchorCell;if(!W)return false;if(!_.cell||_.cell.tableId!==W.tableId)return F.cellDragging;if(!F.cellDragging&&_.cell.cellId===W.cellId)return false;let N=ea$2(e.layout(),W,_.cell);return N?(F.cellDragging=true,e.setCellSelection(N),true):F.cellDragging}function G(F){let _=Date.now(),W=_-c;return d=Math.abs(F.clientX-u)<=dC&&Math.abs(F.clientY-p)<=dC&&W>=0&&W<=UH?d+1:1,c=_,u=F.clientX,p=F.clientY,d}let X=["character","word","paragraph"],ie=F=>{if(F.button!==0)return;if(e.onChangeBarToggle&&F.target?.closest?.("[data-docx-change-bar-toggle]")){F.preventDefault(),F.stopPropagation(),e.onChangeBarToggle();return}let _=F.target?.closest?.("[data-docx-cc-widget]");if(_){if(F.preventDefault(),F.stopPropagation(),_.hasAttribute("disabled")||_.dataset.disabledReason)return;let we=_.dataset.docxCcId,Ue=_.dataset.docxCcWidget;we&&Ue&&e.onContentControlWidget?.(we,Ue);return}if(e.selectionLocked?.()||F.pointerType==="touch")return;s&&H(),l=null;let W=e.layout(),N=h(F.clientX,F.clientY),q=e.activeHeaderFooter?.()??null,U=e.activeNote?.()??null,ne=kp(W,N,e.pageOffsetX),re=ne!==null&&hw(W,ne,N,e.pageOffsetX,q!==null&&kd(ne.story,b(q)),e.measurer()),ee=re?null:ne,oe=Rd(W,N,e.pageOffsetX),ge=re?null:F.target?.closest("[data-docx-hf]"),Ie=!!(ge||ee),_e=F.target,Mt=_e?.closest("[data-docx-note-ref]"),Ne=_e?.closest("[data-docx-note-mark-back]"),Ce=null,Ve=()=>Ce??=G(F);if(Mt?.dataset.docxNoteScope){F.preventDefault(),e.focus(),e.enterNote?.(Mt.dataset.docxNoteScope);return}if(Ne){F.preventDefault(),e.focus(),e.exitNote?.(true);return}if(oe&&!Ie){let we=e.measurer?.(),Ue=ae(W,oe.pageIndex,oe.fragments,oe.local,{...we?{measurer:we}:{}});if(!U||U.scopeId!==oe.scopeId){F.preventDefault(),e.focus(),e.enterNote?.(oe.scopeId,Ue?{paragraphId:Ue.position.paragraphId,offset:Ue.position.offset}:void 0,oe.pageIndex);return}if(U.pageIndex!==oe.pageIndex){F.preventDefault(),e.focus(),e.enterNote?.(oe.scopeId,Ue?{paragraphId:Ue.position.paragraphId,offset:Ue.position.offset}:void 0,oe.pageIndex);return}}else if(U){if(!vp(W,N,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(q)if(ee&&kd(ee.story,b(q)))ee.pageIndex!==q.pageIndex&&e.enterHeaderFooter?.(x(ee,v(ee)));else if(ee&&ee.story.rId){F.preventDefault(),e.focus(),e.enterHeaderFooter?.(x(ee,v(ee)));return}else if(vp(W,N,e.pageOffsetX)){F.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let we=Ve()>=2?Ip(W,N,e.pageOffsetX):null;we&&(F.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(we.kind,we.pageIndex));return}else if(Ie&&Ve()>=2){if(ee?.story.rId)F.preventDefault(),e.focus(),e.enterHeaderFooter?.(x(ee,v(ee)));else if(ge instanceof HTMLElement){let we=ge.dataset.docxRId,Ue=ge.dataset.docxHf,mt=ge.closest("[data-page-index]")?.getAttribute("data-page-index"),Me=mt!=null?Number(mt):NaN;if((Ue==="header"||Ue==="footer")&&Number.isInteger(Me))if(we){let Ke=W.pages[Me]?.[Ue];F.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:we,pageIndex:Me,kind:Ue,partName:Ke?.partName??"",variant:Ke?.variant??"default"});}else W.pages[Me]?.[Ue]||(F.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ue,Me));}return}else if(Ve()>=2){let we=Ip(W,N,e.pageOffsetX);if(we){F.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(we.kind,we.pageIndex);return}}let Ye=g(F.clientX,F.clientY);if(!Ye)return;if(e.isReadOnlyPosition?.(Ye.position)??e.isReadOnlyParagraph?.(Ye.position.paragraphId)){F.preventDefault();return}if(Ve()===2&&e.onTextFormDoubleClick?.(F))return;F.preventDefault(),e.focus();try{n.setPointerCapture(F.pointerId);}catch{}i.addEventListener("pointermove",K),i.addEventListener("pointerup",z),i.addEventListener("pointercancel",z);let $t=Ve(),Je=F.shiftKey?"character":X[($t-1)%X.length],pt=cC(W,Ye);if(pt&&!F.shiftKey){let we=()=>{$t===1&&GH.has(pt.controlType)&&e.onContentControlWidget?.(pt.id,pt.controlType);};if(e.selectContentControl?.(pt.id)){let mt=e.selection(),Me=T(W,mt.anchor,mt.head)||mt.anchor.paragraphId===mt.head.paragraphId&&mt.anchor.offset===mt.head.offset?{from:mt.anchor,to:mt.head}:{from:mt.head,to:mt.anchor};s={pointerId:F.pointerId,granularity:"character",anchorRange:Me,anchorCell:Ye.cell,cellDragging:false,clientX:F.clientX,clientY:F.clientY},we();return}let Ue=Vs(W,pt);if(Ue){s={pointerId:F.pointerId,granularity:"character",anchorRange:Ue,anchorCell:Ye.cell,cellDragging:false,clientX:F.clientX,clientY:F.clientY},pe(()=>e.setSelection({anchor:Ue.from,head:Ue.to})),we();return}}if(F.shiftKey){let we=e.selection();s={pointerId:F.pointerId,granularity:Je,caret:Ye.caret,anchorRange:{from:we.anchor,to:we.anchor},anchorCell:Ye.cell,cellDragging:false,clientX:F.clientX,clientY:F.clientY},pe(()=>e.setSelection(E(W,{from:we.anchor,to:we.anchor},Ye.position,Je,Ye),Ye.caret));}else {let we=(o&&Je==="word"?Pg(W,Ye.position):null)??C(W,Ye.position,Je);s={pointerId:F.pointerId,granularity:Je,caret:Ye.caret,anchorRange:we,anchorCell:Ye.cell,cellDragging:false,clientX:F.clientX,clientY:F.clientY},pe(()=>e.setSelection(Ks(W,{anchor:we.from,head:we.to},{atomic:o}),Ye.caret));}};function pe(F){try{F();}catch(_){throw H(),_}}let K=F=>{let _=s;if(!(!_||F.pointerId!==_.pointerId)){if(e.selectionLocked?.())return H();F.preventDefault(),_.clientX=F.clientX,_.clientY=F.clientY,j(F.clientX,F.clientY),$();}},z=F=>{let _=s;if(!_||F.pointerId!==_.pointerId)return;H();try{n.releasePointerCapture(_.pointerId);}catch{}let W=e.cellSelection();W?e.setCellSelection(W):e.setSelection(e.selection(),_.caret),F.type==="pointerup"&&(e.onTextFormPointerUp?.(F),e.onSelectionSettled?.());};function H(){if(s)try{n.releasePointerCapture(s.pointerId);}catch{}s=null,l=null,A(),i.removeEventListener("pointermove",K),i.removeEventListener("pointerup",z),i.removeEventListener("pointercancel",z);}let Z=()=>{l=null;};return n.addEventListener("pointerdown",ie),w?.addEventListener("scroll",Z,{passive:true}),a?.addEventListener("scroll",Z,{capture:true,passive:true}),a?.addEventListener("resize",Z,{passive:true}),{dragging:()=>s!==null,destroy(){H(),n.removeEventListener("pointerdown",ie),w?.removeEventListener("scroll",Z),a?.removeEventListener("scroll",Z,{capture:true}),a?.removeEventListener("resize",Z);}}}function fC(e,t,n){let r=e??Za;return {view:()=>r,projection:()=>Ya(r),changeBars:()=>t?r==="all-markup"||r==="simple-markup"?r:"none":"all-markup",set:o=>{r=o;},filter:o=>t&&Ya(r)!=="all-markup"?_a(o):o,toggleByChangeBar:()=>{t&&n(r==="simple-markup"?"all-markup":"simple-markup");}}}function pC(e){let{document:t,pagesLayer:n,session:r}=e,o=false,i=null,a,s;function l(){let{head:w}=e.selection();return s&&s.position.paragraphId===w.paragraphId&&s.position.offset===w.offset?s.lineId:void 0}function d(w){let I=oi(w?.anchorNode,n)??oi(w?.focusNode,n);I!==void 0&&(a=I);}function c(w){return a??oi(w?.anchorNode,n)??oi(w?.focusNode,n)}let u=false,p=false,m=false,h=null,b=false;function y(){if(e.selectionLocked?.())return false;let w=t.getSelection(),I=Ji(n,w);return !I||(d(w),Ot(I,e.selection()))?false:(e.adoptSelection(I),true)}function g(){let w=t.activeElement;if(w&&n.contains(w))return true;if(w&&w!==t.body&&w!==t.documentElement)return false;let I=t.getSelection();if(!I||I.rangeCount===0)return true;let L=I.anchorNode;return !L||!L.isConnected?true:n.contains(L)}let x=()=>{if(e.selectionLocked?.())return;let w=t.getSelection(),I=Ji(n,w);if(!I){if(!tg(n,w))return;u=false;let L=We(e.selection().head);if(Ot(L,e.selection()))return;e.setSelection(L);return}u=false,d(w),!Ot(I,e.selection())&&e.setSelection(I);};function v(w){let I=e.textOf(w),L=jP(n,w,I,t.getSelection()?.anchorNode??null);if(L===null)return;let A=WP(w,I,L);if(!A)return;let B=A.ops.find(ie=>ie.op==="deleteText"),$=A.ops.find(ie=>ie.op==="insertText"),j=$&&B?e.replacementOffset?.(w,B.start,B.end):void 0,R=$&&j!==void 0&&j!==$.offset?A.ops.map(ie=>ie===$?{...$,offset:j}:ie):A.ops,G=$?e.pendingFormatOps?.(w,j??$.offset,$.text.length,B?{start:B.start,end:B.end}:void 0)??[]:[],X=e.storyScope();e.commit(()=>{let ie=e.applyOps([...R,...G],e.selectionMark(),X);return G.length===0||!ie.rejected?ie:e.applyOps(R,e.selectionMark(),X)}),e.setSelection(We({paragraphId:w,offset:$&&j!==void 0?j+$.text.length:A.caret}));}function k(){o||m||e.isGesturing?.()||e.holdsCellSelection?.()||P()||u&&x();}function P(){if(!p||u)return false;if(!i)return true;let w=Ji(n,t.getSelection());return w!==null&&Ot(w,i)}function T(w){if(!(w instanceof PointerEvent&&w.button!==0)){if(w.type==="selectstart"&&e.selectionLocked?.()){w.preventDefault();return}u=true;}}let C=false;function E(w=false){if(e.updateCaret(),!w&&!g())return;o=true;let I=e.now(),L=e.domSelection?.()??e.selection();u=false;let A=t.getSelection(),B=c(A),$=l(),j=OP(n,L,A,{...B!==void 0?{preferredPageIndex:B}:{},...$!==void 0?{preferredLineId:$}:{}});j&&d(A),i=j?L:null,j||(p=true),e.recordSelectionMs(e.now()-I),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",T,true),n.addEventListener("selectstart",T,true),{adoptBeforePaint(){let w=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,I=p||w||!u?false:y();return e.hasPendingInput?.()!==true&&(p=false),I},noteModelMoved(){p=true,s=void 0;},noteSelectionSettled(){p=false;},mirrorToDom:E,adoptBeforeInput:k,isComposing:()=>m,noteBrowserSelectionFixup(){C=true;},onSelectionChange:()=>{if(!o&&!m&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(C&&tg(n,t.getSelection())){let w=Ji(n,t.getSelection());if((w===null||!Ot(w,e.selection()))&&(C=false,!u)){E();return}}P()||x();}},onCompositionStart:()=>{k(),m=true;let w=e.selection();b=w.anchor.paragraphId!==w.head.paragraphId,h=w.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:w=>{m=false;let I=h??e.selection().head.paragraphId;h=null;let L=b;b=false;let A=e.storyScope(),B=r.revisionFor(A);if(L){let $=w?.data??"";$.length>0&&e.replaceSelectionWith?.($);}else v(I);r.endComposition(),r.revisionFor(A)===B&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>a,selectionLineId:l,caretPreference(w=a){let I=l();return {...w!==void 0?{preferredPageIndex:w}:{},...I!==void 0?{preferredLineId:I}:{}}},notePointerCaret(w){s=w,w&&(a=w.pageIndex);},destroy(){n.removeEventListener("pointerdown",T,true),n.removeEventListener("selectstart",T,true),u=false;}}}var XH=32;function Tg(e,t,n,r){if(!(e.kind==="textValue"||r>XH)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)Tg(o,t,n,r+1);}}var mC=new WeakMap;function gC(e,t,n,r){if(e.kind==="paragraph"||e.kind==="textValue"){Tg(e,t,n,0);return}let o=mC.get(e);if(!o){let i=new Map;Tg(e,0,i,0),o=[...i.keys()],mC.set(e,o);}for(let i of o)n.has(i)||n.set(i,t);}function JH(e,t){let n=rd(e),r=sc$1(n),o=0,i=Oc$1(e),a=new Map;for(let s=0;s<i.length;s+=1){let l=i[s];for(let d=l.blockStart;d<l.blockEndExclusive;d+=1){let c=n[d];if(c){for(;o<r.length&&r[o]!==c;)gC(r[o],s,a),o+=1;o+=1,gC(c,s,a);}}}return a}var hC=new WeakMap;function e8(e){return !(!e.story||e.origin===g.mutationUndo||e.origin===g.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.includes(l$2.section))}function t8(e,t){t.story&&t.story.kind!=="body"||e8(t)||(e.map=null);}function n8(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>t8(t,n)));}function r8(e,t){let n=hC.get(e);return n||(n={map:null,subscribed:false},hC.set(e,n)),n8(e,n),n.map||(n.map=JH(t)),n.map}function yC(e,t,n){return n.startsWith(`${t.name}#`)?r8(e,t).get(n)??null:null}var bC=32;function js(e,t,n,r,o="all-markup",i){let a=e.part(),s=Oc$1(a,o,i);if(s.length<=1)return 0;let l=Pc$1(a,o,i),d=p=>{let m=l.indexOf(p);if(m!==-1)return m;let h=l.findIndex(b=>b>p);return h===-1?Math.max(0,l.length-1):h},c=Cg(e,t);if(c!==null)return d(c);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let p=e.headerFooterResolutionBySection().findIndex(m=>[m.headers,m.footers].some(h=>[...h.values()].some(b=>b.rId===n.rId)));return p===-1?0:d(p)}let u=i8(e,t);if(u!==null){let p=Cg(e,u);if(p!==null)return d(p)}return 0}function vC(e,t,n,r,o="all-markup",i){let a=e.part(),s=Oc$1(a);if(s.length<=1)return {kind:"whole-document"};let l=Pc$1(a,o,i),d=Cg(e,t),c=js(e,t,n,r,o,i),u=l[c]??c;if(d!==null&&d===u)return {kind:"anchor",paragraphId:t};let p=s[u];if(!p)return {kind:"unaddressable"};let m=rd(a);for(let h=p.blockStart;h<p.blockEndExclusive;h+=1){let b=o8(m[h]);if(b!==null)return {kind:"anchor",paragraphId:b}}return {kind:"unaddressable"}}function o8(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>bC)return null;if(n.kind==="paragraph")return n.id;for(let o of n.children){let i=t(o,r+1);if(i!==null)return i}return null};return t(e,0)}function Cg(e,t){return yC(e,e.part(),t)}function i8(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=ch$1(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let i of Jc$1(o.root)){let a=yc$1(i);if(a===null||!a8(i,t))continue;return dh$1(e.part()).find(l=>l.noteKind===r&&l.noteId===a)?.paragraphId??null}}return null}function a8(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>bC)return false;if(r.kind==="paragraph"&&r.id===t)return true;for(let i of r.children)if(n(i,o+1))return true;return false};return n(e,0)}function ra(e,t){if(t===void 0)return {};let n=`${e}Autospacing`,r=`${e}Lines`;return t===null?{[e]:null,[n]:null,[r]:null}:{[e]:String(Math.round(t*20)),[n]:"0",[r]:null}}function Mc(e){return e===void 0?{}:e===null?{line:null,lineRule:null}:e.rule==="multiple"?{line:String(Math.round(e.value*240)),lineRule:"auto"}:{line:String(Math.round(e.value*20)),lineRule:e.rule==="exact"?"exact":"atLeast"}}function xC(e){return {val:e?"1":"0"}}function wC(e){let t=null,n=null,r=null,o=(a,s)=>(e.setLastRejection(null),e.commit(()=>{let l=e.applyOps(Array.isArray(a)?a:[a],e.selectionMark());return l.rejected&&e.setLastRejection(String(l.reason??"rejected")),l},s),e.lastRejection()===null),i=(a,s,l)=>{let d=pc$1(a);if(!d)return e.setLastRejection("invalid note scope id"),false;let c=e.session.currentPackage(),u=ch$1(c,d.noteKind),p=u?Lc$1(u.root,d.noteId):null;if(!u||!p)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let m=e.selection();r={anchor:{paragraphId:m.anchor.paragraphId,offset:m.anchor.offset},head:{paragraphId:m.head.paragraphId,offset:m.head.offset}};}if(t={kind:"note",id:oc$1(d.noteKind,d.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let m=s8(p),h=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:d.noteKind})),b=m.find(y=>h.has(y.id));if(b){let y=Eg(b);e.setSelection({anchor:{paragraphId:b.id,offset:y},head:{paragraphId:b.id,offset:y}});}}return e.noteModelMoved(),e.render(),n??=e.revealNote(t.id),e.notify(),true};return {insertNote(a){if(e.activeScope().kind!=="body")return e.setLastRejection("insertNote requires body scope"),false;let s=e.deleteSelectionPlan(),l=s.collapseTo;if(!(s.ops.length===0||o(s.ops,()=>({anchor:{...l},head:{...l}}))))return false;let c=SC(e.session.currentPackage(),a);if(!o({op:"insertNote",noteKind:a,paragraphId:l.paragraphId,offset:l.offset},()=>{let h={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:h,head:h}}))return s.ops.length>0&&e.undo(),false;let m=[...SC(e.session.currentPackage(),a)].find(h=>!c.has(h));return m===void 0?true:i(oc$1(a,m))},deleteNote(a,s){return o({op:"deleteNote",noteKind:a,noteId:s})},convertNote(a,s){return o({op:"convertNote",fromKind:a,noteId:s})},convertAllNotes(a){return o({op:"convertAllNotes",fromKind:a})},setNoteProperties(a){return o({op:"setNoteProperties",scope:a.scope,sectionIndex:a.sectionIndex,footnote:a.footnote,endnote:a.endnote})},enterNote:i,exitNote(a=true){if(!t)return;let s=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),a&&s&&e.setSelection(s),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(a){!t||!Number.isInteger(a)||n!==a&&(n=a);}}}function s8(e){let t=[],n=(r,o)=>{if(!(o>32)){if(r.kind==="paragraph"){t.push(r);return}if("children"in r)for(let i of r.children)n(i,o+1);}};return n(e,0),t}function Eg(e){let t=hg$1(e)[0];return t&&uc$2(t.node)?t.end:0}function SC(e,t){let n=ch$1(e,t),r=new Set;if(!n)return r;for(let o of Jc$1(n.root)){if(!Ac$1(o))continue;let i=yc$1(o);i!==null&&r.add(i);}return r}var l8=720;function Og(e,t,n=l8){return RC(e,t,e+t*n)}function kC(e,t,n){let r=t>0?Math.floor(e/n)+1:Math.ceil(e/n)-1;return RC(e,t,r*n)}function RC(e,t,n){return t>0?Math.max(e,Math.min(gd$1,n)):Math.max(0,n)}function Mg(e){let t;for(let r of e){if(r.localName!=="ind")continue;let o=r.attributes?.left??r.attributes?.start;o!==void 0&&(t=o);}let n=nd(t);return n===null||Math.abs(n)>9999999?0:n}function IC(e,t){return e.kind==="midLine"?false:e.kind==="empty"||t<=e.offset}function PC(e,t,n,r,o){let{from:i,to:a}=e;if(i.paragraphId===a.paragraphId&&i.offset===a.offset)return null;let s=t.length>1?n.start(a.paragraphId):null,d=s!==null&&IC(s,a.offset)&&!(s.kind==="empty"&&n.endsStory(a.paragraphId))?t.slice(0,-1):t;if(d.length>1)return {write:"stepLeft",paragraphs:d};if(!IC(n.start(i.paragraphId),i.offset))return null;let{resolved:c,direct:u}=n.firstLine(i.paragraphId);return r==="increase"?{write:c>=0&&c<o?"setFirstLine":"stepLeft",paragraphs:d}:{write:u&&c>0?"clearFirstLine":"stepLeft",paragraphs:d}}function d8(e,t){let n=Number.POSITIVE_INFINITY,r=false;for(let{line:o}of ud$2(e).get(t)??[]){if(!r&&(r=true,Ma(o)[0]?.paragraphId!==t))return {kind:"midLine"};let i=Na(o,t);if(i){for(let a of i.spans)a.range.end>a.range.start&&(n=Math.min(n,a.range.start));for(let a of i.drawings)n=Math.min(n,a.start);if(Number.isFinite(n))break}}return Number.isFinite(n)?{kind:"start",offset:n}:{kind:"empty"}}var c8=["firstLine","hanging","firstLineChars","hangingChars"];function TC(e,t,n){let r=new Map;return {start(o){let i=r.get(o);if(i)return i;let a=d8(e,o);if(a.kind==="start"){let s=Ta(t,o),l=s?.kind==="paragraph"?Eg(s):0;l>a.offset&&(a={kind:"start",offset:l});}return r.set(o,a),a},endsStory:o=>n[n.length-1]===o,firstLine(o){let i=Cm(e,o),a=Dh(t,o).find(l=>l.localName==="ind")?.attributes,s=c8.some(l=>a?.[l]!==void 0);return {resolved:i?Yd(i.indent):0,direct:s}}}}function CC(e,t){let n=(r,o)=>r.paragraphId===o.paragraphId&&r.offset===o.offset;return (e.contentControls??[]).some(r=>{if(!r.placeholder)return false;let o=Vs(e,r);return o!==null&&n(o.from,t.from)&&n(o.to,t.to)})}var Ws="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",oa="a section break cannot be inserted inside a table cell",Fc="a section break cannot change a section that a locked or linked content control holds",Zs="a section break cannot be inserted in locked or linked content";function u8(e){let t=new Set,n=new Set,r=i=>{if(i.kind==="textValue"||!("localName"in i)||i.localName!=="sdt")return false;let a=i.children?.find(s=>s.kind!=="textValue"&&"localName"in s&&s.localName==="sdtPr");return !a||a.kind==="textValue"?false:(a.children??[]).some(s=>{if(s.kind==="textValue"||!("localName"in s)||s.namespaceUri!==la$2)return false;if(s.localName==="dataBinding")return true;if(s.localName!=="lock")return false;let l=s.attributes?.find(d=>d.localName==="val"&&d.namespaceUri===la$2)?.value;return l==="contentLocked"||l==="sdtContentLocked"})},o=(i,a,s)=>{if(i.kind==="textValue")return;if(i.kind==="paragraph"){a&&t.add(i.id),s&&n.add(i.id);return}let l=a||i.kind==="table",d=s||r(i);for(let c of i.children??[])o(c,l,d);};return o(e.root,false,false),{inCell:t,held:n}}var f8=32;function p8(e){let t=new Set(Gk$1(e).map(n=>Jk$1(n)));return Fk$1(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function Fg(e,t){let n=t.replaceAt??t.collapseTo;return Hk$1(e,n.paragraphId)?t.collapseTo:n}var Ag=(e,t)=>ag$1(e,t)||Zf$1(e,t).content;function Ac(e,t,n,r){if(Hk$1(e,t))return oa;if(Ag(e,t))return Zs;let{section:o,ownerId:i}=Ik$1(e,t);return Jk$1(o)===n?null:i!==null&&Ag(e,i)?Fc:r?Ws:null}function EC(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return oa;if(e.caretParagraphId!==null)return Ac(e.part(),e.caretParagraphId,t,n);let r=u8(e.part());if(!n&&r.inCell.size===0&&r.held.size===0)return null;let{from:o,to:i}=e.orderedRange(),a=e.part(),s=Ik$1(a,o.paragraphId),l=Ik$1(a,i.paragraphId),d=s.section===l.section,c=d?Jk$1(s.section):p8(a),u=e.paragraphOrder(),p=u.indexOf(o.paragraphId),m=u.indexOf(i.paragraphId),h=p===-1||m===-1?null:u.slice(p,m+1),b=h!==null&&!h.some(g=>r.inCell.has(g))&&!h.some(g=>r.held.has(g));if(c!==null&&c!==t){if(b&&d&&s.ownerId!==null&&Ag(a,s.ownerId))return Fc;if(n&&b)return Ws}if(b&&c!==null)return null;if(h===null||h.length-1>f8)return n&&c!==null&&c!==t?Ws:null;let y=Fg(a,e.deleteSelectionPlan());return Ac(a,y.paragraphId,t,n)}var m8=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function g8(e,t){let n={...e??{}};return delete n.leftChars,delete n.startChars,e?.start!==void 0&&(n.start=t),(e?.start===void 0||e.left!==void 0)&&(n.left=t),n}function Lc(e,t,n,r){let o={...e};if(delete o[`${t}Chars`],delete o[`${n}Chars`],r===null)return delete o[t],delete o[n],o;let i=String(r),a=e[n]!==void 0;return a&&(o[n]=i),(!a||e[t]!==void 0)&&(o[t]=i),o}function OC(e,t){let n={...e};return delete n.firstLineChars,delete n.hangingChars,t===null?(delete n.firstLine,delete n.hanging,n):(t>=0?(n.firstLine=String(t),n.hanging="0"):(n.hanging=String(-t),n.firstLine="0"),n)}function MC(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:i,collapsedAt:a}=e,s=e.deleteSelectionPlan,l=()=>t.partFor(e.storyScope())??t.part(),d=(w,I,L)=>t.applyTreeOps(w,I,L,e.storyScope()),c=rR({session:t,storyPart:l}),u=()=>e.paragraphOrder(),p={get value(){return e.layout()}};function m(){let w=e.selectedCells?.();return w&&w.length>0?w:null}function h(w){let I=false;return n(()=>{let L=w();return I=L.committed,L},void 0,{keepCellSelection:m()!==null}),I}function b(w=o()){if(m()!==null)return [...ga(p.value,m())];let{from:I,to:L}=w,A=u(),B=A.indexOf(I.paragraphId),$=A.indexOf(L.paragraphId);return B===-1||$===-1?null:A.slice(B,$+1)}let y=8;function g(w){return x(w)?.level??null}function x(w){return Qa(p.value,w)}function v(w){let I=x(w);return I?I.numFmt==="bullet"?"bullet":"ordered":null}function k(w,I){let L=u(),A=L.indexOf(w[0]??""),B=L.indexOf(w[w.length-1]??"");if(A===-1||B===-1)return null;for(let $ of [A-1,B+1]){let j=L[$];if(!j)continue;let R=x(j);if(R&&(R.numFmt==="bullet"?"bullet":"ordered")===I)return R.numId}return null}function P(w,I){return I<0||I>y?false:e.numberingLevelExists(w.numId,I)}function T(w,I){return I<0||I>y?false:e.numberingLevelExists(w.numId,I)?true:t.ensureNumberingLevel(w.numId,I,w.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(w.numId,I)}function C(w,I,L){let A=I==="increase"?1:-1,B=[];for(let $ of w){let j=fr(p.value,$),R=x($),G=R?.level??null;if(R&&G!==null){let z=G+A;if(z<0||z>y||!T(R,z))continue;B.push({op:"setListLevel",paragraphId:$,level:z});continue}let X=Mg(j),ie=L===void 0?Og(X,A):kC(X,A,L);if(ie===X)continue;let pe=Dh(l(),$),K=pe.find(z=>z.localName==="ind");B.push({op:"setParagraphProperties",paragraphId:$,properties:Fh(pe,{localName:"ind",attributes:g8(K?.attributes,String(ie))})});}return B.length===0?false:h(()=>d(B,i()))}function E(w,I){let L=[];for(let A of w){let B=Dh(l(),A),j={...B.find(R=>R.localName==="ind")?.attributes??{}};I.left!==void 0&&(j=Lc(j,"left","start",I.left)),I.right!==void 0&&(j=Lc(j,"right","end",I.right)),I.firstLine!==void 0&&(j=OC(j,I.firstLine)),L.push({op:"setParagraphProperties",paragraphId:A,properties:Fh(B,{localName:"ind",...Object.keys(j).length>0?{attributes:j}:{}})});}return L.length===0?false:h(()=>d(L,i()))}return {insertTab(){let w=s(),I=w.replaceAt??w.collapseTo;n(()=>d([...w.ops,{op:"insertTab",paragraphId:I.paragraphId,offset:I.offset}],i()),()=>a({...I,offset:I.offset+1}));},insertLineBreak(){let w=s(),I=w.replaceAt??w.collapseTo;n(()=>d([...w.ops,{op:"insertHardBreak",paragraphId:I.paragraphId,offset:I.offset}],i()),()=>a({...I,offset:I.offset+1}));},insertPageBreak(){let w=s(),I=w.replaceAt??w.collapseTo;n(()=>d([...w.ops,{op:"insertPageBreak",paragraphId:I.paragraphId,offset:I.offset}],i()),()=>a({...I,offset:I.offset+1}));},exitListOnEmptyItem(){let{from:w,to:I}=o();if(w.paragraphId!==I.paragraphId||w.offset!==I.offset)return false;let L=x(w.paragraphId);if(!L||e.paragraphTextOf(w.paragraphId).length>0)return false;let B=L.level>0&&P(L,L.level-1),$=[];if(B)$.push({op:"setListLevel",paragraphId:w.paragraphId,level:L.level-1});else {let R=c.clearOp(w.paragraphId);R&&$.push(R),$.push({op:"setListNumbering",paragraphId:w.paragraphId,numId:null});}let j=false;return n(()=>{let R=d($,i());return j=R.committed,R}),j},isListParagraph(){let{paragraphId:w}=r();return g(w)!==null},isListActive(w){let I=b();if(I===null)return false;let L=w==="bullet"?"bullet":"ordered";return I.length>0&&I.every(A=>v(A)===L)},toggleList(w){let I=b();if(I===null||I.length===0)return false;let L=I.every($=>v($)===w),A=L?null:k(I,w)??t.ensureListDefinition(w);if(!L&&A===null)return false;let B=L?[]:c.applyOps(I);for(let $ of I){let j=g($);B.push({op:"setListNumbering",paragraphId:$,numId:A,...j!==null?{level:j}:{}});}return h(()=>d(B,i()))},canAdjustIndent(w){let I=b();if(I===null)return false;let L=w==="increase"?1:-1;return I.some(A=>{let B=x(A);if(B){let j=B.level+L;return j>=0&&j<=y}let $=Mg(fr(p.value,A));return Og($,L)!==$})},adjustIndent(w){let I=b();return I!==null&&C(I,w)},setIndent(w){if(w.left===void 0&&w.right===void 0&&w.firstLine===void 0)return false;let I=b();return I!==null&&E(I,w)},indentWithTab(w){let I=o();if(I.from.paragraphId===I.to.paragraphId&&I.from.offset===I.to.offset&&m()===null||CC(p.value,I))return false;let A=b(I);if(A===null)return false;let B=Math.round(zb(t.settingsRoot())*20),$=TC(p.value,l(),u()),j=m()===null?PC(I,A,$,w,B):{write:"stepLeft",paragraphs:A};return j===null?false:(j.write==="stepLeft"?C(j.paragraphs,w,B):E(j.paragraphs,{firstLine:j.write==="setFirstLine"?B:null}),true)},setParagraphFormat(w){let I=b();if(I===null||I.length===0)return false;let L=[];w.direction!==void 0&&L.push({localName:"bidi",paragraphDirection:w.direction}),w.alignment!==void 0&&L.push({localName:"jc",attributes:{val:w.alignment},physicalAlignment:true});let A={...ra("before",w.spaceBeforePt),...ra("after",w.spaceAfterPt),...Mc(w.lineSpacing)};Object.keys(A).length>0&&L.push({localName:"spacing",attributes:A,mergeAttributes:true});for(let[R,G]of m8){let X=w[R];X!==void 0&&L.push({localName:G,attributes:xC(X)});}let B=w.tabStops!==void 0,$=w.indentLeftTwips!==void 0||w.indentRightTwips!==void 0||w.indentFirstLineTwips!==void 0;if(L.length===0&&!$&&!B)return false;let j=[];for(let R of I){let G=Dh(l(),R),X=G;if($){let H={...G.find(Z=>Z.localName==="ind")?.attributes??{}};w.indentLeftTwips!==void 0&&(H=Lc(H,"left","start",w.indentLeftTwips)),w.indentRightTwips!==void 0&&(H=Lc(H,"right","end",w.indentRightTwips)),w.indentFirstLineTwips!==void 0&&(H=OC(H,w.indentFirstLineTwips)),X=Fh(X,{localName:"ind",...Object.keys(H).length>0?{attributes:H}:{}});}let ie=fr(p.value,R),pe=G,K=false;for(let z of L){let H=Ec(z,ie,X,pe);if(!H)continue;if(K=true,H.remove){X=X.filter(_=>_.localName!==H.localName);continue}let Z=H.mergeAttributes?{...X.find(_=>_.localName===H.localName)?.attributes??{},...H.attributes}:H.attributes??{},F=Object.fromEntries(Object.entries(Z).filter(([,_])=>_!=null));X=Fh(X,{localName:H.localName,...Object.keys(F).length>0?{attributes:F}:{}});}if((K||$)&&j.push({op:"setParagraphProperties",paragraphId:R,properties:X}),B){let z=Fs(e.layout(),R);j.push({op:"setParagraphTabStops",paragraphId:R,stops:w.tabStops.map(H=>({positionTwips:Math.round(H.positionTwips),alignment:H.alignment,...H.leader&&H.leader!=="none"?{leader:H.leader}:{}})),...z?{inForcePositionsTwips:z.stops.map(H=>Math.round(H.positionPt*20))}:{}});}}return j.length===0?false:h(()=>d(j,i()))},sectionProperties:()=>Nc$1(t.part()),sectionPropertiesAt(w){let I=Oc$1(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),L=js(t,w,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (I[L]??I[I.length-1]).properties},sectionAnchorParagraphAt(w){return vC(t,w,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(w){let I=false;return n(()=>{let L=e.storyScope().kind==="body",A=t.applyTreeOps([{op:"setSectionProperties",...w}],L?i():void 0,void 0,{kind:"body"});return I=A.committed,A}),I},sectionBreakRefusal(w="nextPage"){return e.storyScope().kind!=="body"?null:EC({part:()=>t.part(),breakType:w,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:u,deleteSelectionPlan:s})},insertSectionBreak(w="nextPage"){if(e.storyScope().kind!=="body")return false;let I=s(),L=Fg(t.part(),I),A=(Hk$1(t.part(),L.paragraphId)?oa:null)??Ac(t.part(),L.paragraphId,w,e.editingMode?.()==="suggest");if(A!==null)return e.publishRefusal?.(A),false;let B=new Set(t.paragraphIds()),$=false,j=false;return n(()=>{let R=t.applyTreeOps([...I.ops,{op:"splitParagraph",paragraphId:L.paragraphId,offset:L.offset},{op:"setSectionMark",paragraphId:L.paragraphId,breakType:w}],i(),void 0,{kind:"body"});return $=R.committed,j=R.reason==="locked"||R.reason==="bound",R},()=>{let R=t.paragraphIds().find(G=>!B.has(G));return R?a({paragraphId:R,offset:0}):null}),!$&&j&&e.publishRefusal?.(Zs),$}}}var DC="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function HC(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===DC}function h8(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===DC}function Lg(e){return e.kind==="textValue"?[]:e.children}function _C(e,t=0){if(e.kind==="textValue")return e.value;if(t>=wa$1||e.kind==="deletedText"||y8(e.kind)||tf(e)||e.kind==="runProperties")return "";let n=fb(e);if(n!==null)return n;if(e.kind==="generic"&&!ya$1(e)&&!HC(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return pb(e);let r=xa$1(e,t),o="";for(let i of e.children)o+=_C(i,r);return o}function y8(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function Ng(e,t,n){if(!(t>=wa$1))for(let r of e){if(r.kind==="hyperlink"){xa$1(r,t)<wa$1&&n(r,t);continue}if(ya$1(r)){Ng(Lg(r),xa$1(r,t),n);continue}if(HC(r)){for(let o of Lg(r))h8(o)&&Ng(Lg(o),xa$1(r,t),n);continue}n(r,t);}}function AC(e,t,n){let r=b8(e,t);if(!r||r.kind!=="paragraph")return [];let o=jg$1(r),i=[],a=0;return Ng(r.children,0,(s,l)=>{let d=o.spanOf(s);if(d&&(a=Math.max(a,d.end)),s.kind!=="hyperlink")return;let c=d?d.start:a,u=d?d.end:a,p=Bd$1(s,n);i.push({id:s.id,paragraphId:t,start:c,end:u,text:jb$1(_C(s,l)),kind:p.kind,href:p.href,authored:p.authored,...p.anchor!==void 0?{anchor:p.anchor}:{},...p.tooltip!==void 0?{tooltip:p.tooltip}:{}});}),i}function b8(e,t){let n=r=>{if(r.kind==="textValue")return r.id===t?r:null;if(r.id===t)return r;for(let o of r.children){let i=n(o);if(i)return i}return null};return n(e.root)}function v8(e,t){for(let n of e)if(n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)return n;return null}function x8(e,t){for(let n of Ga(e,t.paragraphId))for(let r of n.lines)for(let o of r.spans)if(!(!o.fieldAtom||!o.link)&&t.offset>=o.range.start&&t.offset<=o.range.end)return o.link.id;return null}function BC(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,c,u)=>e.session.applyTreeOps(d,c,u,t()),i=d=>{let c=n();return c?AC(c,d,r):[]},a=()=>v8(i(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,c=x8(e.layout(),d);return c===null?null:e.fieldLinkById(c)},l=d=>{let c=e.selection().head.paragraphId,u=i(c).find(p=>p.id===d);if(u)return u;for(let p of e.session.storyParts()){let m=h=>Ig$1(e.session.currentPackage(),p.name,h);for(let h of Oc$2(p))for(let b of Rc$2(h.root)){let y=b.id,g=AC(p,y,m).find(x=>x.id===d);if(g)return g}}return null};return {linksInCaretParagraph:()=>i(e.selection().head.paragraphId),linkAtCaret:a,fieldLinkAtCaret:s,linkById:l,applyHyperlink(d){let c=d.text===void 0?d:{...d,text:kb(d.text)},u=c.url!==void 0&&c.url.length>0,p=c.anchor!==void 0&&c.anchor.length>0;if(u===p)return false;let m=t();if(!n()||e.refusesWrite())return false;let h;if(u){let I=()=>e.session.ensureHyperlinkRelationship(c.url,m),L=e.withMintActor?e.withMintActor(I):I();if(!L)return false;h=L;}let b={...h!==void 0?{relationshipId:h}:{},...p?{anchor:c.anchor}:{},...c.tooltip!==void 0?{tooltip:c.tooltip}:{}},y=a(),g=e.orderedRange(),x=g.from.paragraphId===g.to.paragraphId&&g.from.offset===g.to.offset;if(y&&(x||S8(y,g))){let I=[];if(c.text!==void 0&&c.text!==kb(y.text)){if(c.text.length===0)return false;let A=e.replacementLanding?.(y.paragraphId,y.start,y.end),B=e.textOf(y.paragraphId).slice(y.start,y.start+2),$=y.start+(B.length===2&&B.charCodeAt(0)>=55296&&B.charCodeAt(0)<=56319&&B.charCodeAt(1)>=56320&&B.charCodeAt(1)<=57343?2:1);if(A!=null&&A>y.start&&$<y.end)I.push({op:"setHyperlinkTarget",linkId:y.id,...b},{op:"deleteText",paragraphId:y.paragraphId,start:y.start,end:y.end},{op:"insertText",paragraphId:y.paragraphId,offset:$,text:c.text});else if(A!=null){let j=FC(e.session);I.push({op:"setHyperlinkTarget",linkId:y.id,...b},...LC(y,A,c.text),{op:"insertHyperlink",paragraphId:y.paragraphId,start:A,end:A+c.text.length,...b,...j?{styleId:j}:{}});}else {let j=NC(y.paragraphId,y.start,y.end,c.text);if(!j)return false;I.push({op:"setHyperlinkTarget",linkId:y.id,...b},...j);}}else I.push({op:"setHyperlinkTarget",linkId:y.id,...b});let L=false;return e.commit(()=>{let A=o(I,e.selectionMark());return L=A.committed,A},()=>null),L}let v=g.from.paragraphId;if(g.to.paragraphId!==v)return false;let k=[],P=g.from.offset,T=g.to.offset;if(x){let I=c.text??c.url??c.anchor??"";if(I.length===0)return false;P=e.insertionLanding?.(v,P)??P,k.push({op:"insertText",paragraphId:v,offset:P,text:I}),T=P+I.length;}else {let I=e.replacementLanding?.(v,P,T);if(I!=null){let L=c.text??e.textOf(v).slice(P,T);if(L.length===0)return false;k.push(...LC({paragraphId:v,start:P,end:T},I,L)),P=I,T=I+L.length;}else if(c.text!==void 0&&c.text!==e.textOf(v).slice(P,T)){let L=NC(v,P,T,c.text);if(!L)return false;k.push(...L),T=P+c.text.length;}}if(T<=P)return false;let C=FC(e.session);k.push({op:"insertHyperlink",paragraphId:v,start:P,end:T,...b,...C?{styleId:C}:{}});let E=false,w={paragraphId:v,offset:T};return e.commit(()=>{let I=o(k,e.selectionMark(),{paragraphId:v,start:T,end:T});return E=I.committed,I},()=>({anchor:w,head:w})),E},removeHyperlink(d){if(!n())return false;let c=d?l(d):a();if(!c)return false;let u=false,p={paragraphId:c.paragraphId,offset:c.end};return e.commit(()=>{let m=o([{op:"removeHyperlink",linkId:c.id}],e.selectionMark());return u=m.committed,m},()=>({anchor:p,head:p})),u}}}function FC(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function S8(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function LC(e,t,n){return [{op:"deleteText",paragraphId:e.paragraphId,start:e.start,end:e.end},{op:"insertText",paragraphId:e.paragraphId,offset:t,text:n}]}function NC(e,t,n,r){if(r.length===0)return null;let o=[{op:"insertText",paragraphId:e,offset:t,text:r,bias:"right"}];return n>t&&o.push({op:"deleteText",paragraphId:e,start:t+r.length,end:n+r.length}),o}var w8=24;function $C(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=p=>{if(!p||p.length===0||p.startsWith("#"))return false;let m=Q(p);return !m.ok||!m.href||!n?false:(n.open(m.href,"_blank","noopener,noreferrer"),true)},i=p=>{if(e.enterStoryFor&&!e.enterStoryFor(p.paragraphId))return false;let m=e.layout(),h=oe(m,p);if(!h)return false;let b=m.pages[h.pageIndex];if(!b)return false;let y=b.box.y+(b.contentBox.y-b.box.y)+h.y,g=r();return g&&(g.scrollTop=Math.max(0,y*e.scale()-w8),e.onScrolled?.()),e.setSelection(p),true},a=p=>{let m=e.bookmarks().get(p);return m?i(m):false},s=null;function l(p){if(!p||p.closest("[data-docx-hf]"))return null;let m=p.closest("a.docx-hyperlink");if(m){let b=m.dataset.docxLink;return b?{linkId:b,drawing:false}:null}let h=p.closest("[data-docx-drawing-link]");if(h){let b=h.dataset.docxDrawingLink;return b?{linkId:b,drawing:true}:null}return null}let d=p=>{s=null;let m=p.target,h=l(m);if(!h)return;let y=m.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();s={linkId:h.linkId,drawing:h.drawing,rect:{left:y.left,top:y.top,bottom:y.bottom,right:y.right}};},c=p=>{let m=p.target,h=l(m);if(!h){let g=s;if(s=null,!g)return;p.preventDefault(),u(g.linkId,g.rect,p,g.drawing);return}s=null,p.preventDefault();let y=m.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();u(h.linkId,{left:y.left,top:y.top,bottom:y.bottom,right:y.right},p,h.drawing);};function u(p,m,h,b){let y=b?e.drawingLinkById?.(p)??null:e.linkById(p);if(!y)return;if(h.metaKey||h.ctrlKey){y.kind==="external"?o(y.href):y.anchor&&a(y.anchor);return}if(e.isCollapsedSelection()){if(y.kind==="internal"){y.anchor&&a(y.anchor);return}e.onPopover?.({link:y,rect:m});}}return t.addEventListener("pointerdown",d,true),t.addEventListener("click",c),{goToPosition:i,goToBookmark:a,openExternal:o,destroy(){t.removeEventListener("pointerdown",d,true),t.removeEventListener("click",c);}}}function I8(e){let t=e.hyperlinkHref;if(!t)return null;let n=e.kind==="anchoredDrawing"?e.anchorParagraphId:e.paragraphId,r=e.kind==="inlineDrawing"?e.start:0,o=t.startsWith("#")?"internal":"external";return Object.freeze({id:e.drawingNodeId,paragraphId:n,start:r,end:r+1,text:"",kind:o,href:t,authored:t,...o==="internal"?{anchor:t.slice(1)}:{}})}function Dg(e,t){return e.drawingNodeId!==t?null:I8(e)}function qC(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=Dg(n,t);if(r)return r}return null}function k8(e,t){for(let r of e.anchoredDrawings??[]){let o=Dg(r,t);if(o)return o}for(let r of e.fragments){if(r.kind==="table"){for(let i of r.rows)for(let a of i.cells)for(let s of a.blocks){let l=KC(s,t);if(l)return l}continue}let o=VC(r,t);if(o)return o}let n=qC(e.header,t);return n||qC(e.footer,t)}function VC(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=Dg(r,t);if(o)return o}return null}function KC(e,t){if(e.kind==="table"){for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks){let i=KC(o,t);if(i)return i}return null}return VC(e,t)}function jC(e,t){for(let n of e.pages){let r=k8(n,t);if(r)return r}return null}var Nc=24;function WC(e){let t=null,n=false;return {without(r){let o=n;n=true;try{return r()}finally{n=o;}},follow(r,o){let i=n?"none":o;if(e.storyScopeOpen())return;let a=e.selection();if(!(a.anchor.paragraphId===a.head.paragraphId&&a.anchor.offset===a.head.offset)&&i!=="head")return;let l=e.pagesLayer.ownerDocument.activeElement;if(l!==e.pagesLayer&&(!l||!e.pagesLayer.contains(l)))return;let d=e.preferredPageIndex(),c=e.preferredLineId?.(),u=e.layout(),p=oe(u,a.head,{measurer:e.measurer(),...d!==void 0?{preferredPageIndex:d}:{},...c!==void 0?{preferredLineId:c}:{}});if(!p)return;let m=t!==null&&t!==p.pageIndex;if(t=p.pageIndex,i==="none"||!r&&!m)return;let h=u.pages[p.pageIndex],b=e.scroller();if(!h||!b||b.clientHeight<=0)return;let y=e.scale(),g=h.contentBox.y-h.box.y,x=(h.box.y+g+p.y)*y+e.container.offsetTop,v=x+p.height*y,k=b.scrollTop,P=k+b.clientHeight,T=k;if(x<k+Nc)T=x-Nc;else if(v>P-Nc)T=v+Nc-b.clientHeight;else return;let C=Math.max(0,b.scrollHeight-b.clientHeight),E=Math.max(0,Math.min(T,C));Math.abs(E-b.scrollTop)<.5||(b.scrollTop=E,e.scheduleRematerialize());}}}function ZC(e,t){let n=[],r=a=>{for(let s of a){if(s.kind==="paragraph"){n.push({id:s.id,length:jg$1(s).length});continue}if(s.kind==="textValue")continue;if(s.kind==="contentControl"){r(t.contentChildrenOf(s));continue}r(s.children);}};if(r(t.contentChildrenOf(e)),n.length>0){let a=n[0],s=n[n.length-1];return {anchor:{paragraphId:a.id,offset:0},head:{paragraphId:s.id,offset:s.length}}}let o=null,i=a=>{for(let s of a){if(s.kind==="paragraph"){let l=jg$1(s).spanOf(e);if(!l)continue;return o={anchor:{paragraphId:s.id,offset:l.start},head:{paragraphId:s.id,offset:l.end}},true}if(s.kind!=="textValue"&&i(s.children))return true}return false};return i(t.searchRoots()),o}function UC(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlContent"||t.localName==="sdtContent"))return t.children;return []}function zC(e){return {applyHeaderFooterLifecycle(t){let n=null;return e.commit(()=>{let r=e.applyOps([t]);return r.rejected&&(n=String(r.reason??"rejected")),r}),n?{ok:false,reason:n}:{ok:true}},insertPageField(t){if(!e.isHeaderFooterOpen())return false;let n=e.deleteSelectionPlan(),r=n.replaceAt??n.collapseTo;return e.commit(()=>e.applyOps([...n.ops,{op:"insertPageField",paragraphId:r.paragraphId,offset:r.offset,field:t}],e.selectionMark()),()=>e.collapsedAt({paragraphId:r.paragraphId,offset:r.offset+(t==="PAGE_X_OF_Y"?6:1)})),e.lastRejection()===null}}}var Us="the document is open for viewing",Hg="image changes are not supported in suggesting mode",GC="tracked changes need a non-empty author";function XC(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Us}}function n(){return {committed:false,rejected:true,opCount:0,reason:Hg}}return {applyDrawingOps(r){if(e.editingMode()==="view")return t();if(e.editingMode()==="suggest")return n();let o=e.selectionMark(),i={committed:false,rejected:true,opCount:0};return e.commit(()=>(i=e.applyOps(r,o,o),i)),i},applyImageProperties(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Us};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Hg};let o={ok:false,reason:"invalidArgs"};return e.commit(()=>(o=e.session.applyImageProperties(e.storyScope(),r),{committed:o.ok,rejected:!o.ok,opCount:o.ok?1:0,...o.ok?{}:{reason:o.detail??o.reason}})),o},deleteImage(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Us};let o=e.editingMode()==="suggest",i=e.author();if(o&&(i===void 0||i===""))return {ok:false,reason:"invalidArgs",detail:GC};let a={ok:false,reason:"invalidArgs"};return e.commit(()=>(a=o?e.session.deleteImageTracked(e.storyScope(),r,{author:i,date:e.trackedDate()}):e.session.deleteImage(e.storyScope(),r),{committed:a.ok,rejected:!a.ok,opCount:a.ok?1:0,...a.ok?{}:{reason:a.detail??a.reason}})),a},insertImage(r){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Us});let o=e.editingMode()==="suggest",i=e.author();if(o&&(i===void 0||i===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:GC});let a=e.actorId();return e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort(),...o?{revision:{author:i,date:e.trackedDate()}}:{},...a?{actorId:a}:{}})},replaceImage(r,o,i,a){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Us});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Hg});let s=e.actorId();return e.session.replaceImage(e.storyScope(),r,o,i,e.decodePort(),{...a,commitGuard:()=>e.editingMode()==="edit"&&a.commitGuard?.()!==false,...s?{actorId:s}:{}})}}}function YC(e){let t=null,n=null,r="",o=()=>{let d=e.session.part(),c=e.revisionDisplayMode(),u=e.revisionAuthorFilter();return {sections:Oc$1(d,c,u),sourceIndexes:Pc$1(d,c,u)}},i=d=>{let{sourceIndexes:c}=o(),u=c.indexOf(d);if(u!==-1)return u;let p=c.findIndex(m=>m>d);return p===-1?Math.max(0,c.length-1):p},a=()=>{if(!t)return;let d=fw(e.layout(),t,e.materializedPages?.());d!==t.pageIndex&&(t={...t,pageIndex:d,sectionIndex:e.sectionAtPage(d).sectionIndex});},s=d=>{if(e.entryRefused?.()===true&&t?.scope.rId!==d.rId||!d.rId||e.session.partFor({kind:"headerFooter",rId:d.rId})===null)return false;t?.scope.rId!==d.rId&&e.leaveOtherStories?.();let c=e.layout(),u=dw(c,d.rId),p=t,m=p?.scope.rId===d.rId,h=u?null:R8(e.session,d.rId);if(!u&&!h)return false;let b=d.pageIndex??(m&&p?p.pageIndex:u?.pageIndex??0),y=d.kind??(m&&p?p.kind:u?.kind??h.kind),g=d.variant??(m&&p?p.variant:u?.story.variant??h.variant),x=m&&p?p.partName:u?.story.partName??h.partName,v=c.pages[b]??c.pages[u?.pageIndex??0],k=(v?Bi(v,{scope:{kind:"headerFooter",rId:d.rId},kind:y,partName:x}):null)??u?.story??{scope:{rId:d.rId},variant:g,partName:x},P=e.selection(),T=p?p.savedBodySelection:{anchor:{...P.anchor},head:{...P.head}},C=m&&p?.sectionIndex!==void 0&&b===p.pageIndex,E=d.sectionIndex??(C?p.sectionIndex:u?e.sectionAtPage(b).sectionIndex:h?i(h.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:d.rId},pageIndex:b,...E!==void 0?{sectionIndex:E}:{},kind:y,variant:k.variant,partName:k.partName,savedBodySelection:T};let I=e.session.paragraphIdsIn(Id(t))[0];if(!I)return t=null,false;let L=d.position?Pd(c,{anchor:d.position,head:d.position},t):m?Pd(c,P,t):{anchor:{paragraphId:I,offset:0},head:{paragraphId:I,offset:0}};return e.setScopeSelection(L),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;let d=t.savedBodySelection;t=null,e.setScopeSelection(Pd(e.layout(),d,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>lw(t),setActiveScope(d){return d.kind==="body"?(l(),true):d.kind==="headerFooter"?s({rId:d.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:a,headerFooterState(){if(!t)return null;let d=e.session.headerFooterResolutionBySection(),c=t.sectionIndex??0,u=o(),p,m,h,b=v=>{let k=u.sourceIndexes[v]??v,P=d[k];if(!P)return false;let C=(t.kind==="header"?P.headers:P.footers).get(t.variant);return !C||C.rId!==t.scope.rId?false:(c=v,p=C.inherited,m=P.titlePage,h=P.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&b(t.sectionIndex))){let v;d.forEach((k,P)=>{let C=(t.kind==="header"?k.headers:k.footers).get(t.variant);!C||C.rId!==t.scope.rId||!(v===void 0||v&&!C.inherited||v===C.inherited&&i(P)<c)||(c=i(P),p=C.inherited,m=k.titlePage,h=k.evenAndOddHeaders,v=C.inherited);});}let y=u.sections[c]?.properties??u.sections.at(-1)?.properties,g=y?.margins.headerTwips,x=y?.margins.footerTwips;return {editing:t.kind,sectionIndex:c,variant:t.variant,rId:t.scope.rId,partName:t.partName,...p!==void 0?{inherited:p}:{},...m!==void 0?{titlePage:m}:{},...h!==void 0?{evenAndOddHeaders:h}:{},...g!==void 0?{headerDistanceTwips:g}:{},...x!==void 0?{footerDistanceTwips:x}:{}}},headerFooterStateStable(d){if(!t)return n=null,r="",null;let c=this.headerFooterState();if(!c)return null;let u=[d,c.editing,c.sectionIndex,c.variant??"",c.rId??"",c.partName??"",String(c.inherited),String(c.titlePage),String(c.evenAndOddHeaders),String(c.headerDistanceTwips??""),String(c.footerDistanceTwips??"")].join("|");return n&&r===u||(n=Object.freeze({...c}),r=u),n}}}function QC(e){return e.length>0&&e.every(t=>t.op==="setDocumentProtection")}function R8(e,t){let n=e.headerFooterResolutionBySection();for(let r=0;r<n.length;r+=1){let o=n[r];for(let i of ["header","footer"]){let a=i==="header"?o.headers:o.footers;for(let[s,l]of a)if(l.rId===t)return {sectionIndex:r,kind:i,variant:s,partName:l.partName}}}return null}function JC(e,t,n){let{sectionIndex:r,sectionStart:o}=e.sectionAtPage(n),i=p=>p[Math.min(r,Math.max(0,p.length-1))],a=p=>{let m=i(p);return t==="header"?m?.headers:m?.footers},s=e.session.headerFooterResolutionBySection(),l=i(s),d=e.layout.pages[n]?.pageFieldSource?.pageNumber??n+1,c=l?.evenAndOddHeaders&&d%2===0?"even":l?.titlePage&&n===o?"first":"default",u=a(s)?.get(c)?.rId;if(!u){if(!e.create({op:"createHeaderFooter",sectionIndex:r,kind:t,variant:c,...c==="first"?{titlePage:true}:{},...c==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;u=a(e.session.headerFooterResolutionBySection())?.get(c)?.rId,e.flushLayout();}u&&e.enter({rId:u,pageIndex:n,sectionIndex:r,kind:t,variant:c});}var P8=500;function T8(e,t,n,r){let o=e.part(),i=rd(o,n,r),a=Lc$2(o);return t.map((s,l)=>{let d=s.blockStart<s.blockEndExclusive?i[s.blockEndExclusive-1]:void 0,c=d?.kind==="paragraph"?Mc$1(d):void 0;return c||(l===t.length-1&&a?.kind!=="textValue"?a:void 0)})}function eE(e,t){if(!e)return null;let n=e.session,r=Ya(e.revisionDisplayMode()),o=e.state().selection.head.paragraphId,i=js(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:Rt(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),a=n.currentPackage(),s=Tg$1(a),l=Ug$1(s),d=Vg$1(s),c=Oc$1(n.part(),r,t),u=T8(n,c,r,t),p=Rg$1(u[i]),m=Sg$1(u[i]),h=Wg$1(p,l),b=Xg$1(m,d);return {sectionIndex:i,footnote:{resolved:h,...l?{documentAuthored:l}:{},...p?{sectionAuthored:p}:{}},endnote:{resolved:b,...d?{documentAuthored:d}:{},...m?{sectionAuthored:m}:{}}}}function tE(e,t){let n=pc$1(t);if(!n)return null;let r=ch$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,i=Lc$1(o.root,n.noteId);if(!i)return null;let a=[],s=P8,l=(c,u)=>{if(!(u>32||s<=0)){if(c.kind==="paragraph"&&typeof c.id=="string"){let p=(Vi$1(o,c.id)??"").replace(/\uFFFC/g,"").trim();if(p){let m=p.slice(0,s);a.push(m),s-=m.length;}return}if(c.kind!=="textValue")for(let p of c.children)l(p,u+1);}};l(i,0);let d=a.filter(Boolean).join(" ").trim();return d.length>0?d:null}function nE(e){return [()=>{zb$1(e().root);},()=>{mj(e());},()=>{$j(e());}]}var C8=50,E8=16;function rE(e){let t=e.schedule??((s,l)=>{let d=setTimeout(s,l);return ()=>clearTimeout(d)}),n=false,r=null,o=0,i=0,a=s=>{r=t(()=>{if(r=null,!(n||i>=e.steps.length||!e.shouldRun())){if(e.hasPendingInput()){if(o+=1,o>C8)return;a(E8);return}try{e.steps[i]();}catch{return}i+=1,i<e.steps.length&&a(0);}},s);};return a(0),()=>{n=true,r&&r(),r=null;}}var $r=null;function zs(e,t,n){let r=$r;$r=t===void 0?null:{owner:e,group:t};try{return n()}finally{$r=r;}}function _g(e){if($r===null||$r.owner!==e)return;let{group:t}=$r;return $r=null,t}function O8(e,t){$r===null&&($r={owner:e,group:t});}var Dc=class{current;get value(){return this.current}around(t,n,r,o=true){let i=this.current,a=_g(t);this.current=a??(o?Symbol("command"):void 0);let s;try{s=n();}finally{this.current=i;}return a!==void 0&&!r(s)&&O8(t,a),s}};function oE(e,t){let n=t.indexOf("#"),r=n>0?t.slice(0,n):e.mainDocumentPart,o=e.parts.get(r);return o?Ta(o,t):null}function iE(e){let{anchor:t,head:n}=e;return t.paragraphId!==n.paragraphId||t.offset!==n.offset?null:`${n.paragraphId}\0${n.offset}`}var M8=1e3,A8=2e3,Hc=class{constructor(t,n=()=>performance.now()){this.currentPackage=t;this.now=n;}currentPackage;now;group;expected=null;startedAt=0;lastTypedAt=0;paragraphId=null;landedNode=null;groupAt(t){let n=this.now();return (this.group===void 0||iE(t)!==this.expected||n-this.lastTypedAt>=M8||n-this.startedAt>=A8||n<this.lastTypedAt)&&(this.group=Symbol("typing"),this.startedAt=n),this.lastTypedAt=n,this.group}landed(t){this.expected=iE(t),this.paragraphId=this.expected===null?null:t.head.paragraphId;let n=this.paragraphId;this.landedNode=n===null?null:oE(this.currentPackage(),n),this.expected===null&&(this.group=void 0);}noteForeignChange(t){let n=this.paragraphId;if(n===null||t.origin===g.projection||t.origin===g.awareness)return;if(t.dirty.includes(n)||t.deleted.includes(n))return this.end();if(t.dirty.length>0||t.deleted.length>0)return;let r=this.landedNode,o=oE(this.currentPackage(),n);r!==o&&(r===null||o===null||!Da(r,o))&&this.end();}end(){this.group=void 0,this.expected=null,this.paragraphId=null,this.landedNode=null;}};function Bg(e){return e.bound?"bound":e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function aE(e){return e.effectiveLock==="sdtLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function sE(e,t){for(let n of e.children)if(n.kind!=="textValue"&&!(n.kind!=="contentControlProperties"&&n.localName!=="sdtPr")){if(n.children.some(r=>r.kind!=="textValue"&&r.localName==="dataBinding")&&t==="edit")return "bound";for(let r of n.children){if(r.kind==="textValue"||r.localName!=="lock")continue;let o=r.attributes.find(i=>i.localName==="val")?.value;if(t==="remove"){if(o==="sdtLocked"||o==="sdtContentLocked")return "locked"}else if(o==="contentLocked"||o==="sdtContentLocked")return "locked"}}return null}function ia(e,t,n=true){let r=e.createElement("div");return r.className=t,r.contentEditable="false",n&&r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r}function lE(e,t,n){for(let r of e)r.style.width=t,r.style.height=n;}var dE=64;function $g(e,t,n={}){let r=n,o$1=gc(n),i=r.openedSession??j$1(t,{...n.reviewModel?{reviewModel:n.reviewModel}:{},...n.contentLockPolicy?{contentLockPolicy:n.contentLockPolicy}:{}});if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{},..."limit"in i&&i.limit?{limit:i.limit}:{}};let a=cP(i.session,o$1),s=IR(a),l=s.index,d=n.collaborationModel?.session,c=n.author,u=n.scale??96/72,p={resolve:n.tableInteractionLabel??(f=>gm(f))},m="the document is open for viewing",h="the table of contents is generated and read-only",b=false,y="\0range\0",g$2=()=>`${new Date().toISOString().slice(0,19)}Z`,x=n.measurer?null:S(u,{context:Yi(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),v=n.measurer??x.measurer,k=He(),P=Hf();function T(){return n.measurer?n.producer??"host-measurer":`${n.producer??x?.producer??"fixed-measurer"}@scale:${u}`}let C=T(),E=e.ownerDocument,w=n.lockedControlNavigation==="atomic",I=E.createElement("div");I.className="docx-pages",I.style.position="relative",o$1.listeners(I),I.contentEditable="true",I.spellcheck=false,I.setAttribute("role","textbox"),I.setAttribute("aria-multiline","true"),Mm(I,n.translate),I.style.outline="none";let L=ia(E,"docx-selection-overlay"),A=ia(E,"docx-comment-overlay"),B=ia(E,"docx-text-highlight-overlay"),$=null,j=ia(E,"docx-remote-selection-overlay"),R=ia(E,"docx-table-furniture",false);e.style.position="relative",e.replaceChildren(I,R,A,B,j,L);let G=WT(I,()=>u,()=>{let f=Me?.getActive()??null,S=Te?.activeNoteScope()??null,O=Te?.activeNotePageIndex()??null,D=f?cw(I,f.pageIndex):S?uw(I,S.id,O):null;return {layout:Ee(),selection:Vt.shownSelection(K),...ze.caretPreference(f?.pageIndex??O??void 0),measurer:v,...pt()?{typingStyle:()=>{let V=te.formatting();return V.fontSizeHalfPoints?{fontSizePt:V.fontSizeHalfPoints/2,fontFamily:V.fontFamily,bold:V.bold,italic:V.italic,verticalAlign:V.superscript?"superscript":V.subscript?"subscript":"baseline"}:null}}:{},scopedHost:D,...f?{scopedHostKind:"headerFooter"}:S?{scopedHostKind:"note"}:{},...Ke?.caretInput(xe$1)}}),X=Od(a.part()),ie$1=a.paragraphIds(),pe$1=ie$1.find(f=>!X.has(f))??ie$1[0]??"",K=r.initialSelection??{anchor:{paragraphId:pe$1,offset:0},head:{paragraphId:pe$1,offset:0}},z=r.initialDrawingSelectionIntent??{kind:"none"};function H(f,S){f.kind===z.kind&&(f.kind!=="pointer"||z.kind==="pointer"&&f.drawingNodeId===z.drawingNodeId)||(z=f,S&&n.onChange?.(ut()));}let Z=null,F=null;function _(f){return F=W(f),n.onChange?.(ut()),false}function W(f,S=f){return n.onRejection?.(S),f}let N=()=>n.onEdit?.(ln),q=new Dc,U=new Hc(()=>a.currentPackage()),ne="suggesting needs an author before it can propose a change",re$1=false,ee=false,oe$1=null,ge=new Map;function Ie(){oe$1=null;for(let f of ge.values())oe$1=f;}function _e(f,S){if(f.paragraphId===S.paragraphId)return f.offset-S.offset;let O=ke();return O.indexOf(f.paragraphId)-O.indexOf(S.paragraphId)}function Mt(f){if(!oe$1)return;let{from:S,to:O}=zd(Ee(),oe$1),D=f.head;_e(D,S)>=0&&_e(D,O)<=0||(ge.clear(),oe$1=null);}let Ne$1=null,Ce=new Gd(d??a),Ve=new Zd(d??a,()=>K,()=>Fe(a,K.head.paragraphId)??a.part(),()=>a.packageRevision());function Ye(f){let S=null;d&&gt.expectHistory(true);let O;try{O=Ve.step(f,()=>{if(d)return d[f]();let V=a.packageRevision();return S=a[f](),a.packageRevision()!==V});}finally{d&&gt.expectHistory(false);}if(!O.changed)return;N();let D=f==="undo"?AT(d,dl):null;ZA(D??O.selection??S);}function $t(f){ze.noteModelMoved(),Ft();let S=Ck(f,Ee(),ke());ht(S.selection),Ne$1=S.format,G.update(),n.onChange?.(ut());}function Je(){return pt()?.properties??null}function pt(){return Rm(Ne$1,K)}function we(f){if(!Ne$1)return;let S=Ne$1.position;f.anchor.paragraphId===S.paragraphId&&f.anchor.offset===S.offset&&f.head.paragraphId===S.paragraphId&&f.head.offset===S.offset||(Ne$1=null);}function Ue(f,S,O,D,V){let Y=nt([...f],O,D,me(),true,V);return f.length===S.length||!Y.rejected?Y:nt([...S],O,D,me(),true,V)}function mt(f,S,O,D){let V=Ke?.replacementFormatOps(f,S,O);if(V?.length)return V;let Y=pt()??(Lt(K.head.paragraphId).length===0?{base:[],properties:zi(Fe(a,K.head.paragraphId)??a.part(),K.head.paragraphId,K.head.offset,qt(),It())}:null);if(!Y||O===0||Y.properties.length===0&&Y.base.length===0)return [];let J=Ne$1?.position??K.head,le=D&&J.paragraphId===f&&J.offset>=D.start&&J.offset<=D.end?{paragraphId:f,offset:Cu({paragraphId:f,offset:D.start},{paragraphId:f,offset:D.end})}:xd$1(Ee(),J);return le.paragraphId!==f||le.offset!==S?[]:[{op:"setRunProperties",paragraphId:f,start:S,end:S+O,properties:Mh$1(Y.base,Y.properties,pa(f,S))}]}let Me=null,Te=null,Ke=null,Ee=()=>Ke?.layout(xe$1)??xe$1,hr=()=>Ke?.active()?Ke.paragraphIds():a.paragraphIdsIn(me()),Yn=null,me=()=>Id(Me?.getActive()??null,Te?.activeNoteScope()??null),rn=()=>Te?.activeNoteScope()?.id??null,Qn=f=>{let S=P.multi?.spans,O=0,D=0;if(S&&S.length>0)for(let V=0;V<S.length;V+=1){let Y=S[V];if(O=V,D=Y.startIndex,f<Y.startIndex+Y.pageCount)break}return {sectionIndex:O,sectionStart:D}},nl=(f,S)=>{if(Ke?.active()){let J=Ke.paragraphIds();return J.includes(f)?f:J[J.indexOf(S)+1]??null}let O=Fe(a,f)??Fe(a,S)??a.part();if(Ta(O,f))return f;let D=Ua$1(O,S),V=D?D.children.findIndex(J=>J.id===S):-1,Y=D&&V>=0?D.children[V+1]:void 0;return Y?.kind==="paragraph"?Y.id:null},ke=()=>$i(Ee(),Me?.getActive()??null,rn()),gt=MT({textOf:f=>Lt(f),order:ke,carried:()=>FT(d)}),en=()=>globalThis.performance?.now()??Date.now(),hn=0,yr=0,on=0,Vr=f=>{uk(f)&&n.onTiming?.("input",f.timeStamp);},{styleCascade:jt,numberingIndex:Kr,defaultTabStopPt:rl,compatibilityMode:ho}=NT(a),ol=LT({styleCascade:jt,partOf:f=>Fe(a,f)??a.part()}),il=null,ca=n.imageDecodePort??VT(E)??KT(),tn=Ne({session:a,decodePort:ca,onResourcesChanged:()=>il?.()}),yo=n.drawingStrings??k$1,On=f$1(n.translate),al=n.tocLabels,ua=()=>K.anchor.paragraphId!==K.head.paragraphId||K.anchor.offset!==K.head.offset?null:{paragraphId:K.head.paragraphId,offset:K.head.offset},sl=pR(a),bo=jT({mintValidatedBytes:(f,S)=>tn.mintValidatedBytes(f,S)}),yn=false,Jn=fC(n.revisionDisplayMode,!!n.reviewModel,f=>Ae.setRevisionDisplayMode(f)),fa=Jn.view,qt=Jn.projection,ll=Jn.changeBars,Mn=r.revisionAuthorVisibility??mc(n.hiddenRevisionAuthors),Vt=gk({layout:Ee,part:()=>a.partFor(me())??a.part(),view:Jh}),fi=Ek(n.revisionMarkup,()=>Jn.filter(Mn.filterForSession(a)),()=>tt(),()=>{kt=an(It()),it.invalidateAll(a.packageRevision(),"revision-markup"),it.flush(),vt(false);}),It=fi.filter,pa=Zk(a,qt,It),pi=f=>{let S=Fe(a,f)??a.part();return Mk(S,f,qt(),It())},kt,vo=af(a),xo=bf(),an=(f,S=yn)=>DT({session:a,measurer:v,producer:C,cache:k,styleCascade:jt,numberingIndex:Kr,defaultTabStopPt:rl,compatibilityMode:ho,displayMode:qt(),showFieldCodes:S,revisionAuthorFilter:f,inlineDrawingLayoutForPart:O=>tn.contextForPart(O),drawingLayoutTokenForPart:O=>tn.cacheTokenForPart(O),drawingTokenForParagraphForPart:(O,D)=>tn.drawingTokenForParagraph(D,O),linkProjectors:vo,projectFieldLink:O=>xo.project(O)});kt=an(It());let An={...a,applyTreeOps:(f,S,O,D)=>nt(f,S,O,D),ensureListDefinition:f=>Hb(d?.identity.actorId,()=>a.ensureListDefinition(f)),applyPmDoc:f=>De==="view"?{committed:false,rejected:true,opCount:0,reason:m}:d?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:Iu()?{committed:false,rejected:true,opCount:0,reason:h}:a.applyPmDoc(f)},ma=()=>{},jr=wR({now:en,pageAfterView:()=>{let f=iu();return f&&f.size>0?Math.max(...f)+1:void 0},current:()=>xe$1,revision:()=>a.packageRevision(),publish:f=>o$1.wrap(()=>mi(f))(),snapshot:()=>{let f={...P};return ()=>{Object.assign(P,f);}},pendingChanged:f=>e.toggleAttribute("data-docx-layout-pending",f),passTimed:f=>n.onTiming?.("layout",f)}),er=r.progressiveOpen?dE:null,xe$1=Wt(),tr=n.revisionStyles,br=LR(n.showParagraphMarks??false,tt,()=>vt(false)),sn=r.reviewAuthorSlots??e$1(),M=pP({layout:Ee,items:()=>a.reviewItems(),styles:()=>tr,slots:sn});function Q(f){bt(),d?.flushPendingJournals();let S={selection:K,format:Ne$1},O=JSON.stringify(te.formatting()),D=Tk(K,Ne$1,f,()=>zi(a.partFor(me())??a.part(),K.head.paragraphId,K.head.offset,qt(),It()));D!==void 0&&(Ne$1=D,O!==JSON.stringify(te.formatting())&&Ce.record(S,{selection:K,format:Ne$1},_g(Ae)),U.end(),G.update(),n.onChange?.(ut()));}let te=JT({runFormatRefusal:()=>Wn({type:"toggleMark"},Ae)?.reason??null,session:An,applyOutsideToc:(f,S)=>{let O=f.filter(D=>!uy(D));if(O.length===0)return S(f);b=true;try{return S(O)}finally{b=false;}},storyScope:me,paragraphOrder:ke,layout:Ee,selection:()=>Vt.shownSelection(K),displayMode:()=>qt(),authorFilter:It,paragraphMarkVisible:pi,commit:(f,S,O)=>$e(f,S,O),orderedRange:()=>Vt.shownRange(Gr()),selectionMark:()=>Qe(),textOf:f=>Lt(f),selectedCells:()=>Z?.cellIds,defaultParagraphStyleId:()=>jt()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n.defaultFontFamily??null,pendingFormats:()=>Je(),setPendingFormats:Q}),ve$1=tC({session:An,storyScope:me,layout:Ee,selection:()=>Vt.shownSelection(K),displayMode:()=>qt(),authorFilter:It,paragraphMarkVisible:pi,commit:(f,S,O)=>$e(f,S,O),orderedRange:()=>Vt.shownRange(Gr()),selectionMark:()=>Qe(),textOf:f=>Lt(f),paragraphOrder:ke,selectedCells:()=>Z?.cellIds,armPendingFormats:f=>Q(f),now:en,publish:()=>{ve$1.state().mode!=="off"?I.dataset.formatPainter="":delete I.dataset.formatPainter,n.onChange?.(ut());}}),be=MC({session:An,storyScope:me,headerFooterSectionIndex:()=>Me?.getActive()?.sectionIndex,revisionDisplayMode:qt,revisionAuthorFilter:It,paragraphOrder:ke,selectedCells:()=>Z?.cellIds,editingMode:()=>De,publishRefusal:_,caretParagraphId:()=>K.anchor.paragraphId===K.head.paragraphId&&K.anchor.offset===K.head.offset?K.head.paragraphId:null,layout:Ee,commit:(f,S,O)=>$e(f,S,{rearmPending:pt()??void 0,...O?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Tu(),orderedRange:()=>Gr(),selectionMark:()=>Qe(),collapsedAt:f=>We(f),deleteSelectionPlan:()=>kr(),paragraphTextOf:f=>Lt(f),numberingLevelExists:(f,S)=>mc$1(wc$1(Kr(),jt()),f,S)!==null});function Le(f,S,O){return De!=="suggest"?null:Cu({paragraphId:f,offset:S},{paragraphId:f,offset:O})}let Be=BC({session:An,layout:Ee,fieldLinkById:f=>xo.linkById(f),refusesWrite:()=>Ur(true)!==null,withMintActor:f=>Hb(d?.identity.actorId,f),storyScope:me,replacementLanding:Le,insertionLanding:(f,S)=>xd$1(Ee(),{paragraphId:f,offset:S}).offset,selection:()=>K,orderedRange:()=>Gr(),selectionMark:()=>Qe(),textOf:f=>Lt(f),commit:(f,S)=>$e(f,S)}),se=YP({session:An,storyScope:me,editingMode:()=>De,writeRefusal:f=>Ur(true,[f]),selection:()=>K,selectionMark:()=>Qe(),commit:(f,S)=>$e(f,S)}),Oe=f=>{let S=Rt(a,f,{kind:"body"});if(S.kind==="body")return Te?.exitNote(),Me?.exitHeaderFooter(),true;if(S.kind==="headerFooter"){let D=Me?.activeScope();return D?.kind==="headerFooter"&&D.rId===S.rId?true:(Te?.exitNote(),Me?.enterHeaderFooter({rId:S.rId})??false)}let O=He$1(f);return O?Te?.activeNoteScope()?.id===O?true:(Me?.exitHeaderFooter(),Te?.enterNote(O)??false):false},He$1=f=>{for(let S of xe$1.pages)for(let O of [S.footnotes,S.endnotes])if(O){for(let D of O.notes)for(let V of ya(D.fragments))if(V.paragraphId===f)return D.scopeId}return null},Ge=$C({pagesLayer:I,container:e,scale:()=>u,layout:Ee,bookmarks:()=>a.bookmarks(),linkById:f=>xo.linkById(f)??Be.linkById(f),drawingLinkById:f=>jC(xe$1,f),setSelection:f=>ht(We(f)),enterStoryFor:f=>Oe(f),isCollapsedSelection:()=>De==="view"||Ot(K,We(K.head)),onScrolled:()=>fl(),...n.onHyperlinkPopover?{onPopover:n.onHyperlinkPopover}:{}}),Fn=XP({pagesLayer:I,equationById:f=>se.equationById(f),setSelection:f=>ht(f,false,"none"),...n.onEquationPopover?{onPopover:n.onEquationPopover}:{}});I.addEventListener("contextmenu",Wh),I.addEventListener("click",Zh),I.addEventListener("pointermove",Bh),I.addEventListener("pointerleave",qh);let nr=MR(I),At=null;function So(f,S,O,D){return ma(),jr.finish(),gf(vr(f,S,O,D))}function*vr(f,S,O,D){let V=O?O.authorFilter:It(),Y=O?.layoutSession??P,J=O?.furnitureSource??kt;return S&&uc$1(Y,S),!O&&D===void 0&&(er=null),tn.sync(a),yield*a$3({view:a,revision:f,measurer:v,cache:k,session:Y,producer:C,styleCascade:jt,defaultTabStopPt:rl,numberingIndex:Kr,furniture:J,compatibilityMode:ho,linkProjectors:vo,projectFieldLink:le=>xo.project(le),inlineDrawingLayout:tn.bodyContext,inlineDrawingLayoutForPart:le=>tn.contextForPart(le),drawingTokenForParagraph:le=>tn.drawingTokenForParagraph(le,a.part().name),drawingTokenForParagraphForPart:(le,he)=>tn.drawingTokenForParagraph(he,le),drawingLayoutEpoch:tn.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:le=>tn.cacheTokenForPart(le),displayMode:qt(),showFieldCodes:O?false:yn,fieldResults:o$1.mode,revisionAuthorFilter:V,bodyBlockLimit:D})}function Pt(){return So(a.packageRevision(),void 0,{layoutSession:Hf(),furnitureSource:an(void 0,false)})}function Wt(){let f=en(),S=So(a.packageRevision(),void 0,void 0,er??void 0);return hn=en()-f,S}let Zt=null,wo=0,xr=false,Wr=null,ga=false;function Sr(){if(ga)return;ga=true;let f=a.packageRevision();Wr=rE({steps:nE(()=>a.part()),shouldRun:()=>De!=="view"&&a.editable&&a.packageRevision()===f,hasPendingInput:Io});}function Io(f=true){return eR(e,f)}function et(){if(wo>0){xr=true,Sr();return}if(!Io()){vt(),Sr();return}Zt===null&&(Zt=setTimeout(o$1.wrap(()=>{Zt=null,it.pending()===null&&(vt(),Sr());}),0));}let ct="",Ln=null,ln=false;function bt(){if(ln||(Ln!==null&&(clearTimeout(Ln),Ln=null),ct.length===0))return;let f=ct;ct="",ln=true;try{zs(Ae,U.groupAt(K),()=>Ae.type(f)),U.landed(K);}catch(S){throw ct=f+ct,S}finally{ln=false;}}function ko(f){ct+=f,Ln===null&&(Ln=setTimeout(o$1.wrap(()=>{Ln=null,bt();}),0));}function tu(f,S,O){bt();let D=O?.trim()||c?.trim();if(!D)return _("tracked changes need a non-empty author");if(f!=="deletion"&&S.length===0)return _(`${f} requires non-empty text`);if(f!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(S))return _(`${f} requires text without a paragraph mark`);let V={author:D,date:g$2()},Y=Gr(),J=Y.from.paragraphId===Y.to.paragraphId&&Y.from.offset===Y.to.offset;if(f!=="insertion"&&J&&!(f==="replacement"&&Z))return _(`${f} needs a non-collapsed selection`);let le=f==="insertion"?{ops:[],collapseTo:xd$1(Ee(),Y.from)}:kr(D),he=Qh(le.ops,V,Yh()),Re=le.collapseTo;if(f==="insertion"||f==="replacement"){let ue=f==="replacement"?le.replaceAt??le.collapseTo:le.collapseTo;he.push({op:"insertText",paragraphId:ue.paragraphId,offset:ue.offset,text:S,revision:V}),Re={paragraphId:ue.paragraphId,offset:ue.offset+S.length};}let Se=false;return $e(()=>{let ue=nt(he,Qe(),Ir(Re));return Se=ue.committed,ue},()=>We(Re)),Se}let it=da$1({run:f=>{let S=en();ma(),jr.abandon();let O=vr(f.revision,f),D=jr.run(O,f.revision,fk(f));return hn=en()-S,D},currentRevision:()=>a.packageRevision(),schedule:f=>{let S=setTimeout(o$1.wrap(f),0);return ()=>clearTimeout(S)},publish:f=>mi(f)});function mi(f){M.releaseLayout(),xe$1=f;let S=gt.map(K);S!==K&&(K=S,Ro()),et();}let nu=false;il=()=>{it.invalidateAll(a.packageRevision(),"drawing-resources"),!nu&&(nu=true,setTimeout(o$1.wrap(()=>{nu=false,Ft();}),0));};let pA=a.subscribe(f=>{s.retain(f),f.origin!==g.mutationRemote&&f.origin!==g.mutationUndo&&f.origin!==g.mutationRedo&&Ce.noteEdit(),Ne$1=null,ln||U.noteForeignChange(f),f.origin===g.mutationRemote?gt.note(K,f.dirty,xe$1.revision===f.fromRevision):gt.noteLocal(),it.notify(f);}),dl=d?a.collaborationPort(d.documentId):null,Fh=()=>{},Lh=()=>{},ru=false,ou=null,Nh=null,mA=d?d.subscribeRemoteSelections(()=>{ru&&hl();}):()=>{};function iu(){let f=BT(e,xe$1,K,u),S=Me?.getActive()?.pageIndex??ze.selectionPageIndex();return S===void 0||f===void 0||f.has(S)?f:new Set([...f,S])}function Dh(){xr&&vt();}function Ft(){return it.pending()?it.flush():false}let gA=8;function hA(f){!f&&it.pending()!==null&&hn>gA&&Io(false)||(!Ft()||f&&xr)&&vt();}function tt(){bt(),Ft();}function au(){bt();let f=Ft();return Zt!==null||xr?(vt(),Sr(),true):f}let ha=null;function Hh(f){return Mw(f,a.part())}function yA(){for(let f of I.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(f.getAttribute("data-docx-content-control")===ha){f.dataset.hover="",f.dataset.boundaryVisible="";continue}delete f.dataset.hover,re$1||delete f.dataset.boundaryVisible;}}function _h(f){ha!==f&&(ha=f,yA());}function su(f){return Aw(a.part(),$h(f),f.target)}function Bh(f){let S=su(f);_h(S?Hh(S):null);}function $h(f){let S=f.target,O=S?.isConnected?S.closest("[data-paragraph-id]"):void 0;if(O)return O.dataset.paragraphId;let D=I.ownerDocument;return typeof D.elementFromPoint!="function"?void 0:D.elementFromPoint(f.clientX,f.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function qh(){_h(null);}function bA(){let f=Zr(),S=mb(a.part()),O=Rf(a.part()),D=O.map(ue=>{let yt=gR(ue,xe$1,a.part(),v);return yt?{...yt,empty:S.has(ue.beginParagraphId)}:null}).filter(ue=>ue!==null),V=new Set(D.map(ue=>ue.boundary.id)),Y=new Set(D.filter(ue=>ue.empty).map(ue=>ue.boundary.id));for(let ue of O)ue.contentControlId&&Hh(ue)!==ue.contentControlId&&Y.add(ue.contentControlId);let J=f&&!V.has(f.id)?new Set([f.id]):void 0,le=ha?new Set([ha]):void 0,he=new Set(pe(xe$1).filter(ue=>ue.controlType==="checkbox"&&du(ue.id)).map(ue=>ue.id)),Re=D.filter(ue=>ue.additional&&!ue.empty).map(ue=>ue.boundary),Se=Xh()!==null;if(!(!re$1&&!J&&!le&&!Se&&he.size===0&&Re.length===0&&V.size===0))return {...Se?{readOnly:true}:{},...re$1?{showAll:true}:{},...J?{activeIds:J}:{},...le?{hoverIds:le}:{},...he.size>0?{checkedIds:he}:{},...Re.length>0?{additionalBoundaries:Re}:{},...V.size>0?{tocControlIds:V}:{},...Y.size>0?{suppressedIds:Y}:{}}}let ya$1=null;function Zr(){let f=me();if(f.kind!=="body")return SA(f);if(ya$1&&ya$1.layout===xe$1&&ya$1.selection===K)return ya$1.result;let S=vA();return ya$1={layout:xe$1,selection:K,result:S},S}function vA(){let f=AR(xe$1,K,v);return f&&xA(f.id)===a.part().name?f:null}function xA(f){let S=f.indexOf("#");return S===-1?"":f.slice(0,S)}function SA(f){let S=a.partFor(f);return S?ef(S,K.head.paragraphId):null}function rr(f){let S=Fe(a,f),O=Ta(S??a.part(),f);return !O||!Uc$1(O)?null:O}function Vh(f){let S=rr(f);if(!S)return null;for(let O of S.children)if(O.kind!=="textValue"&&(O.kind==="contentControlProperties"||O.localName==="sdtPr"))for(let D of O.children){if(D.kind==="textValue"||D.localName!=="tabIndex")continue;let V=D.attributes.find(J=>J.localName==="val")?.value;if(V===void 0)return null;let Y=Number(V);return Number.isFinite(Y)?Y:null}return null}function wA(){let f=me(),S=f.kind==="body"?null:a.partFor(f),O=f.kind==="notesPart"?new Set(ke()):void 0;return (S?[...df(S,O)]:[...pe(xe$1)]).filter(V=>Bg(V)===null).sort((V,Y)=>{let J=Vh(V.id),le=Vh(Y.id);return J!==null&&le!==null&&J!==le?J-le:J!==null&&le===null?-1:J===null&&le!==null?1:0})}function lu(f){Me?.getActive()||Te?.activeNoteScope()||Rt(a,f.paragraphId,{kind:"body"}).kind==="body"&&Ae.revealPosition(f);}function IA(f){let S=rr(f);if(!S)return false;let O=ZC(S,{contentChildrenOf:UC,searchRoots:()=>(a.partFor(Rt(a,f,me()))??a.part()).root.children});if(!O)return false;let D=K;return ht(O,false,"none"),(K!==D||Ot(K,O))&&lu(K.anchor),true}let Kh=f=>dR(rr(f),()=>a.currentPackage());function du(f){let S=rr(f);if(!S)return false;for(let O of S.children)if(O.kind!=="textValue"&&!(O.kind!=="contentControlProperties"&&O.localName!=="sdtPr")){for(let D of O.children)if(D.kind==="contentControlCheckbox")for(let V of D.children){if(V.kind!=="contentControlChecked")continue;let Y=V.attributes.find(J=>J.localName==="val")?.value;return !(Y==="0"||Y==="false"||Y==="off")}}return false}let jh=f=>cR(rr(f));function cl(f,S){for(let O of I.querySelectorAll("[data-docx-content-control]"))O.getAttribute("data-docx-content-control")===f&&(S?O.dataset.open="":delete O.dataset.open);}let gi=TR({document:E,layer:I,find:rr,layout:Ee,selectDrawing:(f,S)=>Ae.selectDrawing(f,S),allowed:f=>!wr.disabledReason(f,"edit"),translate:f=>Sa?.(f)??f,replaceImage:(f,S,O,D)=>Ae.replaceImage(f,S,O,{expectedPackageRevision:a.packageRevision(),commitGuard:D}),setOpen:cl,reject:_}),cu=lR({find:rr,allowed:f=>!wr.disabledReason(f,"edit"),apply:(f,S)=>wr.setValue(f,S),items:Kh,date:jh,checked:du,picture:gi.drawingOf,replaceImage:gi.replace,locale:()=>ml.get(),layer:I,setOpen:cl,request:n.onRequestContentControlWidget}),ul=null,uu;function fu(f){ul===f&&(ul=null,uu?.(),uu=void 0);let S=f.dataset.docxCcId,O=f.contains(E.activeElement);f.remove(),S&&cl(S,false),O&&I.focus({preventScroll:true});}function pu(){cu.cancel();let f=ul;return f&&fu(f),f}function Wh(f){let S=su(f);kA(S&&Pu(S.id)?S.id:null);}let ba=null;function kA(f){ba!==f&&(ba=f,n.onChange?.(ut()));}function Zh(f){if(f.button!==0||f.target?.closest("a.docx-hyperlink")||De!=="view"&&!Ot(K,We(K.head)))return;let S=$h(f);if(!S)return;let O=Rf(a.part()).find(Y=>Y.resultParagraphIds.includes(S));if(!O||su(f)?.id!==O.id)return;let V=wg$1(a.part(),O,a.documentOutline(),ku(O))[O.resultParagraphIds.indexOf(S)];V&&(f.preventDefault(),Ge.goToPosition({paragraphId:V,offset:0}));}let Uh={document:E,locale:()=>ml.get(),translate:f=>Sa?.(f)??f,setValue:(f,S)=>wr.setValue(f,S),close:f=>fu(f)};function RA(f,S){let O=wr.disabledReason(f,"edit");if(O){F=W(O),n.onChange?.(ut());return}if(gi.cancel(),pu()?.dataset.docxCcId===f||(S==="picture"&&gi.select(f),cu.open(f,S)))return;if(S==="picture")return gi.pick(f);if(S==="checkbox"){wr.setValue(f,du(f)?"false":"true");return}let D=pe(xe$1).find(Y=>Y.id===f)?.alias,V;if(S==="dropdown"||S==="comboBox"||S==="buildingBlockGallery"){let Y=Kh(f);if(Y.length===0&&S==="dropdown")return;V=QR(Uh,f,S,Y,D,Lm(rr(f),Y));}else if(S==="date")V=JR(Uh,f,jh(f),D);else return;ul=V,YR(V,I,iR(xe$1,u,f,I,ft?.pageOffsetX)),cl(f,true),uu=tc(V,()=>fu(V)),S==="date"?pc(V):(V.querySelector("input")??V.querySelector('[role=option][tabindex="0"]')??V.querySelector("button,[data-docx-part=empty]"))?.focus({preventScroll:true});}let wr={setShowAll(f){re$1!==f&&(re$1=f,vt());},setFormFill(f){ee!==f&&(ee=f,n.onChange?.(ut()));},showAll:()=>re$1,formFill:()=>ee,atCaret:()=>Zr(),navigate(f){let S=wA();if(S.length===0)return false;let O=Zr(),D=O?S.findIndex(Y=>Y.id===O.id):-1;f==="next"?D=D<0?0:(D+1)%S.length:D=D<0?S.length-1:(D-1+S.length)%S.length;let V=S[D];return IA(V.id)},setValue(f,S){let O=wr.disabledReason(f,"edit");if(O)return _(O);let D=fR(rr(f),()=>a.currentPackage(),f,S);if(!D)return _("unknown-building-block");let V=false;return $e(()=>{let Y=nt(D,Qe(),void 0,Rt(a,f,me()),false);return V=Y.committed,Y}),V},remove(f){let S=f??Zr()?.id;if(!S)return _("notFound");let O=wr.disabledReason(S,"remove");if(O)return _(O);let D=false;return $e(()=>{let V=nt([{op:"removeContentControl",controlId:S}],Qe(),void 0,Rt(a,S,me()),false);return D=V.committed,V}),D},disabledReason(f,S){let O=Xh();if(O!==null)return O;let D=pe(xe$1).find(Y=>Y.id===f);if(D)return S==="remove"?aE(D):Bg(D);let V=rr(f);return V?sE(V,S):"notFound"}};function mu(){let f=yu&&De!=="view";I.contentEditable=f?"true":"false",I.setAttribute("aria-readonly",f?"false":"true");}function ut(){return {revision:a.packageRevision(),pageCount:xe$1.pages.length,selection:K,cellSelection:Z,canUndo:Ce.canUndo||(d?.canUndo()??a.canUndo()),canRedo:Ce.canRedo||(d?.canRedo()??a.canRedo()),collaborationStatus:d?.status()??"inactive",lastRejection:F,pendingFormat:Je(),contentControls:{showAll:re$1,formFill:ee,activeControlId:Zr()?.id??null},contextTocId:ba,formatPainter:ve$1.state(),perf:{layoutMs:hn,paintMs:yr,selectionMs:on,placed:P.stats.placed,total:P.stats.total,reusedPages:P.stats.reusedPages,fullPasses:P.stats.fullPasses,staleDiscards:it.staleDiscards,cancelledRuns:it.cancelledRuns}}}let Ut,ft,va=false,xa$1=null,gu=null;function PA(f){for(let S of xe$1.pages){let O=I.children.item(S.index);if(O?.dataset.pageIndex!==String(S.index))continue;let D=f.pageOffsetX.get(S.index)??0;O.style.left=`${(S.box.x+D)*u}px`;}}function vt(f=true){Zt!==null&&(clearTimeout(Zt),Zt=null,f=true),xr=false;let S=ze.adoptBeforePaint(),O=en();Ut=iu(),Me?.reconcileOccurrence();let D=Me?.getActive()??null,V=bA(),Y=mb(a.part());q$1(I,xe$1,{scale:u,readOnlyParagraphIds:Od(a.part()),...Y.size>0?{emptyTocPlaceholderIds:Y}:{},...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},materialize:Ut,ariaHidden:false,drawingStrings:yo,breakMarkStrings:On,...n.fieldShading?{fieldShading:n.fieldShading}:{},...tr!==void 0?{revisionStyles:tr}:{},revisionMarkup:fi.current(),facingPages:Ok(Tg$1(a.currentPackage())),shadeFormFields:sl(),showParagraphMarks:br.get(),changeBars:ll(),changeBarsToggle:!!n.reviewModel,...bo?{imageUrlPort:bo}:{},...D?{activeHeaderFooterRId:D.scope.rId,activeHeaderFooterPageIndex:D.pageIndex}:{},...V?{contentControlChrome:V}:{}},M.get().value),Ke?.syncDom(),Gm(I,ua(),{domReplaced:true}),mw(e,I,D!=null),Sp(e,De),ft=Tc(xe$1,Ut),PA(ft),I.style.width=`${ft.width*u}px`,I.style.height=`${ft.height*u}px`,e.style.width=`${ft.width*u}px`,e.style.height=`${ft.height*u}px`,lE([L,A,B,j,R],`${ft.width*u}px`,`${ft.height*u}px`),Ma.update(),yr=en()-O,n.onTiming?.("paint",yr),Ca(),hl(),hi(true),wu(),Ay(),ze.mirrorToDom(),zh(va),va=false,(f||S)&&n.onChange?.(ut());}function fl(){tt();let f=iu(),S=Tc(xe$1,f);ft&&hg(f,Ut)&&$T(S,ft)||vt(false);}let hu=WC({storyScopeOpen:()=>!!(Me?.getActive()||Te?.activeNoteScope()),selection:()=>Vt.shownSelection(K),layout:Ee,measurer:()=>v,preferredPageIndex:()=>ze.selectionPageIndex(),preferredLineId:()=>ze.selectionLineId(),pagesLayer:I,container:e,scroller:()=>Bt(e),scale:()=>u,scheduleRematerialize:()=>Ou()});function zh(f=false,S="caret"){hu.follow(f,S);}let De=n.editingMode??"edit",yu=true,pl=Object.freeze({kind:"body"}),Gh=0,ml=ZR(n.locale,bt),Sa=n.translate,xt=null,gl=null,bu=null;function nt(f,S,O,D=me(),V=true,Y){bt();let J=Ur(f.some(TA)||!!Y?.length,f,V);if(J!==null)return {committed:false,rejected:true,opCount:0,reason:J};let le=EA(V&&xt?xt.annotate(f):f),he=wa(le,S,O,D,Y);return V&&xt?.afterApply(he.committed),he.committed&&le.some(Um)&&r.onTrackedChange?.(),he}function wa(f,S,O,D=me(),V){let Y=d?.gateOperations(f,D);if(Y)return {committed:false,rejected:true,opCount:0,reason:Y};Gh+=1;let J=q.value;return a.applyTreeOps(f,S,O,D,d?{packageEdits:V,origin:g.mutationHuman,actorId:d.identity.actorId,operationId:`${d.identity.actorId}:${d.sessionId}:browser:${Gh}`,recordsHistory:false,historyGroup:J}:{packageEdits:V,historyGroup:J})}function Ur(f,S=[],O=true){if(Un(e))return "An external document refresh is in progress.";let D=QC(S);return De==="view"&&!D?m:yn&&f&&O&&!D&&mR(V=>Fe(a,V),K)?Gi:f&&!D&&(O&&!b&&Iu()||S.some(V=>uy(V)))?h:De==="suggest"&&!c?.trim()&&f?ne:De==="suggest"&&S.some(V=>V.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}let Xh=uI(()=>Ur(true,[],false),()=>a.editable);function TA(f){return f.op!=="acceptRevision"&&f.op!=="rejectRevision"&&f.op!=="acceptAllRevisions"&&f.op!=="rejectAllRevisions"&&f.op!=="setRevisionAttribution"}let CA=f=>Tj.has(f),Yh=()=>fi.current().trackFormatting&&!a.trackingSettings().doNotTrackFormatting;function Qh(f,S,O){return f.flatMap(D=>Zm(D)?!O&&CA(D.op)?[D]:[D.revision!==void 0?D:{...D,revision:S}]:D.op==="splitParagraphMany"?[{...D,revision:S}]:D.op==="splitParagraph"?[D,{op:"setParagraphMarkRevision",paragraphId:D.paragraphId,kind:"ins",revision:S}]:D.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:D.secondId,revision:S}]:[D])}function vu(){let f=c?.trim();return De==="suggest"&&f?f:void 0}function EA(f){let S=vu();return S===void 0?[...f]:Qh(f,{author:S,date:g$2()},Yh())}function Jh(){return {displayMode:qt(),authorFilter:It()}}function ey(f){let S=Vt.removedCaretEdit(K.head,f);return S===null?false:($e(()=>nt(S.ops,Qe(),Ir(S.caret)),()=>We(S.caret)),true)}function Ir(f){return {paragraphId:f.paragraphId,start:f.offset,end:f.offset}}function $e(...f){if(Un(e))return;let S=VR(e);try{OA(...f);}finally{S();}}function OA(f,S,O={}){bt(),ln||U.end();let D=Ve.begin();O?.keepCellSelection||(Z=null),Ne$1=null,ze.noteModelMoved(),wo+=1;let V=false;try{let Y=q.around(Ae,f,le=>typeof le=="boolean"?le:le.committed,!O?.automation),J=typeof Y=="boolean"||!Y.rejected?null:Y;if(V=J!==null,J){let le=String(J.reason??"rejected");F=W(dI(le,a.settingsRoot()),le);}else {F=null,(typeof Y=="boolean"?Y:Y.committed)&&N();let le=S?.();le&&(Pa(),K=le,H({kind:"none"},!1),At=null,va=!0);let he=O?.rearmPending;if(he&&he.properties.length>0){let{anchor:Re,head:Se}=K;Re.paragraphId===Se.paragraphId&&Re.offset===Se.offset&&(Ne$1={properties:he.properties,base:he.base,position:Se});}}D(),Ro();}catch(Y){if((wo-=1)===0&&xr)try{vt();}catch{}throw Y}wo-=1,hA(V);}function MA(){if(!Ut)return true;for(let f of [K.anchor,K.head]){let S=oe(Ee(),f);if(S&&!Ut.has(S.pageIndex))return false}return true}function Ro(){let f=d;if(!f)return;let S=dl?yP(Z?.text??K,D=>{let V=Fe(a,D)??a.part();return bP(V,D)},Z?"cells":void 0):null,O=S?`${S.anchor.paragraphId}:${S.anchor.offset}|${S.head.paragraphId}:${S.head.offset}|${S.kind??""}`:"";O!==Nh&&(Nh=O,f.setLocalSelection(S));}function ht(f,S=false,O="caret",D){let V=!Ot(f,K);Ke?.active()&&(!Ke.contains(f.anchor.paragraphId)||!Ke.contains(f.head.paragraphId))&&Ke.exit(false),V&&ct.length>0&&bt();let Y=xt?.beforeSelect(f);if(Y===null)return;V&&!ln&&(U.end(),Ce.endGroup()),f=Y??f,we(f),Mt(f);let J=Zr()?.id??null,le=wn(a.part(),K.head)?.id;Pa(),K=f,Z=null,S||(At=null),MA()||(ze.noteModelMoved(),O==="none"?hu.without(()=>vt(false)):vt(false)),ze.noteSelectionSettled(),ze.notePointerCaret(D),ze.mirrorToDom(true),zh(true,O),Ca(),Po.clear(),hi();let he=Zr()?.id??null,Re=wn(a.part(),K.head)?.id;(J!==he||le!==Re)&&vt(false),Ro(),n.onChange?.(ut());}let ze=pC({session:a,storyScope:me,document:E,pagesLayer:I,selection:()=>K,setSelection:f=>ht(f),adoptSelection:f=>{let S=xt?.beforeSelect(f);S!==null&&(f=S??f,we(f),Mt(f),Pa(),K=f,At=null,va=true,Ro());},commit:f=>$e(f),applyOps:(f,S,O)=>nt(f,S,void 0,O),hasPendingInput:()=>ct.length>0,replacementOffset:(f,S,O)=>Cu({paragraphId:f,offset:S},{paragraphId:f,offset:O}),render:()=>vt(),flushLayout:()=>Ft(),flushToPaint:()=>au(),updateCaret:()=>{G.update(),Gm(I,ua());},textOf:f=>Lt(f),pendingFormatOps:(f,S,O,D)=>mt(f,S,O,D),selectionMark:()=>Qe(),now:en,recordSelectionMs:f=>{on=f;},isGesturing:()=>z.kind==="pointer"||(Eu?.dragging()??false),selectionLocked:()=>De==="view",domSelection:()=>Z?We(Z.text.anchor):K,holdsCellSelection:()=>Z!==null,replaceSelectionWith:f=>Ae.type(f),discardPaint:()=>o(I)});Me=YC({session:a,layout:Ee,sectionAtPage:Qn,revisionDisplayMode:qt,revisionAuthorFilter:It,selection:()=>K,setScopeSelection:f=>{bt(),Pa(),we(f),Po.clear(),K=f,Z=null,At=null,Ro();},noteModelMoved:()=>ze.noteModelMoved(),render:()=>vt(),mirrorToDom:()=>ze.mirrorToDom(),notify:()=>n.onChange?.(ut()),materializedPages:()=>Ut,entryRefused:()=>De==="view",leaveOtherStories:()=>{Te?.exitNote(),Ke?.exit();}}),Te=wC({session:a,exitHeaderFooter:()=>{Me?.exitHeaderFooter(),Ke?.exit();},applyOps:nt,commit:$e,selection:()=>K,selectionMark:()=>Qe(),orderedStart:()=>Tu(),deleteSelectionPlan:()=>kr(),undo:()=>Ae.undo(),activeScope:()=>{let f=Ke?.active();if(f)return f;let S=Te?.activeNoteScope();return S||(Me?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:f=>Me.setActiveScope(f),setSelection:f=>ht(f),noteModelMoved:()=>ze.noteModelMoved(),render:()=>{Ft()||vt();},revealNote:f=>{Ft();for(let S of xe$1.pages){let O=[...S.footnotes?.notes??[],...S.endnotes?.notes??[]].find(D=>D.scopeId===f);if(O)return Oa$1(O.box.y,O.box.height,{block:"nearest",offsetPx:48}),S.index}return null},notify:()=>n.onChange?.(ut()),lastRejection:()=>F,setLastRejection:f=>{F=f===null?null:W(f);}});function ty(f){f&&bt(),Z=f,f&&(we(f.text),Pa(),K=f.text),At=null,ze.noteSelectionSettled(),ze.mirrorToDom(),Ca(),Po.clear(),hi(),Ro(),n.onChange?.(ut());}let zr=null;function AA(){let S=oe(Ee(),K.head)?.pageIndex??0,O=new Set;for(let D=S-1;D<=S+1;D+=1)D>=0&&D<xe$1.pages.length&&O.add(D);return O}let ny=new WeakMap;function FA(f){let S=ny.get(f);if(S)return S;let O=new Map;for(let D of f.pages)for(let V of xa(D))O.has(V.paragraphId)||O.set(V.paragraphId,D.index);return ny.set(f,O),O}function LA(){let f=a.revision(),S=Ut??AA();if(zr?.layout===xe$1&&zr.revision===f&&hg(zr.pages,S))return zr.rects;let O=(J,le)=>{if(!S)return true;let he=FA(xe$1),Re=he.get(J),Se=he.get(le);if(Re===void 0||Se===void 0)return true;for(let ue=Math.min(Re,Se);ue<=Math.max(Re,Se);ue+=1)if(S.has(ue))return true;return false},D=[];for(let J of Ta$1()){if(J.kind==="comment"){if(J.range===null||!O(J.range.start.paragraphId,J.range.end.paragraphId))continue;D.push({key:yj(J),from:{paragraphId:J.range.start.paragraphId,offset:J.range.start.offset},to:{paragraphId:J.range.end.paragraphId,offset:J.range.end.offset}});continue}let le=yj(J),he=J.kind==="revision"?J.ranges:J.range?[J.range]:[];for(let[Re,Se]of he.entries())O(Se.start.paragraphId,Se.end.paragraphId)&&D.push({key:he.length===1?le:`${le}${y}${Re}`,from:{paragraphId:Se.start.paragraphId,offset:Se.start.offset},to:{paragraphId:Se.end.paragraphId,offset:Se.end.offset}});}let V=xe(xe$1,D,S,v),Y=[];for(let[J,le]of V)for(let he of le)Y.push({...he,key:J});return zr={layout:xe$1,revision:f,pages:S,rects:Y},Y}let Po=new Set,Ia=null,ka,Ra=null,xu=false,ry=false;function Pa(){xu||(Ra=null);}function oy(){let f=Ra;if(!f||!K)return null;let S=(D,V)=>D.paragraphId===V.paragraphId&&D.offset===V.offset;if(!S(K.anchor,f.anchor)||!S(K.head,f.head))return null;let O=Ta$1().find(D=>yj(D)===f.key);return !O||O.kind==="custom"&&!O.carded||O.kind==="revision"&&Ia!==null&&Ia.has(O.revisionKind)&&(O.revisionKind!=="format"||ka===void 0||ka.has(O.formattingKind??""))&&!ry?null:O}function Su(){let f=oy();if(f)return iy(f);if(!K)return null;let O=Dj(Ta$1(),K.anchor,K.head,l()).filter(D=>!(D.kind==="comment"&&D.resolved)&&!Po.has(yj(D))&&!(D.kind==="custom"&&!D.carded)&&!(D.kind==="revision"&&Ia!==null&&Ia.has(D.revisionKind)&&(D.revisionKind!=="format"||ka===void 0||ka.has(D.formattingKind??""))))[0];return O?iy(O):null}function iy(f){if(f.kind!=="comment")return f;let S=Fj(Ta$1(),f);return Po.has(yj(S))?null:S}function Ta$1(){return Mn.filterItems(a.reviewItems())}let ay=mP({roster:M.get,styles:()=>tr,slots:sn}),sy=ay.forAuthor,NA=ay.declaredFor;function DA(f,S,O){let D=f.split(y),V=D[0],Y=S!==null&&V===yj(S);if(f.startsWith("comment-")){let Se=O.get(V),ue=Se?.kind==="comment"&&Se.resolved;return ue&&!Y?null:Y?`docx-comment-band docx-comment-band--active${ue?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(f.startsWith("custom-"))return Y?"docx-comment-band docx-comment-band--active":null;let J=O.get(V);if(!J||J.kind!=="revision")return null;let le=D.length>1?Number(D[1]):0;return `docx-revision-band docx-revision-band--${(Se=>Se==="delete"||Se==="moveFrom"?"delete":Se==="insert"||Se==="moveTo"?"insert":Se==="replace"&&J.replacedRangeCount!==void 0?le<J.replacedRangeCount?"delete":"insert":"other")(J.revisionKind)}${Y?" docx-revision-band--active":""}`}let ly=null,dy,cy=null;function hi(f=false){let S=Su(),O=S?yj(S):null,D=M.get();if(!f&&ly===xe$1&&dy===O&&cy===D.resolved)return;let V=new Map;for(let J of Ta$1())V.set(yj(J),J);let Y=[];for(let J of LA()){let le=DA(J.key,S,V);if(!le)continue;let he=J.key.split(y)[0],Re=V.get(he),Se=Re?Qm(Re):null,ue=Se===null||Se===""?void 0:D.resolved.get(Se),yt=Re?.kind==="revision"&&S!==null&&he===yj(S)?ue?.style?.activeBackground:void 0;Y.push({...J,className:le,...ue?{reviewAuthor:ue}:{},...yt!==void 0?{activeBackground:yt}:{}});}r$1(A,xe$1,Y,{scale:u,...ft?{pageOffsetX:ft.pageOffsetX}:{}}),ly=xe$1,dy=O,cy=D.resolved;}function Ca(){xt?.update();let f=Z?ia$1(xe$1,Z.cellIds):oe$1?ve(Ee(),oe$1,ke(),v):Pk(Ee(),K,ke,v);r$1(L,xe$1,f,{scale:u,pageOffsetX:ft?.pageOffsetX,...Z?{}:{className:oe$1?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function wu(){$?.({layer:B,layout:xe$1,revision:a.packageRevision(),scale:u,measurer:v,...Ut?{pages:Ut}:{},...ft?{pageOffsetX:ft.pageOffsetX}:{}});}function hl(){if(!ru){j.replaceChildren();return}let f=d;if(!f){j.replaceChildren();return}vP(j,xe$1,f.remoteSelections(),{scale:u,pageOffsetX:ft?.pageOffsetX,...Ut?{pages:Ut}:{},colorForAuthor:sy,declaredColorFor:NA,labelHost:ou,measurer:v});}function yl(f){let S=Rf(a.part());if(f)return S.find(V=>V.id===f)??null;let O=ba?S.find(V=>V.id===ba):void 0;if(O)return O;let D=K.head.paragraphId;return S.find(V=>V.beginParagraphId===D||V.endParagraphId===D||V.resultParagraphIds.includes(D))??(S.length===1?S[0]:null)}function Iu(){return Cw(a.part(),K)}function uy(f){return Ew(a.part(),f)}function fy(){return new Set(Rf(a.part()).flatMap(f=>[f.beginParagraphId,...f.resultParagraphIds,f.endParagraphId]))}function ku(f){return new Set([f.beginParagraphId,f.endParagraphId,...f.resultParagraphIds])}function HA(f){let S=0;for(let O of xe$1.pages)for(let D of xa(O))f.has(D.paragraphId)&&(S+=D.lines.length);return S}function Ru(f,S){let O=new Set(S),D=new Map;for(let V of f.pages)for(let Y of xa(V)){if(!O.has(Y.paragraphId)||D.has(Y.paragraphId))continue;let J=V.pageFieldSource;D.set(Y.paragraphId,ec$1(J?.pageNumber??V.index+1,J?.format));}return D}function Pu(f){if(De==="view"||!a.editable)return false;let S=yl(f);return !S||!Tf(a.part(),a.documentOutline(),S.instruction)?false:Yk$1(a.part(),{op:"rewriteTocPageNumbers",tocId:S.id,updates:[]})===null}function py(f,S){if(!Number.isInteger(f)||!Number.isInteger(S)||f<1||S<1)return null;let O=be.sectionPropertiesAt(K.head.paragraphId),D=O.pageSize.widthTwips-O.margins.leftTwips-O.margins.rightTwips-O.margins.gutterTwips,V=Math.max(300,Math.floor(D/S));return {op:"insertTable",beforeParagraphId:K.head.paragraphId,rows:f,cols:S,columnWidthTwips:V}}function my(f,S){if(Ke?.active()||De==="view"||!a.editable)return false;let O=py(f,S),D=a.partFor(me())??a.part();return O!==null&&Yk$1(D,O)===null}function _A(f,S){if(!my(f,S))return false;let O=py(f,S);if(!O)return false;let D=null,V=a.subscribe(J=>{J.caret&&(D=J.caret);}),Y=false;try{$e(()=>{let J=nt([O],Qe());return J.committed||(F=W(J.reason??"the table could not be inserted here",J.reason??"table-insert-refused")),Y=J.committed,J},()=>{let J=D;return J?We({paragraphId:J.paragraphId,offset:J.start}):null});}finally{V();}return Y}let gy='TOC \\o "1-3" \\h';function hy(){let f=Pf(gy);if(!f)return null;let S=a.documentOutline(),O=ug$1(a.part(),S,f,Ru(Ae.layout(),S.map(D=>D.blockId)),fy(),d?.identity.actorId);return {op:"insertToc",beforeParagraphId:K.head.paragraphId,instruction:gy,alias:al?.title??"TOC",entries:O.entries,bookmarksToCreate:O.bookmarksToCreate}}function yy(){if(De==="view"||!a.editable||Iu())return false;let f=hy();return f!==null&&Yk$1(a.part(),f)===null}function BA(){if(!yy())return false;let f=hy();if(!f)return false;let S=new Set(Rf(a.part()).map(V=>V.id)),O=wa([f],void 0,void 0,pl);if(!O.committed)return F=W(O.reason??"the table of contents could not be inserted",O.reason??"table-of-contents-refused"),false;let D=Rf(a.part()).find(V=>!S.has(V.id));return D?by(D.id,"pageNumbers"):true}function by(f,S="entire"){let O=yl(f);if(!O||!Pu(O.id))return false;let D=Ae.layout(),V=a.documentOutline(),Y=Tf(a.part(),V,O.instruction);if(!Y)return false;let J=Y.map(he=>he.blockId);if(S==="entire"){let he=ug$1(a.part(),V,O.instruction,Ru(D,J),ku(O),d?.identity.actorId),Re=wa([{op:"replaceTocResult",tocId:O.id,entries:he.entries,bookmarksToCreate:he.bookmarksToCreate}],void 0,void 0,pl);if(!Re.committed)return F=W(Re.reason??"the table of contents could not be refreshed",Re.reason??"table-of-contents-refused"),false;if(D=Ae.layout(),O=yl(O.id),!O)return true}let le="";for(let he=0;he<3;he+=1){let Re=Ru(D,J),Se=wg$1(a.part(),O,V,ku(O)),ue=O.resultParagraphIds.flatMap((zt,Rr)=>{let vl=Se[Rr],Aa=vl?Re.get(vl):void 0;return Aa===void 0?[]:[{paragraphId:zt,pageNumberText:Aa}]});if(ue.length===0)break;let yt=ue.map(zt=>`${zt.paragraphId}\0${zt.pageNumberText}`).join("");if(yt===le)break;le=yt;let Xr=wa([{op:"rewriteTocPageNumbers",tocId:O.id,updates:ue}],void 0,void 0,pl);if(!Xr.committed){if(Xr.rejected)return F=W(Xr.reason??"the table of contents page numbers were refused",Xr.reason??"table-of-contents-refused"),false;break}D=Ae.layout(),O=yl(O.id)??O;}return true}function $A(){return aP({session:a,editingMode:De,collaborationActive:d!==void 0,reviewerFilterActive:Mn.filterForSession(a)!==void 0,layout:Ae.layout(),canonicalUnfilteredLayout:Pt,styleCascade:jt(),numberingIndex:Kr(),displayMode:qt()})}let{selectionMark:Qe,orderedRange:Gr,orderedStart:Tu,textOf:Lt,inlineControlBeside:vy,splitEndsTheParagraph:qA,deleteSelectionPlan:kr,deleteSelectionOps:VA,replacementOffset:Cu}=CT({session:a,layout:Ee,selection:()=>K,cellSelection:()=>Z,editingMode:()=>De,author:()=>c,trackedDate:g$2,storyScope:me,paragraphOrder:ke,flushPendingInputAndLayout:tt,trackedAuthorOrNone:vu,atParagraphEnd:(f,S)=>ol.atParagraphEnd(f,S),revisionView:Jh}),{insertPlainText:xy,copyFlavoursNow:KA,pasteRichNow:jA,armForcePlainPaste:WA}=TT({session:a,textFormFieldId:()=>xt?.fieldId()??null,richPasteAllowed:()=>!Ke?.active(),paragraphIds:hr,layout:Ee,cellSelection:()=>Z,editingMode:()=>De,storyScope:me,paragraphOrder:ke,actorId:()=>d?.identity.actorId,collaborationGate:(f,S)=>d?.gateOperations(f,S)??null,now:en,flushPendingInputAndLayout:tt,orderedRange:Gr,selectionMark:Qe,deleteSelectionPlan:kr,consumePendingFormatOps:mt,withoutPendingOnRejection:Ue,caretMark:Ir,commit:$e});function Ea(f){f&&(Yn=null,tt(),kt=an(It()),it.invalidateAll(a.packageRevision(),"tracked-change-filter"),it.flush(),n.onChange?.(ut()));}let yi=false,Ae={session:a,applyGatedTreeOps:(f,S,O,D)=>wa(f,S,O,D??me()),storyScope:me,imageDecodePort:()=>ca,layout:()=>(tt(),xe$1),state:ut,currentPage:(f="caret")=>{if(tt(),f==="viewport"){let O=_T(e,xe$1,u);if(O!==null)return O}let S=oe(Ee(),K.head);return S?S.pageIndex+1:1},setScale(f){if(!(f>0)||!Number.isFinite(f))return false;if(f===u)return true;let S$1={scale:u,defaults:x,measurer:v,producer:C,furnitureSource:kt};try{let O=Bt(e),D=O?{x:(O.scrollLeft-e.offsetLeft+O.clientWidth/2)/u,y:(O.scrollTop-e.offsetTop+O.clientHeight/2)/u}:null;if(u=f,n.measurer||(x=S(u,{context:Yi(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),v=x.measurer),C=T(),kt=an(It()),Ut=void 0,ft=void 0,zr=null,it.invalidateAll(a.packageRevision(),"zoom"),it.flush(),Dh(),O&&D){let V=Math.max(0,D.x*u+e.offsetLeft-O.clientWidth/2),Y=Math.max(0,D.y*u+e.offsetTop-O.clientHeight/2),J=Number.isFinite(O.scrollWidth)?Math.max(0,O.scrollWidth-O.clientWidth):null,le=Number.isFinite(O.scrollHeight)?Math.max(0,O.scrollHeight-O.clientHeight):null;O.scrollLeft=J===null?V:Math.min(V,J),O.scrollTop=le===null?Y:Math.min(Y,le),fl();}return !0}catch{(({scale:u,defaults:x,measurer:v,producer:C,furnitureSource:kt}=S$1)),Ut=void 0,ft=void 0,zr=null;try{it.invalidateAll(a.packageRevision(),"zoom-rollback"),it.flush();}catch{}return false}},enqueueType:ko,flushPendingInput:tt,type(f){let S=kr(),O=S.replaceAt??S.collapseTo,D=mt(O.paragraphId,O.offset,f.length),V=S.ops.length===0?ER(Zr()):void 0,Y=[...S.ops,OR(O,f,V)],J=CR(Fe(a,O.paragraphId)??a.part(),O.paragraphId,O.offset,f.length),le={paragraphId:O.paragraphId,start:J,end:J};$e(()=>Ue([...Y,...D],Y,Qe(),le),()=>We({paragraphId:O.paragraphId,offset:J}));},proposeTextChange:(f,S,O)=>tu(f,S,O),insertPlainText:f=>xy(f),deleteBackward(){if(xt?.selectForDeletion("backward"))return;let f=kr();if(f.ops.length>0){$e(()=>nt(f.ops,Qe(),Ir(f.collapseTo)),()=>We(f.collapseTo));return}if(ey("backward"))return;let S=pt()??void 0,O=Vt.shown(K.head);if(O.offset===0){for(let Re of Oa(Ee(),O.paragraphId)){let Se=Lt(Re);if(Se.length!==0){$e(()=>nt([{op:"deleteText",paragraphId:Re,start:Se.length-1,end:Se.length}],Qe(),Ir({paragraphId:Re,offset:Se.length-1})),()=>We({paragraphId:Re,offset:Se.length-1}),{rearmPending:S});return}}let V=ke(),Y=V.indexOf(O.paragraphId),J=V[Y-1];if(!J)return;let le=Vt.joinOps(J,O.paragraphId);if(!le){ht(We({paragraphId:J,offset:Lt(J).length}));return}let he=Lt(J).length;$e(()=>nt(le,Qe(),Ir({paragraphId:J,offset:he})),()=>We({paragraphId:J,offset:he}),{rearmPending:S});return}let D=vy(O,"before");if(D){$e(()=>nt([{op:"removeContentControl",controlId:D.controlId,keepContent:false}],Qe(),Ir({paragraphId:O.paragraphId,offset:D.start})),()=>We({paragraphId:O.paragraphId,offset:D.start}),{rearmPending:S});return}$e(()=>nt([{op:"deleteText",paragraphId:O.paragraphId,start:O.offset-1,end:O.offset}],Qe(),Ir({...O,offset:O.offset-1})),()=>We({...O,offset:O.offset-1}),{rearmPending:S});},splitParagraph(){let f=kr(),S=f.replaceAt??f.collapseTo,O=pt()??{properties:zi(Fe(a,S.paragraphId)??a.part(),S.paragraphId,S.offset,qt(),It()),base:[]},D=qA(S),V=D?ol.followerStyleId(S.paragraphId):void 0,Y=Mh$1(O.base,O.properties,pa(S.paragraphId,S.offset)),J=D&&De==="edit"&&Y.length>0?[{op:"setParagraphMarkProperties",paragraphId:S.paragraphId,properties:Y}]:[],le={op:"splitParagraph",paragraphId:S.paragraphId,offset:S.offset,tailStyleId:V},he=vu(),Re=he?{author:he,date:g$2()}:void 0,Se=a.documentStyles(),ue=ec(Se),yt=ue??"ListParagraph",Xr=new Set(Se.map(Pr=>Pr.styleId));for(let Pr=1;!ue&&Xr.has(yt);Pr++)yt=`ListParagraph${Pr}`;let zt=De!=="view"&&f.ops.every(Pr=>Pr.op==="deleteText"&&Pr.paragraphId===S.paragraphId)&&V===void 0?Jk(Fe(a,S.paragraphId)??a.part(),xe$1,S,Y,yt,jt(),Re,d?.identity.actorId):null,Rr=Re?[{op:"setParagraphMarkRevision",paragraphId:S.paragraphId,kind:"ins",revision:Re}]:[],vl=zt?[zt,...J,...Rr]:[le],Aa=zt?new Set(hr()):null;qR(a,S.paragraphId,Pr=>$e(()=>Ue([...f.ops,...J,...vl],[...f.ops,...zt?[zt,...Rr]:[le]],Qe(),void 0,zt&&!ue?[oR(jt()?.defaultParagraphStyleId??null,yt)]:void 0),()=>{if(!Aa)return Pr();let Fy=hr().filter(YA=>!Aa.has(YA)),Ly=zt?Fy.at(-1):Fy[0];return Ly?We({paragraphId:Ly,offset:0}):null},{rearmPending:O}),nl);},navigate(f,S=false){if(tt(),!S&&(f==="left"||f==="right")&&(K.anchor.paragraphId!==K.head.paragraphId||K.anchor.offset!==K.head.offset)){let ue=Gr();At=null;let yt=FR(Ee(),ue,ke(),f,v);ht(We(yt),true);return}let O=Ee(),D=wp(O,Vt.shown(K.head),f,At,Me?.getActive()??null,rn(),v,ze.selectionLineId());if(!D)return;let V=fy(),Y=Ow(a.part(),D.position,["left","wordLeft","lineStart","up","pageUp"].includes(f));if(Y&&(D={...D,position:Y,caret:void 0}),w){let ue=lC(O,K.head,D.position);ue!==D.position&&(D={...D,position:ue,caret:void 0});}if(wn(a.part(),D.position)){if(S)return;let yt=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(f)?"up":"down",Xr=HA(V)+4;for(let zt=0;zt<Xr;zt+=1){let Rr=wp(Ee(),D.position,yt,D.desiredX,Me?.getActive()??null,rn(),v);if(!Rr||Rr.position.paragraphId===D.position.paragraphId&&Rr.position.offset===D.position.offset)return;if(D=Rr,!wn(a.part(),D.position))break}if(wn(a.part(),D.position))return}At=D.desiredX,Te?.activeNoteScope()&&D.pageIndex!==void 0&&Number.isInteger(D.pageIndex)&&Te.setActiveNotePageIndex(D.pageIndex);let le={anchor:S?Vt.shown(K.anchor):D.position,head:D.position},he=S&&!w?le:Ks(O,le,{atomic:S&&w}),Re=!S&&!Ot(he,le),Se=K;ht(he,true,Re?"none":"head",Re?void 0:D.caret),Re&&(K!==Se||Ot(K,he))&&lu(K.anchor);},deleteWordBackward(){if(Ae.deleteSelection())return;let f=K.head,S=(xt?.wordDeletionBoundary??ie)(Lt(f.paragraphId),f.offset,-1,re(Ee(),f.paragraphId));if(S===f.offset){Ae.deleteBackward();return}$e(()=>nt([{op:"deleteText",paragraphId:f.paragraphId,start:S,end:f.offset}],Qe()),()=>We({...f,offset:S}),{rearmPending:pt()??void 0});},deleteWordForward(){if(Ae.deleteSelection())return;let f=K.head,S=(xt?.wordDeletionBoundary??ie)(Lt(f.paragraphId),f.offset,1,re(Ee(),f.paragraphId));if(S===f.offset){Ae.deleteForward();return}$e(()=>nt([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset,end:S}],Qe()),void 0,{rearmPending:pt()??void 0});},deleteForward(){if(xt?.selectForDeletion("forward")||Ae.deleteSelection()||ey("forward"))return;let f=pt()??void 0,S=Vt.shown(K.head),O=Lt(S.paragraphId);if(S.offset<O.length){let Y=vy(S,"after");if(Y){$e(()=>nt([{op:"removeContentControl",controlId:Y.controlId,keepContent:false}],Qe()),()=>We(S),{rearmPending:f});return}$e(()=>nt([{op:"deleteText",paragraphId:S.paragraphId,start:S.offset,end:S.offset+1}],Qe()),void 0,{rearmPending:f});return}let D=ke(),V=D[D.indexOf(S.paragraphId)+1];if(V){if(Oa(Ee(),V).includes(S.paragraphId)){if(Lt(V).length===0)return;$e(()=>nt([{op:"deleteText",paragraphId:V,start:0,end:1}],Qe()),()=>We(S),{rearmPending:f});return}$e(()=>nt(Vt.forwardJoinOps(S.paragraphId,V)??[{op:"joinParagraphs",firstId:S.paragraphId,secondId:V}],Qe()),()=>We(S),{rearmPending:f});}},...be,...te,setSelection:f=>{Ot(f,K)||H({kind:"programmatic"},false),gt.discard(),ht(f);},selectDrawing(f,S){Ft();let O=Xi(xe$1,f,S);if(!O)return false;let D=We(O);return H({kind:"pointer",drawingNodeId:f},Ot(D,K)),ht(D,true,"none"),kn(Ae)?.drawingNodeId===f},revealPage(f,S){Ft();let O=xe$1.pages.find(D=>D.index===f);return O?Oa$1(O.box.y,O.box.height,S):false},revealParagraph(f,S){Ft();let O=oe(Ee(),{paragraphId:f,offset:0});if(!O)return false;let D=xe$1.pages.find(V=>V.index===O.pageIndex);return D?Oa$1(D.contentBox.y+O.y,O.height,S):false},revealPosition(f,S){Ft();let O=oe(Ee(),f);if(!O)return false;let D=xe$1.pages.find(V=>V.index===O.pageIndex);return D?Oa$1(D.contentBox.y+O.y,O.height,{block:"nearest",...S}):false},setEditable(f){yu=f,f||Ke?.exit(),mu();},selectAll(){let f=ke(),S=f[0],O=f[f.length-1];!S||!O||ht({anchor:{paragraphId:S,offset:0},head:{paragraphId:O,offset:Lt(O).length}});},hyperlinks:Be,equations:se,contentControls:wr,formatPainter:ve$1,canInsertTable:my,insertTable:_A,canInsertToc:yy,insertToc:BA,canRefreshToc:Pu,canEditTextFormField:()=>xt?.canEdit()??false,editTextFormField:()=>xt?.edit()??false,refreshToc:by,refreshRefFieldResults:$A,save:()=>jR(Ae,e,()=>yi),isInsideToc:f=>Rf(a.part()).some(S=>S.beginParagraphId===f||S.endParagraphId===f||S.resultParagraphIds.includes(f)),retainSelection:()=>{let f=Symbol("selection-pin");return ge.set(f,K),oe$1=K,Ca(),f},releaseSelection:f=>{ge.delete(f)&&(Ie(),Ca());},retainedSelection:()=>oe$1,publishedLayout:()=>xe$1,drawingSelectionIntent:()=>z,overlayCoordinates:()=>Object.freeze({paintScale:u,pageOffsetX:ft?.pageOffsetX??new Map}),commitReviewOps:(f,S)=>{tt();let O=K.head.paragraphId,D=Lt(O);return $e(()=>{if(De==="view")return {committed:false,rejected:true,opCount:0,reason:m};if(d&&(S===void 0||!tR.has(S)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(d){let Y=d.gateOperations([],me());if(Y)return {committed:false,rejected:true,opCount:0,reason:Y}}let V=Hb(d?.identity.actorId,f);return {committed:V.committed,rejected:!V.committed,opCount:0,...typeof V.reason=="string"?{reason:V.reason}:{}}},()=>{Ft(),ze.noteModelMoved();let V=ke();if(V.length===0)return null;let Y=gg(K,O,D,Lt(O));return co(Ee(),V,Y)})},revisionDisplayMode:fa,replacementLanding:Le,applyAutomationOps:(f,S,O,D=false)=>{let V={committed:false,rejected:false,opCount:0},Y=S??pl;return $e(()=>{let J=Ur(false);if(J!==null)return V={committed:false,rejected:true,opCount:0,reason:J};let le=null,he=f(Re=>{let Se=Ur(true,[],false);return Se===null?Hb(d?.identity.actorId,()=>a.ensureHyperlinkRelationship(Re,Y)):(le=Se,null)});return he===null?V={committed:false,rejected:true,opCount:0,reason:le??"this engine will not author that hyperlink target"}:!n.reviewModel&&(D||he.some(Um))?V={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:V=nt(he,void 0,void 0,Y,false,O)},()=>{Ft(),ze.noteModelMoved();let J=ke();return J.length===0?null:co(Ee(),J,K)},{automation:true}),V},editingMode:()=>De,author:()=>c,setAuthor:f=>{c!==f&&(bt(),c=f,f?.trim()&&rP(F)&&(F=null,n.onChange?.(ut())));},setDrawingStrings:f=>{yo!==f&&j$3(yo)!==j$3(f)&&(yo=f,tt(),vt(false));},setLocale:ml.set,setTranslate:f=>{if(Sa===f)return;Sa=f,Mm(I,f),xt?.update();let S=f$1(f),O=g$1(S)!==g$1(On);On=S,O&&br.get()&&(tt(),vt(false));},setTocLabels:f=>{al=f;},setEditingMode:f=>{tt();let S=De!==f;De=f,S&&f!=="edit"&&Ke?.exit(),S&&f==="view"&&Me?.exitHeaderFooter(),S&&f==="view"&&Te?.exitNote(),S&&f==="view"&&ve$1.disarm(),pu(),mu(),Sp(e,De),S&&vt(false),F=null,n.onChange?.(ut());},revisionAuthors:()=>M.get().value,setRevisionDisplayMode(f){yi||f===Jn.view()||(tt(),Jn.set(f),Ea(true));},hiddenRevisionAuthors:()=>Mn.hiddenAuthors,setRevisionAuthorVisible(f,S){Ea(Mn.setVisible(f,S));},setAllRevisionAuthorsVisible(f){Ea(Mn.setAllVisible(M.get().value.keys(),f));},showAllRevisionAuthors(){Ea(Mn.showAll());},setTrackedChangesFilter(f,S){Ea(Mn.setPredicate(f,S));},collaborationSession:()=>d??null,remotePresenceColor:sy,setShowParagraphMarks:br.set,setRevisionMarkup:fi.set,setRevisionStyles:f=>{f!==tr&&(tr=f,tt(),vt(false));},setHighlightPainter(f){$=f,f||B.replaceChildren(),wu();},repaintHighlights:wu,setRemoteCaretLabelHost:f=>{f!==ou&&(ou=f,hl());},setReviewActivationExclusions(f,S){ka=S?.formattingKinds?new Set(S.formattingKinds):void 0,Ia=f===null?null:new Set(f),hi(),n.onChange?.(ut());},activeReviewKey:()=>{let f=Su();return f?yj(f):null},activateReview:(f,S,O)=>{if(Po.clear(),ry=O?.allowExcluded??false,Ra=S?{key:f,anchor:S.anchor,head:S.head}:{key:f,anchor:K.anchor,head:K.head},S){xu=true;try{ht(S);}finally{xu=false;}return}hi(),n.onChange?.(ut());},activatedReviewKey:()=>oy()===null?null:Ra?.key??null,dismissActiveReview:()=>{let f=Su();f&&(Po.add(yj(f)),Ra=null,hi(),n.onChange?.(ut()));},navigation:Ge,bookmarks:()=>a.bookmarks(),selectedText(){if(Z)return xk(xe$1,Z);let{from:f,to:S}=Gr();return vk(Ee(),f,S,ke())},copyFlavours:()=>KA(),pasteRich:(f,S)=>jA(f,S),armForcePlainPaste:WA,deleteSelection(){let f=kr();return f.ops.length===0?false:($e(()=>nt(f.ops,Qe(),Ir(f.collapseTo)),()=>We(f.collapseTo)),true)},setCellSelection:ty,layoutSession:()=>P,undo:()=>{if(De==="view"||Un(e)){F=W(m),n.onChange?.(ut());return}bt(),U.end(),d?.flushPendingJournals(),Ce.step("undo",$t,()=>Ye("undo"));},redo:()=>{if(De==="view"||Un(e)){F=W(m),n.onChange?.(ut());return}bt(),U.end(),d?.flushPendingJournals(),Ce.step("redo",$t,()=>Ye("redo"));},sectionAtPage:Qn,activeScope:()=>{let f=Ke?.active();if(f)return f;let S=Te?.activeNoteScope();return S||Me.activeScope()},setActiveScope:f=>(tt(),f.kind==="frame"?Ke.enter(f):f.kind!=="body"&&f.kind!=="headerFooter"&&f.kind!=="note"?false:(Ke?.exit(),f.kind==="note"?Te.enterNote(f.id):(Te?.exitNote(),Me.setActiveScope(f)))),insertNote:f=>(tt(),Te.insertNote(f)),deleteNote:(f,S)=>Te.deleteNote(f,S),convertNote:(f,S)=>Te.convertNote(f,S),convertAllNotes:f=>Te.convertAllNotes(f),setNoteProperties:f=>Te.setNoteProperties(f),enterNote:(f,S)=>(tt(),Te.enterNote(f,S)),exitNote:()=>(tt(),Te.exitNote()),notePropertiesState:()=>{let f=Ae.state().selection.head.paragraphId,S=a.packageRevision(),O=a.currentPackage(),D=a.part(),V=Tg$1(O),Y=ch$1(O,"footnote"),J=ch$1(O,"endnote"),le=Ae.activeScope().kind==="headerFooter",he=Ae.headerFooterState(),Re=he?.rId??null,Se=he?.sectionIndex??null,ue=Yn;if(ue&&ue.packageRevision===S&&ue.paragraphId===f&&ue.bodyPart===D&&ue.settingsPart===V&&ue.footnotesPart===Y&&ue.endnotesPart===J&&ue.headerFooterOpen===le&&ue.headerFooterRId===Re&&ue.headerFooterSectionIndex===Se)return ue.result;let yt=eE(Ae,It());return Yn={packageRevision:S,paragraphId:f,bodyPart:D,settingsPart:V,footnotesPart:Y,endnotesPart:J,headerFooterOpen:le,headerFooterRId:Re,headerFooterSectionIndex:Se,result:yt},yt},notePreviewText:f=>tE(a,f),applyTableCommandPlan(f){if(!f.ok)return {ok:false,code:f.code,reason:f.reason};let S=null,O=a.subscribe(D=>{D.caret&&(S=D.caret);});try{let D=Qe(),V=f.selection.kind==="adoptCommittedCaret";$e(()=>nt(f.ops,D),V?()=>{let Y=S;return Y?We({paragraphId:Y.paragraphId,offset:Y.start}):null}:void 0,f.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{O();}return F?{ok:false,code:"invalidArgs",reason:F}:{ok:true,changed:true}},enterHeaderFooter:f=>{tt();let S=Me.enterHeaderFooter(f);if(!S)return S;let O=Me.getActive(),D=O?xe$1.pages[O.pageIndex]:void 0;if(O&&D){let V=O.kind==="header"?D.header:D.footer,Y=V?.box.y??(O.kind==="header"?D.box.y:D.box.y+D.box.height-1),J=V?.box.height??1;Oa$1(Y,J,{block:"nearest"});}return S},exitHeaderFooter:()=>(tt(),Me.exitHeaderFooter()),headerFooterState:()=>Me.headerFooterStateStable(a.packageRevision()),...zC({applyOps:nt,commit:$e,deleteSelectionOps:VA,deleteSelectionPlan:()=>kr(),orderedStart:Tu,selectionMark:Qe,collapsedAt:We,isHeaderFooterOpen:()=>Me?.getActive()!==null,lastRejection:()=>F}),...XC({session:a,applyOps:nt,commit:$e,storyScope:me,selectionMark:Qe,editingMode:()=>De,author:()=>c,trackedDate:g$2,decodePort:()=>ca,actorId:()=>d?.identity.actorId}),focus:()=>{E.activeElement!==I&&(I.focus({preventScroll:true}),ze.mirrorToDom(true));},setTableInteractionLabel(f){p.resolve=f;},refreshTableInteractionLabels(){Ma.refreshLabels();},destroy(){if(!yi){yi=true,jr.cancel();try{au();}finally{E.removeEventListener("selectionchange",Sy),I.removeEventListener("pointerdown",Oy,{capture:true}),I.removeEventListener("keydown",bl,{capture:true}),I.removeEventListener("keydown",Vr,{capture:true}),I.removeEventListener("pointerdown",Vr,{capture:true}),I.removeEventListener("beforeinput",bl,{capture:true}),I.removeEventListener("keydown",Ry),XA(),I.removeEventListener("beforeinput",Ey),I.removeEventListener("copy",Py),I.removeEventListener("cut",Ty),I.removeEventListener("paste",Cy),I.removeEventListener("compositionstart",Iy),I.removeEventListener("compositionend",wy),E.removeEventListener("scroll",My,{capture:true}),e.ownerDocument.defaultView?.removeEventListener("resize",Mu),xa$1?.disconnect(),gu=null,pu(),cu.destroy(),gi.destroy(),xt?.destroy(),gl?.destroy(),bu?.destroy(),Eu?.destroy(),Ma.destroy(),Ge.destroy(),Fn.destroy(),ze.destroy(),I.removeEventListener("contextmenu",Wh),I.removeEventListener("click",Zh),I.removeEventListener("pointermove",Bh),I.removeEventListener("pointerleave",qh),nr.destroy(),it.cancel(),Zt!==null&&clearTimeout(Zt),Zt=null,Wr&&Wr(),Wr=null,tn.dispose(),i$1(I),G.destroy(),mA(),Lh(),Fh(),pA(),e.replaceChildren();}}}};function ZA(f){Ne$1=null;let S=xt?.restoreAfterHistory();if(!f&&S&&(K=S),ze.noteModelMoved(),Ft(),!f){ht(co(Ee(),ke(),K));return}if("anchor"in f){let D=ke(),V=!d&&[f.anchor,f.head].every(Y=>D.includes(Y.paragraphId));ht(V?f:co(Ee(),D,f));return}let O={anchor:{paragraphId:f.paragraphId,offset:f.start},head:{paragraphId:f.paragraphId,offset:f.end}};ht(ke().includes(f.paragraphId)?O:co(Ee(),ke(),O));}function Oa$1(f,S,O){let D=Bt(e);if(!D||D.clientHeight===0)return false;Dh();let V=f*u+e.offsetTop,Y=S*u,J=O?.offsetPx??24,le=O?.block??"start",he=D.clientHeight;if(le==="nearest"||le==="centerIfNeeded"){let ue=V<D.scrollTop,yt=V+Y>D.scrollTop+he;if(!ue&&!yt)return true}let Re=le==="center"||le==="centerIfNeeded"?V-Math.max(0,(he-Y)/2):le==="nearest"&&V>D.scrollTop?V+Y+J-he:V-J,Se=Math.max(0,D.scrollHeight-he);return D.scrollTo({top:Math.max(0,Math.min(Re,Se)),behavior:O?.behavior??"auto"}),fl(),true}let{onSelectionChange:Sy,onCompositionEnd:wy}=o$1.methods({...ze}),Iy=(...f)=>{ze.adoptBeforeInput(),au(),ze.onCompositionStart(...f);},Eu=null,UA=$R({onRequest:n.onRequestTextFormField,onInvalidRequest:n.onRequestInvalidTextFormField,locale:ml.get,translate:(f,S)=>Sa?.(f,S)??f,pagesLayer:I,container:e,part:f=>Fe(a,f??K.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(f=K.head.paragraphId)=>qj(a.settingsRoot())&&rj(Fe(a,f)??a.part(),f),selection:()=>K,select:(f,S)=>ht(f,false,S?"none":"caret"),reveal:lu,editable:()=>De==="edit"&&!yn,apply:f=>lc(f,$e,nt),save:(f,S)=>WR(f,S,{session:a,commit:$e,refusal:()=>Ur(true,f,false),gate:(O,D)=>d?.gateOperations(O,D)??null,collaborationActive:d!==void 0})},r.initialTextFormInput);xt=uP(UA,{part:f=>Fe(a,f),selection:()=>K,select:f=>ht(f),writable:()=>De!=="view"&&!yn,compare:_e},o$1),aI(Ae,xt.fieldId),lI(Ae,n.contentLockPolicy),bu=tP({pagesLayer:I,part:f=>Fe(a,f??K.head.paragraphId)??a.part(),editable:()=>De==="edit"&&!yn,protected:f=>qj(a.settingsRoot())&&rj(Fe(a,f)??a.part(),f),selection:()=>K,select:f=>ht(f,false,"none"),apply:f=>lc(f,$e,nt)}),gl=Xk({pagesLayer:I,settings:()=>Tg$1(a.currentPackage()),part:f=>Fe(a,f??K.head.paragraphId)??a.part(),editable:()=>De==="edit"&&!yn,select:f=>ht(f,false,"none"),canApply:f=>a.editable&&Ur(true,[f],false)===null,history:f=>Ae[f](),apply:f=>lc(f,$e,nt)});let zA=qP(Ae,{...n,onToggleFieldCodes:()=>{tt(),yn=!yn,kt=an(It()),it.invalidateAll(a.packageRevision(),"field-code-view"),it.flush();}}),ky=rC(Ae,()=>(Fe(a,K.head.paragraphId)??a.part()).root),Ry=f=>{ky.keydown(f),!gl?.keydown(f)&&(f.defaultPrevented||ze.adoptBeforeInput(),!(bu?.keydown(f)||xt?.keydown(f))&&zA(f));},{onCopy:Py,onCut:Ty,onPaste:Cy}=VP(Ae),GA=KP(Ae,{isComposing:()=>ze.isComposing(),insertPlainText:xy,onBrowserSelectionFixup:()=>{ze.mirrorToDom(),ze.noteBrowserSelectionFixup();}}),Ey=f=>{ze.adoptBeforeInput(),GA(f);};E.addEventListener("selectionchange",Sy);let{onDrawingPointerGesture:Oy,onDrawingKeyGesture:bl}=Ak({surface:Ae,textbox:()=>Ke,intent:()=>z,setIntent:f=>H(f,true)});I.addEventListener("pointerdown",Oy,{capture:true}),I.addEventListener("keydown",bl,{capture:true}),I.addEventListener("beforeinput",bl,{capture:true}),I.addEventListener("keydown",Vr,{capture:true}),I.addEventListener("pointerdown",Vr,{capture:true}),I.addEventListener("keydown",Ry);let XA=oC(I,ky);I.addEventListener("beforeinput",Ey),I.addEventListener("copy",Py),I.addEventListener("cut",Ty),I.addEventListener("paste",Cy),I.addEventListener("compositionstart",Iy),I.addEventListener("compositionend",wy);let Ou=fP(E,o$1.wrap(fl)),My=f=>{let S=Bt(e);!S||f.target!==S||Ou();};E.addEventListener("scroll",My,{capture:true,passive:true});let Mu=()=>{Ou();},Au=e.ownerDocument.defaultView;Au?.addEventListener("resize",Mu,{passive:true}),xa$1=typeof Au?.ResizeObserver=="function"?new Au.ResizeObserver(Mu):null;function Ay(){if(!xa$1)return;let f=Bt(e);f!==gu&&(xa$1.disconnect(),gu=f,f&&xa$1.observe(f));}Ay(),Ke=Wk({session:a,pagesLayer:I,layout:()=>xe$1,selection:()=>K,setSelection:f=>ht(f,false,"none"),flush:tt,leaveOtherStories:()=>{Te?.exitNote(),Me?.exitHeaderFooter();},writable:()=>yu&&De==="edit"&&a.editable}),Eu=uC({onTextFormDoubleClick:f=>xt?.doubleClick(f)??false,onTextFormPointerUp:f=>xt?.pointerUp(f),pagesLayer:I,container:e,scale:()=>u,pageOffsetX:f=>ft?.pageOffsetX.get(f)??0,layout:()=>(va=false,hu.without(Ft),Ee()),measurer:()=>v,selection:()=>Vt.shownSelection(K),setSelection:(f,S)=>ht(f,false,"none",S),cellSelection:()=>Z,setCellSelection:f=>ty(f),focus:()=>I.focus({preventScroll:true}),onSelectionSettled:()=>ve$1.applyIfArmed(),selectionLocked:()=>De==="view",activeHeaderFooter:()=>pw(Me?.getActive()??null),activeNote:()=>{let f=Te?.activeNoteScope();return f?{scopeId:f.id,pageIndex:Te?.activeNotePageIndex()??null}:null},enterHeaderFooter:f=>{tt(),Me?.enterHeaderFooter({rId:f.rId,pageIndex:f.pageIndex,sectionIndex:Qn(f.pageIndex).sectionIndex,kind:f.kind,...f.position?{position:f.position}:{}});},enterNote:(f,S,O)=>{tt(),Te?.enterNote(f,S,O);},exitNote:f=>{tt(),Te?.exitNote(f);},exitHeaderFooter:()=>(tt(),Me?.exitHeaderFooter()),enterEmptyHeaderFooter:(f,S)=>{if(De==="view")return;tt();let O=Me;O&&JC({session:a,layout:xe$1,sectionAtPage:Qn,create:D=>Ae.applyHeaderFooterLifecycle?.(D),flushLayout:Ft,enter:D=>O.enterHeaderFooter(D)},f,S);},onContentControlWidget:(f,S)=>RA(f,S),...n.reviewModel?{onChangeBarToggle:Jn.toggleByChangeBar}:{},isReadOnlyPosition:f=>wn(a.part(),f)!==void 0},{...n.pointer?{mode:n.pointer}:{},...w?{atomicInlineControls:true}:{}});let Ma=YT({pagesLayer:I,furnitureLayer:R,scale:()=>u,pageOffsetX:f=>ft?.pageOffsetX.get(f)??0,read:()=>({layout:xe$1,storeRevision:a.packageRevision(),selection:K,cellSelection:Z,editingMode:De,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:f=>Ae.applyTableCommandPlan(f),label:f=>p.resolve(f)});if(vt(),gl?.sync(),ru=true,hl(),d&&(Lh=d.subscribeStatus(()=>{n.onChange?.(ut());})),d&&dl)try{Fh=d.attach(dl);}catch{try{d.destroy();}catch{}}return Ro(),mu(),Ae.setTableInteractionLabel=f=>{p.resolve=f,Ma.refreshLabels();},Ae.refreshTableInteractionLabels=()=>{Ma.refreshLabels();},yR(Ae,()=>({measurer:n.measurer,producer:n.producer,fontAlias:n.fontAlias,defaultFontFamily:n.defaultFontFamily}),f=>{n={...n,...f},v=n.measurer??x.measurer,C=T();},()=>{yi||(kt=an(It()),Ut=void 0,ft=void 0,zr=null,it.invalidateAll(a.packageRevision(),"fonts"),it.flush());}),zk(Ae,()=>ze.isComposing()),ma=SR(Ae,e,{now:en,destroyed:()=>yi,limit:()=>er,setLimit:f=>er=f,bodyBlockCount:()=>Gf$1(P),prefixPass:f=>vr(a.packageRevision(),void 0,void 0,f),finish:o$1.wrap(()=>{it.invalidateAll(a.packageRevision(),"opening"),it.flush(),er=null;})},dE),{ok:true,surface:o$1.methods(Ae)}}function cE(e){let t={change:new Set,selectionChange:new Set,error:new Set,historyDiagnostic:new Set,diagnostic:new Set,revisionMarkupChange:new Set,reviewItemReveal:new Set};return {emitError(n,r){for(let o of [...t.error]){if(r&&!r())return;o(n);}},emitDocumentChange(n){for(let r of [...t.change])r(n);},emitSelectionChange(){if(!t.selectionChange.size)return;let n=e();for(let r of [...t.selectionChange])r(n);},emitHistoryDiagnostic(n){for(let r of [...t.historyDiagnostic])r(n);},emitDiagnostic(n){for(let r of [...t.diagnostic])r(n);},emitRevisionMarkupChange(n){for(let r of [...t.revisionMarkupChange])r(n);},emitReviewItemReveal(n){let r=Object.freeze({...n});for(let o of [...t.reviewItemReveal])o(r);},hasErrorHandlers:()=>t.error.size>0,hasDiagnosticHandlers:()=>t.diagnostic.size>0,clear(){for(let n of Object.values(t))n.clear();},on(n,r){return t[n].add(r),()=>{t[n].delete(r);}}}}var uE={"paragraph-count-unexplained":"edit.unmapped-change","paragraph-reordered":"edit.unmapped-change","unknown-paragraph-id":"edit.unmapped-change","unknown-content-moved":"edit.unmapped-change","unsupported-node":"edit.unsupported-content","split-not-clean":"edit.unmapped-change","join-not-clean":"edit.unmapped-change"},mE=new Map([["the document is open for viewing","edit.read-only"],["the document is read-only","edit.read-only"],["this content is locked","edit.protected-content"],[Xo,"edit.read-only"],[Yo,"edit.protected-content"],[Qo,"edit.protected-content"],[Nd,"edit.protected-content"],[cr,"edit.suggesting-needs-author"],[em,"edit.suggesting-needs-author"],[Qt,"edit.review-module-required"],[tI,"edit.unsupported-content"],[Ym,"edit.unsupported-story"],[Gi,"edit.field-structure"],[Ws,"edit.tracked-structure-unsupported"],[oa,"edit.section-mark"],[Fc,"edit.protected-content"],[Zs,"edit.protected-content"],["An external document refresh is in progress.","edit.refresh-in-progress"],["invalid note scope id","edit.stale-target"],[Gp,"edit.tracking-required"],[Ss,"edit.tracked-image-replace-unsupported"],[lm,"edit.picture-selected"],[qi,"edit.revision-unsupported"],["note not found","edit.stale-target"]]);function qg(e){let t=String(e??"refused");return mE.get(t)??t}function _c(e,t){return (Object.hasOwn(uE,e)?uE[e]:void 0)??s(e)??mE.get(e)??(t!==void 0&&Object.hasOwn(fE,t)?fE[t]:void 0)??"edit.refused"}var fE={notFound:"edit.stale-target",ambiguous:"edit.invalid-argument",locked:"edit.protected-content",bound:"edit.protected-content",typeMismatch:"edit.invalid-argument",kindMismatch:"edit.invalid-argument",outOfBounds:"edit.invalid-argument",unsupported:"edit.unsupported-content",invalidArgs:"edit.invalid-argument"},pE={wasmUnavailable:"font.shaper-unavailable",initializationFailed:"font.shaper-unavailable",missing:"font.missing",forbidden:"font.load-failed",overLimit:"font.size-limit",malformed:"font.malformed",fontFaceLoadFailed:"font.load-failed",loadFailed:"font.load-failed",missingFont:"font.missing",hashMismatch:"font.integrity-mismatch",hashInvalid:"font.integrity-mismatch",metadataMismatch:"font.integrity-mismatch",fontMismatch:"font.integrity-mismatch",unsupportedFaceIndex:"font.unsupported-face",unsupportedFace:"font.unsupported-face"};function gE(e){return e!==void 0&&Object.hasOwn(pE,e)?pE[e]:"font.load-failed"}var Vg=Object.freeze([16,33,50,100,200,500,1e3]),hE=2048,F8=6e4,L8=200,N8=20,D8=256,H8=6e4;function _8(){return {now:()=>globalThis.performance?.now()??Date.now(),afterNextFrame(t,n){let r=globalThis.requestAnimationFrame;return typeof r!="function"?false:(r(()=>{t(),setTimeout(n,0);}),true)},setTimer(t,n){let r=setTimeout(t,n);return r.unref?.(),r},clearTimer:t=>clearTimeout(t)}}function aa(){return {count:0,max:0,bands:new Array(Vg.length+1).fill(0),samples:[]}}function yE(e,t){return e[Math.min(e.length-1,Math.ceil(t*e.length)-1)]}function B8(e){let t=[...e.samples].sort((n,r)=>n-r);return Object.freeze({count:e.count,p50Ms:Math.round(yE(t,.5)),p95Ms:Math.round(yE(t,.95)),maxMs:Math.round(e.max),bands:Object.freeze([...e.bands])})}function bE(e){let t=e.clock??_8(),n=e.windowMs??F8,r={interaction:aa(),layout:aa(),paint:aa()},o=null,i=null,a=null,s=[],l=false;function d(m,h){if(!Number.isFinite(h)||h<0)return;let b=r[m];b.count+=1,b.max=Math.max(b.max,h);let y=Vg.findIndex(g=>h<=g);if(b.bands[y===-1?Vg.length:y]+=1,b.samples.length<hE)b.samples.push(h);else {let g=Math.floor(Math.random()*b.count);g<hE&&(b.samples[g]=h);}o===null&&(o=t.now(),i=t.setTimer(c,n));}function c(){i!==null&&t.clearTimer(i),i=null;let m=o;o=null;let h=r;if(r={interaction:aa(),layout:aa(),paint:aa()},m===null)return;let b={};for(let g of ["interaction","layout","paint"])h[g].count>0&&(b[g]=B8(h[g]));let y=(b.interaction?.count??0)>=N8&&b.interaction.p95Ms>L8;e.deliver({kind:"performance",...y?{code:"performance.slow-interaction"}:{},windowMs:Math.max(0,Math.round(t.now()-m)),...a===null?{}:{pagesBucket:v(a)},...b});}let u=()=>{globalThis.document?.visibilityState==="hidden"&&(s=[],c());};globalThis.document?.addEventListener?.("visibilitychange",u);let p=()=>globalThis.document?.visibilityState==="hidden";return {timing(m,h,b){if(l||!e.enabled())return;if(b&&(a=b()),m!=="input"){d(m,h);return}if(s.length>=D8||p())return;let y=t.now(),g=h>0&&h<=y?h:y;if(s.push(g),s.length>1)return;let x=s,v=false;t.afterNextFrame(()=>{x===s&&(s=[],v=true);},()=>{if(!v||l)return;let P=t.now();for(let T of x)P-T<=H8&&d("interaction",P-T);})||(s=[]);},flush:c,dispose(){l||(c(),l=true,globalThis.document?.removeEventListener?.("visibilitychange",u));}}}function $8(){return {now:()=>globalThis.performance?.now()??Date.now(),setTimer:(e,t)=>{let n=setTimeout(e,t);return n.unref?.(),n},clearTimer:e=>clearTimeout(e)}}var Kg=()=>({activeMs:0,inputEdits:0,commandEdits:0,automationEdits:0}),q8={input:"inputEdits",command:"commandEdits",automation:"automationEdits"};function vE(e){let t=e.clock??$8(),n=e.windowMs??6e4,r=t.now(),o=Kg(),i=Kg(),a=null,s=null,l=null,d=false,c=false;queueMicrotask(()=>{d||!e.enabled()||(c=true,e.deliver({kind:"session",phase:"start"}));});function u(){s!==null&&t.clearTimer(s),s=null;let b=a;a=null;let y=o;if(o=Kg(),!(b===null||!c)){for(let g of Object.keys(y))i[g]+=y[g];e.deliver({kind:"session",phase:"active",durationMs:Math.max(0,Math.round(t.now()-b)),...y,activeMs:Math.round(y.activeMs)});}}function p(){if(d)return;let b=t.now();l!==null&&b-l<=3e4&&(o.activeMs+=Math.max(0,b-l)),l=b,a===null&&(a=b,s=t.setTimer(u,n));}let m=()=>{globalThis.document?.visibilityState==="hidden"&&u();};globalThis.document?.addEventListener?.("visibilitychange",m);function h(){d||(u(),d=true,globalThis.document?.removeEventListener?.("visibilitychange",m),c&&e.deliver({kind:"session",phase:"end",durationMs:Math.max(0,Math.round(t.now()-r)),...i,activeMs:Math.round(i.activeMs)}));}return {activity:p,edit(b){d||(o[q8[b]]+=1,p());},flush:u,end:h}}var jg=new Set,V8=e=>{if(!e.persisted)for(let t of [...jg])try{t();}catch{}};globalThis.addEventListener?.("pagehide",V8);function xE(e){return jg.add(e),()=>{jg.delete(e);}}var K8=new Set(["insertImage","openRevisionMarkupDialog","proposeDeletion","proposeInsertion","proposeReplacement","replaceImage","setEditingMode","setReviewDisplayMode","toggleDocumentProtection","toggleParagraphMarks","toggleReviewPane"]);function SE(e){if(K8.has(e.type))return e.type;try{let t=Go(e);return t.supported||t.reason!==Up(e.type)?e.type:void 0}catch{return}}function j8(e){let t=e.type;if(t==="acceptRevision"||t==="acceptAllRevisions")return "accept";if(t==="rejectRevision"||t==="rejectAllRevisions")return "reject";let n=e.action;return n==="accept"||n==="reject"?n:void 0}var wE=new WeakMap;function IE(e,t){let n=wE.get(e);return n?n(t):t()}var Wg=new WeakMap;function W8(e,t,n,r){Wg.get(e)?.(t,n,r);}function Z8(e,t,n){Wg.get(e)?.("edit.internal-invariant",n,"exception",{thrown:t});}function U8(e){let t=e?.code;return t==="notFound"?"save.no-document":t==="invalidState"?"save.document-changed":"save.failed"}var z8=new Set(["split","possible-ungrouped-gesture","possible-fragmented-gesture"]);function kE(e){let t$1=()=>globalThis.performance?.now()??Date.now(),n=w(()=>[...e.modules.diagnosticListeners,e.events.emitDiagnostic],e.now),r=n.deliver,o=null,i=0,a=0,s=false;e.events.on("historyDiagnostic",g=>{z8.has(g.kind)&&r({kind:"history",code:`history.${g.kind}`});}),e.customNodes?.observe(g=>{let x=g?.code;(x==="payload-invalid"||x==="payload-missing")&&r({kind:"custom-node",code:`custom-node.${x}`});});let l=e.modules.collaboration?.session,d=l?X8(l,r,t$1):()=>{},c=bE({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("performance"),...e.performance}),u$1=vE({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("session"),...e.session}),p=xE(()=>{c.flush(),u$1.end();}),m=g=>{let x=new Map;for(let[v,k]of g)for(let{reason:P,revision:T,detail:C$1}of v){let E=t(P);if(!E)continue;let w=C(T?.revisionKind),I=w==="format"?D(T?.formattingKind):void 0,L=B(T?.partName),A=y(C$1),B$1=[E,A,k,w,I,L].join("|"),$=x.get(B$1);$?$.count+=1:x.set(B$1,{count:1,event:{code:E,...k?{operation:k}:{},...w?{changeKind:w}:{},...I?{formattingKind:I}:{},...L?{part:L}:{},...A?{cause:A}:{}}});}for(let{event:v,count:k}of x.values())r({kind:"review.skipped",...v,count:k});},h=(g,x)=>m([[x.revisions?.skipped??[],j8(g)],[x.revisionAuthors?.skipped??[],"reassign"]]),b=(g,x,v)=>{try{r({kind:"edit.rejected",code:"edit.internal-invariant",origin:"command",...v,cause:z(),errorName:A(g),stage:x});}catch{}},y$1=g=>{if(g||i===0&&a===0){u$1.edit("input");return}s||(s=true,u$1.edit(a>0?"automation":"command"));};return {editorSessionId:n.editorSessionId,surfaceHooks(g,x){return {onRejection:v=>this.inputRejected(v,g()),onTiming:(v,k)=>this.timing(v,k,x()??void 0),onEdit:y$1}},openStarted(g){o={sizeBucket:u(g.byteLength),start:t$1()};},openDeferred(){o&&(o.start=null);},openMounting(){o&&o.start===null&&(o.start=t$1());},openSettled(g){if(!o)return;let{sizeBucket:x,start:v$1}=o;o=null,r({kind:"document.open",outcome:"opened",sizeBucket:x,pagesBucket:v(ji(g)),durationMs:v$1===null?0:Math.max(0,Math.round(t$1()-v$1)),...G8(g)});},openRejected(g,x,v){let k=o?.sizeBucket;o=null;let P=y(g),T=B(v);r({kind:"document.open",outcome:"rejected",code:r$2(g,x),...k?{sizeBucket:k}:{},...P?{cause:P}:{},...T?{part:T}:{}});},openCrashed(g,x="open-mount"){if(!o)return;let{sizeBucket:v}=o;o=null,r({kind:"document.open",outcome:"rejected",code:"open.failed",sizeBucket:v,cause:z(),errorName:A(g),stage:x});},continueOpen(g){try{return g()}catch(x){throw this.openCrashed(x,"open-layout"),x}},reviewItem(g,x,v,k){return (P,T)=>{let C=x(P),E;try{E=g(P,T);}catch(I){throw i===0&&b(I,"review-item",{tracked:k()}),I}if(E.ok||i>0)return E;if(E.code==="notFound"||E.code==="unsupported"&&C){let I=C?v(C,T):{},L=C&&{revisionKind:C.revisionKind,partName:I.partName??"",...C.formattingKind?{formattingKind:C.formattingKind}:{}},A=E.reason===qi?I.detail??"read-only":y(E.reason)??I.detail;return m([[[{reason:E.code==="notFound"?"unknown-revision":"unsupported-revision",...L?{revision:L}:{},detail:A}],T]]),E}let w=y(E.reason);return r({kind:"edit.rejected",code:_c(E.reason,E.code),origin:"command",tracked:k(),...w?{cause:w}:{}}),E}},exec(g,x,v,k){i===0&&a===0&&(s=false),i+=1;let P;try{P=v();}catch(T){if(i===1){let C;try{C=SE(g);}catch{C=void 0;}b(T,"command",{tracked:x,...C?{command:C}:{}});}throw T}finally{i-=1;}if(i>0)return P;if(P.ok&&!s&&k?.()&&(s=true,u$1.edit(a>0?"automation":"command")),!P.ok){let T=SE(g),C=y(P.reason);r({kind:"edit.rejected",code:_c(P.reason,P.code),origin:"command",tracked:x,...T?{command:T}:{},...C?{cause:C}:{}});}return h(g,P),P},inputRejected(g,x){if(i>0||a>0)return;let v=_c(g),k=y(g);r({kind:"edit.rejected",code:v,origin:"input",tracked:x,...k?{cause:k}:{}});},fontFailed(g){r({kind:"font.failed",code:gE(g)});},attach(g,x){let v=g.exec,k=()=>g.getDocumentHandle().revision;g.exec=(T,C)=>{let E=k();return this.exec(T,x(),()=>v(T,C),()=>k()!==E)};let P=g.save;g.save=()=>this.save(()=>P.call(g)),wE.set(g,T=>{i===0&&a===0&&(s=false),a+=1;try{return T()}finally{a-=1;}}),hI(g,(T,C)=>{this.exec(T,x(),()=>C);}),Wg.set(g,(T,C,E,w)=>{let I=y(E);r({kind:"edit.rejected",code:T,origin:"automation",tracked:C,...I?{cause:I}:{},...w?{errorName:A(w.thrown),stage:"automation"}:{}});});},async save(g){let x=t$1(),v=()=>Math.max(0,Math.round(t$1()-x)),k;try{k=await g();}catch(P){try{let T=U8(P);r({kind:"document.save",outcome:"rejected",code:T,durationMs:v(),...T==="save.failed"?{cause:z(),errorName:A(P),stage:"save"}:{}});}catch{}throw P}return r({kind:"document.save",outcome:"saved",sizeBucket:u(k.byteLength),durationMs:v()}),k},timing(g,x,v){g==="input"&&u$1.activity(),c.timing(g,x,g==="paint"&&v?()=>ji(v):void 0);},dispose(){c.dispose(),d(),u$1.end(),p();}}}function G8(e){try{let{session:t}=e;return {shape:{parts:v(t.currentPackage().parts.size),paragraphs:v(t.paragraphIds().length),reviewItems:v(t.reviewItems().length),embeddedFonts:v(t.embeddedFonts().length)}}}catch{return {}}}function X8(e,t,n){let r=n(),o="none",i,a=false,s=false,l=-1,d=()=>{let p=e.statusSnapshot(),m=p.reason?.code,h=p.recovering===true;if(p.status===o&&m===i&&h===a)return;let b=p.status==="ready"&&!s,y=b&&o!=="none";b&&(s=true),t({kind:"collab.status",status:p.status,previous:o,...m?{code:`collab.${m}`}:{},recovering:h,...y?{connectMs:Math.max(0,Math.round(n()-r))}:{}}),o=p.status,i=m,a=h;},c=()=>{let p=e.participants().length;p!==l&&(l=p,t({kind:"collab.participants",count:p}));},u=[e.subscribeStatus(d),e.subscribeParticipants(c)];return d(),()=>{for(let p of u)p();}}function RE(e$1,t,n=()=>true){if(!n())return;let r=e$1.code==="wasmUnavailable"||e$1.cause instanceof e&&e$1.cause.code==="unsupportedRuntime";r&&!t.config.onFontError&&!t.events.hasErrorHandlers()&&cx(e$1);try{t.config.onFontError?.(e$1);}catch{}n()&&(t.events.emitError(e$1,n),n()&&t.diagnostics.fontFailed(r?"wasmUnavailable":e$1.code));}function Gs(e){let t=[],n=(r,o)=>{let i=o.kind,a=r.handlers.kinds??e;return typeof i!="string"||!a||a.includes(i)};return {request(r){let o=t.filter(l=>n(l,r)),i=[...o].reverse().find(l=>!l.fallback)??o.at(-1);if(!i?.handlers.onRequest)return false;let{sessions:a,handlers:s}=i;return a.add(r),r.signal.addEventListener("abort",()=>a.delete(r),{once:true}),s.onRequest(r),true},register(r,o){let i={handlers:r,fallback:o?.fallback===true,sessions:new Set};return t.push(i),()=>{let a=t.indexOf(i);if(!(a<0)){t.splice(a,1);for(let s of i.sessions)s.cancel();}}}}}var Y8=()=>Gs();function PE(){let e=Y8(),t=Gs(["dropdown","comboBox","date","buildingBlockGallery"]),n=Gs();return {surfaceOptions:{onRequestTextFormField:e.request,onRequestContentControlWidget:t.request,onRequestInvalidTextFormField:n.request},setters:{setTextFormFieldChrome:e.register,setContentControlWidgetChrome:t.register,setInvalidTextFormFieldChrome:n.register}}}function TE(e,t){let n=Va(e),r=null,o=null,i=null,a=Gs(),s=()=>t.destroyed()?{ok:false,code:"notFound",reason:"the editor was destroyed"}:t.contribution()?.createRevisionMarkupDialog?t.container()?{ok:true}:{ok:false,code:"notFound",reason:"the editor is not attached"}:{ok:false,code:"unsupported",reason:"the review module does not supply a settings dialog"},l=p=>{if(t.destroyed())return;let m=Va(p,n);JSON.stringify(m)!==JSON.stringify(n)&&(n=m,t.apply(n),i?.(),t.changed(n));},d=()=>{if(o){o.cancel();return}let p=r;r=null,p?.destroy();},c=()=>{let p=new AbortController,m=new Set,h=n,b=g=>{if(!(p.signal.aborted||JSON.stringify(g)===JSON.stringify(h))){h=g;for(let x of [...m])x();}},y={signal:p.signal,get:()=>h,set(g){p.signal.aborted||b(Va(g,h));},reset:()=>b(Ua),subscribe(g){return p.signal.aborted?()=>{}:(m.add(g),()=>{m.delete(g);})},canApply:()=>o===y&&!p.signal.aborted&&s().ok,apply(){return y.canApply()?(l(h),y.cancel(),true):false},cancel(){if(p.signal.aborted)return;o===y&&(o=null,i=null),m.clear();let g=r;r=null,p.abort(),g?.destroy();}};return i=()=>b(n),y},u=p=>{r=t.contribution().createRevisionMarkupDialog({...p,container:t.container(),translate:m=>t.translate()?.(m)}),p.signal.aborted?d():r.open();};return {current:()=>n,set:l,canOpen:s,register(p,m){return a.register(p??{onRequest:u},m)},open(){let p=s();if(!p.ok)return p;d();let m=c();o=m;try{a.request(m)||u(m);}catch(h){throw m.cancel(),h}return {ok:true,changed:false}},destroyDialog:d}}var CE=new WeakMap;function t6(e){return !(!e.story||e.origin===g.mutationUndo||e.origin===g.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.some(t=>t!==l$2.story))}function n6(e,t){t6(t)||(e.summaries=null);}function r6(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>n6(t,n)));}function OE(e){}function ME(e,t){let n=CE.get(e);return n||(n={summaries:null,subscribed:false},CE.set(e,n)),r6(e,n),n.summaries||(n.summaries=t()),n.summaries}var o6=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function i6(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function a6(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Ct(t)){let o=mn(n,r,t);return o.ok?{ok:true,span:{paragraphId:o.span.nodeId,start:o.span.start,end:o.span.end}}:{ok:false,code:o.code,reason:o.reason,target:t}}if(i6(t)){if(!Ct(t.from)||!Ct(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=mn(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let i=mn(n,r,t.to);if(!i.ok)return {ok:false,code:i.code,reason:i.reason,target:t};if(o.span.nodeId!==i.span.nodeId)return {ok:false,code:"unsupported",reason:"wrapping several paragraphs in one content control is not supported",target:t};let a=Math.min(o.span.start,i.span.start),s=Math.max(o.span.end,i.span.end);return {ok:true,span:{paragraphId:o.span.nodeId,start:a,end:s}}}return {ok:false,code:"unsupported",reason:"address the span with a paraId anchor; DocLocation targeting is not supported",target:t}}function Zg(e,t){let n=o6.get(t.subtype);if(!n)return {ok:false,code:"invalidArgs",reason:`that control type cannot be inserted (${String(t.subtype)})`,...t.target===void 0?{}:{target:t.target}};let r;if(t.target===void 0){let o=ti(e.state().selection);if(!o)return {ok:false,code:"unsupported",reason:"wrapping several paragraphs in one content control is not supported"};r=o;}else {let o=a6(e,t.target);if(!o.ok)return o;r=o.span;}return {ok:true,span:r,op:{op:"insertContentControl",paragraphId:r.paragraphId,start:r.start,end:r.end,type:n,...t.tag===void 0?{}:{tag:t.tag},...t.title===void 0?{}:{alias:t.title}}}}var s6="http://schemas.microsoft.com/office/word/2010/wordml",l6="http://schemas.microsoft.com/office/word/2012/wordml";function li(e){return Uc$1(e)}function Xs(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function d6(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===la$2)return t.value}}function Ug(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return d6(n)}}function c6(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=u6(t);if(n!==void 0)return n}return "richText"}function u6(e){if(e.kind==="textValue")return;let t=e.kind,n=e.localName,r=e.namespaceUri;if(t==="contentControlDropDownList"||n==="dropDownList")return "dropdown";if(t==="contentControlComboBox"||n==="comboBox")return "comboBox";if(t==="contentControlDate"||n==="date")return "date";if(n==="picture")return "picture";if(n==="docPartList")return "buildingBlockGallery";if(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===s6||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===l6)return "repeatingSection"}function Bc(e){let t=Ug(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function f6(e,t){if(Bc(Xs(t)))return true;let n=Ua$1(e,t.id);for(;n;){if(li(n)&&Bc(Xs(n)))return true;n=Ua$1(e,n.id);}return false}function Gg(e,t){let n=Xs(e),r=Ug(n,"tag"),o=Ug(n,"alias"),i=t?f6(t,e):Bc(n);return {id:e.id,controlType:c6(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...i?{locked:true}:{}}}var AE=new WeakMap;function p6(e,t){let n=[],r=Ua$1(e,t.id);for(;r;)li(r)&&n.push(`${r.id}:${Bc(Xs(r))?1:0}`),r=Ua$1(e,r.id);return n.join("|")}function LE(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function m6(e){return Object.freeze(e.map(t=>LE(t)))}function g6(e,t){let n=e.node,r=Xs(n),o=p6(t,n),i=AE.get(n);if(i&&i.properties===r&&i.lockAncestors===o)return i.summary;let a=LE(Gg(n,t));return AE.set(n,{properties:r,lockAncestors:o,summary:a}),a}function h6(e){let t=$b(e.root);return OE(t.length),t.map(n=>g6(n,e))}function y6(e){return m6(e.storyParts().flatMap(t=>h6(t)))}function b6(e){return ME(e,()=>y6(e))}function zg(e,t){return t?!(t.tag!==void 0&&e.tag!==t.tag||t.alias!==void 0&&e.alias!==t.alias||t.controlType!==void 0&&e.controlType!==t.controlType):true}function v6(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,i,a)=>{if(a>=wa$1)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=kg$1(e,l);continue}if(ya$1(l)){s=n(l.children,s,i,a+1);continue}if(li(l)){let d=s,c=i+1;s=n(Tb(l),s,c,a+1),t.push({control:l,start:d,end:s,depth:c});continue}s+=kg$1(e,l);}return s};return n(e.children,0,-1,0),t}function Xg(e,t,n){return v6(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>Gg(r.control,n))}function Yg(e,t){let n=[],r=Ua$1(e,t);for(;r;)li(r)&&n.push(Gg(r,e)),r=Ua$1(e,r.id);return n.reverse()}function NE(e,t){if(!e)return [];let n=b6(e.session);return t?n.filter(r=>zg(r,t)):n}function Qg(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=Fe(e.session,n)??e.session.part(),i=Ta(o,n);if(i&&i.kind==="paragraph"){for(let s of Xg(i,r,o))if(zg(s,t))return s}let a=Yg(o,n);for(let s=a.length-1;s>=0;s-=1){let l=a[s];if(zg(l,t))return l}return null}function Jg(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function x6(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function S6(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function w6(e){let t=n=>{if(n.kind==="textValue")return null;if(n.kind==="body")return n;for(let r of n.children){let o=t(r);if(o)return o}return null};return t(e.root)}function $c(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||li(n))&&t.push(n);return t}function I6(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...$c(r.children));return t}function k6(e){return e.kind==="table"?I6(e):li(e)?$c(Tb(e)):e.kind==="body"?$c(e.children):[]}function R6(e,t,n){if(li(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let a of Xg(t,r,e))return {ok:true,controlId:a.id};let i=Yg(e,t.id).at(-1);if(i)return {ok:true,controlId:i.id}}return {ok:false,code:"notFound",reason:"no content control at the addressed block"}}function P6(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=w6(e);if(!n)return {ok:false,code:"notFound",reason:"the document body was not found",target:t};if(t.path.length===0)return {ok:false,code:"notFound",reason:"DocLocation path is empty",target:t};let r=$c(n.children),o=null;for(let a=0;a<t.path.length;a+=1){if(o=r[t.path[a]]??null,!o)return {ok:false,code:"notFound",reason:`block index ${t.path[a]} is out of range`,target:t};a<t.path.length-1&&(r=k6(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let i=R6(e,o,t.offset);return i.ok?i:{...i,target:t}}function T6(e,t,n){let r=mn(e,t,n);if(!r.ok)return {ok:false,code:r.code,reason:r.reason,target:n};let o=t.partByNode.get(r.span.nodeId)??e,i=Ta(o,r.span.nodeId);if(!i||i.kind!=="paragraph")return {ok:false,code:"notFound",reason:`paragraph '${n.paraId}' was not found`,target:n};let a=r.span.start;for(let d of Xg(i,a,o))return {ok:true,controlId:d.id};let l=Yg(o,i.id).at(-1);return l?{ok:true,controlId:l.id}:{ok:false,code:"notFound",reason:`no content control encloses paragraph '${n.paraId}'`,target:n}}function DE(e,t){if(t===void 0){let r=Qg(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(S6(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return x6(t)?P6(n,t):Ct(t)?T6(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function HE(e){switch(e){case "locked":case "bound":case "typeMismatch":case "invalidArgs":case "unsupported":return e;case "unknown-control":return "notFound";case "indivisible-content":return "unsupported";default:return "unsupported"}}function _E(e){switch(e){case "locked":return "the content control is locked";case "bound":return "the content control is bound to external data";case "typeMismatch":return "the value does not match the control type";case "invalidArgs":return "the value is not valid for this control";case "unsupported":return "this control type is not supported";case "unknown-control":return "the content control was not found";case "indivisible-content":return "a content control cannot start or end inside a hyperlink, a field, or another inline control";default:return `the edit was refused (${e})`}}function BE(e,t){return {ok:false,code:HE(e),reason:_E(e),...t!==void 0?{target:t}:{}}}function C6(e,t,n,r){return r?.scope&&r.scope.kind!=="body"&&e.target!==void 0?{ok:false,refusal:{ok:false,code:"unsupported",reason:"a location or anchor target resolves in the body only; omit it to use the caret"}}:t?n==="view"||!t.session.editable?{ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}}:e.type==="setContentControlValue"&&typeof e.value!="string"?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"setContentControlValue requires a string value"}}:{ok:true}:{ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}}}function eh(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function th(e,t,n,r){let o=C6(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=Zg(t,e);return s.ok?FE(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let i=DE(t,e.target);if(!i.ok)return {ok:false,code:i.code,reason:i.reason};let a=e.type==="setContentControlValue"?{op:"setContentControlValue",controlId:i.controlId,value:e.value}:{op:"removeContentControl",controlId:i.controlId};return FE(t,a,i.controlId)}function FE(e,t,n){let r=Fe(e.session,n)??e.session.part(),o=Tg$1(e.session.currentPackage()),i=oj(o,t)??rk$1(r,o,t)??Yk$1(r,t);return i?{ok:false,code:HE(i),reason:_E(i)}:{ok:true}}function $E(e,t,n,r){t?.flushPendingInput();let o=th(e,t,n,r);return o.ok?E6(t,e):o}function qE(e,t,n,r,o){let i=e.applyGatedTreeOps;return typeof i=="function"?i.call(e,t,n,r,o):e.session.applyTreeOps(t,n,r,o)}function E6(e,t){if(t.type==="insertContentControl")return O6(e,t);let n=DE(e,t.target);if(!n.ok){let a=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...a!==void 0?{target:a}:{}}}e.flushPendingInput();let r=ti(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},i=qE(e,[o],r,r,Rt(e.session,n.controlId,{kind:"body"}));return i.rejected?BE(i.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:i.committed})}function O6(e,t){e.flushPendingInput();let n=Zg(e,t);if(!n.ok){let d=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...d!==void 0?{target:d}:{}}}let{paragraphId:r,start:o,end:i}=n.span,a=ti(e.state().selection),s={paragraphId:r,start:o,end:i},l=qE(e,[n.op],a,s,Rt(e.session,r,{kind:"body"}));return l.rejected?BE(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}function VE(e,t,n){switch(n.type){case "selectedText":return e?.selectedText()??"";case "selectionFormatting":return e?t():null;case "selection":return Bd(e);case "paragraphs":return FI(e,n.container);case "isInsideToc":return HI(e);case "hyperlinkAt":return AI(e);case "contentControls":return NE(e,n.filter);case "trackedChanges":case "revisions":case "findText":case "comments":return [];case "styles":return {paragraph:new Map,character:new Map,table:new Map};case "variables":return {};case "contentControlAt":return Qg(e,n.filter);case "tableContext":return qd(e);default:return null}}var KE=new WeakMap;function jE(e){let t=KE.get(e);if(!t)throw new Error("External refresh requires a mounted createDocxEditor instance.");return t}function WE(e,t){let n=null,r=null,o={...t,epoch:0,revision:0,mountedRevision:0,source:void 0,invalidated:new Set,cancel(){if(!r||r.mountedRevision!==null)return;t.cancelLoad();let i=r;r=null,uo(i.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,i.resolve(false);try{t.changed();}catch{}},invalidate(){o.cancel(),o.epoch++,n=null,r&&(uo(r.container,false),r.resolve(false),r=null),o.source=void 0;for(let i of o.invalidated)i();},contentMounted(i){r?.bytes===i&&(r.mountedRevision=o.revision);},mounted(i,a){if(!r||r.bytes!==i)return;let s=r,l=!a&&!!t.surface();o.mountedRevision=s.mountedRevision??o.revision,l?n=null:n={top:s.top,left:s.left};let d=Bt(s.container);if(l&&d&&(d.scrollTop=Math.max(0,Math.min(s.top,d.scrollHeight-d.clientHeight)),d.scrollLeft=Math.max(0,Math.min(s.left,d.scrollWidth-d.clientWidth)),d.dispatchEvent(new Event("scroll"))),r===s){r=null,uo(s.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,s.resolve(l);try{t.changed();}catch{}}},replace(i,a){let s=t.container();if(!s||r)return Promise.resolve(false);let l=Bt(s);return new Promise(d=>{r={bytes:i,resolve:d,container:s,top:a==="recovery"&&n?n.top:l?.scrollTop??0,left:a==="recovery"&&n?n.left:l?.scrollLeft??0,mountedRevision:null},o.source=a,uo(s,true),t.surface()?.setEditable(false);try{t.load(i);}catch(c){o.mounted(i,c);}})}};return e.on("change",i=>{i.source||o.revision++;}),KE.set(e,o),o}function ZE(e,t,n,r,o){let i=new Map,a=ba(e,{resolveFont:l=>{let d$1=l.fontFamily??t.defaultFont.family;if(d$1.trim().length===0)return null;let c={family:d$1,weight:l.bold?700:400,style:l.italic?"italic":"normal"},u=h(c);if(i.has(u))return i.get(u)??null;let p;try{p=e.fonts.resolve(c);}catch{return i.set(u,null),null}let m=p instanceof d?null:p;return i.set(u,m),m},fallback:n.measurer}),s=`shaped:${e.operation.extensionFingerprint}+algorithm:${e.operation.shapingHash}+producer:${e.operation.producerVersion}+fallback:${n.producer}@scale:${r}+fonts:${o}`;return {measurer:a,producer:s}}var M6="The quick brown fox 0123 \u2014 {}#@",A6=["monospace","serif"],F6=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function zE(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(M6).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!F6.test(r))return t.set(r,true),true;let i=false;for(let a of A6){let s=n(`32px ${a}`);if(n(`32px "${r}", ${a}`)!==s){i=true;break}}return t.set(r,i),i}}var UE=4;function GE(e,t,n){let r=new Set,o=[];for(let c of t){let u=c.toLowerCase();r.has(u)||(r.add(u),o.push(c));}let i=c=>new Set(e.slice(0,Math.max(c,0)).map(u=>u.toLowerCase())),a=0;for(let c=0;c<=UE;c+=1){let u=i(n-a),p=o.filter(h=>!u.has(h.toLowerCase())).length,m=Math.min(p,UE,Math.floor(n/2));if(m===a)break;a=m;}let s=e.slice(0,Math.max(n-a,0)),l=i(n-a),d=o.filter(c=>!l.has(c.toLowerCase()));return [...s,...d].slice(0,n)}function XE(e,t,n,r=new Set){let o=[];for(let i of e){if(r.has(i.toLowerCase())){o.push(i);continue}if(t(i)||n(i))continue;let a=P.get(i.toLowerCase());a!==void 0&&n(a)||o.push(i);}return o}function YE(e,t){let n=new Set(e.map(r=>r.request.family.toLowerCase()));for(let r=0;r<t.length;r+=1){let o=false;for(let i of t){let a=i.from.family.toLowerCase();n.has(a)||!n.has(i.to.family.toLowerCase())||(n.add(a),o=true);}if(!o)break}return n}var QE=new WeakMap,L6=0,N6=p((e,t)=>{if(e.kind==="paragraphProperties"){let n=QE.get(e);return n||(n=String(++L6),QE.set(e,n)),{families:[n],children:[]}}return {families:e.kind==="paragraph"&&!e.children.some(n=>n.kind==="paragraphProperties")?["default-paragraph"]:[],children:q(e,t)}});function qc(e){return N6(e,{key:""})}var JE=new WeakMap,eO=new WeakMap;function nh(e){let t=eO.get(e);return t||eO.set(e,t=r$4()),t}function rh(e,t){nh(e)(t,e.stylesRoot(),e.documentThemeFonts()),t$2(t),qc(t);}function tO(e,t,n,r){let o=nh(e).warmTableRows(t,n,r,e.stylesRoot(),e.documentThemeFonts()),i=t.children.slice(n,r);return t$2(i),qc(i),Math.max(o,t.children.length)}function nO(e){let t=e.packageRevision(),n=JE.get(e);if(n?.revision===t)return n.families;let r=n?.eastAsianFonts??nh(e),o=e.storyParts().map(p=>p.root),i=e.stylesRoot(),a=e.numberingRoot(),s=e.documentThemeFonts(),l=qc(o),c=n&&n.stylesRoot===i&&n.numberingRoot===a&&n.theme===s&&n.numberingInputs.length===l.length&&n.numberingInputs.every((p,m)=>p===l[m])?n.numberingFamilies:v$2(o,a,i,s),u=[...e.symbolFontFamilies(),...r(o,i,s),...t$2(o),...c];return JE.set(e,{eastAsianFonts:r,revision:t,families:u,numberingInputs:l,numberingFamilies:c,numberingRoot:a,stylesRoot:i,theme:s}),u}function rO(e,t,n){let[r]=a$4([[t]]);return GE([...new Set([...r&&r!==n?[r]:[],...e.documentFonts()])],nO(e),c$2)}function oO(e,t){let n,r=false,o=()=>{r=false;let a=e();if(!a)return;let s=n?.generation!==a.generation;s&&(n={generation:a.generation,requested:new Set,running:false});let l=n;if(l.running||!s&&!a.dynamic)return;let d=a.dynamic?a.families().filter(u=>!l.requested.has(u.toLowerCase())):[];if(!s&&d.length===0)return;for(let u of d)l.requested.add(u.toLowerCase());l.running=true;let c=t(d);return c.finally(()=>{l.running=false,n===l&&i();}),c},i=(a=false)=>{if(a)return o();r||(r=true,queueMicrotask(o));};return {schedule:i}}var aO="replace:",D6=`revision-${aO}`,Ys=new WeakMap;function oh(e){return e?Ys.get(e)??null:null}function Vc(e){let t=Ys.get(e);return t?[e,t.deletion,t.insertion]:[e]}function H6(e,t){let n=e.ranges[e.ranges.length-1],r=t.ranges[0];return n!==void 0&&r!==void 0&&n.partName===r.partName&&n.end.paragraphId===r.start.paragraphId&&n.end.offset===r.start.offset}function _6(e,t){return e.revisionKind==="delete"&&t.revisionKind==="insert"&&e.author===t.author&&e.readOnly===t.readOnly&&e.nesting===t.nesting&&H6(e,t)}var iO=new WeakMap;function B6(e,t){let n=iO.get(e);if(n&&Ys.get(n)?.insertion===t)return n;let r=t.date??e.date,o={kind:"revision",id:`${aO}${e.id}+${t.id}`,address:e.address,addresses:[...e.addresses,...t.addresses],replacedText:e.text,revisionKind:"replace",author:t.author,...r!==void 0?{date:r}:{},text:t.text,ranges:[...e.ranges,...t.ranges],nesting:e.nesting,replacedRangeCount:e.ranges.length,readOnly:e.readOnly||t.readOnly,replyIds:[...e.replyIds,...t.replyIds]};return Ys.set(o,{deletion:e,insertion:t}),iO.set(e,o),wj(o,[...xj(e),...xj(t)])}function $6(e){let t=e.filter(a=>a.kind==="revision"),n=new Map,r=new Set,o=new Map;for(let a=0;a+1<t.length;a+=1){let s=t[a],l=t[a+1];if(!_6(s,l))continue;let d=B6(s,l);n.set(s,d),r.add(l),o.set(s.id,d.id),o.set(l.id,d.id),a+=1;}if(n.size===0)return {items:e,renamed:o};let i=[];for(let a of e)r.has(a)||i.push(n.get(a)??a);return {items:i,renamed:o}}function sO(e,t){let n=new Set(t?.excludeRevisionKinds??[]),r=s=>s.kind!=="revision"||!n.has(s.revisionKind),o=n.size>0?e.filter(r):e,i=new Map;if(t?.pairReplacements===true){let s=$6(o);i=s.renamed,o=n.size>0?s.items.filter(r):s.items;}if(n.size===0&&i.size===0)return o;let a=new Set(o.filter(s=>s.kind==="revision").map(s=>s.id));return o.map(s=>{if(s.kind!=="comment"||s.parentRevisionId===void 0)return s;let l=i.get(s.parentRevisionId)??s.parentRevisionId;if(a.has(l))return l===s.parentRevisionId?s:{...s,parentRevisionId:l};let{parentRevisionId:d,...c}=s;return c})}function di(e){return e.startsWith(D6)}function qr(e,t){let n=di(t)?{placement:false,pairReplacements:true}:{placement:false};return e(n).find(r=>r.key===t)}function Kc(e){let t=Ys.get(e);return t?[yj(t.deletion),yj(t.insertion)]:[yj(e)]}function ih(e,t,n){return t===null||n?.pairReplacements!==true?t:e({...n,placement:false}).find(o=>di(o.key)&&Kc(o.item).includes(t))?.key??t}function ah(e,t){let n=di(t.key)?t.key:ih(e,t.key,{pairReplacements:true});return n!==null&&di(n)?{...t,pairKey:n}:t}function dO(e){return e.kind==="custom"?`custom node '${e.name}' has no reviewCard, so it has no card to activate`:`review items of kind '${e.kind==="revision"?e.revisionKind:e.kind}' are excluded from activation`}function sh(e,t){let n=e.review;return n?{reviewModel:{...n,collectReviewItems:r=>n.collectReviewItems(e.customNodes.length>0?{...r,customNodes:e.customNodes,...e.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:t}:{}}:r)}}:{}}var q6=["all-markup","simple-markup","proposed","original"];function cO(e){let t=()=>e.placements().filter(g=>g.kind==="revision"&&(g.activatable||g.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(g=>g.kind==="revision")??[],r=g=>{let x=n(),v,k=E=>(v??=new Map(e.placements({placement:false,pairReplacements:true}).filter(w=>di(w.key)).map(w=>[w.key,w])),v.get(E)),P=new Set(g.keys?.flatMap(E=>{if(!di(E))return [E];let w=k(E);return w?Kc(w.item):[E]})??(g.scope==="document"?x:e.visible()).filter(E=>E.kind==="revision").map(yj)),T=new Map,C=g.scope==="document"&&g.keys===void 0;if(C){let E=e.surface().session;for(let w of E.storyParts())T.set(w.name,{scope:Rt(E,w.root.id,{kind:"body"}),part:w,keys:[]});}for(let E of x){let w=e.scope(E),I=Fe(e.surface().session,xj(E)[0]);if(!I)continue;let L=T.get(I.name);L||(L={scope:w,part:I,keys:[]},T.set(I.name,L));let A=yj(E);P.delete(A)&&L.keys.push(A);}return {scopes:[...T.values()],missing:[...P],unfilteredDocument:C}},o=g=>{let x=bd$1(e.surface().session.currentPackage()),v=[],k=[];for(let{scope:P,part:T,ops:C}of g)C.length&&(T.name===x?.name?k.push({partName:T.name,ops:C}):v.push({scope:P,ops:C}));return {groups:v,partOps:k}},i=g=>{let{scopes:x,missing:v,unfilteredDocument:k}=r(g),P=[],T=v.map(w=>({key:w,reason:"unknown-revision"})),C=[],E=0;for(let{scope:w,part:I,keys:L}of x){let A=va(I,g.action,k?void 0:L);P.push(...A.result.resolved),T.push(...A.result.skipped),E+=A.result.remaining,C.push({scope:w,part:I,ops:A.ops});}return {...o(C),result:{resolved:P,skipped:T,remaining:E}}},a=g=>g.author===void 0?e.surface()?.author():g.author,s=g=>{let{scopes:x,missing:v}=r(g),k={author:a(g)??"",...g.date===void 0?{}:{date:g.date}},P=v.map(E=>({key:E,reason:"unknown-revision"})),T=[];for(let{scope:E,part:w,keys:I}of x){if(!I.length)continue;let L=mk$1(w,k,I,void 0,g.authors);T.push({scope:E,part:w,ops:L.ops,plan:L});}let C=E=>({updated:E.flatMap(w=>w.updated),skipped:[...P,...E.flatMap(w=>w.skipped)]});return {...o(T),result:C(T.map(({plan:E})=>E.result)),finish:()=>{let E=e.surface().session.currentPackage().parts;return C(T.map(({part:w,plan:I})=>{let L=E.get(w.name);return L?I.finish(L):I.result}))}}},l=()=>e.destroyed()?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.enabled()?e.surface()?{ok:true}:{ok:false,code:"notFound",reason:"no document is open"}:{ok:false,code:"unsupported",reason:Qt},d=g=>g.scope!==void 0&&!["visible","document"].includes(g.scope)||g.unsupported!==void 0&&!["skip","fail"].includes(g.unsupported)||g.keys!==void 0&&(!Array.isArray(g.keys)||g.keys.some(x=>typeof x!="string"))?{ok:false,code:"invalidArgs",reason:"invalid bulk revision selection"}:null,c=g=>{let x=l();if(!x.ok)return {gate:x};if(e.viewing())return {gate:{ok:false,code:"locked",reason:"the document is open for viewing"}};let v=Wn(g,e.surface());if(v)return {gate:v};let k=a(g);if(k===void 0)return {gate:{ok:false,code:"invalidArgs",reason:"pass an author, or configure the editor author, to change the author"}};if(typeof k!="string"||g.date!==void 0&&typeof g.date!="string"||lk$1({author:k,...g.date===void 0?{}:{date:g.date}}))return {gate:{ok:false,code:"invalidArgs",reason:"author must be nonblank text, and date an ISO 8601 date and time"}};let P=d(g);if(P)return {gate:P};if(g.keys!==void 0&&(g.scope!==void 0||g.authors!==void 0)||g.authors!==void 0&&(!Array.isArray(g.authors)||g.authors.some(E=>typeof E!="string")))return {gate:{ok:false,code:"invalidArgs",reason:"select by keys, or by scope and authors; authors must be a list of names"}};let T=s(g),{result:C}=T;return g.unsupported==="fail"&&C.skipped.length?{gate:{ok:false,code:"unsupported",reason:"some selected changes cannot change author"},plan:T}:C.updated.length?{gate:{ok:true},plan:T}:{gate:{ok:false,code:C.skipped.some(E=>E.reason==="unsupported-revision")?"unsupported":"notFound",reason:"no eligible selected changes to update"},plan:T}},u=g=>{e.surface()?.flushPendingInput();let{gate:x,plan:v}=c(g);if(!x.ok)return v?{...x,revisionAuthors:{...v.result,updated:[]}}:x;let k=e.surface(),{groups:P,partOps:T}=v;if(!P.length&&!T.length)return {ok:true,changed:false,revisionAuthors:v.result};let C=e.placements().find(L=>L.isActive)?.key,E;if(k.commitReviewOps(()=>(E=k.session.applyTreeOpsAtomic(P,{partOps:T}),E),"revision-attribution"),!E?.committed)return {ok:false,code:"unsupported",reason:typeof E?.reason=="string"?E.reason:"the changes were refused"};let w=v.finish(),I=w.updated.find(L=>L.previousKey===C);return I&&e.activate(I.key),{ok:true,changed:true,revisionAuthors:w}},p=g=>{if(g.type==="setReviewChangesAuthor")return c(g).gate;if(g.type!=="navigateReviewChange"&&g.type!=="resolveAllReviewChanges"&&g.type!=="setReviewDisplayMode")return null;let x=l();if(!x.ok)return x;if(g.type==="setReviewDisplayMode")return q6.includes(g.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(g.type==="navigateReviewChange"&&!["next","previous"].includes(g.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(g.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(g.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(g.type==="navigateReviewChange")return t().length?{ok:true}:{ok:false,code:"notFound",reason:"no visible changes to review"};if(e.viewing())return {ok:false,code:"locked",reason:"the document is open for viewing"};let v=Wn(g,e.surface());if(v)return v;let k=d(g);if(k)return k;let{result:P,groups:T,partOps:C}=i(g);return g.unsupported==="fail"&&P.skipped.length?{ok:false,code:"unsupported",reason:"some selected changes cannot be resolved"}:!P.resolved.length&&!T.length&&!C.length?{ok:false,code:P.skipped.length?"unsupported":"notFound",reason:"no eligible selected changes to review"}:{ok:true}},m=(g,x)=>{let v=l();if(!v.ok)return v;if(e.viewing())return e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve"),{ok:false,code:"locked",reason:"the document is open for viewing"};let k=Wn({type:"resolveAllReviewChanges"},e.surface());if(k)return k;e.surface().flushPendingInput();let P=qr(e.placements,g)?.item;if(!P||P.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(P.readOnly)return {ok:false,code:"unsupported",reason:qi};let T;return e.surface().commitReviewOps(()=>{let C=e.surface().session,E=Fe(C,xj(P)[0]);return E&&E.name===bd$1(C.currentPackage())?.name?(T=C.applyTreeOpsAtomic([],{partOps:[{partName:E.name,ops:lO(P,x,E)}]}),T):(T=e.surface().session.applyTreeOps(lO(P,x,e.surface().session.partFor(e.scope(P))),void 0,void 0,e.scope(P)),T)},"revision-resolve"),T?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof T?.reason=="string"?T.reason:"the revision was refused"}},h=g=>{if(g.type==="setReviewChangesAuthor")return u(g);if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(g.type))return null;e.surface()?.flushPendingInput();let x=p(g);if(!x)return null;if(!x.ok){if(g.type==="resolveAllReviewChanges"&&(x.code==="notFound"||x.code==="unsupported")&&l().ok&&!e.viewing()){let{result:E}=i(g);return {...x,revisions:{...E,resolved:[],remaining:E.remaining+E.resolved.length}}}return x}let v=e.surface();if(g.type==="setReviewDisplayMode")return e.setDisplayMode(g.mode),{ok:true,changed:false};if(g.type==="navigateReviewChange"){let E=t(),w=E.findIndex($=>$.isActive),I=g.direction==="next"?1:-1,L=w<0?V6(E,v,I):(w+I+E.length)%E.length,A=E[L],B=e.activate(A.key,!A.activatable&&A.revisionKind==="format");return B.ok&&e.reveal({key:A.key,source:"navigate"}),B}if(g.type!=="resolveAllReviewChanges")return null;let{groups:k,partOps:P,result:T}=i(g),C;return v.commitReviewOps(()=>(C=v.session.applyTreeOpsAtomic(k,{partOps:P}),C),"revision-resolve"),C?.committed?(e.activate(null),{ok:true,changed:true,revisions:{...T,remaining:n().length}}):{ok:false,code:"unsupported",reason:typeof C?.reason=="string"?C.reason:"the revisions were refused"}},b=g=>{let x=qr(e.placements,g)?.item;return x?.kind==="revision"?x:void 0},y=e.report?e.report.diagnostics.reviewItem(m,b,(g,x)=>{let v=e.surface()?.session,k=v&&Fe(v,xj(g)[0]);if(!k)return {};try{let T=va(k,x,[yj(g)]).result.skipped[0]?.detail;return {partName:k.name,...T?{detail:T}:{}}}catch{return {partName:k.name}}},e.report.tracked):m;return {can:p,exec:h,resolveReviewItem:y}}function V6(e,t,n){let r=t.state().selection.head,o=t.session.storyParts().find(s=>r.paragraphId.startsWith(`${s.name}#`)),i=o?mj(o):new Map,a=i.get(r.paragraphId);if(a!==void 0)for(let s=n>0?0:e.length-1;s>=0&&s<e.length;s+=n){let l=e[s],d=l.kind==="revision"?l.item.ranges[0]?.start:void 0,c=d?i.get(d.paragraphId):void 0;if(d&&c!==void 0&&(n>0?c>a||c===a&&d.offset>=r.offset:c<a||c===a&&d.offset<=r.offset))return s}return n>0?0:e.length-1}function lO(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return [];if(e.revisionKind==="structural"||uj(n.root).length>0||e.revisionKind==="format"&&xj(e).length>1)return [...va(n,t,Kc(e)).ops];let o=new Set(xj(e)),i=new Map;for(let a of $j(n)){if(!o.has(a.node.id))continue;let s=p=>a.node.attributes.find(m=>m.namespaceUri===la$2&&m.localName===p)?.value,l=e.addresses.find(p=>p.id===s("id")&&p.author===(s("author")??"")&&(p.date??"")===(s("date")??""));if(!l)continue;let d=a.node.localName,c=JSON.stringify([l,d]),u=i.get(c);u?u.siteNodeIds.push(a.node.id):i.set(c,{revision:l,localName:d,siteNodeIds:[a.node.id]});}return [...i.values()].map(({revision:a,localName:s,siteNodeIds:l})=>({op:r,revision:a,...s===void 0?{}:{localName:s},siteNodeIds:l}))}function lh(e){return e.kind==="comment"?e.comment.date:e.kind==="revision"?e.date:void 0}function dh(e,t,n,r){return e.type!=="toggleReviewPane"&&e.type!=="toggleParagraphMarks"&&e.type!=="setEditingMode"?null:t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.type==="toggleReviewPane"&&!n?{ok:false,code:"unsupported",reason:Qt}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function uO(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}function fO(e,t,n){if(!t)return false;switch(e.type){case "toggleMark":switch(e.mark){case "bold":return t.bold===true;case "italic":return t.italic===true;case "underline":return t.underline===true;case "strike":return t.strike===true;case "superscript":return t.superscript===true;case "subscript":return t.subscript===true;default:return false}case "setParagraphDirection":return t.direction===e.direction;case "setAlignment":return t.alignment===(e.align==="justify"?"both":e.align);case "toggleList":return n(e.kind);default:return false}}function jc(e,t,n){return t.kind==="note"?e.enterNote?.(t.id,n)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the note could not be opened"}:(t.furnitureKind?e.enterHeaderFooter?.({rId:t.rId,kind:t.furnitureKind,position:n}):e.enterHeaderFooter?.({rId:t.rId,position:n}))?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the header or footer could not be opened"}}function K6(e){return e?.kind==="headerFooter"||e?.kind==="note"}function pO(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function Wc(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.activeScope().kind==="frame"&&e.setActiveScope({kind:"body"}),e.exitNote?.(),e.exitHeaderFooter?.());}function mO(e,t){if(typeof t?.blockId!="string"||t.blockId.length===0||!Number.isInteger(t.start)||t.start<0||!Number.isInteger(t.length)||t.length<0)return {ok:false,code:"invalidArgs",reason:"match must carry a blockId and offsets"};if(t.scope?.kind==="frame"){let{drawingNodeId:r,hostParagraphId:o}=t.scope;if(typeof r!="string"||r.length===0||typeof o!="string"||o.length===0)return {ok:false,code:"invalidArgs",reason:"a frame match must carry drawing and host paragraph ids"};let i={ok:false,code:"unsupported",reason:"the text box drawing could not be selected"};if(!Xi(e.layout(),r,o))return i;let a=t.scope.owner;if(a){let s=jc(e,a,{paragraphId:o,offset:0});if(!s.ok)return s}else Wc(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:i}let n={paragraphId:t.blockId,offset:t.start};if(K6(t.scope)){let r=jc(e,t.scope,n);if(!r.ok)return r}else {if(t.scope&&t.scope.kind!=="body")return {ok:false,code:"unsupported",reason:"the match scope cannot be opened"};Wc(e,t.blockId);}return e.setSelection({anchor:n,head:{paragraphId:t.blockId,offset:t.start+t.length}}),e.revealParagraph(t.blockId),{ok:true,changed:false}}function sa(e,t,n){let r=e.block??t,o=e.behavior??"instant",i=e.offsetPx??24;if(!["start","center","centerIfNeeded","nearest"].includes(r))throw new TypeError("block must be start, center, centerIfNeeded, or nearest.");if(!["instant","smooth"].includes(o))throw new TypeError("behavior must be instant or smooth.");if(!Number.isFinite(i)||i<0)throw new RangeError("offsetPx must be finite and nonnegative.");let a=n?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??false;return {block:r,offsetPx:i,behavior:a?"instant":o}}function gO(e,t,n=()=>null){return {scrollToPage(r){return !Number.isInteger(r)||r<1?false:(t(),e()?.revealPage(r-1)??false)},scrollToBlock(r,o){if(typeof r!="string"||r.length===0)return false;let i;try{i=sa(o??{},"start",n());}catch{return false}t();let a=e();return a&&Wc(a,r),a?.revealParagraph(r,i)??false}}}var hO="cubic-bezier(0.23, 1, 0.32, 1)";function ci(e,t,n,r=1/0){let o=e??t;if(!Number.isFinite(o)||o<0||o>r)throw new RangeError(r===1/0?`${n} must be a finite, nonnegative number.`:`${n} must be finite and between 0 and ${r}.`);return o}function yO(e,t=180){if(e!==void 0&&typeof e!="boolean"&&(typeof e!="object"||e===null||Array.isArray(e)))throw new TypeError("animation must be a boolean or a durationMs settings object.");return e===false?0:ci(typeof e=="object"?e.durationMs:void 0,e===true||typeof e=="object"?180:t,"animation.durationMs",1e4)}function Zc(e,t,{marker:n,defaultColor:r},o){let i=[],a=new Map,s=new Set,l=null,d=null,c=r,u=.14,p=4,m=6,h=0,b=r,y="solid",g="",x=180,v=180,k,P=hO,T,C=0,E=()=>{C++,T!==void 0&&clearTimeout(T),T=void 0;},w=z=>{let H=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(z!==void 0&&(typeof z!="string"||!z.trim()||/var\(|^(inherit|initial|unset|revert|revert-layer)$/i.test(z.trim())||H?.supports&&!H.supports("animation-timing-function",z)))throw new TypeError("animation.easing must be a CSS timing function without variables.");let Z=t.container()?.ownerDocument.defaultView?.KeyframeEffect??globalThis.KeyframeEffect;if(z!==void 0&&Z)try{new Z(null,[],{easing:z});}catch{throw new TypeError("animation.easing must be one valid animation timing function.")}return z},I=(z,H)=>ci(typeof z=="object"?z.exitDurationMs:void 0,H,"animation.exitDurationMs",1e4),L=(z={})=>{if(z.includePrevious!==void 0&&typeof z.includePrevious!="boolean")throw new TypeError("includePrevious must be a boolean.");let H=ci(z.opacity,.14,"opacity",1),Z=ci(z.padding,4,"padding"),F=ci(z.borderRadius,6,"borderRadius"),_=yO(z.animation),W=I(z.animation,_),N=w(typeof z.animation=="object"?z.animation.easing:void 0),q=z.timeoutMs===null?null:ci(z.timeoutMs,3e3,"timeoutMs",2147483647),U=z.color??r,ne=ci(z.borderWidth,0,"borderWidth"),re=z.borderColor??U,ee=z.borderStyle??"solid",oe=z.className??"";if(!["solid","dashed","dotted"].includes(ee))throw new TypeError("borderStyle must be solid, dashed, or dotted.");if(typeof oe!="string")throw new TypeError("className must be a string.");let ge=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(typeof U!="string"||!U.trim()||ge?.supports&&!ge.supports("color",U))throw new TypeError("color must be a CSS color or var() expression.");if(ge?.supports&&!ge.supports("color",`color-mix(in srgb, ${U} ${H*100}%, transparent)`))throw new TypeError("color must be valid inside color-mix(), including var() expressions.");if(typeof re!="string"||!re.trim()||ge?.supports&&!ge.supports("color",re))throw new TypeError("borderColor must be a CSS color or var() expression.");if(z.changeIds!==void 0&&(!Array.isArray(z.changeIds)||z.changeIds.length>1e4||z.changeIds.some(Ie=>typeof Ie!="string"||!Ie)))throw new TypeError("changeIds must contain at most 10000 nonempty string IDs.");return {nextOpacity:H,nextPadding:Z,nextRadius:F,nextDuration:_,nextExitDuration:W,nextEasing:N,nextTimeout:q,nextColor:U,nextBorderWidth:ne,nextBorderColor:re,nextBorderStyle:ee,nextClassName:oe}},A=()=>k||t.container()?.ownerDocument.defaultView?.getComputedStyle(t.container()).getPropertyValue("--doc-motion-ease-out").trim()||hO,B=z=>{z.animation&&(z.animation.onfinish=null,z.animation.cancel(),z.animation=void 0);},$=(z,H)=>{B(H),H.element.remove(),a.get(z)===H&&a.delete(z);},j=()=>(d||(d=t.container()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null,d?.addEventListener("change",G)),d?.matches??false),R=()=>{d?.removeEventListener("change",G),d=null;};function G(){if(d?.matches){for(let[z,H]of a)B(H),H.exiting&&$(z,H);a.size||R();}}let X=(z,H,Z,F,_=false)=>{if(!_&&H.target===Z&&!H.exiting)return;let W=H.element.ownerDocument.defaultView,N=_?0:Number.parseFloat(W?.getComputedStyle(H.element).opacity??String(H.target));B(H),H.target=Z,H.element.style.opacity=String(Z);let q=j()?Math.min(F,125):F;if(q===0||typeof H.element.animate!="function"){H.exiting&&$(z,H);return}try{let U=H.element.animate([{opacity:Number.isFinite(N)?N:Z},{opacity:Z}],{duration:q,easing:P});H.animation=U,U.onfinish=()=>{H.animation===U&&(H.animation=void 0,H.exiting&&$(z,H),a.size||R());};}catch{H.exiting&&$(z,H);}},ie=()=>{l?.disconnect();let z=t.surface(),H=t.container();if(!z||!H||i.length===0)return;P=A();let Z=new Set(i.map(q=>q.paragraphId)),F=e.getRenderScale(),_=e.snapshot().zoom,W=new Set,N=new Set;for(let q of z.layout().pages){let U=H.querySelector(`[data-page-index="${q.index}"] > .docx-page-content`);if(U)for(let ne of xa(q)){if(!Z.has(ne.paragraphId))continue;let re=`${q.index}:${ne.id}`;W.add(re);let ee=Fd$2(ne),oe=ne.lines.length&&!ne.clipToBox?1/0:ee.y,ge=ne.lines.length&&!ne.clipToBox?-1/0:ee.y+ee.height;for(let Je of ne.clipToBox?[]:ne.lines)oe=Math.min(oe,Je.box.y),ge=Math.max(ge,Je.box.y+Je.box.height);let Ie=ne.clipToBox?0:p*_,_e=q.contentBox.x-q.box.x,Mt=q.contentBox.y-q.box.y,Ne=Math.max(-_e*F,ee.x*F-Ie),Ce=Math.min((q.box.width-_e)*F,(ee.x+ee.width)*F+Ie);oe=Math.max(-Mt*F,oe*F-Ie),ge=Math.min((q.box.height-Mt)*F,ge*F+Ie);let Ve=a.get(re);Ve&&Ve.element.parentElement!==U&&($(re,Ve),Ve=void 0);let Ye=!Ve;if(!Ve){let Je=H.ownerDocument.createElement("div");Je.setAttribute("data-docx-marker",""),Je.setAttribute(n,""),Je.setAttribute("contenteditable","false"),Je.setAttribute("aria-hidden","true"),Je.style.cssText="position:absolute;pointer-events:none;box-sizing:border-box;",Ve={element:Je,paragraphId:ne.paragraphId,target:-1,exiting:false},a.set(re,Ve),U.append(Je);}let $t=Ve.exiting;Ve.exiting=false,$t&&(Ve.target=-1),Ve.element.className=g,Object.assign(Ve.element.style,{border:h?`${h*_}px ${y} ${b}`:"0",backgroundColor:`color-mix(in srgb, ${c} ${u*100}%, transparent)`,borderRadius:`${m*_}px`,left:`${Ne}px`,top:`${oe}px`,width:`${Math.max(0,Ce-Ne)}px`,height:`${Math.max(0,ge-oe)}px`}),X(re,Ve,1,Ye&&s.has(ne.paragraphId)?0:x,Ye),N.add(ne.paragraphId);}}for(let q of N)s.add(q);for(let[q,U]of a)W.has(q)||(!U.element.isConnected||Z.has(U.paragraphId)||v===0?$(q,U):U.exiting||(U.exiting=true,X(q,U,0,v)));l??=new MutationObserver(ie),l.observe(H,{childList:true,subtree:true});},pe=()=>{E(),i=[],s.clear(),l?.disconnect();for(let[z,H]of a)$(z,H);R();},K=(z={})=>{let H=I(z.animation,yO(z.animation,v));P=w(typeof z.animation=="object"?z.animation.easing:void 0)??A(),E(),i=[],s.clear(),l?.disconnect();for(let[F,_]of a)_.exiting&&H>0||(_.exiting=true,X(F,_,0,H));a.size||R();};return e.on("selectionChange",()=>{i.length&&ie();}),{show(z,H={}){let{nextOpacity:Z,nextPadding:F,nextRadius:_,nextDuration:W,nextExitDuration:N,nextEasing:q,nextTimeout:U,nextColor:ne,nextBorderWidth:re,nextBorderColor:ee,nextBorderStyle:oe,nextClassName:ge}=L(H),Ie=new Set(i.map(_e=>_e.paragraphId));if(s=new Set([...s].filter(_e=>Ie.has(_e))),c=ne,h=re,b=ee,y=oe,g=ge,u=Z,p=F,m=_,x=W,v=N,k=q,i=z,x===0)for(let _e of a.values())_e.exiting||B(_e);if(!i.length){K();return}if(ie(),E(),U!==null){let _e=C;T=setTimeout(()=>{_e===C&&(T=void 0,K(),o());},U);}},validate:L,hide:K,clear:pe,repaint:ie}}function bO(e,t){e.flushPendingInput();let n=mn(e.session.part(),e.session.paragraphAnchors(),t);return n.ok?n.span:null}function vO(e,t,n){let r=null,o=i=>{if(r)return r;let a=e(),s=Zc(a,i,{marker:"data-docx-anchor-highlight",defaultColor:"var(--doc-anchor-highlight-color)"},()=>{});return i.invalidated.add(()=>s.clear()),a.on("change",l=>{l.source&&s.clear();}),r=s,s};return {scrollToAnchor(i,a={}){let s=t(),l=sa(a,"centerIfNeeded",s?.container()??null);if(!Ct(i))return false;n();let d=s?.surface();if(!d)return false;let c=bO(d,i);return !!c&&d.revealPosition({paragraphId:c.nodeId,offset:c.start},l)},highlightAnchor(i,a){let s=t();if(!s)return false;let l=o(s);if(l.validate(a),!Ct(i))return false;n();let d=s.surface();if(!d||!s.container()||s.source)return false;let c=bO(d,i)?.nodeId;return !c||!d.layout().pages.some(p=>xa(p).some(m=>m.paragraphId===c))?false:(l.show([{paragraphId:c}],a),true)},clearAnchorHighlight(i){let a=t();a&&o(a).hide(i);}}}function xO(e,t){if(!t.some(o=>o.scope?.kind==="frame"))return t;let n=e.publishedLayout();if(n.revision!==e.session.packageRevision())return t;let r=new Map;return t.filter(o=>{let i=o.scope;if(i?.kind!=="frame")return true;let a=`${i.drawingNodeId}\0${i.hostParagraphId}`,s=r.get(a);return s===void 0&&(s=!!Xi(n,i.drawingNodeId,i.hostParagraphId),r.set(a,s)),s})}var j6=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,W6=/^-?[A-Za-z_][A-Za-z0-9_-]*$/,Z6=1e4,SO=32,ch=1e3;function U6(e,t,n){let r=e?.ownerDocument.defaultView?.CSS??globalThis.CSS;return !r?.supports||r.supports(t,n)}function wO(e,t,n){if(e!==void 0){if(typeof e!="string"||!e.trim()||!U6(n,"color",e))throw new TypeError(`${t} must be a CSS color or var() expression.`);return e}}function IO(e){if(typeof e!="string"||!j6.test(e))throw new TypeError('Highlight set names are 1 to 64 letters, digits, "-", or "_", starting with a letter.');return e}function z6(e,t,n,r,o){if(!Array.isArray(t))throw new TypeError("ranges must be an array of HighlightRange.");if(n!==void 0&&(typeof n!="object"||n===null))throw new TypeError("options must be an object.");let i=t.slice(0,Z6),a=t.length-i.length,s=[],l=new Int32Array(i.length),d=new Int32Array(i.length);for(let[y,g]of i.entries()){if(!(typeof g=="object"&&g!==null&&typeof g.blockId=="string"&&g.blockId.length>0&&Number.isSafeInteger(g.start)&&g.start>=0&&Number.isSafeInteger(g.length)&&g.length>=0&&g.start+g.length<=2147483647&&(g.expectedText===void 0||typeof g.expectedText=="string")))throw new TypeError(`ranges[${y}] must have a blockId string, nonnegative integer start and length, and an optional expectedText string.`);s.push(g.blockId),l[y]=g.start,d[y]=g.start+g.length;}let c=n?.activeIndex??-1;if(!Number.isInteger(c)||c<-1)throw new RangeError("activeIndex must be an integer of -1 or more.");let u=n?.priority??0;if(!Number.isInteger(u)||Math.abs(u)>ch)throw new RangeError(`priority must be an integer from -${ch} to ${ch}.`);let p=n?.className??"";if(typeof p!="string")throw new TypeError("className must be a string.");let m=p.split(/\s+/).filter(Boolean);if(m.some(y=>!W6.test(y)))throw new TypeError("className must hold space-separated CSS class names.");let h=wO(n?.color,"color",o),b=wO(n?.activeColor,"activeColor",o);return {name:e,ranges:i,overflow:a,blockIds:s,starts:l,ends:d,...h!==void 0?{color:h}:{},...b!==void 0?{activeColor:b}:{},activeIndex:c,classes:m,priority:u,order:r,expected:null,seen:new Array(i.length).fill(null),resolved:new Uint8Array(i.length),live:new Uint8Array(i.length),checkedAt:null}}function G6(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r+=1;let o=0;for(;o<n-r&&e.charCodeAt(e.length-1-o)===t.charCodeAt(t.length-1-o);)o+=1;return {from:r,oldTo:e.length-o,delta:t.length-e.length}}function X6(e,t,n){return t<=n.from?0:e>=n.oldTo?n.delta:0}var mh=new WeakMap,EO=new WeakMap,kO=new WeakSet,uh=new WeakMap,fh=new WeakMap;function Y6(e,t){return mh.has(e)?mh.get(e):typeof e.expectedText=="string"?e.expectedText:(uh.has(e)||uh.set(e,t),uh.get(e))}var ph=new WeakMap;function OO(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=Fe(e.session,n),o=r?Ta(r,n):null,i=null;return r&&o&&(ph.has(o)?i=ph.get(o):(i=Vi$1(r,n),ph.set(o,i))),t.set(n,i),i}}function RO(e,t,n){let r=t.session,o=r.packageRevision(),i=e.checkedAt;if(i?.session===r&&i.revision===o&&i.layout===n)return;let a=OO(t),s=De(n),l=e.expected===null,d=e.expected??new Array(e.ranges.length).fill(null),c=new Map;for(let u=0;u<e.ranges.length;u+=1){let p=e.ranges[u],m=e.ends[u]>e.starts[u]?a(e.blockIds[u]):null;if(!l&&m!==null&&m===e.seen[u]){e.live[u]=e.resolved[u]&&s.has(e.blockIds[u])?1:0;continue}let h=l?EO.get(p)??fh.get(p)??m:e.seen[u];if(m!==null&&h!==null&&h!==m){let v=e.blockIds[u],k=c.get(v);k?.seen!==h&&(k={seen:h,edit:G6(h,m)},c.set(v,k));let P=X6(e.starts[u],e.ends[u],k.edit);e.starts[u]=e.starts[u]+P,e.ends[u]=e.ends[u]+P;}e.seen[u]=m;let b=e.starts[u],y=e.ends[u],g=m!==null&&y<=m.length?m.slice(b,y):null;if(!l&&m!==null&&g!==d[u]&&h!==null){let v=m.length-h.length,k=b+v>=0?m.slice(b+v,y+v):null;v!==0&&k!==null&&k===d[u]&&(e.starts[u]=b+v,e.ends[u]=y+v,g=k);}l&&(d[u]=Y6(p,g),m!==null&&!fh.has(p)&&fh.set(p,m));let x=g!==null&&g===d[u];e.resolved[u]=x?1:0,e.live[u]=x&&s.has(e.blockIds[u])?1:0;}e.expected=d,e.checkedAt={session:r,revision:o,layout:n};}var PO=new WeakMap,TO=new WeakMap,CO=new WeakMap;function Q6(e){let t=new Map;for(let n=0;n<e.ranges.length;n+=1){if(!e.live[n])continue;let r=e.blockIds[n],o=t.get(r)??[];o.push({key:n,start:e.starts[n],end:e.ends[n]}),t.set(r,o);}return t}function J6(e,t,n,r,o){let i=t.children[n];i||(i=e.createElement("div"),i.style.position="absolute",t.append(i));let a=r.index===o.activeIndex,s=`${r.index}|${a?1:0}|${r.left}|${r.top}|${r.width}|${r.height}`;CO.get(i)?.key!==s&&(i.className=a?"docx-text-highlight docx-text-highlight--active":"docx-text-highlight",o.classes.length>0&&i.classList.add(...o.classes),i.setAttribute("data-highlight-index",String(r.index)),i.style.left=`${r.left}px`,i.style.top=`${r.top}px`,i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,CO.set(i,{key:s}));}function e_(e){return e?[...e].sort((t,n)=>t-n).join(","):"*"}function t_(e){return e?[...e].map(([t,n])=>`${t}:${n}`).join(","):""}function MO(e){let t=new Map,n=0,r=0,o=[],i=null,a=null,s=null,l=null,d=()=>[...t.values()].sort((y,g)=>y.priority-g.priority||y.order-g.order);function c(y){let g=e.surface();if(i=y.layer,l=y,!g||t.size===0){y.layer.childElementCount>0&&y.layer.replaceChildren(),o=[],a=null;return}let x=d();for(let w of x)RO(w,g,y.layout);let v=ri(y.layout),k=[r,g.session.packageRevision(),e_(y.pages),y.scale,t_(y.pageOffsetX)].join("|");if(k===a&&v===s&&y.layer.childElementCount>0)return;a=k,s=v;let P=y.layer.ownerDocument,T=[],C=[];for(let w of x){let I=u(w,v,y),L=p(P,w),A=0;for(let B of I){let $=v.pages[B.pageIndex];if(!$)continue;let j=y.pageOffsetX?.get(B.pageIndex)??0,R={set:w,index:B.key,left:($.contentBox.x+B.x+j)*y.scale,top:($.contentBox.y+B.y)*y.scale,width:B.width*y.scale,height:B.height*y.scale};J6(P,L,A,R,w),A+=1,C.push(R);}for(;L.childElementCount>A;)L.lastElementChild.remove();T.push(L);}let E=y.layer.children;(E.length!==T.length||T.some((w,I)=>E[I]!==w))&&y.layer.replaceChildren(...T),o=C;}function u(y,g,x){let v=PO.get(y);v||(v=new WeakMap,PO.set(y,v));let k=[],P=new Map;for(let C of g.pages)x.pages&&!x.pages.has(C.index)||(k.push(C),v.has(C)||P.set(C.index,{page:C,rects:[]}));if(P.size>0){let C=Ce$1(g,Q6(y),new Set(P.keys()),x.measurer);for(let E of C)P.get(E.pageIndex).rects.push(E);for(let{page:E,rects:w}of P.values())v.set(E,w);}let T=[];for(let C of k)for(let E of v.get(C))T.push(E);return y.activeIndex>=0&&T.sort((C,E)=>+(C.key===y.activeIndex)-+(E.key===y.activeIndex)),T}function p(y,g){let x=TO.get(g);if(x)return x;let v=y.createElement("div");return v.className="docx-text-highlight-set",v.setAttribute("data-highlight-set",g.name),g.color&&v.style.setProperty("--doc-text-highlight-set-color",g.color),g.activeColor&&v.style.setProperty("--doc-text-highlight-set-active-color",g.activeColor),TO.set(g,v),v}function m(){r+=1,e.surface()?.repaintHighlights();}function h(y){let g=e.surface();if(!g)return {applied:0,unavailable:y.ranges.length+y.overflow};let x=g.publishedLayout();RO(y,g,x);let v=x.revision!==g.session.packageRevision(),k=0;for(let P=0;P<y.ranges.length;P+=1)k+=v?y.resolved[P]:y.live[P];return {applied:k,unavailable:y.ranges.length-k+y.overflow}}return {members:{setHighlights(y,g,x){IO(y),Array.isArray(g)&&g.length>0&&e.flushOpen();let v=t.get(y),k=z6(y,g,x,v?.order??n,e.container());if(!v&&k.ranges.length>0&&t.size>=SO)throw new RangeError(`At most ${SO} highlight sets exist at once.`);if(k.ranges.length===0)return v&&(t.delete(y),m()),{applied:0,unavailable:0};v||(n+=1),t.set(y,k);let P=h(k);return m(),P},clearHighlights(y){if(y===void 0){if(t.size===0)return;t.clear();}else if(!t.delete(IO(y)))return;m();},getHighlightsAt(y,g){if(!Number.isFinite(y)||!Number.isFinite(g))return [];let x=i;if(!x?.isConnected||o.length===0)return [];let v=x.getBoundingClientRect(),k=y-v.left,P=g-v.top,T=[],C=new Set;for(let E=o.length-1;E>=0;E-=1){let w=o[E];if(k<w.left||k>=w.left+w.width||P<w.top||P>=w.top+w.height)continue;let I=`${w.set.name}\0${w.index}`;if(C.has(I)||t.get(w.set.name)!==w.set)continue;C.add(I);let L=v.left+w.left,A=v.top+w.top;T.push({name:w.set.name,index:w.index,range:w.set.ranges[w.index],start:w.set.starts[w.index],length:w.set.ends[w.index]-w.set.starts[w.index],active:w.index===w.set.activeIndex,rect:{x:L,y:A,left:L,top:A,width:w.width,height:w.height,right:L+w.width,bottom:A+w.height}});}return T}},frame:()=>{let y=e.surface();if(!l||!y)return l;let g=y.session.packageRevision();if(l.layout.revision===g)return l;let x=y.layout();return l.layout===x?l:{...l,layout:x,revision:g}},noteMatches(y){let g=e.surface();if(!g||kO.has(y))return y;let x=xO(g,y);kO.add(x);let v=OO(g);for(let k of x){let P=v(k.blockId);P!==null&&EO.set(k,P);let T=k.start+k.length;mh.set(k,P!==null&&T<=P.length?P.slice(k.start,T):null);}return x},attach(y,g=false){a=null,l=null,g&&t.clear(),y?.setHighlightPainter(c);},reset(){t.size!==0&&(t.clear(),m());}}}var AO=new WeakMap;function FO(e){let t=AO.get(e);if(t)return t;let n=new Map,r=new Map,o=(s,l)=>{if(n.has(l))return;let d=r.get(s);d||(d=[],r.set(s,d)),n.set(l,{story:s,index:d.length}),d.push(l);},i=(s,l)=>{for(let d of ya(l)){for(let c of d.lines)for(let u of Ma(c))o(s,u.paragraphId);d.lines.length===0&&o(s,d.paragraphId);}};for(let s of e.pages){i("body",s.fragments);for(let l of [s.header,s.footer])l&&i(`part:${l.partName}`,l.fragments);for(let l of [s.footnotes,s.endnotes])for(let d of l?.notes??[])i(`notes:${d.noteKind}`,d.fragments);}let a={positions:n,paragraphs:r};return AO.set(e,a),a}function n_(e,t,n,r){let o=(c,u,p)=>{if(p<=u)return;let m=r.get(c);m?m.push({key:t,start:u,end:p}):r.set(c,[{key:t,start:u,end:p}]);},{start:i,end:a}=e;if(i.paragraphId===a.paragraphId){o(i.paragraphId,i.offset,a.offset);return}let s=n.positions.get(i.paragraphId),l=n.positions.get(a.paragraphId);if(o(i.paragraphId,i.offset,Number.POSITIVE_INFINITY),o(a.paragraphId,0,a.offset),!s||!l||s.story!==l.story||l.index<=s.index)return;let d=n.paragraphs.get(s.story);for(let c=s.index+1;c<l.index;c+=1)o(d[c],0,Number.POSITIVE_INFINITY);}function r_(e,t){if(e.start.paragraphId===e.end.paragraphId)return e.end.offset-e.start.offset;let n=t.positions.get(e.start.paragraphId),r=t.positions.get(e.end.paragraphId);return !n||!r||n.story!==r.story?Number.MAX_SAFE_INTEGER:(r.index-n.index)*1e6+(e.end.offset-e.start.offset)}function o_(e){let t=e.item;return t.kind==="revision"?t.ranges:t.range?[t.range]:[]}var LO={comment:0,custom:1,revision:2};function NO(e,t){let n=new Map,r=[];return e.forEach((o,i)=>{for(let a of o_(o)){let s=r.length;r.push({placement:i,width:r_(a,t)}),n_(a,s,t,n);}}),{byParagraph:n,sources:r}}function DO(e,t){return !e.pages||e.pages.has(t.index)}function HO(e,t,n,r){let o=e.pageOffsetX?.get(n.index)??0,i=t.left+(n.contentBox.x+r.x+o)*e.scale,a=t.top+(n.contentBox.y+r.y)*e.scale,s=r.width*e.scale,l=r.height*e.scale;return {x:i,y:a,left:i,top:a,width:s,height:l,right:i+s,bottom:a+l}}function _O(e){function t(){let n=e.frame();return !n?.layer.isConnected||!(n.scale>0)?null:{frame:n,origin:n.layer.getBoundingClientRect()}}return {getReviewItemsAt(n,r,o){if(!Number.isFinite(n)||!Number.isFinite(r))return [];let i=t();if(!i)return [];let{frame:a,origin:s}=i,l=(n-s.left)/a.scale,d=(r-s.top)/a.scale,c=a.layout.pages.find(k=>{if(!DO(a,k))return false;let P=k.box.x+(a.pageOffsetX?.get(k.index)??0);return l>=P&&l<P+k.box.width&&d>=k.box.y&&d<k.box.y+k.box.height});if(!c)return [];let u=e.placements(o);if(u.length===0)return [];let p=FO(a.layout),{byParagraph:m,sources:h}=NO(u,p),b=l-(a.pageOffsetX?.get(c.index)??0)-c.contentBox.x,y=d-c.contentBox.y,g=new Map,x=Ce$1(ri(a.layout),m,new Set([c.index]),a.measurer);for(let k of x){if(b<k.x||b>=k.x+k.width||y<k.y||y>=k.y+k.height)continue;let P=h[k.key],T=g.get(P.placement);(!T||P.width<T.width)&&g.set(P.placement,{width:P.width,rect:k});}let v=[...g.entries()].map(([k,P])=>({at:k,...P}));return v.sort((k,P)=>{if(k.width!==P.width)return k.width-P.width;let T=u[k.at],C=u[P.at];if(T.kind!==C.kind)return LO[T.kind]-LO[C.kind];if(T.kind==="revision"&&C.kind==="revision"){let E=C.item.nesting-T.item.nesting;if(E!==0)return E}return k.at-P.at}),v.map(k=>({placement:u[k.at],rect:HO(a,s,c,k.rect)}))},getReviewItemRects(n){if(typeof n!="string"||n.length===0)return [];let r=t();if(!r)return [];let{frame:o,origin:i}=r,a=qr(e.placements,n);if(!a)return [];let s=new Set(o.layout.pages.filter(d=>DO(o,d)).map(d=>d.index)),{byParagraph:l}=NO([a],FO(o.layout));return Ce$1(ri(o.layout),l,s,o.measurer).map(d=>HO(o,i,o.layout.pages[d.pageIndex],d))}}}var BO=new WeakMap;function gh(e,t){let n=t(e?.matches??[]);return BO.set(n,e?.truncated??false),n}function $O(e){return BO.get(e)}function i_(e){return e==="password"?{ok:false,code:"locked",reason:qO}:e==="other-restriction"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:e==="no-change"?{ok:false,code:"invalidArgs",reason:"the document protection is already set"}:{ok:false,code:"unsupported",reason:"document protection could not be written"}}var qO="this document is protected with a password; open it in Word to change that";function VO(e){let t=null,n=null,r=()=>{let l=e.tracking();return [l.restrictedToReadOnly,l.restrictedToComments,l.restrictedToForms,l.restrictedToTrackedChanges].join("|")},o,i=null,a=()=>{let l=e.surface();if(!l)return null;let d=l.session.settingsRoot();return (d!==o||i===null)&&(o=d,i=d?Lg$1(d):Kg$1),i},s=()=>{if(e.destroyed())return {ok:false,code:"notFound",reason:"the editor was destroyed"};let l=a();return l===null?{ok:false,code:"notFound",reason:"no document is loaded"}:e.hostViewOnly()?{ok:false,code:"locked",reason:"this document was opened for viewing"}:l.enforced&&l.password?{ok:false,code:"locked",reason:qO}:!l.enforced&&l.edit!=="none"&&l.edit!=="forms"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:null};return {sync(){let l=e.surface()?.session.settingsRoot()??null;if(l===n&&t!==null)return;n=l;let d=r();d!==t&&(t=d,e.adopt(e.decision()));},prime:()=>{n=e.surface()?.session.settingsRoot()??null,t=r();},state:a,isActive:()=>a()?.enforced===true,can(l){return l.type!=="toggleDocumentProtection"?null:s()??{ok:true}},exec(l){if(l.type!=="toggleDocumentProtection")return null;let d=s();if(d&&!d.ok)return d;let c=e.surface(),u=!a().enforced,p=c.applyHeaderFooterLifecycle?.({op:"setDocumentProtection",enforce:u});return p?p.ok?(e.publish(),{ok:true,changed:true}):i_(p.reason):{ok:false,code:"unsupported",reason:"document protection is not available"}}}}function KO(e,t){return Bf(e.revisionsIn,t)}function jO(e,t){let n=fd(e);return {current:()=>n,set(r){if(!t.enabled)return {ok:false,code:"unsupported",reason:Qt};let o;try{o=fd(r,n);}catch(a){return {ok:false,code:"invalidArgs",reason:a.message}}if(o===n)return {ok:true,changed:false};let i=n;return n=o,t.changed(n,i),{ok:true,changed:false}},shows:r=>r.some(o=>KO(n,o)),opensOnLoad:r=>n.opening==="auto"&&r.some(o=>KO(n,o)),opensOnTrackedChange:()=>n.opening==="auto"&&n.revisionsIn==="pane"}}var a_=e=>xa(e);function ZO(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=Y(t,a_);for(let o of t.pages){for(let i of [o.header,o.footer])i&&WO(r,i.fragments,o.index,i.box.y);for(let i of [o.footnotes,o.endnotes])if(i)for(let a of i.notes)WO(r,a.fragments,o.index,a.box.y);}return e.set(t,r),r}}function WO(e,t,n,r){for(let o of ya(t))for(let i of Pa(o))e.has(i)||e.set(i,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}var UO=new WeakMap;function GO(e){let t=UO.get(e);if(t)return t;let n=new Map;for(let r of e.pages)for(let o of [r.footnotes,r.endnotes])if(o)for(let i of o.notes)for(let a of ya(i.fragments))for(let s of Pa(a))n.has(s)||n.set(s,i.scopeId);return UO.set(e,n),n}var zO=new WeakMap;function XO(e){let t=zO.get(e);if(t)return t;let n=new Map;for(let[r,o]of Ra(e).entries())n.set(o,r);return zO.set(e,n),n}function YO(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function hh(e,t){if(e===""&&(t===null||t===""))return;let n=globalThis.navigator?.clipboard;if(!n)return;let r=globalThis.ClipboardItem;if(t&&n.write&&r&&typeof Blob<"u")try{let o=new r({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})});n.write([o]).catch(()=>{YO(e);});return}catch{}YO(e);}function s_(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function l_(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function QO(e){return JO(e.children)}function JO(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||Qb(n))&&t.push(n);return t}function d_(e){if(Qb(e))return JO(Tb(e));if(e.kind!=="table")return [];let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...QO(r));return t}function c_(e,t,n){let r=t.container,o=r.part==="body"?{kind:"body"}:r.part==="header"||r.part==="footer"?{kind:"headerFooter",rId:r.rId}:{kind:"notesPart",noteKind:r.part==="footnote"?"footnote":"endnote"},i=e.session.partFor(o);if(!i)return {ok:false,code:"notFound",reason:"the target story was not found"};let a="noteId"in r?r.noteId:null,s=r.part==="body"?Qc$1(i):Oc$2(i).find(m=>r.part==="header"||r.part==="footer"?m.kind===r.part:m.kind==="note"&&yc$1(m.root)===a)?.root;if(!s||s.kind==="textValue")return {ok:false,code:"notFound",reason:"the target story was not found"};if(t.path.length===0)return {ok:false,code:"invalidArgs",reason:"DocLocation path must not be empty"};let l=QO(s),d;for(let m=0;m<t.path.length;m+=1){let h=t.path[m];if(!Number.isInteger(h)||h<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(d=l[h],!d)return {ok:false,code:"notFound",reason:`block index ${h} is out of range`};m<t.path.length-1&&(l=d_(d));}if(!d||d.kind!=="paragraph"||!Ta(i,d.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let c=(Vi$1(i,d.id)??"").length,u=t.offset??(n==="start"?0:c);if(!Number.isInteger(u)||u<0||u>c)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let p={paragraphId:d.id,offset:u};return {ok:true,selection:{anchor:p,head:p}}}function Uc(e,t,n){if(s_(t))return c_(e,t,n);if(!Ct(t))return {ok:false,code:"invalidArgs",reason:"unrecognized DocTarget endpoint"};let r=e.session.paragraphAnchors(),o=r.nodeByParaId.get(t.paraId.toUpperCase());if(!o)return {ok:false,code:"notFound",reason:"the paragraph was not found"};let i=Rt(e.session,o,{kind:"body"}),a=e.session.partFor(i);if(!a)return {ok:false,code:"notFound",reason:"the target story was not found"};let s=mn(a,r,t);if(!s.ok)return s;let l=n==="start"?s.span.start:s.span.end,d={paragraphId:s.span.nodeId,offset:l};return {ok:true,selection:{anchor:d,head:d}}}function zc(e,t){if(!l_(t)){let o=Uc(e,t,"start");if(!o.ok)return o;let i=Uc(e,t,"end");return i.ok?{ok:true,selection:{anchor:o.selection.anchor,head:i.selection.head}}:i}let n=Uc(e,t.from,"start");if(!n.ok)return n;let r=Uc(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function u_(e){return e.evenPage?"even":e.firstPage?"first":"default"}function eM(e){return e.variant!==void 0?e.variant==="default"||e.variant==="first"||e.variant==="even"?e.variant:{ok:false,reason:"variant must be 'default', 'first', or 'even'"}:u_(e)}function yh(e,t){let n=e.headerFooterState(),r=t.position??n?.editing??null;if(r!=="header"&&r!=="footer")return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"header/footer position is required when no furniture scope is open"}};let i=t.variant!==void 0||t.firstPage!==void 0||t.evenPage!==void 0?eM(t):n?.variant??"default";if(typeof i=="object"&&i.ok===false)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:i.reason}};let a=i,s=t.sectionIndex??n?.sectionIndex??0;return !Number.isInteger(s)||s<0?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"}}:{ok:true,sectionIndex:s,kind:r,variant:a}}function f_(e){let t=e??"rejected";return t==="first-section"||t.includes("first-section")?{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}:{ok:false,code:"invalidArgs",reason:`header/footer lifecycle refused: ${t}`}}function Qs(e,t){if(typeof e.applyHeaderFooterLifecycle!="function")return {ok:false,code:"unsupported",reason:"header/footer lifecycle is not available"};let n=e.applyHeaderFooterLifecycle(t);return n.ok?{ok:true,changed:true}:f_(n.reason)}function Gc(e,t,n,r){let i=e.session.headerFooterResolutionBySection()[t];if(!i)return null;let s=(n==="header"?i.headers:i.footers).get(r);return s?{rId:s.rId,partName:s.partName,inherited:s.inherited,titlePage:i.titlePage,evenAndOddHeaders:i.evenAndOddHeaders}:null}function tM(e,t){if(typeof e.enterHeaderFooter!="function")return {ok:false,code:"unsupported",reason:"header/footer editing is not available"};let n=t.sectionIndex??0;if(!Number.isInteger(n)||n<0)return {ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"};let r=t.position,o=eM(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let i=o,s=Gc(e,n,r,i)?.rId,l=false;if(!s){let c=Qs(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:i,...i==="first"?{titlePage:true}:{},...i==="even"?{evenAndOddHeaders:true}:{}});if(!c.ok)return c;l=true,s=Gc(e,n,r,i)?.rId;}return s?e.enterHeaderFooter({rId:s,kind:r,sectionIndex:n,variant:i})?{ok:true,changed:l}:{ok:false,code:"invalidArgs",reason:"the header/footer relationship could not be opened"}:{ok:false,code:"notFound",reason:`no ${r} story is available to edit`}}function nM(e,t){let n=yh(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,i=Qs(e,{op:"deleteHeaderFooter",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});return i.ok&&o&&r?.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant&&e.exitHeaderFooter(),i}function rM(e,t){let n=yh(e,t);if(!n.ok)return n.refusal;if(n.sectionIndex===0)return {ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"};let r=e.headerFooterState(),o=r?.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant,i=Qs(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;if(o){let a=Gc(e,n.sectionIndex,n.kind,n.variant);a?e.enterHeaderFooter({rId:a.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return i}function oM(e,t){let n=yh(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=!!r&&r.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant,i=r?.rId,a=Qs(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;let s=Gc(e,n.sectionIndex,n.kind,n.variant);return o&&s&&s.rId!==i&&e.enterHeaderFooter({rId:s.rId,kind:n.kind,sectionIndex:n.sectionIndex}),a}function iM(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Qs(e,{op:"setSectionFurnitureOptions",...r!==void 0?{sectionIndex:r}:{},...t.titlePage!==void 0?{titlePage:t.titlePage}:{},...t.evenAndOddHeaders!==void 0?{evenAndOddHeaders:t.evenAndOddHeaders}:{},...t.headerDistanceTwips!==void 0?{headerDistanceTwips:t.headerDistanceTwips}:{},...t.footerDistanceTwips!==void 0?{footerDistanceTwips:t.footerDistanceTwips}:{}})}function aM(e,t){return e.activeScope().kind!=="headerFooter"?{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}:typeof e.insertPageField!="function"?{ok:false,code:"unsupported",reason:"page field insertion is not available"}:e.insertPageField(t.field)?{ok:true,changed:true}:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"page field insertion was refused"}}function sM(e,t){let n=e.activeScope();return n.kind==="headerFooter"?{ok:false,code:"invalidArgs",reason:"cannot insert a note reference inside a header or footer"}:n.kind==="note"?{ok:false,code:"invalidArgs",reason:"cannot insert a note reference inside another note"}:typeof e.insertNote!="function"?{ok:false,code:"unsupported",reason:"insertNote is not available"}:e.insertNote(t.noteKind)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"insertNote was refused"}}function lM(e,t){return typeof e.deleteNote!="function"?{ok:false,code:"unsupported",reason:"deleteNote is not available"}:e.deleteNote(t.noteKind,t.noteId)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"deleteNote was refused"}}function dM(e,t){return typeof e.convertNote!="function"?{ok:false,code:"unsupported",reason:"convertNote is not available"}:e.convertNote(t.fromKind,t.noteId)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"convertNote was refused"}}function cM(e,t){return typeof e.convertAllNotes!="function"?{ok:false,code:"unsupported",reason:"convertAllNotes is not available"}:e.convertAllNotes(t.fromKind)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"convertAllNotes was refused"}}function uM(e,t){if(typeof e.setNoteProperties!="function")return {ok:false,code:"unsupported",reason:"setNoteProperties is not available"};let n=t.scope??"document";return e.setNoteProperties({scope:n,sectionIndex:t.sectionIndex,footnote:t.footnote,endnote:t.endnote})?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"setNoteProperties was refused"}}function pM(e,t,n){switch(t.type){case "toggleMark":{let r=Vp.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=Kp(t);if(!r.ok)return {ok:false,code:r.code,reason:r.reason};e.setRunProperty(r.localName,r.attributes);break}case "clearFormatting":e.clearFormatting();break;case "copyFormatting":return e.formatPainter.capture()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:Cd};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:Pp};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??Pp};break}case "setLineSpacing":e.setParagraphProperty("spacing",Mc({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...ra("before",t.beforePt),...ra("after",t.afterPt)},{mergeAttributes:true});break;case "setAlignment":e.setParagraphProperties([{localName:"jc",attributes:{val:t.align==="justify"?"both":t.align},physicalAlignment:true}]);break;case "setParagraphDirection":e.setParagraphProperties([{localName:"bidi",paragraphDirection:t.direction}]);break;case "setParagraphStyle":{if(!e.session.documentStyles().some(o=>o.type==="paragraph"&&o.styleId===t.styleId))return {ok:false,code:"invalidArgs",reason:`style '${t.styleId}' is not a paragraph style of this document`};e.setParagraphProperty("pStyle",{val:t.styleId});break}case "setIndent":{e.setIndent({...t.left!==void 0?{left:t.left}:{},...t.right!==void 0?{right:t.right}:{},...t.firstLine!==void 0?{firstLine:t.firstLine}:{}});break}case "setParagraphFormat":{if(!e.setParagraphFormat({...t.alignment!==void 0?{alignment:t.alignment==="justify"?"both":t.alignment}:{},...t.direction!==void 0?{direction:t.direction}:{},...t.spaceBeforePt!==void 0?{spaceBeforePt:t.spaceBeforePt}:{},...t.spaceAfterPt!==void 0?{spaceAfterPt:t.spaceAfterPt}:{},...t.lineSpacing!==void 0?{lineSpacing:t.lineSpacing}:{},...t.indentLeftTwips!==void 0?{indentLeftTwips:t.indentLeftTwips}:{},...t.indentRightTwips!==void 0?{indentRightTwips:t.indentRightTwips}:{},...t.indentFirstLineTwips!==void 0?{indentFirstLineTwips:t.indentFirstLineTwips}:{},...t.contextualSpacing!==void 0?{contextualSpacing:t.contextualSpacing}:{},...t.keepNext!==void 0?{keepNext:t.keepNext}:{},...t.keepLines!==void 0?{keepLines:t.keepLines}:{},...t.widowControl!==void 0?{widowControl:t.widowControl}:{},...t.pageBreakBefore!==void 0?{pageBreakBefore:t.pageBreakBefore}:{},...t.tabStops!==void 0?{tabStops:t.tabStops}:{}}))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the paragraph format could not be written here"};break}case "setPageSetup":{let r;if(t.scope==="section"){let s=e.sectionAnchorParagraphAt(e.state().selection.head.paragraphId);if(s.kind==="unaddressable")return {ok:false,code:"unsupported",reason:"this section holds no paragraph to address it by"};r=s.kind==="anchor"?s.paragraphId:void 0;}let o=t.pageWidth,i=t.pageHeight;if(t.orientation!==void 0&&(o!==void 0||i!==void 0)){let s=r?e.sectionPropertiesAt(r):e.sectionProperties(),l=o??s.pageSize.widthTwips,d=i??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,d):Math.min(l,d),i=t.orientation==="landscape"?Math.min(l,d):Math.max(l,d);}if(!e.setSectionProperties({...o!==void 0?{pageWidthTwips:o}:{},...i!==void 0?{pageHeightTwips:i}:{},...t.orientation!==void 0?{orientation:t.orientation}:{},...t.marginTop!==void 0?{marginTopTwips:t.marginTop}:{},...t.marginRight!==void 0?{marginRightTwips:t.marginRight}:{},...t.marginBottom!==void 0?{marginBottomTwips:t.marginBottom}:{},...t.marginLeft!==void 0?{marginLeftTwips:t.marginLeft}:{},...r!==void 0?{anchorParagraphId:r}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the page setup change was refused"};break}case "toggleList":if(!e.toggleList(t.kind))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the list change was refused"};break;case "adjustIndent":if(!e.adjustIndent(t.direction))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the selection is already at that indent level"};break;case "insertBreak":if(t.kind==="section"||t.kind==="sectionContinuous"){let r=t.kind==="section"?"nextPage":"continuous";if(!e.insertSectionBreak(r))return {ok:false,code:"invalidArgs",reason:e.sectionBreakRefusal(r)??e.state().lastRejection??"the section break was refused"};break}if(t.kind==="page"){e.insertPageBreak();break}e.insertLineBreak();break;case "insertHyperlink":{let r=t.href.startsWith("#");if(!e.hyperlinks.applyHyperlink({...r?{anchor:t.href.slice(1)}:{url:t.href},...t.text!==void 0?{text:t.text}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the link was refused: the target is not an allowed scheme, or there is no text to link"};break}case "removeHyperlink":if(!e.hyperlinks.removeHyperlink())return {ok:false,code:"notFound",reason:"there is no hyperlink at the selection"};break;case "insertTextBox":return Tw(e);case "insertText":if(e.type(t.text),e.state().lastRejection==="the table of contents is generated and read-only"||e.state().lastRejection===Gi)return {ok:false,code:"invalidArgs",reason:e.state().lastRejection};break;case "deleteText":if(kn(e))return cm(e,{type:"deleteImage"},n?.editor);e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let i=zc(e,t.target);if(!i.ok)return {ok:false,code:i.code,reason:i.reason};e.setSelection(i.selection);}let r=t.type==="proposeInsertion"?"insertion":t.type==="proposeDeletion"?"deletion":"replacement",o=t.type==="proposeInsertion"?t.text:t.type==="proposeReplacement"?t.replaceWith:"";if(!e.proposeTextChange(r,o,t.author))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??`${t.type} was refused`};break}case "undo":e.undo();break;case "redo":e.redo();break;case "insertTable":if(!e.insertTable(t.rows,t.cols))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table could not be inserted here"};break;case "insertToc":if(!e.insertToc())return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be inserted"};break;case "editTextFormField":return e.editTextFormField()?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"field options are unavailable"};case "refreshToc":if(!e.refreshToc(t.tocId,t.mode))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be refreshed"};break;case "editHeaderFooter":return tM(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return nM(e,t);case "linkHeaderFooterToPrevious":return rM(e,t);case "unlinkHeaderFooterFromPrevious":return oM(e,t);case "setHeaderFooterOptions":return iM(e,t);case "insertPageField":return aM(e,t);case "insertNote":return sM(e,t);case "deleteNote":return lM(e,t);case "convertNote":return dM(e,t);case "convertAllNotes":return cM(e,t);case "setNoteProperties":return uM(e,t);case "insertRow":case "deleteRow":case "insertColumn":case "deleteColumn":case "deleteTable":case "setCellFill":case "setTableCellVerticalAlignment":case "setTableBorders":case "commitTableColumnDividerResize":case "commitTableRightEdgeResize":case "mergeCells":case "splitCell":case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":{if(!ao(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Hr({command:t,part:e.session.part(),layout:e.layout(),storeRevision:e.session.packageRevision(),selection:e.state().selection,cellSelection:e.state().cellSelection,themeColors:e.session.documentThemeColors(),editable:e.session.editable,viewing:e.editingMode()==="view"});return e.applyTableCommandPlan(r)}case "selectAll":return e.selectAll(),{ok:true,changed:false};case "copy":{let r=e.copyFlavours();return r.reason?{ok:false,code:"unsupported",reason:r.reason}:(hh(r.text,r.html),{ok:true,changed:false})}case "cut":{let r=e.copyFlavours();if(r.reason)return {ok:false,code:"unsupported",reason:r.reason};hh(r.text,r.html),e.deleteSelection();break}case "paste":{let r=t.html?Di(t.html):null;if(r&&vc(r.bytes))return {ok:false,code:"unsupported",reason:"unsupported-content"};if(!e.pasteRich(t.text,t.html??null))return {ok:true,changed:false};break}case "pasteWithoutFormatting":e.insertPlainText(t.text);break;case "setSelection":{if("range"in t&&jp(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&Ct(t.anchor)?{anchor:t.anchor}:"range"in t&&zo(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Gw(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let i=g_(e,o.selection);return i.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):i}default:return ks(t)?cm(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function fM(e,t){for(let n of e.layout().pages)for(let r of [n.footnotes,n.endnotes])if(r){for(let o of r.notes)for(let i of ya(o.fragments))if(i.paragraphId===t)return o.scopeId}return null}function p_(e,t){let n=e.layout().pages;for(let r=0;r<n.length;r+=1){let o=n[r];for(let i of [o.header,o.footer])if(i){for(let a of ya(i.fragments))if(a.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function m_(e,t){return e.kind!==t.kind?false:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:e.kind==="notesPart"&&t.kind==="notesPart"?e.noteKind===t.noteKind:true}function g_(e,t){let n=Rt(e.session,t.head.paragraphId,{kind:"body"}),r=Rt(e.session,t.anchor.paragraphId,{kind:"body"});if(!m_(n,r))return {ok:false,code:"unsupported",reason:"a selection cannot span two stories"};let o=e.activeScope();if(n.kind==="body")return o.kind!=="body"&&(e.exitNote?.(),e.exitHeaderFooter?.()),{ok:true,changed:false};if(n.kind==="headerFooter"){if(o.kind==="headerFooter"&&o.rId===n.rId)return {ok:true,changed:false};e.exitNote?.();let l=p_(e,t.head.paragraphId);return e.enterHeaderFooter?.({rId:n.rId,...l?{pageIndex:l.pageIndex,sectionIndex:l.sectionIndex}:{}})?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that header or footer could not be opened"}}let i=fM(e,t.head.paragraphId);return i?(t.anchor.paragraphId===t.head.paragraphId?i:fM(e,t.anchor.paragraphId))!==i?{ok:false,code:"unsupported",reason:"a selection cannot span two stories"}:o.kind==="note"&&o.id===i?{ok:true,changed:false}:(e.exitHeaderFooter?.(),e.enterNote?.(i)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that note could not be opened"}):{ok:false,code:"notFound",reason:"that note is not laid out"}}var h_=new Set(["toggleMark","setMarkAttr","setAlignment","setParagraphDirection","clearFormatting","setLineSpacing","setParagraphSpacing","setParagraphStyle","setParagraphFormat"]),Xc=class{constructor(t,n,r){this.owner=t;this.diagnose=n;this.target=r;}owner;diagnose;target;records=new WeakMap;undoEpoch=0;burst;diagnoseWrites(t,n,r=false){if(t.type!=="setMarkAttr"||!n.ok||!n.changed)return;let o=`${r}:${t.mark}:${t.attr}:${this.target()}`,i=Date.now(),a=this.burst,s=a?.key===o&&i-a.time<=250?a.count+1:1;this.burst={key:o,time:i,count:s},s===3&&this.diagnose({kind:r?"possible-fragmented-gesture":"possible-ungrouped-gesture",reason:"Three rapid formatting writes started separate groups at the same selection. For a continuous control, retain one handle with bindHistoryGroup; separate clicks may be intentional."});}begin(){let t=this.owner(),n={token:Symbol("gesture"),owner:t?new WeakRef(t):void 0,closed:false,committed:false,undoEpoch:this.undoEpoch},r=y_(n,new WeakRef(this));return this.records.set(r,n),r}owns(t){return t!==void 0&&t===this.owner()}gate(t,n){let r=n?.historyGroup;return r===void 0?null:!this.records.get(r)||r.state!=="open"?{ok:false,code:"unsupported",reason:"historyGroup must be an open handle from this editor and document"}:h_.has(t.type)?null:{ok:false,code:"unsupported",reason:`${t.type} does not support history grouping`}}note(t){(t.type==="undo"||t.type==="redo")&&this.undoEpoch++;}run(t,n,r,o){let i=r?.historyGroup,a=i&&this.records.get(i);if(!a){let m=zs(t,void 0,o);return this.diagnoseWrites(n,m),m}let s=a.committed,l,d,c=il(a.token,(m,h)=>{l=m,d=h;},()=>zs(t,a.token,o));if(!c.ok)return c;let p=l===void 0?{kind:"none",reason:"no-history"}:l==="split"||l==="started"&&s?{kind:"split",reason:d??(a.undoEpoch!==this.undoEpoch?"undo-redo":"history-boundary")}:{kind:l};return l&&(a.committed=true,a.undoEpoch=this.undoEpoch),p.kind==="started"?this.diagnoseWrites(n,c,true):this.burst=void 0,p.kind==="split"&&this.diagnose({kind:"split",reason:p.reason??"history-boundary"}),{...c,history:p}}};function y_(e,t){return Object.freeze({get state(){return !e.closed&&t.deref()?.owns(e.owner?.deref())?"open":"closed"},end(){e.closed=true,e.owner=void 0;}})}var mM={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none"};function gM(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:vI(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`}}function hM(){let e={...mM};return {moved(t,n){let r=gM(t,n),o=Ld(r.selection,e.selection)&&r.pendingFormat===e.pendingFormat&&r.headerFooter===e.headerFooter&&r.drawingIntent===e.drawingIntent&&r.formatPainter===e.formatPainter;return e=r,!o},adopt(t){e=gM(t.state(),t);},reset(){e={...mM};}}}function b_(e,t){let n=e.byteLength;if(n<22)return false;let r=new DataView(e.buffer,e.byteOffset,n),o=Math.max(0,n-(64*1024+22)),i=-1;for(let d=n-22;d>=o;d-=1)if(r.getUint32(d,true)===101010256){i=d;break}if(i<0)return false;let a=r.getUint16(i+10,true),s=r.getUint32(i+16,true),l=0;for(let d=0;d<a;d+=1){if(s+46>n||r.getUint32(s,true)!==33639248)return false;if(l+=r.getUint32(s+24,true),l>=t)return true;s+=46+r.getUint16(s+28,true)+r.getUint16(s+30,true)+r.getUint16(s+32,true);}return false}var v_=2e3,x_=40;function bh(e){if(typeof MessageChannel!="function"){setTimeout(e,0);return}let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e();},t.port2.postMessage(null);}function yM(e){let t=null,n=()=>{if(!t)return null;let{bytes:r}=t;return t.cancel(),t=null,r};return {shouldYield:r=>typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"&&(r.byteLength>=524288||b_(r,524288)),schedule(r){let o=null,i=null,a=e.prepare?()=>e.prepare(r):null,s=false,l=false,d=()=>{if(s)return;if(a){let m=a;a=null;let h;try{h=m();}catch{}if(typeof h=="function"){a=h,bh(d);return}if(!h){o=setTimeout(d,0);return}let b=true,y=()=>{b&&(b=false,o!==null&&clearTimeout(o),o=setTimeout(d,0));};o=setTimeout(y,v_),h.then(y,y);return}l=true,e.mount(r);let p=()=>{if(!(s||t!==u)){if(e.continueOpen&&!e.continueOpen(x_)){bh(p);return}t=null,e.continueOpen&&e.scheduled();}};e.continueOpen?bh(p):t=null;},c=requestAnimationFrame(()=>{i!==null&&clearTimeout(i),i=null,o=setTimeout(d,0);});i=setTimeout(()=>{cancelAnimationFrame(c),d();},250);let u={bytes:r,mounted:()=>l,cancel:()=>{s=true,cancelAnimationFrame(c),o!==null&&clearTimeout(o),i!==null&&clearTimeout(i);}};t=u,e.scheduled();},cancel:n,flush(){let r=t;if(!r)return;let o=r.mounted();if(n(),o||e.mount(r.bytes),e.continueOpen)for(;!e.continueOpen(Number.POSITIVE_INFINITY););o&&e.scheduled();},isScheduled:()=>t!==null}}var xh=40,vh=16,bM=32,Sh=new WeakMap;function wh(e,t){let n=kj(t.contentLockPolicy);return n?{...e,contentLockPolicy:n}:e}function S_(e,t,n){let r=De$1(e),o=()=>{let i=performance.now()+xh;for(;;){let a=r.next();if(a.done){let s=k$3(a.value,t);return Sh.set(e,s),n(s)}if(performance.now()>=i)return o}};return o}function vM(e){let t=Sh.get(e);return t===void 0?{}:(Sh.delete(e),{openedSession:t,progressiveOpen:true})}function xM(e,t,n){return r=>S_(r,e(),o=>{let i=o.ok?t(r,o.session):null;return o.ok&&i?w_(o.session,i,n):void 0})}function SM(e){let t=null;return {set(n){t=n;let r=e();r&&Nm(r,n);},adopt:n=>Nm(n,t)}}function w_(e,t,n){let r=e.part().root.children.find(h=>h.kind==="body"),o=r?.kind==="body"?r.children:[],i=[];for(let h of o){if(h.kind==="table")for(let b of h.children)i.push(b);i.push(h);}let a=[];for(let h=0;h<o.length;){let b=o[h];if(b.kind==="table"){for(let x=0;x<b.children.length;x+=bM){let v=x;a.push(()=>{tO(e,b,v,v+bM);});}a.push(()=>rh(e,[b])),h+=1;continue}let y=h;for(;y<o.length&&y-h<vh&&o[y].kind!=="table";)y+=1;let g=o.slice(h,y);a.push(()=>rh(e,g)),h=y;}let s=0,l=0,d=false,c,u=Pa$1(e.part().root),p=[()=>{let h=performance.now()+xh;return u(()=>performance.now()>=h)},()=>(e.reviewItems(),true)],m=()=>{if(!t())return;let h=performance.now()+xh;if(!d){for(;s<a.length&&performance.now()<h;)a[s++]();return s<a.length||(d=true,c=n()),m}if(l<i.length){for(;l<i.length&&performance.now()<h;)Fe$2(i.slice(l,l+vh)),l+=vh;return m}let b=p[0];return b?(b()&&p.shift(),m):c};return m}function wM(e){return {...e.tableInteractionLabel?{tableInteractionLabel:e.tableInteractionLabel}:{},...e.imageDecodePort?{imageDecodePort:e.imageDecodePort}:{},...e.lockedControlNavigation==="atomic"?{lockedControlNavigation:"atomic"}:{}}}function IM(e){let t=[];return Object.assign(r=>{for(let o of [...e.customNodeDiagnostics,...t])try{o(r);}catch{}},{observe(r){t.push(r);}})}function kM(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function RM(e){return e.kind==="comment"}function PM(e){let{surface:t}=e,n=t?.retainedSelection()??t?.state().selection??null;if(!n)return null;let{anchor:r,head:o}=n;if(r.paragraphId===o.paragraphId&&r.offset===o.offset||!t?.publishedLayout())return null;let i=e.bodyOrder(),a=i.get(r.paragraphId)??-1,s=i.get(o.paragraphId)??-1;if(a===-1||s===-1){let d=e.openStoryOrder();a=d.get(r.paragraphId)??-1,s=d.get(o.paragraphId)??-1;}return a===-1||s===-1?null:a<s||a===s&&r.offset<=o.offset?{from:r,to:o}:{from:o,to:r}}function k_(e){let t=new Map;for(let n of e){let r=n.item;if(!RM(r))continue;let o=t.get(r.id);if(o===void 0){t.set(r.id,r);continue}if(o.comment!==r.comment)return "ambiguous"}return t}function R_(e,t){let n=e.filter(i=>i.key===t);if(n.length===0)return {ok:false,code:"notFound",reason:"no review item with that key"};let r=n.map(i=>i.item).filter(RM);if(r.length===0)return {ok:false,code:"kindMismatch",reason:"the review item is not a comment"};let o=r[0];for(let i of r)if(i.comment!==o.comment)return {ok:false,code:"ambiguous",reason:"duplicate comment records share that key"};return o}function TM(e,t,n){if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:e.proReviewReason};if(e.editingMode==="viewing")return {ok:false,code:"locked",reason:"the document is open for viewing"};let r=e.placements(),o=R_(r,t);if(!("kind"in o))return o;if(!e.surface)return {ok:false,code:"notFound",reason:"no review item with that key"};let i=k_(r);if(i==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let a=o,s=new Set;for(;a.parentId!==void 0&&!s.has(a.id);){s.add(a.id);let c=i.get(a.parentId);if(!c)break;a=c;}let l=false,d=false;return e.surface.commitReviewOps(()=>{let c=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(a.id,n),d=l&&e.surface.session.packageRevision()!==c,{committed:d}},"comment-resolve"),l?(d&&e.bump(),{ok:true,changed:d}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function CM(e,t,n){return e.kind==="comment"&&e.resolved?{ok:false,code:"unsupported",reason:"a resolved comment takes no replies"}:n.length===0||t.trim().length===0?{ok:false,code:"invalidArgs",reason:"a reply needs both an author and text"}:e.kind==="custom"?{ok:false,code:"unsupported",reason:"a custom node card takes no replies"}:null}var P_=Object.freeze(["Arial","Calibri","Cambria","Consolas","Courier New","Garamond","Georgia","Helvetica","Open Sans","Roboto","Times New Roman","Verdana"]),T_=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function EM(e,t){let n=new Map,r=s=>{if(s===void 0||!T_.test(s))return;let l=s.toLowerCase();n.has(l)||n.set(l,s);};r(g$2(e));let o=e?.substitutions??[],i=new Set(o.map(s=>s.to.family.toLowerCase()));for(let s of o)r(s.from.family);for(let s of e?.sources??[])i.has(s.request.family.toLowerCase())||r(s.request.family);for(let s of a$4([e?.supportedFamilies]))r(s);for(let s of P_)r(s);for(let s of t)r(s);let a=[...n.values()];return a.sort((s,l)=>s<l?-1:s>l?1:0),a}var OM=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),MM=e=>new a(e.reason,e.reason==="overLimit"?"an embedded font exceeds the font byte budget":"an embedded font part declares an invalid family name",{request:e.request});function AM(e,t){return A$1(e,t)}function Ih(e,t,n){return B$2(e,t,n)}var FM=a$1;function Jt(e,t){if(!e)throw new Error(t)}function LM(e){let t=0;for(let n=0;n<e.length;n+=4){let r=(e[n]||0)*16777216+(e[n+1]||0)*65536+(e[n+2]||0)*256+(e[n+3]||0)>>>0;t=t+r>>>0;}return t}function NM(e,t=0){Jt(e instanceof Uint8Array&&e.length>=12&&e.length<=FM,"Unsupported font byte length"),Jt(Number.isSafeInteger(t)&&t>=0,"Invalid face index");let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=(k,P)=>{Jt(Number.isSafeInteger(k)&&Number.isSafeInteger(P)&&k>=0&&P>=0&&k+P<=e.length,"Font range exceeds source");},o=k=>String.fromCharCode(...e.subarray(k,k+4));if(o(0)!=="ttcf")return Jt(t===0,"Face index requires a collection"),Jt([65536,1330926671,1953658213].includes(n.getUint32(0)),"Unsupported SFNT version"),e.slice();let i=n.getUint32(4);Jt(i===65536||i===131072,"Unsupported TTC version");let a=n.getUint32(8);Jt(a>0&&t<a,"Collection face absent"),r(12,a*4+(i===131072?12:0));let s=12+a*4+(i===131072?12:0),l=n.getUint32(12+t*4);r(l,12);let d=n.getUint32(l);Jt([65536,1330926671,1953658213,1954115633].includes(d),"Unsupported face version");let c=n.getUint16(l+4);Jt(c>0,"Missing face tables"),r(l,12+c*16),Jt(l>=s,"Selected directory overlaps collection header");let u=[[0,s],[l,l+12+c*16]],p=[],m=new Set;for(let k=0;k<c;k++){let P=l+12+k*16,T=o(P),C=n.getUint32(P+8),E=n.getUint32(P+12);Jt(/^[\x20-\x7e]{4}$/.test(T)&&!m.has(T),"Invalid or duplicate table tag"),m.add(T),r(C,E);for(let[w,I]of u)Jt(E===0||C>=I||C+E<=w,"Table overlaps collection directory");p.push({name:T,offset:C,length:E,destination:0});}let h=p.filter(k=>k.length>0).sort((k,P)=>k.offset-P.offset);for(let k=1;k<h.length;k++)Jt(h[k].offset>=h[k-1].offset+h[k-1].length,"Selected face tables overlap");let b=p.find(k=>k.name==="head");Jt(b&&b.length>=54,"Missing or truncated head table"),p.sort((k,P)=>k.name<P.name?-1:k.name>P.name?1:0);let y=12+c*16;for(let k of p)k.destination=y,y+=k.length+3&-4,Jt(y<=FM,"Standalone face exceeds byte ceiling");let g=new Uint8Array(y),x=new DataView(g.buffer);x.setUint32(0,d),x.setUint16(4,c);let v=2**Math.floor(Math.log2(c));x.setUint16(6,v*16),x.setUint16(8,Math.log2(v)),x.setUint16(10,c*16-v*16);for(let[k,P]of p.entries()){let T=12+k*16;for(let C=0;C<4;C++)g[T+C]=P.name.charCodeAt(C);g.set(e.subarray(P.offset,P.offset+P.length),P.destination),P.name==="head"&&x.setUint32(P.destination+8,0),x.setUint32(T+4,LM(g.subarray(P.destination,P.destination+P.length))),x.setUint32(T+8,P.destination),x.setUint32(T+12,P.length);}return x.setUint32(b.destination+8,2981146554-LM(g)>>>0),g}var DM=Object.freeze({installed:0,alias:()=>{},dispose(){}});function C_(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1)t=t*31+n.charCodeAt(r)>>>0;return `docx-embedded-${t.toString(36)}`}var Yc=e=>e.trim().toLowerCase();function E_(){let t=(typeof document<"u"?document:void 0)?.fonts;return !t||typeof FontFace>"u"?{}:{fontSet:t,createFontFace:(n,r,o)=>new FontFace(n,r.slice().buffer,o)}}async function HM(e,t=E_(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return DM;let i=new Map;for(let d of e){let c=Yc(d.request.family),u=i.get(c);u?u.push(d):i.set(c,[d]);}let a=new Map,s=[];if(await Promise.all([...i].map(async([d,c])=>{let u=C_(c.map(m=>`${m.hash}:face:${m.faceIndex}`)),p=false;await Promise.all(c.map(async m=>{try{let h=m.bytes.length>=4&&m.bytes[0]===116&&m.bytes[1]===116&&m.bytes[2]===99&&m.bytes[3]===102;if(h&&m.faceIndex===0&&!l(m.bytes,0).valid)throw new Error("Invalid collection face");let b=h&&m.faceIndex!==0?NM(m.bytes,m.faceIndex):m.bytes;if(!h&&m.faceIndex!==0)throw new Error("Font face index requires a collection");let y=o(u,b,{weight:String(m.request.weight),style:m.request.style});await y.load(),r.add(y),s.push(y),p=!0;}catch{}})),p&&a.set(d,u);})),s.length===0)return DM;for(let d of n){let c=Yc(d.from.family);if(a.has(c))continue;let u=a.get(Yc(d.to.family));u!==void 0&&a.set(c,u);}let l$1=false;return {installed:s.length,alias:d=>l$1?void 0:a.get(Yc(d)),dispose(){if(!l$1){l$1=true;for(let d of s)try{r.delete(d);}catch{}}}}}var Rh=44,Js=.1,el=5;var la={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},O_={type:"fit",fit:"pageWidth"},Qc={type:"fixed"};function Jc(e){return e==="auto"?la:!e||typeof e!="object"?null:e.type==="fixed"?Qc:e.type==="fit"&&e.fit==="pageWidth"?eu(e,la)?la:e:null}function eu(e,t){return e===t?true:e.type!==t.type?false:e.type!=="fit"||t.type!=="fit"?true:e.fit===t.fit&&Object.is(e.minZoom,t.minZoom)&&Object.is(e.maxZoom,t.maxZoom)}function Ph(e,t,n="float"){return e?.type!=="fit"?t:n==="shrinkPage"?e.minZoom!==void 0&&Number.isFinite(e.minZoom)?kh(e.minZoom):.1:e.maxZoom!==void 0&&e.maxZoom<5?e.maxZoom:null}function da(e){return e.type==="fit"}function _M({availableWidthPx:e,pageWidthPx:t,gutterPx:n=24,minZoom:r=.1,maxZoom:o=5}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return null;let i=Number.isFinite(n)&&n>0?n:0,a=Math.max(e-2*i,e*.5),s=Number.isFinite(r)?kh(r):.1,l=Number.isFinite(o)?kh(o):5,d=Math.floor(a/t*100)/100;return Math.min(Math.max(d,s),Math.max(l,s))}function kh(e){return Math.min(Math.max(e,.1),5)}var M_=88;function A_(e,t=false){let n=Bt(e);if(!n)return null;let r=n.clientWidth;if(!Number.isFinite(r)||r<=0)return null;let o=n.ownerDocument.defaultView?.getComputedStyle(n);if(t&&n.hasAttribute("data-review-pane")){let s=Number.parseFloat(o?.getPropertyValue("--docx-review-strip")??""),l=Number.isFinite(s)?s:M_,d=l/2,c=Number.parseFloat(o?.getPropertyValue("--docx-nav-shift")??""),u=Number.parseFloat(o?.getPropertyValue("--docx-review-gutter-start")??""),p=(Number.isFinite(c)?c:0)+(Number.isFinite(u)?u:d)-d;return Math.max(r-l-Math.max(p,0),0)}if(!o)return r;let i=Number.parseFloat(o.paddingLeft)||0,a=Number.parseFloat(o.paddingRight)||0;return Math.max(r-i-a,0)}function BM(e){let t=null,n=null,r=null,o=null;function i(){if(r===null)return;n?.ownerDocument.defaultView?.cancelAnimationFrame(r),r=null;}function a(){let l=e.mode();if(!da(l))return;let d=e.container();if(!d)return;let c=e.reviewPaneScrolls?.()===true&&Ph(l,e.zoom())!==null,u=A_(d,c);if(u===null)return;let p=e.pageWidthPx();if(p===null)return;o=e.pageWidthTwips();let m=_M({availableWidthPx:u,pageWidthPx:p,...l.minZoom!==void 0?{minZoom:l.minZoom}:{},...l.maxZoom!==void 0?{maxZoom:l.maxZoom}:{}});if(m===null||m===e.zoom())return;let h=Bt(d),b=h!==null&&h.scrollLeft===0;e.applyZoom(m),b&&h&&h.scrollLeft!==0&&(h.scrollLeft=0);}function s(){let l=n?.ownerDocument.defaultView;if(!l?.requestAnimationFrame){a();return}r===null&&(r=l.requestAnimationFrame(()=>{r=null,a();}));}return {refitIfPageResized(){let l=e.pageWidthTwips();l===null||l===o||a();},attach(){this.detach();let l=e.container();if(!l)return;let d=Bt(l);d&&(n=d,typeof ResizeObserver<"u"&&(t=new ResizeObserver(s),t.observe(d)),a());},refit:a,detach(){i(),t?.disconnect(),t=null,n=null,o=null;}}}function qM(e,t){let n=e.zoom!==void 0&&Number.isFinite(e.zoom)&&e.zoom>=.1&&e.zoom<=5?e.zoom:null,r=n??1,o=Jc(e.zoomMode??(n!==null?Qc:"auto"))??la;function i(l,d){if(l===r)return d?.(),true;let c=t.surface();return c&&!Fm(c,l*(96/72))?false:(r=l,d?.(),t.bump(),t.emitSelectionChange(),true)}function a(){o=Qc,s.detach();}let s=BM({container:t.container,mode:()=>o,pageWidthPx:()=>{let l=t.surface()?.layout().pages[0]?.box;return l?l.width*(96/72):null},pageWidthTwips:()=>t.surface()?.sectionProperties().pageSize.widthTwips??null,zoom:()=>r,applyZoom:l=>{i(l);},reviewPaneScrolls:()=>t.reviewPaneScrolls?.()===true});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{da(o)&&s.attach();},detach:()=>s.detach(),refit:()=>s.refit(),refitIfPageResized:()=>s.refitIfPageResized(),setZoom(l){if(!Number.isFinite(l)||l<.1||l>5)return {ok:false,code:"invalidArgs",reason:`zoom must be between ${.1} and ${5}, got ${l}`};let d=da(o);return l===r?d?(a(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:i(l,d?a:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let d=Jc(l);return d?eu(d,o)?{ok:true,changed:false}:(o=d,da(d)?s.attach():s.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(l)}`}}}}function $M(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function VM(e,t){return {getZoom:()=>e.zoom(),setZoom:n=>e.setZoom(n),getZoomMode:()=>e.mode(),setZoomMode:n=>e.setZoomMode(n),getRenderScale:()=>e.scale(),getPageGeometry:()=>{let n=t();return n?n.layout().pages.map(r=>({index:r.index,box:$M(r.box),contentBox:$M(r.contentBox)})):[]}}}var KM=new Map;function jM(e){let t=e,n=null,r=null;return {current:()=>t,set:o=>{t=o;},authorsFor:o=>{if(n&&n.slots===o&&n.colors===t)return n.value;let i=c(o,t);return n={slots:o,colors:t,value:i},i},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:b$1(t)}),r.value.get(o))}}function Th(e){let t=[];return {current:()=>t[t.length-1]??e,push:n=>(t.push(n),()=>{let r=t.lastIndexOf(n);r>=0&&t.splice(r,1);})}}function WM(e){let t=Ni$1(e),n=new Intl.Locale(t).baseName;for(;n&&!Object.hasOwn(locales,n);){let s=n.lastIndexOf("-");n=s<0?"":n.slice(0,s);}let r=new Intl.Locale(t).maximize(),o=n?void 0:Object.keys(locales).find(s=>{let l=new Intl.Locale(s).maximize();return l.language===r.language&&l.script===r.script}),i=n||o||"en",a=createT(deepMerge(en,i==="en"?void 0:locales[i]),i);return {locale:t,labels:{title:a("toolbar.tableOfContents")}}}function ZM(e){let t=e.mode,n=e.translate,r=n?l$1(n):k$1,o=WM(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:i=>Xp(t,i),setMode(i){return t===i?false:(t=i,true)},translate:()=>n,drawingStrings:()=>r,setTranslate(i){if(n===i)return null;n=i;let a=i?l$1(i):k$1;return j$3(r)===j$3(a)?(r=a,null):(r=a,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(i){let a=WM(i);return o.locale===a.locale?null:(o=a,o.labels)}}}function UM(e,t){return {setTranslate(n){let r=e.setTranslate(n);t.surface()?.setTranslate(e.translate()),r!==null&&(t.surface()?.setDrawingStrings(r),t.bump(),t.emitSelectionChange());},setLocale(n){let r=e.setLocale(n);r!==null&&(t.surface()?.setLocale(e.locale()),t.surface()?.setTocLabels(r),t.bump(),t.emitSelectionChange());}}}var D_=Object.freeze({kind:"body"}),H_=Object.freeze([]);function __(e){let t=dx(e.fontShaping),n,r=null,o=null,i=-1,a$3=()=>o!==null||!!R&&Ls(R),s=ZM(e),l=zm(e.author),d$1=e.container??null,c=a$2(e.modules),u=IM(c),p=c.review!==null,m=jO(c.review?.pane,{enabled:p,changed:(M,Q)=>{Te&&M.revisionsIn!==Q.revisionsIn&&!m.shows(R?.session.reviewItems()??[])&&(Te=false),me(),ke(),on.refit();}}),h$1=null,b=new WeakMap,y=yM({mount:M=>Kr(M),continueOpen:M=>{if(!R)return true;let Q=gt.continueOpen(()=>Dm(R,M));return Q&&gt.openSettled(R),Q},prepare:xM(()=>wh(sh(c,u),e),(M,Q)=>r===M?null:(o=Q,()=>o===Q),()=>ge.schedule(true)),scheduled:()=>{me(),ke();}}),g=s.mode()==="view"?"viewing":"editing",x=null,v,k=false,P=mc(),T=jM(e.revisionStyles),C=e$1(),E=false,w=false,I=null,L=()=>({reviewEnabled:p,hasAuthor:!!l}),A=false,B=null,$=nI({stillMissing:()=>!F&&l===void 0&&An(null)===cr,emit:M=>Qn(M)}),j$1=s.openingModeDecision(L());j$1.mode!==null&&(g=j$1.mode),j$1.rejection!==null&&(I=j$1.rejection),$.report(j$1.rejection);let R=null,G=null,X$1=SM(()=>R),ie=null,pe=null,K=hM(),z=PE(),H=Th({}),Z$1=Th({}),F=false,_,W,N=null,q=()=>{},U=0;function ne(){N?.dispose(),N=null;}let re=0,ee,oe=()=>typeof e.fonts=="function"?ee:e.fonts,ge=oO(()=>{let M=o??R?.session;if(F||!M)return null;let Q=o?void 0:On().formatting?.fontFamily;return {generation:re,dynamic:typeof e.fonts=="function",families:()=>rO(M,Q,g$2(oe()))}},async M=>{let Q=o?{session:o}:R;Q&&await il(re,Q,M);}),Ie=false,_e=null,Mt=M=>(_e||(_e=zE(d$1?Yi(d$1.ownerDocument):null)),_e(M)),Ne=new Set,Ce=new Set,Ve=M=>Ne.has(M.toLowerCase())||N?.alias(M)!==void 0,Ye=()=>!R||Ie?H_:XE(R.session.renderedFontFamilies(),Ve,Mt,Ce),$t=0,Je=null,pt,we=null,Ue=-1,mt=0,Me=-1,Te=false,Ke=e.reviewDisplayMode??(p?"all-markup":"proposed");if(!["all-markup","simple-markup","proposed","original"].includes(Ke))throw new TypeError("Invalid reviewDisplayMode");if(e.reviewDisplayMode&&e.reviewDisplayMode!=="proposed"&&!p)throw new TypeError("reviewDisplayMode requires a review module");let Ee=gc({fieldResults:e.fieldResults,collaborationModel:c.collaboration??void 0}),hr=uO(M=>{R?.setShowParagraphMarks(M),me(),ke();}),Yn=VO({surface:()=>R,destroyed:()=>F,editingMode:()=>g,hostViewOnly:()=>s.mode()==="view",publish:()=>{me(),ke();},decision:()=>xo(),tracking:vo,adopt:M=>{I=M.rejection??An(null),M.mode!==null&&(w=M.mode==="viewing",an(M.mode)),me(),ke();}});function me(){$t+=1;}let rn=cE(On),{emitError:Qn,emitDocumentChange:nl,emitSelectionChange:ke}=rn,gt=kE({modules:c,events:rn,customNodes:u}),en=()=>g==="suggesting",hn=TE(e.revisionMarkup,{container:()=>d$1,destroyed:()=>F,contribution:()=>c.review,translate:()=>s.translate(),apply:M=>{R?.setRevisionMarkup(M),me();},changed:M=>{ke(),rn.emitRevisionMarkupChange(M);}});function yr(){hn.destroyDialog(),pe?.(),pe=null,R?.destroy(),R=null,K.reset(),mt+=1;}let on=qM(e,{container:()=>d$1,surface:()=>R,bump:me,emitSelectionChange:ke,reviewPaneScrolls:()=>m.current().overflow==="scroll"}),Vr=()=>on.scale(),jt=MO({surface:()=>R,container:()=>d$1,flushOpen:()=>y.flush()});function Kr(...M){let Q=n?.source!==void 0;try{if(r===M[0]){r=null,ho(M[0],!0);return}rl(...M),n?.mounted(M[0]);}catch(te){if(gt.openCrashed(te),n?.mounted(M[0],te),!Q)throw te}}function rl(M,Q,te){if(te??=b.get(M),b.delete(M),o=null,!d$1){h$1=M,te&&b.set(M,te),ie=null,gt.openDeferred(),me();return}gt.openMounting(),yr();let ve=P.stateKey,be=$g(d$1,M,{scale:Vr(),showParagraphMarks:hr.get(),onToggleParagraphMarks:hr.toggle,defaultFontFamily:g$2(oe()),translate:s.translate(),drawingStrings:s.drawingStrings(),locale:s.locale(),...l?{author:l}:{},...T.current()!==void 0?{revisionStyles:T.current()}:{},reviewAuthorSlots:C,revisionAuthorVisibility:P,initialSelection:Q,initialTextFormInput:te,editingMode:g==="suggesting"?"suggest":g==="viewing"?"view":"edit",revisionDisplayMode:p?Ke:"proposed",revisionMarkup:hn.current(),...wh(sh(c,u),e),...gt.surfaceHooks(en,()=>R),...vM(M),..._?{measurer:_,...W?{producer:W}:{}}:{},...N?{fontAlias:N.alias}:{},...wM(e),...c.collaboration?{collaborationModel:c.collaboration}:{},...Ee.mode==="editable"?{fieldResults:Ee.mode}:{},onHyperlinkPopover:Le=>H.current().onPopover?.(Le),...z.surfaceOptions,onRequestHyperlink:()=>H.current().onRequest?.(),onEquationPopover:Le=>Z$1.current().onPopover?.(Le),onTrackedChange:()=>{Te||!m.opensOnTrackedChange()||(Te=true,me(),ke());},tocLabels:s.tocLabels(),onChange:Le=>{if(!R)return;me(),Yn.sync(),ge.schedule();let Be=p&&Ke!==R.revisionDisplayMode();Be&&(Ke=R.revisionDisplayMode());let se=ve!==P.stateKey||Be;ve=P.stateKey,!(!se&&!K.moved(Le,R))&&ke();}});if(!be.ok){ie=be.detail?`${be.reason}: ${be.detail}`:be.reason,me(),Qn(gn(be.reason,`failed to open document: ${be.reason}`)),gt.openRejected(be.reason,be.limit,be.detail);return}ie=null,R=be.surface,i=re,jt.attach(R,n?.source!==void 0),Yn.prime(),Te=p&&m.opensOnLoad(R.session.reviewItems()),K.adopt(R),B!==null?jr(B,false):ma(),kM(R,c),Ls(R)||gt.openSettled(R),mt+=1,R.setEditable(g!=="viewing"),G!==null&&R.setRemoteCaretLabelHost(G),X$1.adopt(R),x!==null&&R.setReviewActivationExclusions(x,{formattingKinds:v}),pe=be.surface.session.subscribe(Le=>{let Be={revision:be.surface.session.packageRevision(),created:Le.created,deleted:Le.deleted,dirty:Le.dirty};on.refitIfPageResized(),me(),nl(Be);}),n?.contentMounted(M),on.attach(),me(),nl({revision:R.session.packageRevision(),source:n?.source??"load"}),ke(),ge.schedule(true);}function ho(M,Q=false){if(y.cancel(),o=null,r=null,n?.source&&!Q&&d$1&&y.shouldYield(M)){r=M,y.schedule(M);return}if(b=new WeakMap,gt.openStarted(M),Te=false,re+=1,C=e$1(),P.showAll(),_=void 0,W=void 0,ee=void 0,Ne=new Set,Ce=new Set,ne(),q(),q=()=>{},Ie=false,d$1&&!n?.source){let te=Bt(d$1);te&&(te.scrollTop=0,te.scrollLeft=0);}!Q&&d$1&&y.shouldYield(M)?(yr(),y.schedule(M)):Kr(M);}function ol(M,Q=re){RE(M,{config:e,events:rn,diagnostics:gt},()=>!F&&Q===re);}async function il(M,Q,te){let ve=Be=>ol(Be,M),be=e.fonts,Le=Q.session.embeddedFonts();if(!(!be&&Le.length===0)){Ie=true,me();try{let{plan:Be,request:se}=y$1(Q.session,te,oe()),Oe=typeof be!="function"?be:ee?await n$1([ee,j(et=>be(et))],se,{onOriginFailure:({cause:et})=>ve(Li(et))}):await be(se),He=typeof be=="function"?b$2(Oe):Oe;if(F||M!==re){M===re&&(Ie=!1);return}if(ee=Oe,Le.length===0&&(!He||Oe?.supportedFamilies?.length&&!b$2(Oe))){Ie=!1,me(),ke();return}let Ge=(He&&"maxFontBytes"in He?He.maxFontBytes:void 0)??a$1,Fn=AM(He?.sources??[],Ge),nr=Fn.sources;for(let et of Fn.dropped)ve(OM(et));let At=Ih(Le,nr,Ge),So=!1,vr=()=>{if(!So){So=!0;for(let et of At.dropped)ve(MM(et));}},Pt=z$1(f$2({epoch:M,...He,sources:nr},At),Be);if(Pt.sources.length===0){vr(),Ie=!1,me(),He&&ve(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let Wt=await fs(Pt,void 0,t),Zt=()=>!F&&M===re?!1:(t$1(Wt),M===re&&(Ie=!1),!0);if(Zt())return;let wo=et=>{vr(),et&&t$1(et),Ie=!1,me();},xr=(et,ct)=>{let Ln=new Set;for(let ln of ct.sources??[]){let bt=et.fonts.resolve(ln.request);bt instanceof d&&(ve(Li(bt)),Ln.add(h(ln.request)));}return Ln},Wr=xr(Wt,Pt);try{if(Wr.size>0){let et=nr.filter(ko=>!Wr.has(h(ko.request))),ct=et.length!==nr.length;ct&&(At=Ih(Le,et,Ge));let Ln=At.sources.filter(ko=>ct||!Wr.has(h(ko.request))),ln=Wt;if(Pt=z$1(f$2({epoch:M,...He,sources:et},{sources:Ln}),Be),Pt.sources.length===0)return wo(ln);if(Wt=await fs(Pt,void 0,t),t$1(ln),Zt())return;let bt=xr(Wt,Pt);if(bt.size>0){let ko=et.filter(mi=>!bt.has(h(mi.request))),tu=At.sources.filter(mi=>!bt.has(h(mi.request))),it=Wt;if(Pt=z$1(f$2({epoch:M,...He,sources:ko},{sources:tu}),Be),Pt.sources.length===0)return wo(it);if(Wt=await fs(Pt,void 0,t),t$1(it),Zt())return}}}finally{vr();}let ga=Pt.sources.map(et=>{let ct=Wt.fonts.resolve(et.request);return ct instanceof d||ct.id!==et.id?null:{request:et.request,id:ct.id,bytes:ct.bytes,hash:ct.hash,faceIndex:ct.faceIndex}}).filter(et=>et!==null),Sr=await HM(ga,void 0,Pt.substitutions??[]);if(F||M!==re){Sr.dispose(),Zt();return}let Io={embeddedFaces:N,coveredFontFamilies:Ne,documentSubstitutedFamilies:Ce,shapedMeasurer:_,shapedProducer:W,disposeShapedFonts:q};try{N=Sr,Ne=YE(ga,Pt.substitutions??[]),Ce=w$1(Pt,Be,Wt.fonts);let et=S(Vr(),{context:d$1?Yi(d$1.ownerDocument):null,...N?{fontAlias:N.alias}:{}}),ct=ZE(Wt,Pt,et,Vr(),++U);if(_=ct.measurer,W=ct.producer,Ie=!1,R&&i===M&&bR(R,{measurer:_,producer:W,fontAlias:N?.alias,defaultFontFamily:g$2(oe())}),F||M!==re){Sr.dispose(),t$1(Wt);return}}catch(et){throw !F&&M===re&&({embeddedFaces:N,coveredFontFamilies:Ne,documentSubstitutedFamilies:Ce,shapedMeasurer:_,shapedProducer:W,disposeShapedFonts:q}=Io),Sr.dispose(),t$1(Wt),et}q=()=>t$1(Wt),Io.disposeShapedFonts(),Io.embeddedFaces?.dispose(),me(),ke();}catch(Be){if(F||M!==re)return;Ie=false,me(),ve(Li(Be));}}}let ca=$p();function tn(){let M=R?.state()??null;return {scope:R?.activeScope?.()??D_,isLoading:ie===null&&R===null&&h$1===null&&!y.isScheduled(),isOpening:y.isScheduled()&&!n?.source,parseError:ie,editable:R!==null&&R.session.editable&&s.mode()!=="view"&&g!=="viewing"&&!(d$1&&Un(d$1)),zoom:on.zoom(),zoomMode:on.mode(),selection:Bd(R),selectionCollapsed:M===null||M.selection.anchor.paragraphId===M.selection.head.paragraphId&&M.selection.anchor.offset===M.selection.head.offset,formatting:OI(R),table:qd(R),tocContext:ca(M?.contextTocId??null),image:ur(R),page:{current:mm(R),total:ji(R)},canUndo:M?.canUndo??false,canRedo:M?.canRedo??false,pageSetup:MI(y,R),reviewPaneOpen:Te,reviewPane:m.current(),showParagraphMarks:hr.get(),documentProtection:Yn.state(),revisionMarkup:hn.current(),reviewDisplayMode:R&&p?R.revisionDisplayMode():Ke,hasReviewContent:R?.session.hasReviewContent()??false,hiddenReviewAuthors:P.hiddenAuthorList,collaborationStatus:M?.collaborationStatus??"inactive",editingMode:g,lastRejection:I??M?.lastRejection??null,fontSubstitutions:Ye(),formatPainter:M?.formatPainter??Ed}}let yo;function On(){if(Je&&Me===$t)return Je;let M=Je,Q=oe()===yo;yo=oe();let te=l===pt;pt=l;let ve=R?.state().selection??null,be=Ld(ve,we);we=ve;let Le=R?.session.packageRevision()??-1,Be=Le===Ue;Ue=Le;let se=tn(),Oe=se;if(M){let He=Dp(se.formatting,M.formatting)?M.formatting:se.formatting,Ge=Hp(se.page,M.page)?M.page:se.page,Fn=_p(se.pageSetup??null,M.pageSetup??null)?M.pageSetup:se.pageSetup,nr=Bp(se.selection,M.selection)?M.selection:se.selection,At=kI(se.image,M.image)?M.image:se.image,So=M.fontSubstitutions!==void 0&&se.fontSubstitutions!==void 0&&M.fontSubstitutions.length===se.fontSubstitutions.length&&se.fontSubstitutions.every((vr,Pt)=>M.fontSubstitutions[Pt]===vr)?M.fontSubstitutions:se.fontSubstitutions;Oe={...se,formatting:He,page:Ge,pageSetup:Fn,selection:nr,image:At,fontSubstitutions:So},qp(Oe,M)&&be&&Be&&te&&Q&&(Oe=M);}return Je=Fd(Oe),Me=$t,Je}if(e.document){let M=Wp(e.document);M?ho(M):(ie=Zp(e.document),Qn(gn("unsupported",ie)),gt.openRejected("unsupported"));}let al=lP({surface:()=>R,activeKey:pi,paneOpen:()=>Te,selectionAnchor:()=>pa()?.anchorY??null,authorFilterKey:()=>P.stateKey});function ua(M){return Aj(M)===null||M.kind==="custom"&&!M.carded?false:!(M.kind==="revision"&&x!==null&&x.includes(M.revisionKind)&&(M.revisionKind!=="format"||v===void 0||v.includes(M.formattingKind??"")))}let sl=ZO();function bo(M){let Q=Aj(M)?.partName;if(!Q||!R||Q===R.session.part().name)return null;for(let te of R.session.headerFooterResolutionBySection())for(let ve of ["header","footer"]){let be=ve==="header"?te.headers:te.footers;for(let Le of be.values())if(Le.partName===Q)return {kind:ve,rId:Le.rId}}return null}function yn(M){let Q=Aj(M),te=R?.publishedLayout();return !Q||!te?null:GO(te).get(Q.start.paragraphId)??null}function Jn(M){let Q=Aj(M)?.partName;if(!Q||!R)return null;for(let te of ["footnote","endnote"])if(ch$1(R.session.currentPackage(),te)?.name===Q)return {kind:"notesPart",noteKind:te};return null}function fa(M){let Q=bo(M);return Q!==null?{kind:"headerFooter",rId:Q.rId}:Jn(M)??{kind:"body"}}let qt=()=>`${new Date().toISOString().slice(0,19)}Z`;function ll(){return PM({surface:R,bodyOrder:()=>{let M=R?.publishedLayout();return M?XO(M):new Map},openStoryOrder:fi})}function Mn(){let M=R?.activeScope();if(M?.kind==="headerFooter")return {kind:"headerFooter",rId:M.rId};if(M?.kind==="note"){let Q=pc$1(M.id);if(Q)return {kind:"notesPart",noteKind:Q.noteKind}}return {kind:"body"}}function Vt(M){if(!R)return {kind:"body"};let Q=M.slice(0,M.indexOf("#"));if(Q.length===0||Q===R.session.part().name)return {kind:"body"};for(let te of R.session.headerFooterResolutionBySection())for(let ve of [te.headers,te.footers])for(let be of ve.values())if(be.partName===Q)return {kind:"headerFooter",rId:be.rId};for(let te of ["footnote","endnote"])if(ch$1(R.session.currentPackage(),te)?.name===Q)return {kind:"notesPart",noteKind:te};return Mn()}function fi(){if(!R)return new Map;let M=Mn();if(M.kind==="body")return new Map;let Q=new Map;for(let[te,ve]of R.session.paragraphIdsIn(M).entries())Q.set(ve,te);return Q}function It(M){if(M.kind==="revision"){let te=M.ranges;if(te.length===0)return null;let be=M.revisionKind==="replace"||M.revisionKind==="insert"||M.revisionKind==="delete"?te[te.length-1]:te[0];return {start:te[0].start,end:be.end}}let Q=Aj(M);return Q?{start:Q.start,end:Q.end}:null}function pa(){if(R&&R.activatedReviewKey()!==null)return null;let M=ll(),Q=R?.publishedLayout();if(!M||!Q)return null;let te=sl(Q).get(M.from.paragraphId);return te?{pageIndex:te.pageIndex,anchorY:te.contentY+X(te,M.from.paragraphId,M.from.offset)}:null}function pi(){return R?.activeReviewKey()??null}function kt(M){if(!p)return [];let Q=sO(Xm(R?.session.reviewItems()??[],P),M),te=M?.placement!==false,ve=null;if(te&&Q.length>0){let se=R?.publishedLayout()??null;se&&(ve=sl(se));}let be=pi(),Le=se=>{let Oe=bo(se);return Oe===null?1:Oe.kind==="header"?0:2},Be=Q.map((se,Oe)=>({item:se,position:Oe,pageIndex:ve?Z(se,ve)?.pageIndex??null:null,group:Le(se)}));return Be.sort((se,Oe)=>{let He=se.pageIndex??Number.MAX_SAFE_INTEGER,Ge=Oe.pageIndex??Number.MAX_SAFE_INTEGER;return He!==Ge?He-Ge:se.group!==Oe.group?se.group-Oe.group:se.position-Oe.position}),Be.map(({item:se})=>{let Oe=yj(se),He=ve?Z(se,ve):null,Ge={key:Oe,id:se.id,...lh(se)!==void 0?{date:lh(se)}:{},activatable:Vc(se).every(ua),anchorY:He?.y??null,pageIndex:He?.pageIndex??null,isActive:Vc(se).some(Fn=>yj(Fn)===be)};return se.kind==="comment"?{...Ge,kind:"comment",author:se.comment.author,initials:Pj(se.comment),text:Nj(se.comment),resolved:se.resolved,...se.parentId!==void 0?{parentId:se.parentId}:{},...se.parentRevisionId!==void 0?{parentRevisionId:se.parentRevisionId}:{},replyIds:se.replyIds,readOnly:false,item:se}:se.kind==="revision"?{...Ge,kind:"revision",revisionKind:se.revisionKind,author:se.author,initials:nP(se.author),text:lb(se.text),...se.replacedText?{replacedText:lb(se.replacedText)}:{},replyIds:se.replyIds,readOnly:se.readOnly||cI(R),item:se}:{...Ge,kind:"custom",author:"",initials:"",text:se.detail??se.text,replyIds:[],readOnly:true,item:se}})}function vo(){return R?.session.trackingSettings()??gi}function xo(M=g,Q=E){let te=vo();return Qp({...L(),viewOnly:s.mode()==="view",hostChoseMode:s.mode()!==void 0,readerChoseMode:Q,currentMode:M,trackRevisions:te.trackRevisions,restrictedToTrackedChanges:te.restrictedToTrackedChanges,restrictedToForms:te.restrictedToForms,restrictedToReadOnly:te.restrictedToReadOnly,restrictedToComments:te.restrictedToComments,engineAdoptedViewing:w})}function an(M){B=null,g=M,R?.setEditingMode(M==="suggesting"?"suggest":M==="viewing"?"view":"edit"),R?.setEditable(M!=="viewing");}function An(M){return M!==null?M:g==="suggesting"&&l===void 0?cr:A?cr:E?null:s.openingModeDecision(L()).rejection}function ma(){let M=xo();I=An(M.rejection),M.mode!==null&&(w=M.mode==="viewing",an(M.mode));}function jr(M="editing",Q=true){if(y.isScheduled()){B=M;return}B=null;let te=oI(s.mode(),L(),vo(),g,M,w);w=te.mode==="viewing"&&s.mode()!=="view",te.mode!==g&&an(te.mode),I=An(te.rejection),$.report(te.configurationRejection),Q&&(me(),ke());}function er(M){return s.mode()==="view"&&M!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(M==="suggesting"?Yp(L()):null)??Jp(vo(),M)}let xe=cO({surface:()=>R,enabled:()=>p,destroyed:()=>F,viewing:()=>g==="viewing",placements:kt,visible:()=>Xm(R?.session.reviewItems()??[],P),scope:fa,reveal:M=>rn.emitReviewItemReveal(ah(kt,M)),activate:(M,Q)=>{k=Q??false;try{return sn.setActiveReviewItem(M,{announce:!1})}finally{k=false;}},setDisplayMode:M=>{Ke=M,R?.setRevisionDisplayMode(M),me(),ke();},report:{diagnostics:gt,tracked:()=>g==="suggesting"}}),{resolveReviewItem:tr}=xe,br=new Xc(()=>R,rn.emitHistoryDiagnostic,()=>JSON.stringify(R?.state().selection)),sn={beginHistoryGroup(){return y.flush(),br.begin()},get mountGeneration(){return mt},get surface(){return R&&Ls(R)?null:R},...z.setters,setHyperlinkChrome:H.push,setEquationChrome:Z$1.push,stateVersion:()=>$t,fontMeasurement:()=>({measurer:_&&!a$3()?"shaped":"fixed",resolving:Ie||a$3(),..._&&W&&!a$3()?{producer:W}:{}}),attach(M){if(d$1!==M&&n?.invalidate(),F){Qn(gn("destroyed","this editor was destroyed; create a new instance to remount"));return}if(R&&d$1===M)return;if(R){R.flushPendingInput(),h$1=R.session.save();let ve=d$1?Bm(d$1):void 0;ve&&b.set(h$1,ve),yr();}let Q=y.cancel();Q&&(h$1=Q),on.detach(),d$1=M,_e=null;let te=h$1;h$1=null,te&&y.shouldYield(te)?y.schedule(te):te?Kr(te):me();},detach(){if(n?.invalidate(),F)return;on.detach();let M=y.cancel();if(R){R.flushPendingInput(),h$1=R.session.save();let Q=d$1?Bm(d$1):void 0;Q&&b.set(h$1,Q),yr();}M&&(h$1=M),d$1=null,_e=null,me();},load(M){let Q=Wp(M);if(!Q){Qn(gn("unsupported",Zp(M))),gt.openRejected("unsupported");return}n?.invalidate(),jt.reset(),ho(Q);},save(){return y.flush(),KR(R,d$1,()=>R)},getDocumentHandle(){return Object.freeze({revision:R?.session.packageRevision()??0})},exec(M,Q){if(d$1&&Un(d$1))return {ok:false,code:"unsupported",reason:"An external document refresh is in progress."};if(y.flush(),M.type==="openRevisionMarkupDialog")return hn.open();let te=br.gate(M,Q);if(te)return te;br.note(M);let ve=dh(M,F,p,er);if(F&&ve&&!ve.ok)return ve;if(M.type==="setEditingMode"){let Ge=er(M.mode);return Ge!==null?(Ge.reason===cr&&(A=true,I=Ge.reason,$.report(Ge.reason),me(),ke()),Ge):(E=true,A=false,I=null,an(M.mode),me(),ke(),{ok:true,changed:false})}if(M.type==="toggleParagraphMarks")return hr.toggle(),{ok:true,changed:false};if(M.type==="toggleReviewPane")return p?(Te=!Te,me(),ke(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Qt};let be=Yn.exec(M);if(be)return be;let Le=xe.exec(M);if(Le)return Le;if(Jg(M))return $E(M,R,eh(g),Q);let Be=Go(M);if(g==="viewing"&&Be.supported&&Be.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let se=Ps(M,R,s.modeForGate(),Q);if(!se.ok)return se.refusal;let Oe=R,He=Oe.session.packageRevision();return br.run(Oe,M,Q,()=>{let Ge=pM(Oe,M,{...se.tablePlan?{admittedTablePlan:se.tablePlan}:{},editor:sn});return Ge||{ok:true,changed:Oe.session.packageRevision()!==He}})},can(M,Q){if(d$1&&Un(d$1))return {ok:false,code:"unsupported",reason:"An external document refresh is in progress."};if(M.type==="openRevisionMarkupDialog")return hn.canOpen();let te=br.gate(M,Q);if(te)return te;if(M.type==="insertImage"||M.type==="replaceImage"){if(F)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(Q?.scope){let Oe=Ps(M,R,s.modeForGate(),Q);if(!Oe.ok)return Oe.refusal}return EI(M,R)}let ve=dh(M,F,p,er);if(ve)return ve;let be=Yn.can(M);if(be)return be;let Le=xe.can(M);if(Le)return Le;if(Jg(M))return th(M,R,eh(g),Q);let Be=Go(M);if(g==="viewing"&&Be.supported&&Be.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let se=Ps(M,R,s.modeForGate(),Q);if(!se.ok)return se.refusal;if(M.type==="proposeInsertion"||M.type==="proposeDeletion"||M.type==="proposeReplacement"){if(!(M.author??l??"").trim())return {ok:false,code:"invalidArgs",reason:`${M.type} requires a non-empty author`};let He=M.target===void 0?{ok:true,selection:R.state().selection}:zc(R,M.target);if(!He.ok)return He;let{anchor:Ge,head:Fn}=He.selection,nr=Ge.paragraphId===Fn.paragraphId&&Ge.offset===Fn.offset,At=M.type==="proposeReplacement"&&M.target===void 0&&R.state().cellSelection!==null;if(M.type!=="proposeInsertion"&&nr&&!At)return {ok:false,code:"invalidArgs",reason:`${M.type} needs a non-collapsed selection`}}if(ks(M)&&am(M)){let Oe=Rs(sn);if(Oe){let He=sm(sn,M,Oe);if(He)return He}}return {ok:true}},isActive(M){return M.type==="toggleParagraphMarks"?hr.get():M.type==="toggleDocumentProtection"?Yn.isActive():M.type==="setReviewDisplayMode"?Ke===M.mode:M.type==="toggleReviewPane"?Te:M.type==="setEditingMode"?g===M.mode:fO(M,R?On().formatting:null,Q=>R?.isListActive(Q)??false)},getDocumentStyles:()=>R?.session.documentStyles()??[],getDocumentFonts:()=>R?.session.documentFonts()??[],getAvailableFonts:()=>EM(oe(),R?.session.documentFonts()??[]),getDocumentThemeColors:()=>R?.session.documentThemeColors()??[],getOutline:()=>R?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>DI(R?On().formatting:null),findMatches:((M,Q)=>{let te={...Q?.matchCase!==void 0?{matchCase:Q.matchCase}:{},...Q?.wholeWord!==void 0?{wholeWord:Q.wholeWord}:{},...R?{stories:pO(R,g)}:{}};if(typeof M=="string")return gh(R?.session.findText(M,te),jt.noteMatches);let ve=R?.session.findText(M,te);return M.map((be,Le)=>gh(ve?.[Le],jt.noteMatches))}),selectMatch(M){return y.flush(),R?mO(R,M):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>On().image,getSelectedTable:()=>NI(R),getTableCellSelection:()=>{let M=R?.state().cellSelection;return M?{tableId:M.tableId,rows:M.rows,columns:M.columns,cellIds:M.cellIds}:null},setTableInteractionLabel(M){R?.setTableInteractionLabel(M);},canExecuteImageCommand(M,Q){if(F)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(Q?.scope){let te=Ps(M,R,s.modeForGate(),Q);if(!te.ok)return te.refusal}return dm(M,R)},executeImageCommand(M){return F?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):um(sn,M)},getPageSetup:()=>pm(R),getWatermark:()=>null,getTrackedChanges:()=>(R?.session.reviewItems()??[]).filter(M=>M.kind==="revision").map(M=>{let Q=bo(M);return {id:M.id,kind:M.kind==="revision"?M.revisionKind:"revision",...M.kind==="revision"&&M.author?{author:M.author}:{},story:Q!==null?Q.kind:Jn(M)?.noteKind??"body"}}),getReviewItems:M=>kt(M),getCustomNodeDefinitions:()=>c.customNodes,reportCustomNodeDiagnostic:u,addComment(M,Q){if(!p)return {ok:false,code:"unsupported",reason:Qt};R?.flushPendingInput();let te=ll();if(!te||!R)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let ve=(Q??l??"").trim();if(ve.length===0||M.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let be=null;return R.commitReviewOps(()=>(be=R.session.replyToComment(null,{paragraphId:te.from.paragraphId,start:te.from.offset,end:te.to.offset,...te.to.paragraphId===te.from.paragraphId?{}:{endParagraphId:te.to.paragraphId}},M,ve,qt(),Vt(te.from.paragraphId)),{committed:be!==null}),"comment-add"),be===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>pa(),isReviewPaneOpen:()=>Te,getEditingMode:()=>g,getReviewAuthors:()=>T.authorsFor(R?.revisionAuthors()??KM),...dP(P,{enabled:p,surface:()=>R,notify:()=>{me(),ke();}}),setTrackedChangesFilter(M,Q){if(R)return R.setTrackedChangesFilter(M,Q);P.setPredicate(M,Q)&&(me(),ke());},getConfiguredAuthor:()=>l??null,setAuthor(M){let Q=zm(M);if(l!==Q){if(l=Q,R?.setAuthor(l),l!==void 0&&A){A=false;let te=rI(er("suggesting"));if(te.enter)E=true,an("suggesting");else {I=te.rejection,me(),ke();return}}else if(!E){let te=B??g;jr(s.mode()===void 0?te:"editing");return}I=An(null),$.report(I),me(),ke();}},setMode(M){s.setMode(M)&&(E=false,A=false,jr());},...UM(s,{surface:()=>R,bump:me,emitSelectionChange:ke}),presenceColorFor:M=>R?.remotePresenceColor(M)??"var(--doc-accent)",collaborationSession:()=>R?.collaborationSession()??null,getReviewAuthorStyle:M=>T.styleFor(M),setOpeningIndicatorHost:X$1.set,setRemoteCaretLabelHost(M){G=M,R?.setRemoteCaretLabelHost(M);},setReviewPaneOptions:m.set,setRevisionMarkup:hn.set,setRevisionMarkupChrome:hn.register,setRevisionStyles(M){T.set(M),R?.setRevisionStyles(M),me(),ke();},setEditingMode:M=>sn.exec({type:"setEditingMode",mode:M}),getReviewRevision:()=>al(),getActivatedReviewItemKey:M=>ih(kt,R?.activatedReviewKey()??null,M),setActiveReviewItem(M,Q){if(M===null)return R?.dismissActiveReview(),me(),ke(),{ok:true,changed:false};if(!R)return {ok:false,code:"notFound",reason:"no document is open"};R.flushPendingInput();let te=qr(kt,M)?.item;if(!te)return {ok:false,code:"notFound",reason:"no review item with that key"};let ve=oh(te),be=ve?yj(ve.deletion):M,Le=Aj(te);if(!Le)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!Vc(te).every(ua)&&!(k&&te.kind==="revision"&&te.revisionKind==="format"))return {ok:false,code:"unsupported",reason:dO(te)};let Be=te?bo(te):null,se=Be===null&&te?yn(te):null;if(Be!==null||se!==null){let Oe=Be!==null?{kind:"headerFooter",rId:Be.rId,furnitureKind:Be.kind}:{kind:"note",id:se},He=jc(R,Oe,Le.start);if(!He.ok)return He}else {R.exitNote?.(),R.exitHeaderFooter?.();let Oe=It(te)??Le,He={paragraphId:Oe.start.paragraphId,offset:Oe.start.offset};R.activateReview(be,{anchor:He,head:He},{allowExcluded:k});let Ge=Q?.reveal??"centerIfNeeded";Ge!==false&&R.revealPosition?.(Oe.start,{block:Ge});}return (Be!==null||se!==null)&&R.activateReview(be,void 0,{allowExcluded:k}),me(),ke(),Q?.announce===true&&rn.emitReviewItemReveal(ah(kt,{key:M,source:"host"})),{ok:true,changed:false}},setReviewActivationExclusions(M,Q){x=M===null?null:[...M],v=Q?.formattingKinds?[...Q.formattingKinds]:void 0,R?.setReviewActivationExclusions(x,{formattingKinds:v});},acceptReviewItem:M=>tr(M,"accept"),rejectReviewItem:M=>tr(M,"reject"),setCommentResolved(M,Q){return TM({reviewEnabled:p,editingMode:g,placements:kt,surface:R,proReviewReason:Qt,bump:me},M,Q)},deleteReviewItem(M){if(!p)return {ok:false,code:"unsupported",reason:Qt};let Q=qr(kt,M)?.item;if(!Q||!R)return {ok:false,code:"notFound",reason:"no review item with that key"};if(Q.kind==="revision")return tr(M,"reject");if(Q.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};pi()===M&&R.dismissActiveReview();let te=false;return R.commitReviewOps(()=>{let ve=yn(Q),be=ve===null?null:pc$1(ve);return te=R.session.deleteComment(Q.id,fa(Q),be?.noteId),{committed:te}},"comment-delete"),te?(me(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(M,Q,te){if(!p)return {ok:false,code:"unsupported",reason:Qt};R?.flushPendingInput();let ve=qr(kt,M)?.item,be=oh(ve)?.insertion??ve;if(!be||!R)return {ok:false,code:"notFound",reason:"no review item with that key"};let Le=Aj(be);if(!Le)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let Be=(te??l??"").trim(),se=CM(be,Q,Be);if(se)return se;let Oe=be.kind==="comment"?be.id:null,He=null;return R.commitReviewOps(()=>(He=R.session.replyToComment(Oe,{paragraphId:Le.start.paragraphId,start:Le.start.offset,end:Le.end.offset},Q,Be,qt(),fa(be)),{committed:He!==null}),"comment-reply"),He===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>R?.headerFooterState()??null,getNotePropertiesState:()=>R?.notePropertiesState?.()??null,getNotePreviewText:M=>R?.notePreviewText?.(M)??null,setActiveScope(M){R?.setActiveScope(M)&&me();},getActiveScope:()=>R?.activeScope()??{kind:"body"},query:M=>VE(R,()=>On().formatting,M),snapshot:()=>On(),getTotalPages:()=>ji(R),getCurrentPage:M=>mm(R,M),...gO(()=>R,()=>y.flush(),()=>d$1),...vO(()=>sn,()=>n,()=>y.flush()),...VM(on,()=>R),...jt.members,..._O({frame:jt.frame,placements:kt}),relayout(M){M?.sync,R?.layout();},retainSelection:()=>R?.retainSelection()??null,releaseSelection:M=>R?.releaseSelection(M),focus(M){return y.flush(),R?M&&M.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:M&&!R.setActiveScope(M)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(R.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){n?.invalidate(),F=true,$.dispose(),y.cancel(),on.detach(),ne(),q(),q=()=>{},yr(),d$1=null,h$1=null,b=new WeakMap,mt+=1,me(),gt.dispose(),rn.clear();},on:rn.on};return n=WE(sn,{surface:()=>R,container:()=>d$1,collaboration:()=>c.collaboration!==null,load:ho,changed:()=>{me(),ke();},cancelLoad:()=>{r=null,y.cancel();}}),gt.attach(sn,en),Ee.methods(sn)}var zM=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function B_(e){if(e.length===0)return;if(e.every(n=>n.kind==="delete"))return "comment-delete";if(e.length!==1)return;let t=e[0];if(t.kind==="resolve")return "comment-resolve";if(t.kind==="create")return "comment-add";if(t.kind==="reply")return "comment-reply"}function $_(e){let t=m({port:q_(e),capabilities:zM}),n=false;return {...t,save:()=>{try{return t.save()}catch(r){return {ok:false,error:{code:"transaction-refused",message:r instanceof Error?r.message:"Cannot save the document."}}}},dispose:()=>{n=true,t.dispose();},execute:r=>(n||e.surface?.flushPendingInput(),IE(e,()=>t.execute(r)))}}function q_(e){let t=0,n=0,r=null,o=false,i$1=false,a=()=>{if(i$1)return null;let d=e.surface?.session??null;return d!==r&&(o&&(t+=n+1),o=true,r=d,n=0),d&&(n=d.packageRevision()),d},s,l=null;return {localChangeTracking:true,suggesting:()=>e.surface?.editingMode()==="suggest",async prepare(d){if(!d.operations.some(p=>p.op==="updateFieldResult"))return;s=void 0,l=null;let c=e.surface;if(!c)return;let u=c.layout();s=j$2(u),l=a()?.currentPackage()??null;},fieldPageContext(d,c,u){let p=a()?.currentPackage()??null;if(!p||p!==l)return null;let m=i(p).story(d);return m?k$2(s,m.part,c,u):null},revision(){return a(),t+n},currentPackage:()=>a()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?Ya(e.surface.revisionDisplayMode()):th$1,collaborative:()=>!!e.surface?.collaborationSession(),trackedRangeReplacement:()=>!e.surface?.collaborationSession(),replacementLanding:(d,c,u)=>e.surface?.replacementLanding(d,c,u)??null,apply(d,c,u=[],p=false){a();let m=e.surface;if(!m)return {ok:false,reason:"no-document"};let h=m.applyAutomationOps(d,c,u,p);return h.rejected?{ok:false,reason:qg(h.reason)}:{ok:true,changed:h.committed}},applyLifecycle(d){a();let c=e.surface;if(!c)return {ok:false,reason:"no-document"};let u=c.applyAutomationOps(()=>[d]);return u.rejected?{ok:false,reason:qg(u.reason)}:{ok:true,changed:u.committed}},applyCommentWrites(d,c){let u=e.surface,p=a();if(!u||!p)return {ok:false,reason:"no-document"};if(d.length===0)return {ok:true,changed:false};if(c.kind!=="body")return {ok:false,reason:"unsupported-story"};let m=e.can({type:"toggleReviewPane"});if(!m.ok)return {ok:false,reason:m.reason??"review-module-required"};let h={ok:false,reason:"refused"};return u.commitReviewOps(()=>{if(d.every(g=>g.kind==="delete")){let g=d.find(v=>v.kind==="delete"),x=p.deleteComments(d.map(v=>{if(v.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:v.commentId,...v.parentCommentId===void 0?{}:{parentCommentId:v.parentCommentId}}}),c,g?.kind==="delete"?g.noteId:void 0);return h=x?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:x}}if(d.length!==1)return h={ok:false,reason:"mixed-comment-writes"},{committed:false};let b=d[0];if(b.kind==="resolve"){let g=p.setCommentResolved(b.commentId,b.resolved);return h=g?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:g}}if(b.kind!=="create"&&b.kind!=="reply")return h={ok:false,reason:"unsupported-comment-write"},{committed:false};let y=p.replyToComment(b.kind==="reply"?b.parentCommentId:null,b.anchor,b.text,b.author,b.date);return h=y===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:y},{committed:y!==null}},B_(d)),h},applyCustomNodeWrite(d,c){let u=e.surface,p=a();if(!u||!p)return {ok:false,reason:"no-document"};if(c.kind!=="body")return {ok:false,reason:"unsupported-story"};let m={ok:false,reason:"refused"};return u.commitReviewOps(()=>{let h=p.insertCustomNode(d);return m=h.ok?{ok:true,changed:h.change!==null}:{ok:false,reason:h.detail?`${h.reason}: ${h.detail}`:h.reason},{committed:h.ok}},"package-scoped"),m},save:()=>a()?e.surface?.save()??null:null,select(d,c){if(!e.surface)return;let p=c==="end"?d.end:d.start,m=c==="start"?d.start:d.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:p.paragraphId,offset:p.offset},head:{paragraphId:m.paragraphId,offset:m.offset}}});},subscribe:d=>e.on("change",()=>d()),dispose(){i$1=true,r=null;}}}function Eh(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}function V_(e){let t=e.popup.ownerDocument,n=r=>{if(r.key!=="Escape"||r.isComposing||r.keyCode===229||e.skip?.(r))return;let o=r.composedPath(),i=o[0]??r.target,a=i instanceof Node?i:null,s=a!==null&&e.contains(a);if(!s&&GM(a,e.popup))return;let l=[Eh(e.popup),e.chromeRoot?.(),...e.editorElements?.()??[]],d=s||l.some(c=>c!=null&&o.includes(c));e.close(s),d&&(r.preventDefault(),r.stopPropagation());};return t.addEventListener("keydown",n,true),()=>t.removeEventListener("keydown",n,true)}function GM(e,t){let r=(e instanceof Element?e:e?.parentElement??null)?.closest('[aria-modal="true"], [data-docx-modal]');return r?r.hasAttribute("data-docx-dialog")||r.hasAttribute("data-docx-modal")?true:Eh(t)?.contains(r)===true:false}var K_='[aria-expanded="true"], [role="menu"], [role="listbox"], [role="dialog"]';function j_(e){return e?.querySelector(K_)!=null}function W_(e){let t=e.popup.ownerDocument,n=r=>{let o=r.composedPath()[0]??r.target;if(!(o instanceof Node)||e.contains(o))return;let i=o instanceof Element?o:o.parentElement;i===null||i===t.body||i===t.documentElement||i.closest(".docx-pages")||GM(i,e.popup)||e.close();};return t.addEventListener("focusin",n,true),()=>t.removeEventListener("focusin",n,true)}function Z_(e){return e*(96/72)}function U_(e,t){return e*t}function z_(e,t){return e/t}function G_(e,t,n){let r=e.pages.find(a=>a.index===t.pageIndex)??e.pages[t.pageIndex];if(!r)return {left:0,top:0,width:0,height:0};let o=n.pageOffsetX.get(r.index)??0,i=n.paintScale;return Object.freeze({left:(r.contentBox.x+t.x+o)*i,top:(r.contentBox.y+t.y)*i,width:t.width*i,height:t.height*i})}function X_(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function YM(e,t,n,r=false){return t?true:e.length===1?false:r?n:!n}var XM=["e","se","s","sw","w","nw","n","ne"];function Y_(e,t){let n=XM.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return XM[(n-r+8)%8]}function Q_(e,t,n){let r=e,o=t,i=-n.rotationDegrees*Math.PI/180,a=Math.cos(i),s=Math.sin(i),l=r*a-o*s,d=r*s+o*a;return r=l,o=d,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function ui(e){return e/12700}function QM(e){let t=Q_(e.deltaXPt,e.deltaYPt,e.transform),n=ui(e.startWidthEmu),r=ui(e.startHeightEmu),o=n/r,i=Y_(e.handle,e.transform),a=i.includes("e")?t.x:i.includes("w")?-t.x:0,s=i.includes("s")?t.y:i.includes("n")?-t.y:0;if(n=Math.max(1,n+a),r=Math.max(1,r+s),e.preserveAspect)if(i.length===2){let v=Math.max(n/ui(e.startWidthEmu),r/ui(e.startHeightEmu));n=Math.max(1,ui(e.startWidthEmu)*v),r=Math.max(1,n/o);}else i==="e"||i==="w"?r=Math.max(1,n/o):n=Math.max(1,r*o);let l=ui(e.startWidthEmu),d=ui(e.startHeightEmu),c=n/l,u=r/d,p=Math.max(1,e.startBounds.width*c),m=Math.max(1,e.startBounds.height*u),h=e.startBounds.x,b=e.startBounds.y,y=e.handle;y.includes("w")&&(h=e.startBounds.x+e.startBounds.width-p),y.includes("n")&&(b=e.startBounds.y+e.startBounds.height-m);let g=null;if(e.kind==="anchored"&&e.startPosition&&(y.includes("w")||y.includes("n")||e.anchorFrameOrigin&&(e.startPosition.horizontalEmu===void 0&&n!==l||e.startPosition.verticalEmu===void 0&&r!==d)))if(e.startPosition.mode==="simple"){let x=y.includes("w")?Et(h-e.startBounds.x):0,v=y.includes("n")?Et(b-e.startBounds.y):0;g=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+x,verticalEmu:(e.startPosition.verticalEmu??0)+v});}else if(e.anchorFrameOrigin)g=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...y.includes("w")||e.startPosition.horizontalEmu===void 0&&n!==l?{horizontalEmu:Et(h-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...y.includes("n")||e.startPosition.verticalEmu===void 0&&r!==d?{verticalEmu:Et(b-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let x=y.includes("w")?Et(h-e.startBounds.x):0,v=y.includes("n")?Et(b-e.startBounds.y):0;g=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+x}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+v}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:Et(n),heightEmu:Et(r),previewBounds:Object.freeze({x:h,y:b,width:p,height:m}),position:g})}function J_(e,t){return Object.freeze({scrollBy(n){if(!Number.isFinite(n)||n===0)return 0;let r=e.scrollTop;return e.scrollTop+=n*t,(e.scrollTop-r)/t}})}function e5(e){if(e.session.mode==="move"){let t=e.session.startBounds.x+e.deltaXPt,n=e.session.startBounds.y+e.deltaYPt+e.accumulatedScrollPt,r=e.session.startPosition&&Hd(e.session.startPosition.mode==="frame"&&e.anchorFrameOrigin?{...e.session.startPosition,horizontalEmu:e.session.startPosition.horizontalEmu??Et(e.session.startBounds.x-e.anchorFrameOrigin.x),verticalEmu:e.session.startPosition.verticalEmu??Et(e.session.startBounds.y-e.anchorFrameOrigin.y)}:e.session.startPosition,e.deltaXPt,e.deltaYPt+e.accumulatedScrollPt);return Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:Object.freeze({x:t,y:n,width:e.session.startBounds.width,height:e.session.startBounds.height}),position:r??null})}return e.session.handle?QM({handle:e.session.handle,startWidthEmu:e.session.startWidthEmu,startHeightEmu:e.session.startHeightEmu,startBounds:e.session.startBounds,startPosition:e.session.startPosition,anchorFrameOrigin:e.anchorFrameOrigin,deltaXPt:e.deltaXPt,deltaYPt:e.deltaYPt,transform:e.session.transform,preserveAspect:YM(e.session.handle,e.aspectLocked,e.shiftKey,e.textbox),kind:e.session.kind}):Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:e.session.startBounds,position:null})}var JM=e=>Math.round(e/1440*100)/100,t5=e=>JM(e).toLocaleString(void 0,{maximumFractionDigits:2}),n5=e=>Math.round(e*1440),r5={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},eA=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",tA=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function o5(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",direction:e.direction??"ltr",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:eA(t),specialBy:Math.abs(t??0),spaceBefore:e.spaceBeforePt??0,spaceAfter:e.spaceAfterPt??0,lineRule:e.lineSpacing?.rule??"multiple",lineValue:e.lineSpacing?.value??1.08,contextualSpacing:e.contextualSpacing===true,keepNext:e.keepNext===true,keepLines:e.keepLines===true,widowControl:e.widowControl!==false,pageBreakBefore:e.pageBreakBefore===true,tabStops:e.tabStops??[],clearedAllTabStops:false}}var nA={contextualSpacing:false,keepNext:false,keepLines:false,widowControl:false,pageBreakBefore:false,tabStops:false,alignment:false,direction:false,indentLeft:false,indentRight:false,special:false,spaceBefore:false,spaceAfter:false,lineSpacing:false};function i5(e){return {contextualSpacing:e.contextualSpacing===null,keepNext:e.keepNext===null,keepLines:e.keepLines===null,widowControl:e.widowControl===null,pageBreakBefore:e.pageBreakBefore===null,tabStops:e.disagrees.tabStops,alignment:e.disagrees.alignment,direction:e.disagrees.direction,indentLeft:e.disagrees.indentLeft||e.indentUnknown,indentRight:e.disagrees.indentRight||e.indentUnknown,special:e.disagrees.indentFirstLine||e.indentUnknown,spaceBefore:e.disagrees.spaceBeforePt,spaceAfter:e.disagrees.spaceAfterPt,lineSpacing:e.disagrees.lineSpacing}}function rA(e,t){return e===t?true:e.length!==t.length?false:e.every((n,r)=>{let o=t[r];return o!==void 0&&n.positionTwips===o.positionTwips&&n.alignment===o.alignment&&(n.leader??"none")===(o.leader??"none")})}function a5(e,t,n=nA,r=n){let o={},i=false,a=(d,c)=>{o[d]=c,i=true;},s=d=>n[d]&&!r[d];(e.direction!==t.direction||s("direction"))&&a("direction",t.direction);let l=!n.direction&&!n.alignment&&e.direction!==t.direction&&t.alignment===oA(e.alignment);return (e.alignment!==t.alignment&&!l||s("alignment"))&&a("alignment",t.alignment),(e.indentLeft!==t.indentLeft||s("indentLeft"))&&a("indentLeftTwips",t.indentLeft),(e.indentRight!==t.indentRight||s("indentRight"))&&a("indentRightTwips",t.indentRight),(e.special!==t.special||e.specialBy!==t.specialBy||s("special"))&&a("indentFirstLineTwips",tA(t.special,t.specialBy)),(e.spaceBefore!==t.spaceBefore||s("spaceBefore"))&&a("spaceBeforePt",t.spaceBefore),(e.spaceAfter!==t.spaceAfter||s("spaceAfter"))&&a("spaceAfterPt",t.spaceAfter),!r.lineSpacing&&(e.lineRule!==t.lineRule||e.lineValue!==t.lineValue||s("lineSpacing"))&&a("lineSpacing",{rule:t.lineRule,value:t.lineValue}),(e.contextualSpacing!==t.contextualSpacing||s("contextualSpacing"))&&a("contextualSpacing",t.contextualSpacing),(e.keepNext!==t.keepNext||s("keepNext"))&&a("keepNext",t.keepNext),(e.keepLines!==t.keepLines||s("keepLines"))&&a("keepLines",t.keepLines),(e.widowControl!==t.widowControl||s("widowControl"))&&a("widowControl",t.widowControl),(e.pageBreakBefore!==t.pageBreakBefore||s("pageBreakBefore"))&&a("pageBreakBefore",t.pageBreakBefore),(!rA(e.tabStops,t.tabStops)||s("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?o:null}function oA(e){return e==="left"?"right":e==="right"?"left":e}function s5(e,t){return [...e.filter(r=>r.positionTwips!==t.positionTwips),t].sort((r,o)=>r.positionTwips-o.positionTwips)}function l5(e,t){if(t.key!=="Tab")return false;let n=[...e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(a=>!a.hasAttribute("disabled")&&a.tabIndex!==-1);if(n.length===0)return false;let r=n[0],o=n[n.length-1],i=e.ownerDocument.activeElement;return t.shiftKey&&(i===r||i===e)?(o.focus(),true):!t.shiftKey&&i===o?(r.focus(),true):false}function d5(e,t,n){let r,o=false,i,a,s=new Set,l=[],d=()=>{clearTimeout(a),a=void 0,r?.end(),r=void 0,i=void 0,s.clear();},c=()=>{if(o)throw new Error("history group binding was disposed");return (!r||r.state==="closed")&&(r=e.beginHistoryGroup()),r},u=()=>{d(),c();},p=()=>{let b=r;i=void 0,s.clear(),clearTimeout(a),a=setTimeout(()=>{r===b&&d();},0);},m=(b,y,g,x=false)=>{b.addEventListener(y,g,x),l.push(()=>b.removeEventListener(y,g,x));},h=b=>n.kind==="native-color"?b==="Enter"||b===" ":["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"," ","Enter"].includes(b);if(m(t,"pointerdown",b=>{let y=b;if(!(y.button!==0||n.kind==="keyboard")&&(u(),i=y.pointerId,n.kind!=="native-color"))try{t.setPointerCapture?.(y.pointerId);}catch{}},true),m(t,"keydown",b=>{let y=b;if(y.key==="Escape"){p();return}!h(y.key)||y.altKey||y.ctrlKey||y.metaKey||(!y.repeat&&s.size===0&&u(),s.add(y.key),c());},true),m(t.ownerDocument,"keyup",b=>{let y=b.key;s.delete(y)&&n.kind!=="native-color"&&s.size===0&&p();},true),n.kind!=="native-color")for(let b of ["pointerup","pointercancel","lostpointercapture"])m(b==="lostpointercapture"?t:t.ownerDocument,b,y=>{i!==void 0&&y.pointerId===i&&p();},true);return m(t,"input",()=>{a!==void 0?u():c();},true),m(t,"change",()=>{(n.kind==="native-color"||i===void 0&&s.size===0)&&p();}),m(t,"blur",p,true),t.ownerDocument.defaultView&&m(t.ownerDocument.defaultView,"blur",p),{options:()=>({historyGroup:c()}),dispose(){if(!o){o=true,d();for(let b of l)b();}}}}var go=class extends Error{code;constructor(t,n){super(`Document capture failed: ${t}.`,{cause:n}),this.name="DocumentRefreshError",this.code=t;}};function iA(e){return JSON.stringify([e.revisionKind,e.author,e.date,e.text,e.replacedText])}function aA(e){return new Map(e.surface()?.session.reviewItems().filter(t=>t.kind==="revision").map(t=>[t.id,iA(t)]))}function sA(e,t,n,r){let o=e.surface();if(!o)return {located:[],available:false};let i=o.session.part(),a=d$1(i),s=o.session.paragraphAnchors().paraIdByNode,l=new Map,d=new Map;a.forEach((h,b)=>{d.set(h.id,b);let y=s.get(h.id);if(y){let g=y.toUpperCase();l.set(g,l.has(g)?null:h);}});let c=new Set(o.layout().pages.flatMap(h=>xa(h).map(b=>b.paragraphId))),u=(h,b=JSON.stringify([typeof h.location?.text=="string"?h.location.text:null,h.unavailableReason,h.description]))=>{let y={id:h.id,resultId:t,isNew:r.get(h.id)!==b,...h.description!==void 0?{description:h.description}:{}};if(!h.location)return {fingerprint:b,change:{...y,status:h.unavailableReason??"unavailable",diagnostic:Object.freeze({code:h.unavailableReason==="deleted"?"deleted":"missing-location"})}};let g=h.location,x=T=>({fingerprint:b,change:{...y,status:"invalid",diagnostic:Object.freeze({code:T,location:Object.freeze({...g})})}});if(g.paragraphId===void 0==(g.paragraphIndex===void 0)||g.paragraphIndex!==void 0&&(!Number.isSafeInteger(g.paragraphIndex)||g.paragraphIndex<0))return x("invalid-selector");if(g.paragraphId!==void 0&&(typeof g.paragraphId!="string"||!vb(g.paragraphId)))return x("invalid-paragraph-id");let v=g.paragraphId!==void 0?l.get(g.paragraphId.toUpperCase()):a[g.paragraphIndex];if(v===null)return x("ambiguous-paragraph-id");if(!v)return x("paragraph-not-found");let k=v?Vi$1(i,v.id)??"":"";if(!Number.isSafeInteger(g.start)||!Number.isSafeInteger(g.end)||g.start<0||g.end<=g.start||g.end>k.length)return x("invalid-offsets");if(k.slice(g.start,g.end)!==g.text)return x("text-mismatch");let P=c.has(v.id);return {fingerprint:b,change:{...y,status:P?"available":"unavailable",location:Object.freeze({...g}),...P?{}:{diagnostic:Object.freeze({code:"not-rendered",location:Object.freeze({...g})})}},...P?{paragraphId:v.id,offset:g.start}:{}}};if(n)return {located:n.map(h=>u(h)),available:true};let p=o.session.reviewItems().filter(h=>h.kind==="revision");return {located:p.map(h=>{let b=iA(h),y=h.ranges[0];if(!y||y.partName!==i.name)return {fingerprint:b,change:{id:h.id,resultId:t,isNew:r.get(h.id)!==b,status:y?"unsupported-story":"unavailable",diagnostic:Object.freeze({code:y?"unsupported-story":"missing-location"})}};let g=d.get(y.start.paragraphId)??-1;if(h.revisionKind==="delete"||h.revisionKind==="moveFrom")return {fingerprint:b,change:{id:h.id,resultId:t,isNew:r.get(h.id)!==b,status:"deleted",diagnostic:Object.freeze({code:"deleted"})}};if(y.start.paragraphId!==y.end.paragraphId)return {fingerprint:b,change:{id:h.id,resultId:t,isNew:r.get(h.id)!==b,status:"unavailable",diagnostic:Object.freeze({code:"multiple-paragraphs"})}};let x=Vi$1(i,y.start.paragraphId)??"",v={paragraphIndex:g,start:y.start.offset,end:y.end.offset,text:x.slice(y.start.offset,y.end.offset)};return u({id:h.id,location:v},b)}),available:p.length>0}}var lA=new WeakMap,c5=0;function u5(e){let t=lA.get(e);if(t)return t;let n=jE(e),r=`refresh-${++c5}`,o=0,i=null,a=new AbortController,s=false,l=Promise.resolve(),d=null,c=[],u=null,p=new Set,m=new Set,h=Object.freeze({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false}),b=C=>{h=Object.freeze({...h,...C});for(let E of p)try{E();}catch{}},y=Zc(e,n,{marker:"data-docx-refresh-highlight",defaultColor:"var(--doc-refresh-highlight-color)"},()=>{h.highlightsVisible&&b({highlightsVisible:false});}),g=(C,E)=>{E&&b({phase:E,result:C,recoveryAvailable:d!==null});for(let w of m)try{w(C);}catch{}return C},x=(C,E,w)=>({ok:false,resultId:C,code:E,...w===void 0?{}:{recovered:w}}),v=()=>n.collaboration()?"collaboration":!n.surface()||!n.container()||e.snapshot().isOpening?"unavailable":null,k=()=>{o++,i=null,a.abort(),a=new AbortController,c=[],u=null,y.clear();};n.invalidated.add(()=>{k(),d=null,b({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});}),e.on("change",C=>{C.source||u===null||n.revision===u||(c=[],y.clear(),u=null,b({changes:[],highlightsVisible:false}));});let P=async C=>{let E=n.surface(),w=n.container();if(!E||!w)throw new Error("unavailable");Gk(E)&&await new Promise((A,B)=>{let $=()=>{w.removeEventListener("compositionend",j),C.removeEventListener("abort",R);},j=()=>{$(),A();},R=()=>{$(),B(new Error("cancelled"));};w.addEventListener("compositionend",j),C.addEventListener("abort",R,{once:true}),C.aborted&&R();});let I=_s(w);if(I&&await I,C.aborted||n.surface()!==E)throw new Error("document-changed");let L=E.save();if(n.surface()!==E)throw new Error("document-changed");return {bytes:L,revision:n.revision}},T={async capture(){let C=v();if(d)throw new go("recovery-failed");if(C||s)throw new go(C??"busy");k(),d=null;let E=o,w=n.epoch,I=a.signal;b({phase:"capturing",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});try{let L=await P(I);if(E!==o||w!==n.epoch)throw new Error("superseded");let A=Object.freeze({id:`${r}-${E}`,bytes:L.bytes.slice().buffer});return i={token:A,epoch:w,revision:L.revision,sequence:-1,seen:aA(n)},b({phase:"processing"}),A}catch(L){throw E===o&&b({phase:"failed"}),new go(E===o?"input-failed":"superseded",L)}},applyUpdate(C){let E=`${C.submission?.id??"unknown"}:${C.sequence}`,w;try{if(!Number.isSafeInteger(C.sequence)||C.sequence<0||!(C.bytes instanceof Uint8Array||C.bytes instanceof ArrayBuffer)||C.failures!==void 0&&(!Array.isArray(C.failures)||C.failures.length>1e4||Array.from(C.failures).some(A=>typeof A!="string"))||C.changes!==void 0&&(!Array.isArray(C.changes)||C.changes.length>1e4||new Set(C.changes.map(A=>A.id)).size!==C.changes.length||Array.from(C.changes).some(A=>!A||typeof A.id!="string"||!A.id||A.description!==void 0&&(typeof A.description!="string"||A.description.length>1e3)||A.location!==void 0&&(!A.location||typeof A.location!="object"||A.location.paragraphId!==void 0&&typeof A.location.paragraphId!="string"||A.location.paragraphIndex!==void 0&&typeof A.location.paragraphIndex!="number"||typeof A.location.start!="number"||typeof A.location.end!="number"||typeof A.location.text!="string")||A.unavailableReason!==void 0&&!["deleted","unavailable"].includes(A.unavailableReason))))throw new Error("invalid-result");w={...C,bytes:new Uint8Array((C.bytes instanceof Uint8Array,C.bytes)).slice(),changes:C.changes?.map(A=>({id:A.id,description:A.description,unavailableReason:A.unavailableReason,location:A.location?{paragraphId:A.location.paragraphId,paragraphIndex:A.location.paragraphIndex,start:A.location.start,end:A.location.end,text:A.location.text}:void 0})),failures:C.failures?.slice()};}catch{return Promise.resolve(g(x(E,"invalid-result")))}let I=async()=>{let A=i,B=v();if(B)return g(x(E,B));if(!A||A.token!==w.submission)return g(x(E,"superseded"));if(w.sequence<=A.sequence)return g(x(E,"out-of-order"));if(A.epoch!==n.epoch)return g(x(E,"document-changed"));s=true;let $=a.signal,j=()=>i===A&&A.epoch===n.epoch&&!$.aborted;try{let R=await P($);if(!j())return g(x(E,"cancelled"));if(R.revision!==A.revision)return g(x(E,"local-edits"),"failed");let G=w.bytes;if(!Ce(G).ok)return g(x(E,"invalid-document"),"failed");if(y.clear(),c=[],u=null,b({phase:"refreshing",changes:[],highlightsVisible:!1}),!j())return g(x(E,"cancelled"));let X=n.surface().save();if(!j())return g(x(E,"cancelled"));if(n.revision!==A.revision)return g(x(E,"local-edits"),"failed");d={bytes:X.slice(),epoch:n.epoch};let ie=await n.replace(G,"refresh");if(A.epoch!==n.epoch)return g(x(E,"document-changed"));if(!ie&&!j())return d=null,g(x(E,"cancelled"));if(!ie){if(b({phase:"recovering"}),A.epoch!==n.epoch)return g(x(E,"document-changed"));let H=d&&await n.replace(d.bytes,"recovery");return A.epoch!==n.epoch?g(x(E,"document-changed")):(H&&(d=null),i=null,g(x(E,H?"load-failed":"recovery-failed",!!H),"failed"))}d=null,y.clear(),A.revision=n.mountedRevision,A.sequence=w.sequence;let pe=sA(n,E,w.changes,A.seen);c=n.revision===A.revision?pe.located:[];for(let H of c)A.seen.set(H.change.id,H.fingerprint);u=A.revision;let K=Object.freeze(c.map(H=>Object.freeze(H.change))),z=Object.freeze({ok:!0,resultId:E,changes:K,changeInformation:n.revision===A.revision&&pe.available?"available":"unavailable",failures:Object.freeze(w.failures??[])});return b({changes:K,result:z,phase:"complete",recoveryAvailable:!1}),g(z)}catch{return g(x(E,j()?"input-failed":"cancelled"),j()?"failed":void 0)}finally{s=false;}},L=l.then(I);return l=L.then(()=>{},()=>{}),L},cancel(){let C=h.phase==="recovering"||!n.surface()&&d!==null;n.cancel(),o++,i=null,a.abort(),a=new AbortController,C||(d=null),b({phase:C?"failed":h.result?.ok?"complete":"idle",result:C||h.result?.ok?h.result:null,recoveryAvailable:d!==null});},finish(C){i?.token===C&&!s&&(i=null,b({phase:h.phase==="processing"?"idle":h.phase}));},snapshot:()=>h,subscribe(C){return p.add(C),()=>{p.delete(C);}},onResult(C){return m.add(C),()=>{m.delete(C);}},highlightChanges(C){if(y.validate(C),u!==n.revision)return 0;let E=C?.changeIds===void 0?null:new Set(C.changeIds),w=c.filter(I=>I.change.status==="available"&&(E?E.has(I.change.id):C?.includePrevious||I.change.isNew));return y.show(w,C),b({highlightsVisible:w.length>0}),w.length},clearHighlights(C){y.hide(C),b({highlightsVisible:false});},navigateToChange(C,E={}){if(E.focus!==void 0&&typeof E.focus!="boolean")throw new TypeError("focus must be a boolean.");let w=sa(E,"center",n.container());if(u!==n.revision)return false;let I=c.find(A=>A.change.id===C);if(!I?.paragraphId||I.offset===void 0)return false;let L=n.surface();if(!L?.revealPosition({paragraphId:I.paragraphId,offset:I.offset},w))return false;if(E?.focus){L.setActiveScope({kind:"body"});let A={paragraphId:I.paragraphId,offset:I.offset};L.setSelection({anchor:A,head:A}),L.focus();}return true},recoveryBytes:()=>d?d.bytes.slice().buffer:null,async recover(){if(!d||d.epoch!==n.epoch||s)return false;s=true;let C=d;b({phase:"recovering"});try{if(C.epoch!==n.epoch)return !1;let E=await n.replace(C.bytes,"recovery");return C.epoch!==n.epoch?!1:(E&&(d=null),b({phase:E?"idle":"failed",recoveryAvailable:!E}),E)}finally{s=false;}}};return lA.set(e,T),T}var f5=150;var p5=Object.freeze({applied:0,unavailable:0});function m5(e,t,n,r={}){let{onResult:o,...i}=r,a=n,s=i,l=p5,d=false,c,u=0,p=y=>{y.applied===l.applied&&y.unavailable===l.unavailable||(l=y,o?.(y));},m=()=>{if(clearTimeout(c),c=void 0,u=0,d)return;let y=typeof a=="function"?a(e):a;p(e.setHighlights(t,y,s));},h=()=>{let y=Date.now();u===0&&(u=y),clearTimeout(c);let g=Math.min(150,1e3-(y-u));c=setTimeout(m,Math.max(0,g));},b=e.on("change",y=>{typeof a=="function"?y.source?m():h():y.source==="refresh"||y.source==="recovery"?m():y.source==="load"&&p({applied:0,unavailable:a.length});});return m(),{get result(){return l},refresh:m,update(y,g){a=y,g!==void 0&&(s=g),m();},stop(){d||(d=true,clearTimeout(c),b(),e.clearHighlights(t));}}}var Mh=150,cA=2e3,uA="search",fA=10,Oh=Object.freeze([]),g5=1e3;function h5(e,t){let n=e.activeIndex>=0?e.matches[e.activeIndex]:void 0;if(!n)return -1;let r=-1;for(let[o,i]of t.entries())i.blockId===n.blockId&&(r<0||Math.abs(i.start-n.start)<Math.abs(t[r].start-n.start))&&(r=o);return r}var dA=new WeakMap;function y5(e){let t=dA.get(e);if(t)return t;let n={query:"",matchCase:false,wholeWord:false,matches:Oh,truncated:false,activeIndex:-1,activeMatch:null,isPending:false},r="",o={},i,a=new Set,s=new Map,l=false;function d(){let T="none";for(let C of s.values()){if(C==="all")return "all";C==="active"&&(T="active");}return T}function c(){let T=d(),{matches:C,activeIndex:E}=n,w=E>=0?C[E]:void 0,I=T==="all"?C:T==="active"&&w?[w]:[];I.length===0&&!l||(e.setHighlights(uA,I,{activeIndex:T==="all"?E:I.length>0?0:-1,priority:fA}),l=I.length>0);}function u(T){let C={...n,...T};if(C.matches!==n.matches&&T.activeIndex===void 0&&(C.activeIndex=h5(n,C.matches)),C.truncated=$O(C.matches)??C.matches.length>=cA,C.activeMatch=C.matches[C.activeIndex]??null,!!Object.keys(C).some(w=>C[w]!==n[w])){n=C,c();for(let w of [...a])w();}}function p(T=r,C=n){return T.length===0?Oh:e.findMatches(T,{matchCase:C.matchCase??false,wholeWord:C.wholeWord??false})}function m(){clearTimeout(i),i=void 0;}function h(){m(),r=n.query,u({matches:p(),isPending:false});}let b,y=0,g=()=>{clearTimeout(b),b=void 0,y=0,r.length>0&&u({matches:p()});},x=()=>{b!==void 0&&g();};e.on("change",T=>{if(r.length===0)return;if(T.source)return g();let C=Date.now();y===0&&(y=C),clearTimeout(b);let E=Math.min(Mh,g5-(C-y));b=setTimeout(g,Math.max(0,E));});let v=e.snapshot().editingMode;e.on("selectionChange",T=>{T.editingMode!==v&&(v=T.editingMode,g());});let k=(T,C)=>{x();let E=n.matches.length;if(E===0)return false;let w=n.activeIndex<0?T>0?-1:0:n.activeIndex;return P.goTo((w+T+E)%E,C)},P={getState:()=>n,subscribe(T){return a.add(T),()=>a.delete(T)},find(T,C={}){m(),r=T;let E=C.matchCase??n.matchCase,w=C.wholeWord??n.wholeWord,I=p(T,{matchCase:E,wholeWord:w});return C.highlight===void 0||C.highlight==="none"?s.delete(o):s.set(o,C.highlight),u({query:T,matchCase:E,wholeWord:w,matches:I,activeIndex:-1,isPending:false}),c(),C.selectFirst&&P.goTo(0),n.matches},setQuery(T){T!==n.query&&(m(),T!==r&&(i=setTimeout(h,Mh)),u({query:T,isPending:T!==r}));},setMatchCase(T){u({matchCase:T,matches:p(r,{...n,matchCase:T})});},setWholeWord(T){u({wholeWord:T,matches:p(r,{...n,wholeWord:T})});},goTo(T,C){x();let E=n.matches[T];return !E||(C?.focus&&e.focus(),!e.selectMatch(E).ok)?false:(u({activeIndex:T}),true)},next:T=>k(1,T),previous:T=>k(-1,T),clear(){m(),r="",s.delete(o),u({query:"",matches:Oh,activeIndex:-1,isPending:false});},showHighlights(T){let C={};return s.set(C,T),c(),()=>{s.delete(C)&&c();}}};return dA.set(e,P),P}var b5=[37,80,68,70,45],tl=class extends Error{constructor(n){super(`Install @docx-editor.dev/docx-to-${n} and configure menu.exporters.${n}.`+(n==="pdf"?" PDF conversion requires a Node.js server.":""));this.format=n;this.name="ChromeExportError";}format;code="missing-exporter"};async function Ah(e,t,n={}){if(t==="markdown"){if(!n.markdown)throw new tl(t);let a=await n.markdown(new Uint8Array(await e.save()));if(typeof a?.markdown!="string")throw new TypeError("The Markdown converter returned no Markdown.");return {bytes:new TextEncoder().encode(a.markdown),extension:"md",mimeType:"text/markdown;charset=utf-8"}}if(t!=="pdf")throw new TypeError("Unsupported export format.");if(!n.pdf)throw new tl(t);let r=e.snapshot?.(),o=r?{displayMode:r.reviewDisplayMode??"proposed",revisionMarkup:r.revisionMarkup,...e.getReviewAuthors?{revisionAuthorSlots:Object.freeze(Object.fromEntries(e.getReviewAuthors().map(({author:a,slot:s})=>[a,s])))}:{}}:void 0,i=await n.pdf(new Uint8Array(await e.save()),o);if(!(i?.bytes instanceof Uint8Array)||i.bytes.length===0)throw new TypeError("The PDF converter returned no PDF bytes.");if(!b5.every((a,s)=>i.bytes[s]===a))throw new TypeError("The PDF converter returned a file without a PDF header.");return {bytes:i.bytes,extension:"pdf",mimeType:"application/pdf"}}var x5=15e3,Xn=class extends Error{code;constructor(t){super(t==="pdf-viewer-unavailable"?"This browser cannot display PDF files in the page.":t==="pdf-load-failed"?"The PDF did not load for printing.":t==="print-refused"?"The browser refused to print the PDF from the page.":"The print job has ended."),this.code=t,this.name="ChromePrintError";}};function S5(e){if(e.altKey||e.shiftKey||typeof e.key!="string")return false;let t=e.key.toLowerCase();return t!=="p"&&(e.code!=="KeyP"||/^[a-z]$/.test(t))?false:isApplePlatform()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}async function w5(e,t={},n=document){let{bytes:r,mimeType:o}=await Ah(e,"pdf",t);return I5(r,o,n)}function I5(e,t,n){let r=n.nodeType===9?n.body:n;if(!r)throw new TypeError("Printing requires a document body.");let o=r.ownerDocument,i=o.defaultView;if(!i)throw new TypeError("Printing requires a document with a window.");let a=e.buffer instanceof ArrayBuffer?e:e.slice(),s=i.URL.createObjectURL(new i.Blob([a],{type:t})),l=null,d=null,c,u=null,p=false,m=y=>{i.clearTimeout(c),u?.(y),u=null,l?.remove(),l=null,d=null;},h=()=>{if(d)return d;let y=o.createElement("iframe");return l=y,y.setAttribute("aria-hidden","true"),y.setAttribute("tabindex","-1"),y.setAttribute("data-docx-print-frame",""),y.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;",d=new Promise((g,x)=>{u=x,c=i.setTimeout(()=>m(new Xn("pdf-load-failed")),x5),y.addEventListener("load",()=>{if(i.clearTimeout(c),!y.contentWindow){m(new Xn("pdf-load-failed"));return}u=null,g(y.contentWindow);},{once:true});}),d.catch(()=>{}),y.src=s,r.append(y),d};return {url:s,async print(y={}){if(p)throw new Xn("print-ended");if(i.navigator.pdfViewerEnabled===false)throw new Xn("pdf-viewer-unavailable");let g=await h();if(p)throw new Xn("print-ended");if(await y.beforePrint?.(),p)throw new Xn("print-ended");let x=o.activeElement;try{g.focus(),g.print();}catch{throw new Xn("print-refused")}finally{x?.isConnected&&x.focus({preventScroll:true});}},dispose(){p||(p=true,m(new Xn("print-ended")),i.URL.revokeObjectURL(s));}}}
27
- export{Wi as $,PR as $a,nA as $b,Dw as A,QN as Aa,O_ as Ab,Hw as B,GI as Ba,Jc as Bb,Ad as C,YI as Ca,eu as Cb,Ap as D,JN as Da,Ph as Db,Fp as E,eD as Ea,__ as Eb,FL as F,vm as Fa,zM as Fb,tm as G,tD as Ga,$_ as Gb,dN as H,nD as Ha,Eh as Hb,ws as I,rD as Ia,V_ as Ib,Is as J,oD as Ja,j_ as Jb,nm as K,iD as Ka,W_ as Kb,cN as L,aD as La,Z_ as Lb,rm as M,sD as Ma,U_ as Mb,Dd as N,lD as Na,z_ as Nb,Et as O,dD as Oa,G_ as Ob,Jo as P,JI as Pa,X_ as Pb,bI as Q,ok as Qa,YM as Qb,Hd as R,yD as Ra,QM as Rb,ur as S,Sm as Sa,J_ as Sb,Rs as T,wm as Ta,e5 as Tb,dm as U,vD as Ua,JM as Ub,um as V,dk as Va,t5 as Vb,wN as W,xD as Wa,n5 as Wb,IN as X,ck as Xa,r5 as Xb,RN as Y,SD as Ya,eA as Yb,PN as Z,wD as Za,tA as Zb,$d as _,ID as _a,o5 as _b,Li as a,BI as aa,Ns as ab,i5 as ac,fs as b,gm as ba,Ds as bb,rA as bc,ud as c,Ts as ca,i2 as cb,a5 as cc,fd as d,MN as da,_m as db,oA as dc,Bf as e,$I as ea,ni as eb,s5 as ec,JA as f,qI as fa,_r as fb,l5 as fc,$f as g,AN as ga,dc as gb,d5 as gc,dL as h,ei as ha,zR as hb,go as hc,cL as i,hm as ia,GR as ib,u5 as ic,Fe as j,DN as ja,$m as jb,f5 as jc,Rp as k,HN as ka,cc as kb,m5 as kc,vL as l,BN as la,qm as lb,Mh as lc,SL as m,Kd as ma,uc as mb,cA as mc,wL as n,WI as na,Vm as nb,uA as nc,vw as o,Vd as oa,Km as ob,fA as oc,IL as p,ZI as pa,jm as pb,y5 as pc,kL as q,UI as qa,GP as qb,tl as qc,RL as r,KN as ra,Tc as rb,Ah as rc,PL as s,jN as sa,$g as sb,Xn as sc,TL as t,WN as ta,_c as tb,S5 as tc,CL as u,UN as ua,W8 as ub,w5 as uc,Sw as v,zN as va,Z8 as vb,ww as w,GN as wa,Rh as wb,Iw as x,XN as xa,Js as xb,EL as y,YN as ya,el as yb,Op as z,bm as za,la as zb};