@docx-editor.dev/core 2.35.0-canary.20261104032723.sha-43c2012 → 2.35.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.
- package/README.md +9 -14
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +16 -11
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +12 -12
- package/dist/binding.js +1 -1
- package/dist/{chrome-print-CK3v5NhC.d.ts → chrome-print-H0uSxdg3.d.ts} +70 -17
- package/dist/{chunk-AMOFXSEO.cjs → chunk-2C75IWUN.cjs} +1 -1
- package/dist/chunk-2NFQ7OXY.cjs +1 -0
- package/dist/chunk-2V3V57SC.js +3 -0
- package/dist/chunk-32YOHLEK.cjs +32 -0
- package/dist/chunk-4NISR27M.cjs +31 -0
- package/dist/chunk-5ZE7ROGP.js +31 -0
- package/dist/{chunk-LZ64O473.js → chunk-66ZAVRGB.js} +1 -1
- package/dist/{chunk-A5GMOQWD.js → chunk-6767S7UF.js} +1 -1
- package/dist/chunk-6BZINLEN.cjs +1 -0
- package/dist/{chunk-EBIMIIC3.js → chunk-AVGSD7FB.js} +5 -5
- package/dist/{chunk-TZTKEPCC.cjs → chunk-CBJMRC4L.cjs} +1 -1
- package/dist/chunk-DCILO4XD.cjs +236 -0
- package/dist/{chunk-FBGZOGLU.cjs → chunk-DSIDCA3V.cjs} +4 -4
- package/dist/chunk-FLEFHRJG.cjs +5 -0
- package/dist/chunk-FMSXJ22B.js +2 -0
- package/dist/{chunk-7ACXKFKO.js → chunk-I4OZW2NO.js} +1 -1
- package/dist/chunk-JGE2O6IF.cjs +3 -0
- package/dist/chunk-K2BBJDM7.js +32 -0
- package/dist/chunk-LMASPHYS.js +1 -0
- package/dist/chunk-NYZP5NM3.js +4 -0
- package/dist/chunk-P3XUE72N.js +236 -0
- package/dist/{chunk-JZ4LO3ZZ.js → chunk-Q5YVLUGG.js} +1 -1
- package/dist/chunk-QALWAAPL.cjs +4 -0
- package/dist/{chunk-ELR6HXOO.js → chunk-QDUMZYTX.js} +1 -1
- package/dist/chunk-QLANEOTJ.cjs +7 -0
- package/dist/{chunk-4NPNKO5U.cjs → chunk-SJV6WCTP.cjs} +1 -1
- package/dist/{chunk-I4WSXFY6.js → chunk-TMCMXIBT.js} +4 -4
- package/dist/{chunk-GTICLPKS.cjs → chunk-TY5CE2JR.cjs} +1 -1
- package/dist/chunk-UAUB5YV6.js +7 -0
- package/dist/{chunk-Q4MUV5KX.cjs → chunk-WWZWT26M.cjs} +1 -1
- package/dist/chunk-Y3JSN52G.cjs +2 -0
- package/dist/chunk-YD3KSZJM.js +1 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +3 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +2 -2
- package/dist/contracts/document.d.ts +2 -2
- package/dist/contracts/editor.d.ts +8 -8
- package/dist/contracts/modules.cjs +1 -1
- package/dist/contracts/modules.d.ts +34 -13
- package/dist/contracts/modules.js +1 -1
- package/dist/contracts/types.d.ts +3 -3
- package/dist/{custom-node-writes-BC3z8NwO.d.ts → custom-node-writes-Cj0itq58.d.ts} +2 -2
- package/dist/{document-protection-8hXPdn5U.d.ts → document-protection-CDLoYQI3.d.ts} +1 -1
- package/dist/{drawing-graphic-kind-_5u2E4ee.d.ts → drawing-graphic-kind-8zt6pugF.d.ts} +2 -2
- package/dist/{drawing-preview-package-JyAqL6OV.d.ts → drawing-preview-package-8o9LSfzP.d.ts} +1 -1
- package/dist/{editor-BGCdE3tB.d.ts → editor-CujQcn1z.d.ts} +20 -10
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +3 -3
- package/dist/editor.d.ts +52 -29
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +6 -6
- package/dist/export.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-D2qNes9-.d.ts → layout-shaping-ZjLRz_qa.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +25 -21
- package/dist/layout.js +1 -1
- package/dist/{note-properties-DGPzKUuA.d.ts → note-properties-BRpskBeh.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +10 -10
- package/dist/output.js +1 -1
- package/dist/{protocol-0y3iaYj9.d.ts → protocol-GVVQQwCX.d.ts} +13 -2
- package/dist/{review-paragraph-order-DeQp2_iu.d.ts → review-paragraph-order-aEHnQTt7.d.ts} +5 -2
- package/dist/{revision-projection-CrAv-HP6.d.ts → revision-projection-vU_UiTLx.d.ts} +1 -1
- package/dist/{semantic-cell-selection-CeG_qqDV.d.ts → semantic-cell-selection-CaRIISu-.d.ts} +2 -2
- package/dist/{semantic-interaction-DcE_ZsiD.d.ts → semantic-interaction-LJtUJJS5.d.ts} +1 -1
- package/dist/{semantic-paint-DfeN6UQF.d.ts → semantic-paint-2LBYlQcn.d.ts} +11 -4
- package/dist/{semantic-record-queries-qwd9Ict6.d.ts → semantic-record-queries-C_YK2gCz.d.ts} +1 -1
- package/dist/{semantic-records-thL1rcmG.d.ts → semantic-records-AU2pIYRp.d.ts} +3 -3
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +1664 -1664
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-CGlwCQXg.d.ts → tree-op-types-DmrePCMo.d.ts} +320 -11
- package/dist/{tree-package-store-D0_BOm-r.d.ts → tree-package-fragment-DXZ2B7x0.d.ts} +702 -691
- package/dist/{tree-session-contract-DkThhHjy.d.ts → tree-session-contract-D3e-5YNq.d.ts} +19 -4
- package/dist/{unsupported-elements-qj0sXi2s.d.ts → unsupported-elements-9Pz4I_F6.d.ts} +1 -1
- package/docs/accept-reject-without-scrolling.md +31 -48
- package/docs/comment-on-found-text.md +47 -23
- package/docs/custom-review-cards.md +50 -34
- package/docs/highlight-ranges.md +26 -6
- package/docs/index.md +21 -21
- package/docs/propose-rewrite.md +87 -138
- package/docs/tracked-replacement.md +41 -20
- package/package.json +2 -2
- package/dist/chunk-4C7JUJDX.cjs +0 -1
- package/dist/chunk-4HENIAFG.js +0 -1
- package/dist/chunk-6IYKYYWF.js +0 -32
- package/dist/chunk-CDAFCPT6.cjs +0 -3
- package/dist/chunk-CU6QPXKD.js +0 -2
- package/dist/chunk-EMITIPLN.js +0 -4
- package/dist/chunk-IGB66DIX.cjs +0 -30
- package/dist/chunk-JQPTNBLT.js +0 -236
- package/dist/chunk-JVWRILO3.cjs +0 -4
- package/dist/chunk-KOYEBRLV.js +0 -1
- package/dist/chunk-KZZPOZOF.cjs +0 -2
- package/dist/chunk-NPWMZIPA.cjs +0 -32
- package/dist/chunk-NS2QCOAS.js +0 -7
- package/dist/chunk-O2PGRL5D.js +0 -3
- package/dist/chunk-TFJUIP4X.cjs +0 -236
- package/dist/chunk-V3N4SOAK.cjs +0 -1
- package/dist/chunk-V6FOPP2H.js +0 -30
- package/dist/chunk-XFEIUKOS.cjs +0 -7
- package/dist/chunk-ZF4N3N3L.cjs +0 -5
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {a as a$2}from'./chunk-YD3KSZJM.js';import {s,o as o$1,j,i,v,w as w$1,q as q$1,k as k$1,n as n$1,p,f as f$1,g as g$1,e as e$1,d as d$1,h,t}from'./chunk-TMCMXIBT.js';import {w,x,o,s as s$1,u,g as g$2,a as a$4,k as k$2,j as j$3,i as i$2,F as F$2,I as I$1,h as h$1,b as b$3,G as G$3,f as f$4,D as D$3,v as v$1,l as l$3,J as J$1,K as K$2,C as C$1,A as A$1,y,c as c$3}from'./chunk-FMSXJ22B.js';import {k,e,r,Z,ha,oa as oa$1,ma as ma$1,ga,j as j$2,_,$,aa as aa$1,pa as pa$1,ka,qa,ja,ra as ra$1,sa as sa$1,ta as ta$1,ia as ia$1,na as na$1,la as la$2,G as G$2,W,c as c$2,t as t$1,fa as fa$1}from'./chunk-2V3V57SC.js';import {B,D,u as u$1,q,s as s$2,r as r$1,j as j$1,c,x as x$1,G,L,K,E,I,M,A,F,i as i$1,e as e$2,C,N,O,a as a$6,b as b$1,d as d$3,g as g$3,f as f$3,h as h$3}from'./chunk-UAUB5YV6.js';import {b,a as a$5,f as f$2,e as e$3,g as g$4}from'./chunk-LMASPHYS.js';import {d,hb as hb$1,a as a$1,l,Fe,if as _if,Bg as Bg$1,Cf as Cf$1,Rf as Rf$1,Sf as Sf$1,yg,Re,lb as lb$1,Xf as Xf$1,Ld,Vf as Vf$1,Se,Eb as Eb$1,$a,He,Ke as Ke$1,la as la$1,Xb as Xb$1,ee,Vd,Cb as Cb$1,Af as Af$1,mb as mb$1,nb as nb$1,pb as pb$1,ob as ob$1,ed,fd,gd,Of as Of$2,be,ae,Qb as Qb$1,Yb as Yb$1,Uf as Uf$1,Ye,_e,Ze as Ze$1,df as df$1,fb as fb$1,cf as cf$1,Ja,hd,Ue,Ka as Ka$1,Ie,Wb as Wb$1,Ve,cb as cb$1,Kd,mf as mf$1,Zb as Zb$2,$b as $b$1,ef as ef$1,$c as $c$1,Gd,Ia as Ia$1,Ef as Ef$2,te,ic as ic$1,qa as qa$1,Te,ze,ve,If as If$1,Ff as Ff$2,Gf as Gf$1,Hf as Hf$1,ib as ib$1,jc as jc$1,ce,uf as uf$1,wf as wf$1,Dd,Oe as Oe$1,$e,eb as eb$2,_d,db as db$1,Za,Qe as Qe$2,Le,Xe,E as E$2,D as D$1,T,ca as ca$1,_ as _$1,Cd,rf as rf$1,Ga,uc as uc$1,tf as tf$1,xe,ye as ye$1,Be,Me,oe,Vb as Vb$1,_a,Sa,_b as _b$1,Bf as Bf$2,qe as qe$1,Ab as Ab$1,ff as ff$1,bd,Xa,ab as ab$1,lf as lf$1,aa as aa$2,Bd,Jd,bb,Ra,tc as tc$1,wc as wc$2,Tf as Tf$2,od,kf as kf$1,cd as cd$1,Xc,Ad,yb as yb$1,og,pd as pd$1,Md,Ag as Ag$1,zg as zg$1,h as h$2,gf as gf$1,q as q$2,p as p$1,ng as ng$1,_c as _c$1,mg as mg$1,Ed}from'./chunk-K2BBJDM7.js';import {m,n,d as d$2,i as i$3,k as k$3,j as j$4,l as l$2}from'./chunk-AVGSD7FB.js';import {a as a$7}from'./chunk-66ZAVRGB.js';import {S,Ia,Aa,E as E$1,G as G$1,F as F$1,D as D$2,M as M$1,J,L as L$1}from'./chunk-NYZP5NM3.js';import {a as a$3,b as b$2}from'./chunk-WN7ICTA5.js';import {c as c$1}from'./chunk-I4OZW2NO.js';import {eb as eb$1,f,Bf as Bf$1,sm,Oe,Dk,Ek,Fk,g,Bh as Bh$1,Pi,Uh as Uh$1,Yi as Yi$1,Wi as Wi$1,Xi as Xi$1,ml,xn as xn$1,Eh as Eh$1,Ni,pj as pj$1,Hb as Hb$1,li as li$1,Of as Of$1,Tf as Tf$1,in as _in,We,Pe,Qe as Qe$1,Se as Se$1,rn as rn$1,sn,U,mn,on as on$1,jn as jn$1,nn,bk,Xm,Mn,Kn as Kn$1,wb as wb$1,gm,Mk,ri as ri$1,di as di$1,ci as ci$1,ei as ei$1,Ka,Yk,Ik,Hk,Qk,ll,lg,Ic as Ic$1,en as en$1,Zb as Zb$1,ld,bj as bj$1,jj as jj$1,Hc as Hc$1,vl,xh as xh$1,cd,Cf as Cf$2,Df as Df$1,zf as zf$1,Af as Af$2,Ef as Ef$1,Ff as Ff$1,vi,wi,oi as oi$1,ni as ni$1,bi,ai as ai$1,_h as _h$1,Bk,Nb as Nb$1,ym,id,hj as hj$1,Jm,_k,Om,Pm,Sm,Tm,Vg as Vg$1,Ah as Ah$1,Ei,be as be$1,Vh as Vh$1,gi,xi,$h as $h$1,ne,l as l$1,vb as vb$1,Sk,zk,_m,Ck,Uk,Ej as Ej$1,Cj as Cj$1,fn,gn,Qd,fd as fd$1,Eg,fb as fb$2,_j as _j$1,ad,Tc as Tc$1,Rc as Rc$1,xl,yi,zi as zi$1,Lh as Lh$1,qc as qc$1,r as r$2,mi,pa as pa$2,md,pd,Jn,bn,nl,Xj as Xj$1,sl,Kh as Kh$1,sc as sc$1,om,wc as wc$1,vc,_d as _d$1,$f as $f$1,_f as _f$1,Gi as Gi$1,Ud,ma as ma$2,va,oa as oa$2,Rm,Bl,Cl,Ug as Ug$1,Zi as Zi$1,Ua,qm,jm,lm,Ol,hm,Oh as Oh$1,dn,cn,qj,Ci,Nc as Nc$1,Sh as Sh$1,Qh as Qh$1,Mg as Mg$1,Gg as Gg$1,Ig,Nk,Wk,Xk,dl,Zl as Zl$1,$l as $l$1,_b as _b$2,ij as ij$1,hd as hd$1,Pa,ud,lb as lb$2,rg,Gk,Qm,Th as Th$1,jl as jl$1,Fl,im,Aa as Aa$1,Ba,Ca,pl,ol,kl,Dj as Dj$1,En,tg,Rb as Rb$1,Jk,kc as kc$1,hc as hc$1,W as W$1,E as E$3,Jh as Jh$1,Fi,yh as yh$1,V,cm,dh as dh$1,ng,bf as bf$1,af as af$1,ba,Lg as Lg$1,nd,ya,Kg as Kg$1,Ng as Ng$1,Z as Z$1,wa,K as K$1,He as He$1,Yb as Yb$2,bh as bh$1,Ub as Ub$1,cc as cc$1,fj as fj$1,zb as zb$1,ph as ph$1,mg,ab as ab$2}from'./chunk-P3XUE72N.js';import {a}from'./chunk-S6J4O5XP.js';import {zipSync,strToU8}from'fflate';import {createT,en,isApplePlatform,locales,deepMerge}from'@docx-editor.dev/i18n';function GI(e){return e===void 0?void 0:Object.freeze({maxFontBytes:j$2(e).maxFontBytes})}function W8(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var VI=false;function zI(e){if(VI)return;VI=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 $i(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:W8(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),cause:e$1})}async function $l(e,t,n){try{return await r(e,t,n)}catch(r){throw $i(r)}}var Eu=Object.freeze({opening:"auto",overflow:"float",revisionsIn:"pane",commentMarkers:"icon"}),Cg={opening:["auto","manual"],overflow:["float","shrinkPage","scroll"],revisionsIn:["pane","balloons"],commentMarkers:["initials","icon"]};function Cu(e,t=Eu){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(Cg,r))throw new TypeError(`unknown review pane setting ${r}`);let i=r;if(typeof o!="string"||!Cg[i].includes(o))throw new TypeError(`review pane ${i} must be ${Cg[i].join(" or ")}`);n[i]!==o&&(n={...n,[i]:o});}return n===t?t:Object.freeze(n)}function Og(e,t){return e==="pane"?true:t.kind==="revision"?false:!(t.kind==="comment"&&t.parentRevisionId!==void 0)}var q8=Object.freeze({revisionMarkup:hb$1,reviewPane:Eu,scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,openFailure: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"});function K8(e){return o(t=>{let n=[],r=s$1([e],t,{onOriginFailure:o=>n.push(o.cause)}).then(o=>n.length>0?{sources:[],...o,failures:n}:o,o=>t.signal?.aborted?void 0:{sources:[],failures:[o]});return {sources:[],deferred:r}})}var XI="http://schemas.openxmlformats.org/wordprocessingml/2006/main",j8="http://schemas.openxmlformats.org/package/2006/content-types",YI="http://schemas.openxmlformats.org/package/2006/relationships",V8="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",G8="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",z8=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${j8}"><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>`,Z8=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${YI}"><Relationship Id="rId1" Type="${V8}" Target="word/document.xml"/></Relationships>`,X8=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${YI}"><Relationship Id="rId1" Type="${G8}" Target="styles.xml"/></Relationships>`,Y8=[{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}],Q8=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>",J8=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${XI}"><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>`+Y8.map(Q8).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>',ZI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${XI}"><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>`,e6=/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8}){0,4}$/;function Mg(e={}){let t=e.direction==="rtl",n=e.bidiLanguage!==void 0&&e6.test(e.bidiLanguage)?e.bidiLanguage:null,r=J8.replace('<w:sz w:val="22"/><w:szCs w:val="22"/>',`<w:sz w:val="22"/><w:szCs w:val="22"/>${n?`<w:lang w:bidi="${n}"/>`:""}`).replace("<w:pPrDefault><w:pPr>",`<w:pPrDefault><w:pPr>${t?"<w:bidi/>":""}`),o=t?ZI.replace("</w:sectPr>","<w:bidi/></w:sectPr>"):ZI;return zipSync({"[Content_Types].xml":strToU8(z8),"_rels/.rels":strToU8(Z8),"word/_rels/document.xml.rels":strToU8(X8),"word/document.xml":strToU8(o),"word/styles.xml":strToU8(r)})}function Wi(e){if(e){if(e.nodeType===9)return e;if(e.ownerDocument)return e.ownerDocument}return globalThis.document}function Ae(e){return Wi(e)?.defaultView??globalThis}var QI=new WeakMap;function JI(e,t){QI.set(e,t);}function t6(e){return wo(e)}function wo(e){return QI.get(e)?.()??null}function eR(e){let t=e.ownerDocument?.defaultView;return t?t.closed?"attach() needs an element in an open window; this window has closed":null:"attach() needs an element in a document with a window; this one has none"}function n6(e){return Wi(wo(e))}function r6(e){return Ae(wo(e))}function qt(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function Vr(e){return qt(e)&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function o6(e){return typeof e=="object"&&e!==null&&e.nodeType===3}function So(e){return typeof e=="object"&&e!==null&&typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function Ou(e,t){return Vr(e)&&e.localName===t}function Ag(){return globalThis}function nt(e){let t=0,n=new Map,r=new Map;function o(f,p){f.win=p,f.native=f.kind==="frame"&&typeof p.requestAnimationFrame=="function"?p.requestAnimationFrame(f.fire):p.setTimeout(()=>f.fire(p.performance?.now()??Date.now()),Math.max(0,f.dueAt-Date.now())),a(p);}function i(f){f.kind==="frame"&&typeof f.win.cancelAnimationFrame=="function"?f.win.cancelAnimationFrame(f.native):f.win.clearTimeout(f.native);}function a(f){if(r.has(f)||f===Ag())return;let p=()=>{s(f);let g=Ae(e()),b=g===f?Ag():g;for(let y of n.values())y.win===f&&(i(y),o(y,b));};f.addEventListener("pagehide",p),r.set(f,p);}function s(f){let p=r.get(f);p&&(r.delete(f),f.removeEventListener("pagehide",p));}function l(f){let p=n.get(f);if(p){n.delete(f);for(let g of n.values())if(g.win===p.win)return;s(p.win);}}function c(){if(n.size===0)return;let f=Ae(e());for(let p of n.values()){if(p.win===f)continue;let g=p.win;i(p),o(p,f);let b=false;for(let y of n.values())y.win===g&&(b=true);b||s(g);}}function d(f,p,g=0){c();let b=++t,y={kind:f,win:Ag(),native:0,dueAt:Date.now()+g,fire:h=>{l(b),p(h);}};return n.set(b,y),o(y,Ae(e())),b}function u(f){if(f==null)return;let p=n.get(f);p&&(i(p),l(f));}return {setTimeout:(f,p)=>d("timeout",()=>f(),p),clearTimeout:u,requestAnimationFrame:f=>d("frame",f),cancelAnimationFrame:u,migrate:c}}function es(e){return typeof e.key=="string"&&"repeat"in e}function Mu(e){return typeof e.pointerId=="number"}function i6(e){return typeof e.button=="number"&&"clientX"in e}function Lg(e){return typeof e.inputType=="string"}var a6=1;function s6(e){let t=Ae(e);if(t.getComputedStyle(e).direction==="rtl")return ()=>{};let n=()=>e.scrollWidth-e.clientWidth,r=true,o=null,i=()=>{r&&(e.scrollLeft=n(),o=e.scrollLeft);},a=()=>{e.scrollLeft!==o&&(o=null,r=e.scrollLeft>=n()-a6);};i(),e.addEventListener("scroll",a,{passive:true}),e.addEventListener("transitionend",i);let s=null;if(typeof t.ResizeObserver=="function"){s=new t.ResizeObserver(i),s.observe(e);for(let l of Array.from(e.children))s.observe(l);}return ()=>{s?.disconnect(),e.removeEventListener("scroll",a),e.removeEventListener("transitionend",i);}}function l6(e,t,n,r){let o=Math.min(e.right,n.width-t.width-8),i=Math.max(8,e.left-t.width),a=e.right+t.width<=n.width-8,s=e.left-t.width>=8,l=r?s?i:o:a?o:i,c=Math.max(8,Math.min(e.top-4,n.height-t.height-8));return {left:l,top:c}}function c6(e){return e?{open:"ArrowLeft",close:"ArrowRight"}:{open:"ArrowRight",close:"ArrowLeft"}}function Fg(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return "host"in t?t.host??null:null}function d6(e){for(let t=e;t;t=Fg(t)){let n=t.getAttribute("dir")?.toLowerCase();if(n==="rtl"||n==="ltr")return n}return "ltr"}function u6(e,t){let n=Ae(e);if(typeof n.MutationObserver!="function")return ()=>{};let r=a=>{for(let s=e;s;s=Fg(s))if(s===a)return true;return false},o=new n.MutationObserver(a=>{a.some(s=>r(s.target))&&t();}),i={attributes:true,attributeFilter:["dir"],subtree:true};o.observe(e.ownerDocument.documentElement,i);for(let a=e;a;a=Fg(a)){let s=a.getRootNode();s!==e.ownerDocument&&!a.parentElement&&o.observe(s,i);}return ()=>o.disconnect()}var tR="http://schemas.microsoft.com/office/2004/12/omml",f6="http://www.w3.org/1998/Math/MathML",p6=4096,nR=32;function rR(e,t){return e.failed||t>nR||e.left<=0?(e.failed=true,false):(e.left-=1,true)}function ql(e,t){return e.kind!=="textValue"&&e.namespaceUri===Eg&&(t===void 0||e.localName===t)}function Dg(e,t){if(e.kind!=="textValue")return e.attributes.find(n=>n.localName==="val"&&n.namespaceUri===t)?.value}function oR(e,t,n){if(!rR(t,n))return "";if(e.kind==="textValue")return e.value;let r="";for(let o of e.children)r+=oR(o,t,n+1);return r}function m6(e,t,n){if(e.kind==="textValue")return "";let r="",o,i=false,a;for(let d of e.children)if(ql(d,"t"))r+=oR(d,t,n+1);else if(ql(d,"rPr")&&d.kind!=="textValue")for(let u of d.children)ql(u,"sty")&&(o=Dg(u,Eg)),ql(u,"nor")&&(i=true);else if(d.kind!=="textValue"&&d.namespaceUri===pa$2&&d.localName==="rPr"){let u=d.children.find(p=>p.kind!=="textValue"&&p.localName==="color"),f=u?Dg(u,pa$2):void 0;f&&/^[0-9A-Fa-f]{6}$/.test(f)&&(a=f.toUpperCase());}if(r.length===0)return "";let s=`<m:r>${V(r)}</m:r>`;a!==void 0&&(s=`<span style="color:#${a}">${s}</span>`);let l=!i&&(o===void 0||o==="i"||o==="bi"),c=o==="b"||o==="bi";return l&&(s=`<i>${s}</i>`),c&&(s=`<b>${s}</b>`),s}function iR(e,t,n){if(e.kind==="textValue"||!ql(e)||!rR(t,n))return "";if(e.localName==="r")return m6(e,t,n);if(e.localName==="ctrlPr")return "";let r=Dg(e,Eg),o=r===void 0?"":` m:val="${W$1(r)}"`,i="";for(let a of e.children)i+=iR(a,t,n+1);return i.length>0?`<m:${e.localName}${o}>${i}</m:${e.localName}>`:`<m:${e.localName}${o}/>`}function g6(e){let t="";for(let n of e.match(/\d+(?:\.\d+)?|\p{L}|\s+|./gu)??[]){if(/^\s+$/.test(n))continue;let r=V(n);/^\d/.test(n)?t+=`<mn>${r}</mn>`:/^\p{L}$/u.test(n)?t+=`<mi>${r}</mi>`:t+=`<mo>${r}</mo>`;}return t}function Ng(e,t){if(t>nR)return "";let n=r=>`<mrow>${Ng(r,t+1)}</mrow>`;switch(e.kind){case "text":return e.format?.normalText?`<mtext>${V(e.value)}</mtext>`:g6(e.value);case "fallback":return `<mtext>${V(e.text)}</mtext>`;case "row":return e.items.map(r=>Ng(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 "borderBox":return `<menclose notation="${[e.hidden.top?"":"top",e.hidden.bottom?"":"bottom",e.hidden.left?"":"left",e.hidden.right?"":"right",e.strikes.horizontal?"horizontalstrike":"",e.strikes.vertical?"verticalstrike":"",e.strikes.bottomLeftToTopRight?"updiagonalstrike":"",e.strikes.topLeftToBottomRight?"downdiagonalstrike":""].filter(Boolean).join(" ")}">${n(e.body)}</menclose>`;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>${V(e.operator)}</mo>`,o=e.lowerLimit?n(e.lowerLimit):"",i=e.upperLimit?n(e.upperLimit):"",[a,s,l]=e.limitLocation==="subSup"?["msubsup","msub","msup"]:["munderover","munder","mover"];return `<mrow>${o&&i?`<${a}>${r}${o}${i}</${a}>`:o?`<${s}>${r}${o}</${s}>`:i?`<${l}>${r}${i}</${l}>`:r}${n(e.body)}</mrow>`}}}function aR(e){if(!Lg$1(e))return "";let t=Kg$1(e),n=t?Ng$1(e):Gg$1(e),r={left:p6,failed:false},o=iR(e,r,0),i=n===null?"":`<math xmlns="${f6}"${t?' display="block"':""}>${Ng(n.expression,0)}</math>`;return r.failed||o.length===0?i:`<!--[if gte msEquation 12]>${o}<![endif]--><![if !msEquation]>${i}<![endif]>`}function sR(e){return e.includes("<!--[if gte msEquation 12]>")}var ts="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h6=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<ts.length;t+=1)e[ts.charCodeAt(t)]=t;return e})();function Au(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 c=0,d=0;for(let u=0;u<4;u+=1){let f=r.charCodeAt(l+u);if(f===61){if(l+u<r.length-o)return null;continue}let p=f<128?h6[f]:-1;if(p<0)return null;c=c<<6|p,d+=6;}c<<=24-d,d>=12&&(a[s++]=c>>>16&255),d>=18&&(a[s++]=c>>>8&255),d>=24&&(a[s++]=c&255);}return s===i?a:null}function Lu(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+=ts[o>>2]+ts[(o&3)<<4|i>>4],n+=r+1<e.length?ts[(i&15)<<2|a>>6]:"=",n+=r+2<e.length?ts[a&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var y6=16*1024*1024,cR=64*1024*1024,dR="data-docx-fragment",uR="data-docx-fragment-end",b6=Lu;function fR(e,t){let n=t?.lastMarkCovered?"covered":"open",r=t?`<div ${dR}="${b6(t.bytes)}" ${uR}="${n}">${e}</div>`:`<div>${e}</div>`;return sR(e)?`<html xmlns:m="${tR}"><body>${r}</body></html>`:r}function lR(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>cR)return null;let o=r+n.length,i=e.indexOf('"',o);return i===-1?null:e.slice(o,i)}function jo(e,t=y6){if(e.length>cR)return null;let n=lR(e,dR);if(n===null||n.length===0)return null;let r=Au(n,t);if(r===null||r.byteLength===0)return null;let o=lR(e,uR);return {bytes:r,lastMarkCovered:o==="covered"}}function qi(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}function Bn(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}var Hg="Unknown",$g=255,_g='w:id="?"';function pR(e){let t=Bn(e??"").replace(/[\t\n\r]+/g," ").trim().slice(0,$g);return t.length>0?t:Hg}function v6(e){if(e===null||e.length>4*$g)return Hg;let t=/^\s*mailto:(.*)$/i.exec(e);if(!t)return Hg;let n=t[1];try{n=decodeURIComponent(n);}catch{}return pR(n)}function Kl(e,t,n){let r=Number(e);return r>=t&&r<=n}function mR(e,t,n,r,o){if(!Kl(e,1,9999)||!Kl(t,1,12)||!Kl(r,0,23)||!Kl(o,0,59))return;let i=new Date(Date.UTC(2e3,Number(t),0)).getUTCDate(),a=Number(e)%4===0&&(Number(e)%100!==0||Number(e)%400===0);if(Kl(n,1,t==="02"&&!a?28:i))return `${e}-${t}-${n}T${r}:${o}:00Z`}function x6(e){let t=/^\s*(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e??"");return t?mR(t[1],t[2],t[3],t[4],t[5]):void 0}function Bg(e){if(e===void 0||e.length>4*$g)return null;let t=/^\s*"([^"]*)"\s+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/.exec(e);if(!t)return null;let n=mR(t[2],t[3],t[4],t[5],t[6]);return {author:pR(t[1]),...n===void 0?{}:{date:n}}}function gR(e,t,n){if(t!=="ins"&&t!=="del")return null;let r=e.getAttribute("cite");if(!n&&!/^\s*mailto:/i.test(r??""))return null;let o=x6(e.getAttribute("datetime"));return {kind:t,author:v6(r),...o===void 0?{}:{date:o}}}function Vo(e){return `${_g} w:author="${W$1(e.author)}"`+(e.date===void 0?"":` w:date="${e.date}"`)}function hR(e){return e.replace(/<w:t(?=[ >/])/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>")}var w6=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/;function yR(e,t){let n=[],r="",o=()=>{r.length!==0&&(n.push(`<w:${e.kind} ${Vo(e)}>${r}</w:${e.kind}>`),r="");};for(let i of t){let a=e.kind==="del"?hR(i):i;a.includes("<w:hyperlink")||w6.test(a)?(o(),n.push(a)):r+=a;}return o(),n}function bR(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){let o=e[r],i=o.kind==="del"?hR(n):n;n=`<w:${o.kind} ${Vo(o)}>${i}</w:${o.kind}>`;}return n}function vR(e){let t=e.find(r=>r.kind==="ins"),n=e.find(r=>r.kind==="del");return (t?`<w:ins ${Vo(t)}/>`:"")+(n?`<w:del ${Vo(n)}/>`:"")}function Wg(e){return Bg(e.get("mso-prop-change"))}function xR(e){let t=Bg(e.get("mso-table-inserted")),n=Bg(e.get("mso-table-deleted"));return (t?`<w:ins ${Vo(t)}/>`:"")+(n?`<w:del ${Vo(n)}/>`:"")}function qg(e){return /!\s*msorm\s*$/i.test(e)}function Kg(e,t){let n=e.getAttribute("style");if(!n||n.length>8192||!/msorm/i.test(n))return t;let r=new Map(t);for(let o of n.split(";")){let i=o.indexOf(":");if(i<=0)continue;let a=o.slice(i+1).trim();if(!qg(a))continue;let s=o.slice(0,i).trim().toLowerCase();r.set(s,a.replace(/!\s*msorm\s*$/i,"").trim());}return r}function wR(e,t){return `<w:rPrChange ${Vo(e)}>${t||"<w:rPr/>"}</w:rPrChange>`}function SR(e,t){return `<w:pPrChange ${Vo(e)}>${t||"<w:pPr/>"}</w:pPrChange>`}function kR(e){if(e.changeXml===void 0)return e;let{changeXml:t,...n}=e;return n}function IR(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1){let o=n[r];o.includes(_g)&&(n[r]=o.replaceAll(_g,()=>`w:id="${t++}"`));}}var jg=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],Ug={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText",TOCHeading:"MsoTocHeading",...Object.fromEntries(Array.from({length:9},(e,t)=>[`TOC${t+1}`,`MsoToc${t+1}`]))},Vg=new Map([...Object.entries(Ug).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function RR(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(Ug,e)?Ug[e]:null}var Gg=Object.fromEntries(s),zg={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function PR(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:`"${Z$1(n)}"`}var S6=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 Ki(e){if(e===null)return null;let t=Jh$1(e,"val",pa$2);if(t===void 0||t==="nil"||t==="none")return null;let n=S6.get(t)??"solid",r=Jh$1(e,"sz",pa$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=Jh$1(e,"color",pa$2),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${a} ${n} ${l.toLowerCase()}`}function TR(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 k6=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"]]),I6=new Set(jg);function ER(e){if(e===null)return [];let t=Jh$1(e,"val",pa$2),n=[],r=t===void 0?void 0:k6.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&I6.has(t)&&n.push(`text-underline:${t}`);let o=Jh$1(e,"color",pa$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 CR(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function OR(e,t,n,r){if(e.namespaceUri!==pa$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=Jh$1(e,"id",pa$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 c=a==="footnote",d=o!==null,u=c?"MsoFootnoteReference":"MsoEndnoteReference",f=c?"ftn":"edn",p=d?`#_${f}ref${l}`:`#_${f}${l}`,g=d?`_${f}${l}`:`_${f}ref${l}`;return `<a style="mso-${c?"footnote":"endnote"}-id:${f}${l}" href="${p}" name="${g}"><span class="${u}"><span style="mso-special-character:footnote">[${n(a,l)}]</span></span></a>`}function MR(e){if(e.namespaceUri!==pa$2||e.localName!=="ptab")return "";let t=Jh$1(e,"alignment",pa$2),n=Jh$1(e,"relativeTo",pa$2),r=Jh$1(e,"leader",pa$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 Tt(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 FR(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 DR(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=Vg.get(r);if(a!==void 0)return a}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(Qe(e)):null;return n?`Heading${n[1]}`:void 0}var NR=262144,R6=4096,P6=256,T6=2048,E6=8,C6=new Set(["MsoNormal",...Vg.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),O6=new Map([["left","left"],["start","start"],["center","center"],["right","right"],["end","end"],["justify","both"]]),M6=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function A6(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 L6(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 F6(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return L6(e,n)}return null}function D6(e){let t=e.split(",");if(t.length===0||t.length>E6)return null;let n=[];for(let r of t){let o=M6.exec(r);if(!o)return null;let i=o[2];if(!C6.has(i))return null;n.includes(i)||n.push(i);}return n}function N6(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=O6.get(i.slice(0,a));s!==void 0&&(t=s);}return t}function H6(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>NR)return n();let r=A6(e),o=0,i=0;for(;o<r.length&&i<R6;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let f=F6(r,o);if(f===null)return n();o=f;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 c=r.slice(a+1,l);if(i+=1,o=l+1,s.length>P6||c.length>T6||c.includes("{"))return n();let d=D6(s),u=N6(c);if(!(!d||u===void 0))for(let f of d)t.set(f,u);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function HR(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>NR)return new Map;let i=H6(o);if(!i.ok)return new Map;for(let[a,s]of i.alignments)t.set(a,s);}return t}var _6=262144;function _R(e,t=_6){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 BR(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 Zg(e,t,n,r){let o=Tt(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 ns(e){return e.nodeType===1}function Qe(e){return e.tagName.toLowerCase()}var B6=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(":"))),$6=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"]]),W6=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,q6=new Map(jg.map(e=>[e.toLowerCase(),e])),AR=new WeakMap;function kt(e){let t=AR.get(e);if(t!==void 0)return t;let n=new Map;AR.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&&!qg(s)&&(n.delete(a),n.set(a,s));}return n}function Go(e){let t=e.trim().toLowerCase(),n=B6.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 K6(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return $6.get(t)}function LR(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||W6.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:Go(t)}function $n(e,t,n){return Math.min(n,Math.max(t,e))}function Du(e){let t=null;for(let[n,r]of e)if(n==="background")t=LR(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let i=LR(r);i!==null&&(t=i);}return t}var U6=new Set(["left","center","right","decimal","bar"]),j6=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function V6(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(U6.has(o)){t=o;continue}if(o==="list"){t="left";continue}let i=j6.get(o);if(i!==void 0){n=i;continue}let a=Tt(o);if(!(a===null||a<0)){if(r.push({val:t,posTwips:$n(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 G6=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function Xg(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var z6=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Fu(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let i of Xg(e)){let a=i.toLowerCase();if(a==="none"||a==="hidden"){n=true;continue}let s=G6.get(a);if(s!==void 0){t=s;continue}let l=z6.get(i.toLowerCase())??Tt(i);if(l!==null){r=l;continue}let c=Go(i);if(c!==null){o=c;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:$n(Math.round(r*8),2,96),color:o??"000000"}}function Nu(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function Ul(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 Ui(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let w=Number.parseInt(r,10);r==="bold"||w>=600?n.bold=true:(r==="normal"||w<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 w of l.trim().split(/\s+/)){let v=w.toLowerCase(),k=q6.get(v);if(k!==void 0)n.underline=true,n.underlineVal=k;else {let E=Go(w);E!==null&&(n.underlineColor=E);}}let c=t.get("text-decoration-style")?.trim().toLowerCase();if(c==="double"&&n.strike&&!n.underline&&(n.doubleStrike=true),n.underline){c==="double"?n.underlineVal="double":c==="dotted"?n.underlineVal="dotted":c==="dashed"?n.underlineVal="dash":c==="wavy"&&(n.underlineVal="wave");let w=Go(t.get("text-decoration-color")??"");w!==null&&(n.underlineColor=w);}let d=Go(t.get("color")??"");d&&(n.color=d);let u=K6(t.get("mso-highlight"));if(u)n.highlight=u,delete n.shdFill;else {let w=Du(t);w&&(n.shdFill=w);}let f=Tt(t.get("font-size")??"");f!==null&&f>0&&(n.szHalfPoints=$n(Math.round(f*2),2,3276));let p=t.get("font-family");if(p!==void 0){let w=p.split(",")[0].trim().replace(/^['"]|['"]$/g,"");w.length>0&&w.length<=64&&(n.font=w);}let g=Tt(t.get("letter-spacing")??"");g!==null&&(n.charSpacingTwentieths=$n(Math.round(g*20),-31680,31680));let b=t.get("vertical-align")?.trim().toLowerCase();b==="sub"?n.vertAlign="subscript":b==="super"&&(n.vertAlign="superscript");let y=qi(t.get("mso-ansi-language")),h=qi(t.get("mso-fareast-language")),x=qi(t.get("mso-bidi-language"));return y!==null&&(n.langVal=y),h!==null&&(n.langEastAsia=h),x!==null&&(n.langBidi=x),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function ji(e,t){let n=Ui(e,kt(t)),r=qi(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function Hu(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 h=o.trim().split(/\s+/).map(x=>Tt(x));if(h.length>=1&&h.length<=4&&!h.some(x=>x===null)){let[x,w=x,v=x,k=w]=h.length===2?[h[0],h[1],h[0],h[1]]:h.length===3?[h[0],h[1],h[2],h[1]]:h;r.top=x??null,r.right=w??null,r.bottom=v??null,r.left=k??null;}}let i=Tt(t.get("margin-left")??"")??r.left;i!==null&&(i>0||i===0&&!e.numPr)&&(e.indLeftTwips=$n(Math.round(i*20),0,31680));let a=Tt(t.get("margin-right")??"")??r.right;a!==null&&a>=0&&(e.indRightTwips=$n(Math.round(a*20),0,31680));let s=Tt(t.get("mso-text-indent-alt")??"");if(s!==null)e.firstLineTwips=$n(Math.round(s*20),-31680,31680);else {let h=Tt(t.get("text-indent")??"");if(h!==null&&h!==0){let x=$n(Math.round(h*20),-31680,31680);x!==0&&(e.firstLineTwips=x);}}let l=Tt(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=$n(Math.round(l*20),0,31680));let c=Tt(t.get("margin-bottom")??"")??r.bottom;c!==null&&c>=0&&(e.spacingAfterTwips=$n(Math.round(c*20),0,31680));let d=t.get("line-height")?.trim()??"",u=t.get("mso-line-height-rule")?.trim().toLowerCase(),f=Tt(d);if(f!==null&&f>0)e.lineTwentieths=$n(Math.round(f*20),24,31680),e.lineRule=u==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(d)&&Number.parseFloat(d)>0)e.lineTwentieths=$n(Math.round(240*Number.parseFloat(d)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(d)){let h=Number.parseFloat(d);h>0&&(e.lineTwentieths=$n(Math.round(2.4*h),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 p=Du(t);p&&(e.shdFill=p);let g=V6(t.get("tab-stops"));g!==void 0&&(e.tabs=g);let b=Fu(t.get("mso-border-alt"))??Fu(t.get("border")),y={};for(let h of ["top","left","bottom","right"]){let x=Fu(t.get(`mso-border-${h}-alt`))??Fu(t.get(`border-${h}`))??b;x!==void 0&&x!=="suppressed"&&(y[h]=x);}Object.keys(y).length>0&&(e.borders=y);}var Z6="http://schemas.openxmlformats.org/drawingml/2006/picture",X6=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,Y6=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 $R(e,t,n){return Math.min(n,Math.max(t,e))}function WR(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let i=X6.exec(o);if(!i)return;let a=n.mediaBySrc.get(o),s=a===void 0?void 0:n.media.get(a),l=s??Au(i[1],n.maxImageBytes);if(l==null)return;let c=Of$1(l),d=Y6.get(c);if(d===void 0)return;let u=c==="image/png"||c==="image/jpeg"||c==="image/gif"||c==="image/bmp"||c==="image/webp"?Tf$1(l,c):null,f=kt(e),p=Zg(e,f,"width",n.wordHtml),g=Zg(e,f,"height",n.wordHtml);u!==null?p===null&&g===null?(p=u.pixelWidth*96/(u.dpiX??96),g=u.pixelHeight*96/(u.dpiY??96)):p!==null&&g===null?g=p*u.pixelHeight/u.pixelWidth:p===null&&g!==null&&(p=g*u.pixelWidth/u.pixelHeight):p!==null&&g===null?g=p*2/3:p===null&&g!==null&&(p=g*3/2);let b=p===null?381e4:$R(Math.round(p*9525),9525,3e7),y=g===null?254e4:$R(Math.round(g*9525),9525,3e7),h=s===void 0?void 0:a;h===void 0&&(n.imageCount+=1,h=`word/media/image${n.imageCount}.${d}`,n.media.set(h,l),n.mediaBySrc.set(o,h),n.mediaExtensions.has(d)||n.mediaExtensions.set(d,c));let x=r(h.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="${Z6}"><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>`);}function In(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${W$1(e.rStyle)}"/>`),e.font!==void 0){let a=W$1(Bn(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="${W$1(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="${W$1(n)}"`}${r===void 0?"":` w:eastAsia="${W$1(r)}"`}${o===void 0?"":` w:bidi="${W$1(o)}"`}`;return i.length>0&&(t+=`<w:lang${i}/>`),e.changeXml!==void 0&&(t+=e.changeXml),t.length>0?`<w:rPr>${t}</w:rPr>`:""}function _u(e,t){return `<w:r>${In(t)}<w:t xml:space="preserve">${V(Bn(e))}</w:t></w:r>`}function Yg(e){let t="";if(e.styleId!==void 0&&(t+=`<w:pStyle w:val="${W$1(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="${W$1(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}"/>`),e.markRevisionXml&&(t+=`<w:rPr>${e.markRevisionXml}</w:rPr>`),e.changeXml!==void 0&&(t+=e.changeXml),t.length>0?`<w:pPr>${t}</w:pPr>`:""}function Vi(e,t){return `<w:p>${Yg(e)}${t.join("")}</w:p>`}var KR={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function Bu(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 Q6=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,qR=new WeakMap;function Qg(e){let t=qR.get(e);for(t||(t={checked:0,furniture:true},qR.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=Q6.test(e[t.checked]),t.checked+=1;return t.furniture}var J6=64,eh=31680;function UR(e){let t=new Map,n=i=>{let a=i.indexOf(":");if(a<=0)return;let s=i.slice(0,a).trim().toLowerCase(),l=i.slice(a+1).trim();s.length===0||s.length>64||(t.delete(s),t.set(s,l));},r=0,o=null;for(let i=0;i<e.length;i+=1){let a=e[i];if(a==="\\"){i+=1;continue}if(o!==null){a===o&&(o=null);continue}a==='"'||a==="'"?o=a:a===";"&&(n(e.slice(r,i)),r=i+1);}return n(e.slice(r)),t}function eB(e){let t=e.trim(),n=t[0];(n==='"'||n==="'")&&t.length>=2&&t.endsWith(n)&&(t=t.slice(1,-1));let r="";for(let o=0;o<t.length;o+=1){let i=t[o];if(i!=="\\"){r+=i;continue}let a=/^[0-9a-fA-F]{1,6}/.exec(t.slice(o+1,o+7));if(a===null){o+1<t.length&&(r+=t[o+1]),o+=1;continue}let s=Number.parseInt(a[0],16);o+=a[0].length,/\s/.test(t[o+1]??"")&&(o+=1),s>0&&s<=1114111&&(s<55296||s>57343)&&(r+=String.fromCodePoint(s));}return r}var Jg=(e,t)=>{let n=Tt(e??"");if(n!==null)return Math.min(eh,Math.max(t,Math.round(n*20)))};function tB(e){let t=new Map,n=(o,i=o)=>{let a=e.get(o);a!==void 0&&t.set(i,a);};if(n("font-family"),n("color"),n("font-weight"),n("mso-ansi-font-weight","font-weight"),n("font-style"),n("mso-ansi-font-style","font-style"),n("font-size"),n("mso-ansi-font-size","font-size"),n("text-decoration"),n("text-underline"),t.size===0)return;let r=In(Ui({},t));return r.length>0?r:void 0}function jR(e){let t=e.get("mso-level-text"),n=t===void 0?void 0:Bn(eB(t)),r=tB(e),o=Jg(e.get("margin-left"),-eh),i=Jg(e.get("text-indent"),-eh),a=Jg(e.get("mso-level-tab-stop"),0),s={...n!==void 0&&n.length<=J6?{text:n}:{},...r!==void 0?{runXml:r}:{},...o!==void 0?{leftTwips:o}:{},...i!==void 0?{firstLineTwips:i}:{},...a!==void 0?{tabTwips:a}:{}};return Object.keys(s).length>0?s:void 0}var nB="http://schemas.openxmlformats.org/wordprocessingml/2006/main",rB='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',VR=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function GR(e,t,n){let r=e?.leftTwips??720*(t+1),o=e?.firstLineTwips??-n,i=e?.tabTwips!==void 0&&e.tabTwips>0?`<w:tabs><w:tab w:val="num" w:pos="${e.tabTwips}"/></w:tabs>`:"",a=o<0?`w:hanging="${-o}"`:`w:firstLine="${o}"`;return `<w:pPr>${i}<w:ind w:left="${r}" ${a}/></w:pPr>`}function zR({kind:e,start:t,align:n,format:r},o){if(e==="bullet"){let s=VR[o%VR.length],l=r?.text!==void 0?r.runXml??"":`<w:rPr><w:rFonts w:ascii="${s.font}" w:hAnsi="${s.font}" w:hint="default"/></w:rPr>`;return `<w:lvl w:ilvl="${o}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${W$1(r?.text??s.text)}"/><w:lvlJc w:val="${n??"left"}"/>${GR(r,o,360)}${l}</w:lvl>`}let i=n??(e==="lowerRoman"||e==="upperRoman"?"right":"left"),a=r?.text??`%${o+1}.`;return `<w:lvl w:ilvl="${o}"><w:start w:val="${t}"/><w:numFmt w:val="${e}"/><w:lvlText w:val="${W$1(a)}"/><w:lvlJc w:val="${i}"/>${GR(r,o,i==="right"?180:360)}${r?.runXml??""}</w:lvl>`}var oB=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),iB=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),aB=new Map([["left","left"],["center","center"],["right","right"]]),ZR=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function XR(e){let t=new Map;if(e.length===0||e.length>262200)return t;ZR.lastIndex=0;let n,r=0;for(;(n=ZR.exec(e))!==null&&r<512;){r+=1;let o="decimal",i=null,a,s=UR(n[4]);for(let[d,u]of s){let f=u.toLowerCase();d==="mso-level-number-format"?o=iB.get(f)??null:d==="mso-level-start-at"&&/^\d{1,5}$/.test(f)?i=Math.min(32767,Number.parseInt(f,10)):d==="mso-level-number-position"&&(a=aB.get(f));}if(o===null)continue;let l=n[3]===void 0?`l${n[1]}:level${n[2]}`:`l${n[1]}:level${n[2]}:lfo${n[3]}`,c=jR(s);t.has(l)||t.set(l,{kind:o,start:i,...a?{align:a}:{},...c?{format:c}:{}});}return t}function YR(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?QR(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 sB=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function QR(e){let t=e.toLowerCase();if(!sB.test(t))return null;let n=0,r=0;for(let o of t){let i=oB.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 JR(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 c=QR(a);if(c!==null)return {kind:s?"lowerRoman":"upperRoman",start:c}}if(l){let c=a.toLowerCase().charCodeAt(0),d=Math.min(32767,(a.length-1)*26+(c-96));return {kind:s?"lowerLetter":"upperLetter",start:d}}}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 lB=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 $u(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=kt(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:lB.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 jl(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 eP(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 c=r.levels.get(l);return zR(c||{kind:i.kind==="bullet"?"bullet":"decimal",start: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 `${rB}<w:numbering xmlns:w="${nB}">${t}${n}</w:numbering>`}function Rr(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 tP(e){if(e===null)return false;if(e.startsWith("#"))return Rr(e.slice(1))!==null;let t=U(e);return t?.ok===true&&t.href.length>0}function nP(e,t){if(e!==void 0&&e.startsWith("#")){let o=Rr(e.slice(1)),i=Rr(t)??o;return i===null?null:`#${i}`}let n=e===void 0?null:U(e),r=Rr(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function rP(){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,globalThis.setTimeout(()=>{e===i&&(e=null);},0),o}}var cB=new Set(["HYPERLINK","NOTEREF","IF","MERGEFIELD","SECTIONPAGES","SECTION","NUMWORDS","NUMCHARS","AUTHOR","TITLE","SUBJECT","CREATEDATE","SAVEDATE","PRINTDATE","DOCPROPERTY","SYMBOL","EQ","LISTNUM","SET","XE","TC","INDEX"]),dB=/^(?:https?|mailto|tel|ftp):/i;function uB(e){let t=Xc(e);if(!t)return false;if(t.target===null)return t.anchor!==null;let n=U(t.target);return n.ok&&dB.test(n.href)}function fB(e){let t=e.trim().split(/\s+/)[0]?.toUpperCase()??"";return t==="HYPERLINK"?uB(e):ba(e)||cB.has(t)}var pB=16384,oP=2048,mB=3e4,gB='<w:r><w:fldChar w:fldCharType="begin"/></w:r>',hB='<w:r><w:fldChar w:fldCharType="separate"/></w:r>',yB='<w:r><w:fldChar w:fldCharType="end"/></w:r>',lP=/<w:r><w:fldChar w:fldCharType="(begin|separate|end)"\/><\/w:r>|<w:r><w:instrText xml:space="preserve">([^<]*)<\/w:instrText><\/w:r>/g,iP={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function cP(e){return e.replace(/&(#x[0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z]{2,8});/g,(t,n)=>{let r=String(n);if(r.startsWith("#")){let o=r[1]==="x"?Number.parseInt(r.slice(2),16):Number(r.slice(1));return Number.isInteger(o)&&o>=32&&o<=1114111&&!(o>=55296&&o<=57343)?String.fromCodePoint(o):""}return Object.hasOwn(iP,r)?iP[r]:t})}function bB(e){let t=cP(e).replace(/[\t\r\n\f\v ]+/g," ");return t.trim()===""?"":`<w:r><w:instrText xml:space="preserve">${V(t)}</w:instrText></w:r>`}var aP=new WeakMap,sP=new WeakMap;function dP(e,t){if(!e.startsWith("[if supportFields]>")||e.length>pB)return [];let n=e.slice(19).replace(/<!\[endif\]\s*$/,""),r=[],o="",i=sP.get(t);i||sP.set(t,i=[]);let a=i,s=()=>a.length>0&&a[a.length-1]===true,l=()=>{if(o.length>oP)return false;let c=s()?bB(o):"";return c&&r.push(c),o="",true};for(let c of n.matchAll(/<([^<>]{0,1024})>|([^<]+)/g)){if(c[2]!==void 0){if(s()&&(o+=c[2]),o.length>oP)return [];continue}let d=/mso-element:\s*field-(begin|separator|end)/i.exec(c[1])?.[1];if(!d)continue;if(!l())return [];let u=aP.get(t)??mB;if(u<=0)return [];aP.set(t,u-1);let f=d.toLowerCase();r.push(f==="begin"?gB:f==="separator"?hB:yB),f==="begin"?a.push(true):f==="separator"?a[a.length-1]=false:a.pop();}return l()?r:[]}function vB(e){let t=e.map(()=>true),n=[];for(let[r,o]of e.entries()){let i=n[n.length-1];if(o.kind==="begin")i&&!i.separated&&i.instruction.trim()===""&&(i.nestedFirst=true),n.push({separated:false,own:[r],instruction:"",begin:r,separator:-1,nestedFirst:false});else if(o.kind==="instruction")i&&!i.separated?(i.own.push(r),i.instruction+=cP(o.text)):t[r]=false;else if(o.kind==="separate"){if(!i||i.separated)return e.map(()=>false);i.separated=true,i.separator=r,i.own.push(r);}else {let a=n.pop();if(!a)return e.map(()=>false);if(a.own.push(r),a.nestedFirst||!fB(a.instruction)){for(let l of a.own)t[l]=false;let s=a.separator<0?r:a.separator;for(let l=a.begin;l<s;l+=1)t[l]=false;}}}return n.length===0?t:e.map(()=>false)}function xB(e){let t=[];for(let n of e)for(let r of n.matchAll(lP))t.push(r[1]!==void 0?{kind:r[1],text:""}:{kind:"instruction",text:r[2]});return t}function th(e){if(!e.some(r=>r.includes("<w:fldChar")||r.includes("<w:instrText")))return e;let t=vB(xB(e));if(t.every(Boolean))return e;let n=0;return e.map(r=>r.replace(lP,o=>t[n++]?o:""))}function uP(e){let t={};for(let n of Object.keys(e)){let r=new Map;for(let[o,i]of e[n])r.set(o,th(i));t[n]=r;}return t}var wB=/^(ftn|edn)([1-9]\d{0,9})$/i,SB={footnote:"ftn",endnote:"edn"};function fP(e,t){let n=e===null?null:wB.exec(e);if(!n||n[1].toLowerCase()!==SB[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function nh(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=fP(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function kB(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=fP(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function pP(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],i=kB(o,kt(o));i!==null&&t.push({...i,element:o});}return t}function mP(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 c=r.get(s);if(c!==void 0)return c;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=nh(kt(s));if(l===null)continue;let c=o(s);c!==null&&c.kind===l.kind&&c.id===l.id||n[l.kind].add(l.id);}}function gP(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var IB=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function rs(e,t,n){return e.replace(IB,(r,o,i)=>{let a=`${o}:${i}`;return t.has(a)?n?.get(a)??"":r})}function rh(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 hP(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=(c,d)=>{o.has(`${c}:${d}`)||!e.notes[c].has(d)||i[c].has(d)||(i[c].add(d),s.push({kind:c,id:d}));};for(let c of ["footnote","endnote"])for(let d of e.bodyNoteRefs[c])l(c,d);for(let c of o)for(let d of e.noteNoteRefs.get(c)??[])l(d.kind,d.id);for(;s.length>0;){let c=s.pop();for(let d of e.noteNoteRefs.get(`${c.kind}:${c.id}`)??[])l(d.kind,d.id);}};for(;;){a();let s=false;for(let l of ["footnote","endnote"]){for(let c of e.notes[l].keys()){let d=`${l}:${c}`;if(!(i[l].has(c)||o.has(d))){o.add(d),s=true;break}}if(s)break}if(!s)break}if(o.size>0)for(let s of ["footnote","endnote"])for(let[l,c]of e.notes[s])o.has(`${s}:${l}`)||e.notes[s].set(l,c.map(d=>rs(d,o,e.noteMarkFallbacks)));for(let s of ["footnote","endnote"])for(let[l,c]of [...e.notes[s]]){if(!o.has(`${s}:${l}`))continue;e.notes[s].delete(l),t[s].delete(l);let d=new Map;for(let u of c){let f=rs(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,(p,g,b)=>{let y=d.get(b);if(y===void 0){let h=e.noteRels[s].find(x=>x.id===b);if(h===void 0)return p;y=r(e,h.type,h.target,h.external),d.set(b,y);}return ` r:${g}="${y}"`});n.push(f),e.lastMarkCovered=false;}}}function oh(e,t,n,r=0){let o=e.lists.get(t);if(o)return o.levels.has(r)||o.levels.set(r,n),o.numId;let i=String(1001+e.lists.size),a={numId:i,levels:new Map([[r,n]])};return e.lists.set(t,a),e.listsByNumId.set(i,a),i}function yP(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=PB(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),c=(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]}`),d=c!==void 0?{kind:c.kind,start:YR(s,c.kind)??c.start??1,...c.align?{align:c.align}:{},...c.format?{format:c.format}:{}}:s.trim().length>0?JR(s):RB(e),f=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${i[1]}${l?`:lfo${l[1]}`:""}`;return {numId:oh(n,f,d,a),ilvl:a}}function RB(e){let t=e.parentElement;return t===null||Qe(t)!=="ol"&&Qe(t)!=="ul"?{kind:"bullet",start:1}:{kind:$u(t),start:jl(t)}}function PB(e,t){let n="",r=(o,i)=>{if(!(n.length>0||i>8||t.nodesLeft<=0)&&ns(o)){if(Nu(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 TB="http://schemas.openxmlformats.org/package/2006/relationships",EB="http://schemas.openxmlformats.org/package/2006/content-types",CB="application/vnd.openxmlformats-package.relationships+xml",sh='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',OB="http://schemas.openxmlformats.org/wordprocessingml/2006/main",ah="http://schemas.openxmlformats.org/officeDocument/2006/relationships",MB="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",AB="http://schemas.openxmlformats.org/drawingml/2006/main",LB="http://schemas.openxmlformats.org/drawingml/2006/picture",FB="http://schemas.openxmlformats.org/officeDocument/2006/math",bP={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 ih(e){let t=e.map(n=>`<Relationship Id="${W$1(n.id)}" Type="${W$1(n.type)}" Target="${W$1(n.target)}"${n.external?' TargetMode="External"':""}/>`).join("");return `${sh}<Relationships xmlns="${TB}">${t}</Relationships>`}function DB(e){let t=new Map;t.set("word/document.xml",bf$1(e.documentXml)),t.set("word/_rels/document.xml.rels",bf$1(ih(e.rels))),t.set("_rels/.rels",bf$1(ih([{id:"rId1",type:`${ah}/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="${bP.document}"/>`;for(let[i,a]of n)a!==void 0&&(t.set(`word/${i}.xml`,bf$1(a)),r+=`<Override PartName="/word/${i}.xml" ContentType="${bP[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`,bf$1(ih(a)));for(let[i,a]of e.media)t.set(i,a);let o=`<Default Extension="rels" ContentType="${CB}"/><Default Extension="xml" ContentType="application/xml"/>`;for(let[i,a]of e.mediaExtensions)o+=`<Default Extension="${W$1(i)}" ContentType="${W$1(a)}"/>`;return t.set("[Content_Types].xml",bf$1(`${sh}<Types xmlns="${EB}">${o}${r}</Types>`)),af$1(t)}function vP(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${ah}/${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=`${sh}<w:document xmlns:w="${OB}" xmlns:r="${ah}" xmlns:wp="${MB}" xmlns:a="${AB}" xmlns:pic="${LB}" xmlns:m="${FB}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return DB({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:eP(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:rh("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:rh("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}var Gi=32;function or(e){return e.left<=0?(e.truncated=true,false):(e.left-=1,e.visited+=1,true)}var xP=Object.freeze({});function wP(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 NB(e){return e.replace(/ /g," ").replace(/[-]/g,"").replace(/[ \t\r\n\f\v]+/g," ")}function ko(e,t,n){let r=V(Bn(NB(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=In({...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 HB=512,SP=new Set(["\u2211","\u220F","\u2210","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"]),_B=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"]]),kP=new Set(["\xAF","\u203E","_","\u2015","\u2014","\u0305","-"]),IP=new Map([["(",")"],["[","]"],["{","}"],["|","|"],["\u2016","\u2016"],["\u27E8","\u27E9"],["\u2329","\u232A"],["\u230A","\u230B"],["\u2308","\u2309"]]),BB=new Set(["annotation","annotation-xml","none","mprescripts","mspace","maligngroup","malignmark","mphantom"]),$B=new Set(["msub","msup","msubsup","munder","mover","munderover"]);function Io(e){return e.localName.toLowerCase()}function Gl(e){return Array.from(e.children)}function zo(e){return (e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim().slice(0,HB)}function zi(e){return W$1(Bn(e))}function qe(e,t){return t.length>0?`<m:${e}>${t}</m:${e}>`:`<m:${e}/>`}function RP(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 Vl(e){if(e===void 0||Io(e)!=="mo")return null;let t=zo(e);return [...t].length===1?t:null}var lh=class{constructor(t){this.state=t;}state;node(t,n,r){if(n>Gi)return this.state.truncated=true,"";if(!or(this.state))return "";let o=Io(t),i=RP(t,r),a=Gl(t),s=l=>a[l]?this.node(a[l],n+1,i):"";if(BB.has(o))return "";switch(o){case "semantics":return s(0);case "mi":return this.identifier(t,i);case "mn":case "mo":return ko(zo(t),"",i);case "mtext":return ko(zo(t),"<m:nor/>",i);case "ms":return ko(`"${zo(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=zo(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"/>'),ko(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=Vl(t);return o!==null&&kP.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=Vl(n);if(i!==null&&kP.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:_B.get(i);return a!==void 0||i!==null&&t.getAttribute("accent")?.trim()==="true"?`<m:acc><m:accPr><m:chr m:val="${zi(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(c=>qe("e",this.node(c,r+1,o)));return `<m:d><m:dPr><m:begChr m:val="${zi(i)}"/>${s.length>0?`<m:sepChr m:val="${zi(s)}"/>`:""}<m:endChr m:val="${zi(a)}"/></m:dPr>${l.join("")||"<m:e/>"}</m:d>`}table(t,n,r){let o="";for(let i of t){if(!or(this.state))break;let a=Io(i);if(a!=="mtr"&&a!=="mlabeledtr")continue;let s=Gl(i).slice(a==="mlabeledtr"?1:0);o+="<m:mr>"+s.map(l=>qe("e",Io(l)==="mtd"?this.row(Gl(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=c=>c===void 0||Io(c)==="none"?"":this.node(c,n+1,r),i=t.findIndex(c=>Io(c)==="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=Io(t),a=Gl(t),s=zo(i==="mo"?t:a[0]),l=g=>a[g]?this.node(a[g],r+1,o):"",c="",d="";i==="msub"||i==="munder"?c=l(1):i==="msup"||i==="mover"?d=l(1):(i==="msubsup"||i==="munderover")&&(c=l(1),d=l(2));let u=i==="munder"||i==="mover"||i==="munderover"?"undOvr":"subSup",f=`<m:chr m:val="${zi(s)}"/><m:limLoc m:val="${u}"/>${c.length===0?'<m:subHide m:val="1"/>':""}${d.length===0?'<m:supHide m:val="1"/>':""}`,p=n?this.node(n,r+1,o):"";return `<m:nary><m:naryPr>${f}</m:naryPr>${qe("sub",c)}${qe("sup",d)}${qe("e",p)}</m:nary>`}isNary(t){let n=Io(t);if(n==="mo")return SP.has(zo(t));if(!$B.has(n))return false;let r=t.children[0];return r!==void 0&&SP.has(Vl(r)??"")}row(t,n,r){if(n>Gi)return this.state.truncated=true,"";let o=Vl(t[0]),i=Vl(t[t.length-1]);if(t.length>=2&&o!==null&&i!==null&&IP.has(o)&&[...IP.values()].includes(i)){let l=this.row(t.slice(1,-1),n+1,r);return `<m:d><m:dPr><m:begChr m:val="${zi(o)}"/><m:endChr m:val="${zi(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 c=t[s+1];a+=this.nary(l,c,n,r),c!==void 0&&(s+=1);continue}a+=this.node(l,n,r);}return a}};function ch(e){return Io(e)==="math"}function PP(e){return e.getAttribute("display")?.trim().toLowerCase()==="block"||e.getAttribute("mode")?.trim().toLowerCase()==="display"}function TP(e,t,n){return new lh(t).row(Gl(e),1,RP(e,n))}var WB="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(" "),CP=new Map(WB.map(e=>[`m:${e.toLowerCase()}`,e])),qB=new Set(["oMath","e","num","den","sub","sup","deg","lim","fName"]),KB=512,UB=512,jB=64,VB=64,GB=2,zB=256,EP=/^\[if\s+gte\s+msEquation\b[^\]]*\]>([\s\S]*)<!\[endif\]$/i,ZB=/^\[if\s+!msEquation\s*\]$/i,XB=/^\[if\b[^\]]*\]$/i,YB=/^\[endif\]$/i,QB=Object.freeze({byElement:new Map,visited:0,truncated:false});function OP(e){return /<m:omath|msEquation|<math[\s>]/i.test(e)}function zl(e){return e.nodeType===1?CP.get(Qe(e)):void 0}function MP(e,t,n,r){if(!(n>Gi||!or(t))){if(e.nodeType===3){r.push(e.nodeValue??"");return}if(!(e.nodeType!==1||Qe(e)==="o:p"))for(let o of Array.from(e.childNodes))MP(o,t,n+1,r);}}function dh(e,t){return wP(ji(Ul({},Qe(e)),e),t)}function JB(e,t,n,r){let o="",i=[],a=r;for(let s of Array.from(e.childNodes)){let l=zl(s);if(l==="rPr")o+=Wu(s,"rPr",t,n+1,r);else {if(s.nodeType===1&&Qe(s)==="w:rpr")continue;s.nodeType===1&&l===void 0&&(a=dh(s,a)),MP(s,t,n+1,i);}}return ko(i.join(""),o,a)}function Wu(e,t,n,r,o){let i="",a="",s=qB.has(t);for(let l of Array.from(e.childNodes)){if(l.nodeType===3){if(!or(n))break;s&&(a+=l.nodeValue??"");continue}l.nodeType===1&&(a.trim().length>0&&(i+=ko(a,"",o)),a="",i+=AP(l,t,n,r+1,o));}return a.trim().length>0&&(i+=ko(a,"",o)),i}function AP(e,t,n,r,o){if(r>Gi)return n.truncated=true,"";if(!or(n))return "";let i=CP.get(Qe(e));if(i===void 0)return Qe(e)==="o:p"?"":Wu(e,t,n,r,dh(e,o));if(i==="ctrlPr"||i==="oMathPara"||i==="oMath")return "";if(i==="r"||i==="t")return JB(e,n,r,o);let a=e.getAttribute("m:val"),s=a!==null&&a.length<=jB?` m:val="${W$1(Bn(a))}"`:"",l=Wu(e,i,n,r,o);return l.length>0?`<m:${i}${s}>${l}</m:${i}>`:`<m:${i}${s}/>`}function LP(e,t,n){if(!or(t))return null;let r=Wu(e,"oMath",t,1,n);return r.length>0?`<m:oMath>${r}</m:oMath>`:null}function FP(e,t,n,r,o){if(!(n>Gi||!or(t)))for(let i of Array.from(e.children)){let a=zl(i);if(a==="oMath"){let s=LP(i,t,r);s!==null&&o.equations.push(s);}else a==="oMathParaPr"&&o.properties.length===0?o.properties=AP(i,"oMathPara",t,n+1,r):a===void 0&&FP(i,t,n+1,dh(i,r),o);}}function e5(e){let t=zl(e);return t==="oMath"||t==="oMathPara"||ch(e)}function t5(e){let t=0;for(let n=e.parentElement;n!==null;n=n.parentElement)if((t+=1)>zB||e5(n))return true;return false}function n5(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(!or(t))return;let i=o.data;if(/<m:omath|<math[\s>]/i.test(i)&&EP.test(i)){if(r.length>=UB){t.truncated=true;break}r.push(o);}}for(let o of r){let i=EP.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 r5(e){return e.nodeType===3?(e.nodeValue??"").replace(/[\s ]/g,"").length>0:e.nodeType===1||e.nodeType===8}function o5(e){let t=e;for(let n=0;n<=GB;n+=1){let r=t.nextSibling;for(;r!==null&&!r5(r);)r=r.nextSibling;if(r!==null){if(r.nodeType!==8||!ZB.test(r.data.trim()))return;let a=[r],s=1;for(let l=r.nextSibling;l!==null&&a.length<=VB;l=l.nextSibling)if(a.push(l),l.nodeType===8){let c=l.data.trim();if(YB.test(c)?s-=1:XB.test(c)&&(s+=1),s===0){for(let d of a)d.parentNode?.removeChild(d);return}}return}let o=t.parentElement;if(o===null||zl(o)!==void 0)return;let i=Qe(o);if(i!=="span"&&i!=="i"&&i!=="b"&&i!=="font")return;t=o;}}function i5(e,t){let n=e.getElementsByTagName("i").length>0?{uprightUnlessItalic:true}:xP;if(ch(e)){if(!or(t))return null;let r=TP(e,t,n);return r.length===0?null:PP(e)?`<m:oMathPara><m:oMath>${r}</m:oMath></m:oMathPara>`:`<m:oMath>${r}</m:oMath>`}if(zl(e)==="oMathPara"){let r={properties:"",equations:[]};return FP(e,t,1,n,r),r.equations.length===0?null:`<m:oMathPara>${r.properties}${r.equations.join("")}</m:oMathPara>`}return LP(e,t,n)}function DP(e,t){if(e.body===null||t<=0)return QB;let n={left:t,visited:0,truncated:false};n5(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>=KB){n.truncated=true;break}if(!or(n))break;let l=a[s];t5(l)||o.push(l);}}for(let i of o){if(n.left<=0){n.truncated=true;break}let a=i5(i,n);a===null||n.truncated||(r.set(i,[a]),o5(i));}return {byElement:r,visited:n.visited,truncated:n.truncated}}function uh(e){return e.startsWith("<m:oMath>")||e.startsWith("<m:oMathPara>")}var NP=new Map;function HP(e,t,n,r){let o=Wg(n)??e.runChange,i=Kg(t,e.originalRunStyle);if(r===null&&o===void 0&&i===void 0)return e;let a=e.run;if(o!==void 0){let s=kR(a),l=Ui(s,i??NP);a={...s,changeXml:wR(o,In(l))};}return {...e,run:a,...r===null?{}:{revisions:[...e.revisions??[],r]},...o===void 0?{}:{runChange:o},...i===void 0?{}:{originalRunStyle:i}}}function _P(e,t,n){let r=Wg(n);if(r===null)return;let o={...e};Hu(o,Kg(t,void 0)??NP),e.changeXml=SR(r,Yg(o));}function qu(e,t){let n=t.markRevision;return t.markRevisionTaken=n!==null,n===null?e:(t.markRevision=null,{...e,markRevisionXml:n})}function BP(e,t){let n=[e],r=[];for(let o of ["footnote","endnote"])for(let[i,a]of t[o]){let s=[...a];r.push({kind:o,id:i,blocks:s}),n.push(s);}IR(n);for(let o of r)t[o.kind].set(o.id,o.blocks);}function Pr(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var Zo=31680;function Ro(e,t,n){return Math.min(n,Math.max(t,e))}function $P(e){let t=Tt(kt(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 a5(e){return Zi(e,"colspan",63)}function WP(e){return Array.from(e.children).flatMap(t=>{let n=Qe(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>Qe(r)==="tr")})}function Zi(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:Ro(Number.parseInt(r,10),1,n)}function qP(e,t){let n=(kt(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${Ro(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=$P(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let i=Ro(Math.round(o*20),1,Zo);return {xml:`<w:tblW w:w="${i}" w:type="dxa"/>`,twips:i}}function KP(e){let n=kt(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 UP(e){let t=kt(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=Tt(a??"");l!==null&&(i+=` w:tblpX="${Ro(Math.round(l*20),-Zo,Zo)}"`);}let s=Tt(t.get("mso-table-top")??"");return s!==null&&(i+=` w:tblpY="${Ro(Math.round(s*20),-Zo,Zo)}"`),`<w:tblpPr${i}/>`}function jP(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 d of e){let u=Array.from({length:t},()=>r),f=0,p=0,g=a.map(h=>h?h.span:null);for(let h=0;h<t;h+=1){let x=a[h];x&&(x.remaining-=1,x.remaining<=0&&(a[h]=null));}let b=Array.from(d.children).filter(h=>/^t[dh]$/.test(Qe(h))),y=0;for(;p<t;){let h=g[p];if(h!==null){p+=h;continue}let x=b[y];if(x===void 0)break;y+=1;let w=Math.min(a5(x),t-p);for(let E=p+1;E<p+w;E+=1)if(g[E]!==null){w=E-p;break}let v=Zi(x,"rowspan",1e3);v>1&&(a[p]={remaining:v-1,span:w});let k=$P(x);if(k!==null){let E=Ro(Math.round(k*20/w),1,Zo);for(let I=0;I<w;I+=1)u[p+I]=E;f+=w;}p+=w;}f>o&&(o=f,i=u);}let s=i.reduce((d,u)=>d+u,0);if(s<=0)return i;let l=i.map(d=>Math.max(1,Math.round(d*n/s))),c=n-l.reduce((d,u)=>d+u,0);return l[l.length-1]=Math.max(1,l[l.length-1]+c),l}function fh(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 VP=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),GP=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function zP(e){return Ro(Math.round(e*8),2,96)}function Gr(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of Xg(e)){let i=VP.get(o.toLowerCase());if(i!==void 0){t=i;continue}let a=GP.get(o.toLowerCase())??Tt(o);if(a!==null){n=a;continue}let s=Go(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:zP(n),color:r??"000000"}}}function Ku(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=VP.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:GP.get(o.toLowerCase())??Tt(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:Go(a);return {val:r,size:i===null?4:zP(i),color:s??"000000"}}function ZP(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function XP(e,t=false){let n=kt(e),o=Gr(n.get("mso-border-alt"))??Gr(n.get("border"))??Ku(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 c=Pr(l,t),d=Gr(n.get(`mso-border-${c}-alt`))??Gr(n.get(`mso-border-${c}`))??Gr(n.get(`border-${c}`))??Ku(n,`border-${c}`)??o;d!==void 0&&(a+=ZP(s,d));}return a.length>0?`<w:tblBorders>${a}</w:tblBorders>`:""}function YP(e){let t=kt(e),n=xR(t),r=Tt(t.get("height")??"");if(r===null||r<=0)return n?`<w:trPr>${n}</w:trPr>`:"";let o=Ro(Math.round(r*20),1,Zo),a=t.get("mso-height-rule")?.trim().toLowerCase()==="exactly"?"exact":"atLeast";return `<w:trPr><w:trHeight w:val="${o}" w:hRule="${a}"/>${n}</w:trPr>`}function s5(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=>Tt(a));if(i.length>=1&&i.length<=4&&!i.some(a=>a===null||a<0)){let[a,s=a,l=a,c=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=c??null;}}for(let i of ["top","right","bottom","left"]){let a=Tt(e.get(`padding-${i}`)??"");a!==null&&a>=0&&(n[i]=a);}let o="";for(let i of ["top","left","bottom","right"]){let a=Pr(i,t),s=n[a];s!==null&&(o+=`<w:${i} w:w="${Ro(Math.round(s*20),0,Zo)}" w:type="dxa"/>`);}return o.length>0?`<w:tcMar>${o}</w:tcMar>`:""}function QP(e,t=false){let n=kt(e),r=Gr(n.get("mso-border-alt"))??Gr(n.get("border"))??Ku(n,"border"),o="";for(let l of ["top","left","bottom","right"]){let c=Pr(l,t),d=Gr(n.get(`mso-border-${c}-alt`))??Gr(n.get(`mso-border-${c}`))??Gr(n.get(`border-${c}`))??Ku(n,`border-${c}`)??r;d!==void 0&&(o+=ZP(l,d));}let i=o.length>0?`<w:tcBorders>${o}</w:tcBorders>`:"",a=Du(n);a&&(i+=`<w:shd w:val="clear" w:color="auto" w:fill="${a}"/>`),i+=s5(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 l5=9360;function JP(e,t,n,r,o,i){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let I of Array.from(e.children))Qe(I)==="caption"&&i(Array.from(I.childNodes),t+1,n,r,o,true);let a=WP(e);if(a.length===0)return;let s=1,l=r.nodesLeft,c=[];for(let I of a){if(l<=0||s>=63)break;let P=c.map(T=>T?T.span:null);for(let T=0;T<c.length;T+=1){let B=c[T];B&&(B.remaining-=1,B.remaining<=0&&(c[T]=null));}let C=Array.from(I.children).filter(T=>/^t[dh]$/.test(Qe(T))),O=0,S=0;for(;S<63&&(l-=1,!(l<=0));){let T=S<P.length?P[S]:null;if(T!=null){S+=T;continue}let B=C[O];if(B===void 0)break;O+=1;let W=Math.min(Zi(B,"colspan",63),63-S);for(let U=S+1;U<S+W;U+=1)if(U<P.length&&P[U]!=null){W=U-S;break}let q=Zi(B,"rowspan",1e3);if(q>1){for(;c.length<=S;)c.push(null);c[S]={remaining:q-1,span:W};}S+=W;}for(let T=S;T<P.length&&T<63;T+=1){let B=P[T];B!=null&&(S=Math.max(S,T+B));}s=Math.max(s,S);}s=Math.min(Math.max(s,1),63);let d=qP(e,l5),u=d.twips,f=a.length>r.nodesLeft?a.slice(0,Math.max(1,r.nodesLeft)):a,p=jP(f,s,u),b=(kt(e).get("direction")??e.getAttribute("dir"))?.trim().toLowerCase()==="rtl",y=XP(e,b),h=UP(e),x=KP(e)??(b?"left":void 0),w=x===void 0?"":`<w:jc w:val="${Pr(x,b)}"/>`,v=p.map(I=>`<w:gridCol w:w="${I}"/>`).join(""),k=new Array(s).fill(null),E=[];for(let I of a){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let P=k.map(W=>W?W.span:null);for(let W=0;W<s;W+=1){let q=k[W];q&&(q.remaining-=1,q.remaining<=0&&(k[W]=null));}let C=Array.from(I.children).filter(W=>/^t[dh]$/.test(Qe(W))),O=0,S=[],T=0,B=true;for(;T<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,B=false;break}let W=P[T];if(W!==null){let M=W>1?`<w:gridSpan w:val="${W}"/>`:"";S.push(`<w:tc><w:tcPr><w:tcW w:w="${fh(p,T,W)}" w:type="dxa"/>${M}<w:vMerge/></w:tcPr><w:p/></w:tc>`),T+=W;continue}let q=C[O];if(q===void 0){S.push(`<w:tc><w:tcPr><w:tcW w:w="${p[T]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),T+=1;continue}O+=1;let U=Math.min(Zi(q,"colspan",63),s-T);for(let M=T+1;M<T+U;M+=1)if(P[M]!==null){U=M-T;break}let Z=Zi(q,"rowspan",1e3);Z>1&&(k[T]={remaining:Z-1,span:U}),S.push(c5(q,U,fh(p,T,U),Z>1,t,n,r,i,b)),T+=U;}if(!B)break;E.push(`<w:tr>${YP(I)}${S.join("")}</w:tr>`);}E.length!==0&&(o.push(`<w:tbl><w:tblPr>${b?"<w:bidiVisual/>":""}${h}${d.xml}${w}${y}</w:tblPr><w:tblGrid>${v}</w:tblGrid>${E.join("")}</w:tbl>`),r.lastMarkCovered=false);}function c5(e,t,n,r,o,i,a,s,l){let c=Qe(e)==="th",d=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(d+=`<w:gridSpan w:val="${t}"/>`),r&&(d+='<w:vMerge w:val="restart"/>'),d+=QP(e,l);let u={run:c?{...i.run,bold:true}:i.run,para:c?{jc:"center"}:{},paragraphMarkCovered:false,pre:false,list:null,...i.noteBody?{noteBody:i.noteBody}:{},...i.rels?{rels:i.rels}:{}},f=[];return s(Array.from(e.childNodes),o+2,u,a,f,true),(f.length===0||f[f.length-1].endsWith("</w:tbl>"))&&f.push("<w:p/>"),`<w:tc><w:tcPr>${d}</w:tcPr>${f.join("")}</w:tc>`}function eT(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 tT(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 nT(e){if(Qe(e)!=="br")return false;let t=kt(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function rT(e){if(nT(e))return true;if(Qe(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||!nT(r))return false;t=true;}}return t}function oT(e){if(Qe(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=kt(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(Qe(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 ph(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var mh=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),gh=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),hh=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),d5=new Set([...gh,...hh,"table","ol","ul","w:sdt"]);function yh(e){for(let t=0;t<e.children.length;t+=1)if(d5.has(Qe(e.children[t])))return true;return false}var u5=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function iT(e){if(Qe(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=Qe(a);if(u5.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(a);}}return null}var f5=4*1024*1024,p5=1e5,m5=64,g5=2*1024*1024,aT="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function bh(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}var h5=/<w:br\/><\/w:r>(?:<\/w:(?:ins|del)>)*$/;function Zl(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 x=e.nodeValue??"";if(n.pre){let v=x.replace(/\r\n?/g,`
|
|
4
|
+
`).split(`
|
|
5
|
+
`);for(let k=0;k<v.length;k+=1){if(k>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${In(n.run)}<w:br/></w:r>`);}let E=v[k];E.length>0&&r.push(_u(E,n.run));}return}let w=x.replace(/[ \t\r\n\f\v]+/g," ");if(w.startsWith(" ")&&h5.test(r[r.length-1]??"")&&(w=w.slice(1)),w.length===0||w===" "&&Qg(r))return;r.push(_u(w,n.run));return}if(e.nodeType===8&&o.wordHtml)for(let x of dP(e.nodeValue??"",o))r.push(x);if(!ns(e))return;let i=o.equations.get(e);if(i!==void 0){for(let x of i)r.push(x);return}let a=Qe(e);if(mh.has(a))return;let s=kt(e);if(Nu(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 x=tT(e);x.length>0&&r.push(`<w:r>${In(n.run)}${x}</w:r>`);return}let c=eT(s.get("mso-tab-count"));if(c.length>0){if(o.nodesLeft-=c.split("<w:tab/>").length-2,o.nodesLeft<=0){o.truncated=true;return}let x=Ui(Ul(n.run,a),s);if(r.push(`<w:r>${In(x)}${c}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let x=s.get("page-break-before")?.trim().toLowerCase()==="always"||s.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${In(n.run)}${x?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){WR(e,r,o,x=>bh(o,`${aT}/image`,x,false,n.rels??o.rels));return}let d=gR(e,a,o.wordHtml),f=d?.kind==="ins"&&n.revisions?.some(x=>x.kind==="del")?null:d,p=d===null?Ul(n.run,a):n.run,g=a==="a"?e.getAttribute("href"):null,b=a==="a"?nh(s):null;b===null&&tP(g)&&(p={...p,rStyle:"Hyperlink"});let y=ji(p,e),h=HP({...n,run:y,pre:n.pre||a==="pre"},e,s,f);if(f!==null){let x=[];for(let w of Array.from(e.childNodes))Zl(w,t+1,h,x,o);for(let w of yR(f,x))r.push(w);return}if(b!==null){let x={...h.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===b.kind&&n.noteBody.id===b.id){let w=b.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${In(x)}<w:${w}/></w:r>`);return}if(o.definedNotes[b.kind].has(b.id)){let w=b.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${In(x)}<w:${w} w:id="${b.id}"/></w:r>`);let v=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),k=`${b.kind}:${b.id}`;if(v.length>0&&!o.noteMarkFallbacks.has(k)&&o.noteMarkFallbacks.set(k,_u(v,x)),n.noteBody===void 0)o.bodyNoteRefs[b.kind].add(b.id);else {let E=`${n.noteBody.kind}:${n.noteBody.id}`,I=o.noteNoteRefs.get(E)??[];I.push({kind:b.kind,id:b.id}),o.noteNoteRefs.set(E,I);}return}for(let w of Array.from(e.childNodes))Zl(w,t+1,h,r,o);return}if(a==="a"){let x=e.getAttribute("href"),w=Rr(e.getAttribute("name")||e.getAttribute("id")),v=[];for(let P of Array.from(e.childNodes))Zl(P,t+1,h,v,o);let k=x?.startsWith("#")?Rr(x.slice(1)):null,E=v.join(""),I=()=>h.revisions===void 0?E:bR(h.revisions,E);if(k!==null)E=`<w:hyperlink w:anchor="${W$1(k)}">${I()}</w:hyperlink>`;else if(x!==null&&!x.startsWith("#")){let P=U(x);P.ok&&P.href.length>0&&(E=`<w:hyperlink r:id="${bh(o,`${aT}/hyperlink`,P.href,true,n.rels??o.rels)}">${I()}</w:hyperlink>`);}if(w!==null){let P=String(o.nextBookmarkId++);E=`<w:bookmarkStart w:id="${P}" w:name="${W$1(w)}"/>${E}<w:bookmarkEnd w:id="${P}"/>`;}E.length>0&&r.push(E);return}a==="o:p"&&n.revisions!==void 0&&(o.markRevision=vR(n.revisions));for(let x of Array.from(e.childNodes))Zl(x,t+1,h,r,o);}function sT(e,t,n,r){let o=Qe(e),i=kt(e),a={};r&&(a.pageBreakBefore=true);let s=DR(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},c=KR[o];c!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=c);let d=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let u=yP(e,i,n,t.noteBody);return u&&(a.numPr=u),BR(a,e,n.classAlignments),Hu(a,i),_P(a,e,i),l=ji(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:d,list:t.list,...t.noteBody?{noteBody:t.noteBody}:{},...t.rels?{rels:t.rels}:{}}}function lT(e,t,n,r,o,i=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.markRevision=null;let a=sT(e,n,r,i);Xo(Array.from(e.childNodes),t+1,a,r,o,true,void 0,false);}function cT(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=$u(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:oh(r,`sem:${r.semanticListCount}`,{kind:a,start:jl(e)}),level:0};if(n.list){let d=r.listsByNumId.get(s.numId);d!==void 0&&!d.levels.has(s.level)&&d.levels.set(s.level,{kind:a,start:jl(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},c=i;for(let d of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!ns(d))continue;let u=Qe(d);if(u==="li")r.nodesLeft-=1,lT(d,t+1,l,r,o,c),c=false;else if(u==="ol"||u==="ul"){let f=o.length;cT(d,t+1,{...n,list:s},r,o,c),o.length>f&&(c=false);}}}function Xo(e,t,n,r,o,i=false,a,s=true){if(t>r.maxDepth)return;let l=o.length,c=a===void 0,d=[],u=[],f=n.para,p=a??{pending:false,skipSpacer:false},g=()=>({...f,pageBreakBefore:void 0,numPr:void 0}),b=()=>{if(d.length===0)return;if(!d.some(h=>h.includes("<w:r")||uh(h))){if(o.length===l){u=u.concat(d),d=[];return}let h=o[o.length-1];h?.endsWith("</w:p>")?(o[o.length-1]=`${h.slice(0,-6)}${d.join("")}</w:p>`,d=[]):h!==void 0&&d.length>0&&(o.push(Vi(g(),d)),d=[],r.lastMarkCovered=false);return}let y=p.pending?{...f,pageBreakBefore:true}:f;o.push(Vi(qu(y,r),d)),f.pageBreakBefore&&(f={...f,pageBreakBefore:void 0}),p.pending=false,p.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken,d=[];};for(let y of e){if(r.nodesLeft<=0){r.truncated=true;break}if(ns(y)){let h=Qe(y),x=h==="w:sdt"?iT(y):null;if(s&&rT(y)){b(),r.nodesLeft-=1,p.pending&&Bu(o),p.pending=true,p.skipSpacer=true;continue}if(mh.has(h)&&!r.equations.has(y)){r.nodesLeft-=1;continue}let w=kt(y);if(w.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(gP(w)){b(),r.nodesLeft-=1,Xo(Array.from(y.childNodes),t+1,n,r,o,false,p,s);continue}if(r.definedNoteElements.has(y)){r.nodesLeft-=1;continue}if(gh.has(h)){if(b(),r.nodesLeft-=1,p.pending&&p.skipSpacer&&oT(y)){p.skipSpacer=false;continue}if(h==="div"&&yh(y)){let k=sT(y,n,r,false);k.para.pageBreakBefore&&(p.pending=true),Xo(Array.from(y.childNodes),t+1,k,r,o,false,p,s);continue}let v=o.length;lT(y,t,n,r,o,p.pending),o.length>v&&(p.pending=false,p.skipSpacer=false);continue}if(h==="ol"||h==="ul"){b();let v=o.length;cT(y,t,n,r,o,p.pending),o.length>v&&(p.pending=false,p.skipSpacer=false);continue}if(h==="table"){b(),p.pending&&Bu(o),y5(y,t,n,r,o),p.pending=false,p.skipSpacer=false;continue}if(hh.has(h)||x!==null||h==="span"&&yh(y)){b(),r.nodesLeft-=1,Xo(x??Array.from(y.childNodes),t+1,n,r,o,false,p,s);continue}}if(y.nodeType===3&&/^[\s\u00a0]+$/.test(y.nodeValue??"")&&Qg(d)){r.nodesLeft-=1;continue}Zl(y,t,n,d,r);}if(i&&o.length===l&&d.length>0&&!d.some(y=>y.includes("<w:r")||uh(y))&&(o.push(Vi(qu(f,r),d)),d=[],r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken),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,Vi(g(),u)):d=u.concat(d),u=[];}d.length>0&&(o.push(Vi(g(),d)),d=[],r.lastMarkCovered=false),c&&p.pending&&(Bu(o),p.pending=false,p.skipSpacer=false,r.lastMarkCovered=false),i&&o.length===l&&(o.push(Vi(qu(f,r),d)),d=[],r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken);}function y5(e,t,n,r,o){JP(e,t,n,r,o,Xo);}function b5(e,t){return vP({blocks:th(t),rels:e.rels,lists:[...e.lists.values()],notes:uP(e.notes),noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function v5(e,t){let n=t.maxHtmlBytes??f5;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??p5,a=OP(e)?DP(r,i):null,s=pP(r),l={footnote:new Set,endnote:new Set},c=new Set,d={footnote:new Set,endnote:new Set};mP(r,s,d);let u={nodesLeft:i-(a?.visited??0),maxDepth:t.maxDepth??m5,maxImageBytes:t.maxImageBytes??g5,wordHtml:FR(e),truncated:false,lastMarkCovered:false,markRevision:null,markRevisionTaken: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:HR(r),listDefinitions:XR(_R(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:c,equations:a?.byElement??new Map},f={};f=ji(f,r.documentElement),f=ji(f,o);let p={run:f,para:f.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},g=[];for(let w of s)d[w.kind].has(w.id)&&(l[w.kind].has(w.id)||(l[w.kind].add(w.id),c.add(w.element),g.push(w)));g.sort((w,v)=>ph(v.element)-ph(w.element)),u.lastMarkCovered=false;let b=[];Xo(Array.from(o.childNodes),0,p,u,b);let y=u.lastMarkCovered,h=u.truncated,x=false;for(let w=0;w<g.length;w+=1){let v=g[w];u.truncated=false;let k=u.nodesLeft,E=[];if(Xo(Array.from(v.element.childNodes),0,{...p,noteBody:{kind:v.kind,id:v.id},rels:u.noteRels[v.kind]},u,E,true),u.truncated||E.length===0){x=true;let I=new Set;for(let P=w;P<g.length;P+=1){let C=g[P];l[C.kind].delete(C.id),c.delete(C.element),u.notes[C.kind].delete(C.id),u.bodyNoteRefs[C.kind].delete(C.id),I.add(`${C.kind}:${C.id}`);}if(I.size>0){for(let P=0;P<b.length;P+=1)b[P]=rs(b[P],I,u.noteMarkFallbacks);for(let P of ["footnote","endnote"])for(let[C,O]of u.notes[P])u.notes[P].set(C,O.map(S=>rs(S,I,u.noteMarkFallbacks)));}u.nodesLeft=k;for(let P=w;P<g.length&&u.nodesLeft>0;P+=1)Xo(Array.from(g[P].element.childNodes),0,p,u,b);break}u.notes[v.kind].set(v.id,E);}return u.truncated=h||x,u.lastMarkCovered=y,hP(u,l,b,bh),b.length===0?{ok:false,reason:"no-content"}:(BP(b,u.notes),{ok:true,projection:u,blocks:b})}var x5=rP();function dT(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return x5(e,n,()=>v5(e,t))}function uT(e,t={}){let n=dT(e,t);return n.ok?{ok:true,fragmentBytes:b5(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function fT(e,t={}){let n=dT(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var w5={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function pT(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 w5[n.toLowerCase()]??t})}var S5=new Set(["script","style","title","template"]),k5=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),I5=new Set(["td","th"]),mT=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),R5=e=>mT(e)||e!==void 0&&e>="0"&&e<="9",gT=e=>e===" "||e===" "||e===`
|
|
6
|
+
`||e==="\r"||e==="\f";function P5(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!mT(e[n]))return null;let o=n;for(;n<e.length&&R5(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};gT(l)||(s=false);}n+=1;}return {name:i,closing:r,end:e.length}}function T5(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 E5(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&&gT(e[i]);)i+=1;if(e[i]===">")return i+1}r=o+2;}return e.length}function*hT(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=P5(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&S5.has(r.name)?t=E5(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
|
|
7
|
+
`:r.closing&&I5.has(r.name)?yield " ":r.closing&&k5.has(r.name)&&(yield `
|
|
8
|
+
`);}}function C5(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of hT(t))n+=r;return pT(n).replace(/\r\n?/g,`
|
|
9
|
+
`).split(`
|
|
10
|
+
`).map(T5).join(`
|
|
11
|
+
`).replace(/\n{3,}/g,`
|
|
12
|
+
|
|
13
|
+
`).trim()}function Uu(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 yT=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function bT(e){return yT.test(e)}function vh(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of hT(t)){let r=n.includes("&")?pT(n):n;if(yT.test(r))return true}return false}function xh(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?C5(n):""}function wh(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function O5(e){if(!e)return false;if(bT(wh(e,"text/plain")))return true;let t=wh(e,"text/html");if(t.length===0)return false;if(vh(t))return true;let n=jo(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:fT(t).imageCount>0}function M5(e){return e?vh(wh(e,"text/html")):false}var A5="popup,width=1000,height=900",vT=["class","style","data-theme","data-color-mode","dir","lang"];async function L5(e={}){let t=globalThis.window;if(!t?.open)return null;let n=e.url??"about:blank",r=t.open(n,e.name??"docx-editor",e.features??A5);if(!r)return null;n!=="about:blank"&&await F5(r);let o=r.document;e.title&&(o.title=e.title),o.body.style.margin="0";let i=o.createElement("div");i.style.height="100vh",o.body.append(i);let a=e.styles??true,s=a===false?()=>{}:a===true?wT(t.document,o):a(t.document,o),l=new Set,c=false,d=()=>{if(!c){c=true,r.removeEventListener("pagehide",d),t.removeEventListener("pagehide",u),s();for(let f of [...l])try{f();}catch(p){console.error(p);}l.clear();}},u=()=>{d(),r.close();};return r.addEventListener("pagehide",d),t.addEventListener("pagehide",u),{window:r,element:i,onClose(f){return l.add(f),()=>l.delete(f)},close:u}}function F5(e){return new Promise(t=>{let n=false,r=()=>{n||(n=true,t());};e.addEventListener("load",r,{once:true});try{e.document.readyState==="complete"&&e.location.href!=="about:blank"&&r();}catch{}})}function wT(e,t){let n=new Map,r=b=>{if(n.has(b))return;let y=t.importNode(b,true),h=b.sheet;b.localName==="style"&&h&&!(b.textContent??"").trim()&&(y.textContent=Sh(h)),t.head.append(y),n.set(b,y);},o=b=>b.nodeType===1&&(b.localName==="style"||b.localName==="link"&&(b.getAttribute("rel")??"").split(/\s+/).includes("stylesheet"));for(let b of Array.from(e.querySelectorAll('link[rel~="stylesheet"], style')))r(b);let i=t.createElement("style");i.dataset.docxAdopted="",t.head.append(i);let a="",s=()=>{let b=e.adoptedStyleSheets??[],y=b.map(h=>xT(h)).join(",");y!==a&&(a=y,i.textContent=b.map(Sh).join(`
|
|
16
|
+
`));};s();let l=()=>{for(let b of vT){let y=e.documentElement.getAttribute(b);y===null?t.documentElement.removeAttribute(b):t.documentElement.setAttribute(b,y);}};l();let c=new Map,d=()=>{for(let[b,y]of n){let h=b.sheet;if(b.localName!=="style"||!h)continue;let x=xT(h);if(c.get(b)===x)continue;let w=!c.has(b);c.set(b,x),w||(y.textContent=Sh(h));}s();};d();let u=t.defaultView?.setInterval(d,D5),f=()=>{u!==void 0&&t.defaultView?.clearInterval(u);},p=e.defaultView?.MutationObserver;if(typeof p!="function")return f;let g=new p(b=>{for(let y of b){if(y.type==="attributes"){l();continue}for(let x of Array.from(y.addedNodes))if(o(x))r(x);else if(x.nodeType===1)for(let w of Array.from(x.querySelectorAll("style, link")))o(w)&&r(w);for(let x of Array.from(y.removedNodes)){let w=n.get(x);w&&(n.delete(x),w.parentNode?.removeChild(w));}let h=y.target;if(y.type==="characterData"||h.localName==="style"&&n.has(h)){let x=y.type==="characterData"?y.target.parentNode:h,w=x&&n.get(x);w&&(w.textContent=x.textContent);}}});return g.observe(e.head,{childList:true,subtree:true,characterData:true}),g.observe(e.documentElement,{attributes:true,attributeFilter:vT}),()=>{g.disconnect(),f();}}var D5=250;function xT(e){try{return e.cssRules.length}catch{return -1}}function Sh(e){try{return Array.from(e.cssRules,t=>t.cssText).join(`
|
|
17
|
+
`)}catch{return ""}}function N5(e,t,n,r){let o=e.top-n-r;return t!==void 0&&o<t?e.bottom+r:o}var ST=new WeakMap;function Xl(e){let t=ST.get(e);if(t)return t;let n=[],r=e.contentBox;for(let i of [e.header,e.footer]){if(!i)continue;let a=(s,l)=>{!s.textboxStory||s.accessibility.hidden||n.push(Object.freeze({drawing:s,kind:i.kind,...i.rId!==void 0?{rId:i.rId}:{},origin:Object.freeze({x:l.x-r.x,y:l.y-r.y})}));};for(let s of i.anchoredDrawings??[])a(s,Ia$1(s,i.box,e.box));for(let s of Ka$1(i.fragments,true))for(let l of s.lines)for(let c of l.drawings??[])a(c,{x:i.box.x+c.x,y:i.box.y+c.y});}let o=Object.freeze(n);return ST.set(e,o),o}function H5(e,t){let n=fb$2(e,t),r=n&&fb$2(e,n.id);if(!r)return false;let o=Ud(r.children,{namespaceUri:ma$2,localName:"spPr"}),i=o&&Ud(o.children,{namespaceUri:va,localName:"xfrm"}),a=Ud(r.children,{namespaceUri:ma$2,localName:"bodyPr"}),s=i&&oa$2(i.attributes,"rot"),l=a&&oa$2(a.attributes,"rot"),c=a&&oa$2(a.attributes,"vert");return !!s&&Number(s)!==0||!!l&&Number(l)!==0||!!c&&c!=="horz"}function ju(e,t,n){let r=n.textboxStory;return !!r&&!H5(e,t)&&n.transform.rotationDegrees===0&&r.contentRotation===void 0&&r.fragments.length>0&&r.fragments.every(o=>o.kind==="paragraph")}function kT(e,t,n){if(!t.owner)return Fe(e,t.drawingNodeId);let r=e.pages[n],o=r?.index===n?[r,...e.pages]:e.pages;for(let i of o){let a=Xl(i).find(d=>d.drawing.drawingNodeId===t.drawingNodeId);if(!a)continue;let{drawing:s,origin:l}=a,c=s.paintBounds;return c.width<=0||c.height<=0?null:Object.freeze({pageIndex:i.index,x:l.x+c.x-s.x,y:l.y+c.y-s.y,width:c.width,height:c.height,record:s})}return null}function IT(e,t){if(!e.textboxStory)return {};let n=bk(t).find(r=>r.drawingNodeId===e.drawingNodeId);return {textEditable:!!n&&ju(t,n.root.id,e)}}function _5(e,t){return !e.textbox||t==="view"?null:e.textEditable===false?"imageOverlay.textLocked":!e.canMove&&!e.canResize?"imageOverlay.locked":null}var B5=Object.freeze({kind:"body"});function de(e,t){if(t===void 0)return null;let n=t.indexOf("#");return n===-1?e.storyParts?.().find(r=>eb$1(r,t)!==null)??null:n===0?null:e.currentPackage().parts.get(t.slice(0,n))??null}function Vu(e,t,n){let r=t.indexOf("#"),o=n.indexOf("#");if(r>0&&o>0)return r===o&&t.startsWith(n.slice(0,o+1));let i=de(e,t);return i!==null&&i.name===de(e,n)?.name}function Et(e,t,n){let r=t?.indexOf("#")??-1,o=r===-1?de(e,t)?.name??"":t.slice(0,r);return kh(e,o,n)}function kh(e,t,n){if(t.length===0||t===e.part().name)return {kind:"body"};for(let r of e.headerFooterResolutionBySection())for(let o of [r.headers,r.footers])for(let i of o.values())if(i.partName===t)return {kind:"headerFooter",rId:i.rId};for(let r of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:r})?.name===t)return {kind:"notesPart",noteKind:r};return n}function Gu(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=Ic$1(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function PT(e,t){return e?e.scope:t||B5}function $5(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(...RT(a.fragments));return o}if(!t)return Ja(e);let r=os(e,t);return r?RT(r.fragments):[]}function os(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 TT(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 zu(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Zu(e,t,n){let r=ve(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 Ih(e,t,n,r,o={}){return ze(e,t,n.fragments,r,o)}function W5(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=os(r,t);return o?Qe$2(e,t.pageIndex,o.fragments,n):null}function q5(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(...Qe$2(e,o.index,a.fragments,n));}return r.length>0?r:null}function ET(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function CT(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 OT(e,t,n){if((i=>{let a=e.pages[i];return !!a&&!!os(a,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let i of e.pages)if(os(i,t)&&(o===null&&(o=i.index),n===void 0||n.has(i.index)))return i.index;return o??t.pageIndex}function MT(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function AT(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Rh(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Ph(e,t,n,r,o,i,a,s){let l=o?W5(e,o,a):i?q5(e,i,a):null,c=Ve(e,t,n,r,{...a?{measurer:a}:{},...l?{stops:l}:{},...s!==void 0?{lineId:s}:{}});if(!c)return null;let u=(l?.find(p=>p.position.paragraphId===c.position.paragraphId&&p.position.offset===c.position.offset&&(c.lineId===void 0||p.lineId===c.lineId))??l?.find(p=>p.position.paragraphId===c.position.paragraphId&&p.position.offset===c.position.offset))?.pageIndex,f=c.lineId===void 0?null:Re(e,c.position,{...a?{measurer:a}:{},...u!==void 0?{preferredPageIndex:u}:{},preferredLineId:c.lineId});return {position:c.position,desiredX:c.desiredX,...u!==void 0?{pageIndex:u}:{},...f?{caret:f}:{}}}function Xu(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,c=s.y;if(t.x>=l&&t.x<l+s.width&&t.y>=c&&t.y<c+s.height)return {pageIndex:r.index,scopeId:a.scopeId,noteKind:a.noteKind,noteId:a.noteId,local:{x:t.x-l,y:t.y-c},fragments:a.fragments}}}return null}function LT(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let c=o.y,d=r.y,u=n?Math.max(d,n.box.y+n.box.height):d,f=n?Math.min(c,n.box.y):c;return u<=f?null:{x:r.x,y:f,width:r.width,height:u-f}}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 Th(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=LT(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 Eh(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=LT(r,i)??s,c=l.x+o,d=l.y;if(t.x>=c&&t.x<c+l.width&&t.y>=d&&t.y<d+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 FT(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,c=n.y-s.y;if(l<0||l>=s.width||c<0||c>=s.height)return false;let d=i?{measurer:i}:{},{story:u,local:f}=t,p=xe(u.anchoredDrawings,f,a.index)!==null||ze(e,a.index,u.fragments,f,d)?.onGlyphs===true;if(o&&p)return false;let g=ye$1(e,a.index,{x:l,y:c},d),b=Xu(e,n,r),y=g?.onGlyphs===true&&g.pageIndex===a.index||b?.pageIndex===a.index&&ze(e,a.index,b.fragments,b.local,d)?.onGlyphs===true;return o?y:y||!p}function is(e,t,n){if(!t&&!n)return db$1(e);let r=new Set,o=[];for(let i of e.pages)for(let a of $5(i,t,n)){for(let s of a.lines)for(let l of Za(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 Yu(e,t,n,r){let o=is(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 RT(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 DT(e,t){for(let n of e.pages)for(let r of [n.footnotes,n.endnotes])if(r){for(let o of r.notes)for(let i of Ka$1(o.fragments))if(i.paragraphId===t)return o.scopeId}return null}function NT(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 K5(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function U5(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 j5(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function V5(e,t){if(e)try{await e.delete(t);}catch{}}async function Ch(e){let t=()=>{if(e.signal?.aborted)throw e.signal.reason};t();let n=e.fetcher??fetch,r=e.maxFontBytes??a$1,o=await K5(e.cacheName??"docx-editor-fonts");t();async function i(c){t();let d=Object.freeze({family:c.family,weight:c.weight,style:c.style}),u=NT(d);if(u)return {failure:{url:c.url,request:d,reason:"invalidRequest",diagnostic:u}};let f$1=(h,x)=>{if(h.byteLength===0)return {url:c.url,request:d,reason:"emptyResponse"};if(h.byteLength>r)return {url:c.url,request:d,reason:"overLimit"};let w=l(h,c.faceIndex??0);if(!w.valid)return {url:c.url,request:d,reason:"malformed",diagnostic:w.diagnostic};let v=f(h);return c.hash!==void 0&&c.hash!==v?{url:c.url,request:d,reason:"hashMismatch",expectedHash:c.hash,actualHash:v,...x?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:d,id:`url:${c.url}`,bytes:h,hash:v,faceIndex:c.faceIndex??0}},p=await U5(o,c.url);if(t(),p){let h=f$1(p,true);if(!("reason"in h))return {source:h};await V5(o,c.url),t();}let g;try{g=e.signal?await n(c.url,{signal:e.signal}):await n(c.url),t();}catch(h){return t(),{failure:{url:c.url,request:d,reason:"networkError",diagnostic:h instanceof Error?h.message:String(h)}}}if(!g.ok)return {failure:{url:c.url,request:d,reason:"httpError",status:g.status}};let b;try{b=new Uint8Array(await g.arrayBuffer()),t();}catch(h){return t(),{failure:{url:c.url,request:d,reason:"networkError",diagnostic:h instanceof Error?h.message:String(h)}}}let y=f$1(b,false);return "reason"in y?{failure:y}:(await j5(o,c.url,b),t(),{source:y})}let a=await Promise.all(e.sources.map(c=>i(c)));t();let s=[],l$1=[];for(let c of a)"source"in c?s.push(c.source):l$1.push(c.failure);return {sources:s,failures:l$1}}function G5(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=NT(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 z5=e=>e.trim().toLowerCase(),HT=e=>JSON.stringify([z5(e.family),e.weight,e.style]);function Z5(e){return o(async t=>{if(t.signal?.aborted)throw t.signal.reason;let n=new Set((t.resolvedFaces??[]).map(HT)),r=e.sources.filter(s=>!n.has(HT(s)));if(r.length===0)return {sources:[],failures:[]};let{onFailure:o,...i}=e,a=await Ch({...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 X5=96,_T=37.79527559055118;function Y5(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 c=s/8;n.push({position:l,height:10,...c>0?{label:String(c)}:{}});}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=_T/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 Q5(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var J5=1440,e4=567,t4=180,n4=56.7,BT=e=>({pageWidth:e.pageWidth,leftMargin:e.rightMargin,rightMargin:e.leftMargin}),Qu=(e,t,n)=>n<t||e<t?t:e>n?n:e;function $T(e,t,n){if(t.rtl)return n.pageWidth-$T(e,{...t,rtl:false},BT(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 WT(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 qT(e,t,n,r,o={}){if(n.rtl)return {...qT(e,r.pageWidth-t,{...n,rtl:false},BT(r),o),rtl:true};let i=WT(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=Qu(i,0,a);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),c=a-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:Qu(i-r.leftMargin,l,c)}}case "hanging":{let l=Qu(i-r.leftMargin,-r.leftMargin,a-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=Qu(i,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}function r4(e,t,n){return n.rtl?t.pageWidth-t.rightMargin-e:t.leftMargin+e}function o4(e,t,n){if(!Number.isFinite(e.pageWidth)||e.pageWidth<=0)return [];let r=t.rtl?e.pageWidth-e.rightMargin:e.leftMargin,o=n==="inch"?8:10,i=(n==="inch"?1440:567)/o,a=[],s=-Math.floor(r/i),l=Math.floor((e.pageWidth-r)/i);for(let c=s;c<=l;c+=1){let d=r+c*i,u=Math.abs(c)%o;if(u===0){let f=Math.abs(c)/o,p=f>0&&d>0&&d<e.pageWidth;a.push({position:d,height:8,...p?{label:String(f)}:{}});}else u===o/2?a.push({position:d,height:5}):n==="cm"||u%2===0?a.push({position:d,height:3}):a.push({position:d,height:2});}return a}function KT(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 i4(e){if(!(!e||typeof e!="object"||"preventDefault"in e))return e}var UT="no formatting has been copied",Ju="there is nothing at the selection to copy",Oh="the selection has nothing to paint",ef=Object.freeze({mode:"off",level:"none"});function jT(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>
|
|
18
|
+
<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">
|
|
19
|
+
<wp:anchor distT="0" distB="0" distL="91440" distR="91440" simplePos="0" relativeHeight="251658240" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1">
|
|
20
|
+
<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>
|
|
21
|
+
<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/>
|
|
22
|
+
<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>
|
|
23
|
+
</wp:anchor></w:drawing></w:r></w:p></w:body></w:document>`,i=Pa(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 c of l.children){let d=a(c);if(d)return d}return null},s=a(i.part.root);if(!s)throw new Error("Textbox drawing is missing");return s}function Mh(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 VT(e){let t=Mh(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=eb$1(o,r);if(!i||i.kind!=="paragraph")return {ok:false,code:"notFound",reason:"Textbox anchor is missing"};let a=_f$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(bk(o).map(p=>p.root.id)),l=e.layout().pages.flatMap(p=>p.fragments).find(p=>p.kind==="paragraph"&&p.paragraphId===r),c=Math.min(300,l?.box.width??300);n.kind==="frame"&&e.setActiveScope({kind:"body"});let d=Gi$1(i);e.setSelection({anchor:{paragraphId:r,offset:d},head:{paragraphId:r,offset:d}});let u=e.applyDrawingOps([{op:"insertDrawing",paragraphId:r,offset:d,drawing:jT(a.id,c)}]);if(u.rejected)return {ok:false,code:"invalidArgs",reason:u.reason??"Textbox insertion was refused"};let f=bk(e.session.part()).find(p=>!s.has(p.root.id));return f&&e.setActiveScope({kind:"frame",id:f.root.id,drawingNodeId:f.drawingNodeId,hostParagraphId:f.hostParagraphId}),e.focus(),{ok:true,changed:u.committed}}var Ah=new WeakMap;function Po(e){let t=Ah.get(e);if(t)return t;let n=Bh$1(e);if(n.length===0)return Ah.set(e,[]),[];let r=[];for(let o of n){let i=Ah$1(o);for(let a of new Set([o.beginParagraphId,...o.resultParagraphIds,o.endParagraphId])){let s=eb$1(e,a);if(s?.kind!=="paragraph")continue;let l=Ei(s),c=a===o.beginParagraphId,d=a===o.endParagraphId;r.push({toc:o,paragraphId:a,length:l.length,startsHere:c,endsHere:d,start:c?l.spanOf(o.beginNodeId)?.start??0:0,end:d&&i?l.spanOf(i.endNodeId)?.end??l.length:l.length});}}return Ah.set(e,r),r}function tf(e){return new Set(Po(e).filter(t=>t.start===0&&t.end===t.length&&!(t.endsHere&&!t.startsHere&&t.end===0)).map(t=>t.paragraphId))}function Lh(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 ir(e,t){return Po(e).find(n=>n.paragraphId===t.paragraphId&&Lh(n,t.offset))?.toc}function GT(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 Po(e).some(a=>a.paragraphId===n.paragraphId&&(o===i?Lh(a,o):o<a.end&&i>a.start))}return ir(e,n)!==void 0||ir(e,r)!==void 0}function zT(e,t){let n=Po(e);if(n.length===0)return false;let r=qm(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:c}=a.range;return l===c?Lh(s,l):l<s.end&&c>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,c])=>i(c,l));return i(t)}function ZT(e,t,n){let r=ir(e,t);if(!r)return null;let o=Po(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 XT(e,t){return !Po(t).some(r=>r.toc.id===e.id&&(r.start>0||r.end<r.length))&&e.contentControlId?e.contentControlId:`toc:${e.id}`}function YT(e,t,n){if(!t)return;let r=n?.closest("[data-start]");return Po(e).find(o=>o.paragraphId===t&&(r?Number(r.dataset.start)<o.end&&Number(r.dataset.end)>o.start:tf(e).has(t)))?.toc}function QT(e,t){return Bh$1(e).some(n=>n.beginParagraphId===t||n.endParagraphId===t||n.resultParagraphIds.includes(t))}var eE="suggesting cannot merge or split cells; stop suggesting to change the table structure",a4="select two or more cells that form a rectangle to merge them",s4="select two or more cells to merge them";function tE(e){switch(e){case "cells-not-rectangle":return {code:"invalidArgs",reason:a4};case "split-rows-not-divisor":return {code:"invalidArgs",reason:"a merged cell splits only into a number of rows that divides its rows"};case "split-needs-grid":return {code:"invalidArgs",reason:"this table has no column grid, so the cell splits only into a divisor of its columns"};case "cell-too-narrow":return {code:"invalidArgs",reason:"the cell is too narrow to split into that many columns"};case "cell-has-revision":return {code:"unsupported",reason:"the cells have a tracked change; accept or reject it first"};default:return null}}function JT(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=Rm}function nE(e){return JT(e.rows)&&JT(e.cols)&&e.rows*e.cols>=2?null:`splitCell rows and cols must be whole numbers from 1 to ${Rm}, and not both 1`}function nf(e){let t=e.author()?.trim();return e.editingMode()==="suggest"&&t?{suggestingAuthor:t}:{}}function rE(e,t,n){return !n||t.op!=="mergeTableCells"&&t.op!=="splitTableCell"?t:Xm(e.root,t.tableId,n)?{...t,revision:{author:n}}:t}function oE(e,t,n){return e.type==="mergeCells"?!n||t.cellIds.length<2?{ok:false,code:"invalidArgs",reason:s4}:{ok:true,op:{op:"mergeTableCells",tableId:t.tableId,cellIds:t.cellIds}}:t.cellIds.length>1?{ok:false,code:"invalidArgs",reason:"select one cell to split it"}:{ok:true,op:{op:"splitTableCell",tableId:t.tableId,cellId:t.cellId,rows:e.rows,columns:e.cols}}}function iE(e,t,n){let r=Sm(e,t.tableId);if(!r.ok)return null;let o=null;for(let i of t.cellIds){let a=r.table.index.byId.get(i);if(!a)continue;let s=Tm(r.table,a),l=n==="above"?s.rowFrom:s.rowTo;o=o===null?l:n==="above"?Math.min(o,l):Math.max(o,l);}return o===null?null:r.table.topology.rows[o]?.row.id??null}function aE(e,t,n){let r=Sm(e,t.tableId);if(!r.ok)return null;let o=null;for(let i of t.cellIds){let a=r.table.index.byId.get(i);if(!a)continue;let s=Tm(r.table,a),l=n==="left"?s.colFrom:s.colTo;o=o===null?l:n==="left"?Math.min(o,l):Math.max(o,l);}return o===null?null:r.table.topology.gridColumns[o]?.id??null}var Yl=/^[0-9A-Fa-f]{6}$/,sE={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"},l4={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 Fh(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function rf(e){return Math.max(0,Math.min(1,e))}function lE(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 cE(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 dE(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-rf(t))*255)))/255,o=lE(e);return cE(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function uE(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(rf(t)*255)))/255,o=lE(e);return cE(r*o.r,r*o.g,r*o.b)}function Dh(e){return sE[e]??sE[e.toLowerCase()]??null}function c4(e,t){let n=Dh(e);if(!n)return null;let r=t.find(i=>i.slot===n)?.hex;if(r&&Yl.test(r))return r.toUpperCase();let o=l4[n];return o&&Yl.test(o)?o.toUpperCase():null}function of(e,t){let n=c4(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Fh(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Fh(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=dE(r,rf(e.tint)):e.shade!==void 0&&(r=uE(r,rf(e.shade))),{ok:true,hex:r}}var d4="000000";function Nh(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return Yl.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:d4}};let n=of(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Dh(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Hh(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 Yl.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=of(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Dh(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function u4(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return Yl.test(o)?`#${o}`:`#${n}`}let r=of(e,t);return `#${r.ok?r.hex:n}`}function fE(e,t){if(t.region!=="table")return {ok:false,code:"unsupported",reason:`selecting a table ${t.region} is not supported yet`};let n=e.cellSelection?.tableId??qa(e.layout,e.selection.head.paragraphId)?.tableId,r=n===void 0?null:ja(e.layout,n);return r?{ok:true,ops:[],selection:{kind:"selectCells",cells:r}}:{ok:false,code:"unsupported",reason:"the selection is not inside a table"}}function pE(e,t,n){return n==="suggest"||!t||!ka(e,t)?null:{ok:true,ops:[{op:"deleteBlock",blockId:t.tableId}],selection:{kind:"adoptCommittedCaret"}}}function _h(e,t){return Ef$2(e).occurrences.some(n=>n.table.tableId===t&&n.row.cells.some(r=>r.logicalGridColumn!==void 0))}function mE(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var g4=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function Yo(e){return g4.has(e.type)}function ye(e,t){return {ok:false,code:e,reason:t}}function Bh(e,t){let n=tE(e);if(n)return ye(n.code,n.reason);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 uses a legacy horizontal merge the editor cannot change");case "row-hides-cell":case "tree-invariant":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 rn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qn(e,t){return !rn(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function bE(e){if(!rn(e))return false;let t=e.kind;if(t==="hex")return qn(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return qn(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 qn(e,n)}return false}function vE(e){return rn(e)&&qn(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 xE(e){return rn(e)&&qn(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 h4(e){return rn(e)&&qn(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 y4(e){return rn(e)&&qn(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 b4(e){return !rn(e)||!qn(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&bE(e.color)}function gE(e){return !("target"in e)||e.target===void 0||vE(e.target)}function hE(e){return !("target"in e)||e.target===void 0||xE(e.target)}function v4(e){switch(e.type){case "splitCell":{let t=nE(e);return t?ye("invalidArgs",t):null}case "insertRow":return !rn(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"):gE(e)?null:ye("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !rn(e)||e.type!=="deleteRow"?ye("invalidArgs","deleteRow command shape is invalid"):gE(e)?null:ye("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !rn(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"):hE(e)?null:ye("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !rn(e)||e.type!=="deleteColumn"?ye("invalidArgs","deleteColumn command shape is invalid"):hE(e)?null:ye("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !rn(e)||!qn(e,["type"])?ye("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !rn(e)||!qn(e,["type","color"])?ye("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!bE(e.color)?ye("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !rn(e)||!qn(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?ye("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !rn(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)||!b4(e.spec)?ye("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !rn(e)||!qn(e,["type","target","leftWidthTwips","rightWidthTwips"])||!h4(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?ye("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !rn(e)||!qn(e,["type","target","columnWidthTwips","tableWidthTwips"])||!y4(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?ye("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function x4(e){return !("target"in e)||e.target===void 0?null:vE(e.target)?e.target:null}function w4(e){return !("target"in e)||e.target===void 0?null:xE(e.target)?e.target:null}function S4(e,t){let n=Om(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 k4(e,t){let n=Om(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=wE(s);if(r.has(s.id))for(let c=0;c<l;c+=1){let d=n.topology.gridColumns[a+c];d&&o.add(d.id);}a+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function yE(e,t,n){let r=Om(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function I4(e){let t=ra$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 wE(e){let t=Bl(e,"tcPr"),n=t&&Bl(t,"gridSpan"),r=n&&Cl(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 R4(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=wE(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 P4(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Om(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 T4(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Om(e.part.root,t.tableId);return n.ok?R4(n.topology,t.tableId,t.gridColumnId):null}function SE(e,t){for(let n of t){let r=xn$1(e,n);if(r)return Bh(r)}return null}function Wn(e,t,n){let r=SE(e,t);return r||{ok:true,ops:t,selection:n}}function E4(e,t){if(!Pm.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=Nh(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function Ql(e,t,n){return n!==e.storeRevision?ye("invalidArgs","the table target is stale"):Om(e.part.root,t).ok?null:ye("invalidArgs","the table target is no longer valid")}function C4(e){return e?.isHeaderRepeat?ye("unsupported","repeated header rows cannot be edited"):null}function O4(e,t,n,r){let o=Ql(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=Om(e.part.root,t.tableId);if(!i.ok){let u=i.reason==="duplicate-node-id"?"unknown-table":i.reason;return Bh(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),c=i.topology.gridColumns.indexOf(s);if(Math.abs(c-l)!==1)return ye("invalidArgs","the column divider target is not adjacent");let d={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:l<c?t.leftGridColumnId:t.rightGridColumnId,rightGridColumnId:l<c?t.rightGridColumnId:t.leftGridColumnId,leftWidthTwips:l<c?n:r,rightWidthTwips:l<c?r:n};return Wn(e.part,[d],{kind:"preserveSelection"})}function M4(e,t,n,r){let o=Ql(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=Om(e.part.root,t.tableId);if(!i.ok){let l=i.reason==="duplicate-node-id"?"unknown-table":i.reason;return Bh(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 Wn(e.part,[s],{kind:"preserveSelection"})}function kE(e,t,n){if(e.viewing||!e.editable)return ye("locked","the document is open for viewing");let r=Ql(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 Wn(e.part,[o],{kind:"preserveSelection"})}function Tr(e){let{command:t,part:n,viewing:r,editable:o}=e;if(t.type==="selectTableRegion")return fE(e,t);if(r||!o)return ye("locked","the document is open for viewing");switch(t.type){case "toggleHeaderRow":case "setTableProperties":return ye("unsupported",`command '${t.type}' is not supported by the tree editor`);}let i=v4(t);if(i)return i;let a=x4(t),s=w4(t),l=C4(a??s);if(l)return l;if(a){let d=Ql(e,a.tableId,a.sourceRevision);if(d)return d}if(s){let d=Ql(e,s.tableId,s.sourceRevision);if(d)return d}let c=a!==null?P4(e,a):s!==null?T4(e,s):I4(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!c)return a||s?ye("invalidArgs","the table target is no longer valid"):ye("unsupported","the selection is not inside a table");if(c?.isHeaderRepeat)return ye("unsupported","repeated header rows cannot be edited");switch(t.type){case "mergeCells":case "splitCell":{if(!c)return ye("unsupported","the selection is not inside a table");let d=oE(t,c,e.cellSelection!==null);if(!d.ok)return ye(d.code,d.reason);let u=rE(n,d.op,e.suggestingAuthor);return SE(n,[u])??{ok:true,ops:[d.op],selection:{kind:"adoptCommittedCaret"}}}case "insertRow":{if(!c)return ye("unsupported","the selection is not inside a table");let d=(a?null:iE(n,c,t.where))??c.rowId,u={op:"insertTableRow",tableId:c.tableId,rowId:d,where:t.where};return Wn(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!c)return ye("unsupported","the selection is not inside a table");let d=S4(n,c),u=d.wholeTable?[{op:"deleteBlock",blockId:c.tableId}]:d.rowIds.map(f=>({op:"deleteTableRow",tableId:c.tableId,rowId:f,...f===c.rowId?{referenceCellId:c.cellId}:{}}));return Wn(n,u,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!c)return ye("unsupported","the selection is not inside a table");let d=s?.tableId??c.tableId,u=_h(e.layout,d)?t.where==="left"?"right":"left":t.where,f=s?.gridColumnId??aE(n,c,u)??yE(n,d,c.gridColumnIndex),p=f?{op:"insertTableColumn",tableId:d,where:u,gridColumnId:f}:{op:"insertTableColumn",tableId:d,where:u,referenceCellId:c.cellId};return Wn(n,[p],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!c)return ye("unsupported","the selection is not inside a table");let d=s?.tableId??c.tableId,u=s?.gridColumnId??yE(n,d,c.gridColumnIndex);if(!u)return ye("invalidArgs","the table has no grid column to delete");let f=s?.gridColumnId===void 0?k4(n,c):{gridColumnIds:[u],wholeTable:false};if(f.wholeTable)return Wn(n,[{op:"deleteBlock",blockId:d}],{kind:"adoptCommittedCaret"});let g=(f.gridColumnIds.length>0?f.gridColumnIds:[u]).map(b=>({op:"deleteTableColumn",tableId:d,gridColumnId:b}));return Wn(n,g,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!c)return ye("unsupported","the selection is not inside a table");let d={op:"deleteBlock",blockId:c.tableId};return Wn(n,[d],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!c)return ye("unsupported","the selection is not inside a table");let d;if(t.color===null)d=null;else {let f=Hh(t.color,e.themeColors);if(!f.ok)return ye("invalidArgs",f.reason);d=f.color;}let u={op:"setTableCellFill",tableId:c.tableId,cellIds:c.cellIds,color:d};return Wn(n,[u],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!c)return ye("unsupported","the selection is not inside a table");let d={op:"setTableCellVerticalAlignment",tableId:c.tableId,cellIds:c.cellIds,alignment:t.alignment};return Wn(n,[d],{kind:"preserveSelection"})}case "setTableBorders":{if(!c)return ye("unsupported","the selection is not inside a table");if(t.scope==="none"){let f={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:"none",target:mE(t.target,_h(e.layout,c.tableId))};return Wn(n,[f],{kind:"preserveSelection"})}let d=E4(t.spec,e.themeColors);if(!d.ok)return ye("invalidArgs",d.reason);let u={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:mE(t.scope,_h(e.layout,c.tableId)),spec:d.spec};return Wn(n,[u],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return O4(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return M4(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return ye("unsupported",`command '${t.type}' is not a table command`)}}function IE(e){if(!Yo(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "toggleHeaderRow":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}var af="Calibri",$h=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),A4=4e3,as=e=>Math.max(1,Math.min(A4,e));function L4(e,t,n,r){let o={...la$1,fontFamily:t.fontFamily,bold:t.bold,italic:t.italic,fontSizePt:t.size??100},i=r?.measure(e,o)??NaN,a=r?.lineMetrics(o).height??NaN;if(i>0||(i=.55*o.fontSizePt*Array.from(e).length),a>0||(a=1.22*o.fontSizePt),t.size!==null)return {width:as(i),height:as(a)};let s=a/i,l=Math.min(n.width,n.height),c=t.diagonal?l*Math.SQRT2/(1+s):n.width;return {width:as(c),height:as(c*s)}}function F4(e,t,n){let r=Of$1(e);if(!$h.has(r))return null;let o=Tf$1(e,r);if(!o)return null;let i=o.pixelWidth*72/(o.dpiX&&o.dpiX>0?o.dpiX:96),a=o.pixelHeight*72/(o.dpiY&&o.dpiY>0?o.dpiY:96);if(!(i>0)||!(a>0))return null;let s=t??Math.min(n.width/i,n.height/a);return {width:as(i*s),height:as(a*s)}}function Jl(e,t,n){if(e.imageData)return F4(e.imageData,e.scale??null,t);let r=e.text??"";return r===""?null:L4(r,{fontFamily:e.fontFamily?.trim()||af,bold:e.bold??false,italic:e.italic??false,size:e.fontSizePt??null,diagonal:(e.layout??"diagonal")==="diagonal"},t,n)}var D4="C0C0C0",N4=.5,H4=/^[^"';{}<>\\\u0000-\u001f]{1,64}$/u;function sf(e){if(!e)return null;let t=hj$1(e.session.currentPackage());return t?t.kind==="picture"?Object.freeze({kind:"image",washout:t.washout}):Object.freeze({kind:"text",text:t.text,fontFamily:t.fontFamily,fontSizePt:t.fontSizePt,bold:t.bold,italic:t.italic,color:t.colorHex,transparency:Math.round((1-t.opacity)*1e3)/1e3,layout:t.diagonal?"diagonal":"horizontal"}):null}function PE(e){let t=sf(e);if(!t||!e)return null;if(t.kind==="text"){let{kind:i,...a}=t;return Object.freeze(a)}let n=e.session.currentPackage(),r=hj$1(n),o=r?.kind==="picture"&&r.mediaPartName?n.partBytes.get(r.mediaPartName):void 0;return Object.freeze({washout:t.washout??false,scale:null,...o?{imageData:o}:{}})}var Wh=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n;function qh(e){if(e===null)return null;if(typeof e!="object"||e===void 0)return "watermark must be an object or null";let t=e,n=t.text!==void 0,r=t.imageData!==void 0;if(n===r)return "set exactly one of text and imageData";if(n){if(typeof t.text!="string"||!t.text.trim())return "text must be a non-empty string";if(t.text.length>_d$1)return `text is longer than ${_d$1}`;if(/[\r\n\v\f\u2028\u2029]/u.test(t.text))return "text must be one line";if(/[\u0000-\u0008\u000e-\u001f]/u.test(t.text))return "text holds a control character";if(t.fontFamily!==void 0&&(typeof t.fontFamily!="string"||!H4.test(t.fontFamily.trim())))return "fontFamily is not a font name";if(t.fontSizePt!==void 0&&t.fontSizePt!==null&&!Wh(t.fontSizePt,1,1e3))return "fontSizePt must be from 1 to 1000";if(t.color!==void 0&&(typeof t.color!="string"||!/^[0-9a-f]{6}$/iu.test(t.color)))return "color must be RRGGBB";if(t.transparency!==void 0&&!Wh(t.transparency,0,1))return "transparency must be from 0 to 1";if(t.layout!==void 0&&t.layout!=="diagonal"&&t.layout!=="horizontal")return "layout must be 'diagonal' or 'horizontal'";for(let i of ["bold","italic"])if(t[i]!==void 0&&typeof t[i]!="boolean")return `${i} must be a boolean`;return t.scale!==void 0||t.washout!==void 0?"scale and washout apply to a picture watermark":null}if(!(t.imageData instanceof Uint8Array))return "imageData must be a Uint8Array";let o=Of$1(t.imageData);if(!$h.has(o))return "imageData is not a PNG, JPEG, GIF, BMP or WebP picture";if(!$f$1(t.imageData,o))return "imageData is not a readable picture";if(t.scale!==void 0&&t.scale!==null&&!Wh(t.scale,.01,10))return "scale must be from 0.01 to 10";if(t.washout!==void 0&&typeof t.washout!="boolean")return "washout must be a boolean";for(let i of ["fontFamily","fontSizePt","bold","italic","color","transparency","layout"])if(t[i]!==void 0)return `${i} applies to a text watermark`;return null}function TE(e){let{pageSize:t,margins:n}=e,r=(t.widthTwips-n.leftTwips-n.rightTwips-n.gutterTwips)/20,o=(t.heightTwips-n.topTwips-n.bottomTwips)/20;return {width:Math.max(72,r),height:Math.max(72,o)}}function RE(e,t,n){let r=e.session.currentPackage(),o=r.parts.get(r.mainDocumentPart);if(o)return be(o).map(i=>{let a=Jl(t,TE(i.properties),n);return a?{widthPt:a.width,heightPt:a.height}:null})}function _4(e,t){let n=TE(e.sectionPropertiesAt(e.state().selection.head.paragraphId)),r=e.textMeasurer?.();if(t.imageData){let u=Of$1(t.imageData),f=Jl(t,n);return f?{kind:"picture",washout:t.washout??true,widthPt:f.width,heightPt:f.height,sectionSizes:RE(e,t,r),image:{bytes:t.imageData,mime:u}}:null}let o=t.text??"",i=t.fontFamily?.trim()||af,a=t.bold??false,s=t.italic??false,l=(t.layout??"diagonal")==="diagonal",c=t.fontSizePt??null,d=Jl(t,n,r);return {kind:"text",text:o,fontFamily:i,fontSizePt:c,bold:a,italic:s,colorHex:(t.color??D4).toUpperCase(),opacity:1-(t.transparency??N4),diagonal:l,widthPt:d.width,heightPt:d.height,sectionSizes:RE(e,t,r)}}function EE(e,t){let n=qh(t);if(n)return {ok:false,code:"invalidArgs",reason:n};if(typeof e.applyHeaderFooterLifecycle!="function")return {ok:false,code:"unsupported",reason:"watermarks are not available"};let r=t?_4(e,t):null;if(t&&!r)return {ok:false,code:"invalidArgs",reason:"imageData is not a readable picture"};if(!t&&!hj$1(e.session.currentPackage()))return {ok:true,changed:false};let o={op:"setWatermark",watermark:r},i=e.applyHeaderFooterLifecycle(o);return i.ok?{ok:true,changed:true}:{ok:false,code:i.reason==="locked"?"locked":"invalidArgs",reason:`the watermark was not written: ${i.reason}`}}function Gt(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 Xi(e){if(typeof e!="object"||e===null)return false;let t=e;return Gt(t.from)&&Gt(t.to)}function CE(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 Kn(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=Jm(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=CE(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=CE(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 OE(e,t,n){if("anchor"in n){let s=Kn(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(!Gt(r)||!Gt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let i=Kn(e,t,r);if(!i.ok)return {ok:false,code:i.code,reason:i.reason,target:r};let a=Kn(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}}function ME(e){let t=e.match;return typeof t?.blockId!="string"||t.blockId.length===0||!Number.isInteger(t.start)||t.start<0||!Number.isInteger(t.length)||t.length<0?"match must carry a blockId and offsets":typeof e.text!="string"?"replaceMatch requires text":/[\r\n\v\f\u2028\u2029]/.test(e.text)?"replaceMatch requires text without a paragraph mark":null}function Kh(e,t){let n=t.scope??{kind:"body"},r=e.activeScope();return (n.kind==="body"?r.kind==="body":n.kind==="headerFooter"?r.kind==="headerFooter"&&r.rId===n.rId:n.kind==="note"?r.kind==="note"&&r.id===n.id:false)?null:{ok:false,code:"unsupported",reason:n.kind==="frame"?"replaceMatch does not replace text in a text box":"replaceMatch replaces text only in the open story"}}function AE(e,t){let n=Kh(e,t.match);if(n)return n;let{blockId:r,start:o,length:i}=t.match;return e.replaceTextInPlace(r,o,o+i,t.text)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"replaceMatch was refused"}}var B4=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function $4(e,t){return e===t?true:!e||!t?false:B4.every(n=>e[n]===t[n])}function Uh(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||!$4(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 jh(e,t){return e.current===t.current&&e.total===t.total}function Vh(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 LE(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 Gh(e,t){return e===t?true:!e||!t||!Xi(e)||!Xi(t)?false:LE(e.from,t.from)&&LE(e.to,t.to)}function zh(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var W4={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",openFailure:"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",showBookmarks:"compared",documentProtection:"compared",reviewDisplayMode:"compared",revisionMarkup:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},q4=Object.keys(W4);function Zh(e,t){return q4.every(n=>e[n]===t[n])}function lf(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)lf(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))lf(t[n]);return Object.freeze(e)}var Xh=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"}}]]),K4=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),U4=/^[0-9A-Fa-f]{6}$/;function Yh(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"&&!U4.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"||!K4.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 HE(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function Qh(e){return typeof e=="object"&&e!==null&&HE(e.anchor)&&HE(e.head)}function on(e,t){let n=new Error(t);return n.code=e,n}function cf(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 Jh(e){return e==="blank"?Mg():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function _E(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 Yi(e){switch(e.type){case "toggleMark":return Xh.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=Yh(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))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${Gd}`};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)return {supported:false,reason:`indent values must be within \xB1${Gd} 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 "replaceMatch":{let t=ME(e);return t?{supported:false,code:"invalidArgs",reason:t}:{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 "removeToc":return e.tocId!==void 0&&(typeof e.tocId!="string"||e.tocId.length===0)?{supported:false,code:"invalidArgs",reason:"removeToc 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 "setTableProperties":{let t=IE(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "selectTableRegion":return e.region==="table"?{supported:true,mutating:false}:{supported:false,reason:`selecting a table ${e.region} is not supported yet`};case "setSelection":return "range"in e&&(Qh(e.range)||Xi(e.range))||"anchor"in e&&Gt(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};case "insertBookmark":case "deleteBookmark":case "keepFirstBookmark":case "goToBookmark":return typeof e.name=="string"&&e.name.length>0?{supported:true,mutating:e.type!=="goToBookmark"}:{supported:false,code:"invalidArgs",reason:`${e.type} needs a name`};case "setWatermark":{let t=qh(e.watermark);return t?{supported:false,code:"invalidArgs",reason:t}:{supported:true,mutating:true}}default:return {supported:false,reason:ey(e.type)}}}function ey(e){return `command '${e}' is not supported by the tree editor`}var Kt="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",BE="realtime collaboration requires the pro collaboration module (@docx-editor.dev/pro)",zr="suggesting mode needs an author; configure author before enabling it",j4="this document asks for tracked changes, but no author is configured",df="this document is protected for filling in forms, which does not track changes",ny="this document permits editing only as tracked changes",uf="image changes are not supported in suggesting mode",ss="this revision kind has no structural accept/reject yet",Qi="this document is protected against editing; open it in Word to change that",Ji="this document is protected for comments only",ty={mode:null,rejection:null};function ry(e,t){if(e===void 0||e==="view")return ty;if(e==="edit")return {mode:"editing",rejection:null};let n=$E(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function $E(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:zr}:{ok:false,code:"unsupported",reason:Kt}}function WE(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==zr||t||n!==null||(n=globalThis.setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let i=`${zr}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(on("suggestingNeedsAuthor",i)),r(`[@docx-editor.dev/core] ${i}`);},0));},dispose(){n!==null&&globalThis.clearTimeout(n),n=null;}}}function oy(e){if(e.restrictedToReadOnly)return e.currentMode==="viewing"?ty:{mode:"viewing",rejection:Qi};let t=e.currentMode,n=null;e.engineAdoptedViewing&&t==="viewing"&&!e.viewOnly&&(n="editing",t="editing");let r=n===null?ty:{mode:n,rejection:null};return e.restrictedToComments?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:Ji}:r:e.restrictedToForms?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:df}: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:j4}}function qE(e){return e===null?{enter:true,rejection:null}:{enter:false,rejection:e.reason}}function KE(e,t){return t!=="viewing"&&e.restrictedToReadOnly?{ok:false,code:"locked",reason:Qi}:t==="suggesting"&&e.restrictedToComments?{ok:false,code:"locked",reason:Ji}:t==="suggesting"&&e.restrictedToForms?{ok:false,code:"locked",reason:df}:t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:ny}}function UE(e,t,n,r){return e&&r!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(r==="suggesting"?$E(t()):null)??KE(n(),r)}function jE(e,t,n,r,o,i=false){let a=ry(e,t),s=e==="view"?"viewing":a.mode??o,l=oy({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:s,engineAdoptedViewing:i});l.mode!==null&&(s=l.mode);let c=KE(n,s),d=n.restrictedToReadOnly?"viewing":r;return {mode:c===null?s:d,rejection:l.rejection??c?.reason??null,configurationRejection:a.rejection}}function VE(e,t,n,r){return (ym(e,t,n)?.offset??n)+r}function ec(e){if(e&&!(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")&&!e.bound&&!(e.controlType==="checkbox"||e.controlType==="picture"))return e.id}function GE(e,t,n){return {op:"insertText",paragraphId:e.paragraphId,offset:e.offset,text:t,...n===void 0?{}:{inside:n}}}var zE=new WeakMap;function ZE(e,t){zE.set(e,t);}var iy=new WeakMap;function XE(e,t){let n=Qk(t);n&&iy.set(e,n);}function ay(e){return iy.get(e)}var sy="this document is protected for tracked changes; their authors cannot change",ea="this document is protected; only form fields can be filled";function Un(e,t){if(e.type==="undo"||e.type==="redo"||e.type==="toggleDocumentProtection")return null;let n=Bf$1(t.session.currentPackage()),r=jj$1(n?.root);if(!r.enforced)return null;if(r.edit==="readOnly"||r.edit==="comments")return {ok:false,code:"locked",reason:r.edit==="comments"?Ji:Qi};if(r.edit==="trackedChanges"&&e.type==="setReviewChangesAuthor")return {ok:false,code:"locked",reason:sy};if(r.edit!=="forms"||Yo(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 "setWatermark":case "convertAllNotes":case "insertToc":case "refreshToc":case "removeToc":case "replaceAllMatches":case "resolveAllReviewChanges":case "setReviewChangesAuthor":case "acceptRevision":case "rejectRevision":case "acceptAllRevisions":case "rejectAllRevisions":o="document";break}let s=t.state().selection,l=de(t.session,s.head.paragraphId);if(!l)return {ok:false,code:"locked",reason:ea};let c=s.anchor.paragraphId===s.head.paragraphId&&s.anchor.offset===s.head.offset,d=o==="text"&&i!==void 0&&!Uu(i).includes(`
|
|
24
|
+
`)&&c?ec(t.contentControls.atCaret()):void 0,u=t.state().cellSelection;return (u&&(o==="runFormat"||o==="paragraph")?[...ma$1(t.layout(),u.cellIds)].map(g=>({anchor:{paragraphId:g,offset:0},head:{paragraphId:g,offset:(Jm(l,g)??"").length}})):[s]).some(g=>_k(l,n,{selection:g,intent:o,text:i,paste:a,fieldId:zE.get(t)?.()??void 0,...d===void 0?{}:{inside:d},contentLockPolicy:iy.get(t)}))?{ok:false,code:"locked",reason:ea}:null}function YE(e,t){if(e!=="locked")return e;let n=jj$1(t);return n.enforced?n.edit==="comments"?Ji:n.edit==="forms"?ea:Qi:"this content is locked"}function QE(e){return e!==null&&Un({type:"resolveAllReviewChanges"},e)!==null}function JE(e,t){return ()=>e()??(t()?null:"the document is read-only")}var ly="this content is locked",V4=new Set(["toggleMark","setMarkAttr","clearFormatting"]),ff=Number.MAX_SAFE_INTEGER;function G4(e){let t=e.state(),n=t.cellSelection;if(n)return [...ma$1(e.layout(),n.cellIds)].map(b=>({paragraphId:b,start:0,end:ff}));let{anchor:r,head:o}=t.selection;if(r.paragraphId===o.paragraphId)return r.offset===o.offset?[{paragraphId:o.paragraphId,start:o.offset,end:o.offset}]:[{paragraphId:r.paragraphId,start:Math.min(r.offset,o.offset),end:Math.max(r.offset,o.offset)}];let i=Et(e.session,r.paragraphId,{kind:"body"}),a=e.session.paragraphIdsIn(i),s=a.indexOf(r.paragraphId),l=a.indexOf(o.paragraphId);if(s===-1||l===-1)return [{paragraphId:r.paragraphId,start:0,end:ff},{paragraphId:o.paragraphId,start:0,end:ff}];let[c,d]=s<l?[r,o]:[o,r],[u,f]=s<l?[s,l]:[l,s],p=a.slice(u,f+1).map((b,y,h)=>({paragraphId:b,start:y===0?c.offset:0,end:y===h.length-1?d.offset:ff})),g=p[p.length-1];return g&&g.end===0?p.slice(0,-1):p}function z4(e){return sc$1(e.root).some(t=>wc$1(qc$1(t.node).lock))}function eC(e,t,n){if(!V4.has(e.type))return null;let r=e.type==="clearFormatting",o=t.editingMode()==="suggest"&&!!t.author()?.trim()&&!t.session.trackingSettings().doNotTrackFormatting,i=n?.allowFormattingInLockedContent===true&&!o,{selection:a,cellSelection:s}=t.state(),l=!s&&a.anchor.paragraphId===a.head.paragraphId&&a.anchor.offset===a.head.offset;if(i&&!r&&!l)return null;let c={ok:false,code:"locked",reason:ly};for(let d of G4(t)){let u=de(t.session,d.paragraphId)??t.session.part();if(!z4(u))continue;let f=eb$1(u,d.paragraphId);if(!f||f.kind!=="paragraph")continue;if(Kh$1(u,d.paragraphId).content)return c;if(i&&!l)continue;let p=sc$1(f);if(p.length===0)continue;let g=Ei(f),b=d.start===d.end;for(let y of p){let h=g.spanOf(y.node);if(!h||!(b?h.start<d.start&&d.start<h.end:h.end>d.start&&h.start<d.end))continue;let w=om(u,y.node.id).map(v=>qc$1(v).lock);if(wc$1(vc(w)))return c}}return null}var cy="this content is locked; only alignment, indents, spacing, and line and page breaks can change",Z4=new Set(["setAlignment","setParagraphDirection","setLineSpacing","setParagraphSpacing","setIndent","adjustIndent","toggleList","setParagraphStyle","setParagraphFormat"]),X4=["direction","contextualSpacing","tabStops"];function Y4(e){switch(e.type){case "setAlignment":return "alignment";case "setLineSpacing":case "setParagraphSpacing":case "setIndent":return "placement";case "adjustIndent":return "indentStep";case "setParagraphDirection":case "toggleList":case "setParagraphStyle":return "locked";case "setParagraphFormat":{if(X4.some(i=>e[i]!==void 0))return "locked";let{type:t,alignment:n,...r}=e;return n!==void 0&&Object.values(r).every(i=>i===void 0)?"alignment":"placement"}}}function Q4(e){let t=e.state(),n=t.cellSelection;if(n)return [...ma$1(e.layout(),n.cellIds)];let{anchor:r,head:o}=t.selection;if(r.paragraphId===o.paragraphId)return [o.paragraphId];let i=Et(e.session,r.paragraphId,{kind:"body"}),a=e.session.paragraphIdsIn(i),s=a.indexOf(r.paragraphId),l=a.indexOf(o.paragraphId);return s===-1||l===-1?[r.paragraphId,o.paragraphId]:a.slice(Math.min(s,l),Math.max(s,l)+1)}var tC=new WeakMap;function J4(e){let t=tC.get(e.root);if(t)return t;let n=new Set;for(let r of sc$1(e.root)){if(!wc$1(qc$1(r.node).lock))continue;let o=[r.node];for(;o.length>0;){let i=o.pop();if(i.kind!=="textValue"){i.kind==="paragraph"&&n.add(i.id);for(let a of i.children)o.push(a);}}}return tC.set(e.root,n),n}var nC=new WeakMap;function e3(e){let t=nC.get(e);if(t)return t;let n=new Set;for(let r of e.pages)for(let o of Xa(r))if(o.marker){n.add(o.paragraphId);for(let i of ab$1(o))n.add(i);}return nC.set(e,n),n}function t3(e,t){let n=eb$1(e,t);if(n?.kind!=="paragraph")return false;let r=ai$1(n,"paragraphProperties","pPr");return r!==void 0&&r.kind!=="textValue"&&r.children.some(o=>o.kind!=="textValue"&&o.localName==="pPrChange")}function n3(e,t,n){let r=ci$1(e,t),o=r.filter(i=>i.localName!==n);return o.length===r.length?[...r,{localName:n}]:o}function r3(e,t,n,r){let o=r!==void 0?{revision:{author:r}}:{};return n==="alignment"?{op:"setParagraphProperties",paragraphId:t,properties:[...ci$1(e,t).filter(i=>i.localName!=="jc"),{localName:"jc",attributes:{val:"center"}}],...o}:{op:"setParagraphProperties",paragraphId:t,properties:n3(e,t,n==="placement"?"ind":"contextualSpacing"),...n==="placement"?o:{}}}function rC(e,t,n){if(!Z4.has(e.type))return null;let r=Y4(e),o=t.author()?.trim(),i=t.editingMode()==="suggest"&&o&&!t.session.trackingSettings().doNotTrackFormatting?o:void 0,a=t.state().selection.head.paragraphId,s=de(t.session,a)??t.session.part(),l=J4(s);if(l.size===0)return null;let c=r==="indentStep"?e3(t.layout()):null;for(let d of Q4(t)){if(!l.has(d))continue;let u=r!=="indentStep"?r:c?.has(d)?"locked":"placement";if(u!=="locked"&&(i===void 0||!t3(s,d)))continue;if(xn$1(s,r3(s,d,u,i),{contentLockPolicy:n})==="locked")return {ok:false,code:"locked",reason:u==="locked"?cy:ly}}return null}function oC(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function iC(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function aC(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||mn(e)}function sC(e,t){for(let n of e.pages){let r=o3(n.fragments,t);if(r!==void 0)return r}return null}function o3(e,t){for(let n of e)if(n.kind==="paragraph")for(let r of n.lines)for(let o of r.drawings??[]){if(o.drawingNodeId!==t)continue;if(n.fragmentIndex!==0||n.positionedFrame||n.outOfFlow)return null;let i=Math.round(o.x*12700),a=Math.round((o.y-n.box.y)*12700);return !Number.isFinite(i)||!Number.isFinite(a)?null:Object.freeze({mode:"frame",horizontalEmu:i,verticalEmu:a,relativeToH:"margin",relativeToV:"paragraph"})}}function i3(e,t,n=e.extentEmu){let r=e.picture?.transform.rotationDegrees;return e.kind==="inline"==(t==="inline")||r===void 0||Math.abs(r%180)!==90||n.cx===n.cy?null:{cx:n.cy,cy:n.cx}}function lC(e,t,n,r,o=e.drawingNodeId){let i=i3(e,t);if(!i)return;let a=n.findIndex(l=>l.op==="resizeDrawing"),s=n[a];s?.op==="resizeDrawing"?n[a]={...s,extentEmu:{cx:r?.widthEmu!==void 0||r?.resetToNaturalSize?s.extentEmu.cx:i.cx,cy:r?.heightEmu!==void 0||r?.resetToNaturalSize?s.extentEmu.cy:i.cy}}:n.push({op:"resizeDrawing",drawingNodeId:o,extentEmu:i});}var cC=new WeakMap;function dC(e,t){cC.set(e,t);}function uC(e,t,n){cC.get(e)?.(t,n);}var a3="this drawing is a chart; only delete applies, and it removes the whole chart";function s3(e,t){let n=de(e.session,t)??e.session.part();return rn$1(n,t)!==null}function dy(e,t,n){let r=de(e.session,t)??e.session.part(),o=rn$1(r,t);return o?{chart:true,locks:sn(o.chartDrawing)??n.locks}:{chart:false,locks:n.locks}}function uy(e,t,n){return t.type==="deleteImage"||!s3(e,n)?null:{ok:false,code:"unsupported",reason:a3}}function fy(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 l3(e){return [e.left,e.top,e.right,e.bottom]}function py(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function c3(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function tc(e){return Math.round(e*1e3)}function nc(e){return e/1e3}function my(e){return Object.freeze({left:tc(e.left),top:tc(e.top),right:tc(e.right),bottom:tc(e.bottom)})}function d3(e){return Object.freeze({left:nc(e.left),top:nc(e.top),right:nc(e.right),bottom:nc(e.bottom)})}function gy(e){return l3(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var pf=12700;function At(e){return Math.round(e*12700)}function ta(e){return e/12700}function fC(e,t,n,r,o,i){let a=ta(e),s=ta(t),l=a/s,c=n.includes("e")?r:n.includes("w")?-r:0,d=n.includes("s")?o:n.includes("n")?-o:0;if(a=Math.max(1,a+c),s=Math.max(1,s+d),i)if(n.length===2){let f=Math.max(a/ta(e),s/ta(t));a=Math.max(1,ta(e)*f),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:At(a),cy:At(s)})}function mf(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+At(t),verticalEmu:(e.verticalEmu??0)+At(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+At(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+At(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}var u3=new Set(["insertImage","replaceImage"]),f3=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function hy(e,t,n){return e.accessibility.hidden||n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function p3(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&hy(o,n,r))return o;return null}function m3(e,t,n,r){let o=e.layout();for(let i of o.pages){for(let a of i.anchoredDrawings??[])if(a.anchorParagraphId===t&&hy(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&&hy(s,n,r))return s}}return null}function mC(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function jn(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=Xb$1(e.layout(),n.paragraphId,n.offset),i=t.kind==="pointer"?t.drawingNodeId:null;return p3(o,n.paragraphId,n.offset,i)??m3(e,n.paragraphId,n.offset,i)}function by(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=eb$1(r,t.drawingNodeId);return o?o.kind!=="drawing"?_in(r,t.drawingNodeId):We(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Qe$1,limits:Pe,resolveRelationship:Se$1(e.session.currentPackage(),t.ownerPartName)}):null}function gC(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 g3(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 hC(e,t){let n=t?{resize:true,move:true,changeAspect:true}:e.locks,r=e.kind==="inline"&&e.textboxStory!==null;return Object.freeze({canResize:!n.resize&&!e.hidden,canMove:!r&&!n.move&&!e.hidden,canChangeWrap:!t&&e.picture!==null&&!n.move&&!e.hidden,canCrop:e.picture!==null&&!n.resize&&!n.changeAspect&&!e.hidden})}function h3(e){return e.kind==="inlineDrawing"?"inline":e.wrap}var yC=e=>e.placeholderGraphicKind===null||!!e.textboxStory||e.placeholderGraphicKind==="chart"||!!e.chart;function Zr(e){let t=jn(e);if(!t||!yC(t))return null;let n=e?by(e,t):null;if(!n)return null;let{chart:r,locks:o}=dy(e,t.drawingNodeId,n);if(n.hidden||o.select)return null;let i=t.transform;return Object.freeze({id:t.drawingNodeId,kind:n.kind,widthEmu:n.extentEmu.cx,heightEmu:n.extentEmu.cy,crop:py(t.crop),rotationDegrees:i.rotationDegrees,wrap:h3(t),position:gC(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:o,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:g3(t),...hC(n,r)})}function vy(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function bC(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function xy(e){return vy(e)!==void 0||bC(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function wy(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=bC(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let i=vy(t),a=Zr(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 ls(e,n,{requireDrawing:i!==void 0||n.drawingNodeId!==null,drawingNodeId:i??n.drawingNodeId??void 0})}function Qo(e,t){let n=Zr(e),r=vy(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 y3(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 pC(e,t,n){if(n==="inline")return [];let r=sC(e.layout(),t);return r?[{op:"positionDrawing",drawingNodeId:t,position:r}]:[]}function yy(e,t,n,r){let o=jn(e),i=o&&by(e,o);i&&lC(i,t,n,r,o.drawingNodeId);}function gf(e,t){return y3(e.applyDrawingOps(t))}function b3(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 vC(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 rc(e){return f3.has(e.type)}function v3(e){return u3.has(e.type)}function xC(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function wC(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:uf}:null}function oc(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Zr(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function ls(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=Zr(r),s=n.drawingNodeId??t.drawingNodeId;if(!a||!s||a.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}var Sy="a picture is selected; place the caret in text to insert a picture";function cs(e,t){if(!rc(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=Un(e,t);if(n)return n;if(e.type==="insertImage")return jn(t)?{ok:false,code:"invalidArgs",reason:Sy}:!(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=jn(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 c=Qo(t,e);return "ok"in c?c:uy(t,e,c.id)}let i=Qo(t,e);if("ok"in i)return i;let a=uy(t,e,i.id);if(a)return a;let s=Zr(t);if(!s)return {ok:false,code:"notFound",reason:"no drawing is selected"};let l=e.type==="setImageWrapType"?e.target:e.type==="setImageProperties"?e.wrap:void 0;if(l!==void 0&&s.locks.resize){let c=[];if(yy(t,l,c),c.length)return {ok:false,code:"locked",reason:"the drawing size is locked"}}switch(e.type){case "deleteImage":return s.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return s.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return s.locks.changeAspect||s.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!s.canMove||s.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!iC(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let c=s.position?.mode??"frame";return on$1(e,c)?jn$1(vC(e,s))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(oC(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!aC(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!s.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&&!s.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!s.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!gy(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!s.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!U(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!s.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(mn(e)){if(!s.canMove||s.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let d=s.position?.mode??"frame";if(!on$1(e,d))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!jn$1(nn(e,s)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function ky(e,t){let n=wC(t,e.type);if(n)return n;let r=cs(e,t);return r||{ok:true}}function SC(e,t){let n=cs(e,t);return n||xC(e)}function Iy(e,t,n){if(v3(t))return xC(t);let r=n&&xy(t)?oc(n):null;if(r&&n){let o=wy(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=Qo(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=Qo(e,t);if("ok"in o)return o;let i=[];return yy(e,t.target,i),gf(e,[...i,{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target},...pC(e,o.id,t.target)])}case "transformImage":{let o=Qo(e,t);return "ok"in o?o:gf(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=Qo(e,t);if("ok"in o)return o;let i=Zr(e),a=vC(t,i);return gf(e,[{op:"positionDrawing",drawingNodeId:o.id,position:a}])}case "setImageProperties":{let o=Qo(e,t);if("ok"in o)return o;let i=Zr(e);if(!i)return {ok:false,code:"notFound",reason:"no drawing is selected"};let a=[];if(t.resetToNaturalSize){let c=b3(i);if(!c)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};a.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:c});}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:my(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&&(yy(e,t.wrap,a,t),a.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),a.push(...pC(e,o.id,t.wrap))),mn(t)){let c=nn(t,i);a.push({op:"positionDrawing",drawingNodeId:o.id,position:c});}if(t.hyperlink!==void 0){let c=e.applyImageProperties({drawingNodeId:o.id,ops:a,hyperlink:t.hyperlink});return c.ok?null:{ok:false,code:"invalidArgs",reason:c.detail??c.reason??"setImageProperties was refused"}}return a.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:gf(e,a)}default:return null}}function x3(e,t,n,r,o){let i=ee(e.sectionPropertiesAt(t)),a=i.width-i.margin.left-i.margin.right,s=Vd(i),l=i.height-s.top-s.bottom,c=Xb$1(e.layout(),t,n),d=c&&c.box.width>0?Math.min(c.box.width,a):a,u=Math.min(1,d/r,l/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function Ry(e,t){let n=await w3(e,t);return uC(e,t,n),n}async function w3(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=wC(n,t.type);if(r)return r;let o=cs(t,n);if(o)return o;let i=oc(e);if(!i)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:u}=n.state().selection,f=t.expectedPackageRevision??i.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let p=x3(n,u.paragraphId,u.offset,t.widthPoints,t.heightPoints),g=await n.insertImage({paragraphId:u.paragraphId,offset:u.offset,bytes:t.data,mime:t.mime,widthPoints:p.widthPoints,heightPoints:p.heightPoints,expectedPackageRevision:f,commitGuard:()=>ls(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=ls(e,i);return b||(g.ok?{ok:true,changed:g.change!==null}:{ok:false,code:"invalidArgs",reason:g.detail==="stale-package-epoch"?"stale package revision":g.detail??g.reason??"insertImage was refused"})}let a=Qo(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",c=await n.replaceImage(a.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>ls(e,i,{requireDrawing:true,drawingNodeId:a.id})===null}),d=ls(e,i,{requireDrawing:true,drawingNodeId:a.id});return d||(c.ok?{ok:true,changed:c.change!==null}:{ok:false,code:"invalidArgs",reason:c.detail==="stale-package-epoch"?"stale package revision":c.detail??c.reason??"replaceImage was refused"})}var S3=1,k3=10;function I3(e,t,n){if(!t||t.hidden||!yC(e))return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let r=hC(t,n);return Object.freeze({canResize:r.canResize,canMove:r.canMove,aspectLocked:n||t.locks.changeAspect})}function R3(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"?null:jn(e);if(t.kind!=="frame"&&!o)return null;let i=e.layout(),a=t.kind==="frame"?kT(i,t,e.currentPage("caret")-1):null,s=t.kind==="frame"?a?.record:o;if(!s||s.accessibility.hidden)return null;let l=a??Fe(i,s.drawingNodeId);if(!l)return null;let c=by(e,s),d=c?dy(e,s.drawingNodeId,c):null,u=d!==null&&!d.locks.select;if(!u&&t.kind!=="frame")return null;let f=u?I3(s,c,d.chart):{canResize:false,canMove:false,aspectLocked:true},g=e.editingMode()!=="view"&&e.session.editable?f:{...f,canResize:false,canMove:false},b=s.kind==="anchoredDrawing"?Object.freeze({x:s.horizontalFrameOrigin+l.x-s.paintBounds.x,y:s.verticalFrameOrigin+l.y-s.paintBounds.y}):null;return Object.freeze({id:s.drawingNodeId,textbox:"textboxStory"in s&&!!s.textboxStory,...IT(s,de(e.session,s.drawingNodeId)??e.session.part()),pageIndex:l.pageIndex,x:l.x,y:l.y,width:l.width,height:l.height,kind:s.kind==="inlineDrawing"?"inline":"anchored",widthEmu:c?.extentEmu.cx??At(l.width),heightEmu:c?.extentEmu.cy??At(l.height),position:c?gC(c):null,anchorFrameOrigin:b,transform:s.transform,...g})}function P3(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"}:ls(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}var Py="suggesting cannot move a table; stop suggesting to move it",Ty="suggesting cannot change a form field checkbox or dropdown; stop suggesting to change it",Ey="suggesting cannot delete a whole table; stop suggesting to delete it, or delete its rows one at a time";function T3(e){return t=>{let n=de(e,t);return n!==null&&eb$1(n,t)?.kind==="table"}}function Cy(e,t){return n=>{let r=t?.trim()?de(e,n):null;return r!==null&&Xm(r.root,n,t)}}function kC(e,t,n){return Oy(n,T3(e),Cy(e,t))}function Oy(e,t,n=()=>false){if(e.some(i=>i.op==="deleteNote"))return "suggesting cannot delete a note outright; strike its reference to propose the deletion";let r=i=>i.op==="removeContentControl"&&i.keepContent===false;if(e.some(r))return "suggesting cannot remove a content control outright";if(e.some(i=>i.op==="removeToc"))return "suggesting cannot remove a table of contents outright";let o=i=>(i.op==="mergeTableCells"||i.op==="splitTableCell")&&!n(i.tableId);return e.some(o)?eE:e.some(i=>i.op==="deleteBlock"&&t(i.blockId))?Ey:e.some(i=>i.op==="moveTable")?Py:e.some(i=>i.op==="setLegacyCheckbox"||i.op==="setLegacyDropdown")?Ty:null}function My(e,t){for(let n of [e.footnotes,e.endnotes]){let r=n?.notes.find(o=>Ka$1(o.fragments).some(i=>i.paragraphId===t));if(r)return r}}function ic(e,t){for(let n of [e.header,e.footer]){if(!n)continue;if(Ka$1(n.fragments).some(o=>o.paragraphId===t))return n.box}return My(e,t)?.box??e.contentBox}var E3={empty:"a bookmark needs a name",tooLong:"a bookmark name has at most 40 characters",invalidStart:"a bookmark name starts with a letter",invalidCharacter:"a bookmark name holds only letters, digits and underscores"};function Ay(e){let t=Wi$1(e);return t?E3[t]:e.startsWith("_")?"a bookmark name starts with a letter":null}var IC=new WeakMap;function C3(e){let t=IC.get(e);return t||(t=Zi$1(e),IC.set(e,t)),t}function O3(e,t){return e.kind==="body"?"body":e.kind==="notesPart"?e.noteKind:t.root.localName==="ftr"?"footer":"header"}function RC(e){return e.kind==="body"?"body":e.kind==="headerFooter"?"headerFooter":"note"}function EC(e){let t=e.options.showBookmarks===true,n=null;e.options.bookmarkMarks?.onChange(()=>{t&&n?.isConnected&&e.repaint();});let r=null,o=()=>{let c=e.session.storyParts();if(r?.parts.length===c.length&&r.parts.every((u,f)=>u===c[f]))return r.entries;let d=[];for(let u of c){let f=kh(e.session,u.name,{kind:"body"}),p=O3(f,u);for(let g of C3(u))d.push({record:g,scope:f,partName:u.name,place:p});}return r={parts:c,entries:d},d},i=c=>{let d=Yi$1(c);return o().find(u=>Yi$1(u.record.name)===d)??null},a=(c,d,u=[])=>{let f=false;return e.commit(()=>(f=e.session.applyTreeOps([c],void 0,void 0,d,{packageEdits:u}).committed,f)),f},s=c=>Ay(c)??e.writeRefusal(),l=()=>{let c=e.orderedRange().from,d=JSON.stringify(e.storyScope()),u,f=g=>(u??=new Map(e.session.paragraphIdsIn(e.storyScope()).map((b,y)=>[b,y]))).get(g)??-1,p=(g,b)=>g===c.paragraphId?[0,b-c.offset]:[f(g)-f(c.paragraphId),0];return (g,b)=>{if(JSON.stringify(b)!==d)return false;let[y,h]=p(g.start.paragraphId,g.start.offset),[x,w]=p(g.end.paragraphId,g.end.offset),v=y<0||y===0&&h<=0,k=x>0||x===0&&w>=0;return v&&k}};return {list(){let c=l(),d=new Map;for(let{record:p}of o()){let g=Yi$1(p.name);d.set(g,(d.get(g)??0)+p.copies);}let u=new Set,f=[];for(let{record:p,scope:g,place:b}of o()){let y=Yi$1(p.name);u.has(y)||(u.add(y),f.push(Object.freeze({name:p.name,hidden:p.hidden,story:RC(g),place:b,order:f.length,empty:p.start.paragraphId===p.end.paragraphId&&p.start.offset===p.end.offset,atSelection:c(p,g),duplicates:(d.get(y)??1)-1})));}return f},insertRefusal:s,insert(c){if(s(c))return false;let d=e.storyScope(),u=e.orderedRange(),f=Yi$1(c),p=new Set(o().filter(g=>Yi$1(g.record.name)===f&&JSON.stringify(g.scope)!==JSON.stringify(d)).map(g=>g.partName));return a({op:"insertBookmark",name:c,start:{paragraphId:u.from.paragraphId,offset:u.from.offset},end:{paragraphId:u.to.paragraphId,offset:u.to.offset}},d,[...p].map(g=>b=>Mk(b,g,c)))},remove(c){let d=i(c);if(!d||e.writeRefusal()!==null)return false;let u=Yi$1(c),f=new Set(o().filter(p=>Yi$1(p.record.name)===u&&p.partName!==d.partName).map(p=>p.partName));return a({op:"deleteBookmark",name:c},d.scope,[...f].map(p=>g=>Mk(g,p,c)))},keepFirst(c){let d=i(c);if(!d||e.writeRefusal()!==null)return false;let u=Yi$1(c),p=[...new Set(o().filter(b=>Yi$1(b.record.name)===u&&b.partName!==d.partName).map(b=>b.partName))].map(b=>y=>Mk(y,b,c));if(d.record.copies>1)return a({op:"deleteBookmark",name:c,keepFirst:true},d.scope,p);if(p.length===0)return false;let g=false;return e.commit(()=>(g=e.session.applyTreeOps([],void 0,void 0,d.scope,{packageEdits:p}).committed,g)),g},writeRefusal:()=>e.writeRefusal(),goTo(c){let d=i(c);if(!d)return false;let{start:u,end:f}=d.record,p=e.goToPosition(u,{orShow:true,center:true});return p?(p===true&&e.setSelection({anchor:u,head:f}),true):false},shown:()=>t,setShown(c){c!==t&&(e.beforeChange(),t=c,e.repaint());},paint(c){if(n=c.layer,!t){c.layer.replaceChildren();return}let d=e.options.bookmarkMarks?.current()??{};c.layer.classList.toggle("docx-bookmark-overlay--print",d.print===true);let u=d.include??"visible",f=[],p=new Set;for(let{record:g,scope:b,partName:y}of o()){let h=Yi$1(g.name);if(p.has(h))continue;p.add(h);let x={name:g.name,hidden:g.hidden,story:RC(b)};if(u==="visible"?g.hidden:u!=="all"&&!u(x))continue;let w=g.start.paragraphId===g.end.paragraphId&&g.start.offset===g.end.offset,v=b.kind==="headerFooter"?y:void 0;if(w){f.push({...x,edge:"point",...g.start,repeats:v});continue}f.push({...x,edge:"start",...g.start,repeats:v},{...x,edge:"end",...g.end,repeats:v});}A3(c,f,d.decorate,e.options.bookmarkMarks?.reportError);}}}var PC=new WeakMap,TC=new WeakSet;function M3(e){TC.has(e)||(TC.add(e),e.addEventListener("mousedown",t=>{let r=t.target?.localName;r==="input"||r==="select"||r==="textarea"||t.preventDefault();}));}function A3(e,t,n,r){let{layer:o,layout:i,scale:a}=e,s=o.ownerDocument;M3(o),o.style.setProperty("--docx-bookmark-scale",String(a));let l=[],c=e.pages?[...e.pages]:i.pages.map((f,p)=>p),d=PC.get(i);d||PC.set(i,d=new Map);let u=d;for(let f of t){let p={paragraphId:f.paragraphId,offset:f.offset},g=(h,x)=>{let w=`${f.paragraphId}:${h}:${x??""}`;if(u.has(w))return u.get(w);let v=Re(i,{paragraphId:f.paragraphId,offset:h},{...e.measurer?{measurer:e.measurer}:{},...x!==void 0?{preferredPageIndex:x}:{}});return u.set(w,v),v},b=f.repeats?c.map(h=>g(p.offset,h)):[g(p.offset)],y=new Set;for(let h of b){if(!h||!(h.height>0)||y.has(h.pageIndex)||e.pages&&!e.pages.has(h.pageIndex))continue;let x=i.pages[h.pageIndex];if(!x)continue;let w=e.pageOffsetX?.get(h.pageIndex)??0,v=f.repeats?[x.header,x.footer].find(O=>O?.partName===f.repeats):f.story==="note"?My(x,f.paragraphId):void 0;if((f.repeats||f.story==="note")&&!v)continue;let k=v?.box??x.contentBox;y.add(h.pageIndex);let E=s.createElement("div");E.className=`docx-bookmark-mark docx-bookmark-mark--${f.edge}`;let I=f.edge==="end"?p.offset-1:p.offset+1,P=I>=0?g(I,f.repeats?h.pageIndex:void 0):null;P?.lineId===h.lineId&&(f.edge==="end"?P.x>h.x:P.x<h.x)&&E.classList.add("docx-bookmark-mark--rtl");let C={name:f.name,hidden:f.hidden,story:f.story,edge:f.edge};try{E=n?.(E,C)??E;}catch(O){r?.(O);}E.dataset.bookmarkName=f.name,E.dataset.bookmarkHidden=String(f.hidden),E.dataset.bookmarkEdge=f.edge,E.dataset.bookmarkStory=f.story,E.dataset.docxMarker="",E.setAttribute("contenteditable","false"),E.style.position="absolute",E.style.left=`${(k.x+h.x+w)*a}px`,E.style.top=`${(k.y+h.y)*a}px`,E.style.height=`${h.height*a}px`,l.push(E);}}o.replaceChildren(...l);}function L3(e){return e.type==="insertBookmark"||e.type==="deleteBookmark"||e.type==="keepFirstBookmark"||e.type==="goToBookmark"}function F3(e,t){let n=Yi$1(t);return e.bookmarkEditing.list().some(r=>Yi$1(r.name)===n)}function Ly(e,t){if(!L3(t))return null;if(t.type==="insertBookmark"){let n=Ay(t.name);if(n)return {ok:false,code:"invalidArgs",reason:n};let r=e.bookmarkEditing.insertRefusal(t.name);return r?{ok:false,code:"locked",reason:r}:null}if(!F3(e,t.name))return {ok:false,code:"notFound",reason:"the document has no bookmark with that name"};if(t.type==="keepFirstBookmark"){let n=Yi$1(t.name);if(!e.bookmarkEditing.list().find(o=>Yi$1(o.name)===n)?.duplicates)return {ok:false,code:"unsupported",reason:"the bookmark has no copies"}}if(t.type!=="goToBookmark"){let n=e.bookmarkEditing.writeRefusal();if(n)return {ok:false,code:"locked",reason:n}}return null}function Fy(e,t,n,r="bookmark dialog"){return t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.canOpen()?(n&&e.open(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:`no ${r} is registered`}}function CC(e,t){let n=Ly(e,t);return n||(t.type==="goToBookmark"?e.bookmarkEditing.goTo(t.name)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the bookmark cannot be shown"}:(t.type==="insertBookmark"?e.bookmarkEditing.insert(t.name):t.type==="keepFirstBookmark"?e.bookmarkEditing.keepFirst(t.name):e.bookmarkEditing.remove(t.name))?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:e.state().lastRejection??`${t.type} was refused`})}function OC(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 Dy=new WeakMap;function MC(e,t){let n=e.isScheduled(),r=Ny(t);return r?Dy.set(e,r):n||Dy.delete(e),r??(n?Dy.get(e)??null:null)}function Ny(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 hf(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let c=e.session.paraIdOf(t.paragraphId);return c===null?null:{from:{paraId:c},to:{paraId:c}}}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 AC(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 LC(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$2(n).map(o=>{let i=r.paraIdByNode.get(o.id),a=o.kind==="textValue"?void 0:i$3(o);return {...i!==void 0?{paraId:i}:{},text:Jm(n,o.id)??"",...a!==void 0?{styleId:a}:{}}})}function ds(e){return e?e.state().pageCount:0}function Hy(e,t="caret"){return e?e.currentPage(t):1}function D3(e,t){if(!Yo(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=yf(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 FC(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",...nf(t)}}function yf(e,t){let n=FC(e,t),r=Tr(n),o=Bf$1(t.session.currentPackage());if(r.ok&&r.ops.some(i=>sm(n.part,o,i))&&(r={ok:false,code:"locked",reason:ea}),r.ok&&t.editingMode()==="suggest"){let i=Oy(r.ops,a=>eb$1(n.part,a)?.kind==="table",Cy(t.session,t.author()));i&&(r={ok:false,code:"unsupported",reason:i});}return r.ok?{can:{ok:true},plan:r}:{can:{ok:false,code:r.code,reason:r.reason},plan:r}}function ac(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 d=t?.activeScope?.()??{kind:"body"};if(d.kind!=="headerFooter"||d.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=Yi(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?Un(e,t):null;if(i)return {ok:false,refusal:i};let a=eC(e,t,ay(t));if(a)return {ok:false,refusal:a};let s=rC(e,t,ay(t));if(s)return {ok:false,refusal:s};if(e.type==="insertTextBox"){let d=Mh(t);return d?{ok:false,refusal:d}:{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"&&jn(t)){let d=cs({type:"deleteImage"},t);return d&&!d.ok?{ok:false,refusal:d}:{ok:true}}if(e.type==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:d,head:u}=t.state().selection;if(d.paragraphId===u.paragraphId&&d.offset===u.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(d=>d.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:UT}};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"}};let l=Ly(t,e);if(l)return {ok:false,refusal:l};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==="removeToc"){let d=t.removeTocRefusal(e.tocId);if(d)return {ok:false,refusal:{ok:false,...d}}}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 u=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(u)return {ok:false,refusal:{ok:false,code:"unsupported",reason:u}}}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 d=t.headerFooterState?.();if((e.sectionIndex??d?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(Yo(e)){let d=D3(e,t);return d.ok?{ok:true,tablePlan:d.tablePlan}:d}let c=cs(e,t);return c&&!c.ok?{ok:false,refusal:c}:{ok:true}}function DC(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!eb$1(n,t))return true;let r=fb$2(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=fb$2(n,r.id);}return false}function NC(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!DC(e,t.selection.head.paragraphId))return null;let r=qa(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 bf(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!DC(e,t.selection.head.paragraphId))return null;let r=qa(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 HC(e){if(!e)return null;let t=FC({type:"splitCell",rows:1,cols:2},e),n=ra$1(t.layout,t.selection.head.paragraphId,t.cellSelection);if(!n||n.cellIds.length>1)return null;let r=bn(t.part,n.tableId,n.cellId);return r?{...r}:null}function _C(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 BC(e){return !!e&&ir(e.session.part(),e.state().selection.head)!==void 0}var ue={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"],bookmark:["M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z"],bookmarks:["M120-40v-640q0-33 23.5-56.5T200-760h400q33 0 56.5 23.5T680-680v640L400-160 120-40Zm80-122 200-86 200 86v-518H200v518Zm560 2v-680H240v-80h520q33 0 56.5 23.5T840-840v680h-80ZM200-680h400-400Z"],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"],difference:["M500-520h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80Zm-80 160h240v-80H420v80ZM320-200q-33 0-56.5-23.5T240-280v-560q0-33 23.5-56.5T320-920h280l240 240v400q0 33-23.5 56.5T760-200H320Zm0-80h440v-360L560-840H320v560ZM160-40q-33 0-56.5-23.5T80-120v-560h80v560h440v80H160Zm160-240v-560 560Z"],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 us={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},WC=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function _y(e){return createT(en)(e)}function sc(e){return WC.includes(e)}function _3(e){return e!=null}var qC=[{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"}],KC=[{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"}],B3=[{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 $3(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function W3(e){return e==="none"||$3(e)}function $C(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function q3(e){return KC.some(t=>t.value===e)}function na(e,t,n){switch(t){case "table.borderTarget":return W3(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(!$C(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(!q3(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&&!$C(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function By(e,t=us){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return na(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return na(t,e,"single")?.command??null;case "table.borderWidth":return na(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function K3(e){return qC.find(n=>n.value===e)?.labelKey??"table.borders.all"}function $y(e){return ue[e]}var U3=new RegExp("^[\\p{L}\\p{M}\\p{N}'\\u2019\\u001F\\u00AD\\u200C\\u200D]$","u"),j3=/[\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;function Wy(e,t){let n=e.charCodeAt(t);if(Number.isNaN(n))return false;let r=n>=56320&&n<=57343&&t>0?t-1:t,o=e.codePointAt(r);return o!==void 0&&U3.test(String.fromCodePoint(o))}function vf(e,t,n,r,o){let i=[],a=0;for(let s of ri$1(e,t,0,n,r,o))s.start>a&&i.push({start:a,end:s.start}),a=Math.max(a,s.end);return a<n&&i.push({start:a,end:n}),i}function qy(e,t,n){let r=Ue(e,t).split("");for(let{line:i}of Wb$1(e,t)??[]){let a=_a(i,t);if(a)for(let s of a.spans){if(!(s.fieldAtom||s.noteNav||s.equation||s.unsupported))continue;let l=Math.min(s.range.end,r.length);for(let c=s.range.start;c<l;c+=1)r[c]=V3;}}let o=r.join("");for(let{start:i,end:a}of n){let s=Math.min(a,r.length);if(!(i<=0||s>=r.length||i>=s)&&!(!Wy(o,i-1)||!Wy(o,s)))for(let l=i;l<s;l+=1)r[l]="a";}return r.join("")}var V3="\uFFFC";function Ky(e,t,n){let r=s=>Wy(e,s);if(t<=0||t>=e.length||n.has(t)||!r(t-1)||!r(t))return null;let o=t-1;for(;o>0&&r(o-1)&&!n.has(o);)o-=1;let i=t+1;for(;i<e.length&&r(i)&&!n.has(i);)i+=1;let a=z3(e,o,i,t);return a===void 0?{start:o,end:i}:a}function Uy(e,t,n,r){return G3(e,t,n)?null:Ky(qy(e,t,r),n,Le(e,t))}function xf(e,t){let{anchor:n,head:r}=t;if(n.paragraphId!==r.paragraphId||n.offset!==r.offset)return null;let o=Uy(e,r.paragraphId,r.offset,[]);return o?{from:{paragraphId:r.paragraphId,offset:o.start},to:{paragraphId:r.paragraphId,offset:o.end}}:null}function G3(e,t,n){for(let{line:r}of Wb$1(e,t)??[]){let o=_a(r,t);if(o)for(let i of o.spans){let{start:a,end:s}=i.range;if(!(a===s||a>n||s<n)&&i.revisions?.some(l=>l.kind==="delete"||l.kind==="moveFrom"))return true}}return false}function z3(e,t,n,r){let o=e.slice(t,n);if(j3.test(o)){for(let i of G$2(o)){let a=t+i.utf16From,s=t+i.utf16To;if(r===a)return null;if(r>a&&r<s)return {start:a,end:s}}return null}}function lc(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 fs(e){let t=lc({}),n=false,r=false,o=()=>t.current().onRequest!==void 0,i=()=>{o()!==n&&(n=o(),e?.());};return {canOpen:o,open(){let a=t.current().onRequest;return a?.(),a!==void 0},shortcutOn:()=>t.current().shortcut!==false,openFromShortcut(){if(t.current().shortcut===false)return false;let a=t.current().onRequest;return a?.(),a!==void 0},current:()=>t.current(),register(a){let s=t.push(a);return i(),()=>{s(),!r&&(r=true,globalThis.queueMicrotask(()=>{r=false,i();}));}}}}function UC(e={}){let t=fs(e.changed),n=fs(e.changed),r=lc({}),o=null,i={current:r.current,onChange:a=>{o=a;},reportError:a=>e.error?.(a)};return {surfaceOptions:{onRequestBookmark:t.open,onRequestGoTo:n.openFromShortcut,bookmarkMarks:i},bookmarkDialog:t,goTo:n,setters:{setBookmarkChrome:a=>t.register(a),setGoToChrome:a=>n.register(a),setBookmarkMarks(a){let s=r.push(a);return o?.(),()=>{s(),o?.();}}}}}var Z3=256,jC=new WeakMap;function X3(e){let t=bk(e),n=jC.get(t);return n||(n=new Map(t.map(r=>[r.root.id,r])),jC.set(t,n)),n}function GC(e,t){let n=X3(e);if(n.size===0||!eb$1(e,t))return null;let r=fb$2(e,t);for(let o=0;r&&o<Z3;o+=1){let i=r.id,a=n.get(i);if(a)return {kind:"frame",id:a.root.id,drawingNodeId:a.drawingNodeId,hostParagraphId:a.hostParagraphId};r=fb$2(e,i);}return null}var VC=new WeakMap;function wf(e,t){let n=e&&de(e.session,t);if(!n)return null;let r=VC.get(n.root);r||VC.set(n.root,r=new Map);let o=r.get(t);if(o!==void 0)return o;let i=GC(n,t)?.hostParagraphId??null;return r.set(t,i),i}function jy(e,t,n){let r=de(e.session,t.paragraphId),o=r&&GC(r,t.paragraphId);o&&e.setActiveScope(n?{...o,owner:{kind:"headerFooter",rId:n}}:o)&&e.setSelection({anchor:t,head:t});}function zC(e){let t=new Map,n=e.activeScope();if(n.kind!=="frame")return t;let r=de(e.session,n.id),o=r&&eb$1(r,n.id);if(!o)return t;let i=[o];for(;i.length>0;){let a=i.pop();a.kind==="paragraph"&&t.set(a.id,t.size);let s="children"in a?a.children:void 0;if(s)for(let l=s.length-1;l>=0;l-=1)i.push(s[l]);}return t}function ZC(e,t){e.exitNote?.(),e.exitHeaderFooter?.(),jy(e,t);}var Sf="no comment draft view is registered",XC=new WeakMap;function YC(e={}){let t=fs(e.changed);return {requests:{canOpen:t.canOpen,open:t.open},setters:{setCommentDraftChrome:r=>t.register(r)}}}function QC(e,t){XC.set(e,t);}function Vy(e){return XC.get(e)??null}function Gy(e){let t=e.surface;if(!t||t.activatedReviewKey()!==null)return null;let n=t.state().selection;return xf(t.publishedLayout(),n)??Y3(t,n)}function Y3(e,{anchor:t,head:n}){if(t.paragraphId!==n.paragraphId||t.offset!==n.offset||wf(e,n.paragraphId)===null)return null;let r=de(e.session,n.paragraphId),o=r&&Jm(r,n.paragraphId),i=o?Ky(o,n.offset,new Set):null;return i?{from:{paragraphId:n.paragraphId,offset:i.start},to:{paragraphId:n.paragraphId,offset:i.end}}:null}var kf="no link view is registered",zy={type:"insertHyperlink",href:"https://example.com"},JC=new WeakMap;function eO(e){let t=fs(e);return {requests:{canOpen:t.canOpen,open:t.open},current:t.current,open:t.open,register:r=>t.register(r)}}function tO(e,t){JC.set(e,t);}function Zy(e){return JC.get(e)??null}function Xy(e){let t=r=>({id:"text.link",enabled:false,disabledReason:r,active:false}),n=e.can(zy);return n.ok?Zy(e)?.canOpen()?{id:"text.link",enabled:true,disabledReason:null,active:false}:t(kf):t(n.reason)}function To(e){return e.surface??null}var Q3={"review.revisionMarkup":{type:"openRevisionMarkupDialog"},"review.compareDocuments":{type:"openCompareDocumentsDialog"},"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.bookmarks":{type:"toggleBookmarks"},"insert.bookmark":{type:"openBookmarkDialog"},"insert.goToBookmark":{type:"openGoTo"},"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"},"table.mergeCells":{type:"mergeCells"}};function J3(e){return oO[e]??null}var nO=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),rO={"file.pageSetup":"page setup is not a command; render DocxEditor.PageSetupDialog with open and onClose","paragraph.dialog":"the paragraph dialog is not a command; render DocxEditor.ParagraphDialog with open and onClose"},oO={"text.link":zy,"image.insert":{type:"insertImage",data:nO,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"},"insert.watermark":{type:"setWatermark",watermark:{text:"DRAFT"}},"table.splitCell":{type:"splitCell",rows:1,cols:2}};function Rf(e){return Q3[e]??null}var e$={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},iO={"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 aO(e,t,n){return na(n,e,t)?.command??null}function If(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(sc(e))return aO(e,t,us);if(e==="image.wrap")return typeof t!="string"||!Oe.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=e$[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function sO(e,t,n=us){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=By(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 t$=["editing","suggesting","viewing"];function lO(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"):Vy(e)?.canOpen()?e.getSelectionPlacement()===null&&!Gy(e)?n("a comment needs a selected range"):{id:t,enabled:true,disabledReason:null,active:false}:n(Sf):n(r.reason)}function cO(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(sc(t))return sO(e,t);if(t==="review.editingMode"){let i=e.getEditingMode?.()??"editing",a=t$.filter(c=>c!==i).map(c=>e.can(If(t,c))),s=a.some(c=>c.ok),l=a.find(c=>!c.ok);return {id:t,enabled:s,disabledReason:!s&&l&&!l.ok?l.reason:null,active:false,value:i}}if(t==="format.painter"){let i=To(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=To(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=To(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 lO(e);if(t==="text.link")return Xy(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=Rf(t);if(!n){let i=iO[t];if(i!==void 0){let s=If(t,i);if(!s)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let l=e.can(s),c=e.getSelectedImage?.()??null,d=t==="image.wrap"?c?.wrap:t==="image.altText"?c?.description:KT(e,t);return l.ok?{id:t,enabled:true,disabledReason:null,active:false,...d!==void 0?{value:d}:{}}:{id:t,enabled:false,disabledReason:l.reason,active:false,...d!==void 0?{value:d}:{}}}let a=oO[t];if(a){if(t==="image.insert"&&a.type==="insertImage"){let c=e.canExecuteImageCommand?.({type:"insertImage",data:nO,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(a);return c.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:c.reason,active:false}}if(t==="image.properties"&&a.type==="setImageProperties"){let c=e.can(a);return c.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:c.reason,active:false}}if(t==="table.insert"&&a.type==="insertTable"){let c=e.can(a);return c.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:c.reason,active:false}}if(t==="table.splitCell"&&a.type==="splitCell"){let c=e.can(a),d=c.ok?null:e.query({type:"splitCellConfig"});for(let u of d?[2,d.maxRows]:[]){if(c.ok||u<2)break;let f=e.can({type:"splitCell",rows:u,cols:1});f.ok&&(c=f);}return c.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:c.reason,active:false}}if(t==="paragraph.dialog"&&a.type==="setParagraphFormat"){let c=e.can(a);return c.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:c.reason,active:false}}let s=e.can(a);if(!s.ok)return {id:t,enabled:false,disabledReason:s.reason,active:false};let l=rO[t];if(l)return {id:t,enabled:false,disabledReason:l,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 n$(e){if(e==="format.painter")return true;let t=Rf(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="toggleBookmarks"||t?.type==="toggleDocumentProtection"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"||t?.type==="setParagraphDirection"}function r$(e,t){return t.map(n=>cO(e,n))}function o$(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=na(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 i$=new Set(["format.painter","contentControl.showAll","contentControl.formFill","contentControl.inspector","contentControl.remove","review.addComment"]);function a$(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||iO[t]!==void 0||sc(t))return {ok:false,code:"invalidArgs",reason:"pass a toolbar value before command options"};r=n,n=void 0;}if(r?.historyGroup!==void 0&&i$.has(t))return {ok:false,code:"unsupported",reason:`${t} does not take a history group`};if(t==="format.painter"){let a=To(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:Ju}}if(t==="text.link"){let a=Xy(e);return a.enabled?Zy(e)?.open()?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:kf}:{ok:false,code:"unsupported",reason:a.disabledReason??kf}}if(t==="review.addComment"){let a=lO(e);if(!a.enabled)return {ok:false,code:"unsupported",reason:a.disabledReason??Sf};let s=e.getSelectionPlacement()===null?Gy(e):null,l=s?To(e):null,c=l?.state().selection;return s&&l?.setSelection({anchor:s.from,head:s.to}),Vy(e)?.open()?{ok:true,changed:false}:(c&&l?.setSelection(c),{ok:false,code:"unsupported",reason:Sf})}if(t==="contentControl.showAll"){let a=To(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=To(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=To(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=To(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?Rf(t):If(t,n);if(!o){if(n!==void 0)return {ok:false,code:"unsupported",reason:"invalid value for toolbar command"};if(t==="file.exportMarkdown"||t==="file.exportPdf")return {ok:false,code:"unsupported",reason:"export is not a command; run it with runChromeExport(editor, format, handlers)"};if(t==="file.print")return {ok:false,code:"unsupported",reason:"print is not a command; run it with runChromePrint(editor, handlers)"};if(t==="file.save")return {ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"};if(t==="file.open")return {ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"};let a=rO[t];return a?{ok:false,code:"unsupported",reason:a}:{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 s$(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function l$(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=yf(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function c$(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 Yy(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Yy):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Yy(e[t])]))}function d$(e){return JSON.stringify(Yy(e))}var Qy=["zoom","script","format","list","alignment","styles","font","text","history"],u$=new Set(["review"]),Jy=24;function dO(e,t=Qy){let n=t.indexOf(e);return n===-1?void 0:(n+1)*10}function f$(e,t=Qy,n){let r=[],o=[];return e.forEach((i,a)=>{let s=n?.get(i)??dO(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 p$(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 eb=8;function m$(e){let t=e.margin??eb,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 g$(e){let t=e.margin??eb,n=e.viewportWidth-t-e.popupWidth;return Math.max(t,Math.min(e.anchorLeft,n))}var Tf="data-toolbar-item",tb="host-content",fO=new Map;function pO(e,t){return `${e}\0${t}`}function h$(e){return e.map(t=>[t.id,...t.items].join("")).join("\0")}function y$(e,t){return t?[...e,tb]:[...e]}function b$(e,t){return e?t.includes(tb):t.length>0}function mO(e,t,n){return Math.max(0,n-(e.get(t)??0))}function gO(e,t,n){return e.itemWidths.get(pO(t,n))??0}function cc(e,t,n){if(n<=0)return 0;let r=0,o=0;for(let a=0;a<n&&a<t.items.length;a+=1){let s=gO(e,t.id,t.items[a]);s>0&&(r+=s,o+=1);}let i=e.groupGaps?.get(t.id)??e.gap;return (e.groupBases.get(t.id)??0)+r+Math.max(0,o-1)*i}function uO(e,t){let n=e.fixed;for(let i of e.groups)n+=cc(e,i,i.items.length);if(n<=t)return fO;n+=e.more;let r=new Map(e.groups.map(i=>[i.id,i])),o=new Map;for(let i of e.order){if(n<=t)break;let a=r.get(i);if(!a||o.has(i))continue;let s=a.items.length;for(let l=s-1;l>=0;l-=1){let c=cc(e,a,l+1)-cc(e,a,l);if(!(c<=0)){if(n-=c,o.set(i,s-l),l>0&&!v$(e,a,l)){n-=cc(e,a,l),o.set(i,s);break}if(n<=t)break}}}return o}function v$(e,t,n){for(let r=0;r<n&&r<t.items.length;r+=1)if(gO(e,t.id,t.items[r])>0)return true;return false}function x$(e,t){let n=e.fixed;for(let r of e.groups)n+=cc(e,r,mO(t,r.id,r.items.length));return t.size>0?n+e.more:n}function Pf(e){let t=0;for(let n of e.values())t+=n;return t}function hO(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let[n,r]of e)if(t.get(n)!==r)return false;return true}function w$(e,t){let n=new Map(t.map(r=>[r.id,r.items.length]));for(let[r,o]of e){let i=n.get(r);if(i===void 0||o>i)return null}return e}function S$(e){if(!(e.available>0))return fO;let t=uO(e,e.available),n=e.previous?w$(e.previous,e.groups):null;if(!n||n.size===0||Pf(t)>=Pf(n))return t;let r=uO(e,e.available-(e.hysteresis??Jy));return hO(r,n)?n:Pf(r)>Pf(n)?x$(e,n)<=e.available?n:t:r}function yO(e,t,n,r){return e+t+n+r*2}function nb(e,t){return e+t}function bO(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 Er(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function vO(e){return Er(e.columnGap)}function xO(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 wO(e){return e.position==="absolute"||e.position==="fixed"||e.display==="none"}function SO(e){let t=e.computedStyleMap;if(typeof t!="function")return null;try{return t.call(e)}catch{return null}}function rb(e,t){let n=e?.get(t);return n&&typeof n.value=="string"?n.value:null}var k$=new Set(["auto","max-content","fit-content","min-content"]);function kO(e){return e.display.includes("flex")&&!e.flexDirection.startsWith("column")&&!e.flexWrap.startsWith("wrap")}function Cf(e,t,n){return rb(e,`margin-${n}`)==="auto"?0:Er(n==="left"?t.marginLeft:t.marginRight)}function I$(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 R$(e,t,n){let r=t.flexBasis.trim(),o=r.endsWith("px")?Er(r):0,i=rb(n,"min-width")??t.minWidth.trim();return i==="auto"||i===""?I$(e)?null:o:/^[\d.]+px$/.test(i)?Math.max(o,Er(i)):null}function IO(e,t,n){for(let r of e.childNodes){if(r.nodeType===3&&(r.textContent??"").trim().length>0)return false;if(!qt(r))continue;let o=Ae(r).getComputedStyle(r);if(o.display==="contents"){if(!IO(r,t,n))return false;continue}if(wO(o)||(n.items+=1,r===t))continue;let i=SO(r),s=Number.parseFloat(o.flexGrow)>0?R$(r,o,i):r.getBoundingClientRect().width;if(s===null)return false;n.width+=s+Cf(i,o,"left")+Cf(i,o,"right");}return true}function P$(e,t){if(!kO(t)||!e.parentElement)return 0;let n={width:0,items:0};return IO(e.parentElement,e,n)?n.width+Math.max(0,n.items-1)*Er(t.columnGap):null}function T$(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 E$="[data-toolbar-group], [data-toolbar-fixed], [data-toolbar-more]";function ob(e,t){let n=e.getBoundingClientRect();if(!(n.width>0))return null;let r=n.left+e.clientLeft+Er(t.paddingLeft),o=n.left+e.clientLeft+e.clientWidth-Er(t.paddingRight);for(let i of e.querySelectorAll(E$)){let a=i.getBoundingClientRect();if(a.width!==0&&(a.right>o+1||a.left<r-1))return true}return false}var dc=new WeakMap,Ef=new WeakMap;function C$(e,t,n,r){let o=e.parentElement;if(!o||wO(t)||(t.cssFloat||t.getPropertyValue("float")||"none")!=="none")return null;let i=SO(e),a=rb(i,"width");if(a===null||!k$.has(a))return null;let s=Ae(o).getComputedStyle(o),l=kO(s),c=s.display.includes("flex")&&s.flexDirection.startsWith("column"),d=(s.display==="block"||s.display==="flow-root"||c)&&!t.display.startsWith("inline");if(!l&&!d||l&&Number.parseFloat(t.flexGrow)>0)return null;let u=o.clientWidth-Er(s.paddingLeft)-Er(s.paddingRight),f=Math.max(0,e.offsetWidth-e.clientWidth)+r,p=P$(e,s),g=T$(t,u,f);return p===null||g===void 0?null:{room:xO({own:n,parentContent:u,siblings:p,margins:Cf(i,t,"left")+Cf(i,t,"right"),chrome:f,maxWidth:g}),parentContent:u}}function RO(e,t){let n=Er(t.paddingLeft)+Er(t.paddingRight),r=e.clientWidth-n,o=C$(e,t,r,n);if(!o)return dc.delete(e),Ef.delete(e),r;let i=dc.get(e);if(i&&i.parentContent!==o.parentContent&&dc.delete(e),ob(e,t)===true)return Ef.get(e)&&dc.set(e,{parentContent:o.parentContent,cap:r}),Ef.set(e,false),r;let a=dc.get(e)?.cap??Number.POSITIVE_INFINITY,s=Math.max(r,Math.min(o.room,a));return Ef.set(e,s>r),s}function O$(e){let t=e.getBoundingClientRect().width;return t>0&&e.offsetWidth>0?e.offsetWidth/t:1}function uc(e,t){let n=e.getBoundingClientRect().width;if(n>0)return n*t;let r=e.offsetWidth;return typeof r=="number"&&r>0?r:0}function M$(e){if(e.children.length>0)return true;for(let t of e.childNodes)if(t.nodeType===3&&(t.textContent??"").length>0)return true;return false}function A$(e,t,n){let r=e.getComputedStyle(t).columnGap.trim();return r==="normal"?0:/^-?[\d.]+px$/.test(r)?Number.parseFloat(r):n}function L$(e,t,n){let r=Ae(e),o=r.getComputedStyle(e),i=vO(o),a=RO(e,o),s=O$(e),l=e.querySelector(".docx-toolbar__separator"),c=i*2;if(l){let f=bO(r.getComputedStyle(l));c=yO(uc(l,s),f.start,f.end,i);}for(let f of e.querySelectorAll("[data-toolbar-group]")){let p=f.getAttribute("data-toolbar-group"),g=uc(f,s);if(!p||!(g>0))continue;let b=[];for(let v of f.children)v.hasAttribute(Tf)&&b.push(v);if(b.length===0){t.itemWidths.set(n(p,p),g),t.groupBases.set(p,c);continue}let y=A$(r,f,i);t.groupGaps.set(p,y);let h=0,x=0;for(let v of b){let k=v.getAttribute(Tf)??"";if(!M$(v)){t.itemWidths.set(n(p,k),0);continue}let E=uc(v,s);E>0&&(t.itemWidths.set(n(p,k),E),h+=E,x+=1);}let w=Math.max(0,g-h-Math.max(0,x-1)*y);t.groupBases.set(p,c+w);}let d=0;for(let f of e.querySelectorAll("[data-toolbar-fixed]")){let p=uc(f,s);p>0&&(d+=nb(p,i));}let u=e.querySelector("[data-toolbar-more]");if(u){let f=uc(u,s);f>0&&(t.more=nb(f,i));}return {available:a,gap:i,fixed:d,more:t.more,overflowing:ob(e,o)}}var D$=/^[a-z]$/;function Of(e){let t=e.key.toLowerCase();if(D$.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function ib(e,t=isApplePlatform()){if(e.shiftKey||e.isComposing)return false;if(t){if(!e.metaKey||!e.altKey||e.ctrlKey)return false}else if(!e.ctrlKey||e.metaKey||e.altKey)return false;return Of(e)==="g"}function PO(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 TO={id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:ue.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:ue.file_download,state:{kind:"save"}},{id:"exportMarkdown",labelKey:"toolbar.exportMarkdown",paths:ue.file_download,state:{kind:"export"}},{id:"exportPdf",labelKey:"toolbar.exportPdf",paths:ue.file_download,state:{kind:"export"}},{id:"print",labelKey:"toolbar.print",paths:ue.print,state:{kind:"export"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:ue.settings,state:{kind:"command"}}]};var EO={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"revisionMarkup",shape:"icon",labelKey:"revisionMarkup.title",defaultToolbar:false,paths:ue.edit_note,state:{kind:"command"}},{id:"simpleMarkup",shape:"icon",labelKey:"review.simpleMarkup",defaultToolbar:false,paths:ue.visibility,state:{kind:"command"}},{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:ue.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:ue.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:ue.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:ue.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:ue.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:ue.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:ue.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:ue.format_paragraph,state:{kind:"command"}},{id:"bookmarks",shape:"icon",labelKey:"formattingBar.showBookmarks",defaultToolbar:false,paths:ue.bookmarks,state:{kind:"command"}},{id:"protectDocument",shape:"icon",labelKey:"review.protectDocument",defaultToolbar:false,paths:ue.lock,state:{kind:"command"}},{id:"compareDocuments",shape:"icon",labelKey:"review.compareDocuments",defaultToolbar:false,paths:ue.difference,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:ue.comment,state:{kind:"command"}},{id:"addComment",shape:"icon",labelKey:"formattingBar.addComment",defaultToolbar:false,paths:ue.add_comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:ue.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:ue.edit_note,state:{kind:"command"}}]};var sb=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:ue.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:ue.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:ue.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:ue.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:ue.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:ue.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:ue.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:ue.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:ue.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:ue.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:ue.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:ue.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:ue.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:ue.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:ue.format_align_justify,state:{kind:"command"}}]},{id:"direction",labelKey:"formattingBar.groups.direction",contextual:true,controls:[{id:"ltr",labelKey:"toolbar.leftToRight",paths:ue.format_textdirection_l_to_r,state:{kind:"command"}},{id:"rtl",labelKey:"toolbar.rightToLeft",paths:ue.format_textdirection_r_to_l,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:ue.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:ue.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:ue.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:ue.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:ue.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:ue.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:ue.format_clear,state:{kind:"command"}}]},EO,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:ue.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:ue.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:ue.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:ue.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:ue.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:ue.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:ue.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:ue.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:ue.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:ue.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:ue.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:ue.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:ue.format_color_fill,state:{kind:"value"}},{id:"mergeCells",labelKey:"table.mergeCells",paths:ue.call_merge,state:{kind:"command"}},{id:"splitCell",labelKey:"table.splitCell",paths:ue.call_split,state:{kind:"command"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:ue.format_line_spacing,state:{kind:"command"}}]},TO,{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"textBox",labelKey:"toolbar.insertTextBox",paths:ue.format_shapes,state:{kind:"command"}},{id:"footnote",labelKey:"toolbar.insertFootnote",paths:ue.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:ue.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:ue.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:ue.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:ue.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:ue.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:ue.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:ue.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:ue.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:ue.toc,state:{kind:"command"}},{id:"bookmark",labelKey:"toolbar.bookmark",paths:ue.bookmark,state:{kind:"command"}},{id:"goToBookmark",labelKey:"toolbar.goToBookmark",paths:ue.bookmarks,state:{kind:"command"}},{id:"watermark",labelKey:"toolbar.watermark",paths:ue.branding_watermark,state:{kind:"command"}}]}],ab=sb;function N$(e,t){return `${e.id}.${t.id}`}function CO(){return ab.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function H$(e,t){let n=CO(),r=t?.direction?ab.find(a=>a.id==="direction"):void 0,o=n.findIndex(a=>a.id==="alignment")+1;if(r&&o>0&&(n=[...n.slice(0,o),r,...n.slice(o)]),!e)return n;let i=ab.find(a=>a.id==="image");return i?[...n,i]:n}var OO=[{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:ue.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:ue.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"},{kind:"item",slot:"insert.bookmark",shortcutKey:"toolbar.bookmarkShortcut"},{kind:"item",slot:"insert.goToBookmark"},{kind:"item",slot:"insert.watermark"}]},{id:"review",labelKey:"toolbar.review",entries:[{kind:"submenu",labelKey:"review.displayForReview",paths:ue.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:"item",slot:"review.bookmarks"},{kind:"separator"},{kind:"item",slot:"review.protectDocument"},{kind:"separator"},{kind:"item",slot:"review.compareDocuments"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function _$(){return PO(OO)}function B$(){return sb.reduce((e,t)=>e+t.controls.length,0)}var $$="formattingBar.unavailableInPreview";function W$(e,t){let n=eb$1(e,t);if(!n||n.kind==="textValue")return null;let r=fb$2(e,t),o="http://schemas.openxmlformats.org/markup-compatibility/2006";if(r?.namespaceUri===o&&(r.localName==="Choice"||r.localName==="Fallback")){let i=fb$2(e,r.id);if(i?.namespaceUri===o&&i.localName==="AlternateContent")return i}return n}function fc(e){return e.map(t=>{if(t.match!==void 0&&typeof t.match!="function")throw new TypeError("UnsupportedElement match must be a function.");if(t.includePartial!==void 0&&typeof t.includePartial!="boolean")throw new TypeError("UnsupportedElement includePartial must be a boolean.");let n=t.layout;if(n&&(!Number.isFinite(n.width)||!Number.isFinite(n.height)||n.width<=0||n.height<=0||n.width>1e5||n.height>1e5))throw new RangeError("UnsupportedElement layout requires positive dimensions up to 100000 points.");return Object.freeze({...t,...n?{layout:Object.freeze({...n})}:{}})})}function lb(e){let t=new Map;return {...Cb$1(r=>{let o=e.find(a=>a.match?.(r)??true),i=o?o.layout??(r.placement==="block"?{width:240,height:96}:{width:120,height:24}):null;return t.set(`${r.ownerPartName}\0${r.nodeId}`,i?`${i.width},${i.height}`:"hidden"),i}),includePartial:e.some(r=>r.includePartial===true),geometryKey:()=>JSON.stringify([...t].sort(([r],[o])=>r.localeCompare(o)))}}function MO(e,t){let n=fc(e??[]);return {current:()=>n,set(r){let o=fc(r);t()?.setUnsupportedElementRules(o),n=o;}}}function AO(e,t){return {includePartial:e.includePartial,unsupportedOwnerPartName:n=>de(t,n)?.name??t.part().name,unsupportedSource:(n,r)=>{let o=r?t.currentPackage().parts.get(r):de(t,n);return o?W$(o,n):null}}}var Mf=class{constructor(t,n,r,o){this.selection=n;this.part=r;this.revision=o;this.position=t?Mn(t):void 0;}selection;part;revision;entries=new WeakMap;position;save(){let t=this.part(),n=o=>{let i=eb$1(t,o.paragraphId);return {nodeId:o.paragraphId,stableId:i&&i.kind!=="textValue"?wb$1(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 d of l.children)d.kind!=="textValue"&&o.push(d);if(l.kind!=="paragraph")continue;let c=wb$1(l);c&&r.set(c,l.id);}let i=l=>{let c=l.stableId?r.get(l.stableId):l.nodeId;return c?{paragraphId:c,offset:l.offset}:null},a=i(t.anchor),s=i(t.head);return a&&s?{anchor:a,head:s}:null}};var q$=new Set(["Shift","Control","Alt","AltGraph","Meta","OS","Hyper","Super","Symbol","Fn","FnLock","CapsLock","NumLock","ScrollLock","SymbolLock"]),K$=["opening","fonts","drawing-resources"];function LO(e){return !q$.has(e.key)}function FO(e){return e.paragraphIds.size>0||!K$.some(t=>e.dependencyKeys.has(t))}var U$=new Set;function pc(e,t){let n=tf$1(e,t.displayMode,t.authorFilter),r=wc$2(n);if(r===n)return U$;let o=new Set(n.map(i=>i.id));return new Set(r.flatMap(i=>o.has(i.id)?[]:[i.id]))}function j$(e,t,n){let r=tf$1(e,n.displayMode,n.authorFilter),o=wc$2(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 V$(e,t,n,r){let o=c=>e.findIndex(d=>d.kind!=="textValue"&&d.id===c),i=o(t),a=o(n);if(i===-1||a<=i)return null;let s=[];for(let c=i+1;c<a;c+=1){let d=e[c];if(d.kind==="textValue")return null;s.push(d.id);}if(s.length===0)return s;let l=r();return s.every(c=>l.has(c))?s:null}function DO(e,t,n,r){let o=fb$2(e,t);if(o===null||fb$2(e,n)?.id!==o.id)return null;let i=V$(o.children,t,n,()=>pc(o.children,r));return i===null?null:[...i,n].map(a=>({op:"joinParagraphs",firstId:t,secondId:a}))}function NO(e,t,n,r){if(Wb$1(e,n.paragraphId).length>0)return n;let o=fb$2(t,n.paragraphId);if(o===null)return n;let i=j$(o.children,n.paragraphId,r);return i===null?n:{paragraphId:i,offset:0}}function G$(e,t,n,r,o){if(Wb$1(e,n.paragraphId).length>0)return null;let i=fb$2(t,n.paragraphId);if(i===null||!pc(i.children,r).has(n.paragraphId))return null;let a=i.children,s=a.findIndex(d=>d.kind!=="textValue"&&d.id===n.paragraphId),l;for(let d=s-1;d>=0&&l===void 0;d-=1)a[d].kind!=="textValue"&&(l=a[d]);if(l===void 0||l.kind!=="paragraph")return null;let c=o==="backward"?{paragraphId:l.id,offset:(Jm(t,l.id)??"").length}:NO(e,t,n,r);return {ops:[{op:"joinParagraphs",firstId:l.id,secondId:n.paragraphId}],caret:c}}function z$(e,t,n){let r=fb$2(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 c=o[l];if(c.kind!=="textValue"){if(a??=pc(o,n),!a.has(c.id))break;s.push({op:"joinParagraphs",firstId:t,secondId:c.id});}}return s.length>0?s:null}function HO(e){let t=n=>NO(e.layout(),e.part(),n,e.view());return {joinOps:(n,r)=>DO(e.part(),n,r,e.view()),forwardJoinOps:(n,r)=>DO(e.part(),n,r,e.view())??z$(e.part(),n,e.view()),shown:t,removedCaretEdit:(n,r)=>G$(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}}}}function Z$(e){return e.level==="inline"&&e.range!==void 0&&e.range.start<e.range.end&&(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")}function cb(e,t,n){let r=(e.contentControls??[]).filter(l=>Z$(l)&&l.range.paragraphId===t.paragraphId&&l.range.start>=t.offset&&l.range.end<=n.offset),o=r.filter(l=>!r.some(c=>c!==l&&c.range.start<=l.range.start&&c.range.end>=l.range.end&&c.nestingDepth<l.nestingDepth)).sort((l,c)=>c.range.start-l.range.start);if(o.length===0)return null;let i=t.paragraphId,a=[],s=n.offset;for(let l of o)l.range.end<s&&a.push({op:"deleteText",paragraphId:i,start:l.range.end,end:s}),a.push({op:"removeContentControl",controlId:l.id,keepContent:false}),s=l.range.start;return t.offset<s&&a.push({op:"deleteText",paragraphId:i,start:t.offset,end:s}),a}function _O(e){let{anchor:t,head:n}=e.selection;if(t.paragraphId!==n.paragraphId)return null;if(t.offset!==n.offset){if(e.tracked)return null;let[l,c]=t.offset<n.offset?[t,n]:[n,t],d=cb(e.layout,l,c);return d?{kind:"remove",ops:d,collapseTo:l}:null}let r=e.shown(n),o=e.direction==="backward",i=e.controlBeside(r,o?"before":"after");if(!i)return null;let a={paragraphId:r.paragraphId,offset:i.start},s={paragraphId:r.paragraphId,offset:i.end};if(i.struck){let l=o?a:s;return {kind:"select",selection:{anchor:l,head:l}}}return i.contentLocked?{kind:"select",selection:o?{anchor:s,head:a}:{anchor:a,head:s}}:{kind:"remove",ops:e.tracked?[{op:"deleteText",paragraphId:r.paragraphId,start:i.start,end:i.end}]:[{op:"removeContentControl",controlId:i.controlId,keepContent:false}],collapseTo:o?a:e.tracked?s:r}}var BO="\uFFFC",Af="\0";function $O(e,t){return (n,r)=>{let o=e(n,r),i=new Uint8Array(o.length);for(let{line:s}of Wb$1(n,r)??[]){let l=_a(s,r);if(l){for(let c of l.spans)i.fill(1,Math.min(c.range.start,o.length),Math.min(c.range.end,o.length));for(let c of l.drawings)c.start<o.length&&(i[c.start]=1);}}if(!t)for(let s of Yb$1(n,r))i.fill(0,Math.min(s.start,o.length),Math.min(s.end,o.length));if(!i.includes(0))return o;let a="";for(let s=0;s<o.length;s+=1)a+=i[s]?o[s]:Af;return a}}function X$(e,t){let n=new Map,r=new Set,o=Wb$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?Ka$1(l.fragments).some(c=>c.lines.includes(i.line)):false);for(let{line:l,pageIndex:c}of o)if(!(s&&c!==i.pageIndex)&&!r.has(l)){r.add(l);for(let d of _a(l,t)?.spans??[])!d.fieldAtom&&!d.projected||d.range.end-d.range.start===1&&n.set(d.range.start,(n.get(d.range.start)??"")+d.text);}for(let[l,c]of n)c.length<=1&&n.delete(l);return n}function mc(e,t){let n=new Map,r=i=>{let a=n.get(i);return a||n.set(i,a=X$(e,i)),a},o=i=>{let a=t(e,i).split("");for(let s of r(i).keys())s<a.length&&a[s]!==Af&&(a[s]=BO);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,c)=>l===BO?s.get(c)??l:l).join("")}}}var Y$=/[\p{L}\p{N}_'’]/u,db=e=>e!==void 0&&Y$.test(e);function Lf(e,t,n,r="after",o=Ue(e,t.paragraphId)){let i=t.paragraphId,a=Math.max(0,Math.min(t.offset,o.length)),s=-1;if(r==="before"&&a>0&&db(o[a-1])?s=a-1:db(o[a])?s=a:a>0&&db(o[a-1])&&(s=a-1),s===-1){let l=a,c=a;for(;l>0&&/\s/.test(o[l-1]??"");)l-=1;for(;c<o.length&&/\s/.test(o[c]??"");)c+=1;return l===c&&c<o.length&&(c+=1),{from:{paragraphId:i,offset:l},to:{paragraphId:i,offset:c}}}return {from:{paragraphId:i,offset:He(o,s+1,-1,n)},to:{paragraphId:i,offset:He(o,s,1,n)}}}function Ke(e){return {anchor:e,head:e}}function ra(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 Ff(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??db$1(e);return i.indexOf(r.paragraphId)<=i.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function Jo(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,c=Ue(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,c))}};return {anchor:o(n.anchor),head:o(n.head)}}function ub(e,t,n,r,o,i=Ue,a){let s=(p,g,b)=>o===void 0||!g.includes("\uFFFC")?g:g.replace(/\uFFFC/g,(y,h)=>o(p,b+h)??y);if(t.paragraphId===n.paragraphId)return s(t.paragraphId,i(e,t.paragraphId).slice(t.offset,n.offset),t.offset);let l=r??db$1(e),c=l.indexOf(t.paragraphId),d=l.indexOf(n.paragraphId);if(c===-1||d===-1)return "";let u=l.slice(c,d+1),f=s(t.paragraphId,i(e,t.paragraphId).slice(t.offset),t.offset);for(let p=1;p<u.length;p+=1){let g=u[p],b=i(e,g),y=$a(e,g).includes(u[p-1])||a?.(u[p-1])?"":`
|
|
25
|
+
`;f+=y+s(g,p===u.length-1?b.slice(0,n.offset):b,0);}return f}function qO(e,t,n,r){let o=mc(e,Ue);return ub(e,t,n,r,o.resultAt,o.markedText)}function KO(e,t){return pa$1(e,t,mc(e,Ue).spelledText)}function fb(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 UO(e){return e.kind}function jO(e){return e.kind!=="textValue"&&UO(e)==="contentControl"}function WO(e){return e.kind!=="textValue"&&UO(e)==="contentControlContent"}function Q$(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let i=fb(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 J$(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(jO(i)){let s=fb(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 VO(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 eW(e,t,n){let r=[],o=i=>{if(i.kind!=="textValue"){if(i.kind==="table"||jO(i)){let s=fb(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 GO(e,t,n,r,o){let i=f=>Ue(e,f);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let a=o??db$1(e),s=a.indexOf(n.paragraphId),l=a.indexOf(r.paragraphId);if(s===-1||l===-1||s>l)return null;let c=a.slice(s,l+1),d=VO(i,a,s,l,n,r),u=a[l];return {partName:t.name,paragraphIds:c,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...d],fullyCoveredBlockIds:eW(t,d,new Set(a)),lastMarkCovered:r.offset===i(u).length}}function zO(e,t,n,r,o,i={displayMode:e.displayMode??"all-markup",authorFilter:void 0},a=false){let s=S=>Ue(e,S),l=(S,T,B)=>(a?null:cb(e,{paragraphId:S,offset:T},{offset:B}))??[{op:"deleteText",paragraphId:S,start:T,end:B}];if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:l(n.paragraphId,n.offset,r.offset),collapseTo:n};let c=o??db$1(e),d=c.indexOf(n.paragraphId),u=c.indexOf(r.paragraphId);if(d===-1||u===-1)return {ops:[],collapseTo:n};let f=VO(s,c,d,u,n,r),p=a?new Map:Q$(t,f),g=new Map;for(let[S,T]of p)for(let B of T)g.set(B,S);let b=J$(t,f,p),y=d;if(g.has(n.paragraphId)){y=-1;for(let S=d+1;S<=u;S+=1)if(!g.has(c[S])){y=S;break}if(y===-1){let S=g.get(n.paragraphId);for(let T of p.get(S)??[])g.delete(T);p.delete(S),y=d;}}let h=c[y],x=y===d?n:{paragraphId:h,offset:0},w=[];for(let S=d;S<=u;S+=1){let T=c[S];if(g.has(T))continue;let B=s(T).length,W=S===d?n.offset:0,q=S===u?r.offset:B;W<q&&w.push(...l(T,W,q));}for(let S of p.keys())w.push({op:"deleteBlock",blockId:S});for(let S of b)w.push({op:"removeContentControl",controlId:S});let v=S=>{let T=fb$2(t,S);for(;T&&WO(T);){let B=fb$2(t,T.id);if(!B||!b.has(B.id))break;T=fb$2(t,B.id);}return T},k=new Map,E=S=>{let T=k.get(S.id);return T||k.set(S.id,T=pc(S.children,i)),T},I=S=>{let T=[],B=W=>{for(let q of W)if(q.kind!=="textValue"&&!p.has(q.id)){if(b.has(q.id)){let U=q.children.find(WO);U&&U.kind!=="textValue"&&B(U.children);continue}if(q.kind==="paragraph"){T.push(q.id);continue}T.push(`\0barrier:${q.id}`);}};return B(S.children),T},P=(S,T)=>{let B=v(S);if(!B||v(T)!==B)return null;let W=I(B),q=W.indexOf(S),U=W.indexOf(T);if(q===-1||U<=q)return null;let Z=W.slice(q+1,U);if(Z.length===0)return Z;let M=E(B);return Z.every(J=>M.has(J))?Z:null},C=h,O=h;for(let S=y+1;S<=u;S+=1){let T=c[S];if(g.has(T))continue;let B=P(O,T);if(B)for(let W of [...B,T])w.push({op:"joinParagraphs",firstId:C,secondId:W});else C=T;O=T;}return {ops:w,collapseTo:x}}function ZO(e,t,n,r){return t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset?[]:Ze$1(e,t,n(),r)}function pb(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 XO(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:pb(t,e)?.base??r()}}function YO(e,t,n){let r=Jo(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 Df=class{undo=[];redo=[];moving=false;group;position;constructor(t){this.position=Mn(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},Kn$1(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(),Kn$1(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;}}};var eM=32,QO=new WeakMap,JO=new WeakMap,tW=new WeakMap,nW=new WeakMap;function Nf(e){let t=QO.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 QO.set(e,r),r}function tM(e,t){let n=t?nW:tW,r=n.get(e);return r||(r={fragment:e,indent:{indent:e.indent,inTable:t},emptyStyle:e.emptyParagraphStyle},n.set(e,r)),r}function nM(e,t){return e?!e.emptyStyle&&t.emptyStyle?{...e,emptyStyle:t.emptyStyle}:e:t}function gc(e,t,n){let r=e.get(t),o=nM(r,n);o!==r&&e.set(t,o);}function rW(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 mb(e){if(e.complete)return e.complete;let t=new Map;rW(e.stories,(n,r)=>{let o=tM(n,r);for(let i of ab$1(n))gc(t,i,o);});for(let[n,r]of e.sparse)r&&t.set(n,r);return e.sparse.clear(),e.complete=t,t}function oW(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 ab$1(e).includes(t);return false}function rM(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>=eM)return mb(e).get(t);let r,o=(i,a)=>{for(let s of i){if(s.kind==="paragraph"){if(!oW(s,t))continue;if(r=nM(r,tM(s,a)),r.emptyStyle)return true;continue}if(Tf$2(s).has(t)){for(let l of s.rows)if(!l.isHeaderRepeat){for(let c of l.cells)if(o(c.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 iW(e,t,n){for(let[r,o]of n)oM(e,t,r,o);for(let r=0;r<t.frontier;r+=1)for(let[o,i]of mb(Nf(e.pages[r])))n.has(o)||gc(t.entries,o,i);t.progress=null;}function oM(e,t,n,r){for(let o=r;o<t.frontier;o+=1){let i=rM(Nf(e.pages[o]),n);i&&gc(t.entries,n,i);}}function hc(e,t,n=false){let r=JO.get(e);r||(r={frontier:0,entries:new Map,progress:new Map},JO.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>=eM&&iW(e,r,i),r.progress){oM(e,r,t,r.progress.get(t)??0);let s=o();for(;!s&&r.frontier<e.pages.length;){let l=rM(Nf(e.pages[r.frontier++]),t);l&&gc(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 mb(Nf(e.pages[r.frontier++])))gc(r.entries,s,l);a=o();}return a??r.entries.get(t)}var gb=e=>wf$1(e)?"rtl":"ltr";function aM(e,t){return hc(e,t,true)?.emptyStyle}var sM=Object.freeze([]);function Vn(e,t){return hc(e,t)?.fragment.props??sM}function yc(e,t){return hc(e,t)?.fragment.tabStops??null}function Hf(e){return Math.round((e.hanging>0?-e.hanging:e.firstLine)*20)}function bc(e,t){return hc(e,t)?.indent??null}function lM(e,t,n,r,o=Uh$1,i){let a=eb$1(e,t);if(!a||a.kind!=="paragraph")return false;for(let s of Vh$1(a,gi(a),n,r,o,i))if(bi(ai$1(s.run,"runProperties","rPr"),_h$1).length>0)return true;return false}function ei(e,t,n,r=Uh$1,o){let i=eb$1(e,t);if(!i||i.kind!=="paragraph")return [];let a=vi(i,n)?wi(i,n):void 0;if(a?.kind==="none")return [];if(!a&&oi$1(i,n)===null)return [];let s=ni$1(i,n,r,o);return s?bi(ai$1(s,"runProperties","rPr"),_h$1):di$1(e,t)}function oa(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 cM(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:oa(t,"b")===true};break;case "i":n={...n,italic:oa(t,"i")===true};break;case "u":n={...n,underline:oa(t,"u")===true};break;case "strike":n={...n,strikethrough:oa(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 hb(e,t,n,r){return (n&&n.length>0?na$1(e,n):Xe(e,t,r??(t.anchor.paragraphId===t.head.paragraphId?[]:fb$1(e)))).map(i=>{let a=E$2(D$1(i.style));return a===i.style?i:{...i,style:a}})}function _f(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 Bf(e,t,n,r){return hb(e,t,n,r)[0]?.style??null}function dM(e,t,n,r,o,i){let a=hb(e,t,r,i),s=a.length===0&&!r?.length&&t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset?aM(e,t.head.paragraphId):void 0,l=a.length>0?a.map(d=>d.style):s?[s]:[];if(l.length===0)return false;let c=d=>{switch(n){case "b":return d.bold;case "i":return d.italic;case "u":return d.underline!==null;case "strike":return d.strike;case "vertAlign":return d.verticalAlign===o;default:return false}};return l.every(c)}var aW=/\p{L}/u;function sW(e,t,n){let r=e.range.paragraphId===t.paragraphId?t.offset:e.range.start,o=e.range.paragraphId===n.paragraphId?n.offset:e.range.end;return e.text.slice(Math.max(0,r-e.range.start),Math.max(0,o-e.range.start))}function uM(e,t,n,r,o,i,a,s=true){let l=s?hb(e,t,r,i):[],c=l.length===0?iM(e,t,r,i).map(H=>aM(e,H)).filter(H=>H!==void 0):[],d=c.length>0?c:l.map(H=>H.style),u=H=>{if(d.length===0)return null;let j=H(d[0]);return d.every(N=>H(N)===j)?j:null},f=(H,j=(N,D)=>N===D)=>H.length>0&&H.every(N=>j(N,H[0]))?H[0]:null,p=(H,j)=>H.props.some(N=>N.localName===j),g=l.some(H=>H.fontSlot==="eastAsia"),{anchor:b,head:y}=t,h=b.paragraphId===y.paragraphId&&b.offset===y.offset,x=!g||h||r?.length?null:Te(t,b.paragraphId===y.paragraphId?[]:i??fb$1(e)),w=g?l.filter(H=>aW.test(x?sW(H,x.from,x.to):H.text)):[],v=w.length>0?w:l,k=H=>Ga(H.style,H.fontSlot).fontFamily??n?.(H.range.paragraphId,H.props).fontFamily??null,E=H=>p(H,"sz")?Math.round(H.style.fontSizePt*2):n?.(H.range.paragraphId,H.props).fontSizeHalfPoints??Math.round(H.style.fontSizePt*2),I=c.length>0?{fontFamily:u(H=>H.fontFamily??a??null),fontSizeHalfPoints:u(H=>Math.round(H.fontSizePt*2))}:l.length===0?n?.(t.head.paragraphId,[]):void 0,P=iM(e,t,r,i),C=H=>f(P.map(j=>H(Vn(e,j)))),O=(H,j=(N,D)=>N===D)=>{if(P.length<2)return false;let N=H(Vn(e,P[0]));return P.some((D,z)=>z>0&&!j(H(Vn(e,D)),N))},S=C(H=>Cd(H)),T$1=C(gb),B=C(H=>_$1(H,"pStyle")?.val??o??void 0)??null,W=H=>_$1(H,"spacing")??void 0,q=H=>{if(H===sM)return "";let j=aa$2(H),N=D=>Math.round(D*100)/100;return j.rule==="auto"?`multiple:${N(j.value/240)}`:`${j.rule}:${N(j.value)}`},U=C(q),Z=(()=>{if(!U)return null;let[H,j]=U.split(":");return {rule:H,value:Number(j)}})(),M=(H,j)=>{let N=Qd(W(H)?.[j]);return N===null?null:Math.round(N/20*100)/100},J=H=>C(j=>M(j,H)),ee=(()=>{let H=Y=>gb(Vn(e,Y))==="rtl",j=P.map(Y=>{let le=bc(e,Y);return !le||!H(Y)?le:{...le,indent:{...le.indent,left:le.indent.right,right:le.indent.left}}}),N=j[0];if(!N||j.some(Y=>Y===null||Y.inTable))return null;let D=H(P[0]),z=Y=>Math.round(Y*20),X=j,F=z(N.indent.left),K=z(N.indent.right),V=Hf(N.indent);return {left:F,right:K,firstLine:V,mixed:{left:X.some(Y=>z(Y.indent.left)!==F),right:X.some(Y=>z(Y.indent.right)!==K),firstLine:X.some(Y=>Hf(Y.indent)!==V)},...D?{rtl:D}:{}}})(),fe=H=>C(j=>H(rf$1(j))),se=C(T),$=C(ca$1);return {bold:d.length>0&&d.every(H=>H.bold),italic:d.length>0&&d.every(H=>H.italic),underline:d.length>0&&d.every(H=>H.underline!==null),strikethrough:d.length>0&&d.every(H=>H.strike),superscript:d.length>0&&d.every(H=>H.verticalAlign==="superscript"),subscript:d.length>0&&d.every(H=>H.verticalAlign==="subscript"),fontFamily:l.length>0?f(v.map(k)):I?.fontFamily??null,fontSizeHalfPoints:l.length>0?f(l.map(E)):I?.fontSizeHalfPoints??null,color:u(H=>H.color),highlight:u(H=>H.highlight),alignment:S,direction:T$1,styleId:B,lineSpacing:Z,spaceBeforePt:J("before"),spaceAfterPt:J("after"),disagrees:{alignment:O(H=>Cd(H)),direction:O(gb),spaceBeforePt:O(H=>M(H,"before")),spaceAfterPt:O(H=>M(H,"after")),lineSpacing:O(q),tabStops:(()=>{if(P.length<2)return false;let H=JSON.stringify(yc(e,P[0])?.stops??null);return P.some((j,N)=>N>0&&JSON.stringify(yc(e,j)?.stops??null)!==H)})()},indent:ee,tabStops:f(P.map(H=>yc(e,H)?.stops??null),(H,j)=>H===null||j===null?H===j:H.length===j.length&&H.every((N,D)=>Math.round(N.positionPt*20)===Math.round(j[D].positionPt*20)&&N.alignment===j[D].alignment&&(N.leader??"none")===(j[D].leader??"none")))?.map(H=>({positionTwips:Math.round(H.positionPt*20),alignment:H.alignment,...H.leader?{leader:H.leader}:{}}))??null,paragraphFlags:{contextualSpacing:$,keepNext:fe(H=>H.keepNext),keepLines:fe(H=>H.keepLines),widowControl:fe(H=>H.widowControl),pageBreakBefore:se}}}function iM(e,t,n,r){if(n&&n.length>0)return [...ma$1(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??fb$1(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 fM(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}]}var lW=/\p{L}/u;function cW(e){for(let t of e)if(lW.test(t))return Ab$1.test(t)?"rtl":"ltr";return null}function pM(e,t,n){return (r,o,i,a)=>{let{paragraphId:s,offset:l}=r,c=o-i.length;if(cW(i)!=="rtl")return [...a];let d=t(),u=n(),f=de(e,s)??e.part();if(mi(f,s,l,b$1(e.stylesRoot(),e.settingsRoot(),d,u),d,u))return [...a];let g=y=>[...y.filter(h=>h.localName!=="rtl"),{localName:"rtl"}],b=a.findIndex(y=>y.op==="setRunProperties"&&y.paragraphId===s&&y.start===c&&y.end===c+i.length);return b>=0?a.map((y,h)=>h===b&&y.op==="setRunProperties"?{...y,properties:g(y.properties)}:y):[...a,{op:"setRunProperties",paragraphId:s,start:c,end:c+i.length,properties:g(ei(f,s,l,d,u))}]}}function mM(e,t,n,r){let o=e??hb$1,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 gM(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 hM(e,t,n,r){let o=eb$1(e,t);if(o?.kind!=="paragraph")return false;if(!uc$1(o,n,r))return true;let i=fb$2(e,t);return i?tf$1(i.children,n,r).some(a=>a.kind==="paragraph"&&a.id===t):false}var dW=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),yb=new WeakSet;function yM(e){return yb.has(e)}function bM(e){let t=null,n=o=>{if(!Mu(o))return;let{clientX:i,clientY:a}=o,s=Date.now(),l=t===null?-1:s-t.time,c=t!==null&&l>=0&&l<=500&&Math.abs(i-t.x)<=4&&Math.abs(a-t.y)<=4;return t=c?null:{time:s,x:i,y:a},{clientX:i,clientY:a,double:c}},r=(o,i)=>e.surface.selectDrawing(o,i)?(e.setIntent({kind:"pointer",drawingNodeId:o}),true):false;return {onDrawingPointerGesture(o){if(Mu(o)&&o.button!==0||e.surface.editingMode()==="view")return;let i=qt(o.target)?o.target:null,a=e.textbox()?.preparePointer(i,n(o));a&&yb.add(o);let s=a?null:e.textbox()?.takeRefusedPress();if(s&&r(s.drawingNodeId,s.hostParagraphId)){yb.add(o),o.preventDefault(),o.stopImmediatePropagation();return}let l=!a&&i?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");if(l&&i?.closest(".docx-drawing-textbox")){let c;for(let d of e.surface.layout().pages)if(c=$b$1(d,l),c)break;if(c&&r(l,c.paragraphId)){o.preventDefault(),o.stopImmediatePropagation();return}}e.setIntent(l?{kind:"pointer",drawingNodeId:l}:{kind:"none"});},onDrawingKeyGesture(o){if(es(o)&&dW.has(o.key))return;let i=e.textbox(),a=i?.active();if(es(o)&&o.key==="Escape"&&a){i.exit(),r(a.drawingNodeId,a.hostParagraphId),o.preventDefault(),o.stopImmediatePropagation();return}let s=es(o)&&o.key==="Enter"&&!o.shiftKey&&!o.altKey&&!o.ctrlKey&&!o.metaKey,l=e.intent();if(s&&!a&&l.kind==="pointer"&&i?.enterDrawing(l.drawingNodeId)){e.setIntent({kind:"none"}),o.preventDefault(),o.stopImmediatePropagation();return}if((es(o)&&(o.key==="Delete"||o.key==="Backspace")&&!o.altKey&&!o.ctrlKey&&!o.metaKey||Lg(o)&&(o.inputType==="deleteContentBackward"||o.inputType==="deleteContentForward"))&&e.intent().kind==="pointer"){let d=jn(e.surface);if(d!==null){o.preventDefault(),o.stopImmediatePropagation(),e.setIntent({kind:"none"}),e.surface.deleteImage(d.drawingNodeId);return}}e.setIntent({kind:"none"});}}}function vM(e,t,n){let r=t.owner;if(!r){for(let a of e.pages){let s=$b$1(a,t.drawingNodeId);if(s)return {pageIndex:a.index,drawing:s,origin:s}}return null}if(r.kind!=="headerFooter")return null;let o=n===void 0?void 0:e.pages[n],i=o?.index===n?o:void 0;for(let a of i?[i,...e.pages]:e.pages){let s=Xl(a).find(l=>l.drawing.drawingNodeId===t.drawingNodeId&&(l.rId===void 0||l.rId===r.rId));if(s)return {pageIndex:a.index,drawing:s.drawing,origin:s.origin,kind:s.kind}}return null}function uW(e,t,n){if(!t.double&&n===void 0)return null;let r=e?.closest("[data-page-index]");if(!r)return null;let o=n!==void 0&&!!e?.closest("[data-docx-hf-active] [data-start]"),i=[...r.querySelectorAll(".docx-drawing-textbox-content")].reverse();for(let a of i){let s=a.closest("[data-docx-hf], [data-docx-hf-front], [data-docx-hf-behind]"),l=!!s?.hasAttribute("data-docx-hf-behind");if(!s||l&&(n===void 0||o))continue;let c=a.getBoundingClientRect();if(t.clientX>=c.left&&t.clientX<=c.right&&t.clientY>=c.top&&t.clientY<=c.bottom)return a}return null}function fW(e){let n=e.closest(".docx-editor__scroll-container")?.getBoundingClientRect()??{top:0,bottom:e.ownerDocument.defaultView?.innerHeight??0};for(let r of e.querySelectorAll(".docx-page[data-page-index]")){let o=r.getBoundingClientRect();if(o.bottom>n.top&&o.top<n.bottom)return Number(r.dataset.pageIndex)}}function xM(e){let t=null,n,r=null,o=null,i=b=>b.owner?e.partOf(b.drawingNodeId):e.session.part(),a=b=>{let y=i(b);return y?bk(y).find(h=>h.root.id===b.id&&h.drawingNodeId===b.drawingNodeId):void 0},s=()=>t&&a(t),l=b=>!b.owner||b.owner.kind==="headerFooter"&&e.headerFooter.active()?.rId===b.owner.rId,c=()=>{if(t&&!l(t)){d(false);return}if(t&&!s()){d();return}let y=t?.owner?.kind==="headerFooter"?e.headerFooter.active():null;y&&n!==y.pageIndex&&(n=y.pageIndex,o=null);for(let h of e.pagesLayer.querySelectorAll(".docx-drawing-textbox")){let x=h.dataset.drawingNodeId===t?.drawingNodeId&&(n===void 0||h.closest("[data-page-index]")?.getAttribute("data-page-index")===String(n)),w=h.dataset.docxTextboxActive;if(w!==String(x)){if(h.dataset.docxTextboxActive=String(x),h.contentEditable=x?"true":"false",h.setAttribute("role",x?"textbox":"img"),x)h.removeAttribute("aria-hidden"),h.setAttribute("aria-multiline","true");else if(h.removeAttribute("aria-multiline"),h.hasAttribute("aria-label")||h.setAttribute("aria-hidden","true"),w!=="true")continue;for(let v of h.querySelectorAll("[data-textbox-paragraph-id]"))x?v.dataset.paragraphId=v.dataset.textboxParagraphId:delete v.dataset.paragraphId;}}},d=(b=true)=>{t&&(e.flush(),t=null,n=void 0,o=null,c(),b&&r&&e.setSelection(r),r=null);},u=(b,y)=>{if(b.owner&&b.owner.kind!=="headerFooter"||!e.writable())return false;e.flush();let h=i(b),x=h&&bk(h).find(O=>O.root.id===b.id&&O.drawingNodeId===b.drawingNodeId&&O.hostParagraphId===b.hostParagraphId),w=e.headerFooter.active(),v=b.owner,k=y??(v?w?.rId===v.rId?w.pageIndex:fW(e.pagesLayer):void 0),E=vM(e.layout(),b,k),I=E?.drawing;if(!h||!x||!E||!I||!ju(h,x.root.id,I))return false;let P=I.textboxStory.fragments[0];if(!P||P.kind!=="paragraph")return false;if(t?.id===b.id&&n===(v?E.pageIndex:void 0))return true;if(d(),v&&(w?.rId!==v.rId||w.pageIndex!==E.pageIndex)&&(!E.kind||!e.headerFooter.enter(v.rId,E.pageIndex,E.kind)))return false;e.leaveOtherStories(v),r=e.selection(),t=b,n=v?E.pageIndex:void 0,o=null,c();let C={paragraphId:P.paragraphId,offset:P.range.start};return e.setSelection({anchor:C,head:C}),true},f=b=>t?vM(b,t,n):null,p=null,g=(b,y)=>{let h=bk(e.session.part()).find(I=>I.drawingNodeId===b);if(h)return {scope:{kind:"frame",id:h.root.id,drawingNodeId:b,hostParagraphId:h.hostParagraphId}};let x=e.partOf(b),w=x&&bk(x).find(I=>I.drawingNodeId===b);if(!w)return null;let v=e.layout(),k=y===void 0?void 0:v.pages[y],E=k&&k.index===y?[k,...v.pages]:v.pages;for(let I of E){let P=Xl(I).find(C=>C.drawing.drawingNodeId===b);if(P?.rId)return {scope:{kind:"frame",id:w.root.id,drawingNodeId:b,hostParagraphId:w.hostParagraphId,owner:{kind:"headerFooter",rId:P.rId}},pageIndex:I.index,kind:P.kind}}return null};return {active:()=>t,replacementFormatOps(b,y,h){let{anchor:x,head:w}=e.selection(),v=t&&i(t);if(!v||h===0||x.paragraphId===w.paragraphId&&x.offset===w.offset)return [];let k=ei(v,b,y);return k.length?[{op:"setRunProperties",paragraphId:b,start:y,end:y+h,properties:k}]:[]},enter:b=>u(b),exit:d,syncDom:c,contains:b=>{let y=s();return !!y&&id(y.root).some(h=>h.id===b)},paragraphIds:()=>{let b=s();return b?id(b.root).map(y=>y.id):[]},caretInput(b){let y=f(b);if(!y)return {};let h=y.drawing.drawingNodeId,w=[...e.pagesLayer.querySelectorAll(".docx-drawing-textbox")].find(k=>k.dataset.drawingNodeId===h&&k.closest("[data-page-index]")?.dataset.pageIndex===String(y.pageIndex))?.querySelector(".docx-drawing-textbox-content");if(!w)return {};let v=y.drawing.textboxStory;return {scopedHost:w,scopedHostKind:"textbox",scopedOrigin:{x:y.origin.x+v.contentOffset.x,y:y.origin.y+v.contentOffset.y}}},layout(b){if(!t)return b;if(o?.base===b&&o.id===t.id)return o.layout;let y=f(b),h=y?.drawing.textboxStory,x=y&&h?h.fragments.flatMap(v=>v.kind==="paragraph"?[Bf$2(v,y.origin.x+h.contentOffset.x,y.origin.y+h.contentOffset.y)]:[]):[],w={...b,pages:b.pages.map(v=>({...v,header:void 0,footer:void 0,footnotes:void 0,endnotes:void 0,anchoredDrawings:[],fragments:t.owner?v.index===y?.pageIndex?x:[]:$b$1(v,t.drawingNodeId)?x:[]}))};return o={base:b,id:t.id,layout:w},w},enterDrawing(b){let y=e.headerFooter.active(),h=g(b,y?.pageIndex);return !!h&&u(h.scope,h.pageIndex)},takeRefusedPress(){let b=p;return p=null,b},preparePointer(b,y){p=null;let h=b?.closest(".docx-drawing-textbox-content")??(y?uW(b,y,e.headerFooter.active()?.rId):null),x=h?.closest("[data-drawing-node-id]")?.dataset.drawingNodeId,w=Number(h?.closest("[data-page-index]")?.dataset.pageIndex),v=x?g(x,Number.isInteger(w)?w:void 0):null;if(v&&u(v.scope,v.pageIndex))return true;d(false);let k=v?.scope.owner;if(v&&k?.kind==="headerFooter"&&v.kind&&v.pageIndex!==void 0){let E=e.headerFooter.active();(E?.rId===k.rId&&E.pageIndex===v.pageIndex||e.headerFooter.enter(k.rId,v.pageIndex,v.kind))&&(p={drawingNodeId:v.scope.drawingNodeId,hostParagraphId:v.scope.hostParagraphId});}return false}}}function wM(e,t){return e?.active()?null:t?.getActive()??null}function SM(e,t,n){let r={session:e,headerFooter:()=>n().hfScope,sectionAtPage:t,exitNote:()=>n().noteOps?.exitNote()};return {partOf:o=>de(r.session,o)??null,leaveOtherStories:o=>{r.exitNote();let i=r.headerFooter();o&&i?.getActive()?.scope.rId===o.rId||i?.exitHeaderFooter();},headerFooter:{active:()=>{let o=r.headerFooter()?.getActive();return o?{rId:o.scope.rId,pageIndex:o.pageIndex}:null},enter:(o,i,a)=>r.headerFooter()?.enterHeaderFooter({rId:o,pageIndex:i,sectionIndex:r.sectionAtPage(i).sectionIndex,kind:a})??false}}}function kM(e,t,n){return (r,o)=>{let i=t(),a=n();return mi(de(e,r)??e.part(),r,o,a$6(e.stylesRoot(),e.settingsRoot(),i,a),i,a)}}var mW=[["--docx-hf-add-header","headerFooter.addHeaderHint"],["--docx-hf-add-footer","headerFooter.addFooterHint"],["--docx-hf-edit-header","headerFooter.editHeaderHint"],["--docx-hf-edit-footer","headerFooter.editFooterHint"]];function gW(e){return `"${e.replace(/[\\"]/g,"\\$&").replace(/[\n\r\f]/g," ")}"`}function vb(e,t){e.setAttribute("aria-label",t?.("editor.documentContent")??en.editor.documentContent);for(let[n,r]of mW){let o=t?.(r);o&&o!==r?e.style.setProperty(n,gW(o)):e.style.removeProperty(n);}}var wc="An external document refresh is in progress.",Sc="rejected",Cr="A preview is open. Commit or discard it before editing.",ms=new WeakSet,xc=new WeakSet,IM=new WeakMap,sr=e=>ms.has(e)||xc.has(e),RM=e=>ms.has(e),gs=e=>!ms.has(e)&&xc.has(e)?Cr:wc;function ti(e,t){t?ms.add(e):ms.delete(e);}function xb(e,t){t?xc.add(e):xc.delete(e);}function PM(e,t){IM.set(e,t);}var $f=e=>IM.get(e)?.()??false,hW=new Set(["toggleReviewPane","toggleParagraphMarks","selectAll","setSelection","copyFormatting"]),yW=(e,t)=>!ms.has(e)&&xc.has(e)&&hW.has(t.type),wb=(e,t)=>e&&sr(e)&&!yW(e,t)?{ok:false,code:"unsupported",reason:gs(e)}:null;function TM(e){let t="select[data-docx-form-dropdown]",n=c=>qt(c)?c.closest(t):null,r=c=>{let d=c.closest("[data-start][data-paragraph-id]"),u=d?.dataset.paragraphId;if(!d||!u)return null;let f=e.part(u),p=eb$1(f,u);if(p?.kind!=="paragraph")return null;let g=Number(d.dataset.start),b=Ck(p).find(h=>h.start<=g&&g<h.end);if(!b)return null;let y={op:"setLegacyDropdown",paragraphId:u,fieldNodeId:b.fieldNodeId,selectedIndex:c.selectedIndex};return {field:b,paragraphId:u,op:y,enabled:e.editable()&&e.canApply(y)&&Uk(e.settings(),y)===null&&xn$1(f,y)===null}},o=()=>{for(let c of e.pagesLayer.querySelectorAll(t))c.disabled=!r(c)?.enabled;},i=c=>{let d=n(c.target);d&&(c.stopPropagation(),r(d)?.enabled||c.preventDefault());},a=c=>{let d=n(c.target);d&&(d.disabled=!r(d)?.enabled);},s=c=>{let d=n(c.target);if(!d)return;c.stopPropagation();let u=r(d);if(!u)return;if(!u.enabled||!e.apply(u.op)){d.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(p=>{let g=p.closest("[data-start][data-paragraph-id]");return g?.dataset.paragraphId===u.paragraphId&&Number(g.dataset.start)===u.field.start})?.focus({preventScroll:true});},l=new(Ae(e.pagesLayer)).MutationObserver(c=>{for(let d of c)for(let u of d.addedNodes){if(!qt(u))continue;let f=u.matches(t)?[u]:u.querySelectorAll(t);for(let p of f)p.disabled=!r(p)?.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(c){let d=n(c.target);if(!d)return false;c.stopPropagation();let u=c.key.toLowerCase();return (c.ctrlKey||c.metaKey)&&!c.altKey&&(u==="z"||u==="y")?(c.preventDefault(),e.pagesLayer.focus({preventScroll:true}),e.history(u==="y"||c.shiftKey?"redo":"undo"),true):(!r(d)?.enabled&&c.key!=="Tab"&&c.preventDefault(),true)},destroy(){l.disconnect(),e.pagesLayer.removeEventListener("pointerdown",i,true),e.pagesLayer.removeEventListener("focusin",a),e.pagesLayer.removeEventListener("change",s);}}}function EM(e,t){let n=fb$2(e,t.id);for(let i=0;n&&i<64&&(n.namespaceUri===pa$2&&n.localName==="customXml"||ld(n)||md(n));i+=1)n=fb$2(e,n.id);if(!n)return [];let r=pd(n.children),o=r.findIndex(i=>i.id===t.id);return o>=2?r.slice(o-2,o):[]}function CM(e){let t=n=>n.kind==="textValue"?/^[ \t\u00a0]*$/.test(n.value):n.namespaceUri!==pa$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 OM(e,t,n,r,o,i,a,s){let l=eb$1(e,n.paragraphId);if(l?.kind!=="paragraph")return null;let[c,d]=EM(e,l);if(d?.kind!=="paragraph"||c?.kind!=="paragraph"||!CM(d))return null;let u=cb$1(t,l.id),f=cb$1(t,c.id);if(!u||u.numId!==f?.numId||u.level!==f.level||cb$1(t,d.id))return null;let p=(E,I,P,C)=>({id:E,kind:I,localName:P,namespaceUri:pa$2,prefix:"w",namespaceBindings:[],attributes:[],children:C}),g=l.children.find(E=>E.kind==="paragraphProperties"),b=g&&{...g,children:g.children.filter(E=>E.localName!=="sectPr")},y=Bk({localName:"pStyle",attributes:{val:o}},"separator-style"),h=r.map((E,I)=>Bk(E,`separator-format-${I}`));a&&h.push(Bk({localName:"ins",attributes:{id:Nb$1(e,s)(),author:a.author,...a.date?{date:a.date}:{}}},"separator-insertion"));let x=p("separator-mark","runProperties","rPr",h),w=p("separator-properties","paragraphProperties","pPr",[...y?[y]:[],...h.length?[x]:[]]),v=[...w.children],k=i?.styles.has(o)?w:p("separator-defaults","paragraphProperties","pPr",[]);return i&&Kd(mf$1(i,k).paragraphPropertyNodes)&&v.splice(y?1:0,0,p("separator-numbering","generic","numPr",[Bk({localName:"numId",attributes:{val:"0"}},"separator-number-id")])),{op:"insertFragment",paragraphId:l.id,offset:n.offset,blocks:[p("separator-head","paragraph","p",b?[b]:[]),p("separator-blank","paragraph","p",[p("separator-properties-final","paragraphProperties","pPr",v)])],lastMarkCovered:true}}function MM(e,t=true){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:t})??false}function Sb(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}var AM=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve","revision-attribution"]);var bW="list paragraph",vW="ListParagraph";function LM(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function Wf(e){let t=null;for(let n of e)if(n.type==="paragraph"){if(n.name.trim().toLowerCase()===bW)return n.styleId;t===null&&n.styleId===vW&&(t=n.styleId);}return t}function FM(e){let{session:t}=e,n;function r(){let o=t.stylesRoot();return (n===void 0||n.root!==o)&&(n={root:o,styleId:lf$1(o,t.documentThemeFonts()).defaultParagraphStyleId}),n.styleId}return {applyOps(o){let i=Wf(t.documentStyles());if(i===null)return [];let a=r(),s=e.storyPart(),l=[];for(let c of o){let d=ci$1(s,c),u=LM(d);u!==void 0&&u!==a||l.push({op:"setParagraphProperties",paragraphId:c,properties:ei$1(d,{localName:"pStyle",attributes:{val:i}})});}return l},clearOp(o){let i=Wf(t.documentStyles());if(i===null)return null;let a=ci$1(e.storyPart(),o);return LM(a)!==i?null:{op:"setParagraphProperties",paragraphId:o,properties:a.filter(s=>s.localName!=="pStyle")}}}}function DM(e,t){return h$3(t,n=>n("style",{type:"paragraph",styleId:t},[n("name",{val:"List Paragraph"}),...e?[n("basedOn",{val:e})]:[],n("uiPriority",{val:"34"}),n("qFormat"),n("pPr",{},[n("ind",{left:"720"}),n("contextualSpacing")])]))}function qf(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,c=qt(l)?l.closest("[data-docx-cc-widget]"):null;l&&(e.contains(l)||c?.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 NM(e,t,n,r,o){let a=Se(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,c=s.contentBox.x-s.box.x,d=s.contentBox.y-s.box.y;return {left:(s.box.x+l+c+a.box.x)*t,top:(s.box.y+d+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 HM(e){return e.kind==="textValue"?e.value:e.localName==="sdtPr"?"":e.children.map(HM).join("")}function kb(e,t){let n=e?HM(e):"";return t.find(r=>r.displayText===n)?.value??n}function _M(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 xW=["dropdown","comboBox","date","checkbox","picture","buildingBlockGallery"];function BM(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||!xW.includes(i))return false;let a=new AbortController;t={controller:a,id:o};let s=()=>!n&&t?.controller===a&&!a.signal.aborted,l=()=>s()&&_M(e.find(o))===i&&e.allowed(o),c=e.find(o),d=e.items(o).map(b=>({...b})),u=kb(c,d),f=i==="picture"?e.picture(o):void 0;if(i==="picture"&&!f)return r(),false;let p=false,g={controlId:o,kind:i,items:d,value:i==="date"?e.date(o)??"":i==="checkbox"?String(e.checked(o)):i==="picture"?f: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(p||!l())return false;p=true;try{return await e.replaceImage(o,b,()=>l()&&e.picture(o)===f)?(s()&&r(),!0):!1}finally{p=false;}}}:{}};return e.setOpen(o,true),e.request(g)?true:(g.cancel(),false)}}}function $M(e,t){if(!e)return [];if(t&&qM(e))return bj$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 WM(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 qM(e){return _M(e&&e.kind!=="textValue"?e:null)==="buildingBlockGallery"}function KM(e,t,n,r){if(!e||!qM(e))return [{op:"setContentControlValue",controlId:n,value:r}];let o=bj$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 UM(e){let t=-1,n=true;return ()=>{let r=e.packageRevision();return t!==r&&(t=r,n=!_j$1(e.settingsRoot()).doNotShadeFormData),n}}var ia="switch to field results before editing a form value";function jM(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&&eb$1(a,i.paragraphId);if(s?.kind!=="paragraph")continue;let l=o?Math.min(n.offset,r.offset):i.offset,c=o?Math.max(n.offset,r.offset):i.offset,d=Ei(s);if(ph$1(s).filter(f=>f.addressing==="editable-result").map(f=>{let p=d.spanOf(f.node)?.start??0,g=p;for(let b of f.removeNodeIds)g=Math.max(g,d.spanOf(b)?.end??g);return {start:p,end:g}}).some(f=>l===c?l>=f.start&&(l<f.end||f.start===f.end):l<f.end&&c>f.start))return true}return false}function VM(e,t,n,r){let o=e.contentControlId?Se(t).find(d=>d.id===e.contentControlId):void 0,i=Po(n).filter(d=>d.toc.id===e.id),a=i.some(d=>d.start>0||d.end<d.length);if(o&&!a)return {tocId:e.id,boundary:o,additional:false};let s=new Map(i.map(d=>[d.paragraphId,d])),l=i.filter(d=>d.start>0||d.end<d.length).flatMap(d=>Ye(t,{anchor:{paragraphId:d.paragraphId,offset:d.start},head:{paragraphId:d.paragraphId,offset:d.end}},[d.paragraphId],r)),c=t.pages.flatMap(d=>{let u=Ja(d).filter(y=>{let h=s.get(y.paragraphId);return h&&h.start===0&&h.end===h.length}).map(jc$1);if(u.push(...l.filter(y=>y.pageIndex===d.index)),u.length===0)return [];let f=Math.min(...u.map(y=>y.x)),p=Math.min(...u.map(y=>y.y)),g=Math.max(...u.map(y=>y.x+y.width)),b=Math.max(...u.map(y=>y.y+y.height));return [{pageIndex:d.index,box:{x:f,y:p,width:g-f,height:b-p}}]});return c.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:c}}}var wW="there is no table of contents to remove",Kf="the table of contents cannot be removed",GM={locked:"the table of contents is locked",bound:"the table of contents is bound to data","carries-section-mark":"the table of contents holds a section break","not-a-block":"the table of contents holds a table or a content control"};function SW(e,t){let n=t.indexOf(e.endParagraphId),r=t.indexOf(e.beginParagraphId),o=(n>=0?t[n+1]:void 0)??(r>0?t[r-1]:void 0);return o===void 0?void 0:{paragraphId:o,start:0,end:0}}function zM(e){function t(a){let s=SW(a,e.session.paragraphIds());return s&&e.pointedTocId()===a.id&&e.select({paragraphId:s.paragraphId,offset:0}),s}function n(a){if(e.editingMode()==="view"||!e.session.editable)return false;let s=e.target(a);if(!s||!Eh$1(e.session.part(),e.session.documentOutline(),s.instruction))return false;let l={op:"rewriteTocPageNumbers",tocId:s.id,updates:[]};return xn$1(e.session.part(),l)===null}function r(a){let s=e.target(a);if(!s)return {refusal:{code:"notFound",reason:wW}};let l={op:"removeToc",tocId:s.id},c=xn$1(e.session.part(),l),d=c?GM[c]??Kf:e.writeRefusal([l]);return {op:l,toc:s,refusal:d?{code:"unsupported",reason:d}:null}}function o(a){return e.session.editable?r(a).refusal:{code:"unsupported",reason:Kf}}function i(a){let{op:s,toc:l,refusal:c}=r(a);if(!s||!l||c)return e.refuse(c?.reason??Kf,"table-of-contents-refused"),false;let d,u=e.session.subscribe(p=>{p.caret&&(d=p.caret);}),f;try{f=e.apply([s],t(l));}finally{u();}if(!f.committed){let p=f.reason??Kf;return e.refuse(GM[p]??p,p),false}return d&&e.select({paragraphId:d.paragraphId,offset:d.start}),e.removed(),true}return {canRefreshToc:n,pointAtToc:t,removal:{removeTocRefusal:o,removeToc:i}}}var ZM=new WeakMap;function XM(e,t,n,r){ZM.set(e,(o,i)=>{let a=t();e.flushPendingInput();try{n(o),r();}catch(s){throw i&&(n(a),r()),s}});}function Ib(e,t,n=true){let r=ZM.get(e);if(!r)throw new Error("Surface does not support measurement updates");r(t,n);}var Uf=new WeakMap,kW=96;function YM(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 QM(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};Uf.set(e,i),YM(i);let a=()=>{let s=r.parentElement?.querySelector(":scope > .docx-pages"),l=s?.querySelector(":scope > .docx-page");r.hidden=!s||!l,!(!s||!l)&&(r.style.left=l.style.left,r.style.top=s.style.height,r.style.width=l.style.width,r.style.height=`${kW}px`);};return t.append(r),a(),{place:a,remove:()=>{Uf.get(e)===i&&(Uf.delete(e),r.remove(),i.host?.publish(null));}}}function Rb(e,t){let n=Uf.get(e);if(!n||n.host===t)return;let r=n.host;n.host=t,r?.publish(null),YM(n),t?.publish(n.status);}var kc=64,Eo=new WeakMap,ni=new WeakMap,IW=48;function PW(e,t){Eo.set(e,t);}function Ic(e,t){let n=Eo.get(e);if(!n)return true;let r=n(t);return r&&Eo.delete(e),r}function Or(e){return Eo.has(e)}var TW=6e4,EW=300,CW=16,eA=4096;function OW(e,t,n){let r=0,o=e;for(;o<t&&o-e<eA&&(o-e<CW||r<TW);)r+=AW(n(o)),o+=1;return o}function MW(e,t,n){let r=[];for(let o=e;o<t;o+=1){let i=n(o);if(i?.kind==="table"){for(let a of i.children)r.push(a);r.push(i);}}return r}var JM=new WeakMap;function AW(e){if(typeof e!="object"||e===null)return 1;let t=JM.get(e);if(t!==void 0)return t;let n=1,r=[e];for(;r.length>0;){let o=r.pop();if(o.kind==="textValue")n+=o.value?.length??0;else if(o.children)for(let i of o.children)r.push(i);}return JM.set(e,n),n}function tA(e,t,n,r){let o=r,i=n.now(),a=null,s=null,l=[],c=0,d=()=>{let x=a;a=null,x&&Xf$1(x);},u=(x,w=false)=>{if(!w&&n.composing())return false;let v=n.now()+(ni.has(e)?Math.max(x,IW):x);for(;n.limit()!==null&&!n.destroyed();){if(!a){if(n.busy()){if(!w)return false;n.finishBusy();}let P=n.limit(),C=n.bodyBlockCount();if(C!==void 0&&P>=C)return n.finish(),w&&n.busy()&&n.finishBusy(),true;s===null&&(s=C===void 0?P+o:OW(P,C,O=>n.bodyBlock(O)),l=MW(P,s,O=>n.bodyBlock(O)),c=0);for(let O=0;c<l.length;O+=1){if(O>0&&(n.now()>=v||n.inputPending()))return false;gf$1([l[c++]]);}if(s<=n.limit()){s=null;continue}n.setLimit(s),a=n.prefixPass(s),s=null;}let k;do k=a.next();while(!k.done&&n.now()<v&&!n.inputPending());if(!k.done)return false;a=null;let E=ni.get(e),I=E?.covers(k.value)===true;if(n.limit()!==null&&(I||n.now()-i>=EW)&&(n.publish(k.value),i=n.now()),I&&(ni.delete(e),E.reveal()),o=Math.min(eA,o*2),n.now()>=v||n.inputPending())return false}return true};if(t().removeAttribute("data-docx-opening-preview"),n.limit()===null)return {finishPaused:d,stop:()=>{}};t().setAttribute("data-docx-opening-preview",""),t().setAttribute("data-docx-layout-pending","");let f=QM(e,t()),p=()=>{ni.delete(e);},g=["pointerdown","keydown","wheel"],b=n.pages();for(let x of g)b.addEventListener(x,p,{capture:true});let y=false,h=()=>{if(!y){y=true,Eo.delete(e),a=null,s=null,l=[];for(let x of g)b.removeEventListener(x,p,true);t().removeAttribute("data-docx-opening-preview"),n.busy()||t().removeAttribute("data-docx-layout-pending"),f.remove();}};return PW(e,(x,w)=>{if(!u(x,w))return f.place(),false;h();let k=ni.get(e);return ni.delete(e),n.destroyed()||k?.reveal(),true}),{finishPaused:d,stop:h}}function ri(e){if(!Eo.has(e))return false;for(;!Eo.get(e)?.(Number.POSITIVE_INFINITY,true)&&Eo.has(e););return true}function LW(e){ni.delete(e);}function FW(e,t,n,r,o){if(!Eo.has(e)||typeof t!="number"&&!r(t.paragraphId))return false;let i=s=>typeof t=="number"?s.pages.length>t:Re(s,t)!==null,a=o();return ni.set(e,{covers:i,reveal:()=>{Math.abs(o()-a)<1&&n();}}),true}function nA(e,t){return {begin(){t.flushLayout(),LW(e());},later(n,r){return t.scroller()!==null&&FW(e(),n,r,o=>t.paragraphIds().includes(o),()=>t.scroller()?.scrollTop??0)}}}function rA(e,t,n,r){let o=r?.offsetPx??24,i=r?.block??"start",a=e.clientHeight;if(i==="nearest"||i==="centerIfNeeded"){let c=t<e.scrollTop,d=t+n>e.scrollTop+a;if(!c&&!d)return false}let s=i==="center"||i==="centerIfNeeded"?t-Math.max(0,(a-n)/2):i==="nearest"&&t>e.scrollTop?t+n+o-a:t-o,l=Math.max(0,e.scrollHeight-a);return e.scrollTo({top:Math.max(0,Math.min(s,l)),behavior:r?.behavior??"auto"}),true}var DW=40,NW=12,HW=8;function Pb(e,t){if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);return}(t??globalThis).setTimeout(e,0);}function BW(e,t){let n=t??globalThis;if(typeof n.requestAnimationFrame=="function"){n.requestAnimationFrame(()=>Pb(e,t));return}Pb(e,t);}function oA(e){let t=null,n=0,r=(l,c)=>{l&&e.passTimed?.(c);},o=l=>{let c=t===null!=(l===null);t=l,c&&e.pendingChanged?.(l!==null);},i=(l,c)=>{e.revision()===c&&e.publish(l);},a=()=>{let l=t;if(!l)return;let c=e.now(),d=c+NW;for(;;){let u=l.steps.next();if(!u.done&&u.value?.wrapUp&&(l.wrapUp=u.value.wrapUp),u.done){o(null),i(u.value,l.revision),r(l.timed,l.spent+e.now()-c);return}if(e.now()>=d)break}l.spent+=e.now()-c,Pb(a,e.view?.());},s=()=>{let l=t;if(!l)return;let c=e.now();o(null),i(Xf$1(l.steps),l.revision),r(l.timed,l.spent+e.now()-c);};return {run(l,c,d=true){let u=e.snapshot(),f=e.now(),p=d?n:0;d&&(n=0);let g=f+DW,b=e.pageAfterView(),y=e.current(),h=e.partial?.()===true,x=null;for(;;){let w=l.next();if(w.done)return r(d,p+e.now()-f),w.value;if(w.value&&(x=w.value),b===void 0||!x?.finalize||x.pages.length<=b||e.now()<g||!y||!h&&!x.settled&&y.pages.length-x.pages.length<HW)continue;let v=x.settled?x.pages:[...x.pages,...y.pages.slice(x.pages.length)];return o({steps:l,revision:c,restore:u,spent:p+e.now()-f,timed:d,restorable:x.restorable!==false,wrapUp:x.wrapUp,settled:x.settled===true}),BW(a,e.view?.()),x.finalize(v)}},finish:s,abandon(){let l=t;if(l){if(l.settled){o(null),l.timed&&(n+=l.spent);return}if(!l.restorable)return l.wrapUp?.(),s();o(null),l.restore(),l.timed&&(n+=l.spent);}},pending:()=>t!==null,cancel(){o(null);}}}var $W=1e3,WW=12,iA=100;function aA(e,t){let n=o=>{let i=o.fragments[0];if(!i)return "";let a=i.kind==="paragraph"?i.lines[0]:void 0;return `${i.id}:${a?.range.start??""}`},r=o=>(o.footnotes?.notes??[]).map(i=>`${i.noteId}${i.continuation?"c":""}:${i.box.height}`).join(",");return `${e.pages.map(o=>`${n(o)}/${r(o)}`).join("|")}#${ng$1(t)}`}function sA(e){let t=null,n=false,r=false,o=null,i=()=>{t?.(),t=null;},a=(l,c)=>{i(),!r&&(t=e.schedule(()=>{t=null,r||l();},c));},s=()=>{if(e.busy())return a(s,iA);let l=e.live().notePageBottomReserves,c=e.current();if(!l||!c)return;let d=aA(c,l);if(d===o)return;let u=e.revision(),f=e.createSession(),p=e.pass(u,f),g=()=>{if(e.revision()!==u)return;let y=e.now()+WW;for(;;){let h=p.next();if(h.done)return b(h.value);if(e.now()>=y)break}a(g,0);},b=y=>{if(e.revision()!==u)return;if(e.busy())return a(()=>b(y),iA);let h=e.live().notePageBottomReserves,x=f.notePageBottomReserves??new Map;if(h&&mg$1(h,x)){o=d;return}n=true;try{e.adopt(f,y);}finally{n=false;}o=aA(y,x);};g();};return {request(){n||r||a(s,$W);},cancel(){r=true,i();}}}var qW=1e4;function lA(e){let t=null,n=()=>{let a=[],s=new Set([e.part()]);for(let l of e.headerFooterPartsBySection())for(let c of [l.headers,l.footers])for(let d of c.values())s.has(d)||(s.add(d),a.push(d));for(let l of ["footnote","endnote"]){let c=e.partFor({kind:"notesPart",noteKind:l});!c||s.has(c)||(s.add(c),a.push(c));}return a},r=(a,s)=>a.length===s.length&&a.every((l,c)=>l===s[c]),o=a=>{let s=eb$1(e.part(),a);if(!s||s.kind!=="paragraph")return false;let l=0,c=[...s.children];for(;c.length>0;){let d=c.pop();if(++l>qW)return false;if(d.kind!=="textValue"){if(d.namespaceUri===pa$2&&d.localName==="p")return false;for(let u of d.children)c.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:f}=l.split,p=s.get(u);if(p===void 0||s.has(f)||a.deleted.length>0||a.created.length!==1||a.created[0]!==f||!o(u)||!o(f))return false;for(let[g,b]of s)b>p&&s.set(g,b+1);return s.set(f,p+1),true}let{kept:c,removed:d}=l.join;return !s.has(c)||a.created.length>0||a.deleted.length!==1||a.deleted[0]!==d||!o(c)?false:(s.delete(d),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,c=u=>{let f=l.size;for(let[p,g]of u)l.has(p)||l.set(p,f+g);};c(Sk(e.part()));let d=n();for(let u of d)c(Sk(u));return t={packageRevision:a,bodyRoot:s,index:l,otherParts:d},l}}}var KW=`revision-${nl}`,hs=new WeakMap;function ys(e){return e?hs.get(e)??null:null}function jf(e){let t=hs.get(e);return t?[e,t.deletion,t.insertion]:[e]}var cA=pl,dA=new WeakMap;function UW(e,t,n){let r=dA.get(e);if(r&&hs.get(r)?.insertion===t)return r;let o=t.date??e.date,i={kind:"revision",id:ol(e.id,t.id),address:n.address,addresses:[...e.addresses,...t.addresses],replacedText:e.text,revisionKind:"replace",author:t.author,...o!==void 0?{date:o}:{},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 hs.set(i,{deletion:e,insertion:t}),dA.set(e,i),kl(i,[...ll(e),...ll(t)])}function pA(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],c=s.revisionKind==="insert",d=t[a+2];if(c&&d&&cA(l,d))continue;let[u,f]=c?[l,s]:[s,l];if(!cA(u,f))continue;let p=UW(u,f,s);n.set(s,p),r.add(l),o.set(u.id,p.id),o.set(f.id,p.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 mA(e,t){let n=`${Tb(t)}|${[...t?.excludeRevisionKinds??[]].sort().join(",")}`,r=uA.get(e),o=r?.get(n);if(o)return o;let i=jW(e,t);return r||uA.set(e,r=new Map),r.set(n,i),i}var uA=new WeakMap;function jW(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(Tb(t)){let s=pA(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:c,...d}=s;return d})}function Vf(e,t,n){if(t===null)return new Set;let r=n?VW(e(),t):null;return new Set(r===null?[t]:[t,r])}function VW(e,t){for(let n of pA(e).items){let r=hs.get(n);if(!r)continue;let o=ml(r.deletion),i=ml(r.insertion);if(o===t)return i;if(i===t)return o}return null}function gA(e,t){let n=null;return {set:r=>n=r,lightsPair:()=>e()||n!==null&&t()?.activatedReviewKey()===n}}function Tb(e){return e?.pairReplacements!==false}function oi(e){return e.startsWith(KW)}function Xr(e,t){let n={placement:false,pairReplacements:oi(t)};return e(n).find(r=>r.key===t)}function bs(e){let t=hs.get(e);return t?[ml(t.deletion),ml(t.insertion)]:[ml(e)]}function Eb(e,t,n){return t===null||!Tb(n)?t:e({...n,placement:false}).find(o=>oi(o.key)&&bs(o.item).includes(t))?.key??t}function Cb(e,t){let n=oi(t.key)?t.key:Eb(e,t.key,{pairReplacements:true});return n!==null&&oi(n)?{...t,pairKey:n}:t}function hA(e,t){if(!t.skipped.length)return t;let n=new Map;for(let r of e({placement:false,pairReplacements:true}))if(oi(r.key))for(let o of bs(r.item))n.set(o,r.key);return {...t,skipped:t.skipped.map(r=>{let o=n.get(r.key);return o===void 0?r:{...r,pairKey:o}})}}var fA=new WeakMap;function yA(e){let t=fA.get(e);if(!t){let n=new Map;for(let r of e)n.set(ml(r),r);fA.set(e,t=n);}return t}var bA=2,vA=100;function*xA(e,t){if(!t||t.size===0)return yield*e;let n=1/0,r=-1/0;for(let l of t)n=Math.min(n,l),r=Math.max(r,l);let o=l=>l<n-bA||l>r+bA,i;for(;;){let l=ed(o,()=>e.next());if(l.done){i=l.value;break}let c=l.value,d=c?.finalize;yield c&&d?{...c,finalize:u=>ed(o,()=>d(u))}:c;}let a=i.pages.length,s=i.pages.findIndex(l=>fd(l,a));if(s<0)return i;for(;s<a;s+=vA){let l=i;yield {pages:l.pages,finalize:()=>l,settled:true},i=gd(i,s,s+vA);}return i}var ZW=createT(en);function lr(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return ZW(t)}}var wA=new WeakMap;function Gf(e,t){let n=new Map;return wA.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 SA(e,t){let n=wA.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 kA(e,t){let n=e.ownerDocument.defaultView;if(!n)return;if(n.getComputedStyle(e).position==="fixed"){let P=t.getBoundingClientRect();e.style.maxHeight="";let C=Number.parseFloat(n.getComputedStyle(e).maxHeight),O=Number.isFinite(C)?C:n.innerHeight;e.style.maxWidth=`${Math.max(0,n.innerWidth-16)}px`,e.style.maxHeight=`${Math.max(0,Math.min(O,n.innerHeight-16))}px`;let S=e.getBoundingClientRect(),T=Math.max(0,n.innerHeight-8-P.bottom-4),B=Math.max(0,P.top-8-4),W=S.height>T&&B>T,q=Math.min(S.height,W?B:T);e.style.maxHeight=`${q}px`,e.style.left=`${Math.max(8,Math.min(P.left,n.innerWidth-8-S.width))}px`;let U=W?P.top-4-q:P.bottom+4;e.style.top=`${Math.max(8,Math.min(U,n.innerHeight-8-q))}px`,e.dataset.placement=W?"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),c=Math.max(0,a?.top??0),d=Math.min(n.innerHeight,a?.bottom??n.innerHeight);e.style.maxWidth=`${Math.max(0,l-s)}px`,e.style.maxHeight=`${Math.max(0,d-c)}px`;let u=e.getBoundingClientRect(),f=d-o.bottom,p=o.top-c,g=u.height>f&&p>f,b=Math.max(0,g?p:f);e.style.maxHeight=`${Math.max(0,Math.min(d-c,b))}px`;let y=Math.min(u.height,b),h=Math.max(s,Math.min(o.left,l-u.width)),x=Math.max(c,g?o.top-y:o.bottom),w=r.getBoundingClientRect(),v=r.offsetWidth?w.width/r.offsetWidth:1,k=r.offsetHeight?w.height/r.offsetHeight:1;e.style.left=`${(h-w.left)/v-r.clientLeft+r.scrollLeft}px`,e.style.top=`${(x-w.top)/k-r.clientTop+r.scrollTop}px`,e.dataset.placement=g?"top":"bottom";}function Rc(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 c=[...r.querySelectorAll("[data-docx-content-control]")].find(d=>d.dataset.docxContentControl===o)?.querySelector(".docx-content-control-boundary");c&&(s?.unobserve(i),i=c,s?.observe(i));}i.isConnected&&kA(e,i);},s=typeof n?.ResizeObserver=="function"?new n.ResizeObserver(a):null;s?.observe(e),s?.observe(i);let l=typeof n?.MutationObserver=="function"?new n.MutationObserver(a):null;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 Pc(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 XW(e){let t=e?.ownerDocument??(typeof globalThis.document>"u"?null:globalThis.document),n=t?.activeElement;return n&&n!==t?.body?n:e?.closest(".docx-pages")??null}var Ob="image/png,image/jpeg,image/gif,image/bmp,image/webp",YW=new Set(Ob.split(",")),QW=8;function JW(e){if(!e||e.kind==="textValue")return;let t=(n,r)=>{if(!(n.kind==="textValue"||r>QW)){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 IA(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}));},c=u=>JW(e.find(u)),d=async(u,f,p=()=>true)=>{if(s||!p()||!e.allowed(u))return false;if(f.byteLength>r$2.maxEncodedBytes)return e.reject("image-resource-limit"),false;let g=c(u);if(!g)return e.reject("no-picture"),false;let b=Of$1(f);if(!YW.has(b))return e.reject("unsupported-image"),false;let y=await e.replaceImage(g,f,b,()=>!s&&p()&&e.allowed(u)&&c(u)===g);return y.ok?true:(e.reject(y.detail??y.reason),false)};return {drawingOf:c,replace:d,cancel:l,select(u){let f=c(u),p=f?Fe(e.layout(),f):null;return p?e.selectDrawing(f,p.record.paragraphId):false},pick(u){if(l(),s||!e.allowed(u))return;let f=a,p=()=>!s&&a===f;if(!c(u)){e.reject("no-picture");return}let g=e.document.createElement("input");g.type="file",g.accept=Ob,g.className="docx-content-control-picture-picker",g.dataset.docxMarker="",g.dataset.docxCcId=u,g.setAttribute("contenteditable","false"),g.setAttribute("aria-hidden","true"),g.tabIndex=-1;let b=lr(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 h=e.document.createElement("div");h.className="docx-content-control-widget-error",h.setAttribute("role","alert"),h.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",w=>w.stopPropagation()),y.addEventListener("keydown",w=>{Pc(y,w,l),w.stopPropagation();}),y.append(h,x),g.addEventListener("change",()=>{let w=g.files?.[0];!w||!p()||(g.value="",g.disabled=true,(async()=>{let v=false;try{w.size>r$2.maxEncodedBytes?e.reject("image-resource-limit"):v=await d(u,new Uint8Array(await w.arrayBuffer()),p);}catch{p()&&e.reject("image-read-failed");}if(!p())return;if(v){l();return}g.disabled=false,g.className="docx-content-control-picture-input",g.removeAttribute("aria-hidden"),g.tabIndex=0,g.setAttribute("aria-label",b("contentControl.types.picture")),g.setAttribute("aria-invalid","true"),y.prepend(g),y.hidden=false;let k=[...e.layer.querySelectorAll("[data-docx-content-control]")].find(E=>E.getAttribute("data-docx-content-control")===u)?.querySelector(".docx-content-control-boundary");i?.(),o?.(),k&&(i=Rc(y,k)),o=qf(y,l),g.focus();})());}),g.addEventListener("cancel",l),e.layer.append(g),(e.layer.closest(".docx-editor__scroll-container")??e.layer).append(y),r=y,t=g,n=u,e.setOpen(u,true),g.click();},destroy(){s=true,l();}}}var eq=22,Mb=3;function tq(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-Mb&&t<=s.right+eq&&n>=s.top-Mb&&n<=s.bottom+Mb)return i}return null}function RA(e){let t=null,n=nt(()=>e),r=0,o=null,i=c=>{c!==t&&(t?.isConnected&&delete t.dataset.hover,t=c,c&&(c.dataset.hover=""));},a=()=>{r=0,o&&i(tq(e,o.x,o.y));},s=c=>{o={x:c.clientX,y:c.clientY},n.migrate(),r===0&&(r=n.requestAnimationFrame(a));},l=()=>{o=null,i(null);};return e.addEventListener("pointermove",s),e.addEventListener("pointerleave",l),{destroy(){e.removeEventListener("pointermove",s),e.removeEventListener("pointerleave",l),n.cancelAnimationFrame(r),i(null);}}}var Tc=.25;function PA(e,t,n){let r=(s,l)=>{let c=Re(e,s,n);return c?Oe$1(e,{x:c.x+l,y:c.y+c.height/2,pageIndex:c.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 nq(e,t.head)??r(t.head,-Tc);let a=t.head.paragraphId===t.anchor.paragraphId&&t.head.offset<t.anchor.offset;return r(t.head,a?Tc:-Tc)??r(t.anchor,a?-Tc:Tc)}function nq(e,t){let n=null;for(let r of e.contentControls??[]){let o=r.range;!o||o.paragraphId!==t.paragraphId||o.end!==t.offset||o.start===o.end||(!n||r.nestingDepth>n.nestingDepth)&&(n=r);}return n}function TA(e,t,n,r,o){let i=r==="left"?-1:1,a=Re(e,t.from,o),s=Re(e,t.to,o),l=a?Ie(e,a)??1:1,c=i*l===-1?t.from:t.to;if(!a||!s||a.lineId!==s.lineId||a.pageIndex!==s.pageIndex)return c;let d=Wb$1(e,t.from.paragraphId)?.find(({line:g})=>g.id===a.lineId)?.line;if(!d?.spans.some(g=>g.style.shaping))return c;let u=n.indexOf(t.from.paragraphId),f=n.indexOf(t.to.paragraphId),p;for(let g of d.spans){let b=g.range.paragraphId,y=n.indexOf(b);if(y<u||y>f)continue;let h=Math.max(g.range.start,b===t.from.paragraphId?t.from.offset:0),x=Math.min(g.range.end,b===t.to.paragraphId?t.to.offset:1/0);if(!(h>=x))for(let w of [h,x]){let v={paragraphId:b,offset:w},k=Re(e,v,o);if(!k||k.lineId!==a.lineId||k.pageIndex!==a.pageIndex)continue;let E=k.x;(!p||(E-p.x)*i>0)&&(p={position:v,x:E});}}return p?.position??c}function EA(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}function CA(e,t,n,r){let o=lr(r),i=e.ownerDocument,a=i.createElement("dialog"),s=Gf(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 c=i.createElement("div");c.className="docx-text-form-dialog__body",s(c,`textFormField.invalid${t==="number"?"Number":"Date"}`);let d=i.createElement("div");d.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 f=false,p=()=>{f||(f=true,n());};return u.addEventListener("click",p),a.addEventListener("keydown",g=>{g.key!=="Enter"||g.isComposing||(g.preventDefault(),g.stopPropagation(),p());}),a.addEventListener("cancel",g=>{g.preventDefault(),p();}),d.append(u),a.append(l,c,d),e.append(a),a.showModal(),u.focus(),a}function OA(e,t,n,r,o){let i=lr(o),a=e.ownerDocument,s=a.createElement("dialog"),l=Gf(s,i);s.className="docx-text-form-dialog",s.setAttribute("data-docx-modal",""),l(s,"textFormField.title","aria-label");let c=a.createElement("h2");c.className="docx-text-form-dialog__header",l(c,"textFormField.title");let d=a.createElement("div");d.className="docx-text-form-dialog__body";let u=a.createElement("div");u.className="docx-text-form-dialog__footer",s.append(c,d,u);let f=(O,S)=>{let T=a.createElement("label");T.className="docx-text-form-dialog__row";let B=a.createElement("span");B.className="docx-text-form-dialog__label",l(B,O),S.className="docx-text-form-dialog__input",T.append(B,S),d.append(T);},p=a.createElement("input");p.type="text",p.value=t.defaultText,f("textFormField.defaultText",p);let g=a.createElement("select"),b=["regular","number","date"];for(let O of b){let S=a.createElement("option");S.value=O,l(S,`textFormField.${O}`),g.append(S);}if(!b.includes(t.type)){let O=a.createElement("option");O.value=t.type,l(O,"textFormField.preservedType"),O.disabled=true,g.append(O);}g.value=t.type,f("textFormField.type",g);let y=a.createElement("input");y.type="number",y.min="0",y.max="32767",y.step="1",y.value=String(t.maxLength),f("textFormField.maxLength",y);let h=a.createElement("select"),x=O=>{h.replaceChildren();let S=Gk[g.value]??[];for(let T of S){let B=a.createElement("option");B.value=T;let q={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[T];q||!T?l(B,q??"textFormField.noFormat"):B.textContent=T,h.append(B);}if(!S.includes(O)){let T=a.createElement("option");T.value=O,O?T.textContent=O:l(T,"textFormField.noFormat"),T.disabled=true,h.append(T);}h.value=O;};x(t.format),g.addEventListener("change",()=>x("")),f("textFormField.format",h);let w=a.createElement("input");w.type="checkbox",w.checked=t.enabled;let v=a.createElement("label");v.className="docx-text-form-dialog__checkbox-row";let k=a.createElement("span");l(k,"textFormField.enabled"),v.append(w,k),d.append(v);let E=a.createElement("p");E.className="docx-text-form-dialog__error",E.setAttribute("role","alert"),d.append(E);let I=a.createElement("button");I.type="button",I.className="docx-text-form-dialog__button",l(I,"textFormField.cancel"),I.addEventListener("click",r);let P=a.createElement("button");P.type="button",P.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(P,"textFormField.apply");let C=()=>{if(!y.value||!y.checkValidity()||!n(p.value,{type:g.value,maxLength:Number(y.value),format:h.value,enabled:w.checked})){l(E,"textFormField.invalidOptions");return}r();};return P.addEventListener("click",C),s.addEventListener("keydown",O=>{O.key==="Enter"&&!O.isComposing&&Ou(O.target,"input")&&(O.preventDefault(),C());}),s.addEventListener("cancel",O=>{O.preventDefault(),r();}),u.append(I,P),e.append(s),s.showModal(),p.focus(),p.select(),s}function MA(e,t,n){let r=[],o=[];for(let a of e)for(let s of Sk(a).keys()){let l=eb$1(a,s);if(l?.kind==="paragraph")for(let c of Yk(l)){let d=t.get(c.fieldNodeId);if(!d)continue;let u=(Jm(a,s)??"").slice(c.start,c.end),f=Hk(u,c,"fill",d.locale);if(f===null)return {reason:"invalidArgs"};if(f===u)continue;let p={op:"commitTextFormField",paragraphId:s,fieldNodeId:c.fieldNodeId,locale:d.locale},g=xn$1(a,p);if(g)return {reason:g};r.push(p),o.push({paragraphId:s,start:c.start,end:c.end,length:f.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 Ab=new WeakMap,zf=new WeakMap;function rq(e){for(let t of Array.from(e.children))if(t.classList.contains("docx-pages"))return t;return null}function LA(e){let t=rq(e);return (t&&zf.get(t)?.())??null}function AA(e){return [...Sk(e).keys()].flatMap(t=>{let n=eb$1(e,t);return n?.kind==="paragraph"?Yk(n):[]})}function FA(e,t){let n=lr(e.translate),r,o=false,i=new Map,a=()=>e.parts?.()??[e.part()];if(t?.length)for(let $ of a()){let H=t.filter(N=>N.partName===$.name);if(!H.length)continue;let j=AA($);for(let N of H){let D=j[N.fieldIndex];D&&i.set(D.fieldNodeId,{text:N.text,locale:N.locale});}}let s=new WeakMap,l=new WeakMap,c=($=e.part())=>{s.set($,new Map([...i].filter(([H])=>H.startsWith(`${$.name}#`))));},d=()=>(i=new Map(a().flatMap($=>[...s.get($)??[]])),l.get(e.part())??null),u=$=>{i.delete($),c();};a().forEach(c);let f=()=>{if(!i.size)return null;if(o)return "invalidState";let $=MA(a(),i,e.selection());if("reason"in $)return $.reason;if($.ops.length&&!e.editable())return "locked";let H=a();a().forEach(c);let j=i;$.ops.length&&l.set(e.part(),e.selection()),i=new Map,o=true;try{let N=$.ops.length?e.save?e.save($.ops,$.selection):"unsupported":null;return N?i=j:(delete se.dataset.fieldError,$.ops.length&&l.set(e.part(),$.selection)),a().forEach(c),N}catch(N){throw a().every(D=>H.includes(D))&&(i=j),a().forEach(c),N}finally{o=false;}};zf.set(e.pagesLayer,f);let p=()=>i.size?a().flatMap($=>AA($).flatMap((H,j)=>{let N=i.get(H.fieldNodeId);return N?[{partName:$.name,fieldIndex:j,...N}]:[]})):[];Ab.set(e.pagesLayer,p);let g,b=($,H)=>(Jm(e.part(),$)??"").slice(H.start,H.end),y=null,h=null,x=null,w=false,v=false,k=()=>{let $=x;x=null,v=false,y?.remove(),y=null,$?.abort();},E=()=>{if(!y&&!x)return;let $=e.selection();k(),!w&&(e.pagesLayer.focus({preventScroll:true}),e.select($));};function I($,H,j="plain"){g={paragraphId:$,fieldNodeId:H.fieldNodeId},e.select({anchor:{paragraphId:$,offset:H.start},head:{paragraphId:$,offset:H.end}},j==="press"?"pressed":void 0);let N=e.selection().head.paragraphId===$&&e.selection().head.offset>=H.start&&e.selection().head.offset<=H.end;N&&(h=g??h),g=void 0,N&&j==="travel"&&e.reveal?.({paragraphId:$,offset:H.start});}function P($,H){if(w)return;E();let j=e.locale?.()??"en-US",N=new AbortController;x=N;let D=()=>{if(w||N.signal.aborted||x!==N)return false;let X=eb$1(e.part($),$);return X?.kind==="paragraph"&&Yk(X).some(F=>F.fieldNodeId===H.fieldNodeId)&&e.editable()&&!e.protected($)},z={field:{...H},signal:N.signal,canApply:D,apply(X,F){if(!D()||!e.apply({op:"setTextFormFieldDefault",locale:j,paragraphId:$,fieldNodeId:H.fieldNodeId,text:X,options:F}))return false;if(w||x!==N||N.signal.aborted)return true;let K=eb$1(e.part($),$),V=K?.kind==="paragraph"?Yk(K).find(Y=>Y.fieldNodeId===H.fieldNodeId):null;return V&&I($,V),E(),true},cancel(){x===N&&!N.signal.aborted&&E();}};e.onRequest?.(z)||N.signal.aborted||(y=OA(e.container,H,z.apply,z.cancel,n));}let C=$=>{let j=$.target?.closest('[data-field-atom="form"][data-start]'),N=j?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!j||!N||!e.editable())return null;let D=eb$1(e.part(),N);if(D?.kind!=="paragraph")return null;let z=Number(j.dataset.start),X=Yk(D).find(F=>F.start<=z&&z<F.end);return X?{paragraphId:N,field:X}:null},O=null,S=$=>$.shiftKey||$.altKey||$.ctrlKey||$.metaKey,T=$=>{if(r=void 0,O=null,$.button!==0)return;let H=C($);H&&!S($)&&!e.protected(H.paragraphId)&&(O={x:$.clientX,y:$.clientY,paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId,moved:false}),g=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",T,{capture:true});let B=$=>{O&&Math.hypot($.clientX-O.x,$.clientY-O.y)>4&&(O.moved=true);},W=()=>{O=null;},q=($,H=false)=>{let j=O;if(O=null,!j||j.moved||y||$.button!==0||$.detail>1||Math.hypot($.clientX-j.x,$.clientY-j.y)>4||!e.editable()||S($)||e.protected(j.paragraphId))return;let N=eb$1(e.part(),j.paragraphId),D=N?.kind==="paragraph"?Yk(N).find(X=>X.fieldNodeId===j.fieldNodeId):null;if(!D)return;let z=e.selection();H&&(z.anchor.paragraphId!==z.head.paragraphId||z.anchor.offset!==z.head.offset)&&!(z.anchor.paragraphId===j.paragraphId&&z.head.paragraphId===j.paragraphId&&Math.min(z.anchor.offset,z.head.offset)===D.start&&Math.max(z.anchor.offset,z.head.offset)===D.end)||I(j.paragraphId,D,"press");},U=[e.listeners.onDocument("pointermove",B),e.listeners.onDocument("pointercancel",W)];e.pagesLayer.addEventListener("click",q);let Z=$=>{if($.shiftKey||$.altKey||$.ctrlKey||$.metaKey||e.pagesLayer.contentEditable==="false")return false;let H=C($);if(!H)return false;let{paragraphId:j,field:N}=H;return $.preventDefault(),I(j,N,"press"),e.protected(j)||P(j,N),true};e.pagesLayer.addEventListener("dblclick",Z);function M(){let $=e.selection();if($.anchor.paragraphId!==$.head.paragraphId)return null;let H=$.head.paragraphId,j=eb$1(e.part(),H);if(j?.kind!=="paragraph")return null;let N=Math.min($.anchor.offset,$.head.offset),D=Math.max($.anchor.offset,$.head.offset),z=Yk(j).filter(F=>F.start<=N&&F.end>=D&&(F.start===F.end||N!==D||N<F.end||e.protected(H))),X=z.find(F=>h?.paragraphId===H&&F.fieldNodeId===h.fieldNodeId)??z.find(F=>F.start===N&&F.end===D)??z[0];return X?{paragraphId:H,field:X}:null}function J(){if(r===void 0)return M();if(!r)return null;let $=eb$1(e.part(),r.paragraphId),H=$?.kind==="paragraph"?Yk($).find(j=>j.fieldNodeId===r.fieldNodeId):null;return H?{paragraphId:r.paragraphId,field:H}:null}let ee=$=>{let H=$.button===-1||$.clientX===0&&$.clientY===0?M():C($);r=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",ee);let fe=()=>{let $=J();return !!$&&e.editable()&&!e.protected($.paragraphId)&&!xn$1(e.part(),{op:"setTextFormFieldDefault",paragraphId:$.paragraphId,fieldNodeId:$.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},se=e.pagesLayer.ownerDocument.createElement("span");return se.className="docx-text-form-status",e.container.append(se),{doubleClick:Z,pointerUp:$=>q($,true),canEdit:fe,edit(){if(!fe())return false;let $=J();return I($.paragraphId,$.field,"travel"),P($.paragraphId,$.field),true},selectForDeletion($){let H=e.selection(),{paragraphId:j,offset:N}=H.head;if(!e.editable()||e.protected(j)||H.anchor.paragraphId!==j||H.anchor.offset!==N)return false;let D=eb$1(e.part(),j);if(D?.kind!=="paragraph")return false;let z=Yk(D).find(X=>X.start<X.end&&($==="backward"?X.end===N:X.start===N));return z?(I(j,z),true):false},wordDeletionBoundary($,H,j,N){let D=He($,H,j,N),z=e.selection().head.paragraphId;if(e.protected(z))return D;let X=eb$1(e.part(z),z);if(X?.kind!=="paragraph")return D;let F=Yk(X),K=F.find(Y=>Y.start<Y.end&&(j===-1?Y.end===H:Y.start===H));if(K)return j===-1?K.start:K.end;let V=D;for(let Y of F)for(let le of [Y.start,Y.end])j===-1&&le<H&&le>V&&(V=le),j===1&&le>H&&le<V&&(V=le);return V},beforeSelect($){let H=Se=>{if(g!==void 0)h=g;else if($.anchor.paragraphId!==$.head.paragraphId||h?.paragraphId!==$.head.paragraphId)h=null;else {let Ue=eb$1(e.part(),$.head.paragraphId),_e=Ue?.kind==="paragraph"?Yk(Ue).find(Je=>Je.fieldNodeId===h?.fieldNodeId):null;(!_e||Math.min($.anchor.offset,$.head.offset)<_e.start||Math.max($.anchor.offset,$.head.offset)>_e.end)&&(h=null);}return g=void 0,delete se.dataset.fieldError,Se};if(o||v)return null;if(!e.editable())return $;let j=M();if(!j||!e.protected(j.paragraphId)||!j.field.enabled||!Ik(j.field))return H($);let{field:N,paragraphId:D}=j;if((!g||g.fieldNodeId===N.fieldNodeId)&&$.anchor.paragraphId===D&&$.head.paragraphId===D&&Math.min($.anchor.offset,$.head.offset)>=N.start&&Math.max($.anchor.offset,$.head.offset)<=N.end)return H($);let z=i.get(N.fieldNodeId),X=z?.text,F=z?.locale??e.locale?.()??"en-US",K=b(D,N);if(N.type==="date"&&X===void 0)return u(N.fieldNodeId),H($);let V=Hk(K,N,"fill",F);if(V===K||V===null&&(X===void 0||X===K))return u(N.fieldNodeId),H($);o=true;let Y=e.part();c(Y);let le=i;i=new Map(le),i.delete(N.fieldNodeId);let oe;try{oe=e.apply({op:"commitTextFormField",locale:F,paragraphId:D,fieldNodeId:N.fieldNodeId}),oe||(i=le);}catch(Se){throw e.part()===Y&&(i=le),Se}finally{c(),o=false;}if(!oe){if(g=void 0,se.setAttribute("role","alert"),se.dataset.fieldError="true",se.textContent=n("textFormField.invalidValue"),V===null&&(N.type==="number"||N.type==="date")){k();let Se=new AbortController;x=Se,v=true;let Ue=()=>{if(w||Se.signal.aborted||x!==Se||(k(),w))return;let Je=e.selection(),et=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(Je);},He=eb$1(e.part(),D),st=He?.kind==="paragraph"?Yk(He).find(an=>an.fieldNodeId===N.fieldNodeId):null;if(!st||!e.editable()||!e.protected(D)||b(D,st)!==K||!st.enabled||!Ik(st)||st.type!==N.type||st.format!==N.format||Hk(K,st,"fill",F)!==null){et();return}o=true;try{if(e.apply({op:"deleteText",paragraphId:D,start:st.start,end:st.end,textFormFieldId:st.fieldNodeId})){u(st.fieldNodeId),delete se.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let an={paragraphId:D,offset:st.start};o=!1,e.select({anchor:an,head:an}),h={paragraphId:D,fieldNodeId:st.fieldNodeId};}else o=!1,et();}finally{o=false;}},_e={type:N.type,signal:Se.signal,acknowledge:Ue,cancel(){x===Se&&!Se.signal.aborted&&E();}};!e.onInvalidRequest?.(_e)&&!Se.signal.aborted&&(y=CA(e.container,N.type,Ue,n));}return null}u(N.fieldNodeId);let ae=eb$1(e.part(),D),xe=ae?.kind==="paragraph"?Yk(ae).find(Se=>Se.fieldNodeId===N.fieldNodeId):null,we=xe?xe.end-N.end:0,at=Se=>Se.paragraphId===D&&Se.offset>=N.end?{...Se,offset:Se.offset+we}:Se;return H({anchor:at($.anchor),head:at($.head)})},update(){y&&SA(y,n);let $=M(),H=e.selection(),j=!!$&&H.anchor.offset!==H.head.offset&&Math.min(H.anchor.offset,H.head.offset)===$.field.start&&Math.max(H.anchor.offset,H.head.offset)===$.field.end;for(let N of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let D=N.closest("[data-paragraph-id]")?.dataset.paragraphId,z=Number(N.dataset.start);!!$&&D===$.paragraphId&&z>=$.field.start&&z<$.field.end?N.dataset.textFormSelection=j?"whole":"caret":delete N.dataset.textFormSelection;}if(se.dataset.fieldError){se.textContent=n("textFormField.invalidValue");return}$?se.setAttribute("role","status"):se.removeAttribute("role"),se.textContent=$?n(j?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>M()?.field.fieldNodeId??null,afterApply($){$?c():d();},restoreAfterHistory:d,annotate($){(!o||$.some(j=>j.op!=="commitTextFormField"))&&c(),$.some(j=>j.op==="insertText"||j.op==="deleteText")&&delete se.dataset.fieldError;let H=M();return h=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null,$.map(j=>{if(!h||j.op!=="insertText"&&j.op!=="deleteText"||j.revision||j.paragraphId!==h.paragraphId||!e.protected(j.paragraphId))return j;let N=eb$1(e.part(),j.paragraphId),D=N?.kind==="paragraph"?Yk(N).find(F=>F.fieldNodeId===h.fieldNodeId):null,z=j.op==="insertText"?j.offset:j.start,X=j.op==="insertText"?j.offset:j.end;return !D||z<D.start||X>D.end?j:(i.has(D.fieldNodeId)||i.set(D.fieldNodeId,{text:b(j.paragraphId,D),locale:e.locale?.()??"en-US"}),{...j,textFormFieldId:D.fieldNodeId})})},keydown($){if($.key==="F10"&&$.shiftKey&&!$.altKey&&!$.ctrlKey&&!$.metaKey)return r=void 0,$.preventDefault(),e.pagesLayer.dispatchEvent(new(Ae(e.pagesLayer)).MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if($.key!=="Tab"||$.altKey||$.ctrlKey||$.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let H=[],j=[e.part().root];for(;j.length;){let V=j.pop();if(V.kind==="paragraph")for(let Y of Yk(V))e.protected(V.id)&&Y.enabled&&Ik(Y)&&!xn$1(e.part(),{op:"insertText",paragraphId:V.id,offset:Y.start,text:"x"})&&H.push({paragraphId:V.id,field:Y});else for(let Y=V.children.length-1;Y>=0;Y--){let le=V.children[Y];le.kind!=="textValue"&&j.push(le);}}if(!H.length)return false;let N=e.selection(),D=N.head,z=h?H.findIndex(V=>V.paragraphId===h.paragraphId&&V.field.fieldNodeId===h.fieldNodeId&&V.field.start<=Math.min(N.anchor.offset,D.offset)&&V.field.end>=Math.max(N.anchor.offset,D.offset)):-1,X=z>=0?z:H.findIndex(V=>V.paragraphId===D.paragraphId&&V.field.start<=Math.min(N.anchor.offset,D.offset)&&V.field.end>=Math.max(N.anchor.offset,D.offset)),F=X<0?$.shiftKey?H.length-1:0:(X+($.shiftKey?-1:1)+H.length)%H.length,K=H[F];return $.preventDefault(),I(K.paragraphId,K.field,"travel"),true},destroy(){w=true,k(),zf.get(e.pagesLayer)===f&&zf.delete(e.pagesLayer),Ab.get(e.pagesLayer)===p&&Ab.delete(e.pagesLayer);for(let $ of U)$();e.pagesLayer.removeEventListener("click",q),e.pagesLayer.removeEventListener("contextmenu",ee),se.remove(),e.pagesLayer.removeEventListener("dblclick",Z),e.pagesLayer.removeEventListener("pointerdown",T,{capture:true}),y?.remove(),y=null;}}}function DA(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 Zf=new WeakMap;function Ec(e){let t=Zf.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function NA(e){let t=Zf.get(e)??{depth:0};return t.depth++,Zf.set(e,t),()=>{--t.depth===0&&(Zf.delete(e),t.resolve?.());}}var oq=12;function Cc(e,t){if(typeof MessageChannel!="function"){t.setTimeout(e,0);return}let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);}function HA(e,t,n=oq){let r=globalThis.performance??Date;return new Promise((o,i)=>{let a=()=>{let s=r.now()+n;try{for(;;){let l=e.next();if(l.done){o(l.value);return}if(r.now()>=s)break}}catch(l){i(l);return}Cc(a,Ae(t));};a();})}async function _A(e,t,n){if(!e)throw on("notFound","no document is loaded");let r=t?Ec(t):void 0;if(r&&(await r,n()!==e))throw on("invalidState","The document changed before the pending save could finish.");return (await HA(e.saveSteps(),t)).slice().buffer}function BA(e,t,n){return WA(e,t,n,()=>e.session.save())}function $A(e,t,n){return WA(e,t,n,()=>e.session.saveSteps())}function WA(e,t,n,r){let o=()=>{if(n())throw on("destroyed","Cannot save a destroyed surface.")};if(o(),Ec(t))throw on("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),o();let i=LA(t);if(i)throw on(i,"Cannot save pending text form input. Enter a valid value in each field.");o(),e.refreshRefFieldResults(),o();let a=RM(t);ti(t,true);try{return r()}finally{ti(t,a);}}function Xf(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function qA(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=Et(n.session,a.paragraphId,{kind:"body"}),l=JSON.stringify(s),c=o.get(l)??{scope:s,ops:[]};c.ops.push(a),o.set(l,c);}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 KA(e,t){let n=Dk(e);return {get:()=>n,set(r){let o=Dk(r);n!==o&&(t(),n=o);}}}var iq=42,aq=/^(\d{4})-(\d{2})-(\d{2})/,sq=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"]),lq=new Set(["AE","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]);function aa(e){return `${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Co(e){let t=aq.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 Yf(e){let t=Dk(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&&sq.has(i))return 0;if(i&&lq.has(i))return 6}catch{}return 1}function UA(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function jA(e,t,n){return new Intl.DateTimeFormat(Dk(n),{calendar:"gregory",month:"long",year:"numeric"}).format(new Date(e,t,1))}function VA(e){let t=Dk(e),n=new Intl.DateTimeFormat(t,{calendar:"gregory",weekday:"narrow"}),r=Yf(t);return Array.from({length:7},(o,i)=>n.format(new Date(2024,0,7+(r+i)%7)))}function Lb(e,t,n={}){let r=Dk(n.locale),o=n.selected?Co(n.selected):null,i=n.today??new Date,a=new Intl.DateTimeFormat(r,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric"}),s=Yf(r),l=(new Date(e,t,1).getDay()-s+7)%7,c=[];for(let d=0;d<iq;d+=1){let u=new Date(e,t,d-l+1);c.push({iso:aa(u),day:u.getDate(),label:a.format(u),otherMonth:u.getMonth()!==t,selected:o!==null&&UA(u,o),today:UA(u,i)});}return {year:e,month:t,title:jA(e,t,r),weekdays:VA(r),days:c}}function Qf(e,t,n){let r=new Date(e,t+n,1);return {year:r.getFullYear(),month:r.getMonth()}}function Fb(e,t,n,r=false){let o=Co(e);if(!o)return null;let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},a=(o.getDay()-Yf(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?aa(o):null}function Jf(e,t){let n=Co(e);if(!n)return "";let r=Dk(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 Db(e,t){if(e.length>100)return null;let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n)){let s=Co(n);return s?aa(s):null}let r=Ek(Dk(t)),o=r.pattern.exec(Fk(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 Co(a)?a:null}function Nb(e){let t=new Intl.DateTimeFormat(Dk(e),{calendar:"gregory",month:"long"});return Array.from({length:12},(n,r)=>t.format(new Date(2e3,r,1)))}function Hb(e){let t="",n=0,r=new Intl.Collator(Dk(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(d=>!d.hasAttribute("disabled"));if(!s.length)return;let l=s.indexOf(i.ownerDocument.activeElement),c;if(o.key==="ArrowDown")c=Math.min(s.length-1,l+1);else if(o.key==="ArrowUp")c=l<0?s.length-1:Math.max(0,l-1);else if(!a&&o.key==="Home")c=0;else if(!a&&o.key==="End")c=s.length-1;else if(!a&&o.key.length===1&&o.key!==" "){let d=Date.now();t=d-n>700?o.key:(t+o.key).slice(-100),n=d;let u=[...t].every(f=>r.compare(f,o.key)===0)?o.key:t;for(let f=1;f<=s.length;f++){let p=(Math.max(-1,l)+f)%s.length;if(r.compare((s[p].textContent??"").slice(0,u.length),u)===0){c=p;break}}}c!==void 0&&(o.preventDefault(),s.forEach((d,u)=>{d.tabIndex=u===c?0:-1;}),s[c]?.focus({preventScroll:true}),s[c]?.scrollIntoView?.({block:"nearest"}));}}}var cq=0;function GA(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=>Pc(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 zA(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=Rc(e,n.element),s=new(Ae(e)).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 ep(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=lr(e.translate)("disabledReason.invalidValue"),false}function ZA(e,t,n,r,o,i){let a=GA(e,t),s=lr(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-${++cq}`,l.setAttribute("role","listbox"),l.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let c=Hb(e.locale());a.addEventListener("keydown",u=>c.keyDown(u,a));let d=r.findIndex(u=>u.value===i);for(let[u,f]of r.entries()){let p=e.document.createElement("button");p.type="button",p.className="docx-content-control-menu-item",p.dataset.docxPart="item",p.dataset.value=f.value,p.setAttribute("role","option"),p.setAttribute("aria-selected",String(f.value===i)),p.tabIndex=u===Math.max(0,d)?0:-1,p.textContent=f.displayText,p.addEventListener("click",()=>{ep(e,a,t,f.value);}),l.append(p);}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",p=>{p.key!=="Enter"||p.isComposing||(p.preventDefault(),ep(e,a,t,u.value));}),a.append(u);let f=e.document.createElement("div");f.className="docx-dialog__footer",f.dataset.docxPart="footer";for(let p of ["cancel","apply"]){let g=e.document.createElement("button");g.type="button",g.className=`docx-dialog__button${p==="apply"?" docx-dialog__button--primary":""}`,g.dataset.docxPart=p,g.textContent=s(`common.${p}`),g.addEventListener("click",()=>{p==="apply"?ep(e,a,t,u.value):e.close(a);}),f.append(g);}a.append(l,f);}else a.append(l);return a}function tp(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 XA(e,t,n,r){let o=lr(e.translate),i=GA(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?Co(n):null,s=a?aa(a):null,l=new Date,c={year:(a??l).getFullYear(),month:(a??l).getMonth()},d=null,u=Jf(s??"",e.locale()),f=h=>{ep(e,i,t,h);},p=h=>{h.addEventListener("mousedown",x=>x.stopPropagation());},g=e.document.createElement("div");g.className="docx-content-control-calendar-title docx-content-control-calendar-announcement",g.dataset.docxPart="title",g.setAttribute("aria-live","polite");let b=()=>{let h=e.document.activeElement?.dataset.docxCalendarNav,x=Lb(c.year,c.month,{locale:e.locale(),selected:s,today:l}),w=e.document.createElement("div");w.className="docx-content-control-calendar-header",w.dataset.docxPart="header";let v=e.document.createElement("button");v.type="button",v.className="docx-content-control-calendar-nav",v.dataset.docxPart="previousMonth",v.dataset.docxCalendarNav="previous",v.textContent="\u2039",v.setAttribute("aria-label",o("contentControl.calendar.previousMonth")),g.textContent=x.title;let k=e.document.createElement("button");k.type="button",k.className="docx-content-control-calendar-nav",k.dataset.docxPart="nextMonth",k.dataset.docxCalendarNav="next",k.textContent="\u203A",k.setAttribute("aria-label",o("contentControl.calendar.nextMonth")),p(v),p(k),v.addEventListener("click",()=>{c=Qf(c.year,c.month,-1),d=null,b();}),k.addEventListener("click",()=>{c=Qf(c.year,c.month,1),d=null,b();});let E=e.document.createElement("div");E.className="docx-content-control-calendar-navigation",E.dataset.docxPart="navigation";let I=e.document.createElement("select");I.className="docx-content-control-calendar-month",I.dataset.docxPart="month",I.dataset.docxCalendarNav="month",I.setAttribute("aria-label",o("contentControl.calendar.month"));for(let[Z,M]of Nb(e.locale()).entries()){let J=e.document.createElement("option");J.value=String(Z),J.textContent=M,I.append(J);}I.value=String(c.month);let P=e.document.createElement("input");P.type="number",P.min="100",P.max="9999",P.value=String(c.year),P.className="docx-content-control-calendar-year",P.dataset.docxPart="year",P.dataset.docxCalendarNav="year",P.addEventListener("keydown",Z=>{Z.key==="Enter"&&!Z.isComposing&&(Z.preventDefault(),P.blur());}),P.setAttribute("aria-label",o("contentControl.calendar.year")),I.addEventListener("change",()=>{c.month=Number(I.value),d=null,b();}),P.addEventListener("change",()=>{let Z=Number(P.value);if(!Number.isInteger(Z)||Z<100||Z>9999){P.value=String(c.year);return}c.year=Z,d=null,b();}),E.append(I,P);let C=e.document.createElement("div");C.className="docx-content-control-calendar-weekdays",C.dataset.docxPart="weekdays";for(let Z of x.weekdays){let M=e.document.createElement("span");M.textContent=Z,C.append(M);}let O=e.document.createElement("div");O.className="docx-content-control-calendar-grid",O.dataset.docxPart="grid",O.setAttribute("role","grid"),O.setAttribute("aria-label",x.title);for(let Z=0;Z<x.days.length;Z+=7){let M=e.document.createElement("div");M.className="docx-content-control-calendar-week",M.setAttribute("role","row");for(let J of x.days.slice(Z,Z+7))M.append(y(J));O.append(M);}let S=e.document.createElement("div");S.className="docx-content-control-calendar-entry",S.dataset.docxPart="dateEntry";let T=e.document.createElement("button");T.type="button",T.className="docx-content-control-calendar-today",T.dataset.docxPart="today",T.textContent=o("contentControl.calendar.today"),p(T),T.addEventListener("click",()=>f(aa(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=Jf("2006-11-22",e.locale()),B.value=u,B.addEventListener("input",()=>{u=B.value,B.removeAttribute("aria-invalid"),W.hidden=true;});let W=e.document.createElement("div");W.className="docx-content-control-widget-error",W.dataset.docxPart="error",W.setAttribute("role","alert"),W.hidden=true,W.textContent=o("disabledReason.invalidValue");let q=()=>{let Z=Db(u,e.locale());Z?f(Z):(W.hidden=false,B.setAttribute("aria-invalid","true"),B.focus());};B.addEventListener("keydown",Z=>{Z.key==="Enter"&&!Z.isComposing&&(Z.preventDefault(),q());});let U=e.document.createElement("div");U.className="docx-dialog__footer",U.dataset.docxPart="footer";for(let Z of ["cancel","apply"]){let M=e.document.createElement("button");M.type="button",M.dataset.docxPart=Z,M.className=`docx-dialog__button${Z==="apply"?" docx-dialog__button--primary":""}`,M.textContent=o(`common.${Z}`),M.addEventListener("click",Z==="apply"?q:()=>e.close(i)),U.append(M);}w.append(v,E,k,g),S.append(T,B),i.replaceChildren(w,C,O,S,W,U),tp(i,d),h==="previous"&&v.focus({preventScroll:true}),h==="next"&&k.focus({preventScroll:true}),h==="month"&&I.focus({preventScroll:true}),h==="year"&&P.focus({preventScroll:true});},y=h=>{let x=e.document.createElement("button");return x.type="button",x.className="docx-content-control-calendar-day",x.dataset.docxPart="day",x.textContent=String(h.day),x.dataset.iso=h.iso,x.setAttribute("role","gridcell"),x.setAttribute("aria-label",h.label),h.otherMonth&&(x.dataset.otherMonth=""),h.selected&&(x.dataset.selected="",x.setAttribute("aria-selected","true")),x.setAttribute("aria-selected",String(h.selected)),h.today&&(x.dataset.today="",x.setAttribute("aria-current","date")),p(x),x.addEventListener("click",()=>f(h.iso)),x.addEventListener("keydown",w=>{if(w.isComposing||w.altKey||w.ctrlKey||w.metaKey)return;let v=Fb(h.iso,w.key,e.locale(),w.shiftKey);if(!v)return;w.preventDefault();let k=Co(v);if(d=v,k.getFullYear()!==c.year||k.getMonth()!==c.month){c={year:k.getFullYear(),month:k.getMonth()},b();return}tp(i,d);}),x};return b(),i}function _b(e,t){let r=(qt(t)?t:null)?.closest("[data-docx-form-checkbox][data-start]"),o=r?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!r||!o)return null;let i=eb$1(e.part(o),o);if(i?.kind!=="paragraph")return null;let a=Number(r.dataset.start),s=_m(i).find(l=>l.start<=a&&a<l.end);return s?{paragraphId:o,field:s}:null}function YA(e){return e.shiftKey||e.altKey||e.ctrlKey||e.metaKey}function QA(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||YA(i))return;let a=_b(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=_b(e,i.target);a&&Vr(i.target)&&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=eb$1(e.part(a),a);if(s?.kind!=="paragraph")return null;let l=Math.min(i.anchor.offset,i.head.offset),c=Math.max(i.anchor.offset,i.head.offset),d=_m(s).find(u=>u.start===l&&u.end===c||l===c&&l===u.start&&e.protected(a));return d?{paragraphId:a,field:d}:null};return {keydown(i){let a=_b(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!==" "||YA(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(c=>c.dataset.paragraphId===s.paragraphId&&Number(c.dataset.start)===s.field.start)?.focus({preventScroll:true}),true},destroy(){e.pagesLayer.removeEventListener("pointerdown",n,{capture:true}),e.pagesLayer.removeEventListener("focusin",r);}}}var dq=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertComplexField","insertEquation","setFieldResult","insertInlineContentControl","insertNote","insertTable","insertTableRow","deleteTableRow","mergeTableCells","splitTableCell","setRunProperties","setParagraphProperties","setParagraphMarkProperties","setListNumbering","setListLevel","setContentControlValue"]);function JA(e){return dq.has(e.op)}function Oc(e){if(JA(e))return e.revision!==void 0;switch(e.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "insertContentControl":case "authorTable":case "splitParagraphMany":return e.revision!==void 0;default:return false}}var uq=e=>dl.has(e);function Mc(e,t,n){return e.flatMap(r=>JA(r)?!n&&uq(r.op)?[r]:[r.revision!==void 0?r:{...r,revision:t}]:r.op==="splitParagraphMany"?[{...r,revision:t}]:r.op==="splitParagraph"?[r,{op:"setParagraphMarkRevision",paragraphId:r.paragraphId,kind:"ins",revision:t}]:r.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:r.secondId,revision:t}]:[r])}function np(e,t,n,r,o){let{past:i,landing:a}=Ej$1(e,{start:t,end:n},n,r,o),s=Cj$1(e,t,i,r);return (i-t>s?a:i)-s}function $b(e){return e?.trim()||void 0}var Bb=new Map;function eL(e){let t=Bb.get(e);if(t!==void 0)return t;let n=e.trim().split(/\s+/).filter(Boolean),r=n.length===0?"?":n.slice(0,2).map(o=>o[0].toUpperCase()).join("");return Bb.size<256&&Bb.set(e,r),r}function rp(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}function vs(e,t,n){if(!e)return null;let r=Fe(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var tL="docx-field-atom--active",fq="docx-field-atom",nL=new WeakMap;function Wb(e,t,n){let r=nL.get(e);r||(r={caretKey:null,marked:[]},nL.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(tL);if(r.marked=[],r.caretKey=o,!t)return;let i=e.querySelectorAll(`.${fq}`);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(tL),r.marked.push(a));}}var rL=new WeakMap;function pq(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};Ra(r,(i,a)=>{a.textboxDepth===0||a.textboxOwner?.accessibility.hidden||a.textboxOwner?.textboxStory?.contentRotation||t.push(Bf$2(i,a.storyOrigin.x-e.contentBox.x,a.storyOrigin.y-e.contentBox.y));},o,i=>Ia$1(i,o,n));}return t}function sa(e){let t=rL.get(e);if(t)return t;let n=e.pages.map(o=>{let i=aL(o);return i.length?{...o,fragments:[...o.fragments,...i]}:o}),r=n.every((o,i)=>o===e.pages[i])?e:{...e,pages:n};return rL.set(e,r),r}function aL(e){let t=_b$1(e).flatMap(n=>{let r=n.textboxStory;return r.contentRotation?[]:r.fragments.flatMap(o=>o.kind==="paragraph"?[Bf$2(o,n.x+r.contentOffset.x,n.y+r.contentOffset.y)]:[])});return t.push(...pq(e)),t}var oL=new WeakMap,iL=new WeakMap;function qb(e){let t=oL.get(e);if(t)return t;let n=e.pages.map(o=>{let i=iL.get(o);if(!i){let{header:a,footer:s,footnotes:l,endnotes:c,...d}=o;i={...d,fragments:aL(o)},iL.set(o,i);}return i}),r={...e,pages:n};return oL.set(e,r),r}function sL(e,t,n,r){let o=$e(e,t,n,r),i=null,a=t.filter(s=>o.has(s.key)||!s.key.startsWith("comment-")?false:(i??=eb$2(e),!i.has(s.from.paragraphId)));if(a.length===0)return o;for(let[s,l]of $e(qb(e),a,n,r))o.set(s,l);return o}var mq={kind:"body"};function lL(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??=_(e.canonicalUnfilteredLayout()),n(l)):_(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},i=$(t.part(),o),a=aa$1(t.part(),o);if(!i&&a.length===0)return true;let s=[];i&&s.push({scope:mq,ops:[i]});for(let l of a)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function gq(e,t,n){return t==="all-markup"||t==="simple-markup"?oe(e,k$3(n.reviewItems()),t==="simple-markup"):e}function cL(e,t,n){return e.filter(gq(t.filterForSession(n),e.view(),n))}function dL(){let e=new WeakMap;return {record(t,n){e.set(t,[n?.cacheKey,n?.unlisted]);},moved(t,n){let[r,o]=e.get(t)??[];return n?.cacheKey!==r||n?.unlisted!==o}}}function fL(e){let t=0,n=null,r="",o=null,i=true,a=null,s="";return ()=>{let l=e.surface(),c=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,d=e.activeKey(),u=e.paneOpen(),f=e.selectionAnchor(),p=e.authorFilterKey();return (l!==n||c!==r||d!==o||u!==i||f!==a||p!==s)&&(n=l,r=c,o=d,i=u,a=f,s=p,t+=1),t}}function op(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=pb$1(t),o=null,i="accept",a=null,s="accept",l=new WeakMap,c=null,d=false,u=0,f=null,p=[],g=null,b=[],y=r,h=t,x=new Set,w="accept",v=new WeakSet,k=new WeakMap,E=new Map,I=()=>{u+=1,f=null,p=[],g=null;},P=S=>JSON.stringify([S.id,ll(S)]),C=(S,T,B)=>{let W=hq(B),q=t,U=r?.hiddenAuthors??ob$1,Z=i,M;q===h&&yq(W,x)&&(W.size===0||Z===w)?M=y:W.size===0&&q.size===0?M=void 0:M=Object.freeze({hiddenAuthors:U,includes:ee=>!q.has(ee.author)&&!W.has(ee.nodeId),includesNode:(ee,fe)=>!q.has(fe)&&!W.has(ee),excludedNodeMode:(ee,fe)=>q.has(fe)?"proposed":W.has(ee)&&Z==="reject"?"original":"proposed",cacheKey:bq(q,W,Z)});let J=[];for(let ee of S){let fe=uL(ee);fe!==null&&q.has(fe)||ee.kind==="revision"&&T.has(ee)||J.push(ee);}b=J.length===S.length?S:gm(J),g=S,v=T,y=M,h=q,x=W,w=Z,d=false,a=null,s="accept",l=new WeakMap,c=null;},O=S=>{if(S===g)return;let T=new WeakSet,B=[],W=[];try{for(let U of S){if(U.kind!=="revision")continue;let Z=!t.has(U.author),M=k.get(U);M===void 0&&(M=o?.(U)??!0,W.push([U,M])),!(Z&&M)&&(T.add(U),M||B.push(U));}}catch(U){if(d)o=a,i=s,k=l,g=c,a=null,s="accept",l=new WeakMap,c=null,u+=1;else {let Z=new WeakSet,M=[];for(let J of S){if(J.kind!=="revision")continue;let ee=E.get(P(J))??true;(t.has(J.author)||!ee)&&Z.add(J),ee||M.push(J);}C(S,Z,M);}throw d=false,U}for(let[U,Z]of W)k.set(U,Z);let q=new Map;for(let U of S)U.kind==="revision"&&q.set(P(U),k.get(U)??true);E=q,C(S,T,B);};return {get hiddenAuthors(){return r?.hiddenAuthors??ob$1},get hiddenAuthorList(){return n},get stateKey(){return String(u)},get hasFilter(){return t.size>0||o!==null},get hasPredicate(){return o!==null},filterFor(S){return o?(O(S),y):r},filterForSession(S){return o?(O(S.reviewItems()),y):r},filterItems(S){if(!o){if(t.size===0)return S;if(S===f)return p;let T=S.filter(B=>{let W=uL(B);return W===null||!t.has(W)});return f=S,p=T.length===S.length?S:gm(T),p}return O(S),b},includesRevisionItem(S){return !v.has(S)},setPredicate(S,T="accept"){return o===null&&S===null?false:S===null?(o=null,i="accept",a=null,s="accept",d=false,k=new WeakMap,l=new WeakMap,E=new Map,c=null,b=[],v=new WeakSet,y=r,h=t,x=new Set,w="accept",I(),true):(a=o,s=i,l=k,c=g,d=true,o=S,i=T,k=new WeakMap,I(),true)},isVisible:S=>!t.has(S),setVisible(S,T){if(T===!t.has(S))return false;let B=new Set(t);return T?B.delete(S):B.add(S),t=B,n=Object.freeze([...B]),r=pb$1(B),I(),true},setAllVisible(S,T){let B=T?new Set:new Set(S);return B.size===t.size&&[...B].every(W=>t.has(W))?false:(t=B,n=Object.freeze([...B]),r=pb$1(B),I(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,I(),true)}}}function pL(e,t){return t.filterItems(e)}function hq(e){let t=new Set;for(let n of e)for(let r of ll(n))t.add(r);return t}function yq(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function bq(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function uL(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function mL(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 vq=Object.freeze({mode:"atomic",run:e=>e(),wrap:e=>e,methods:e=>e,listeners:()=>{},selectsWholeFieldWhen:()=>{},edits:e=>e});function xq(e){if(e===void 0||e==="atomic")return "atomic";if(e==="editable")return "editable";throw new TypeError('Invalid fieldResults: use "atomic" or "editable"')}var Kb='fieldResults "editable" is not supported in a collaboration session: shared paragraph text keeps each field one unit';function wq(e){if(e==="atomic")return vq;let t=o=>Ug$1(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()?Vg$1(()=>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=c=>{let d=s.get(c);return d||(d=typeof c=="function"?function(u){return t(()=>c.call(this,u))}:u=>t(()=>c.handleEvent(u)),s.set(c,d)),d};Object.defineProperty(o,"addEventListener",{configurable:true,writable:true,value(c,d,u){d&&i.call(o,c,l(d),u);}}),Object.defineProperty(o,"removeEventListener",{configurable:true,writable:true,value(c,d,u){d&&a.call(o,c,s.get(d)??d,u);}});}}}function gL(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 ip(e){let t=xq(e.fieldResults);if(t==="editable"&&e.collaborationModel)throw new TypeError(Kb);return wq(t)}function ap(e,t){let n=e.part(t),r=n?eb$1(n,t):null;return r?.kind!=="paragraph"?[]:zk(r).filter(o=>o.start<o.end)}function Sq(e,t){return ap(e,t.paragraphId).find(n=>t.offset>n.start&&t.offset<n.end)}function kq(e,t){let n=(i,a)=>{let s=Sq(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 Iq(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=ap(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 hL(e,t,n){if(n.mode==="atomic")return e;let{selectForDeletion:r,wordDeletionBoundary:o,beforeSelect:i,annotate:a}=e,s=null,l=d=>s!==null&&d.anchor.paragraphId===s.anchor.paragraphId&&d.head.paragraphId===s.head.paragraphId&&d.anchor.offset===s.anchor.offset&&d.head.offset===s.head.offset;n.selectsWholeFieldWhen(()=>l(t.selection()));let c=d=>{let{anchor:u,head:f}=t.selection();if(!(u.paragraphId!==f.paragraphId||u.offset!==f.offset))return ap(t,f.paragraphId).find(p=>d===-1?p.end===f.offset:p.start===f.offset)};return Object.assign(e,{annotate:n.wrap(d=>a.call(e,l(t.selection())?d:Iq(t,d))),selectForDeletion:n.wrap(d=>{let u=t.writable()?c(d==="backward"?-1:1):void 0;if(!u)return r.call(e,d);let{paragraphId:f}=t.selection().head;return s={anchor:{paragraphId:f,offset:u.start},head:{paragraphId:f,offset:u.end}},t.select(s),true}),wordDeletionBoundary:n.wrap((d,u,f,p)=>{let g=o.call(e,d,u,f,p),b=ap(t,t.selection().head.paragraphId),y=b.find(x=>f===-1?x.end===u:x.start===u);if(y)return f===-1?y.start:y.end;let h=g;for(let x of b)for(let w of [x.start,x.end])f===-1&&w<u&&w>h&&(h=w),f===1&&w>u&&w<h&&(h=w);return h}),beforeSelect:n.wrap(d=>(l(d)||(s=null),i.call(e,kq(t,d))))})}function yL(e,t){let n,r=()=>{n!==void 0&&(n=void 0,t());};return ()=>{let o=e.ownerDocument?.defaultView??null;n!==void 0&&n===o||(n=o,o&&typeof o.requestAnimationFrame=="function"?o.requestAnimationFrame(r):queueMicrotask(r));}}var bL=Af$1;function vL(e){let{session:t,...n}=e;return Of$2({view:t,...n})}function Nt(e){return e.closest(".docx-editor__scroll-container")}function xL(e){return Number.isFinite(e.scrollWidth)?Math.max(0,e.scrollWidth-e.clientWidth):Number.POSITIVE_INFINITY}function wL(e){return Ae(e).getComputedStyle(e).direction==="rtl"}function ws(e){let t=xL(e);return wL(e)&&Number.isFinite(t)?e.scrollLeft+t:e.scrollLeft}function xs(e,t){let n=xL(e),r=Math.min(Math.max(0,t),n);e.scrollLeft=wL(e)&&Number.isFinite(n)?r-n:r;}function SL(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.width!==0||r.width!==0}function kL(e,t,n){let r=t.clientWidth/2;return SL(e,t)?(t.getBoundingClientRect().left+t.clientLeft+r-e.getBoundingClientRect().left)/n:(ws(t)-e.offsetLeft+r)/n}function IL(e,t,n,r){let o=t.clientWidth/2;if(!SL(e,t)){xs(t,n*r+e.offsetLeft-o);return}let i=t.getBoundingClientRect().left+t.clientLeft,a=e.getBoundingClientRect().left+n*r-(i+o);xs(t,ws(t)+a);}function RL(e){let t=Nt(e);t&&(t.scrollTop=0,t.scrollLeft=0);}function PL(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 TL(e,t,n){let r=Nt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=PL(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 EL(e,t,n,r){let o=Nt(e);if(!o||o.clientHeight===0)return;let i=PL(e,o,r),a=[];for(let s of [n.anchor,n.head]){let l=Re(t,s);l&&a.push(l.pageIndex);}return ga({layout:t,viewport:i,overscanPages:1,pinnedPages:a})}function Ub(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 sp(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 CL(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 OL(e,t,n,r){for(let o of t.pages){let i=e.children.item(o.index);if(i?.dataset.pageIndex!==String(o.index))continue;let a=n.pageOffsetX.get(o.index)??0;i.style.left=`${(o.box.x+a)*r}px`;}}function ML(e){let{pagesLayer:t,listeners:n}=e,r=n.onDocument("selectionchange",e.onSelectionChange),o=yL(t,e.rematerialize),i=n.onDocument("scroll",p=>{let g=Nt(e.container());!g||p.target!==g||o();},{capture:true,passive:true}),a=n.onWindow("resize",o,{passive:true}),s=null,l=null,c=null,d=false;function u(){s?.disconnect(),s=null,l=null,c=null;}function f(){if(d)return;let p=Ae(t);if(p!==l&&(u(),l=p,s=typeof p.ResizeObserver=="function"?new p.ResizeObserver(o):null),!s)return;let g=Nt(e.container());g!==c&&(s.disconnect(),c=g,g&&s.observe(g));}return f(),{schedule:o,watchScrollerSize:f,rebind(){d=false,f(),o();},suspend(){d=true,u();},destroy(){r(),i(),a(),u();}}}function AL(e){let t=new Set,n=false;function r(s){return s==="document"?Wi(e()):Ae(e())}function o(s){s.bound?.removeEventListener(s.type,s.listener,s.options),s.bound=null;}function i(s){let l=r(s.target);s.bound!==l&&(o(s),l.addEventListener(s.type,s.listener,s.options),s.bound=l);}function a(s,l,c,d){let u={target:s,type:l,listener:c,options:d,bound:null};return t.add(u),n||i(u),()=>{o(u),t.delete(u);}}return {onDocument(s,l,c){return a("document",s,l,c)},onWindow(s,l,c){return a("window",s,l,c)},rebind(){n=false;for(let s of t)i(s);},suspend(){n=true;for(let s of t)o(s);},clear(){for(let s of t)o(s);t.clear();},stale(){if(n)return false;for(let s of t)if(s.bound!==r(s.target))return true;return false}}}var Rq=["docx-paginated-surface--viewing","docx-paginated-surface--hf-editing"],Pq=["data-docx-layout-pending","data-docx-opening-preview"];function Tq(e,t){if(e===t)return;t.style.position="relative";let n=Array.from(e.childNodes);t.replaceChildren();for(let r of n)t.appendChild(r);for(let r of Rq)e.classList.contains(r)&&(e.classList.remove(r),t.classList.add(r));for(let r of Pq){let o=e.getAttribute(r);o!==null&&(e.removeAttribute(r),t.setAttribute(r,o));}e.style.removeProperty("position"),e.style.removeProperty("width"),e.style.removeProperty("height");}var LL=["focusin","pointerdown","pointerenter","wheel"],Eq=5,Cq=2e3;function Oq(e){return qt(e)?e.localName==="input"||e.localName==="textarea"||e.localName==="select"||Vr(e)&&e.isContentEditable:false}function FL(e){let t=null,n=null,r=false,o=Number.NEGATIVE_INFINITY,i=f=>{let p=f.relatedTarget;So(p)&&e.pagesLayer.contains(p)||(o=Oq(p)?Number.NEGATIVE_INFINITY:Date.now());};e.pagesLayer.addEventListener("focusout",i);let a=nt(()=>e.pagesLayer);function s(f){if(t!==null)return;let p=Nt(f),g=e.scale();n=p?{x:(ws(p)-f.offsetLeft)/g,y:(p.scrollTop-f.offsetTop)/g}:null;let b=e.pagesLayer.ownerDocument.activeElement;r=!!b&&e.pagesLayer.contains(b)||Date.now()-o<Cq;}function l(){let f=n;if(n=null,!f)return;let p=()=>{let y=e.container(),h=Nt(y);if(!h)return false;let x=e.scale();return h.scrollTop=Math.max(0,f.y*x+y.offsetTop),xs(h,f.x*x+y.offsetLeft),true};p();let g=0,b=()=>{t!==null||p()||++g>Eq||a.requestAnimationFrame(b);};queueMicrotask(b);}function c(f){s(e.container()),e.settle(),e.listeners.suspend(),e.viewport()?.suspend(),Tq(e.container(),f),e.setContainer(f);}let d=false;function u(){if(!(d||t!==null||e.destroyed()||!e.listeners.stale())){d=true;try{e.listeners.rebind(),e.viewport()?.rebind(),e.settle(),e.onHostMoved?.(e.pagesLayer.ownerDocument);}finally{d=false;}}}for(let f of LL)e.pagesLayer.addEventListener(f,u,{capture:true,passive:true});return {moveTo(f,p){if(!e.destroyed()){if(f===e.container()&&t===null)return u();c(f),t=null,e.listeners.rebind(),e.viewport()?.rebind(),(p?.focus??r)&&e.pagesLayer.focus({preventScroll:true}),e.repaint(),l();}},park(){if(e.destroyed()||t!==null)return;let f=e.pagesLayer.ownerDocument.createElement("div");c(f),t=f;},parked:()=>t!==null,heal:u,destroy(){for(let f of LL)e.pagesLayer.removeEventListener(f,u,{capture:true});e.pagesLayer.removeEventListener("focusout",i);}}}function jb(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function DL(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(h(n),(function*(){for(let f of r){let p=jb(f);p!==null&&(yield p);}})()),s=i?.value,l=s!==void 0&&s.size===a.size&&[...a].every(([u,f])=>s.get(u)===f),c=l?s:a,d=i!==null&&l&&i.styles===o?i.resolved:new Map(g$1(c,o).map(u=>[u.author,u]));return t={layout:n,items:r,styles:o,value:c,resolved:d},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function NL(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$3(o.color)??e$1(o.slot);let i=e.slots.resolve(r.value,[n]).get(n);return i===void 0?void 0:e$1(i)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:f$1(r)}),a$3(t.resolved.get(n)?.color)}}}function ii(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function _L(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 BL(e,t){let n=eb$1(e,t);if(!n||n.kind==="textValue")return null;let r=wb$1(n);return !r||!vb$1(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var Vb=new WeakMap;function Mq(e,t,n){return e.map(r=>a$3(n?.(r.name))??a$3(r.color)??a$3(t?.(r.name)))}function Aq(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}
|
|
26
|
+
`;return n}function Lq(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function Fq(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 Dq(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 HL(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function Nq(e,t){let n=sa$1(e,t.anchor.nodeId),r=sa$1(e,t.head.nodeId);if(!n||!r)return [];let o=ia$1(e,n,r);return o?oa$1(e,o.cellIds).map(i=>({...i,className:"docx-remote-selection-rect"})):[]}function $L(e,t,n,r){t=sa(t);let{scale:o,pageOffsetX:i,pages:a,colorForAuthor:s,declaredColorFor:l}=r,c=r.labelHost??null,d=Mq(n,s,l),u={layout:t,fingerprint:Aq(n,d),pagesKey:Lq(a),scale:o,offsetKey:Fq(i),labelHost:c},f=Vb.get(e);if(f&&Dq(f,e,u))return;Vb.delete(e);let p=[],g=[],b=[],y=[];for(let[v,k]of n.entries())k.kind==="cells"||HL(k)||y.push({key:String(v),from:{paragraphId:k.anchor.nodeId,offset:k.anchor.offset},to:{paragraphId:k.head.nodeId,offset:k.head.offset}});let h=y.length>0?df$1(t,y,fb$1(t),a,r.measurer):null;for(let[v,k]of n.entries()){let E=d[v],I=Re(t,{paragraphId:k.head.nodeId,offset:k.head.offset},r.measurer);if(I){let C=cf$1(t,k.head.nodeId,I.pageIndex);b.push({selection:k,...E?{color:E}:{},pageIndex:I.pageIndex,x:I.x+C.x,y:I.y+C.y});}if(k.kind==="cells"){let C=Nq(t,k);if(C.length>0){for(let O of C)p.push(O),g.push(E);continue}}if(HL(k)){let C=Re(t,{paragraphId:k.anchor.nodeId,offset:k.anchor.offset},r.measurer);if(!C)continue;let O=cf$1(t,k.anchor.nodeId,C.pageIndex);p.push({pageIndex:C.pageIndex,x:C.x+O.x,y:C.y+O.y,width:Math.max(1/o,1),height:C.height,className:"docx-remote-caret"}),g.push(E);continue}let P=h?.get(String(v));if(P)for(let C of P)p.push({...C,className:"docx-remote-selection-rect"}),g.push(E);}w$1(e,t,p,{scale:o,pageOffsetX:i}),[...e.children].forEach((v,k)=>{let E=a$3(g[k]);!E||!Vr(v)||v.style.setProperty("--doc-remote-color",E);});let x=e.ownerDocument,w=[];for(let v of b){let k=t.pages[v.pageIndex];if(!k)continue;let E=x.createElement("div");E.className="docx-remote-caret-label",c?(E.setAttribute("data-docx-remote-actor",v.selection.actorId),w.push({element:E,selection:v.selection})):E.textContent=v.selection.name,E.style.left=`${(k.contentBox.x+v.x+(i?.get(v.pageIndex)??0))*o}px`,E.style.top=`${(k.contentBox.y+v.y)*o}px`;let I=a$3(v.color);I&&E.style.setProperty("--doc-remote-color",I),e.append(E);}Vb.set(e,{...u,childCount:e.childElementCount}),c&&c.publish(w);}function lp(e,t,n){if(n<e+40){let r=Math.max(0,e+40-n);return -Math.min(12,r/40*12)}if(n>t-40){let r=Math.max(0,n-(t-40));return Math.min(12,r/40*12)}return 0}function WL(e){let t=null,n=0,r=i=>{let a=i.getBoundingClientRect();return lp(a.top,a.bottom,n)},o=()=>{t=null;let i=e.scroller(),a=i?r(i):0;!i||a===0||(i.scrollTop+=a,e.onScroll(),t=e.frames.requestAnimationFrame(o));};return {follow(i){n=i;let a=e.scroller();t===null&&a&&r(a)!==0&&(t=e.frames.requestAnimationFrame(o));},stop(){t!==null&&e.frames.cancelAnimationFrame(t),t=null;}}}function qL(e,t,n){let r=Th$1(t,n);if(!r)return [];let o=r.children.filter(c=>c.kind==="paragraph"||c.kind==="table"),i=o.findIndex(c=>c.id===n),a=new Map(o.map((c,d)=>[c.id,d===i||d===i+1])),s=[],l=(c,d,u)=>{for(let f of c){let p=f.kind==="paragraph"?f.paragraphId:f.tableId,g=a.get(p);if(f.fragmentIndex===0&&g!==void 0){let{x:b,y,width:h}=f.box;s.push({beforeBlockId:p,stays:g,pageIndex:d,x:b,y,width:h,origin:u});}if(f.kind==="table")for(let b of f.rows)for(let y of b.cells)l(y.blocks,d,u);}};return e.pages.forEach((c,d)=>{l(c.fragments,d,c.contentBox);for(let u of [c.header,c.footer])u&&l(u.fragments,d,u.box);}),s}function KL(e,t,n,r){let o=l=>l.origin.x+l.x+r(l.pageIndex),i=l=>{let c=Math.abs(l.origin.y+l.y-n),d=o(l);if(t>=d&&t<=d+l.width)return [0,c];let u=Math.min(Math.abs(t-d),Math.abs(t-d-l.width));return [1,Math.hypot(u,c)]},a=null,s=[2,0];for(let l of e){let[c,d]=i(l);(c<s[0]||c===s[0]&&d<s[1])&&(a=l,s=[c,d]);}return a}var Hq=4;function UL(e,t){return {ok:true,ops:[{op:"moveTable",tableId:e,beforeBlockId:t}],selection:{kind:"preserveSelection"}}}function jL(e){let t=null,n=null,r=e.layer.ownerDocument.createElement("div");r.className="docx-table-drop-indicator",r.style.position="absolute",r.style.pointerEvents="none";let o=WL({scroller:()=>e.pagesLayer.closest(".docx-editor__scroll-container"),frames:e.frames,onScroll:()=>i()});function i(){if(!t?.slots)return;let u=e.pagesLayer.getBoundingClientRect(),f=e.scale();t.slot=KL(t.slots,(t.lastX-u.left)/f,(t.lastY-u.top)/f,e.pageOffsetX);let p=t.slot;if(!p||p.stays){r.remove();return}let g=p.origin.x+p.x+e.pageOffsetX(p.pageIndex);r.style.left=`${g*f}px`,r.style.top=`${(p.origin.y+p.y)*f-1}px`,r.style.width=`${p.width*f}px`,r.parentNode!==e.layer&&e.layer.append(r);}function a(u){if(!(!t||u.pointerId!==t.pointerId)){if(t.lastX=u.clientX,t.lastY=u.clientY,!t.slots){if(Math.hypot(u.clientX-t.startX,u.clientY-t.startY)<Hq)return;t.slots=t.mode==="move"?qL(e.layout(),e.partOf(t.tableId),t.tableId):[],t.handle.dataset.dragging="true";}i(),o.follow(u.clientY);}}function s(u){if(!t||u.pointerId!==t.pointerId)return;let{tableId:f,slot:p,slots:g,mode:b}=t;d(),p&&!p.stays?e.applyTableCommandPlan(UL(f,p.beforeBlockId)):b==="refuse"&&g&&e.applyTableCommandPlan(UL(f,f));}function l(u){t&&u.pointerId===t.pointerId&&d();}function c(u){u.key!=="Escape"||!t?.slots||(u.preventDefault(),d());}function d(){if(o.stop(),r.remove(),n?.(),n=null,!t)return;let{handle:u,pointerId:f}=t;delete u.dataset.dragging,u.hasPointerCapture?.(f)&&u.releasePointerCapture(f),u.removeEventListener("pointermove",a),u.removeEventListener("pointerup",s),u.removeEventListener("pointercancel",l),t=null;}return {press(u,f,p,g){u.button===0&&(d(),t={pointerId:u.pointerId,startX:u.clientX,startY:u.clientY,tableId:f,handle:p,mode:g,lastX:u.clientX,lastY:u.clientY,slots:null,slot:null},p.setPointerCapture?.(u.pointerId),p.addEventListener("pointermove",a),p.addEventListener("pointerup",s),p.addEventListener("pointercancel",l),n=e.listeners.onDocument("keydown",c));},dragging:()=>(t?.slots??null)!==null,cancel:d,destroy:d}}function Oo(e,t){return de(e,t)??e.part()}function Gb(e,t,n){return !t||t.kind==="tableBody"?null:Vu(e,t.tableId,n)?t:null}function Ac(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 c of l.cells){let d=r(c.blocks);if(d)return d}}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}var _q=120,Bq=16,$q=2;function zL(e,t){return e.tableId===t?true:e.rows.some(n=>n.cells.some(r=>r.blocks.some(o=>o.kind==="table"&&zL(o,t))))}function VL(e,t,n){let r=e.pages[n];if(!r)return null;let o=a=>a.find(s=>s.kind==="table"&&zL(s,t))??null,i=o(r.fragments);if(i)return {table:i,origin:r.contentBox};for(let a of [r.header,r.footer]){let s=a?o(a.fragments):null;if(s&&a)return {table:s,origin:a.box}}return null}var GL="http://www.w3.org/2000/svg";function Wq(e){let t=e.createElementNS(GL,"svg");t.setAttribute("viewBox","0 -960 960 960"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");for(let n of $y("open_with")){let r=e.createElementNS(GL,"path");r.setAttribute("d",n),t.append(r);}return t}function ZL(e){let{layer:t}=e,n=nt(()=>t),r=null,o=null,i=null,a=false,s=jL({pagesLayer:e.pagesLayer,layer:t,listeners:e.listeners,frames:n,scale:()=>e.scale(),pageOffsetX:b=>e.pageOffsetX(b),layout:()=>e.read().layout,partOf:b=>Oo(e.session(),b),applyTableCommandPlan:b=>e.applyTableCommandPlan(b)}),l=t.ownerDocument.createElement("button");l.type="button",l.className="docx-table-select-handle",l.append(Wq(t.ownerDocument)),l.style.position="absolute",l.style.pointerEvents="auto";let c=b=>{b.preventDefault(),b.stopPropagation();};l.addEventListener("pointerdown",b=>{c(b);let y=e.read().editingMode;!i||a||y==="view"||(d(),s.press(b,i,l,y==="suggest"?"refuse":"move"));}),l.addEventListener("mousedown",c),l.addEventListener("click",b=>{c(b);let y=i?ja(e.read().layout,i):null;y&&(e.setCellSelection(y),e.pagesLayer.focus({preventScroll:true}));}),l.addEventListener("pointerenter",()=>d());function d(){o!==null&&(n.clearTimeout(o),o=null);}function u(b,y){let h=qa(b,y.head.paragraphId)?.tableId,x=h===void 0?void 0:Re(b,y.head)?.pageIndex;return h===void 0||x===void 0?null:{tableId:h,pageIndex:x}}function f(){let{layout:b,selection:y,editingMode:h}=e.read(),x=y.head.paragraphId,w=r?VL(b,r.tableId,r.pageIndex):null;r&&!w&&(r=null,d());let v=h!=="view"&&r!==null&&w!==null&&Vu(e.session(),r.tableId,x),k=h==="view"?null:v?r:u(b,y),E=k?v?w:VL(b,k.tableId,k.pageIndex):null;if(!k||!E){i=null,s.dragging()&&s.cancel(),l.remove();return}let{table:I,origin:P}=E,C=e.scale(),O=e.pageOffsetX(k.pageIndex);i=I.tableId,a=I.floatingWrap!==void 0,l.dataset.tableId=I.tableId,l.dataset.draggable=String(!a&&h==="edit"),l.setAttribute("aria-label",e.label("table.selectTable")),l.title=e.label("table.selectTable");let S=Bq+$q;l.style.left=`${(P.x+I.box.x+O)*C-S}px`,l.style.top=`${(P.y+I.box.y)*C-S}px`,l.parentNode!==t&&t.append(l);}function p(b){if(l.contains(b.target)||s.dragging())return;let{layout:h}=e.read(),x=e.pagesLayer.getBoundingClientRect(),w=e.scale(),v=(b.clientX-x.left)/w,k=(b.clientY-x.top)/w,E=ve(h,k),I=E>=0?If$1(Ef$2(h),v,k,h,e.pageOffsetX(E),E):null;if(I){if(d(),r?.tableId===I.tableId&&r.pageIndex===I.pageIndex)return;r={tableId:I.tableId,pageIndex:I.pageIndex},f();return}!r||o!==null||(n.migrate(),o=n.setTimeout(()=>{o=null,r=null,f();},_q));}let g=e.listeners.onDocument("pointermove",p);return {update:f,destroy(){d(),s.destroy(),g(),t.remove();}}}function qq(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var tF=/^[^\s]{1,512}$/,zb=/["\\\u0000-\u001f\u007f]/;function nF(e,t){return !e||t===void 0||!/^\d{1,9}$/.test(t)||!tF.test(e)||e==="__proto__"?null:{paragraphId:e,offset:Number(t)}}function ai(e){let t=nF(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 Ss(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:nF(t.dataset.drawingParagraphId,t.dataset.drawingStart)}function Kq(e,t){let n=zb.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")?Ss(i)?.paragraphId===t&&o.push(i):r.push(i);return {spans:r,spacers:o}}function dp(e,t,n){return zb.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function rF(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=ai(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function oF(e){return e.querySelector("[data-docx-hf-active]")}function la(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 Uq(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function cp(e,t){let n=oF(e),r=n?.closest(".docx-page");if(n)return r&&r!==e?[n,r,e]:[n,e];let o=Uq(e,t);return o&&o!==e?[o,e]:[e]}function XL(e,t){let n=l=>({paragraphId:l.paragraphId,offset:t?l.end:l.start}),r=l=>t?{...l,offset:l.offset+1}:l,o=rF(e);if(o)return n(o.identity);let i=Ss(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 c=Ss(l);if(c)return r(c);let d=ai(l);if(d)return n(d)}return null}function YL(e,t,n=false){let r=[...e.childNodes];if(r.length===0)return null;let o=Ss(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=XL(r[i],false);if(a)return a}for(let i=Math.min(t,r.length)-1;i>=0;i-=1){let a=XL(r[i],true);if(a)return a}return null}function QL(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")||oF(n)&&r?.closest(".docx-page-content"))return null;let i=r?.closest("[data-docx-marker]"),a=Ss(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 d=s.parentElement,u=[...d.querySelectorAll(".layout-run[data-start]")].filter(g=>g.closest(".docx-line")===d).flatMap(g=>{let b=ai(g);return b?[{run:g,identity:b}]:[]}),f=u.at(-1)?.identity.paragraphId,p;for(let g of u)g.identity.paragraphId===f&&(!p||g.identity.start>p.identity.start)&&(p=g);if(p){let g=p.run.textContent===`
|
|
27
|
+
`,{start:b,end:y}=p.identity;return {paragraphId:p.identity.paragraphId,offset:g?b:y}}}let l=s??(i?.classList.contains("docx-wrap-advance")?i:null);if(l?.parentElement){let d=[...l.parentElement.childNodes],u=d.indexOf(l);if(s){let g="[data-start], a, br, .docx-inline-drawing-advance, .docx-wrap-advance";for(;u>0&&!d[u-1].matches?.(g);)u-=1;}let f=!s&&t>0?1:0,p=YL(l.parentElement,u+f,!!s);if(p)return p}if(i)return i.parentElement?iF(i.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let d=e,u=ai(d);if(u)return {paragraphId:u.paragraphId,offset:t>0?u.end:u.start};let f=YL(d,t);return f||zq(d)}let c=rF(e);return c?{paragraphId:c.identity.paragraphId,offset:qq(c.identity,t)}:null}function ks(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=QL(n,r,e),s=QL(o,i,e);if(!a||!s){let l=a??s;return l?{anchor:l,head:l}:null}return {anchor:a,head:s}}function Zb(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 JL(e,t,n,r){if(r!==void 0)for(let o of cp(e,n)){let i=zb.test(r)?"[data-line-id]":`[data-line-id="${r}"]`;for(let a of o.querySelectorAll(i)){if(a.dataset.lineId!==r)continue;let s=eF(a,t);if(s)return s}}for(let o of cp(e,n)){let i=eF(o,t);if(i)return i}return null}function jq(e,t){let n=null;for(let r of e){if(!r.hasAttribute("data-docx-field")||!r.parentNode)continue;let o=ai(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=ai(n);for(let o of e){let i=ai(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 eF(e,t){let{spans:n,spacers:r}=Kq(e,t.paragraphId),o=jq(n,t);if(o)return o;let i=null,a=false;for(let p of n){let g=ai(p);if(!g||g.paragraphId!==t.paragraphId)continue;let b=Vq(p),y=p.textContent?.length??0,h=g.end;if(b){if(p.closest?.("[data-docx-field]")){a=true;continue}if(a=true,t.offset>=g.start&&t.offset<=h){let x={node:b,offset:Math.min(t.offset-g.start,y)};if(t.offset<h)return x;i=x;}}}let s=p=>r.find(g=>Ss(g)?.offset===p)??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 c=l,d=c?null:s(t.offset-1),u=c??d;if(u?.parentNode)return {node:u.parentNode,offset:[...u.parentNode.childNodes].indexOf(u)+(d?1:0)};if(a||=r.length>0,a)return null;let f=Gq(e,t.paragraphId);return f?{node:f,offset:0}:null}function Vq(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 Gq(e,t){let n=null;for(let r of dp(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 iF(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!tF.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function zq(e){let t=iF(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function aF(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??la(n.anchorNode,e),a=Ht(t,{anchor:t.head,head:t.head})?r?.preferredLineId:void 0,s=JL(e,t.anchor,o,a),l=JL(e,t.head,o,a);if(!s||!l)return false;let c=ks(e,n);if(c&&Ht(c,t)){let d=la(n.anchorNode,e),f=(n.focusNode?.nodeType===Node.ELEMENT_NODE?n.focusNode:n.focusNode?.parentElement)?.closest("[data-line-id]")?.dataset.lineId;if((o===void 0||d===o)&&(a===void 0||f===a))return true}try{return n.setBaseAndExtent(s.node,s.offset,l.node,l.offset),!0}catch{return false}}function Ht(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 Zq='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function sF(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 lF(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 Xq(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function Yq(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function cF(e,t,n,r){if(e.dataset.docxField!==void 0){let i=sF(e,t,t);return {start:t,end:i,text:n.slice(t,i),seq:r}}let o=e.textContent??"";return {start:t,end:sF(e,t,t+o.length),text:o,seq:r}}function dF(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=lF(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?.(Zq))continue;dF(r,t);continue}let i=cF(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 Qq(e,t,n,r){let o=[];for(let a of dp(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=Yq(a,n,r),c=i.get(s);(!c||l>c.affinity)&&i.set(s,{element:a,affinity:l});}return [...i.values()].map(a=>a.element)}function Jq(e,t,n){for(let r of dp(e,n.paragraphId,"[data-start]")){let o=r,i=lF(o,n.paragraphId);if(i===null||t.some(l=>l.contains(o)))continue;let a=cF(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 eK(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 uF(e,t,n,r){let o=Qq(e,t,r,Xq(r)),i={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let a of o)dF(a,i);return Jq(e,o,i),i.pieces.length===0?null:eK(i.pieces,n)}function Xb(e){if(!(e.metaKey||e.ctrlKey))return null;let t=e.key.toLowerCase();return t==="y"?"redo":t==="z"?e.shiftKey?"redo":"undo":null}function pF(e){return e.altKey||e.ctrlKey}function mF(e){return sa$1(e.layout(),e.state().selection.head.paragraphId)!==null}function gF(e,t){let{selection:n,cellSelection:r}=e.state(),o=ta$1(e.layout(),n.head.paragraphId,t);if(o===null)return false;let i=r&&r.cellIds.length>1&&r.cellIds[0];return i?(fF(e,ma$1(e.layout(),[i])),true):o==="end"?(t==="next"&&tK(e),true):(fF(e,o.paragraphIds),true)}function fF(e,t){let n=t[0],r=t.at(-1);if(n===void 0||r===void 0)return;let o=eb$1(de(e.session,r)??e.session.part(),r),i=o?.kind==="paragraph"?Gi$1(o):0;e.setSelection({anchor:{paragraphId:n,offset:0},head:{paragraphId:r,offset:i}});}function tK(e){let t=e.state(),n=Tr({command:{type:"insertRow",where:"below"},part:de(e.session,t.selection.head.paragraphId)??e.session.part(),layout:e.layout(),storeRevision:e.session.packageRevision(),selection:t.selection,cellSelection:t.cellSelection,themeColors:e.session.documentThemeColors(),editable:e.session.editable,viewing:e.editingMode()==="view"});if(!e.applyTableCommandPlan(n).ok)return;let r=ta$1(e.layout(),t.selection.head.paragraphId,"next"),o=typeof r=="object"?r?.paragraphIds[0]:void 0;o!==void 0&&e.setSelection({anchor:{paragraphId:o,offset:0},head:{paragraphId:o,offset:0}});}var xF={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"};function nK(e){return xF[e.key]||e.key==="PageUp"||e.key==="PageDown"?e.shiftKey:(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="a"}var hF={l:"left",e:"center",r:"right",j:"both"},yF={1:"240",5:"360",2:"480"},bF={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function rK(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}function wF(e,t={}){return n=>{if(n.defaultPrevented)return;let r=e.editingMode()==="view"||n.currentTarget?.contentEditable==="false";if(n.key==="F5"&&n.shiftKey&&(n.ctrlKey||n.metaKey)&&!n.altKey&&!n.isComposing&&t.onRequestBookmark?.()){n.preventDefault();return}if(ib(n)&&t.onRequestGoTo?.()){n.preventDefault();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(r&&!nK(n))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 o=Of(n);if(rK(n,o)&&!n.shiftKey){let l=o;if(l==="f"){n.preventDefault(),e.insertNote("footnote");return}if(l==="d"){n.preventDefault(),e.insertNote("endnote");return}if(l==="c"){n.preventDefault(),e.formatPainter.capture();return}if(l==="v"){n.preventDefault(),e.formatPainter.apply();return}}let i=n.metaKey||n.ctrlKey,a=xF[n.key];if(a){let l=a;n.key==="Home"||n.key==="End"?i&&(l=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?l=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?l=n.key==="ArrowLeft"?"lineStart":"lineEnd":i&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(l=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(l,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(i?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){i||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){i||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}if(pF(n)&&!n.isComposing){if(mF(e)){(e.state().cellSelection?.cellIds.length??0)<=1&&e.insertTab(),n.preventDefault();return}}else if(!n.isComposing&&gF(e,n.shiftKey?"previous":"next")){n.preventDefault();return}let l=n.shiftKey?"decrease":"increase";e.isListParagraph()?e.adjustIndent(l):e.indentWithTab(l)||(n.shiftKey?e.adjustIndent("decrease"):e.insertTab()),n.preventDefault();return}if(n.key==="Enter"){i?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(i&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(i&&n.shiftKey&&n.key.toLowerCase()==="v"){e.armForcePlainPaste();return}if(i&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){if(t.onRequestHyperlink()===false)return;n.preventDefault();return}if(i&&!n.shiftKey&&bF[n.key.toLowerCase()]){let l=bF[n.key.toLowerCase()];e.toggleRunProperty(l.localName,l.attributes),n.preventDefault();return}if(i&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(i&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(i&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(i&&!n.shiftKey&&hF[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperties([{localName:"jc",attributes:{val:hF[n.key.toLowerCase()]},physicalAlignment:true}]),n.preventDefault();return}if(i&&!n.shiftKey&&yF[n.key]){e.setParagraphProperty("spacing",{line:yF[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}let s=Xb(n);s&&(s==="redo"?e.redo():e.undo(),n.preventDefault());}}function SF(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=>{if(e.editingMode()==="view"){i.preventDefault();return}t(i)&&(e.deleteSelection(),i.preventDefault());},onPaste:i=>{let a=xh(i.clipboardData),s=i.clipboardData?.getData("text/html")??"";i.preventDefault(),!(!a&&!s)&&e.pasteRich(a,s.length>0?s:null);}}}function vF(e){let t=xh(e.dataTransfer);return t.length>0?t:null}function kF(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??vF(n);if(!r)return;sK(e,iK(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=vF(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function oK(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 iK(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=oK(n);return r?{text:r,paragraphId:aK(n)}:null}function aK(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 sK(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,i=t.text;if(Ht(r.selection,Ke(o))&&o.offset>=i.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let a=de(e.session,o.paragraphId)??e.session.part(),s=Jm(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 IF(e,t,n,r=null){for(let o of cp(e)){let i=uF(o,t,n,r);if(i!==null)return i}return null}function RF(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 lK="equation replacement is not supported in suggesting mode",cK="in suggesting mode, remove the whole equation block rather than one equation",PF=new WeakMap,TF=new WeakSet,dK="compact linear text cannot spell this equation";function Yb(e,t){let n=eb$1(e,t);if(!n||n.kind!=="paragraph")return [];let r=PF.get(n);if(r)return r;let o=[];for(let a of Ci(n))for(let s of Mg$1(a.node)){let l=Gg$1(s);if(!l)continue;let c=Object.freeze({id:s.id,paragraphId:t,start:a.start,end:a.end,linear:Ig(l.expression),fallbackText:l.fallbackText,supported:dr(l.expression)});cr(l.expression)&&TF.add(c),o.push(c);}let i=Object.freeze(o);return PF.set(n,i),i}function EF(e,t,n){let r=Yb(e,t).filter(o=>o.start===n);return r.length===0?null:r.map(o=>o.linear||o.fallbackText).join(" ")}function CF(e){return "controlProperties"in e&&e.controlProperties===true}function cr(e){if(CF(e))return true;switch(e.kind){case "bar":case "borderBox":return true;case "text":return e.format!==void 0;case "fallback":return false;case "row":return e.items.some(cr);case "fraction":return cr(e.numerator)||cr(e.denominator);case "radical":return cr(e.radicand)||e.degree!==void 0&&cr(e.degree);case "script":return cr(e.base)||e.subscript!==void 0&&cr(e.subscript)||e.superscript!==void 0&&cr(e.superscript);case "nary":return e.limitLocation==="subSup"||cr(e.body)||e.lowerLimit!==void 0&&cr(e.lowerLimit)||e.upperLimit!==void 0&&cr(e.upperLimit)}}function dr(e){if(CF(e))return false;switch(e.kind){case "fallback":case "bar":case "borderBox":return false;case "text":return e.format===void 0;case "row":return e.items.every(dr);case "fraction":return dr(e.numerator)&&dr(e.denominator);case "radical":return dr(e.radicand)&&(e.degree===void 0||dr(e.degree));case "script":return dr(e.base)&&(e.subscript===void 0||dr(e.subscript))&&(e.superscript===void 0||dr(e.superscript));case "nary":return dr(e.body)&&(e.lowerLimit===void 0||dr(e.lowerLimit))&&(e.upperLimit===void 0||dr(e.upperLimit))}}function OF(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function MF(e){let t=null,n=a=>{if(d$1(a)||!e.pagesLayer.ownerDocument.defaultView||!qt(a))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 c=s.getBoundingClientRect();t={equationId:l,rect:{left:c.left,top:c.top,right:c.right,bottom:c.bottom}};},i=a=>{let s=n(a.target),l=s?.dataset.docxEquation,c=t;if(t=null,!s||!l){if(!c)return;a.preventDefault(),r(c.equationId,c.rect);return}let d=s.getBoundingClientRect();a.preventDefault(),r(l,{left:d.left,top:d.top,right:d.right,bottom:d.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 AF(e){let t=()=>e.session.partFor(e.storyScope()),n=c=>{let d=t();return d?Yb(d,c):[]},r=()=>{let c=e.selection().head;return OF(n(c.paragraphId),c)},o=c=>{let d=n(e.selection().head.paragraphId).find(u=>u.id===c);if(d)return d;for(let u of e.session.storyParts()){let f=eb$1(u,c);if(!f||f.kind!=="generic"||f.namespaceUri!==Eg||f.localName!=="oMath")continue;let p=f;for(;p&&p.kind!=="paragraph";)p=fb$2(u,p.id);return !p||p.kind!=="paragraph"?null:Yb(u,p.id).find(g=>g.id===c)??null}return null},i=c=>e.editingMode()==="suggest"?e.trackedOps([{op:"deleteText",paragraphId:c.paragraphId,start:c.start,end:c.end}]):[{op:"removeMathEquation",equationId:c.id}],a=(c,d)=>{let u=false,f={paragraphId:c.paragraphId,offset:c.start};return e.commit(()=>{let p=e.session.applyTreeOps([...d],e.selectionMark(),{paragraphId:f.paragraphId,start:f.offset,end:f.offset},e.storyScope());return u=p.committed,p},()=>({anchor:f,head:f})),u},s=(c,d)=>{let u=o(c);if(!u)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest"){if(d==="replace")return {ok:false,code:"unsupported",reason:lK};if(n(u.paragraphId).filter(b=>b.start===u.start).length>1)return {ok:false,code:"unsupported",reason:cK}}if(d==="replace"&&TF.has(u))return {ok:false,code:"unsupported",reason:"compact linear editing cannot preserve this equation source formatting"};if(d==="replace"&&u.supported&&u.linear===""&&u.fallbackText!=="")return {ok:false,code:"unsupported",reason:dK};let[f]=d==="replace"?[{op:"setMathEquation",equationId:c,linear:u.linear}]:i(u),p=f?e.writeRefusal(f):null;return p===null?{ok:true}:{ok:false,code:"locked",reason:p}},l=c=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:c.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:s,applyEquation(c,d){let u=o(c);if(!u)return false;let f=s(c,"replace");return f.ok?u.supported&&u.linear===d?true:a(u,[{op:"setMathEquation",equationId:c,linear:d}]):l(f)},removeEquation(c){let d=o(c);if(!d)return false;let u=s(c,"remove");return u.ok?a(d,i(d)):l(u)}}}var Lc="the selection contains a chart; a chart cannot be copied, cut or pasted";function Qb(e,t,n=E$1){for(let[r,o]of t){let i=eb$1(e,r);if(i&&i.kind!=="textValue"&&i.kind==="paragraph"&&o&&o.end>o.start){let a=Ei(i),s=[...i.children];for(;s.length;){let l=s.pop();if(l.kind!=="textValue"){if(n(l)){let c=a.spanOf(l);if(c?c.end>o.start&&c.start<o.end:o.start===0&&o.end===1/0)return true}for(let c of l.children)s.push(c);}}}}return false}function LF(e,t){return Qb(e,t,D$2)}function FF(e){return Fc(e)!==null}function Fc(e){let t=lg(e);if(!t.ok)return null;let n=[...t.package.parts.values()].map(r=>r.root);return G$1(n)?"chart":F$1(n)?"object":null}function Ze(e){return e.kind!=="textValue"}function me(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Ze(n)&&n.localName===t&&n.namespaceUri===pa$2)return n;return null}function mt(e,t="val"){return e?Jh$1(e,t,pa$2):void 0}function ur(e,t,n){return e?Jh$1(e,t,n):void 0}function Jb(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=Jb(n);return t}function Is(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=Is(r,t,n);if(o)return o}return null}function si(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function Rn(e){return Qd(e)}function ev(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var Yr=ev;function up(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function Mr(e){return `${Math.round(e/20*100)/100}pt`}var uK="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",fK=Ad;function Dc(e,t,n){for(let o of tg(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let i=E$3(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 DF(e){let t=Dc(e,uK,"/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,c=null;for(let d of t.children){if(!Ze(d)||d.namespaceUri!==pa$2)continue;if(d.localName==="docDefaults"){c=d,r=me(me(d,"rPrDefault"),"rPr"),o=me(me(d,"pPrDefault"),"pPr");continue}if(d.localName!=="style")continue;if(l>=kf$1)break;l+=1;let u=Jh$1(d,"styleId",pa$2);if(!u)continue;n.set(u,d);let f=Jh$1(d,"default",pa$2),p=Jh$1(d,"type",pa$2);f==="1"||f==="true"||f==="on"?p==="paragraph"?i=u:p==="character"?a=u:p==="table"&&(s=u):(i===u&&(i=null),a===u&&(a=null),s===u&&(s=null));}if(t.namespaceUri===pa$2){let d=J(c);d.run&&(r=L$1("rPr","application")),d.paragraph&&(o=L$1("pPr","application"));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:i,defaultCharacterStyleId:a,defaultTableStyleId:s}}function Mo(e,t,n){let r=[],o=new Set,i=t;for(;i&&!o.has(i)&&r.length<fK;){o.add(i);let a=e.byId.get(i);if(!a)break;if(r.length===0&&n!==void 0){let s=Jh$1(a,"type",pa$2);if(s!==void 0&&s!==n)return []}r.unshift(a),i=mt(me(a,"basedOn"));}return r}function tv(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let i of n)r.push(i);let o=mt(me(t,"pStyle"));for(let i of Mo(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let a=me(i,"pPr");a&&r.push(a);}return t&&r.push(t),r}function fp(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=mt(me(t,"pStyle"));for(let u of Mo(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let f=me(u,"rPr");f&&a.push(f);}let l=[],c=mt(me(n,"rStyle"))??void 0;for(let u of Mo(e,c,"character")){let f=Jh$1(u,"styleId",pa$2);if(f!==void 0&&f===e.defaultCharacterStyleId)continue;let p=me(u,"rPr");p&&l.push(p);}let d=[...o,...i,...a,...l];return n&&d.push(n),{all:d,defaults:o,tableLevel:i,paragraphLevel:a,characterLevel:l,direct:n}}function fr(e,t){let n=null;for(let r of e){let o=me(r,t);o&&(n=o);}return n}function _t(e,t,n){let r;for(let o of e){let i=me(o,t);if(!i)continue;let a=Jh$1(i,n,pa$2);a!==void 0&&(r=a);}return r}function pp(e){return !(e==="0"||e==="false"||e==="off")}function Qr(e,t){let n=false;for(let r of e){let o=me(r,t);o&&(n=pp(mt(o)));}return n}function li(e,t){let n;for(let r of e){let o=me(r,t);o&&(n=pp(mt(o)));}return n}function Ar(e,t){let n=e.direct?me(e.direct,t):null;if(n)return pp(mt(n));let r=li(e.tableLevel,t),o=li(e.paragraphLevel,t),i=li(e.characterLevel,t);return i===false||i===void 0&&o===false||i===void 0&&o===void 0&&r===false?false:li(e.defaults,t)===true?true:r===true!=(o===true)!=(i===true)}function nv(e,t){let n=e.direct?me(e.direct,t):null;if(n)return pp(mt(n));let r=li(e.characterLevel,t);if(r!==void 0)return r;let o=li(e.paragraphLevel,t);if(o!==void 0)return o;let i=li(e.tableLevel,t);return i!==void 0?i:li(e.defaults,t)===true}function NF(e){return e.isLgl?"decimal":e.numFmt}function HF(e){let t=od(e),n=new Map,r=new Map,o=new Map,i=new Map,a=new Map,s=new Map;for(let[l,c]of t.abstractNums){c.numStyleLink!==void 0&&s.set(l,c.numStyleLink);let d=new Map,u=new Map;for(let[f,p]of c.levels)d.set(String(f),NF(p)),u.set(String(f),p.start);r.set(l,d),o.set(l,u);}for(let[l,c]of t.nums){n.set(l,c.abstractNumId);for(let[d,u]of c.overrides){let f=`${l}:${d}`,p=u.startOverride??u.level?.start;p!==void 0&&i.set(f,p),u.level!==void 0&&a.set(f,NF(u.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:i,formatOverrides:a,styleLinks:s}}function _F(e,t){return e===null?null:Qd(Jh$1(e,t,pa$2))}function $F(e,t){if(e===null)return null;let n=Jh$1(e,t,pa$2);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function BF(e){return `${Math.round(e/20*100)/100}pt`}var pK=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function Rs(e,t,n){if(e===null)return null;let r=Jh$1(e,t,pa$2);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Jh$1(e,"val",pa$2);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function rv(e,t){let n=new Map,r=new Set(pK);for(let o of e)for(let i of o.children){if(i.kind==="textValue"||i.localName!=="tblStylePr"||i.namespaceUri!==pa$2)continue;let a=Jh$1(i,"type",pa$2);a===void 0||!r.has(a)||n.set(a,{fill:$F(me(me(i,"tcPr"),"shd"),"fill"),rPr:me(i,"rPr"),pPr:me(i,"pPr")});}return {byType:n,firstRowEnabled:Rs(t,"firstRow",32)??false,lastRowEnabled:Rs(t,"lastRow",64)??false,firstColumnEnabled:Rs(t,"firstColumn",128)??false,lastColumnEnabled:Rs(t,"lastColumn",256)??false,hBandingEnabled:!(Rs(t,"noHBand",512)??false),vBandingEnabled:!(Rs(t,"noVBand",1024)??false)}}function ov(e,t,n,r,o,i){let a=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,c=e.lastColumnEnabled&&o,d=u=>e.byType.get(u)??null;if(s&&l&&d("swCell"))return d("swCell");if(s&&c&&d("seCell"))return d("seCell");if(a&&l&&d("nwCell"))return d("nwCell");if(a&&c&&d("neCell"))return d("neCell");if(s&&d("lastRow"))return d("lastRow");if(a&&d("firstRow"))return d("firstRow");if(c&&d("lastCol"))return d("lastCol");if(l&&d("firstCol"))return d("firstCol");if(e.hBandingEnabled){let u=t-(e.firstRowEnabled?1:0);if(u>=0){let f=d(u%2===0?"band1Horz":"band2Horz");if(f)return f}}if(e.vBandingEnabled){let u=i-(e.firstColumnEnabled?1:0);if(u>=0){let f=d(u%2===0?"band1Vert":"band2Vert");if(f)return f}}return null}function WF(e,t,n,r,o,i,a,s,l=false,c=[]){let d=[],u=me(e,"tcBorders"),f={top:n===0?"top":"insideH",bottom:n+o>=r?"bottom":"insideH",left:i?"left":"insideV",right:a?"right":"insideV"};for(let v of ["top","left","bottom","right"]){let k=v==="left"?"start":v==="right"?"end":v,E=me(u,v)??me(u,k),I=f[v],P=I==="left"?"start":I==="right"?"end":I,C=E!==null?Ki(E):Ki(me(t,I)??me(t,P));C&&d.push(`border-${Pr(v,l)}:${C}`);}let p=$F(me(e,"shd"),"fill")??s;p&&d.push(`background-color:${p}`);let g=me(e,"vAlign"),b=g===null?void 0:Jh$1(g,"val",pa$2);b==="center"?d.push("vertical-align:middle"):(b==="bottom"||b==="top")&&d.push(`vertical-align:${b}`);let y=me(e,"tcW"),h=_F(y,"w"),x=y===null?void 0:Jh$1(y,"type",pa$2);h!==null&&h>0&&(x===void 0||x==="dxa")&&d.push(`width:${BF(h)}`);let w=me(e,"tcMar");for(let v of ["top","right","bottom","left"]){let k=v==="left"?"start":v==="right"?"end":v,E=me(w,v)??me(w,k)??c.map(C=>me(C,v)??me(C,k)).find(C=>C!==null)??null,I=_F(E,"w"),P=E===null?void 0:Jh$1(E,"type",pa$2);I!==null&&I>=0&&(P===void 0||P==="dxa")&&d.push(`padding-${Pr(v,l)}:${BF(I)}`);}return d.join(";")}function mK(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===pa$2}function qF(e){return e.localName==="customXml"&&e.namespaceUri===pa$2}function KF(e){let t=[],n=[],r=o=>{for(let i of o)if(Ze(i)){if(i.kind==="tableRow"||i.localName==="tr"&&i.namespaceUri===pa$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(qF(i)){r(i.children);continue}n.push({skip:i});}};return r(e.children),{rows:t,tableItems:n}}function UF(e){let t=[],n=[],r=new Set;for(let o of e){let i=new Set,a=[],s=[],l=0,c=d=>{for(let u of d)if(Ze(u)){if(mK(u)){let f=me(u,"tcPr"),p=Math.min(Math.max(si(mt(me(f,"gridSpan")))??1,1),63),g=me(f,"vMerge"),b=g===null?null:mt(g)==="restart"?"restart":"continue",y=b==="continue"&&!r.has(l)?"restart":b;b!==null&&i.add(l);let h={cell:u,startColumn:l,span:p,vMerge:y};a.push(h),s.push({placement:h}),l+=p;continue}if(u.kind==="contentControl"){let f=u.children.find(p=>p.kind==="contentControlContent");f&&Ze(f)&&c(f.children);continue}if(qF(u)){c(u.children);continue}s.push({skip:u});}};c(o.children),r=i,t.push(a),n.push(s);}return {placements:t,items:n}}function jF(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 VF(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=ov(t,a,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),c=[],d=[];i?.rPr&&c.push(i.rPr),i?.pPr&&d.push(i.pPr),l?.rPr&&c.push(l.rPr),l?.pPr&&d.push(l.pPr),o.set(s.cell,c.length>0||d.length>0?{...e,tableRPr:c,tablePPr:d}:e);}return o}function GF(e,t){let n=Mo(e.styles,mt(me(t,"tblStyle")),"table");return n.length>0?n:Mo(e.styles,e.styles.defaultTableStyleId??void 0,"table")}function zF(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Ze(n)?n:null,o=GF(e,r),i=rv(o,me(r,"tblLook")),{rows:a}=KF(t),{placements:s}=UF(a);return VF(e,i,s,jF(s))}function ZF(e,t,n,r){let o=t.children.find(C=>C.kind==="tableProperties"),i=o&&Ze(o)?o:null,a=null,s=GF(e,i);for(let C of s){let O=me(me(C,"tblPr"),"tblBorders");O&&(a=O);}let l=s.map(C=>me(C,"tblPr")).filter(C=>C!==null);i&&l.push(i);let c=Qr(l,"bidiVisual"),d=[],u;for(let C of l){let O=me(C,"tblCellMar");O&&d.unshift(O),u=mt(me(C,"jc"))??u;}let f=me(i,"tblBorders");f&&(a=f);let p=rv(s,me(i,"tblLook")),{rows:g,tableItems:b}=KF(t),{placements:y,items:h}=UF(g),x=jF(y),w=VF(e,p,y,x),v=["border-collapse:collapse"],k=me(i,"tblW"),E=Rn(ur(k,"w",pa$2));E!==null&&E>0&&ur(k,"type",pa$2)==="dxa"&&v.push(`width:${Mr(E)}`);let I=Pr(u==="right"||u==="end"?"right":u==="center"?"center":"left",c);I==="center"?v.push("margin-left:auto","margin-right:auto"):I==="right"?v.push("margin-left:auto","margin-right:0"):v.push("margin-left:0","margin-right:auto");for(let[C,O]of [["insideH","insideh"],["insideV","insidev"]]){let S=Ki(me(a,C));S&&v.push(`mso-border-${O}-alt:${S}`);}let P=`<table dir="${c?"rtl":"ltr"}" align="${I}" style="${v.join(";")}">`;for(let C of b){if("skip"in C){r.advanceFieldState(C.skip,n);continue}let O=C.row,S=me(me(g[O]??null,"trPr"),"trHeight"),T=Rn(ur(S,"val",pa$2)),B=CR(T,ur(S,"hRule",pa$2)),W=B===""?"":` style="${B}"`;P+=`<tr${W}>`;for(let q of h[O]??[]){if("skip"in q){r.advanceFieldState(q.skip,n);continue}let U=q.placement;if(U.vMerge==="continue"){r.advanceFieldState(U.cell,n);continue}let Z=1;if(U.vMerge==="restart")for(let j=O+1;j<y.length&&y[j].find(D=>D.startColumn===U.startColumn&&D.vMerge==="continue");j+=1)Z+=1;let M=me(U.cell,"tcPr"),J=U.startColumn+U.span>=x,ee=ov(p,O,y.length,U.startColumn===0,J,U.startColumn),fe=p.byType.get("wholeTable")??null,se=WF(M,a,O,y.length,Z,U.startColumn===0,J,ee?.fill??fe?.fill??null,c,d),$=(U.span>1?` colspan="${U.span}"`:"")+(Z>1?` rowspan="${Z}"`:"")+(se===""?"":` style="${Yr(se)}"`),H=w.get(U.cell)??e;P+=`<td dir="ltr"${$}>${r.renderBlocks(H,U.cell.children,n)}</td>`;}P+="</tr>";}return `${P}</table>`}function mp(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 iv(e){let t=Jh$1(e,"type",pa$2);return t==="separator"||t==="continuationSeparator"}function av(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Ze(r)||r.namespaceUri!==pa$2||r.localName!==t||iv(r))continue;let o=mp(Jh$1(r,"id",pa$2));o!==null&&n.add(o);}return n}function Nc(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"){Nc(e,s,n,r,o,i,zF(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===pa$2&&s.localName==="tc"){let l=a?.get(s);if(l===void 0){r.inert||o(s,r);continue}Nc(l,s,n,r,o,i,a);continue}if(s.kind==="paragraph"){let l=s.children.find(c=>c.kind==="paragraphProperties");Nc(e,s,n,r,o,l&&Ze(l)?l:null,a);continue}if(s.kind==="run"){if(s.children.some(d=>d.kind==="fldChar")){r.inert||o(s,r);continue}if(s.children.some(d=>d.kind==="instrText")||!r.inert&&r.stack.some(d=>d==="instr"))continue;let l=s.children.find(d=>d.kind==="runProperties"),c=fp(e.styles,i,l&&Ze(l)?l:null,e.tableRPr);if(Ar(c,"vanish"))continue}if(s.namespaceUri===pa$2&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=mp(Jh$1(s,"id",pa$2));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}Nc(e,s,n,r,o,i,a);}}function gK(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Ze(r)||r.namespaceUri!==pa$2)&&!(r.localName!==t||iv(r))&&mp(Jh$1(r,"id",pa$2))===n)return r;return null}function XF(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=gK(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},c=[];Nc(e,a,c,l,n,null);for(let d of c)e.availableNotes[d.kind].has(d.id)&&(r[d.kind].has(d.id)||(r[d.kind].add(d.id),o.push(d)));}return r}function sv(e,t,n,r,o){if(n===null)return "";let i=`/word/${t}s.xml`;for(let[l,c]of e.pkg.parts)c.root===n&&(i=l);let a=tg(e.pkg,i),s="";for(let l of n.children){if(!Ze(l)||l.namespaceUri!==pa$2||l.localName!==t||iv(l))continue;let c=Jh$1(l,"id",pa$2),d=mp(c);if(c===void 0||d===null||!r.has(d))continue;let u=o({...e,noteBody:{kind:t,id:d},docRels:a},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${d}">${u===""?"<p></p>":u}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}function YF(e){if(!e)return null;let t=[];for(let n of e.children){if(!Ze(n)||n.localName!=="tab")continue;let r=mt(n),o=Rn(Jh$1(n,"pos",pa$2));if(o===null||o<0||r!=="left"&&r!=="center"&&r!=="right"&&r!=="decimal"&&r!=="bar")continue;let i=mt(n,"leader"),a=i==="dot"?"dotted":i==="hyphen"?"dashed":i==="underscore"?"lined":i==="middleDot"?"middledot":i==="heavy"?"heavy":"";t.push(`${r}${a?` ${a}`:""} ${Mr(o)}`);}return t.length>0?`tab-stops:${t.join(" ")}`:null}var lv="http://schemas.openxmlformats.org/officeDocument/2006/relationships",hK=`${lv}/numbering`,yK=`${lv}/footnotes`,bK=`${lv}/endnotes`,vK=2*1024*1024,xK=8*1024*1024,QF=9525,wK=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 gp(e,t,n,r){let o=e.direct!==null&&me(e.direct,r)!==null||fr(e.defaults,r)!==null||fr(e.tableLevel,r)!==null||fr(e.paragraphLevel,r)!==null||fr(e.characterLevel,r)!==null;return Ar(e,t&&o?r:n)}function SK(e){let t=e.all;if(Ar(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=Qr(t,"rtl"),o=(r?_t(t,"rFonts","cs"):void 0)??_t(t,"rFonts","ascii")??_t(t,"rFonts","hAnsi")??_t(t,"rFonts","eastAsia")??(r?void 0:_t(t,"rFonts","cs"));if(o!==void 0){let v=PR(o);v&&n.push(`font-family:${v}`);}let i=si((r?_t(t,"szCs","val"):void 0)??_t(t,"sz","val")??(r?void 0:_t(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;gp(e,r,"b","bCs")?n.push("font-weight:bold"):gp(a,r,"b","bCs")&&n.push("font-weight:normal"),gp(e,r,"i","iCs")?n.push("font-style:italic"):gp(a,r,"i","iCs")&&n.push("font-style:normal");let l=[],c=fr(t,"u"),d=c!==null&&mt(c)!=="none";d&&l.push("underline");let u=nv(e,"dstrike");if((Ar(e,"strike")||u)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let v=fr(s,"u");(v!==null&&mt(v)!=="none"||Ar(a,"strike")||nv(a,"dstrike"))&&n.push("text-decoration:none");}d&&n.push(...ER(c)),u&&!d&&n.push("text-decoration-style:double");let f=up(_t(t,"color","val"));f&&n.push(`color:${f}`);let p=Rn(_t(t,"spacing","val"));p!==null&&n.push(`letter-spacing:${Math.round(p/20*100)/100}pt`);let g=mt(fr(t,"highlight")),b=g!==void 0&&Object.hasOwn(Gg,g)?Gg[g]:void 0,y=up(_t(t,"shd","fill"));b?n.push(`background-color:${b}`,`mso-highlight:${g}`):y&&n.push(`background-color:${y}`),Ar(e,"caps")?n.push("text-transform:uppercase"):Ar(a,"caps")&&n.push("text-transform:none"),Ar(e,"smallCaps")?n.push("font-variant:small-caps"):Ar(a,"smallCaps")&&n.push("font-variant:normal");let h=mt(fr(t,"vertAlign")),x=h==="superscript"||h==="subscript"?h:null,w=qi((r?_t(t,"lang","bidi"):void 0)??_t(t,"lang","val")??_t(t,"lang","bidi")??_t(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:x,lang:w,rtl:r}}function kK(e,t,n=false){let r=[],o=mt(fr(e,"jc")),i=o!==void 0&&Object.hasOwn(zg,o)?zg[o]:void 0;i&&r.push(`text-align:${n&&i!=="center"&&i!=="justify"?i==="left"?"right":"left":i}`);let a=Rn(_t(e,"spacing","before"));a!==null&&a>=0&&r.push(`margin-top:${Mr(a)}`);let s=Rn(_t(e,"spacing","after"));s!==null&&s>=0&&r.push(`margin-bottom:${Mr(s)}`);let l=Rn(_t(e,"spacing","line")),c=_t(e,"spacing","lineRule");r.push(...TR(l,c));let d=null,u=null,f=null,p=null;for(let h of e){let x=me(h,"ind");if(!x)continue;let w=Rn(ur(x,"left",pa$2)??ur(x,"start",pa$2));w!==null&&(d=w);let v=Rn(ur(x,"right",pa$2)??ur(x,"end",pa$2));v!==null&&(u=v);let k=Rn(ur(x,"hanging",pa$2)),E=Rn(ur(x,"firstLine",pa$2));k!==null?(f=k,p=null):E!==null&&(p=E,f=null);}!t&&d!==null&&r.push(`margin-${n?"right":"left"}:${Mr(d)}`),u!==null&&r.push(`margin-${n?"left":"right"}:${Mr(u)}`),f!==null&&f!==0?r.push(`text-indent:${Mr(-f)}`):p!==null&&p!==0&&r.push(`text-indent:${Mr(p)}`);let g=YF(fr(e,"tabs"));g&&r.push(g),Qr(e,"pageBreakBefore")&&r.push("page-break-before:always"),Qr(e,"keepNext")&&r.push("page-break-after:avoid"),Qr(e,"keepLines")&&r.push("page-break-inside:avoid"),Qr(e,"widowControl")&&r.push("widows:2","orphans:2");let b=up(_t(e,"shd","fill"));b&&r.push(`background-color:${b}`);let y=fr(e,"pBdr");if(y)for(let h of ["top","left","bottom","right"]){let x=Ki(me(y,h));x&&r.push(`border-${h}:${x}`,`mso-border-${h}-alt:${x}`);}return r.join(";")}function IK(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 JF={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function tD(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 RK(e,t){let n,r;for(let s of t){let l=me(s,"numPr");if(!l)continue;let c=mt(me(l,"numId"));c!==void 0&&(n=c);let d=mt(me(l,"ilvl"));d!==void 0&&(r=d);}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),c=l===void 0?void 0:e.styles.byId.get(l),d=mt(me(me(me(c??null,"pPr"),"numPr"),"numId")),u=d===void 0?void 0:e.numbering.numToAbstract.get(d);if(u===void 0||u===o)break;o=u;}let i=Math.min(Math.max(si(r)??0,0),8),a=tD(e,n,o,i);return {numId:n,abstractId:o,level:i,fmt:a.fmt,start:a.start}}function PK(e,t){let n=K$1(e.pkg.contentTypes,t);if(n.ok){let i=wK.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 TK(e,t){let n=Is(t,"inline",wa)??Is(t,"anchor",wa);if(!n)return "";let r=Is(n,"blip",va);if(!r)return "";let o=Jh$1(r,"embed",ya);if(!o)return "";let i=e.docRels.find(b=>b.id===o&&b.targetMode!=="External");if(!i)return "";let a=E$3(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=PK(e,a.partName);if(!l||s.byteLength>e.maxImageBytes||e.imageBudget.used+s.byteLength>e.maxTotalImageBytes)return "";e.imageBudget.used+=s.byteLength;let c=e.imageDataUris.get(a.partName);c==null&&(c=`data:${l};base64,${Lu(s)}`,e.imageDataUris.set(a.partName,c));let d=Is(n,"extent",wa),u=d?si(Jh$1(d,"cx","")):null,f=d?si(Jh$1(d,"cy","")):null,p=b=>Math.round(b/12700*100)/100,g=u!==null&&f!==null&&u>0&&f>0?` width="${Math.round(u/QF)}" height="${Math.round(f/QF)}" style="width:${p(u)}pt;height:${p(f)}pt"`:"";return `<img src="${c}"${g}>`}function da(e,t,n=0){if(n>=Aa$1)return;let r=dh$1(e)?n+1:Ba(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)&&da(i,t,r+1);continue}if(o.kind==="fldChar"){nD(o,t);continue}da(o,t,r);}}function nD(e,t){let n=Jh$1(e,"fldCharType",pa$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 EK(e,t,n,r){let o=t.children.find(c=>c.kind==="runProperties"),i=fp(e.styles,n,o&&Ze(o)?o:null,e.tableRPr),a=SK(i),s="";for(let c of t.children){if(!Ze(c))continue;if(c.kind==="fldChar"){r.inert||nD(c,r);continue}if(c.kind==="instrText"||!r.inert&&r.stack.some(f=>f==="instr")||a.vanish)continue;let d=MR(c);if(d!==""){s+=d;continue}let u=OR(c,e.noteBody,(f,p)=>IK(e,f,p),(f,p)=>e.availableNotes[f].has(p));if(u!==""){s+=u;continue}switch(c.kind){case "text":s+=ev(Jb(c));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let f=Jh$1(c,"type",pa$2);s+=f==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let f=Rr(Jh$1(c,"name",pa$2));f!==null&&(s+=`<a id="${Yr(f)}"></a>`);break}case "drawing":s+=TK(e,c);break;default:s+=yb$1(c)?.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="${Yr(a.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function ca(e,t,n,r,o=0){if(o>=Aa$1)return "";let i="";for(let a of t)if(Ze(a))switch(dh$1(a)?"fldSimple":a.kind){case "run":i+=EK(e,a,n,r);break;case "hyperlink":{let s=ca(e,a.children,n,r,o+1);if(s==="")break;let l=Jh$1(a,"id",ya),c=l?e.docRels.find(f=>f.id===l):void 0,d=c===void 0?void 0:c.targetMode==="External"||c.rawTarget.startsWith("#")?c.rawTarget:void 0,u=nP(d,Jh$1(a,"anchor",pa$2));i+=u!==null?`<a href="${Yr(u)}">${s}</a>`:s;break}case "bookmarkStart":{let s=Rr(Jh$1(a,"name",pa$2));s!==null&&(i+=`<a id="${Yr(s)}"></a>`);break}case "fldSimple":i+=ca(e,a.children,n,r,o+1);break;case "contentControl":{let s=a.children.find(l=>l.kind==="contentControlContent");s&&Ze(s)&&(i+=ca(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":i+=ca(e,a.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":da(a,r,o);break;case "generic":if(Lg$1(a))i+=aR(a);else if(Ca(a))i+=ca(e,a.children,n,r,o+1);else {let s=nd(a);s&&(i+=ca(e,s,n,r,o+1));}break}return i}function CK(e,t){let n=mt(me(t,"pStyle")),r=Mo(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let i=Jh$1(r[o],"styleId",pa$2),a=i?/^Heading([1-6])$/.exec(i):null;if(a)return {level:Number(a[1]),fromStyle:true}}if(n===void 0){let o=si(mt(me(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function OK(e,t){let n=Mo(e.styles,mt(me(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=RR(Jh$1(n[r],"styleId",pa$2));if(o!==null)return o}return null}function eD(e,t,n,r){let o=t.children.find(y=>y.kind==="paragraphProperties"),i=o&&Ze(o)?o:null,a=tv(e.styles,i,e.tablePPr),s=kK(a,n.asListItem,Qr(a,"bidi")),l=ca(e,t.children,i,r),c=s===""?"":` style="${Yr(s)}"`,d=Qr(a,"bidi")?' dir="rtl"':"",u=OK(e,i),f=u===null?"":` class="${u}"`,p=CK(e,i);if(n.asListItem)return `<li${p?.fromStyle===true?` class="Heading${p.level}"`:f}${d}${c}>${l}</li>`;let g=p===null?"p":`h${p.level}`,b=p===null?f:p.fromStyle?` class="Heading${p.level}"`:' class="docx-outline"';return `<${g}${b}${d}${c}>${l}</${g}>`}var MK={renderBlocks:(e,t,n)=>hp(e,t,n),advanceFieldState:da};function hp(e,t,n){let r="",o=[],i=null,a=new Map,s=n;if(s===void 0){let f={stack:[]};for(let p of t)Ze(p)&&da(p,f);s={stack:[],inert:f.stack.length>0};}let l=()=>{let f=o.pop();f&&(r+=`</${f.tag}>`);},c=()=>{for(;o.length>0;)l();i=null;},d=(f,p)=>{for(i!==null&&p.level<i&&c();o.length>0&&o[o.length-1].abstractId!==p.abstractId;)l();o.length===0&&(i=p.level);let g=i??p.level,b=p.level-g+1;for(;o.length>b;)l();for(o.length===b&&o[b-1].numId!==p.numId&&l();o.length<b;){let x=g+o.length,w=tD(e,p.numId,p.abstractId,x),v=a.get(`${p.abstractId}:${p.numId}:${x}`)??0,k=w.start+v,E=w.fmt==="bullet"?"ul":"ol",I=E==="ol"?Object.hasOwn(JF,w.fmt)?JF[w.fmt]:"decimal":null,P=E==="ol"&&k!==1?` start="${k}"`:"";r+=I?`<${E}${P} style="list-style-type:${Yr(I)}">`:`<${E}>`,o.push({tag:E,numId:p.numId,abstractId:p.abstractId});}let y=`${p.abstractId}:${p.numId}:${p.level}`;a.set(y,(a.get(y)??0)+1);let h=`${p.abstractId}:`;for(let x of a.keys()){if(!x.startsWith(h))continue;let w=x.slice(x.lastIndexOf(":")+1);/^\d+$/.test(w)&&Number(w)>p.level&&a.delete(x);}r+=eD(e,f,{asListItem:true},s);},u=f=>{for(let p of f)if(Ze(p))switch(p.kind){case "paragraph":{let g=p.children.find(h=>h.kind==="paragraphProperties"),b=g&&Ze(g)?g:null,y=RK(e,tv(e.styles,b));y?d(p,y):(c(),r+=eD(e,p,{asListItem:false},s));break}case "table":c(),r+=ZF(e,p,s,MK);break;case "contentControl":{let g=p.children.find(b=>b.kind==="contentControlContent");g&&Ze(g)&&u(g.children);break}case "generic":u(p.children);break;case "bookmarkStart":{let g=Rr(Jh$1(p,"name",pa$2));g!==null&&(r+=`<a id="${Yr(g)}"></a>`);break}default:s.inert||da(p,s);break}};return u(t),c(),r}function rD(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Ze(n.root))return "";let r=n.root.children.find(c=>c.kind==="body");if(!r||!Ze(r))return "";let o=Dc(e,yK,"/word/footnotes.xml"),i=Dc(e,bK,"/word/endnotes.xml"),a={pkg:e,styles:DF(e),numbering:HF(Dc(e,hK,"/word/numbering.xml")),docRels:tg(e,e.mainDocumentPart),maxImageBytes:vK,maxTotalImageBytes:xK,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:av(o,"footnote"),endnote:av(i,"endnote")},noteBody:null},s=hp(a,r.children),l=XF(a,{footnote:o,endnote:i},da);return s+sv(a,"footnote",o,l.footnote,hp)+sv(a,"endnote",i,l.endnote,hp)}var AK=12*1024*1024;function LK(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function FK(e){return `<div><table>${e.split(`
|
|
28
|
+
`).map(n=>`<tr>${n.split(" ").map(r=>`<td>${LK(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function cv(e){if(e.cellRectangle)return {text:e.text,html:FK(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=M$1(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null,...t.reason==="unsupported-content"?{reason:t.reason}:{}};let n=e.maxFragmentBytes??AK,r=t.bytes;if(t.bytes.byteLength>n){let a=M$1(e.pkg,e.coverage,{omitMedia:true});r=a.ok&&a.bytes.byteLength<=n?a.bytes:null;}let o;try{o=rD(t.package);}catch(a){console.error("docx-editor: copy HTML flavour failed to render",a),o="";}let i=fR(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:i}}function oD(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=jo(r);if(!e.richLaneOpen)return o&&FF(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=uT(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 iD(e,t){let n=Ue(e,t);if(!n.includes("\xAD"))return n;let r=n.split("");for(let{line:o}of Wb$1(e,t)??[])for(let i of _a(o,t)?.spans??[])Ed(i)&&i.range.start<r.length&&(r[i.range.start]=Rb$1);return r.join("")}function aD(e){return e.includes(Rb$1)?e.replaceAll(Rb$1,""):e}function sD(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!Wk(e.settingsRoot()))return r;let i=de(e,t.paragraphId)??e.part();if(!Xk(i,t.paragraphId))return r;let a=eb$1(i,t.paragraphId);if(a?.kind!=="paragraph")return r;let s=Yk(a).find(y=>y.fieldNodeId===o&&y.start<=t.offset&&y.end>=n.offset);if(!s?.enabled||!Ik(s)||s.maxLength<=0)return r;let l=(Jm(i,t.paragraphId)??"").slice(s.start,s.end),c=l.slice(0,t.offset-s.start),d=l.slice(n.offset-s.start),u=c+d,f=y=>Jk(c+y+d,s,u)<=s.maxLength;if(f(r))return r;let p=[...r],g=s.maxLength-[...u].length;if(s.type==="number"&&s.format)for(let y of u)(y===","&&s.format.includes(",")||y==="%"&&s.format.endsWith("%"))&&g++;let b=new Set;if(s.type==="date"){let y=0;for(let h=0;h<p.length;h++)if(/\S/.test(p[h])){if(++y>18)break;b.add(h+1);}else (h+1===p.length||/\S/.test(p[h+1]))&&b.add(h+1);}else if(s.type==="number"&&s.format)for(let y=1;y<=3;y++)b.add(g+y);for(let y of [...b].sort((h,x)=>x-h)){if(y<=Math.max(0,g)||y>p.length)continue;let h=p.slice(0,y).join("");if(f(h))return h}return p.slice(0,Math.max(0,g)).join("")}function DK(e,t){let n=eb$1(e,t);if(!n||!tc$1(n))return false;let r=fb$2(e,t)?.children??[];return r[r.findIndex(i=>i.id===t)+1]?.kind==="paragraph"}var NK=2e3;function lD(e){let{session:t}=e,n=null;function r(s){let l=Uu(s),c=e.orderedRange(),d=sD(t,c.from,c.to,l,e.textFormFieldId?.()??null).split(`
|
|
29
|
+
`),u=e.deleteSelectionPlan(),f=u.replaceAt??u.collapseTo,p=d.join(""),g=[...u.ops],b=e.consumePendingFormatOps(f.paragraphId,f.offset,p.length);if(p.length>0){let E=u.ops.length===0&&d.length===1?e.insertOwner?.():void 0;g.push({op:"insertText",paragraphId:f.paragraphId,offset:f.offset,text:p,...E===void 0?{}:{inside:E}}),g.push(...b);}let y=[],h=0;for(let E=0;E<d.length-1;E+=1)h+=d[E].length,y.push(f.offset+h);if(y.length>0&&g.push({op:"splitParagraphMany",paragraphId:f.paragraphId,offsets:y}),g.length===0)return;let x=new Set(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())),w=d[d.length-1],v=y.length===0?e.caretMark({paragraphId:f.paragraphId,offset:f.offset+w.length}):void 0,k=g.filter(E=>!b.includes(E));e.commit(()=>e.withoutPendingOnRejection(g,k,e.selectionMark(),v),()=>{if(y.length===0)return Ke({paragraphId:f.paragraphId,offset:f.offset+w.length});let E=(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())).filter(P=>!x.has(P)),I=E[E.length-1];return I?Ke({paragraphId:I,offset:w.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection(),l=e.orderedRange(),c=e.paragraphOrder(),d=s?ma$1(e.layout(),s.cellIds):c.slice(c.indexOf(l.from.paragraphId),c.indexOf(l.to.paragraphId)+1),u=new Map(d.map(O=>[O,{start:!s&&O===l.from.paragraphId?l.from.offset:0,end:!s&&O===l.to.paragraphId?l.to.offset:1/0}])),p=e.storyScope().kind==="body"?t.part():de(t,d[0]??l.from.paragraphId);if(p&&Qb(p,u)){let O=LF(p,u);return e.commit(()=>({committed:false,rejected:true,opCount:0,reason:O?Lc:"unsupported-content"})),{text:"",html:null,reason:O?"chart-content":"unsupported-content"}}let g=e.revisionDisplayMode?.()!=="original",b=$O(iD,!g),y=O=>aD(O).replaceAll(Af,""),h=mc(e.layout(),b);if(s)return cv({text:y(pa$1(e.layout(),s,h.spelledText)),cellRectangle:true,coverage:null,pkg:null});let{from:x,to:w}=e.orderedRange(),v=t.part(),k=y(ub(e.layout(),x,w,e.paragraphOrder(),(O,S)=>h.resultAt(O,S)??(v?EF(v,O,S):null),h.markedText,g&&v?O=>DK(v,O):void 0)),E=e.storyScope();if(x.paragraphId===w.paragraphId&&x.offset===w.offset||E.kind!=="body")return {text:k,html:null};let P=t.part(),C=GO(e.layout(),P,x,w,e.paragraphOrder());return cv({text:k,cellRectangle:false,coverage:C,pkg:t.currentPackage()})}function i(s,l){let c=e.editingMode()==="suggest"?e.suggestion?.():void 0;if(e.editingMode()!=="edit"&&c===void 0||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let d=e.deleteSelectionPlan(),u=c?e.trackedOps?.(d.ops,c.date)??d.ops:d.ops,f=d.replaceAt??d.collapseTo,p=false,g=false;return e.commit(()=>{let b=e.collaborationGate(u,{kind:"body"});if(b)return {committed:false,rejected:true,opCount:0,reason:b};let y=e.actorId(),h=t.applyFragmentPaste({kind:"body"},{paragraphId:f.paragraphId,offset:f.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:u,...y!==void 0?{actorId:y}:{},...c?{revision:c}:{}});return p=h.ok,p&&c&&e.trackedChangeLanded?.(),g=!h.ok&&h.detail==="fragment-merge:unsupported-content",{committed:h.ok,rejected:!h.ok,opCount:h.ok?1:0,...h.ok?{}:{reason:h.detail??h.reason}}},()=>Ke(f)),g?"unsupported-content":p}function a(s,l){let c=n!==null&&e.now()-n<NK;n=null;let d=oD({richLaneOpen:(e.richPasteAllowed?.()??true)&&(e.editingMode()==="edit"||e.editingMode()==="suggest"&&e.suggestion?.()!==void 0)&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(u,f)=>i(u,f),insertPlainText:r},{html:l,text:s,forcePlain:c});if(d==="unsupported-content"){let u=l?jo(l):null,f=u!==null&&Fc(u.bytes)==="chart";return e.commit(()=>({committed:false,rejected:true,opCount:0,reason:f?Lc:"unsupported-content"})),false}return d!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:a,armForcePlainPaste:()=>{n=e.now();}}}function cD(e){let{session:t}=e,n=null,r=()=>n??e.selection(),o=()=>n?null:e.cellSelection();function i(){return ra(e.selection())}function a(){e.flushPendingInputAndLayout();let v=r(),k=v.anchor.paragraphId===v.head.paragraphId?void 0:e.paragraphOrder();return Ff(e.layout(),v,k)}function s(){return a().from}function l(v){return Ue(e.layout(),v)}function c(v,k){let E=t.partFor(e.storyScope())??t.part(),I=eb$1(E,v.paragraphId);if(!I||I.kind!=="paragraph")return null;let P=k==="before"?yi(I,v.offset):zi$1(I,v.offset);if(!P)return null;let C=Lh$1(E,P.controlId),O=C?qc$1(C):null;if(!O)return null;let S=O.lock==="contentLocked"||O.lock==="sdtContentLocked";if(!(S||O.type==="checkbox"||O.type==="picture")||!C)return null;let B=false,W=e.trackedAuthorOrNone()!==void 0;for(let q=W?fb$2(E,C.id):null;q&&(q.kind==="revisionDelete"&&(B=true),!(B||q.kind==="paragraph"));q=fb$2(E,q.id));return {...P,contentLocked:S,...B?{struck:B}:{}}}function d(v,k){return e.flushPendingInputAndLayout(),e.cellSelection()?null:_O({layout:e.layout(),selection:e.selection(),direction:v,shown:k,controlBeside:c,tracked:e.trackedAuthorOrNone()!==void 0})}function u(v){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let k=a();return k.from.paragraphId===k.to.paragraphId&&k.from.offset===k.to.offset?e.atParagraphEnd(v.paragraphId,v.offset):e.atParagraphEnd(k.to.paragraphId,k.to.offset)}function f(v){let k=v?.trim()||void 0,E=p(g(k!==void 0||e.trackedAuthorOrNone()!==void 0),!k&&e.editingMode()!=="suggest"),I=o(),P=null;return {...E,get replaceAt(){return P??=x(E,k,I),P}}}function p(v,k){if(!k||v.ops.length===0||o())return v;let{from:E,to:I}=a();if(E.paragraphId===I.paragraphId)return v;let P=de(t,E.paragraphId)??t.part(),C=Nk(P,E,I,e.paragraphOrder());return C.length===0?v:{...v,ops:[...C,...v.ops]}}function g(v=e.trackedAuthorOrNone()!==void 0){e.flushPendingInputAndLayout();let k=o();if(k){let C=[];for(let O of ma$1(e.layout(),k.cellIds)){let S=Ue(e.layout(),O).length;S>0&&C.push({op:"deleteText",paragraphId:O,start:0,end:S});}return {ops:C,collapseTo:s()}}let E=r();if(E.anchor.paragraphId===E.head.paragraphId&&E.anchor.offset===E.head.offset)return {ops:[],collapseTo:Zb$2(e.layout(),E.head)};let{from:I,to:P}=a();return zO(e.layout(),t.partFor(e.storyScope())??t.part(),I,P,e.paragraphOrder(),e.revisionView(),v)}function b(){return f().ops}function y(v){let k=n;n=v;try{let E=f();return {ops:E.ops,replaceAt:E.replaceAt??E.collapseTo}}finally{n=k;}}function h(v,k,E){if(!(E!==void 0||e.editingMode()==="suggest")||v.paragraphId!==k.paragraphId||k.offset<=v.offset)return v.offset;let P=(E??e.author())?.trim();if(!P)return Zb$2(e.layout(),k).offset;let C=de(t,k.paragraphId)??t.part(),O=eb$1(C,k.paragraphId);return !O||O.kind!=="paragraph"?Zb$2(e.layout(),k).offset:np(O,v.offset,k.offset,P,e.trackedDate())}function x(v,k,E){let I=v.collapseTo;if(k===void 0&&e.editingMode()!=="suggest")return I;if(E){for(let ee of E.cellIds){let fe=la$2(e.layout(),[ee]),se=fe.length>0?fe:ma$1(e.layout(),[ee]);if(se.length===0)continue;let $=new Map,H=z=>{let X=$.get(z);return X===void 0&&(X=h({paragraphId:z,offset:0},{paragraphId:z,offset:l(z).length},k),$.set(z,X)),X},j=(k??e.author())?.trim(),N=z=>{let X=l(z);if(!j)return /\S/.test(X);let F=eb$1(de(t,z)??t.part(),z);if(!F||F.kind!=="paragraph")return /\S/.test(X);let K="",V=0;for(let Y of Dj$1(F,0,X.length,j))K+=X.slice(V,Math.max(V,Y.start)),V=Math.max(V,Y.end);return K+=X.slice(V),/\S/.test(K)},D=null;for(let z=se.length-1;z>=0;z-=1){let X=se[z];if(N(X)){D=X;break}}if(D===null)for(let z=se.length-1;z>=0;z-=1){let X=se[z];if(H(X)!==0){D=X;break}}return D??=se[se.length-1],{paragraphId:D,offset:H(D)}}return I}let{from:P,to:C}=a();if(P.paragraphId===C.paragraphId&&P.offset===C.offset)return I;if(P.paragraphId===C.paragraphId)return {paragraphId:C.paragraphId,offset:h(P,C,k)};let O=new Set(v.ops.flatMap(ee=>ee.op==="deleteBlock"?[ee.blockId]:[])),S=de(t,C.paragraphId)??t.part();if(O.size>0)for(let ee=fb$2(S,C.paragraphId);ee;ee=fb$2(S,ee.id)){if(!O.has(ee.id))continue;let fe={paragraphId:I.paragraphId,offset:l(I.paragraphId).length};return {paragraphId:I.paragraphId,offset:h(I,fe,k)}}let T=(k??e.author())?.trim();if(!T)return I;let B=new Set(v.ops.flatMap(ee=>ee.op==="joinParagraphs"?[ee.secondId]:[])),W=e.paragraphOrder(),q=W.indexOf(P.paragraphId),U=W.indexOf(C.paragraphId);if(q===-1||U===-1)return I;let Z=ee=>{let fe=eb$1(S,ee);return fe?.kind==="paragraph"&&En(fe,T)},M=U;for(;M>q&&B.has(W[M])&&Z(W[M-1]);)M-=1;let J=0;for(let ee=M;ee<=U;ee+=1){let fe=W[ee],se={paragraphId:fe,offset:fe===P.paragraphId?P.offset:0},$=fe===C.paragraphId?Zb$2(e.layout(),C):{paragraphId:fe,offset:l(fe).length};ee===M&&(J+=se.offset),J+=$.offset-se.offset-w(se,$,T);}return {paragraphId:W[M],offset:J}}function w(v,k,E){let I=E?.trim();if(!I||v.paragraphId!==k.paragraphId)return 0;let P=de(t,k.paragraphId)??t.partFor(e.storyScope())??t.part(),C=eb$1(P,k.paragraphId);return !C||C.kind!=="paragraph"?0:Cj$1(C,v.offset,k.offset,I)}return {selectionMark:i,orderedRange:a,orderedStart:s,textOf:l,inlineControlBeside:c,atomicControlDeletion:d,splitEndsTheParagraph:u,deleteSelectionPlan:f,deleteSelectionOps:b,deleteRangePlan:y,replacementOffset:h}}function Hc(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 uD=[24,16,12,8,6,4],HK=8;function dD(e,t,n,r,o){let i=r.textOf(e.paragraphId)??"",a=n.after.slice(0,HK);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 c=o.indexOf(l);if(!(c<0))for(let d of [c,c-1,c+1])o[d]&&s.add(o[d]);}for(let l of uD){if(n.before.length<l)continue;let c=n.before.slice(-l);if(i.slice(Math.max(0,e.offset-l),e.offset)===c)return e;let d=null;for(let u of s){let f=r.textOf(u)??"";for(let p=f.indexOf(c);p>=0;p=f.indexOf(c,p+1)){if(d)return e;d={...e,paragraphId:u,offset:p+c.length};}}if(d)return d}return e}var yp="stale",_K=16;function bp(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 fD(e){let t=null,n=false,r=i=>{let a=new Set(e.order());return i.filter(s=>a.has(s)).slice(0,_K).map(s=>({id:s,text:e.textOf(s)??""}))};return {expectHistory(i){n=i;},note(i,a,s){let l=n;if(n=false,t!==null){l&&t!==yp&&t.history.length===0&&(t={...t,history:r(a)});return}if(!s){t=yp;return}let c=new Map;for(let u of [i.anchor.paragraphId,i.head.paragraphId]){let f=e.textOf(u);f!==null&&c.set(u,f);}let d=u=>{let f=c.get(u.paragraphId)??"",p=uD[0];return {before:f.slice(Math.max(0,u.offset-p),u.offset),after:f.slice(u.offset,u.offset+p)}};t={selection:i,before:c,order:e.order(),context:{anchor:d(i.anchor),head:d(i.head)},history:l?r(a):[]};},noteLocal(){t!==null&&(t=yp);},discard(){t=null;},map(i){let a=o(i);return bp(a,i)?i:a}};function o(i){let a=t;if(t=null,!a)return i;let s=e.carried?.()??null,l=v=>s&&bp(s.from,v)&&bp(i,v)&&e.textOf(s.to.anchor.paragraphId)!==null&&e.textOf(s.to.head.paragraphId)!==null?s.to:null;if(a===yp)return l(i)??i;let c=e.order(),d=new Set(c);for(let{id:v,text:k}of a.history){if(!d.has(v))continue;let E=e.textOf(v)??k;if(E===k)continue;let I=0;for(;I<k.length&&I<E.length&&k[I]===E[I];)I+=1;let P={paragraphId:v,offset:I+Math.max(0,E.length-k.length)};return {anchor:P,head:P}}let u=new Set(c),f=l(a.selection);if(f)return f;let p=new Set(a.order),g=v=>{let k=a.before.get(v.paragraphId),E=e.textOf(v.paragraphId);if(k===void 0||E===null||E.length>=k.length||!k.startsWith(E)||v.offset<=E.length)return null;let I=c[c.indexOf(v.paragraphId)+1];return I===void 0||p.has(I)||!(e.textOf(I)??"").startsWith(k.slice(E.length))?null:{paragraphId:I,offset:v.offset-E.length}},b=g(i.anchor),y=g(i.head),h=i;for(let[v,k]of a.before)u.has(v)&&(h=Hc(h,v,k,e.textOf(v)??k));h={anchor:b??h.anchor,head:y??h.head};let x=v=>{if(u.has(v.paragraphId))return v;let k=a.order.indexOf(v.paragraphId),E=null;for(let C=k-1;C>=0&&E===null;C-=1)u.has(a.order[C])&&(E=a.order[C]);let I=a.before.get(v.paragraphId),P=E===null?"":e.textOf(E)??"";if(E!==null&&I!==void 0&&P.endsWith(I)){let C=P.length-I.length+v.offset;return {paragraphId:E,offset:C}}for(let C=k+1;k>=0&&C<a.order.length;C+=1){let O=a.order[C];if(u.has(O))return {paragraphId:O,offset:0}}return E===null?v:{paragraphId:E,offset:P.length}};return !(c.length!==a.order.length||c.some((v,k)=>v!==a.order[k]))||!bp(i,a.selection)?{anchor:x(h.anchor),head:x(h.head)}:{anchor:dD(x(h.anchor),i.anchor,a.context.anchor,e,c),head:dD(x(h.head),i.head,a.context.head,e,c)}}}function pD(e,t){let n=e?.historySelection?.()??null;return n&&t?BK(n,t):null}function mD(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 BK(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 gD(e){return {atParagraphEnd(t,n){let r=Jm(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=ci$1(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 dv=4096;function hD(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"?qK(e,n,o):$K(n,r)}})}async function $K(e,t,n){let r=be$1().metafile?.rasterize;if(!r)return WK(e,t);let o=await r(e,t,{maxEdge:dv});return o?Object.freeze({bytes:o.bytes,mime:o.mime}):null}async function WK(e,t){let{convertEmfToDataUrl:n,convertWmfToDataUrl:r}=await import('emf-converter'),o=new Uint8Array(e),i=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),a={maxWidth:dv,maxHeight:dv},s=t==="image/x-emf"?await n(i,a):await r(i,a),l="data:image/png;base64,";if(!s?.startsWith(l))return null;let c=atob(s.slice(l.length)),d=new Uint8Array(c.length);for(let u=0;u<c.length;u+=1)d[u]=c.charCodeAt(u);return Object.freeze({bytes:d,mime:"image/png"})}async function qK(e,t,n){let r=await a$5(t,n);if(r===null)return null;let o=await KK(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function KK(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(c=>l(c),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function yD(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function bD(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);}})}function vD(e,t){e.contentEditable=t?"true":"false",e.setAttribute("aria-readonly",t?"false":"true"),t?e.removeAttribute("tabindex"):e.tabIndex=0;}var UK="docx-editor-one-surface__caret",uv="docx-editor-one-surface__caret--steady",jK=530;function xD(e,t,n){let r=e.ownerDocument.createElement("div");r.className=UK,r.dataset.docxCaret="",r.dataset.docxMarker="",r.setAttribute("contenteditable","false"),r.setAttribute("aria-hidden","true"),r.dataset.noColorInvert="",r.style.position="absolute",r.style.pointerEvents="none",r.style.userSelect="none",r.style.setProperty("-webkit-user-select","none");let o=false,i=nt(()=>e),a=null,s=null,l=null;function c(){let x=e.ownerDocument.activeElement;return x===e||!!x&&e.contains(x)}function d(x){return x.anchor.paragraphId===x.head.paragraphId&&x.anchor.offset===x.head.offset}function u(){s=null,a!==null&&(i.clearTimeout(a),a=null),r.classList.remove(uv),r.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function f(){r.classList.add(uv),a!==null&&i.clearTimeout(a),a=i.setTimeout(()=>{a=null,r.classList.remove(uv);},jK);}function p(){if(o||!c()||n().suppress){u();return}let{layout:x,selection:w,scopedHost:v,scopedHostKind:k,scopedOrigin:E,preferredPageIndex:I,preferredLineId:P,measurer:C,typingStyle:O}=n(),S=t();if(!d(w)){u();return}let T=Re(x,w.head,{...C?{measurer:C}:{},...I!==void 0?{preferredPageIndex:I}:{},...P!==void 0?{preferredLineId:P}:{}});if(!T||!Number.isInteger(T.pageIndex)){u();return}if(O&&C){let{pageIndex:Z,lineId:M}=T,J=Wb$1(x,w.head.paragraphId)?.find(fe=>fe.pageIndex===Z&&fe.line.id===M),ee=J?.line;if(ee&&!ee.drawings?.length&&!te(T)&&(ee.spans.length>0||ee.box.height>0)){let fe=O();if(fe){let se={...Bf(x,w)??la$1,...fe},$=C.lineMetrics(se);if($.height>0){let H=ic$1({...T,width:0,y:ee.spans.length>0?ee.box.y+ee.baseline-$.baseline-qa$1(se):T.y,height:$.height},J?.clipBox);if(!H){u();return}T=H;}}}}let B=v??e.querySelector(`[data-page-index="${T.pageIndex}"] > .docx-page-content`);if(!B){u();return}if(!(T.height>0)){u();return}r.style.left=`${(T.x-(E?.x??0))*S}px`,r.style.top=`${(T.y-(E?.y??0))*S}px`,r.style.height=`${T.height*S}px`;let W=te(T);r.style.transformOrigin=W?"0 0":"",r.style.transform=W?"rotate(-90deg)":"",r.parentNode!==B&&B.append(r),e.style.caretColor="transparent",l&&l!==v&&l.style.removeProperty("caret-color"),l=v??null,l?.style.setProperty("caret-color","transparent");let q=B===v?k??"scoped":"body",U=`${T.pageIndex}:${q}:${T.x}:${T.y}:${T.height}`;U!==s&&(s=U,f());}let g=()=>{o=true,p();},b=()=>{o=false,p();},y=()=>p(),h=x=>{let w=x.relatedTarget;w&&e.contains(w)||u();};return e.addEventListener("compositionstart",g),e.addEventListener("compositionend",b),e.addEventListener("focusin",y),e.addEventListener("focusout",h),{update:p,destroy(){e.removeEventListener("compositionstart",g),e.removeEventListener("compositionend",b),e.removeEventListener("focusin",y),e.removeEventListener("focusout",h),u();}}}function fv(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)fv(o.blocks,t);}}function VK(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});};fv(n.fragments,r);for(let o of [n.header,n.footer])o&&fv(o.fragments,r);}}function pv(e,t,n,r){let o=null;return VK(e,i=>{i.table.tableId===t&&i.row.id===n&&i.row.isHeaderRepeat===r&&(o=i);}),o}function mv(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function wD(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function SD(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function kD(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var zK=120,ID=20;function vp(e){return Qd(Cl(e,"w"))??0}function ZK(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function gv(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function hv(e,t){return t.kind==="insertColumn"?pv(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?pv(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function RD(e){return Math.min(160,e)}function PD(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=nt(()=>t),r=null,o=null,i=null,a=null,s=null,l=null,c=false,d=0,u=0,f=null,p=null,g=null;function b(F){return Ou(F,"button")&&(F.classList.contains("docx-table-insert-row")||F.classList.contains("docx-table-insert-column"))}function y(){let F=t.ownerDocument.activeElement;return F!==null&&b(F)&&F.closest(".docx-table-furniture")===t?F:null}function h(F){for(let K of [...t.children])b(K)&&K!==F&&K.remove();}function x(){p=null,g=null;}function w(){r!==null&&(n.clearTimeout(r),r=null);}function v(){for(let K of [...t.children])b(K)||K.remove();let F=y();if(!F){h(null),x();return}p=F,h(F);}function k(F){let K=p??y(),V=K!==null&&t.ownerDocument.activeElement===K;x(),t.replaceChildren(),F&&V&&e.pagesLayer.focus({preventScroll:true});}function E(){for(let F of [...t.children])b(F)||F.remove();}function I(F,K,V,Y){let oe=e.read().layout.pages[F];if(!oe)return {left:0,top:0};let ae=Y??oe.contentBox,xe=e.scale(),we=e.pageOffsetX(F);return {left:(ae.x+K+we)*xe,top:(ae.y+V)*xe}}function P(F,K){let V=e.read(),Y=Ac(V.layout,K.tableId,K.pageIndex);if(!Y)return;let{table:le,origin:oe}=Y,ae=t.ownerDocument.createElement("div");ae.className="docx-table-resize-preview",ae.style.position="absolute",ae.style.pointerEvents="none";let xe=K.kind!=="rowDivider",we=I(K.pageIndex,xe?le.box.x+F:le.box.x,xe?le.box.y:le.box.y+F,oe);ae.style.left=`${we.left}px`,ae.style.top=`${we.top}px`,ae.style.width=xe?"2px":`${le.box.width*e.scale()}px`,ae.style.height=xe?`${le.box.height*e.scale()}px`:"2px",t.append(ae);}function C(){let F=t.ownerDocument.createElement("button");return F.type="button",F.textContent="+",F.style.position="absolute",F.style.pointerEvents="auto",F}function O(F){W(F);let K=g;if(!K)return;let V=e.read();K.kind==="insertRow"?U(K,V):K.kind==="insertColumn"&&Z(K,V);}function S(){queueMicrotask(()=>{!p||t.ownerDocument.activeElement===p||c||o?.kind==="insertRow"||o?.kind==="insertColumn"||(p.remove(),x());});}function T(){if(p&&t.contains(p))return p;let F=y();if(F)return p=F,F;let K=C();return K.addEventListener("pointerenter",()=>{c=true,w();}),K.addEventListener("pointerleave",()=>{c=false;}),K.addEventListener("pointerdown",W),K.addEventListener("mousedown",W),K.addEventListener("click",O),K.addEventListener("blur",S),p=K,K}function B(F,K){let V=Ac(K.layout,F.tableId,F.pageIndex);if(!V)return;let{table:Y,origin:le}=V,oe=T();if(h(oe),g=F,oe.dataset.tableId=F.tableId,F.kind==="insertRow"){let ae=Y.rows.find(at=>at.id===F.rowId);if(!ae)return;oe.dataset.rowId=F.rowId,delete oe.dataset.gridColumnId,oe.className="docx-table-insert-row",oe.setAttribute("aria-label",e.label("table.insertRowBelow"));let xe=ae.box.y+ae.box.height/2,we=I(F.pageIndex,Y.box.x-14,xe,le);oe.style.left=`${we.left}px`,oe.style.top=`${we.top-8}px`;}else {let ae=Y.rows[0]?.cells.find(Se=>Se.gridColumnId===F.gridColumnId);if(!ae)return;oe.dataset.gridColumnId=F.gridColumnId,delete oe.dataset.rowId;let xe=Y.columnEdges[ae.gridColumn]??0,we=Y.columnEdges[ae.gridColumn+1]??Y.box.width;oe.className="docx-table-insert-column",oe.setAttribute("aria-label",e.label("table.insertColumnRight"));let at=I(F.pageIndex,Y.box.x+(xe+we)/2-8,Y.box.y-14,le);oe.style.left=`${at.left}px`,oe.style.top=`${at.top}px`;}t.contains(oe)||t.append(oe);}function W(F){F.preventDefault(),F.stopPropagation();}function q(F,K){if(E(),h(p??y()),!(l||K.editingMode==="view")){if((F.kind==="columnDivider"||F.kind==="rightEdge")&&!F.isHeaderRepeat){let V=Ac(K.layout,F.tableId,F.pageIndex);if(!V)return;let{table:Y,origin:le}=V,oe=t.ownerDocument.createElement("div");oe.className=F.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",oe.style.position="absolute",oe.style.pointerEvents="auto",oe.style.cursor="col-resize",oe.dataset.active="true";let ae=I(F.pageIndex,Y.box.x+F.edgeX,Y.box.y,le);oe.style.left=`${ae.left-3}px`,oe.style.top=`${ae.top}px`,oe.style.width="6px",oe.style.height=`${Y.box.height*e.scale()}px`,oe.addEventListener("pointerdown",M),t.append(oe);}if(F.kind==="rowDivider"&&!F.isHeaderRepeat){let V=Ac(K.layout,F.tableId,F.pageIndex);if(!V)return;let{table:Y,origin:le}=V,oe=t.ownerDocument.createElement("div");oe.className="docx-table-row-divider-handle layout-table-row-resize-handle",oe.style.position="absolute",oe.style.pointerEvents="auto",oe.style.cursor="row-resize",oe.dataset.active="true";let ae=I(F.pageIndex,Y.box.x,Y.box.y+F.edgeY,le);oe.style.left=`${ae.left}px`,oe.style.top=`${ae.top-3}px`,oe.style.width=`${Y.box.width*e.scale()}px`,oe.style.height="6px",oe.addEventListener("pointerdown",M),t.append(oe);}F.kind==="insertRow"&&!F.isHeaderRepeat&&B(F,K),F.kind==="insertColumn"&&!F.isHeaderRepeat&&B(F,K);}}function U(F,K){let V=hv(K.layout,F);if(!V)return;let Y=gv(K),le=Tr({command:{type:"insertRow",where:"below",target:mv(F.sourceRevision,V)},part:Oo(e.session(),F.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...Y});e.applyTableCommandPlan(le);}function Z(F,K){let V=hv(K.layout,F);if(!V)return;let Y=V.row.cells.find(xe=>xe.gridColumnId===F.gridColumnId);if(!Y)return;let le=wD(F.sourceRevision,V,Y);if(!le)return;let oe=gv(K),ae=Tr({command:{type:"insertColumn",where:"right",target:le},part:Oo(e.session(),F.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...oe});e.applyTableCommandPlan(ae);}function M(F){if(F.button!==0)return;let K=e.read();if(K.editingMode==="view"||!o||o.kind!=="columnDivider"&&o.kind!=="rightEdge"&&o.kind!=="rowDivider")return;F.preventDefault(),F.stopPropagation();let V=o,Y=hv(K.layout,V);if(!Y)return;let le=Om(Oo(e.session(),V.tableId).root,V.tableId);if(!le.ok||V.kind!=="rowDivider"&&Qm(le.topology)!==null)return;let oe=0,ae=0,xe=0,we=le.topology.gridColumns.reduce((Ue,_e)=>Ue+vp(_e),0),at;if(V.kind==="columnDivider"){let Ue=le.topology.gridColumns.find(Je=>Je.id===V.leftGridColumnId),_e=le.topology.gridColumns.find(Je=>Je.id===V.rightGridColumnId);if(!Ue||!_e)return;oe=vp(Ue),ae=vp(_e),at=SD(V.sourceRevision,Y,V.leftGridColumnId,V.rightGridColumnId);}else if(V.kind==="rightEdge"){let Ue=le.topology.gridColumns.find(_e=>_e.id===V.gridColumnId);if(!Ue)return;oe=vp(Ue),ae=0,at=kD(V.sourceRevision,Y,V.gridColumnId);}else xe=Math.max(20,Math.round(Y.row.box.height*ID)),at=mv(V.sourceRevision,Y);let Se=F.currentTarget;Se.setPointerCapture(F.pointerId),d=F.clientX,u=F.clientY,l={pointerId:F.pointerId,startClientX:F.clientX,startClientY:F.clientY,startEdgePt:V.kind==="rowDivider"?V.edgeY:V.edgeX,leftTwips:oe,rightTwips:ae,tableWidthTwips:we,rowHeightTwips:xe,target:V,ref:Y,resizeTarget:at,captureElement:Se,rightEdge:V.kind==="rightEdge",vertical:V.kind==="rowDivider",cancelled:false};for(let Ue of [...t.children])Ue!==Se&&Ue.remove();P(V.kind==="rowDivider"?V.edgeY:V.edgeX,V);}function J(){if(l){try{l.captureElement.hasPointerCapture(l.pointerId)&&l.captureElement.releasePointerCapture(l.pointerId);}catch{}l.cancelled=true,l=null,v(),o=null;}}function ee(){if(!l||l.cancelled){l=null,v();return}let F=l;l=null;try{F.captureElement.hasPointerCapture(F.pointerId)&&F.captureElement.releasePointerCapture(F.pointerId);}catch{}if(F.vertical?u===F.startClientY:d===F.startClientX){v();return}let K=e.read(),V=gv(K),Y=(F.vertical?u-F.startClientY:d-F.startClientX)/e.scale(),le=Math.round(Y*ID),oe;if(F.target.kind==="rowDivider")oe=kE({part:Oo(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...V},F.resizeTarget,Math.max(RD(F.rowHeightTwips),F.rowHeightTwips+le));else if(F.rightEdge&&F.target.kind==="rightEdge"){let ae=Math.max(300,F.leftTwips+le),xe=Math.max(ae,F.tableWidthTwips+le);oe=Tr({command:{type:"commitTableRightEdgeResize",target:F.resizeTarget,columnWidthTwips:ae,tableWidthTwips:xe},part:Oo(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...V});}else if(F.target.kind==="columnDivider"){let ae=F.leftTwips+le,xe=F.rightTwips-le;ae=Math.max(300,ae),xe=Math.max(300,xe);let we=F.leftTwips+F.rightTwips;ae+xe!==we&&(ae>we-300?(ae=we-300,xe=300):xe=we-ae),oe=Tr({command:{type:"commitTableColumnDividerResize",target:F.resizeTarget,leftWidthTwips:ae,rightWidthTwips:xe},part:Oo(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...V});}else {v();return}e.applyTableCommandPlan(oe),v();}function fe(F){if(!f)return null;i??=Ef$2(F.layout);let K=e.pageOffsetX(f.pageIndex);return If$1(i,f.x,f.y,F.layout,K,f.pageIndex)}function se(F){if(!o||l||F.editingMode==="view")return;w();let K=fe(F),V=Gb(e.session(),K,F.selection.head.paragraphId);if(!V){o=null,v();return}if(Gf$1(V)!==Gf$1(o)){o=null,v();return}o=V,q(V,F);}function $(){let F=p??y(),K=F!==null&&t.ownerDocument.activeElement===F;x(),F&&t.contains(F)&&F.remove(),K&&e.pagesLayer.focus({preventScroll:true});}function H(F){if(l||F.editingMode==="view")return;let K=p??y();if(!K||!t.contains(K)){g&&x();return}if(p=K,!g||g.kind!=="insertRow"&&g.kind!=="insertColumn")return;i??=Ef$2(F.layout);let V=Gf$1(g),Y=Hf$1(i,g);if(!Y||Gf$1(Y)!==V){$();return}g=Y,B(Y,F);}function j(F){let K=e.read();if(l&&F.pointerId===l.pointerId){d=F.clientX,u=F.clientY;let xe=(l.vertical?F.clientY-l.startClientY:F.clientX-l.startClientX)/e.scale();l.target.kind==="rowDivider"&&(xe=Math.max(xe,(RD(l.rowHeightTwips)-l.rowHeightTwips)/20));for(let we of [...t.children])we!==l.captureElement&&we.remove();P(l.startEdgePt+xe,l.target);return}if(K.editingMode==="view"){k(false);return}if(So(F.target)&&p?.contains(F.target)){w();return}let V=ZK(e,F.clientX,F.clientY),Y=ve(K.layout,V.y);Y>=0&&(f={x:V.x,y:V.y,pageIndex:Y});let le=Y>=0?e.pageOffsetX(Y):0;i??=Ef$2(K.layout);let oe=i?If$1(i,V.x,V.y,K.layout,le,Y>=0?Y:void 0):null,ae=Gb(e.session(),oe,K.selection.head.paragraphId);if(!ae){if(c)return;n.migrate(),!r&&o&&(r=n.setTimeout(()=>{r=null,o=null,v();},zK));return}r&&(n.clearTimeout(r),r=null),!(o&&Ff$2(ae)===Ff$2(o))&&(o=ae,q(ae,K));}function N(F){if(!(!l||F.pointerId!==l.pointerId)){if(e.read().editingMode==="view"){J();return}ee();}}function D(F){!l||F.pointerId!==l.pointerId||J();}function z(F){F.key!=="Escape"||!l||J();}e.pagesLayer.addEventListener("pointermove",j);let X=[e.listeners.onDocument("pointermove",j),e.listeners.onDocument("pointerup",N),e.listeners.onDocument("pointercancel",D)];return e.pagesLayer.addEventListener("keydown",z),{update(){let F=e.read(),K=a,V=s;i=null,a=F.layout.revision,s=F.storeRevision,F.editingMode==="view"?(J(),o=null,w(),k(true)):K!==null&&(K!==F.layout.revision||V!==F.storeRevision)&&(o!==null&&se(F),H(F)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},cancelDrag:J,refreshLabels(){let F=e.read();if(F.editingMode==="view")return;let K=p??y();if(K&&t.contains(K)&&g&&(g.kind==="insertRow"||g.kind==="insertColumn")){B(g,F);return}o&&(o.kind==="insertRow"||o.kind==="insertColumn")&&B(o,F);},destroy(){w(),J(),x(),v(),e.pagesLayer.removeEventListener("pointermove",j);for(let F of X)F();e.pagesLayer.removeEventListener("keydown",z),t.remove();}}}var xp={},TD=new WeakMap;function XK(e,t){let n=TD.get(e??xp);n||TD.set(e??xp,n=new WeakMap);let r=n.get(t??xp);return r||(r=lf$1(e,void 0,t),n.set(t??xp,r)),r}function ED(e,t,n=null){return mf$1(XK(t,n),ai$1(e,"paragraphProperties","pPr")).markRunProperties}var YK=e=>e==="left"||e==="center"||e==="right"||e==="both";function CD(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 wp(e,t,n,r=n){let o=()=>wf$1([...t,...n]);if(e.paragraphDirection!==void 0&&e.localName==="bidi"){let a=e.paragraphDirection==="rtl";return o()===a?null:a?wf$1(CD(t,r))?{localName:"bidi",remove:true}:{localName:"bidi"}:wf$1(CD(t,r))?{localName:"bidi",attributes:{val:"0"}}:{localName:"bidi",remove:true}}let i=e.attributes?.val;return !e.physicalAlignment||e.localName!=="jc"||!YK(i)?e:{localName:"jc",attributes:{val:Dd(i,o())}}}function OD(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=c(()=>e.session.stylesRoot(),()=>e.session.settingsRoot(),()=>e.displayMode(),()=>e.authorFilter()),{session:r,commit:o,orderedRange:i,selectionMark:a,textOf:s}=e,l=()=>e.displayMode(),c$1=()=>e.authorFilter(),d=()=>r.partFor(e.storyScope())??r.part(),u=P=>{let{anchor:C,head:O}=P;if(C.paragraphId!==O.paragraphId||C.offset!==O.offset)return {selection:P,caretSpan:true};let S=eb$1(d(),O.paragraphId);if(S?.kind!=="paragraph")return {selection:P,caretSpan:true};let T=vi(S,O.offset)!==void 0,B=T?xi(S,O.offset):oi$1(S,O.offset);if(B===void 0)return {selection:P,caretSpan:!T};if(B===null&&T){let q=ED(S,r.stylesRoot(),r.settingsRoot());return {selection:P,caretSpan:false,markFace:q}}if(B===null)return {selection:P,caretSpan:false};let W=B.end<=O.offset?B.end-1:B.start;return {selection:{anchor:{paragraphId:O.paragraphId,offset:W},head:{paragraphId:O.paragraphId,offset:W+1}},caretSpan:true}},f=P=>{let C=P?.ascii;return !C||P.hAnsi!==C||Object.keys(P).length!==2?P:ne(C)?{...P,eastAsia:C}:P},p=(P,C,O)=>{let S=T=>r.applyTreeOps(T,C,O,e.storyScope());return e.applyOutsideToc?e.applyOutsideToc(P,S):S(P)},g=()=>{let P=e.runFormatRefusal?.();return P?e.commit(()=>({committed:false,rejected:true,opCount:0,reason:P}))??P:null},b={get value(){return e.layout()}},y={get value(){return e.selection()}},h=(P,C,O)=>{let S=d();if(P.paragraphId===C.paragraphId){let U=t(S,P.paragraphId,P.offset,C.offset,O,l(),c$1());if(U.length===0)return null;let Z=n(S,P.paragraphId,O);return o(()=>p([...U.map(M=>({op:"setRunProperties",paragraphId:P.paragraphId,start:M.start,end:M.end,properties:M.properties,...M.targetRunIds?{targetRunIds:M.targetRunIds}:{}})),...e.paragraphMarkVisible(P.paragraphId)?fM(s(P.paragraphId),P,C,Z):[]],a()))}let T=e.paragraphOrder(),B=T.indexOf(P.paragraphId),W=T.indexOf(C.paragraphId);if(B===-1||W===-1)return null;let q=[];for(let U=B;U<=W;U+=1){let Z=T[U],M=s(Z),J=U===B?P.offset:0,ee=U===W?C.offset:M.length,fe=J<ee?t(S,Z,J,ee,O,l(),c$1()):[];for(let $ of fe)q.push({op:"setRunProperties",paragraphId:Z,start:$.start,end:$.end,properties:$.properties,...$.targetRunIds?{targetRunIds:$.targetRunIds}:{}});(U<W||J===0&&ee===M.length&&M.length>0)&&e.paragraphMarkVisible(Z)&&q.push({op:"setParagraphMarkProperties",paragraphId:Z,properties:n(S,Z,O)});}return q.length===0?null:o(()=>p(q,a()))},x=(P,C)=>{let O=d(),S=[];for(let T of ma$1(b.value,P)){let B=s(T);for(let W of t(O,T,0,B.length,C,l(),c$1()))S.push({op:"setRunProperties",paragraphId:T,start:W.start,end:W.end,properties:W.properties,...W.targetRunIds?{targetRunIds:W.targetRunIds}:{}});e.paragraphMarkVisible(T)&&S.push({op:"setParagraphMarkProperties",paragraphId:T,properties:n(O,T,C)});}return S.length===0?null:o(()=>p(S,a()),void 0,{keepCellSelection:true})},w=P=>{$h$1(P.localName)&&e.setPendingFormats(ei$1(e.pendingFormats()??[],P));},v=(P,C)=>P.paragraphId===C.paragraphId&&P.offset===C.offset&&s(P.paragraphId).length===0&&e.paragraphMarkVisible(P.paragraphId)&&!e.pendingFormats()?.length?P.paragraphId:null,k=(P,C)=>{let O=d(),S=n(O,P,C);return JSON.stringify(S)===JSON.stringify(di$1(O,P))?null:o(()=>p([{op:"setParagraphMarkProperties",paragraphId:P,properties:S}],a()))},E=(P,C)=>{if(P.paragraphId!==C.paragraphId||P.offset!==C.offset||e.pendingFormats()?.length)return null;let O=vf(d(),P.paragraphId,s(P.paragraphId).length,l(),c$1()),S=Uy(b.value,P.paragraphId,P.offset,O);return S?{from:{paragraphId:P.paragraphId,offset:S.start},to:{paragraphId:P.paragraphId,offset:S.end}}:null},I=P=>{if(P.length===0)return;let C=e.selectedCells?.(),O=C&&C.length>0?[...ma$1(b.value,C)]:null,{from:S,to:T}=i(),B=O??e.paragraphOrder(),W=O?0:B.indexOf(S.paragraphId),q=O?B.length-1:B.indexOf(T.paragraphId);if(W===-1||q===-1)return;let U=d(),Z=B.slice(W,q+1).filter(M=>e.paragraphMarkVisible(M)).flatMap(M=>{let J=ci$1(U,M),ee=J,fe=Vn(b.value,M),se=false;for(let $ of P){let H=wp($,fe,ee,J);if(!H)continue;if(se=true,H.remove){ee=ee.filter(D=>D.localName!==H.localName);continue}let j=H.mergeAttributes?{...ee.find(D=>D.localName===H.localName)?.attributes??{},...H.attributes}:H.attributes??{},N=Object.fromEntries(Object.entries(j).filter(([,D])=>D!=null));ee=ei$1(ee,{localName:H.localName,...Object.keys(N).length>0?{attributes:N}:{}});}return se?[{op:"setParagraphProperties",paragraphId:M,properties:ee}]:[]});Z.length!==0&&o(()=>p(Z,a()),void 0,{keepCellSelection:O!==null});};return {setRunProperty(P,C){let O=g();if(O)return O;let S=P==="rFonts"?f(C):C,T={localName:P,...S?{attributes:S}:{}},B=e.selectedCells?.();if(B&&B.length>0)return x(B,T);let{from:W,to:q}=i(),U=v(W,q);if(U)return k(U,T);let Z=P==="highlight"?null:E(W,q);return Z?h(Z.from,Z.to,T):W.paragraphId===q.paragraphId&&W.offset===q.offset?(w(T),null):h(W,q,T)},setParagraphProperty(P,C,O){I([{localName:P,...C?{attributes:C}:{},...O??{}}]);},setParagraphProperties:I,formatting:()=>{let P=u(y.value);return cM(uM(b.value,P.selection,(C,O)=>{let S=r.effectiveRunDefaults(C,O);if(S.fontFamily!==null)return S;let T=e.defaultFontFamily?.()??null;return T===null?S:{...S,fontFamily:T}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,y.value.anchor.paragraphId===y.value.head.paragraphId?[y.value.head.paragraphId]:e.paragraphOrder(),e.defaultFontFamily?.()??null,P.caretSpan),ei$1(P.markFace??[],e.pendingFormats()??[]))},toggleRunProperty(P,C){let O=g();if(O)return O;let S=e.selectedCells?.(),T=C?.val,B=u(y.value),{from:W,to:q}=i(),U=S&&S.length>0?null:E(W,q),Z=B.caretSpan?dM(b.value,B.selection,P,S,T,e.paragraphOrder()):oa(B.markFace??null,P,T)===true,M=oa(e.pendingFormats(),P,T)??Z,J=M?{localName:P,attributes:{val:QK[P]??"0"}}:{localName:P,...C?{attributes:C}:{}};if(S&&S.length>0)return x(S,J);let ee=v(W,q);if(ee)return k(ee,J);if(U)return h(U.from,U.to,J);if(W.paragraphId===q.paragraphId&&W.offset===q.offset){let fe=e.pendingFormats()??[];if(!M===Z){let se=fe.filter($=>$.localName!==P);e.setPendingFormats(se.length>0?se:null);}else w(J);return null}return h(W,q,J)},clearFormatting(){if(g())return;e.setPendingFormats(null);let P=b.value,C=e.paragraphOrder(),O=e.selectedCells?.(),S=O&&O.length>0?[...ma$1(P,O)]:_f(C,i());if(S.length===0)return;let T=O!==void 0&&O.length>0,B=i(),{from:W,to:q}=!T&&E(B.from,B.to)||B,U=d(),Z=[];for(let M of S){let J=s(M),ee=T||M!==W.paragraphId?0:W.offset,fe=T||M!==q.paragraphId?J.length:q.offset;for(let H of ri$1(U,M,ee,fe,l(),c$1()))lM(U,M,H.start,H.end,l(),c$1())&&Z.push({op:"setRunProperties",paragraphId:M,start:H.start,end:H.end,properties:[]});e.paragraphMarkVisible(M)&&di$1(U,M).length>0&&Z.push({op:"setParagraphMarkProperties",paragraphId:M,properties:[]});let se=ci$1(U,M),$=se.filter(H=>H.localName==="bidi");e.paragraphMarkVisible(M)&&se.length>$.length&&Z.push({op:"setParagraphProperties",paragraphId:M,properties:$});}Z.length!==0&&o(()=>p(Z,a()),void 0,{keepCellSelection:T});}}}var QK={u:"none",vertAlign:"baseline"};var MD=500;function JK(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 AD(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=c(()=>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,c$1=ef,d=()=>{let x=a===null?"none":a.paragraphProperties?"paragraph":"run";return (c$1.mode!==i||c$1.level!==x)&&(c$1={mode:i,level:x}),c$1},u=(x,w,v)=>{if(v||x.paragraphId!==w.paragraphId||x.offset===w.offset)return true;let k=e.textOf(x.paragraphId);return x.offset===0&&w.offset===k.length&&k.length>0},f=()=>{let x=e.selectedCells?.(),w=x!==void 0&&x.length>0,{from:v,to:k}=e.orderedRange();if(!e.paragraphOrder().includes(v.paragraphId))return false;let E=Bf(e.layout(),e.selection(),x,e.paragraphOrder()),I=u(v,k,w)?ci$1(o(),v.paragraphId):null;return !E&&I===null?false:(a={runProperties:E?JK(E):[],paragraphProperties:I},true)},p=()=>f()?(e.publish(),true):false,g=()=>{let x=a;if(!x)return {wrote:false,armed:false,built:false};let w=e.selectedCells?.(),v=w!==void 0&&w.length>0,{from:k,to:E}=e.orderedRange(),I=!v&&k.paragraphId===E.paragraphId&&k.offset===E.offset,P=I?Lf(e.layout(),k,Le(e.layout(),k.paragraphId),"after",qy(e.layout(),k.paragraphId,vf(o(),k.paragraphId,e.textOf(k.paragraphId).length,e.displayMode(),e.authorFilter()))):null,C=P?.from??k,O=P?.to??E,S=I&&C.offset===O.offset,T=v?[...ma$1(e.layout(),w)]:_f(e.paragraphOrder(),{from:C,to:O});if(T.length===0)return {wrote:false,armed:false,built:false};let B=o(),W=e.displayMode(),q=[];for(let J of T){let ee=e.textOf(J),fe=v||J!==C.paragraphId?0:C.offset,se=v||J!==O.paragraphId?ee.length:O.offset;if(fe<se&&x.runProperties.length>0)for(let j of t(B,J,fe,se,x.runProperties,W,e.authorFilter()))q.push({op:"setRunProperties",paragraphId:J,start:j.start,end:j.end,properties:j.properties,...j.targetRunIds?{targetRunIds:j.targetRunIds}:{}});let $=x.paragraphProperties!==null||v||J!==O.paragraphId||fe===0&&se===ee.length&&ee.length>0,H=e.paragraphMarkVisible(J);$&&H&&x.runProperties.length>0&&q.push({op:"setParagraphMarkProperties",paragraphId:J,properties:n(B,J,x.runProperties)}),x.paragraphProperties&&H&&q.push({op:"setParagraphProperties",paragraphId:J,properties:[...x.paragraphProperties]});}let U=r.packageRevision();q.length>0&&e.commit(()=>r.applyTreeOps(q,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:v});let Z=r.packageRevision()!==U,M=S&&x.runProperties.length>0&&(Z||q.length===0);return M&&e.armPendingFormats(x.runProperties),{wrote:Z,armed:M,built:q.length>0}},b=()=>{let x=g();return x.wrote&&i==="once"&&h(),x.wrote?"painted":x.armed?"armed":x.built?"refused":"nothingToPaint"},y=()=>{i!=="off"&&(i="off",e.publish());},h=()=>{s=null,l=null,y();};return {state:d,capture:p,apply:b,disarm:h,press(){let x=e.now(),w=s!==null&&x-s<MD,v=i;s=x;let k=()=>(s=null,false);return v==="once"&&w?f()?(i="locked",e.publish(),true):(y(),k()):v!=="off"?(y(),l=v==="locked"?x:null,true):l!==null&&x-l<MD?(l=null,true):f()?(i="once",l=null,e.publish(),true):k()},applyIfArmed(){i==="off"||a===null||g().wrote&&i==="once"&&h();}}}var LD=new WeakMap;function eU(e){let t=LD.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 LD.set(e,r),r}function FD(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||!eU(i)||e.setParagraphProperties([{localName:"bidi",paragraphDirection:o}]);},disarm(){n=null;}}}function DD(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 tU(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 nU(e,t){return tU(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 Jr(e,t,n){if(t.paragraphId===n.paragraphId)return t.offset-n.offset;let r=db$1(e);return r.indexOf(t.paragraphId)-r.indexOf(n.paragraphId)}function HD(e,t,n){if(!(t>qe$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=qe$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let i of o.cells)HD(i.blocks,t+1,n);}}}function yv(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&&HD(i.fragments,0,a=>{if(!nU(o.box,a.box))return;let s={paragraphId:a.paragraphId,offset:0},l={paragraphId:a.paragraphId,offset:Ue(e,a.paragraphId).length};(!n||Jr(e,s,n)<0)&&(n=s),(!r||Jr(e,l,r)>0)&&(r=l);});}return n&&r?{from:n,to:r}:null}function Ps(e,t){return t.placeholder?yv(e,t):null}function _D(e){return !e.placeholder&&e.level==="inline"&&e.range!==void 0&&(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")}function rU(e){return e.placeholder}var ND=new WeakMap;function oU(e,t){let n=ND.get(e);if(!n){n=new Map;for(let r of e.contentControls??[]){if(!_D(r))continue;let o=yv(e,r),i=n.get(o.from.paragraphId)??[];i.push(o),n.set(o.from.paragraphId,i);}ND.set(e,n);}return n.get(t)??[]}function bv(e,t){let n=null;for(let r of oU(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 BD(e,t,n){let r=bv(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 _c(e,t,n={}){let r=e.contentControls??[];if(r.length===0)return t;let o=Jr(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 c=n.atomic===true&&_D(l);if(!l.placeholder&&!c)continue;let d=yv(e,l);if(!d)continue;let u=Jr(e,i,a)===0,f=Jr(e,i,d.from);(u?(rU(l)?f>=0:f>0)&&Jr(e,i,d.to)<0:Jr(e,i,d.to)<0&&Jr(e,a,d.from)>0)&&(Jr(e,d.from,i)<0&&(i=d.from,s=true),Jr(e,d.to,a)>0&&(a=d.to,s=true));}}return o?{anchor:i,head:a}:{anchor:a,head:i}}function aU(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function vv(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},i=Be(e,t.pageIndex,o);return i?.placeholder?i:null}let r=aU(e,n);return r?.placeholder?r:null}var sU=new Set(["dropdown","comboBox","date","buildingBlockGallery"]);function $D(e,t={}){if(t.mode==="native")return {dragging:()=>false,cancelGesture:()=>{},destroy:()=>{}};let{pagesLayer:n}=e,r=t.atomicInlineControls===true,o=nt(()=>n),i=null,a=null,s=null,l=0,c=0,d=0,u=0,f=null;function p(N,D){if(!s){let X=n.getBoundingClientRect();s={left:X.left,top:X.top};}let z=e.scale()||1;return {x:(N-s.left)/z,y:(D-s.top)/z}}function g(N){return {scope:{kind:"headerFooter",rId:N.rId},pageIndex:N.pageIndex,kind:N.kind,partName:N.partName,variant:N.variant}}function b(N,D){let z=e.layout(),X=p(N,D),F=ve(z,X.y),K=z.pages[F];if(!K)return null;let V=e.measurer();return ye$1(z,F,{x:X.x-K.contentBox.x-e.pageOffsetX(F),y:X.y-K.contentBox.y},V?{measurer:V}:{})}function y(N,D){let z=e.activeNote?.()??null;if(z){let Y=e.layout(),le=Xu(Y,p(N,D),e.pageOffsetX);if(!le||le.scopeId!==z.scopeId)return null;let oe=e.measurer();return ze(Y,le.pageIndex,le.fragments,le.local,{...oe?{measurer:oe}:{}})}let X=e.activeHeaderFooter?.()??null;if(!X)return b(N,D);let F=e.layout(),K=p(N,D),V=Eh(F,K,e.pageOffsetX);if(V&&zu(V.story,g(X))){let Y=e.measurer();return Ih(F,V.pageIndex,V.story,V.local,Y?{measurer:Y}:{})}return null}function h(N,D){let{story:z,pageIndex:X,kind:F}=N;return {rId:z.rId,pageIndex:X,kind:F,partName:z.partName,variant:z.variant,...D?{position:D}:{}}}function x(N){let D=e.measurer();return Ih(e.layout(),N.pageIndex,N.story,N.local,D?{measurer:D}:{})?.position??void 0}let w=new WeakMap;function v(N,D){let z=e.activeNote?.();if(z){let V=is(N,null,z.scopeId).indexOf(D);return V===-1?-1:V}let X=e.activeHeaderFooter?.();if(X){let V=is(N,g(X)).indexOf(D);return V===-1?-1:V}let F=w.get(N);return F||(F=new Map(db$1(N).map((K,V)=>[K,V])),w.set(N,F)),F.get(D)??-1}function k(N,D,z){let X=v(N,D.paragraphId),F=v(N,z.paragraphId);return X!==F?X<F:D.offset<z.offset}function E(N,D,z,X=null){if(z==="character")return {from:D,to:D};let F=D.paragraphId;if(z==="paragraph"){let V=Ue(N,F);return {from:{paragraphId:F,offset:0},to:{paragraphId:F,offset:V.length}}}let K=Me(N,D,X);return Lf(N,D,Ke$1(N,F),K)}function I(N,D,z,X,F){let K=F?vv(N,F):null,V=K?Ps(N,K)??E(N,z,X,F?.contentControlId):E(N,z,X,F?.contentControlId),Y=k(N,V.from,D.from)?{anchor:D.to,head:V.from}:{anchor:D.from,head:V.to};return _c(N,Y,{atomic:r})}function P(){return e.container.closest(".docx-editor__scroll-container")}function C(){f!==null&&(o.cancelAnimationFrame(f),f=null);}function O(){f=null;let N=a,D=P();if(!N||!D)return;let z=D.getBoundingClientRect(),X=lp(z.top,z.bottom,N.clientY);X!==0&&(D.scrollTop+=X,s=null,T(N.clientX,N.clientY),f=o.requestAnimationFrame(O));}function S(){if(f!==null||!a)return;let N=P();if(!N)return;let D=N.getBoundingClientRect();lp(D.top,D.bottom,a.clientY)!==0&&(f=o.requestAnimationFrame(O));}function T(N,D){let z=a;if(!z)return;let X=y(N,D);X&&((e.isReadOnlyPosition?.(X.position)??e.isReadOnlyParagraph?.(X.position.paragraphId))||B(z,X)||(z.caret=X.caret,e.setSelection(I(e.layout(),z.anchorRange,X.position,z.granularity,X),X.caret)));}function B(N,D){let z=N.anchorCell;if(!z)return false;if(!D.cell||D.cell.tableId!==z.tableId)return N.cellDragging;if(!N.cellDragging&&D.cell.cellId===z.cellId)return false;let X=ia$1(e.layout(),z,D.cell);return X?(N.cellDragging=true,e.setCellSelection(X),true):N.cellDragging}function W(N){let D=Date.now(),z=D-c;return l=Math.abs(N.clientX-d)<=4&&Math.abs(N.clientY-u)<=4&&z>=0&&z<=500?l+1:1,c=D,d=N.clientX,u=N.clientY,l}let q=["character","word","paragraph"],U="[data-docx-hf], [data-docx-cc-widget], [data-docx-note-ref], [data-drawing-paragraph-id], .docx-image-selection-overlay, .docx-drawing-textbox, input, textarea, select",Z=N=>N.button===0&&N.ctrlKey&&!N.metaKey&&isApplePlatform();function M(N){if(N.pointerType==="touch"||N.button!==2&&!Z(N)||e.activeHeaderFooter?.()||e.activeNote?.()||N.target?.closest?.(U))return;let z=e.layout();if(!Zu(z,p(N.clientX,N.clientY),e.pageOffsetX))return;let X=b(N.clientX,N.clientY);if(!X||(e.isReadOnlyPosition?.(X.position)??e.isReadOnlyParagraph?.(X.position.paragraphId)))return;let F=e.selection(),K=k(z,F.head,F.anchor),V=K?F.head:F.anchor,Y=K?F.anchor:F.head;if(!k(z,X.position,V)&&!k(z,Y,X.position))return;e.focus();let le=vv(z,X);if(le){if(e.selectContentControl?.(le.id))return;let oe=Ps(z,le);if(oe){e.setSelection({anchor:oe.from,head:oe.to});return}}e.setSelection({anchor:X.position,head:X.position},X.caret);}let J=N=>{if(Z(N)){N.target?.closest?.("input, textarea, select")||N.preventDefault(),M(N);return}if(N.button!==0){M(N);return}if(e.onChangeBarToggle&&N.target?.closest?.("[data-docx-change-bar-toggle]")){N.preventDefault(),N.stopPropagation(),e.onChangeBarToggle();return}let D=N.target?.closest?.("[data-docx-cc-widget]");if(D){if(N.preventDefault(),N.stopPropagation(),D.hasAttribute("disabled")||D.dataset.disabledReason)return;let $e=D.dataset.docxCcId,lt=D.dataset.docxCcWidget;$e&<&&e.onContentControlWidget?.($e,lt);return}if(N.pointerType==="touch")return;a&&$(),s=null;let z=e.layout(),X=p(N.clientX,N.clientY),F=e.activeHeaderFooter?.()??null,K=e.activeNote?.()??null,V=Eh(z,X,e.pageOffsetX),Y=V!==null&&FT(z,V,X,e.pageOffsetX,F!==null&&zu(V.story,g(F)),e.measurer()),le=yM(N)||N.target?.closest('.docx-drawing-textbox[data-docx-textbox-active="true"]'),oe=Y||le?null:V,ae=Xu(z,X,e.pageOffsetX),xe=Y||le?null:N.target?.closest("[data-docx-hf]"),we=!!(xe||oe),at=N.target,Se=at?.closest("[data-docx-note-ref]"),Ue=at?.closest("[data-docx-note-mark-back]"),_e=null,Je=()=>_e??=W(N);if(Se?.dataset.docxNoteScope){N.preventDefault(),e.focus(),e.enterNote?.(Se.dataset.docxNoteScope);return}if(Ue){N.preventDefault(),e.focus(),e.exitNote?.(true);return}if(ae&&!we){let $e=e.measurer?.(),lt=ze(z,ae.pageIndex,ae.fragments,ae.local,{...$e?{measurer:$e}:{}});if(!K||K.scopeId!==ae.scopeId){N.preventDefault(),e.focus(),e.enterNote?.(ae.scopeId,lt?{paragraphId:lt.position.paragraphId,offset:lt.position.offset}:void 0,ae.pageIndex);return}if(K.pageIndex!==ae.pageIndex){N.preventDefault(),e.focus(),e.enterNote?.(ae.scopeId,lt?{paragraphId:lt.position.paragraphId,offset:lt.position.offset}:void 0,ae.pageIndex);return}}else if(K){if(!Zu(z,X,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(F)if(oe&&zu(oe.story,g(F)))oe.pageIndex!==F.pageIndex&&e.enterHeaderFooter?.(h(oe,x(oe)));else if(oe&&oe.story.rId){N.preventDefault(),e.focus(),e.enterHeaderFooter?.(h(oe,x(oe)));return}else if(Zu(z,X,e.pageOffsetX)){N.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let $e=Je()>=2?Th(z,X,e.pageOffsetX):null;$e&&(N.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.($e.kind,$e.pageIndex));return}else if(we&&Je()>=2){if(oe?.story.rId)N.preventDefault(),e.focus(),e.enterHeaderFooter?.(h(oe,x(oe)));else if(Vr(xe)){let $e=xe.dataset.docxRId,lt=xe.dataset.docxHf,Mt=xe.closest("[data-page-index]")?.getAttribute("data-page-index"),Bt=Mt!=null?Number(Mt):NaN;if((lt==="header"||lt==="footer")&&Number.isInteger(Bt))if($e){let mr=z.pages[Bt]?.[lt];N.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:$e,pageIndex:Bt,kind:lt,partName:mr?.partName??"",variant:mr?.variant??"default"});}else z.pages[Bt]?.[lt]||(N.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(lt,Bt));}return}else if(Je()>=2&&!le){let $e=Th(z,X,e.pageOffsetX);if($e){N.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.($e.kind,$e.pageIndex);return}}let et=y(N.clientX,N.clientY);if(!et)return;if(e.isReadOnlyPosition?.(et.position)??e.isReadOnlyParagraph?.(et.position.paragraphId)){N.preventDefault();return}if(Je()===2&&e.onTextFormDoubleClick?.(N))return;N.preventDefault(),e.focus();try{n.setPointerCapture(N.pointerId);}catch{}i=n.ownerDocument,i.addEventListener("pointermove",fe),i.addEventListener("pointerup",se),i.addEventListener("pointercancel",se);let He=Je(),st=N.shiftKey?"character":q[(He-1)%q.length],an=vv(z,et);if(an&&!N.shiftKey){let $e=()=>{n.contentEditable!=="false"&&He===1&&sU.has(an.controlType)&&e.onContentControlWidget?.(an.id,an.controlType);};if(e.selectContentControl?.(an.id)){let Mt=e.selection(),Bt=k(z,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};a={pointerId:N.pointerId,granularity:"character",anchorRange:Bt,anchorCell:et.cell,cellDragging:false,clientX:N.clientX,clientY:N.clientY},$e();return}let lt=Ps(z,an);if(lt){a={pointerId:N.pointerId,granularity:"character",anchorRange:lt,anchorCell:et.cell,cellDragging:false,clientX:N.clientX,clientY:N.clientY},ee(()=>e.setSelection({anchor:lt.from,head:lt.to})),$e();return}}if(N.shiftKey){let $e=e.selection();a={pointerId:N.pointerId,granularity:st,caret:et.caret,anchorRange:{from:$e.anchor,to:$e.anchor},anchorCell:et.cell,cellDragging:false,clientX:N.clientX,clientY:N.clientY},ee(()=>e.setSelection(I(z,{from:$e.anchor,to:$e.anchor},et.position,st,et),et.caret));}else {let $e=(r&&st==="word"?bv(z,et.position):null)??E(z,et.position,st,et.contentControlId);a={pointerId:N.pointerId,granularity:st,caret:et.caret,anchorRange:$e,anchorCell:et.cell,cellDragging:false,clientX:N.clientX,clientY:N.clientY},ee(()=>e.setSelection(_c(z,{anchor:$e.from,head:$e.to},{atomic:r}),et.caret));}};function ee(N){try{N();}catch(D){throw $(),D}}let fe=N=>{let D=a;!D||N.pointerId!==D.pointerId||(N.preventDefault(),D.clientX=N.clientX,D.clientY=N.clientY,T(N.clientX,N.clientY),S());},se=N=>{let D=a;if(!D||N.pointerId!==D.pointerId)return;$();try{n.releasePointerCapture(D.pointerId);}catch{}let z=e.cellSelection();z?e.setCellSelection(z):e.setSelection(e.selection(),D.caret),N.type==="pointerup"&&(e.onTextFormPointerUp?.(N),e.onSelectionSettled?.());};function $(){if(a)try{n.releasePointerCapture(a.pointerId);}catch{}a=null,s=null,C(),i?.removeEventListener("pointermove",fe),i?.removeEventListener("pointerup",se),i?.removeEventListener("pointercancel",se),i=null;}let H=()=>{s=null;};n.addEventListener("pointerdown",J);let j=[e.listeners.onWindow("scroll",H,{capture:true,passive:true}),e.listeners.onWindow("resize",H,{passive:true})];return {dragging:()=>a!==null,cancelGesture:$,destroy(){$(),n.removeEventListener("pointerdown",J);for(let N of j)N();}}}function WD(e,t,n){let r=e??mb$1;return {view:()=>r,projection:()=>lb$1(r),changeBars:()=>t?r==="all-markup"||r==="simple-markup"?r:"none":"all-markup",set:o=>{r=o;},filter:o=>t&&lb$1(r)!=="all-markup"?nb$1(o):o,toggleByChangeBar:()=>{t&&n(r==="simple-markup"?"all-markup":"simple-markup");}}}function qD(e){let{pagesLayer:t,session:n}=e,r=()=>t.ownerDocument,o=false,i=null,a,s;function l(){let{head:C}=e.selection();return s&&s.position.paragraphId===C.paragraphId&&s.position.offset===C.offset?s.lineId:void 0}function c(C){let O=la(C?.anchorNode,t)??la(C?.focusNode,t);O!==void 0&&(a=O);}function d(C){return a??la(C?.anchorNode,t)??la(C?.focusNode,t)}let u=false,f=false,p=false,g=null,b=false;function y(){let C=r().getSelection(),O=ks(t,C);return !O||(c(C),Ht(O,e.selection()))?false:(e.adoptSelection(O),true)}function h(){let C=r().activeElement;if(C&&t.contains(C))return true;if(C&&C!==r().body&&C!==r().documentElement)return false;let O=r().getSelection();if(!O||O.rangeCount===0)return true;let S=O.anchorNode;return !S||!S.isConnected?true:t.contains(S)}let x=()=>{let C=r().getSelection(),O=ks(t,C);if(!O){if(!Zb(t,C))return;u=false;let S=Ke(e.selection().head);if(Ht(S,e.selection()))return;e.setSelection(S);return}u=false,c(C),!Ht(O,e.selection())&&e.setSelection(O);};function w(C){let O=e.textOf(C),S=IF(t,C,O,r().getSelection()?.anchorNode??null);if(S===null)return;let T=RF(C,O,S);if(!T)return;let B=T.ops.find(J=>J.op==="deleteText"),W=T.ops.find(J=>J.op==="insertText"),q=W&&B?e.replacementOffset?.(C,B.start,B.end):void 0,U=W&&q!==void 0&&q!==W.offset?T.ops.map(J=>J===W?{...W,offset:q}:J):T.ops,Z=W?e.pendingFormatOps?.(C,q??W.offset,W.text.length,B?{start:B.start,end:B.end}:void 0)??[]:[],M=e.storyScope();e.commit(()=>{let J=e.applyOps([...U,...Z],e.selectionMark(),M);return Z.length===0||!J.rejected?J:e.applyOps(U,e.selectionMark(),M)}),e.setSelection(Ke({paragraphId:C,offset:W&&q!==void 0?q+W.text.length:T.caret}));}function v(){o||p||e.isGesturing?.()||e.holdsCellSelection?.()||k()||u&&x();}function k(){if(!f||u)return false;if(!i)return true;let C=ks(t,r().getSelection());return C!==null&&Ht(C,i)}function E(C){C.type.startsWith("pointer")&&C.button!==0||(u=true);}let I=false;function P(C=false){if(e.updateCaret(),!C&&!h())return;o=true;let O=e.now(),S=e.domSelection?.()??e.selection();u=false;let T=r().getSelection(),B=d(T),W=l(),q=aF(t,S,T,{...B!==void 0?{preferredPageIndex:B}:{},...W!==void 0?{preferredLineId:W}:{}});q&&c(T),i=q?S:null,q||(f=true),e.recordSelectionMs(e.now()-O),queueMicrotask(()=>{o=false;});}return t.addEventListener("pointerdown",E,true),t.addEventListener("selectstart",E,true),{adoptBeforePaint(){let C=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,O=f||C||!u?false:y();return e.hasPendingInput?.()!==true&&(f=false),O},noteModelMoved(){f=true,s=void 0;},noteSelectionSettled(){f=false;},mirrorToDom:P,adoptBeforeInput:v,isComposing:()=>p,noteBrowserSelectionFixup(){I=true;},onSelectionChange:()=>{if(!o&&!p&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(I&&Zb(t,r().getSelection())){let C=ks(t,r().getSelection());if((C===null||!Ht(C,e.selection()))&&(I=false,!u)){P();return}}k()||x();}},onCompositionStart:()=>{v(),p=true;let C=e.selection();b=C.anchor.paragraphId!==C.head.paragraphId,g=C.head.paragraphId,n.beginComposition(e.storyScope());},onCompositionEnd:C=>{p=false;let O=g??e.selection().head.paragraphId;g=null;let S=b;b=false;let T=e.storyScope(),B=n.revisionFor(T);if(S){let W=C?.data??"";W.length>0&&e.replaceSelectionWith?.(W);}else w(O);n.endComposition(),n.revisionFor(T)===B&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>a,selectionLineId:l,caretPreference(C=a){let O=l();return {...C!==void 0?{preferredPageIndex:C}:{},...O!==void 0?{preferredLineId:O}:{}}},notePointerCaret(C){s=C,C&&(a=C.pageIndex);},destroy(){t.removeEventListener("pointerdown",E,true),t.removeEventListener("selectstart",E,true),u=false;}}}function UD(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 c=Ic$1(a);if(!c)return e.setLastRejection("invalid note scope id"),false;let d=e.session.currentPackage(),u=pj$1(d,c.noteKind),f=u?cd(u.root,c.noteId):null;if(!u||!f)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let p=e.selection();r={anchor:{paragraphId:p.anchor.paragraphId,offset:p.anchor.offset},head:{paragraphId:p.head.paragraphId,offset:p.head.offset}};}if(t={kind:"note",id:Hc$1(c.noteKind,c.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let p=lU(f),g=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:c.noteKind})),b=p.find(y=>g.has(y.id));if(b){let y=xv(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 d=KD(e.session.currentPackage(),a);if(!o({op:"insertNote",noteKind:a,paragraphId:l.paragraphId,offset:l.offset},()=>{let g={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:g,head:g}}))return s.ops.length>0&&e.undo(),false;let p=[...KD(e.session.currentPackage(),a)].find(g=>!d.has(g));return p===void 0?true:i(Hc$1(a,p))},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 lU(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 xv(e){let t=Ci(e)[0];return t&&Nc$1(t.node)?t.end:0}function KD(e,t){let n=pj$1(e,t),r=new Set;if(!n)return r;for(let o of ad(n.root)){if(!Tc$1(o))continue;let i=Rc$1(o);i!==null&&r.add(i);}return r}var cU=720;function wv(e,t,n=cU){return GD(e,t,e+t*n)}function VD(e,t,n){let r=t>0?Math.floor(e/n)+1:Math.ceil(e/n)-1;return GD(e,t,r*n)}function GD(e,t,n){return t>0?Math.max(e,Math.min(Gd,n)):Math.max(0,n)}function ci(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=Qd(t);return n===null||Math.abs(n)>9999999?0:n}function jD(e,t){return e.kind==="midLine"?false:e.kind==="empty"||t<=e.offset}function zD(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,c=s!==null&&jD(s,a.offset)&&!(s.kind==="empty"&&n.endsStory(a.paragraphId))?t.slice(0,-1):t;if(c.length>1)return {write:"stepLeft",paragraphs:c};if(!jD(n.start(i.paragraphId),i.offset))return null;let{resolved:d,direct:u}=n.firstLine(i.paragraphId);return r==="increase"?{write:d>=0&&d<o?"setFirstLine":"stepLeft",paragraphs:c}:{write:u&&d>0?"clearFirstLine":"stepLeft",paragraphs:c}}function dU(e,t){let n=Number.POSITIVE_INFINITY,r=false;for(let{line:o}of Vb$1(e).get(t)??[]){if(!r&&(r=true,Za(o)[0]?.paragraphId!==t))return {kind:"midLine"};let i=_a(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 uU=["firstLine","hanging","firstLineChars","hangingChars"];function ZD(e,t,n){let r=new Map;return {start(o){let i=r.get(o);if(i)return i;let a=dU(e,o);if(a.kind==="start"){let s=eb$1(t,o),l=s?.kind==="paragraph"?xv(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=bc(e,o),a=ci$1(t,o).find(l=>l.localName==="ind")?.attributes,s=uU.some(l=>a?.[l]!==void 0);return {resolved:i?Hf(i.indent):0,direct:s}}}}function XD(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=Ps(e,r);return o!==null&&n(o.from,t.from)&&n(o.to,t.to)})}var fU=new Set(["ind"]);function YD(e){let t=r=>bb(e.layout(),r)?.paragraphId!==r;function n(r){let o=e.styleCascade(),i=eb$1(e.storyPart(),r);if(!o||!i)return null;let a=Qh$1(i),s=mf$1(o,a).paragraphPropertyNodes;return Kd(s.filter(l=>l!==a))}return {levelOps(r,o,i,a){let s=eb$1(e.storyPart(),r),c=!(s&&Sh$1(Qh$1(s),"numPr"))&&!t(r)&&n(r)?.numId===o,d={op:"setListLevel",paragraphId:r,level:a};return c?[{op:"setListNumbering",paragraphId:r,numId:o,level:i},d]:[d]},styleIndent(r,o=false){let i=e.styleCascade(),a=eb$1(e.storyPart(),r);if(!i||!a)return {left:0,firstLine:0,inChars:false,leftInChars:false};let s=Qh$1(a),c=mf$1(i,o?void 0:s).paragraphPropertyNodes.filter(p=>p!==s).flatMap(p=>bi(p,fU)),d=0,u=false,f=false;for(let{attributes:p}of c){let g=Qd(p?.hanging),b=Qd(p?.firstLine);g!==null?d=-g:b!==null&&(d=b);let y=Number(p?.hangingChars??p?.firstLineChars??NaN);Number.isFinite(y)&&(u=y!==0);let h=Number(p?.leftChars??p?.startChars??NaN);Number.isFinite(h)&&(f=h!==0);}return {left:ci(c),firstLine:d,inChars:u,leftInChars:f}},styleNumbered(r){return !t(r)&&n(r)!==null},numbered(r){if(t(r))return false;let o=eb$1(e.storyPart(),r);if(!o)return false;let a=Sh$1(Sh$1(Qh$1(o),"numPr"),"numId")?.attributes.find(s=>s.localName==="val")?.value;return a!==void 0?a!=="0":n(r)!==null},leaveOp(r){let o=!t(r)&&n(r)!==null;return {op:"setListNumbering",paragraphId:r,numId:o?"0":null}}}}var pU=e=>e.numFmt==="bullet"?"bullet":"ordered",Sp=e=>Math.round(e*20);function mU(e,t,n){let r=e.order(),o=r.indexOf(t[0]??""),i=r.indexOf(t[t.length-1]??"");if(o===-1||i===-1)return null;for(let a of [o-1,i+1]){let s=r[a];if(!s)continue;let l=e.markerOf(s);if(l&&pU(l)===n)return l.numId}return null}function QD(e,t,n){let r=n?e.styleNumberedIndentSides(t):null,o=r?e.indentOf(t):null;if(!n||!r||!o)return null;let i=e.directIndentSides(t),a={},s=Sp(o.left),l=Sp(o.right);r.left&&!i.left&&n.left!==void 0&&n.left!==s&&(a.left=s),r.right&&!i.right&&n.right!==void 0&&n.right!==l&&(a.right=l);let c=o.hanging>0?-Sp(o.hanging):Sp(o.firstLine),d=n.hanging!==void 0?-n.hanging:n.firstLine;return r.offset&&!i.offset&&d!==void 0&&d!==c&&(a.firstLine=c),Object.keys(a).length>0?a:null}var JD=(e,t)=>e.left===t.left&&e.right===t.right&&e.firstLine===t.firstLine;function e1(e,t){let{hanging:n,firstLine:r,...o}=e,i=t.firstLine===void 0?{...n!==void 0?{hanging:n}:{},...r!==void 0?{firstLine:r}:{}}:t.firstLine<0?{hanging:-t.firstLine}:{firstLine:t.firstLine};return {...o,...t.left!==void 0?{left:t.left}:{},...t.right!==void 0?{right:t.right}:{},...i}}function t1(e,t,n){let r=t.map(p=>e.markerOf(p)),o=p=>p===null?null:new Map(t.map(g=>[g,p])),i=p=>typeof p=="string"&&r.every(g=>e.listLevelKindOf(p,g?.level??0)===n),a=mU(e,t,n);if(i(a))return o(a);let s=r.find(p=>i(p?.numId))?.numId;if(s)return o(s);let l=gU(r);if(l===null)return o(e.ensureListDefinition(n));if(n==="ordered"){let p=e.listGeometryOf(l),g=new Map;t.forEach((y,h)=>{let x=r[h],w=x?.level??0,v=x?.numId===l?QD(e,y,p[w]):null,k=g.get(w);k===void 0?g.set(w,v):k&&!(v&&JD(k,v))&&g.set(w,null);});let b=p.map((y,h)=>{let x=g.get(h);return y&&x?e1(y,x):y});return o(e.ensureListDefinition(n,b))}let c=new Map,d=p=>{let g=c.get(p);return g||(g=e.listGeometryOf(p),c.set(p,g)),g},u=[];t.forEach((p,g)=>{let b=r[g],y=b?.numId??l,h=b?.level??0,x=b?QD(e,p,d(y)[h]):null,w=u.find(v=>{if(v.numId!==y)return false;let k=v.shown.get(h);return k===void 0?true:x?k!==null&&JD(k,x):k===null});w||(w={numId:y,shown:new Map,items:[]},u.push(w)),w.shown.set(h,x),w.items.push(p);});let f=new Map;for(let p of u){let g=d(p.numId).map((y,h)=>{let x=p.shown.get(h);return y&&x?e1(y,x):y}),b=e.ensureListDefinition(n,g);if(b===null)return null;for(let y of p.items)f.set(y,b);}return f}function gU(e){let t=new Map,n=null;for(let r of e){if(!r)continue;let o=(t.get(r.numId)??0)+1;t.set(r.numId,o),(n===null||o>t.get(n))&&(n=r.numId);}return n}var hU=9,kp=e=>Math.round(e*20);function yU(e,t){return e>0||t<0?{hanging:kp(e>0?e:-t)}:{firstLine:kp(t)}}function bU(e,t){return Array.from({length:hU},(n,r)=>{let o=pd$1(e,t,r)?.level;if(!o)return;let i=_c$1(o),{indent:a}=o,s=a.stated;return {...s?.left?{left:kp(a.left)}:{},...s?.right?{right:kp(a.right)}:{},...s?.firstLineOffset?yU(a.hanging,a.firstLine):{},suffix:o.suff,align:o.lvlJc,...i?{paragraphProperties:i}:{}}})}function Sv(e){let t=(...n)=>e.some(r=>r.localName==="ind"&&n.some(o=>r.attributes?.[o]!==void 0));return {left:t("left","start"),right:t("right","end"),offset:t("hanging","firstLine")}}function n1(e,t){if(!e)return null;let n=t.children.find(a=>a.kind==="paragraphProperties"),r=mf$1(e,n).styleId,o=r?Bd(e,r,"paragraph"):[],i=Jd(o,n);return i>=o.length?null:Sv(o.slice(i).flatMap(a=>a.paragraphProperties))}function r1(e){return {listGeometryOf:t=>bU(e(),t),listLevelKindOf:(t,n)=>vU(e(),t,n)}}function vU(e,t,n){let r=pd$1(e,t,n)?.level;return r?r.numFmt==="bullet"?"bullet":"ordered":null}var xU=32;function kv(e,t,n,r){if(!(e.kind==="textValue"||r>xU)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)kv(o,t,n,r+1);}}var o1=new WeakMap;function i1(e,t,n,r){if(e.kind==="paragraph"||e.kind==="textValue"){kv(e,t,n,0);return}let o=o1.get(e);if(!o){let i=new Map;kv(e,0,i,0),o=[...i.keys()],o1.set(e,o);}for(let i of o)n.has(i)||n.set(i,t);}function kU(e,t){let n=uf$1(e),r=wc$2(n),o=0,i=be(e),a=new Map;for(let s=0;s<i.length;s+=1){let l=i[s];for(let c=l.blockStart;c<l.blockEndExclusive;c+=1){let d=n[c];if(d){for(;o<r.length&&r[o]!==d;)i1(r[o],s,a),o+=1;o+=1,i1(d,s,a);}}}return a}var a1=new WeakMap;function IU(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$1.section))}function RU(e,t){t.story&&t.story.kind!=="body"||IU(t)||(e.map=null);}function PU(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>RU(t,n)));}function TU(e,t){let n=a1.get(e);return n||(n={map:null,subscribed:false},a1.set(e,n)),PU(e,n),n.map||(n.map=kU(t)),n.map}function s1(e,t,n){return n.includes("#")&&!n.startsWith(`${t.name}#`)?null:TU(e,t).get(n)??null}var l1=32;function Bc(e,t,n,r,o="all-markup",i){let a=e.part(),s=be(a,o,i);if(s.length<=1)return 0;let l=ce(a,o,i),c=f=>{let p=l.indexOf(f);if(p!==-1)return p;let g=l.findIndex(b=>b>f);return g===-1?Math.max(0,l.length-1):g},d=Iv(e,t);if(d!==null)return c(d);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let f=e.headerFooterResolutionBySection().findIndex(p=>[p.headers,p.footers].some(g=>[...g.values()].some(b=>b.rId===n.rId)));return f===-1?0:c(f)}let u=CU(e,t);if(u!==null){let f=Iv(e,u);if(f!==null)return c(f)}return 0}function c1(e,t,n,r,o="all-markup",i){let a=e.part(),s=be(a);if(s.length<=1)return {kind:"whole-document"};let l=ce(a,o,i),c=Iv(e,t),d=Bc(e,t,n,r,o,i),u=l[d]??d;if(c!==null&&c===u)return {kind:"anchor",paragraphId:t};let f=s[u];if(!f)return {kind:"unaddressable"};let p=uf$1(a);for(let g=f.blockStart;g<f.blockEndExclusive;g+=1){let b=EU(p[g]);if(b!==null)return {kind:"anchor",paragraphId:b}}return {kind:"unaddressable"}}function EU(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>l1)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 Iv(e,t){return s1(e,e.part(),t)}function CU(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=pj$1(n,r);if(!(!o||!OU(o,t)))for(let i of ad(o.root)){let a=Rc$1(i);if(a===null||!MU(i,t))continue;return qj(e.part()).find(l=>l.noteKind===r&&l.noteId===a)?.paragraphId??null}}return null}function OU(e,t){return t.includes("#")?t.startsWith(`${e.name}#`):eb$1(e,t)!==null}function MU(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>l1)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 Ts(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 Ip(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 d1(e){return {val:e?"1":"0"}}function Rv(e){return e.bound?"bound":e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function u1(e){return e.effectiveLock==="sdtLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function Rp(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}var f1=["firstLine","hanging","firstLineChars","hangingChars"],AU=["left","start","leftChars","startChars"],LU=new Set(["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","permStart","permEnd","proofErr","moveFromRangeStart","moveFromRangeEnd","moveToRangeStart","moveToRangeEnd"]),FU=["leftChars","startChars","firstLineChars","hangingChars"];function p1(e){function t(){let{from:s,to:l}=e.orderedRange();if(s.paragraphId!==l.paragraphId||s.offset!==l.offset)return null;let c=e.markerOf(s.paragraphId);return c?{position:s,marker:c}:null}function n(s){let l=ci(Vn(e.layout(),s)),c=ci$1(e.storyPart(),s),d=c.find(y=>y.localName==="ind")?.attributes,u=e.listNumbering.styleNumbered(s),f=e.listNumbering.styleIndent(s),p=u||d!==void 0||f.left!==l,g=!u&&(f.firstLine!==0||f.inChars);if(!p&&!g)return null;let b={...d??{}};for(let y of f1)delete b[y];if(g&&(b.firstLine="0"),g&&f.inChars&&(b.firstLineChars="0"),p){delete b.leftChars,delete b.startChars;let y=String(l);d?.start!==void 0&&(b.start=y),(d?.start===void 0||d.left!==void 0)&&(b.left=y);}return {op:"setParagraphProperties",paragraphId:s,properties:[...c.filter(y=>y.localName!=="ind"),{localName:"ind",attributes:b}]}}function r(s){let l=e.storyPart(),c=Th$1(l,s)?.children??[],d=c.findIndex(u=>u.kind!=="textValue"&&u.id===s);for(let u=d-1;u>=0;u-=1){let f=c[u];if(!(f.kind==="textValue"||LU.has(f.localName)))return f.kind==="paragraph"?f.id:null}return null}function o(s){let l=e.storyPart();for(let c=Th$1(l,s);c;c=Th$1(l,c.id))if(c.localName==="sdt"&&Rp(c,"edit")==="locked")return true;return false}function i(s){let l=Vn(e.layout(),s),c=0,d=false;for(let u of l){if(u.localName!=="ind")continue;let f=u.attributes??{},p=Qd(f.hanging),g=Qd(f.firstLine);p!==null?c=-p:g!==null&&(c=g);for(let b of FU){let y=Number(f[b]??NaN);Number.isFinite(y)&&y!==0&&(d=true);}}return {left:ci(l),firstLine:c,inChars:d}}function a(s,l){let c=r(s);if(l.firstLine!==0||l.inChars||c===null||!e.markerOf(c))return 0;let d=i(c);if(d.inChars||d.left!==l.left)return 0;let u=d.left+d.firstLine;return u>0&&u<l.left?u:0}return {exitListOnEmptyItem(){let s=t();if(!s)return false;let{position:l,marker:c}=s;if(e.paragraphTextOf(l.paragraphId).length>0)return false;let d=c.level>0&&e.listLevelExists(c,c.level-1),u=[];if(d)u.push(...e.listNumbering.levelOps(l.paragraphId,c.numId,c.level,c.level-1));else {let f=e.listStyle.clearOp(l.paragraphId);f&&u.push(f),u.push(e.listNumbering.leaveOp(l.paragraphId));}return e.commitOps(u)},removeListNumber(s){if(!e.markerOf(s)||!e.listNumbering.numbered(s))return false;let l=n(s);return e.commitOps([...l?[l]:[],e.listNumbering.leaveOp(s)]),true},removeParagraphIndent(s){if(e.markerOf(s)||e.paragraphTextOf(s).length===0||o(s))return false;let l=i(s);if(l.left===0&&l.firstLine===0&&!l.inChars)return false;let c=a(s,l),d=e.listStyle.clearOp(s)!==null,u=e.listNumbering.styleIndent(s,d),f=ci$1(e.storyPart(),s),p=f.find(h=>h.localName==="ind")?.attributes,g={...p??{}};for(let h of [...AU,...f1])delete g[h];(c!==0||u.left!==0||u.leftInChars)&&(g.left=String(c)),u.leftInChars&&(g.leftChars="0"),(u.firstLine!==0||u.inChars)&&(g.firstLine="0"),u.inChars&&(g.firstLineChars="0");let b=f.filter(h=>h.localName!=="ind"&&!(d&&h.localName==="pStyle"));if(!d&&DU(g,p??{}))return false;let y=Object.keys(g).length>0?[{localName:"ind",attributes:g}]:[];return e.commitOps([{op:"setParagraphProperties",paragraphId:s,properties:[...b,...y]}]),true}}}function DU(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>e[r]===t[r])}function m1(e,t,n){let r=false;return e(()=>{let o=t([...n]);return r=o.committed,o}),r}var $c="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",Es="a section break cannot be inserted inside a table cell",Tp="a section break cannot change a section that a locked or linked content control holds",Wc="a section break cannot be inserted in locked or linked content";function NU(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!==pa$2)return false;if(s.localName==="dataBinding")return true;if(s.localName!=="lock")return false;let l=s.attributes?.find(c=>c.localName==="val"&&c.namespaceUri===pa$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",c=s||r(i);for(let d of i.children??[])o(d,l,c);};return o(e.root,false,false),{inCell:t,held:n}}var HU=32;function _U(e){let t=new Set(dn(e).map(n=>gn(n)));return cn(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function Tv(e,t){let n=t.replaceAt??t.collapseTo;return en$1(e,n.paragraphId)?t.collapseTo:n}var Pv=(e,t)=>Oh$1(e,t)||Kh$1(e,t).content;function Pp(e,t,n,r){if(en$1(e,t))return Es;if(Pv(e,t))return Wc;let{section:o,ownerId:i}=fn(e,t);return gn(o)===n?null:i!==null&&Pv(e,i)?Tp:r?$c:null}function g1(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return Es;if(e.caretParagraphId!==null)return Pp(e.part(),e.caretParagraphId,t,n);let r=NU(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=fn(a,o.paragraphId),l=fn(a,i.paragraphId),c=s.section===l.section,d=c?gn(s.section):_U(a),u=e.paragraphOrder(),f=u.indexOf(o.paragraphId),p=u.indexOf(i.paragraphId),g=f===-1||p===-1?null:u.slice(f,p+1),b=g!==null&&!g.some(h=>r.inCell.has(h))&&!g.some(h=>r.held.has(h));if(d!==null&&d!==t){if(b&&c&&s.ownerId!==null&&Pv(a,s.ownerId))return Tp;if(n&&b)return $c}if(b&&d!==null)return null;if(g===null||g.length-1>HU)return n&&d!==null&&d!==t?$c:null;let y=Tv(a,e.deleteSelectionPlan());return Pp(a,y.paragraphId,t,n)}var BU=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function $U(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 Ep(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 h1(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 y1(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(),c=(S,T,B)=>t.applyTreeOps(S,T,B,e.storyScope()),d=FM({session:t,storyPart:l}),u=YD({storyPart:l,styleCascade:e.styleCascade,layout:e.layout}),f=p1({orderedRange:o,layout:e.layout,storyPart:l,markerOf:v,listLevelExists:I,paragraphTextOf:e.paragraphTextOf,listNumbering:u,listStyle:d,commitOps:S=>m1(n,T=>c(T,i()),S)}),p=()=>e.paragraphOrder(),g={get value(){return e.layout()}};function b(){let S=e.selectedCells?.();return S&&S.length>0?S:null}function y(S){let T=false;return n(()=>{let B=S();return T=B.committed,B},void 0,{keepCellSelection:b()!==null}),T}function h(S=o()){if(b()!==null)return [...ma$1(g.value,b())];let{from:T,to:B}=S,W=p(),q=W.indexOf(T.paragraphId),U=W.indexOf(B.paragraphId);return q===-1||U===-1?null:W.slice(q,U+1)}let x=8;function w(S){return v(S)?.level??null}function v(S){return cb$1(g.value,S)}function k(S){let T=v(S);return T?T.numFmt==="bullet"?"bullet":"ordered":null}let E={listGeometryOf:e.listGeometryOf,listLevelKindOf:e.listLevelKindOf,order:p,markerOf:v,ensureListDefinition:(S,T)=>t.ensureListDefinition(S,T),indentOf:S=>bc(g.value,S)?.indent??null,directIndentSides:S=>Sv(ci$1(l(),S)),styleNumberedIndentSides:S=>{let T=eb$1(l(),S);return T&&T.kind!=="textValue"?n1(e.styleCascade(),T):null}};function I(S,T){return T<0||T>x?false:e.numberingLevelExists(S.numId,T)}function P(S,T){return T<0||T>x?false:e.numberingLevelExists(S.numId,T)?true:t.ensureNumberingLevel(S.numId,T,S.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(S.numId,T)}function C(S,T,B){let W=T==="increase"?1:-1,q=[];for(let U of S){let Z=Vn(g.value,U),M=v(U),J=M?.level??null;if(M&&J!==null){let H=J+W;if(H<0||H>x||!P(M,H))continue;q.push(...u.levelOps(U,M.numId,J,H));continue}let ee=ci(Z),fe=B===void 0?wv(ee,W):VD(ee,W,B);if(fe===ee)continue;let se=ci$1(l(),U),$=se.find(H=>H.localName==="ind");q.push({op:"setParagraphProperties",paragraphId:U,properties:ei$1(se,{localName:"ind",attributes:$U($?.attributes,String(fe))})});}return q.length===0?false:y(()=>c(q,i()))}function O(S,T){let B=[];for(let W of S){let q=ci$1(l(),W),Z={...q.find(M=>M.localName==="ind")?.attributes??{}};T.left!==void 0&&(Z=Ep(Z,"left","start",T.left)),T.right!==void 0&&(Z=Ep(Z,"right","end",T.right)),T.firstLine!==void 0&&(Z=h1(Z,T.firstLine)),B.push({op:"setParagraphProperties",paragraphId:W,properties:ei$1(q,{localName:"ind",...Object.keys(Z).length>0?{attributes:Z}:{}})});}return B.length===0?false:y(()=>c(B,i()))}return {insertTab(){let S=s(),T=S.replaceAt??S.collapseTo;n(()=>c([...S.ops,{op:"insertTab",paragraphId:T.paragraphId,offset:T.offset}],i()),()=>a({...T,offset:T.offset+1}));},insertLineBreak(){let S=s(),T=S.replaceAt??S.collapseTo;n(()=>c([...S.ops,{op:"insertHardBreak",paragraphId:T.paragraphId,offset:T.offset}],i()),()=>a({...T,offset:T.offset+1}));},insertPageBreak(){let S=s(),T=S.replaceAt??S.collapseTo;n(()=>c([...S.ops,{op:"insertPageBreak",paragraphId:T.paragraphId,offset:T.offset}],i()),()=>a({...T,offset:T.offset+1}));},exitListOnEmptyItem:f.exitListOnEmptyItem,removeListNumber:f.removeListNumber,removeParagraphIndent:f.removeParagraphIndent,isListParagraph(){let{paragraphId:S}=r();return w(S)!==null},isListActive(S){let T=h();if(T===null)return false;let B=S==="bullet"?"bullet":"ordered";return T.length>0&&T.every(W=>k(W)===B)},toggleList(S){let T=h();if(T===null||T.length===0)return false;let B=T.every(U=>k(U)===S),W=B?null:t1(E,T,S);if(!B&&W===null)return false;let q=B?[]:d.applyOps(T);for(let U of T){if(B){q.push(u.leaveOp(U));continue}let Z=w(U);q.push({op:"setListNumbering",paragraphId:U,numId:W?.get(U)??null,...Z!==null?{level:Z}:{}});}return y(()=>c(q,i()))},canAdjustIndent(S){let T=h();if(T===null)return false;let B=S==="increase"?1:-1;return T.some(W=>{let q=v(W);if(q){let Z=q.level+B;return Z>=0&&Z<=x}let U=ci(Vn(g.value,W));return wv(U,B)!==U})},adjustIndent(S){let T=h();return T!==null&&C(T,S)},setIndent(S){if(S.left===void 0&&S.right===void 0&&S.firstLine===void 0)return false;let T=h();return T!==null&&O(T,S)},indentWithTab(S){let T=o();if(T.from.paragraphId===T.to.paragraphId&&T.from.offset===T.to.offset&&b()===null||XD(g.value,T))return false;let W=h(T);if(W===null)return false;let q=Math.round(Qb$1(t.settingsRoot())*20),U=ZD(g.value,l(),p()),Z=b()===null?zD(T,W,U,S,q):{write:"stepLeft",paragraphs:W};return Z===null?false:(Z.write==="stepLeft"?C(Z.paragraphs,S,q):O(Z.paragraphs,{firstLine:Z.write==="setFirstLine"?q:null}),true)},setParagraphFormat(S){let T=h();if(T===null||T.length===0)return false;let B=[];S.direction!==void 0&&B.push({localName:"bidi",paragraphDirection:S.direction}),S.alignment!==void 0&&B.push({localName:"jc",attributes:{val:S.alignment},physicalAlignment:true});let W={...Ts("before",S.spaceBeforePt),...Ts("after",S.spaceAfterPt),...Ip(S.lineSpacing)};Object.keys(W).length>0&&B.push({localName:"spacing",attributes:W,mergeAttributes:true});for(let[M,J]of BU){let ee=S[M];ee!==void 0&&B.push({localName:J,attributes:d1(ee)});}let q=S.tabStops!==void 0,U=S.indentLeftTwips!==void 0||S.indentRightTwips!==void 0||S.indentFirstLineTwips!==void 0;if(B.length===0&&!U&&!q)return false;let Z=[];for(let M of T){let J=ci$1(l(),M),ee=J;if(U){let j={...J.find(N=>N.localName==="ind")?.attributes??{}};S.indentLeftTwips!==void 0&&(j=Ep(j,"left","start",S.indentLeftTwips)),S.indentRightTwips!==void 0&&(j=Ep(j,"right","end",S.indentRightTwips)),S.indentFirstLineTwips!==void 0&&(j=h1(j,S.indentFirstLineTwips)),ee=ei$1(ee,{localName:"ind",...Object.keys(j).length>0?{attributes:j}:{}});}let fe=Vn(g.value,M),se=J,$=false;for(let H of B){let j=wp(H,fe,ee,se);if(!j)continue;if($=true,j.remove){ee=ee.filter(z=>z.localName!==j.localName);continue}let N=j.mergeAttributes?{...ee.find(z=>z.localName===j.localName)?.attributes??{},...j.attributes}:j.attributes??{},D=Object.fromEntries(Object.entries(N).filter(([,z])=>z!=null));ee=ei$1(ee,{localName:j.localName,...Object.keys(D).length>0?{attributes:D}:{}});}if(($||U)&&Z.push({op:"setParagraphProperties",paragraphId:M,properties:ee}),q){let H=yc(e.layout(),M);Z.push({op:"setParagraphTabStops",paragraphId:M,stops:S.tabStops.map(j=>({positionTwips:Math.round(j.positionTwips),alignment:j.alignment,...j.leader&&j.leader!=="none"?{leader:j.leader}:{}})),...H?{inForcePositionsTwips:H.stops.map(j=>Math.round(j.positionPt*20))}:{}});}}return Z.length===0?true:y(()=>c(Z,i()))},sectionProperties:()=>ae(t.part()),sectionPropertiesAt(S){let T=be(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),B=Bc(t,S,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (T[B]??T[T.length-1]).properties},sectionAnchorParagraphAt(S){return c1(t,S,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(S){let T=false;return n(()=>{let B=e.storyScope().kind==="body",W=t.applyTreeOps([{op:"setSectionProperties",...S}],B?i():void 0,void 0,{kind:"body"});return T=W.committed,W}),T},sectionBreakRefusal(S="nextPage"){return e.storyScope().kind!=="body"?null:g1({part:()=>t.part(),breakType:S,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:p,deleteSelectionPlan:s})},insertSectionBreak(S="nextPage"){if(e.storyScope().kind!=="body")return false;let T=s(),B=Tv(t.part(),T),W=(en$1(t.part(),B.paragraphId)?Es:null)??Pp(t.part(),B.paragraphId,S,e.editingMode?.()==="suggest");if(W!==null)return e.publishRefusal?.(W),false;let q=new Set(t.paragraphIds()),U=false,Z=false;return n(()=>{let M=t.applyTreeOps([...T.ops,{op:"splitParagraph",paragraphId:B.paragraphId,offset:B.offset},{op:"setSectionMark",paragraphId:B.paragraphId,breakType:S}],i(),void 0,{kind:"body"});return U=M.committed,Z=M.reason==="locked"||M.reason==="bound",M},()=>{let M=t.paragraphIds().find(J=>!q.has(J));return M?a({paragraphId:M,offset:0}):null}),!U&&Z&&e.publishRefusal?.(Wc),U}}}var w1="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function S1(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===w1}function WU(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===w1}function Ev(e){return e.kind==="textValue"?[]:e.children}function k1(e,t=0){if(e.kind==="textValue")return e.value;if(t>=Aa$1||e.kind==="deletedText"||qU(e.kind)||bh$1(e)||e.kind==="runProperties")return "";let n=Ub$1(e);if(n!==null)return n;if(e.kind==="generic"&&!Ca(e)&&!S1(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return cc$1(e);let r=Ba(e,t),o="";for(let i of e.children)o+=k1(i,r);return o}function qU(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function Cv(e,t,n){if(!(t>=Aa$1))for(let r of e){if(r.kind==="hyperlink"){Ba(r,t)<Aa$1&&n(r,t);continue}if(Ca(r)){Cv(Ev(r),Ba(r,t),n);continue}if(S1(r)){for(let o of Ev(r))WU(o)&&Cv(Ev(o),Ba(r,t),n);continue}n(r,t);}}function b1(e,t,n){let r=KU(e,t);if(!r||r.kind!=="paragraph")return [];let o=Ei(r),i=[],a=0;return Cv(r.children,0,(s,l)=>{let c=o.spanOf(s);if(c&&(a=Math.max(a,c.end)),s.kind!=="hyperlink")return;let d=c?c.start:a,u=c?c.end:a,f=He$1(s,n);i.push({id:s.id,paragraphId:t,start:d,end:u,text:Yb$2(k1(s,l)),kind:f.kind,href:f.href,authored:f.authored,...f.anchor!==void 0?{anchor:f.anchor}:{},...f.tooltip!==void 0?{tooltip:f.tooltip}:{}});}),i}function KU(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 UU(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 jU(e,t){for(let n of Sa(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 I1(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,u,f,p)=>e.session.applyTreeOps(d,u,f,t(),p?.length?{packageEdits:p}:void 0),i=d=>{let u=n();return u?b1(u,d,r):[]},a=()=>UU(i(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,u=jU(e.layout(),d);return u===null?null:e.fieldLinkById(u)},l=d=>{let u=e.selection().head.paragraphId,f=i(u).find(p=>p.id===d);if(f)return f;for(let p of e.session.storyParts()){let g=b=>fj$1(e.session.currentPackage(),p.name,b);for(let b of fd$1(p))for(let y of id(b.root)){let h=y.id,x=b1(p,h,g).find(w=>w.id===d);if(x)return x}}return null};return {linksInCaretParagraph:()=>i(e.selection().head.paragraphId),linkAtCaret:a,fieldLinkAtCaret:s,linkById:l,selectionIsPendingDeletion:()=>{let{anchor:d,head:u}=e.selection();if(d.paragraphId!==u.paragraphId||d.offset===u.offset)return false;let f=Math.min(d.offset,u.offset),p=Math.max(d.offset,u.offset);return Yb$1(e.layout(),u.paragraphId).some(g=>g.start<=f&&p<=g.end)},wordAtCaret(){return a()||s()?null:xf(e.layout(),e.selection())},applyHyperlink(d){let u=d.text===void 0?d:{...d,text:Zb$1(d.text)},f=u.url!==void 0&&u.url.length>0,p=u.anchor!==void 0&&u.anchor.length>0;if(f===p)return false;let g=t();if(!n()||e.refusesWrite())return false;let b;if(f){let B=()=>e.session.ensureHyperlinkRelationship(u.url,g),W=e.withMintActor?e.withMintActor(B):B();if(!W)return false;b=W;}let y={...b!==void 0?{relationshipId:b}:{},...p?{anchor:u.anchor}:{},...u.tooltip!==void 0?{tooltip:u.tooltip}:{}},h=a(),x=e.orderedRange(),w=x.from.paragraphId===x.to.paragraphId&&x.from.offset===x.to.offset;if(h&&(w||VU(h,x))){let B=[],W;if(u.text!==void 0&&u.text!==Zb$1(h.text)){if(u.text.length===0)return false;let U=e.replacementLanding?.(h.paragraphId,h.start,h.end),Z=e.textOf(h.paragraphId).slice(h.start,h.start+2),M=h.start+(Z.length===2&&Z.charCodeAt(0)>=55296&&Z.charCodeAt(0)<=56319&&Z.charCodeAt(1)>=56320&&Z.charCodeAt(1)<=57343?2:1);if(U!=null&&U>h.start&&M<h.end)B.push({op:"setHyperlinkTarget",linkId:h.id,...y},{op:"deleteText",paragraphId:h.paragraphId,start:h.start,end:h.end},{op:"insertText",paragraphId:h.paragraphId,offset:M,text:u.text});else if(U!=null){let J=i$1(e.session.currentPackage(),{createPart:!e.collaborative});J.edit&&(W=[J.edit]),B.push({op:"setHyperlinkTarget",linkId:h.id,...y},...v1(h,U,u.text),{op:"insertHyperlink",paragraphId:h.paragraphId,start:U,end:U+u.text.length,...y,...J.styleId?{styleId:J.styleId}:{}});}else {let J=x1(h.paragraphId,h.start,h.end,u.text);if(!J)return false;B.push({op:"setHyperlinkTarget",linkId:h.id,...y},...J);}}else B.push({op:"setHyperlinkTarget",linkId:h.id,...y});let q=false;return e.commit(()=>{let U=o(B,e.selectionMark(),void 0,W);return q=U.committed,U},()=>null),q}let v=x.from.paragraphId;if(x.to.paragraphId!==v)return false;let k=[],E=x.from.offset,I=x.to.offset;if(w){let B=u.text??u.url??u.anchor??"";if(B.length===0)return false;E=e.insertionLanding?.(v,E)??E,k.push({op:"insertText",paragraphId:v,offset:E,text:B}),I=E+B.length;}else {let B=e.replacementLanding?.(v,E,I);if(B!=null){let W=u.text??e.textOf(v).slice(E,I);if(W.length===0)return false;k.push(...v1({paragraphId:v,start:E,end:I},B,W)),E=B,I=B+W.length;}else if(u.text!==void 0&&u.text!==e.textOf(v).slice(E,I)){let W=x1(v,E,I,u.text);if(!W)return false;k.push(...W),I=E+u.text.length;}}if(I<=E)return false;let{styleId:P,edit:C}=i$1(e.session.currentPackage(),{createPart:!e.collaborative}),O=C?[C]:void 0;k.push({op:"insertHyperlink",paragraphId:v,start:E,end:I,...y,...P?{styleId:P}:{}});let S=false,T={paragraphId:v,offset:I};return e.commit(()=>{let B=o(k,e.selectionMark(),{paragraphId:v,start:I,end:I},O);return S=B.committed,B},()=>({anchor:T,head:T})),S},removeHyperlink(d){if(!n())return false;let u=d?l(d):a();if(!u)return false;let f=false,p={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let g=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return f=g.committed,g},()=>({anchor:p,head:p})),f}}}function VU(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function v1(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 x1(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}function Ov(e){if(e.kind==="textValue")return JSON.stringify(e.value);let t=e.attributes.map(n=>`${n.namespaceUri??""}|${n.localName}=${n.value}`).sort().join(",");return `<${e.namespaceUri??""}|${e.localName} ${t}>${e.children.map(Ov).join("")}</>`}function R1(e){let t=ud(e)?.root;if(!t)return [];let n=new Map,r=[];for(let o of g$3(t)){let i=f$3(o,"styleId");if(!i)continue;let a=n.get(i);a?Ov(a)===Ov(o)&&r.push(o.id):n.set(i,o);}return r}function P1(e){return R1(e).length===0?null:d$3(t=>{let n=ud(t);if(!n)return t;for(let r of R1(t)){let o=lb$2(n,r);if(!o.ok)return t;n=o.part;}return rg(t,n)})}function T1(e){let{session:t,collaboration:n}=e,r=0,o=(d,u)=>{if(!n)return {packageEdits:d,historyToken:u};r+=1;let f=n.identity.actorId;return {packageEdits:d,origin:g.mutationHuman,actorId:f,operationId:`${f}:${n.sessionId}:browser:${r}`,recordsHistory:false,historyToken:u}},i=(d,u)=>Ua(()=>t.applyTreeOps([],void 0,void 0,u,o(d,void 0)));function a(d,u,f,p=e.defaultScope(),g){let b=n?.gateOperations(d,p);if(b)return {committed:false,rejected:true,opCount:0,reason:b};let y=n?(g??[]).filter(e$2):[];if(y.length>0){let x=i(y,p);if(x.rejected)return x}let h=g?.filter(x=>!y.includes(x));return t.applyTreeOps(d,u,f,p,o(h?.length?h:void 0,e.historyGroup()))}function s(){if(!n||!e.canRepair()||n.gateOperations([],{kind:"body"}))return;let d=P1(t.currentPackage());d&&i([d],{kind:"body"});}let l=false;function c(d){if(!n||l)return;let u=d.dependencyKeys;u.length>0&&u.every(f=>f===l$1.story)||(l=true,e.later(()=>{l=false,s();}));}return {apply:a,noteRemoteChange:c}}function GU(e,t,n){if(!t)return 0;let r=t.scrollTop;return e.pages.find(i=>(i.box.y+i.box.height)*n>r)?.index??0}var zU=24;function ZU(e,t,n){if(!n)return Math.max(0,t-zU);let r=e.clientHeight,o=e.scrollTop;return t>=o+r*.2&&t<=o+r*.8?o:Math.max(0,t-r/2)}function E1(e){let{pagesLayer:t}=e;function n(){return e.container.closest(".docx-editor__scroll-container")}let r=u=>{if(!u||u.length===0||u.startsWith("#"))return false;let f=U(u);if(!f.ok||!f.href)return false;let p=t.ownerDocument.defaultView;return p?(p.open(f.href,"_blank","noopener,noreferrer"),true):false},o=(u,f)=>{e.beginJump?.();let p=!e.enterStoryFor||e.enterStoryFor(u.paragraphId);if(!p&&!f?.orShow)return false;let g=e.layout(),b=n(),y=Re(g,u,p?void 0:{preferredPageIndex:GU(g,b,e.scale())});if(!y)return !p||!e.whenLaidOut?.(u,()=>o(u,f))?false:(e.setSelection(u),true);let h=g.pages[y.pageIndex];if(!h)return false;let x=ic(h,u.paragraphId).y+y.y;return b&&(b.scrollTop=ZU(b,x*e.scale(),f?.center===true),e.onScrolled?.()),p?(e.setSelection(u),true):"shown"},i=u=>{let f=e.bookmarks().get(u);return f?o(f)===true:false},a=null;function s(u){if(!u||u.closest("[data-docx-hf]"))return null;let f=u.closest("a.docx-hyperlink");if(f){let g=f.dataset.docxLink;return g?{linkId:g,drawing:false}:null}let p=u.closest("[data-docx-drawing-link]");if(p){let g=p.dataset.docxDrawingLink;return g?{linkId:g,drawing:true}:null}return null}let l=u=>{if(d$1(u.target))return;a=null;let f=u.target,p=s(f);if(!p)return;let b=f.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();a={linkId:p.linkId,drawing:p.drawing,rect:{left:b.left,top:b.top,bottom:b.bottom,right:b.right}};},c=u=>{if(d$1(u.target))return;let f=u.target,p=s(f);if(!p){let y=a;if(a=null,!y)return;u.preventDefault(),d(y.linkId,y.rect,u,y.drawing);return}a=null,u.preventDefault();let b=f.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();d(p.linkId,{left:b.left,top:b.top,bottom:b.bottom,right:b.right},u,p.drawing);};function d(u,f,p,g){let b=g?e.drawingLinkById?.(u)??null:e.linkById(u);if(!b)return;if(p.metaKey||p.ctrlKey){b.kind==="external"?r(b.href):b.anchor&&i(b.anchor);return}if(e.isCollapsedSelection()){if(b.kind==="internal"){b.anchor&&i(b.anchor);return}e.onPopover?.({link:b,rect:f});}}return t.addEventListener("pointerdown",l,true),t.addEventListener("click",c),{goToPosition:o,goToBookmark:i,openExternal:r,destroy(){t.removeEventListener("pointerdown",l,true),t.removeEventListener("click",c);}}}function XU(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 Mv(e,t){return e.drawingNodeId!==t?null:XU(e)}function C1(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=Mv(n,t);if(r)return r}return null}function YU(e,t){for(let r of e.anchoredDrawings??[]){let o=Mv(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=M1(s,t);if(l)return l}continue}let o=O1(r,t);if(o)return o}let n=C1(e.header,t);return n||C1(e.footer,t)}function O1(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=Mv(r,t);if(o)return o}return null}function M1(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=M1(o,t);if(i)return i}return null}return O1(e,t)}function A1(e,t){for(let n of e.pages){let r=YU(n,t);if(r)return r}return null}var Cp=24;function L1(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))&&i!=="none")return;let d=e.preferredPageIndex(),u=e.preferredLineId?.(),f=e.layout(),p=Re(f,a.head,{measurer:e.measurer(),...d!==void 0?{preferredPageIndex:d}:{},...u!==void 0?{preferredLineId:u}:{}});if(!p)return;let g=t!==null&&t!==p.pageIndex;if(t=p.pageIndex,i==="none"||!r&&!g)return;let b=f.pages[p.pageIndex],y=e.scroller();if(!b||!y||y.clientHeight<=0)return;let h=e.scale(),x=b.contentBox.y-b.box.y,w=(b.box.y+x+p.y)*h+e.container.offsetTop,v=w+p.height*h,k=y.scrollTop,E=k+y.clientHeight,I=k;if(w<k+Cp)I=w-Cp;else if(v>E-Cp)I=v+Cp-y.clientHeight;else return;let P=Math.max(0,y.scrollHeight-y.clientHeight),C=Math.max(0,Math.min(I,P));Math.abs(C-y.scrollTop)<.5||(y.scrollTop=C,e.scheduleRematerialize());}}}function F1(e){return (t,n,r,o)=>{if(e.settle(),/[\r\n\v\f\u2028\u2029]/.test(o))return e.refuse("replacement requires text without a paragraph mark");if(!e.storyParagraphs().includes(t))return e.refuse("that text is not in the story being edited");let i=e.textOf(t);if(n<0||r<n||r>i.length)return e.refuse("that range is outside the paragraph");let a={paragraphId:t,offset:n},s=r>n?e.rangePlan({anchor:a,head:{paragraphId:t,offset:r}}):{ops:[],replaceAt:e.insertionPoint(a)},l=[...s.ops],{paragraphId:c,offset:d}=s.replaceAt;if(o.length>0&&l.push({op:"insertText",paragraphId:c,offset:d,text:o}),l.length===0)return true;let u=e.selection();return e.commitWithoutFollow(l,e.selectionMark()??void 0,()=>{e.flushLayout();let f=e.textOf(t),p=Hc(u,t,i,f);return e.selectionsEqual(p,u)?null:(e.noteModelMoved(),p)})}}function D1(e,t){let n=[],r=a=>{for(let s of a){if(s.kind==="paragraph"){n.push({id:s.id,length:Ei(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=Ei(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 N1(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlContent"||t.localName==="sdtContent"))return t.children;return []}function H1(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 qc="the document is open for viewing",QU="image changes are not supported in suggesting mode",_1="tracked changes need a non-empty author";function B1(e){function t(){return {committed:false,rejected:true,opCount:0,reason:qc}}return {applyDrawingOps(n){if(e.editingMode()==="view")return t();let r=e.selectionMark(),o={committed:false,rejected:true,opCount:0};return e.commit(()=>(o=e.applyOps(n,r,r),o)),o},applyImageProperties(n){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:qc};let r={ok:false,reason:"invalidArgs"};return e.commit(()=>(r=e.session.applyImageProperties(e.storyScope(),n),{committed:r.ok,rejected:!r.ok,opCount:r.ok?1:0,...r.ok?{}:{reason:r.detail??r.reason}})),r},deleteImage(n){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:qc};let r=e.editingMode()==="suggest",o=e.author();if(r&&(o===void 0||o===""))return {ok:false,reason:"invalidArgs",detail:_1};let i={ok:false,reason:"invalidArgs"};return e.commit(()=>(i=r?e.session.deleteImageTracked(e.storyScope(),n,{author:o,date:e.trackedDate()}):e.session.deleteImage(e.storyScope(),n),{committed:i.ok,rejected:!i.ok,opCount:i.ok?1:0,...i.ok?{}:{reason:i.detail??i.reason}})),i},insertImage(n){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:qc});let r=e.editingMode()==="suggest",o=e.author();if(r&&(o===void 0||o===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:_1});let i=e.actorId();return e.session.insertImage(e.storyScope(),{...n,decodePort:e.decodePort(),...r?{revision:{author:o,date:e.trackedDate()}}:{},...i?{actorId:i}:{}})},replaceImage(n,r,o,i){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:qc});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:QU});let a=e.actorId();return e.session.replaceImage(e.storyScope(),n,r,o,e.decodePort(),{...i,commitGuard:()=>e.editingMode()==="edit"&&i.commitGuard?.()!==false,...a?{actorId:a}:{}})}}}function $1(e){let t=null,n=null,r="",o=()=>{let c=e.session.part(),d=e.revisionDisplayMode(),u=e.revisionAuthorFilter();return {sections:be(c,d,u),sourceIndexes:ce(c,d,u)}},i=c=>{let{sourceIndexes:d}=o(),u=d.indexOf(c);if(u!==-1)return u;let f=d.findIndex(p=>p>c);return f===-1?Math.max(0,d.length-1):f},a=()=>{if(!t)return;let c=OT(e.layout(),t,e.materializedPages?.());c!==t.pageIndex&&(t={...t,pageIndex:c,sectionIndex:e.sectionAtPage(c).sectionIndex});},s=c=>{if(e.entryRefused?.()===true&&t?.scope.rId!==c.rId||!c.rId||e.session.partFor({kind:"headerFooter",rId:c.rId})===null)return false;e.leaveOtherStories?.();let d=e.layout(),u=TT(d,c.rId),f=t,p=f?.scope.rId===c.rId,g=u?null:JU(e.session,c.rId);if(!u&&!g)return false;let b=c.pageIndex??(p&&f?f.pageIndex:u?.pageIndex??0),y=c.kind??(p&&f?f.kind:u?.kind??g.kind),h=c.variant??(p&&f?f.variant:u?.story.variant??g.variant),x=p&&f?f.partName:u?.story.partName??g.partName,w=d.pages[b]??d.pages[u?.pageIndex??0],v=(w?os(w,{scope:{kind:"headerFooter",rId:c.rId},kind:y,partName:x}):null)??u?.story??{scope:{rId:c.rId},variant:h,partName:x},k=e.selection(),E=f?f.savedBodySelection:{anchor:{...k.anchor},head:{...k.head}},I=p&&f?.sectionIndex!==void 0&&b===f.pageIndex,P=c.sectionIndex??(I?f.sectionIndex:u?e.sectionAtPage(b).sectionIndex:g?i(g.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:c.rId},pageIndex:b,...P!==void 0?{sectionIndex:P}:{},kind:y,variant:v.variant,partName:v.partName,savedBodySelection:E};let O=e.session.paragraphIdsIn(Gu(t))[0];if(!O)return t=null,false;let S=c.position?Yu(d,{anchor:c.position,head:c.position},t):p?Yu(d,k,t):{anchor:{paragraphId:O,offset:0},head:{paragraphId:O,offset:0}};return e.setScopeSelection(S),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;e.leaveOtherStories?.();let c=t.savedBodySelection;t=null,e.setScopeSelection(Yu(e.layout(),c,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>PT(t),setActiveScope(c){return c.kind==="body"?(l(),true):c.kind==="headerFooter"?s({rId:c.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:a,headerFooterState(){if(!t)return null;let c=e.session.headerFooterResolutionBySection(),d=t.sectionIndex??0,u=o(),f,p,g,b=w=>{let v=u.sourceIndexes[w]??w,k=c[v];if(!k)return false;let I=(t.kind==="header"?k.headers:k.footers).get(t.variant);return !I||I.rId!==t.scope.rId?false:(d=w,f=I.inherited,p=k.titlePage,g=k.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&b(t.sectionIndex))){let w;c.forEach((v,k)=>{let I=(t.kind==="header"?v.headers:v.footers).get(t.variant);!I||I.rId!==t.scope.rId||!(w===void 0||w&&!I.inherited||w===I.inherited&&i(k)<d)||(d=i(k),f=I.inherited,p=v.titlePage,g=v.evenAndOddHeaders,w=I.inherited);});}let y=u.sections[d]?.properties??u.sections.at(-1)?.properties,h=y?.margins.headerTwips,x=y?.margins.footerTwips;return {editing:t.kind,sectionIndex:d,variant:t.variant,rId:t.scope.rId,partName:t.partName,...f!==void 0?{inherited:f}:{},...p!==void 0?{titlePage:p}:{},...g!==void 0?{evenAndOddHeaders:g}:{},...h!==void 0?{headerDistanceTwips:h}:{},...x!==void 0?{footerDistanceTwips:x}:{}}},headerFooterStateStable(c){if(!t)return n=null,r="",null;let d=this.headerFooterState();if(!d)return null;let u=[c,d.editing,d.sectionIndex,d.variant??"",d.rId??"",d.partName??"",String(d.inherited),String(d.titlePage),String(d.evenAndOddHeaders),String(d.headerDistanceTwips??""),String(d.footerDistanceTwips??"")].join("|");return n&&r===u||(n=Object.freeze({...d}),r=u),n}}}function W1(e){return e.length>0&&e.every(t=>t.op==="setDocumentProtection")}function JU(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 q1(e,t,n){let{sectionIndex:r,sectionStart:o}=e.sectionAtPage(n),i=f=>f[Math.min(r,Math.max(0,f.length-1))],a=f=>{let p=i(f);return t==="header"?p?.headers:p?.footers},s=e.session.headerFooterResolutionBySection(),l=i(s),c=e.layout.pages[n]?.pageFieldSource?.pageNumber??n+1,d=l?.evenAndOddHeaders&&c%2===0?"even":l?.titlePage&&n===o?"first":"default",u=a(s)?.get(d)?.rId;if(!u){if(!e.create({op:"createHeaderFooter",sectionIndex:r,kind:t,variant:d,...d==="first"?{titlePage:true}:{},...d==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;u=a(e.session.headerFooterResolutionBySection())?.get(d)?.rId,e.flushLayout();}u&&e.enter({rId:u,pageIndex:n,sectionIndex:r,kind:t,variant:d});}var ej=500;function tj(e,t,n,r){let o=e.part();return _d(o,uf$1(o,n,r),t)}function K1(e,t){if(!e)return null;let n=e.session,r=lb$1(e.revisionDisplayMode()),o=e.state().selection.head.paragraphId,i=Bc(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:Et(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),a=n.currentPackage(),s=Bf$1(a),l=Cf$2(s),c=Df$1(s),d=be(n.part(),r,t),u=tj(n,d,r,t),f=zf$1(u[i]),p=Af$2(u[i]),g=Ef$1(f),b=Ff$1(p,c);return {sectionIndex:i,footnote:{resolved:g,...l?{documentAuthored:l}:{},...f?{sectionAuthored:f}:{}},endnote:{resolved:b,...c?{documentAuthored:c}:{},...p?{sectionAuthored:p}:{}}}}function U1(e,t){let n=Ic$1(t);if(!n)return null;let r=pj$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,i=cd(o.root,n.noteId);if(!i)return null;let a=[],s=ej,l=(d,u)=>{if(!(u>32||s<=0)){if(d.kind==="paragraph"&&typeof d.id=="string"){let f=(Jm(o,d.id)??"").replace(/\uFFFC/g,"").trim();if(f){let p=f.slice(0,s);a.push(p),s-=p.length;}return}if(d.kind!=="textValue")for(let f of d.children)l(f,u+1);}};l(i,0);let c=a.filter(Boolean).join(" ").trim();return c.length>0?c:null}function j1(e){return [()=>{zb$1(e().root);},()=>{Sk(e());},()=>{Ol(e());}]}var nj=50,rj=16;function V1(e){let t=e.schedule??((s,l)=>{let c=globalThis.setTimeout(s,l);return ()=>globalThis.clearTimeout(c)}),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>nj)return;a(rj);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 Ao=null;function Cs(e,t,n){let r=Ao;Ao=t===void 0?null:{owner:e,group:t};try{return n()}finally{Ao=r;}}function Av(e){if(Ao===null||Ao.owner!==e)return;let{group:t}=Ao;return Ao=null,t}function oj(e,t){Ao===null&&(Ao={owner:e,group:t});}var Op=class{current;get value(){return this.current}around(t,n,r,o=true){let i=this.current,a=Av(t);this.current=a??(o?Symbol("command"):void 0);let s;try{s=n();}finally{this.current=i;}return a!==void 0&&!r(s)&&oj(t,a),s}};function G1(e,t){let n=t.indexOf("#"),r=n>0?t.slice(0,n):e.mainDocumentPart,o=e.parts.get(r);return o?eb$1(o,t):null}function z1(e){let{anchor:t,head:n}=e;return t.paragraphId!==n.paragraphId||t.offset!==n.offset?null:`${n.paragraphId}\0${n.offset}`}var ij=1e3,aj=2e3,Mp=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||z1(t)!==this.expected||n-this.lastTypedAt>=ij||n-this.startedAt>=aj||n<this.lastTypedAt)&&(this.group=Symbol("typing"),this.startedAt=n),this.lastTypedAt=n,this.group}landed(t){this.expected=z1(t),this.paragraphId=this.expected===null?null:t.head.paragraphId;let n=this.paragraphId;this.landedNode=n===null?null:G1(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=G1(this.currentPackage(),n);r!==o&&(r===null||o===null||!Ka(r,o))&&this.end();}end(){this.group=void 0,this.expected=null,this.paragraphId=null,this.landedNode=null;}};function di(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 Z1(e,t,n){for(let r of e)r.style.width=t,r.style.height=n;}function Kc(e,t$1,n={}){let r=n,o=ip(n),i$1=r.openedSession??m(t$1,{...n.reviewModel?{reviewModel:n.reviewModel}:{},...n.contentLockPolicy?{contentLockPolicy:n.contentLockPolicy}:{}});if(!i$1.ok)return {ok:false,reason:i$1.reason,...i$1.detail?{detail:i$1.detail}:{},..."limit"in i$1&&i$1.limit?{limit:i$1.limit}:{}};let a=gL(i$1.session,o),s=lb(fc(n.unsupportedElementRules??[])),l=lA(a),c=l.index,d=n.collaborationModel?.session,u$1=n.author,f=n.scale??96/72,p={resolve:n.tableInteractionLabel??(m=>_y(m))},g$1="the document is open for viewing",b$1="the table of contents is generated and read-only",y=false,h="\0range\0",x=u(a.currentPackage()),w=n.measurer?null:Z(f,{context:ii(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{},serifHangulFace:x}),v$1=n.measurer??w.measurer,k=_if(),E=Bg$1();function I(){return n.measurer?n.producer??"host-measurer":`${n.producer??w?.producer??"fixed-measurer"}@scale:${f}`}let P=I(),C=n.lockedControlNavigation==="atomic",O=e.ownerDocument,S=O.createElement("div"),T=AL(()=>S);S.className="docx-pages",S.style.position="relative",o.listeners(S),S.contentEditable="true",S.spellcheck=false,S.setAttribute("role","textbox"),S.setAttribute("aria-multiline","true"),vb(S,n.translate),S.style.outline="none";let B=di(O,"docx-selection-overlay"),W=di(O,"docx-comment-overlay"),q=di(O,"docx-text-highlight-overlay"),U=null,Z$1=di(O,"docx-remote-selection-overlay"),M=di(O,"docx-bookmark-overlay"),J=di(O,"docx-table-furniture",false),ee=di(O,"docx-table-select-layer",false),fe=null;e.style.position="relative";let se=[J,ee,W,M,q,Z$1,B];e.replaceChildren(S,...se);let $=xD(S,()=>f,()=>{let m=Xe?.getActive()??null,R=Ye$1?.activeNoteScope()??null,L=Ye$1?.activeNotePageIndex()??null,_=m?ET(S,m.pageIndex):R?CT(S,R.id,L):null;return {layout:Pe(),selection:$t.shownSelection(D),...ze.caretPreference(m?.pageIndex??L??void 0),measurer:v$1,...Bt()?{typingStyle:()=>{let G=Cn.formatting();return G.fontSizeHalfPoints?{fontSizePt:G.fontSizeHalfPoints/2,fontFamily:G.fontFamily,bold:G.bold,italic:G.italic,verticalAlign:G.superscript?"superscript":G.subscript?"subscript":"baseline"}:null}}:{},scopedHost:_,...m?{scopedHostKind:"headerFooter"}:R?{scopedHostKind:"note"}:{},...gt?.caretInput(be),suppress:De==="view"}}),H=tf(a.part()),j$2=a.paragraphIds(),N=j$2.find(m=>!H.has(m))??j$2[0]??"",D=r.initialSelection??{anchor:{paragraphId:N,offset:0},head:{paragraphId:N,offset:0}},z=r.initialDrawingSelectionIntent??{kind:"none"};function X(m,R){m.kind===z.kind&&(m.kind!=="pointer"||z.kind==="pointer"&&m.drawingNodeId===z.drawingNodeId)||(z=m,R&&n.onChange?.(xt()));}let F=null,K=null;function V(m){return K=Y(m),n.onChange?.(xt()),false}function Y(m,R=m){return n.onRejection?.(R),m}let le=()=>n.onEdit?.(An),oe=new Op,ae=new Mp(()=>a.currentPackage()),xe="suggesting needs an author before it can propose a change",we=false,at=false,Se$1=null,Ue=new Map;function _e$1(){Se$1=null;for(let m of Ue.values())Se$1=m;}function Je(m,R){if(m.paragraphId===R.paragraphId)return m.offset-R.offset;let L=rt();return L.indexOf(m.paragraphId)-L.indexOf(R.paragraphId)}function et(m){if(!Se$1)return;let{from:R,to:L}=Ff(Pe(),Se$1),_=m.head;Je(_,R)>=0&&Je(_,L)<=0||(Ue.clear(),Se$1=null);}let He$1=null,st=new Df(d??a),an=new Mf(d??a,()=>D,()=>de(a,D.head.paragraphId)??a.part(),()=>a.packageRevision());function $e(m){let R=null;d&&to.expectHistory(true);let L;try{L=an.step(m,()=>{if(d)return d[m]();let G=a.packageRevision();return R=a[m](),a.packageRevision()!==G});}finally{d&&to.expectHistory(false);}if(!L.changed)return;le();let _=m==="undo"?pD(d,Do):null;F8(_??L.selection??R);}function lt(m){ze.noteModelMoved(),Wt();let R=YO(m,Pe(),rt());wt(R.selection),He$1=R.format,$.update(),n.onChange?.(xt());}function Mt(){return Bt()?.properties??null}function Bt(){return pb(He$1,D)}function fi(m){if(!He$1)return;let R=He$1.position;m.anchor.paragraphId===R.paragraphId&&m.anchor.offset===R.offset&&m.head.paragraphId===R.paragraphId&&m.head.offset===R.offset||(He$1=null);}function mr(m,R,L,_,G){let Q=dt([...m],L,_,je(),true,G);return m.length===R.length||!Q.rejected?Q:dt([...R],L,_,je(),true,G)}function eo(m,R,L,_){let G=gt?.replacementFormatOps(m,R,L);if(G?.length)return G;let Q=Bt()??(zt(D.head.paragraphId).length===0?{base:[],properties:ei(de(a,D.head.paragraphId)??a.part(),D.head.paragraphId,D.head.offset,Yt(),vt())}:null);if(!Q||L===0||Q.properties.length===0&&Q.base.length===0)return [];let te=He$1?.position??D.head,pe=_&&te.paragraphId===m&&te.offset>=_.start&&te.offset<=_.end?{paragraphId:m,offset:vm({paragraphId:m,offset:_.start},{paragraphId:m,offset:_.end})}:Zb$2(Pe(),te);return pe.paragraphId!==m||pe.offset!==R?[]:[{op:"setRunProperties",paragraphId:m,start:R,end:R+L,properties:li$1(Q.base,Q.properties,Bs(m,R))}]}let Xe=null,Ye$1=null,gt=null,Pe=()=>gt?.layout(be)??be,ga=()=>gt?.active()?gt.paragraphIds():a.paragraphIdsIn(je()),sn=null,je=()=>Gu(Xe?.getActive()??null,Ye$1?.activeNoteScope()??null),pi=()=>Ye$1?.activeNoteScope()?.id??null,Gn=m=>{let R=E.multi?.spans,L=0,_=0;if(R&&R.length>0)for(let G=0;G<R.length;G+=1){let Q=R[G];if(L=G,_=Q.startIndex,m<Q.startIndex+Q.pageCount)break}return {sectionIndex:L,sectionStart:_}},Ce=(m,R)=>{if(gt?.active()){let te=gt.paragraphIds();return te.includes(m)?m:te[te.indexOf(R)+1]??null}let L=de(a,m)??de(a,R)??a.part();if(eb$1(L,m))return m;let _=fb$2(L,R),G=_?_.children.findIndex(te=>te.id===R):-1,Q=_&&G>=0?_.children[G+1]:void 0;return Q?.kind==="paragraph"?Q.id:null},fn=()=>wM(gt,Xe),rt=()=>is(Pe(),fn(),pi()),to=fD({textOf:m=>zt(m),order:rt,carried:()=>mD(d)}),Ee=()=>globalThis.performance?.now()??Date.now(),Lt=0,ha$1=0,Pn=0,mi=m=>{LO(m)&&n.onTiming?.("input",m.timeStamp);},{styleCascade:pn,numberingIndex:zn,defaultTabStopPt:mn,compatibilityMode:gi}=bL(a),Lo=gD({styleCascade:pn,partOf:m=>de(a,m)??a.part()}),ya=null,ba=n.imageDecodePort??hD(O)??yD(),wn=Cf$1({session:a,decodePort:ba,onResourcesChanged:()=>ya?.()}),no=n.drawingStrings??o$1,va=j(n.translate),Hs=n.tocLabels,_s=()=>D.anchor.paragraphId!==D.head.paragraphId||D.anchor.offset!==D.head.offset?null:{paragraphId:D.head.paragraphId,offset:D.head.offset},Jp=UM(a),Zc=bD({mintValidatedBytes:(m,R)=>wn.mintValidatedBytes(m,R)}),gr=false,Fr=WD(n.revisionDisplayMode,!!n.reviewModel,m=>ve.setRevisionDisplayMode(m)),ro=Fr.view,Yt=Fr.projection,Xc=Fr.changeBars,Zn=r.revisionAuthorVisibility??op(n.hiddenRevisionAuthors),$t=HO({layout:Pe,part:()=>a.partFor(je())??a.part(),view:Kx}),hi=mM(n.revisionMarkup,()=>cL(Fr,Zn,a),()=>ot(),()=>{Qt=Tn(vt()),yt.invalidateAll(a.packageRevision(),"revision-markup"),yt.flush(),Rt(false);}),vt=hi.filter,Bs=kM(a,Yt,vt),Yc=pM(a,Yt,vt),xa=m=>{let R=de(a,m)??a.part();return hM(R,m,Yt(),vt())},Qt,Qc=Rf$1(a),yi=Sf$1(),$s=dL(),Tn=(m,R=gr)=>{let L=vL({session:s.view(a),measurer:v$1,producer:P,cache:k,styleCascade:pn,numberingIndex:zn,defaultTabStopPt:mn,compatibilityMode:gi,displayMode:Yt(),showFieldCodes:R,revisionAuthorFilter:m,inlineDrawingLayoutForPart:_=>wn.contextForPart(_),drawingLayoutTokenForPart:_=>wn.cacheTokenForPart(_),drawingTokenForParagraphForPart:(_,G)=>wn.drawingTokenForParagraph(G,_),linkProjectors:Qc,projectFieldLink:_=>yi.project(_)});return $s.record(L,m),L};Qt=Tn(vt());let Fo={...a,applyTreeOps:(m,R,L,_,G)=>dt(m,R,L,_,true,G?.packageEdits),ensureListDefinition:(m,R)=>Hb$1(d?.identity.actorId,()=>a.ensureListDefinition(m,R)),applyPmDoc:m=>De==="view"?{committed:false,rejected:true,opCount:0,reason:g$1}:d?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:mm()?{committed:false,rejected:true,opCount:0,reason:b$1}:a.applyPmDoc(m)},wa=()=>{},Xn=()=>{},En=oA({now:Ee,view:()=>Ae(S),pageAfterView:()=>{let m=Ta();return m&&m.size>0?Math.max(...m)+1:void 0},current:()=>be,partial:()=>ln!==null,revision:()=>a.packageRevision(),publish:m=>o.wrap(()=>vi(m))(),snapshot:()=>og(E),pendingChanged:m=>e.toggleAttribute("data-docx-layout-pending",m||ln!==null),passTimed:m=>n.onTiming?.("layout",m)}),ln=r.progressiveOpen?kc:null,be=Ft(),Yn=n.revisionStyles,Ws=EA(n.showParagraphMarks??false,ot,()=>Rt(false)),Sa=EC({session:Fo,storyScope:je,orderedRange:()=>fo(),writeRefusal:()=>vr(true),commit:(m,R)=>Be(m,R),goToPosition:(m,R)=>Oe.goToPosition(m,R),setSelection:m=>wt(m),beforeChange:ot,repaint:()=>Rt(false),options:n}),ka=r.reviewAuthorSlots??i(),hr=DL({layout:Pe,items:()=>a.reviewItems(),styles:()=>Yn,slots:ka});function Jc(m){en(),d?.flushPendingJournals();let R={selection:D,format:He$1},L=JSON.stringify(Cn.formatting()),_=XO(D,He$1,m,()=>ei(a.partFor(je())??a.part(),D.head.paragraphId,D.head.offset,Yt(),vt()));_!==void 0&&(He$1=_,L!==JSON.stringify(Cn.formatting())&&st.record(R,{selection:D,format:He$1},Av(ve)),ae.end(),$.update(),n.onChange?.(xt()));}let Cn=OD({runFormatRefusal:()=>Un({type:"toggleMark"},ve)?.reason??null,session:Fo,applyOutsideToc:(m,R)=>{let L=m.filter(_=>!e0(_));if(L.length===0)return R(m);y=true;try{return R(L)}finally{y=false;}},storyScope:je,paragraphOrder:rt,layout:Pe,selection:()=>$t.shownSelection(D),displayMode:()=>Yt(),authorFilter:vt,paragraphMarkVisible:xa,commit:(m,R,L)=>Be(m,R,L),orderedRange:()=>$t.shownRange(fo()),selectionMark:()=>it(),textOf:m=>zt(m),selectedCells:()=>F?.cellIds,defaultParagraphStyleId:()=>pn()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n.defaultFontFamily??null,pendingFormats:()=>Mt(),setPendingFormats:Jc}),bi=AD({session:Fo,storyScope:je,layout:Pe,selection:()=>$t.shownSelection(D),displayMode:()=>Yt(),authorFilter:vt,paragraphMarkVisible:xa,commit:(m,R,L)=>Be(m,R,L),orderedRange:()=>$t.shownRange(fo()),selectionMark:()=>it(),textOf:m=>zt(m),paragraphOrder:rt,selectedCells:()=>F?.cellIds,armPendingFormats:m=>Jc(m),now:Ee,publish:()=>{bi.state().mode!=="off"?S.dataset.formatPainter="":delete S.dataset.formatPainter,n.onChange?.(xt());}}),On=y1({session:Fo,storyScope:je,headerFooterSectionIndex:()=>Xe?.getActive()?.sectionIndex,revisionDisplayMode:Yt,revisionAuthorFilter:vt,paragraphOrder:rt,selectedCells:()=>F?.cellIds,editingMode:()=>De,publishRefusal:V,caretParagraphId:()=>D.anchor.paragraphId===D.head.paragraphId&&D.anchor.offset===D.head.offset?D.head.paragraphId:null,layout:Pe,commit:(m,R,L)=>Be(m,R,{rearmPending:Bt()??void 0,...L?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>bm(),orderedRange:()=>fo(),selectionMark:()=>it(),collapsedAt:m=>Ke(m),deleteSelectionPlan:()=>po(),paragraphTextOf:m=>zt(m),numberingLevelExists:(m,R)=>pd$1(Md(zn(),pn()),m,R)!==null,...r1(()=>Md(zn(),pn())),styleCascade:pn});function oo(m,R,L){return De!=="suggest"?null:vm({paragraphId:m,offset:R},{paragraphId:m,offset:L})}let A=I1({session:Fo,collaborative:!!d,layout:Pe,fieldLinkById:m=>yi.linkById(m),refusesWrite:()=>vr(true)!==null,withMintActor:m=>Hb$1(d?.identity.actorId,m),storyScope:je,replacementLanding:oo,insertionLanding:(m,R)=>Zb$2(Pe(),{paragraphId:m,offset:R}).offset,selection:()=>D,orderedRange:()=>fo(),selectionMark:()=>it(),textOf:m=>zt(m),commit:(m,R)=>Be(m,R)}),ne=AF({session:Fo,storyScope:je,editingMode:()=>De,writeRefusal:m=>vr(true,[m]),trackedOps:dm,selection:()=>D,selectionMark:()=>it(),commit:(m,R)=>Be(m,R)}),ie=m=>{let R=Et(a,m,{kind:"body"});if(R.kind==="body")return Ye$1?.exitNote(),Xe?.exitHeaderFooter(),true;if(R.kind==="headerFooter"){let _=Xe?.activeScope();return _?.kind==="headerFooter"&&_.rId===R.rId?true:(Ye$1?.exitNote(),Xe?.enterHeaderFooter({rId:R.rId})??false)}let L=DT(be,m);return L?Ye$1?.activeNoteScope()?.id===L?true:(Xe?.exitHeaderFooter(),Ye$1?.enterNote(L)??false):false},Oe=E1({pagesLayer:S,get container(){return e},scale:()=>f,layout:Pe,bookmarks:()=>a.bookmarks(),linkById:m=>yi.linkById(m)??A.linkById(m),drawingLinkById:m=>A1(be,m),setSelection:m=>wt(Ke(m)),whenLaidOut:(m,R)=>nd(m,R),beginJump:()=>td(),enterStoryFor:m=>ie(m),isCollapsedSelection:()=>Ht(D,Ke(D.head)),onScrolled:()=>ad(),...n.onHyperlinkPopover?{onPopover:n.onHyperlinkPopover}:{}}),Te=MF({pagesLayer:S,equationById:m=>ne.equationById(m),setSelection:m=>wt(m,false,"none"),...n.onEquationPopover?{onPopover:n.onEquationPopover}:{}});S.addEventListener("contextmenu",Nx),S.addEventListener("click",Hx),S.addEventListener("pointermove",Ox),S.addEventListener("pointerleave",Ax);let Ve=RA(S),Le=null;function ht(m,R,L,_){return wa(),En.finish(),Xf$1(Fe(m,R,L,_))}function*Fe(m,R,L,_){let G=L?L.authorFilter:vt(),Q=!L||L.furnitureSource===Qt;Q&&$s.moved(Qt,G)&&(Qt=Tn(G));let te=L?.layoutSession??E,pe=Q||!L?Qt:L.furnitureSource;return R&&Ld(te,R),!L&&_===void 0&&(ln=null),wn.sync(a),yield*b({view:s.view(a),revision:m,measurer:v$1,cache:k,session:te,producer:P,styleCascade:pn,defaultTabStopPt:mn,numberingIndex:zn,furniture:pe,compatibilityMode:gi,linkProjectors:Qc,projectFieldLink:he=>yi.project(he),inlineDrawingLayout:wn.bodyContext,inlineDrawingLayoutForPart:he=>wn.contextForPart(he),drawingTokenForParagraph:he=>wn.drawingTokenForParagraph(he,a.part().name),drawingTokenForParagraphForPart:(he,Ie)=>wn.drawingTokenForParagraph(Ie,he),drawingLayoutEpoch:wn.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:he=>wn.cacheTokenForPart(he),displayMode:Yt(),showFieldCodes:L&&!L.live?false:gr,fieldResults:o.mode,revisionAuthorFilter:G,bodyBlockLimit:_})}function Ge(){return ht(a.packageRevision(),void 0,{layoutSession:Bg$1(),furnitureSource:Tn(void 0,false)})}function Ft(){let m=Ee(),R=ht(a.packageRevision(),void 0,void 0,ln??void 0);return Lt=Ee()-m,R}let Ne=nt(()=>S),We=null,ct=0,Jt=false,Qn=null,Mn=false;function io(){if(Mn)return;Mn=true;let m=a.packageRevision();Qn=V1({steps:j1(()=>a.part()),shouldRun:()=>De!=="view"&&a.editable&&a.packageRevision()===m,hasPendingInput:gn,schedule:(R,L)=>{let _=Ne.setTimeout(R,L);return ()=>Ne.clearTimeout(_)}});}function gn(m=true){return MM(e,m)}function qs(){if(ct>0){Jt=true,io();return}if(!gn()){Rt(),io();return}We===null&&(We=Ne.setTimeout(o.wrap(()=>{We=null,yt.pending()===null&&(Rt(),io());}),0));}let yr="",br=null,An=false;function en(){if(An||(br!==null&&(Ne.clearTimeout(br),br=null),yr.length===0))return;let m=yr;yr="",An=true;try{Cs(ve,ae.groupAt(D),()=>ve.type(m)),ae.landed(D);}catch(R){throw yr=m+yr,R}finally{An=false;}}function Ks(m){yr+=m,br===null&&(br=Ne.setTimeout(o.wrap(()=>{br=null,en();}),0));}function tn(m,R,L){en();let _=L?.trim()||u$1?.trim();if(!_)return V("tracked changes need a non-empty author");if(m!=="deletion"&&R.length===0)return V(`${m} requires non-empty text`);if(m!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(R))return V(`${m} requires text without a paragraph mark`);let G={author:_,date:j$1()},Q=fo(),te=Q.from.paragraphId===Q.to.paragraphId&&Q.from.offset===Q.to.offset;if(m!=="insertion"&&te&&!(m==="replacement"&&F))return V(`${m} needs a non-collapsed selection`);let pe=m==="insertion"?{ops:[],collapseTo:Zb$2(Pe(),Q.from)}:po(_),he=Mc(pe.ops,G,qx()),Ie=pe.collapseTo;if(m==="insertion"||m==="replacement"){let ge=m==="replacement"?pe.replaceAt??pe.collapseTo:pe.collapseTo;he.push({op:"insertText",paragraphId:ge.paragraphId,offset:ge.offset,text:R,revision:G}),Ie={paragraphId:ge.paragraphId,offset:ge.offset+R.length};}let ke=false;return Be(()=>{let ge=dt(he,it(),uo(Ie));return ke=ge.committed,ge},()=>Ke(Ie)),ke}function nn(m){ki=false,sd.without(m),ki=false;}let Ia=F1({settle:()=>ot(),refuse:m=>V(m),storyParagraphs:()=>rt(),textOf:m=>zt(m),rangePlan:m=>O8(m),insertionPoint:m=>Zb$2(Pe(),m),selection:()=>D,selectionMark:()=>it(),commitWithoutFollow:(m,R,L)=>{let _=false;return nn(()=>Be(()=>{let G=dt(m,R,R,je(),false);return _=G.committed,G},L)),_},flushLayout:()=>Wt(),noteModelMoved:()=>ze.noteModelMoved(),selectionsEqual:Ht}),yt=ha({run:m=>{let R=Ee();wa(),En.abandon();let L=xA(Fe(m.revision,m,void 0,ln??void 0),Ta()),_=En.run(L,m.revision,FO(m));return ln=yg(E,ln),Lt=Ee()-R,_},currentRevision:()=>a.packageRevision(),schedule:m=>{let R=Ne.setTimeout(o.wrap(m),0);return ()=>Ne.clearTimeout(R)},publish:m=>vi(m)});function vi(m){hr.releaseLayout(),be=m;let R=to.map(D);R!==D&&(D=R,ze.noteModelMoved(),Ii()),qs(),Ra.request();}let Ra=sA({now:Ee,schedule:(m,R)=>Ne.clearTimeout.bind(null,Ne.setTimeout(o.wrap(m),R)),revision:()=>a.packageRevision(),live:()=>E,current:()=>be,busy:()=>En.pending()||ln!==null,pass:(m,R)=>Fe(m,void 0,{authorFilter:vt(),layoutSession:R,furnitureSource:Qt,live:true}),createSession:Bg$1,adopt:(m,R)=>{E=m,vi(R);}}),Pa=false;ya=()=>{ln===null&&(yt.invalidateAll(a.packageRevision(),"drawing-resources"),!Pa&&(Pa=true,Ne.setTimeout(o.wrap(()=>{Pa=false,Wt();}),0)));};let xi=a.subscribe(m=>{l.retain(m),m.origin!==g.mutationRemote&&m.origin!==g.mutationUndo&&m.origin!==g.mutationRedo&&st.noteEdit(),He$1=null,An||ae.noteForeignChange(m),m.origin===g.mutationRemote?(g8(m),to.note(D,m.dirty,be.revision===m.fromRevision)):to.noteLocal(),yt.notify(m);}),Do=d?a.collaborationPort(d.documentId):null,It=()=>{},Dr=()=>{},Nr=false,ao=null,so=null,wi=d?d.subscribeRemoteSelections(()=>{Nr&&pd();}):()=>{};function Ta(){let m=EL(e,be,D,f),R=Xe?.getActive()?.pageIndex??ze.selectionPageIndex();return R===void 0||m===void 0||m.has(R)?m:new Set([...m,R])}function Us(){Jt&&Rt();}function Wt(){return yt.pending()?yt.flush():false}let a8=8;function s8(m){!m&&yt.pending()!==null&&Lt>a8&&gn(false)||(!Wt()||m&&Jt)&&Rt();}function ot(){en(),Wt();}function ed(){en();let m=Wt();return We!==null||Jt?(Rt(),io(),true):m}let js=null;function Ex(m){return XT(m,a.part())}function l8(){for(let m of S.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(m.getAttribute("data-docx-content-control")===js){m.dataset.hover="",m.dataset.boundaryVisible="";continue}delete m.dataset.hover,we||delete m.dataset.boundaryVisible;}}function Cx(m){js!==m&&(js=m,l8());}function em(m){return YT(a.part(),Mx(m),m.target)}function Ox(m){let R=em(m);Cx(R?Ex(R):null);}function Mx(m){let R=m.target,L=R?.isConnected?R.closest("[data-paragraph-id]"):void 0;if(L)return L.dataset.paragraphId;let _=S.ownerDocument;return typeof _.elementFromPoint!="function"?void 0:_.elementFromPoint(m.clientX,m.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function Ax(){Cx(null);}function c8(){let m=lo(),R=Eb$1(a.part()),L=Bh$1(a.part()),_=L.map(ge=>{let St=VM(ge,be,a.part(),v$1);return St?{...St,empty:R.has(ge.beginParagraphId)}:null}).filter(ge=>ge!==null),G=new Set(_.map(ge=>ge.boundary.id)),Q=new Set(_.filter(ge=>ge.empty).map(ge=>ge.boundary.id));for(let ge of L)ge.contentControlId&&Ex(ge)!==ge.contentControlId&&Q.add(ge.contentControlId);let te=m&&!G.has(m.id)?new Set([m.id]):void 0,pe=js?new Set([js]):void 0,he=new Set(Se(be).filter(ge=>ge.controlType==="checkbox"&&nm(ge.id)).map(ge=>ge.id)),Ie=_.filter(ge=>ge.additional&&!ge.empty).map(ge=>ge.boundary),ke=$x()!==null;if(!(!we&&!te&&!pe&&!ke&&he.size===0&&Ie.length===0&&G.size===0))return {...ke?{readOnly:true}:{},...we?{showAll:true}:{},...te?{activeIds:te}:{},...pe?{hoverIds:pe}:{},...he.size>0?{checkedIds:he}:{},...Ie.length>0?{additionalBoundaries:Ie}:{},...G.size>0?{tocControlIds:G}:{},...Q.size>0?{suppressedIds:Q}:{}}}let Vs=null;function lo(){let m=je();if(m.kind!=="body")return u8(m);if(Vs&&Vs.layout===be&&Vs.selection===D)return Vs.result;let R=d8();return Vs={layout:be,selection:D,result:R},R}function d8(){let m=PA(be,D,v$1);return m&&de(a,m.id)?.name===a.part().name?m:null}function u8(m){let R=a.partFor(m);return R?Vf$1(R,D.head.paragraphId):null}function Hr(m){let R=de(a,m),L=eb$1(R??a.part(),m);return !L||!ld(L)?null:L}function Lx(m){let R=Hr(m);if(!R)return null;for(let L of R.children)if(L.kind!=="textValue"&&(L.kind==="contentControlProperties"||L.localName==="sdtPr"))for(let _ of L.children){if(_.kind==="textValue"||_.localName!=="tabIndex")continue;let G=_.attributes.find(te=>te.localName==="val")?.value;if(G===void 0)return null;let Q=Number(G);return Number.isFinite(Q)?Q:null}return null}function f8(){let m=je(),R=m.kind==="body"?null:a.partFor(m),L=m.kind==="notesPart"?new Set(rt()):void 0;return (R?[...Uf$1(R,L)]:[...Se(be)]).filter(G=>Rv(G)===null).sort((G,Q)=>{let te=Lx(G.id),pe=Lx(Q.id);return te!==null&&pe!==null&&te!==pe?te-pe:te!==null&&pe===null?-1:te===null&&pe!==null?1:0})}let{begin:td,later:nd}=nA(()=>ve,{flushLayout:()=>{Wt();},paragraphIds:()=>a.paragraphIds(),scroller:()=>Nt(e)});function tm(m){Xe?.getActive()||Ye$1?.activeNoteScope()||Et(a,m.paragraphId,{kind:"body"}).kind==="body"&&ve.revealPosition(m);}function p8(m){let R=Hr(m);if(!R)return false;let L=D1(R,{contentChildrenOf:N1,searchRoots:()=>(a.partFor(Et(a,m,je()))??a.part()).root.children});if(!L)return false;let _=D;return wt(L,false,"none"),(D!==_||Ht(D,L))&&tm(D.anchor),true}let Fx=m=>$M(Hr(m),()=>a.currentPackage());function nm(m){let R=Hr(m);if(!R)return false;for(let L of R.children)if(L.kind!=="textValue"&&!(L.kind!=="contentControlProperties"&&L.localName!=="sdtPr")){for(let _ of L.children)if(_.kind==="contentControlCheckbox")for(let G of _.children){if(G.kind!=="contentControlChecked")continue;let Q=G.attributes.find(te=>te.localName==="val")?.value;return !(Q==="0"||Q==="false"||Q==="off")}}return false}let Dx=m=>WM(Hr(m));function rd(m,R){for(let L of S.querySelectorAll("[data-docx-content-control]"))L.getAttribute("data-docx-content-control")===m&&(R?L.dataset.open="":delete L.dataset.open);}let Si=IA({get document(){return S.ownerDocument},layer:S,find:Hr,layout:Pe,selectDrawing:(m,R)=>ve.selectDrawing(m,R),allowed:m=>!co.disabledReason(m,"edit"),translate:m=>Zs?.(m)??m,replaceImage:(m,R,L,_)=>ve.replaceImage(m,R,L,{expectedPackageRevision:a.packageRevision(),commitGuard:_}),setOpen:rd,reject:V}),rm=BM({find:Hr,allowed:m=>!co.disabledReason(m,"edit"),apply:(m,R)=>co.setValue(m,R),items:Fx,date:Dx,checked:nm,picture:Si.drawingOf,replaceImage:Si.replace,locale:()=>ld$1.get(),layer:S,setOpen:rd,request:n.onRequestContentControlWidget}),od=null,om;function im(m){od===m&&(od=null,om?.(),om=void 0);let R=m.dataset.docxCcId,L=m.contains(S.ownerDocument.activeElement);m.remove(),R&&rd(R,false),L&&S.focus({preventScroll:true});}function id(){rm.cancel();let m=od;return m&&im(m),m}function Nx(m){let R=em(m),L=R&&(ym(R.id)||!n0.removeTocRefusal(R.id));am(L?R.id:null);}let Ea=null;function am(m){Ea!==m&&(Ea=m,n.onChange?.(xt()));}function Hx(m){if(m.button===0&&am(null),m.button!==0||m.target?.closest("a.docx-hyperlink")||!Ht(D,Ke(D.head)))return;let R=Mx(m);if(!R)return;let L=Bh$1(a.part()).find(Q=>Q.resultParagraphIds.includes(R));if(!L||em(m)?.id!==L.id)return;let G=Pi(a.part(),L,a.documentOutline(),gm(L))[L.resultParagraphIds.indexOf(R)];G&&(m.preventDefault(),Oe.goToPosition({paragraphId:G,offset:0}));}let _x={get document(){return S.ownerDocument},locale:()=>ld$1.get(),translate:m=>Zs?.(m)??m,setValue:(m,R)=>co.setValue(m,R),close:m=>im(m)};function m8(m,R){let L=co.disabledReason(m,"edit");if(L){K=Y(L),n.onChange?.(xt());return}if(Si.cancel(),id()?.dataset.docxCcId===m||(R==="picture"&&Si.select(m),rm.open(m,R)))return;if(R==="picture")return Si.pick(m);if(R==="checkbox"){co.setValue(m,nm(m)?"false":"true");return}let _=Se(be).find(Q=>Q.id===m)?.alias,G;if(R==="dropdown"||R==="comboBox"||R==="buildingBlockGallery"){let Q=Fx(m);if(Q.length===0&&R==="dropdown")return;G=ZA(_x,m,R,Q,_,kb(Hr(m),Q));}else if(R==="date")G=XA(_x,m,Dx(m),_);else return;od=G,zA(G,S,NM(be,f,m,S,Ct?.pageOffsetX)),rd(m,true),om=qf(G,()=>im(G)),R==="date"?tp(G):(G.querySelector("input")??G.querySelector('[role=option][tabindex="0"]')??G.querySelector("button,[data-docx-part=empty]"))?.focus({preventScroll:true});}let co={setShowAll(m){we!==m&&(we=m,Rt());},setFormFill(m){at!==m&&(at=m,n.onChange?.(xt()));},showAll:()=>we,formFill:()=>at,atCaret:()=>lo(),navigate(m){let R=f8();if(R.length===0)return false;let L=lo(),_=L?R.findIndex(Q=>Q.id===L.id):-1;m==="next"?_=_<0?0:(_+1)%R.length:_=_<0?R.length-1:(_-1+R.length)%R.length;let G=R[_];return p8(G.id)},setValue(m,R){let L=co.disabledReason(m,"edit");if(L)return V(L);let _=KM(Hr(m),()=>a.currentPackage(),m,R);if(!_)return V("unknown-building-block");let G=false;return Be(()=>{let Q=dt(_,it(),void 0,Et(a,m,je()),false);return G=Q.committed,Q}),G},remove(m){let R=m??lo()?.id;if(!R)return V("notFound");let L=co.disabledReason(R,"remove");if(L)return V(L);let _=false;return Be(()=>{let G=dt([{op:"removeContentControl",controlId:R}],it(),void 0,Et(a,R,je()),false);return _=G.committed,G}),_},disabledReason(m,R){let L=$x();if(L!==null)return L;let _=Se(be).find(Q=>Q.id===m);if(_)return R==="remove"?u1(_):Rv(_);let G=Hr(m);return G?Rp(G,R):"notFound"}},sm=()=>vD(S,lm&&De!=="view");function xt(){return {revision:a.packageRevision(),pageCount:be.pages.length,selection:D,cellSelection:F,canUndo:st.canUndo||(d?.canUndo()??a.canUndo()),canRedo:st.canRedo||(d?.canRedo()??a.canRedo()),collaborationStatus:d?.status()??"inactive",lastRejection:K,pendingFormat:Mt(),contentControls:{showAll:we,formFill:at,activeControlId:lo()?.id??null},contextTocId:Ea,formatPainter:bi.state(),perf:{layoutMs:Lt,paintMs:ha$1,selectionMs:Pn,placed:E.stats.placed,total:E.stats.total,reusedPages:E.stats.reusedPages,fullPasses:E.stats.fullPasses,staleDiscards:yt.staleDiscards,cancelledRuns:yt.cancelledRuns}}}let hn,Ct,ki=false,Gs=null,Ca=FL({pagesLayer:S,listeners:T,viewport:()=>Gs,container:()=>e,setContainer:m=>e=m,destroyed:()=>mo,scale:()=>f,settle:()=>{ed(),wa(),En.finish(),id(),Si.cancel(),gd?.cancelGesture(),La.cancelDrag();},repaint:()=>Rt(false),onHostMoved:m=>n.onHostMoved?.(m)});function Rt(m=true){if(We!==null&&(Ne.clearTimeout(We),We=null,m=true),Ca.heal(),Ca.parked()){Jt=false,fd(),m&&n.onChange?.(xt());return}Jt=false;let R=ze.adoptBeforePaint(),L=Ee();hn=Ta(),Xe?.reconcileOccurrence();let _=Xe?.getActive()??null,G=c8(),Q=Eb$1(a.part());v(S,be,{scale:f,readOnlyParagraphIds:tf(a.part()),...Q.size>0?{emptyTocPlaceholderIds:Q}:{},...n.fontAlias?{fontAlias:n.fontAlias}:{},serifHangulFace:x,...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},materialize:hn,ariaHidden:false,drawingStrings:no,...AO(s,a),breakMarkStrings:va,...n.fieldShading?{fieldShading:n.fieldShading}:{},...Yn!==void 0?{revisionStyles:Yn}:{},revisionMarkup:hi.current(),facingPages:gM(Bf$1(a.currentPackage())),shadeFormFields:Jp(),showParagraphMarks:Ws.get(),changeBars:Xc(),changeBarsToggle:!!n.reviewModel,...Zc?{imageUrlPort:Zc}:{},..._?{activeHeaderFooterRId:_.scope.rId,activeHeaderFooterPageIndex:_.pageIndex}:{},...G?{contentControlChrome:G}:{}},hr.get().value),gt?.syncDom(),Wb(S,_s(),{domReplaced:true}),AT(e,S,_!=null),Rh(e,De),Ct=sp(be,hn),OL(S,be,Ct,f),S.style.width=`${Ct.width*f}px`,S.style.height=`${Ct.height*f}px`,e.style.width=`${Ct.width*f}px`,e.style.height=`${Ct.height*f}px`;let{width:te,height:pe}=Ct;Z1(se,`${te*f}px`,`${pe*f}px`),La.update(),ha$1=Ee()-L,n.onTiming?.("paint",ha$1),el(),pd(),Aa(true),Sa.paint(Jx(M)),fd(),Gs?.watchScrollerSize(),ze.mirrorToDom(),Bx(ki),ki=false,(m||R)&&n.onChange?.(xt());}function ad(){ot();let m=Ta(),R=sp(be,m);Ct&&Ub(m,hn)&&CL(R,Ct)||Rt(false);}let sd=L1({storyScopeOpen:()=>!!(Xe?.getActive()||Ye$1?.activeNoteScope()),selection:()=>$t.shownSelection(D),layout:Pe,measurer:()=>v$1,preferredPageIndex:()=>ze.selectionPageIndex(),preferredLineId:()=>ze.selectionLineId(),pagesLayer:S,get container(){return e},scroller:()=>Nt(e),scale:()=>f,scheduleRematerialize:()=>Gs?.schedule()});function Bx(m=false,R="caret"){sd.follow(m,R);}let De=n.editingMode??"edit",lm=true,zs=Object.freeze({kind:"body"}),ld$1=KA(n.locale,en),Zs=n.translate,Dt=null,cd=null,cm=null;function dt(m,R,L,_=je(),G=true,Q){en();let te=vr(m.some(Wx)||!!Q?.length,m,G);if(te!==null)return {committed:false,rejected:true,opCount:0,reason:te};let pe=dm(G&&Dt?Dt.annotate(m):m),he=Oa(pe,R,L,_,Q);return G&&Dt?.afterApply(he.committed),he.committed&&pe.some(Oc)&&r.onTrackedChange?.(),he}let{apply:Oa,noteRemoteChange:g8}=T1({session:a,collaboration:d,historyGroup:()=>oe.value,defaultScope:()=>je(),canRepair:()=>!mo&&De!=="view"&&a.editable,later:m=>Ne.setTimeout(o.wrap(m),0)});function vr(m,R=[],L=true){if(sr(e))return gs(e);let _=W1(R);return De==="view"&&!_?g$1:gr&&m&&L&&!_&&jM(G=>de(a,G),D)?ia:m&&!_&&(L&&!y&&mm()||R.some(G=>e0(G)))?b$1:De==="suggest"&&!u$1?.trim()&&m?xe:De==="suggest"?kC(a,u$1,R):null}let $x=JE(()=>vr(true,[],false),()=>a.editable);function Wx(m){return m.op!=="acceptRevision"&&m.op!=="rejectRevision"&&m.op!=="acceptAllRevisions"&&m.op!=="rejectAllRevisions"&&m.op!=="setRevisionAttribution"}let qx=()=>hi.current().trackFormatting&&!a.trackingSettings().doNotTrackFormatting;function dd(){let m=u$1?.trim();return De==="suggest"&&m?m:void 0}function dm(m,R=j$1()){let L=dd();return L===void 0?[...m]:Mc(m,{author:L,date:R},qx())}function Kx(){return {displayMode:Yt(),authorFilter:vt()}}function Ux(m){let R=$t.removedCaretEdit(D.head,m);return R===null?false:(Be(()=>dt(R.ops,it(),uo(R.caret)),()=>Ke(R.caret)),true)}function um(m){let R=T8(m,L=>$t.shown(L));if(R?.kind==="select")wt(R.selection);else if(R){let L=Bt()??void 0;Be(()=>dt(R.ops,it(),uo(R.collapseTo)),()=>Ke(R.collapseTo),{rearmPending:L});}return R!==null}function uo(m){return {paragraphId:m.paragraphId,start:m.offset,end:m.offset}}function Be(...m){if(sr(e))return Y(gs(e));let R=NA(e);try{return h8(...m)}finally{R();}}function h8(m,R,L={}){en(),An||ae.end();let _=an.begin();L?.keepCellSelection||(F=null),He$1=null,ze.noteModelMoved(),ct+=1;let G=null;try{let Q=oe.around(ve,m,pe=>typeof pe=="boolean"?pe:pe.committed,!L?.automation),te=typeof Q=="boolean"||!Q.rejected?null:Q;if(te){let pe=String(te.reason??Sc);G=K=Y(YE(pe,a.settingsRoot()),pe);}else {K=null,(typeof Q=="boolean"?Q:Q.committed)&&le();let pe=R?.();pe&&(Js(),D=pe,X({kind:"none"},!1),Le=null,ki=!0);let he=L?.rearmPending;if(he&&he.properties.length>0){let{anchor:Ie,head:ke}=D;Ie.paragraphId===ke.paragraphId&&Ie.offset===ke.offset&&(He$1={properties:he.properties,base:he.base,position:ke});}}_(),Ii();}catch(Q){if((ct-=1)===0&&Jt)try{Rt();}catch{}throw Q}return ct-=1,s8(G!==null),G}function y8(){if(!hn)return true;for(let m of [D.anchor,D.head]){let R=Re(Pe(),m);if(R&&!hn.has(R.pageIndex))return false}return true}function Ii(){let m=d;if(!m)return;let R=Do?_L(F?.text??D,_=>{let G=de(a,_)??a.part();return BL(G,_)},F?"cells":void 0):null,L=R?`${R.anchor.paragraphId}:${R.anchor.offset}|${R.head.paragraphId}:${R.head.offset}|${R.kind??""}`:"";L!==so&&(so=L,m.setLocalSelection(R));}function wt(m,R=false,L="caret",_){let G=!Ht(m,D);gt?.active()&&(!gt.contains(m.anchor.paragraphId)||!gt.contains(m.head.paragraphId))&>.exit(false),G&&yr.length>0&&en();let Q=Dt?.beforeSelect(m);if(Q===null)return;G&&!An&&(ae.end(),st.endGroup()),m=Q??m,fi(m),et(m);let te=lo()?.id??null,pe=ir(a.part(),D.head)?.id;Js(),D=m,F=null,R||(Le=null),y8()||(ze.noteModelMoved(),L==="none"?sd.without(()=>Rt(false)):Rt(false)),ze.noteSelectionSettled(),ze.notePointerCaret(_),ze.mirrorToDom(true),Bx(true,L),el(),Ri.clear(),Aa();let he=lo()?.id??null,Ie=ir(a.part(),D.head)?.id;(te!==he||pe!==Ie)&&Rt(false),Ii(),n.onChange?.(xt());}let ze=qD({session:a,storyScope:je,pagesLayer:S,selection:()=>D,setSelection:m=>wt(m),adoptSelection:m=>{let R=Dt?.beforeSelect(m);R!==null&&(m=R??m,fi(m),et(m),Js(),D=m,Le=null,ki=true,Ii());},commit:m=>Be(m),applyOps:(m,R,L)=>dt(m,R,void 0,L),hasPendingInput:()=>yr.length>0,replacementOffset:(m,R,L)=>vm({paragraphId:m,offset:R},{paragraphId:m,offset:L}),render:()=>Rt(),flushLayout:()=>Wt(),flushToPaint:()=>ed(),updateCaret:()=>{$.update(),Wb(S,_s());},textOf:m=>zt(m),pendingFormatOps:(m,R,L,_)=>eo(m,R,L,_),selectionMark:()=>it(),now:Ee,recordSelectionMs:m=>{Pn=m;},isGesturing:()=>z.kind==="pointer"||(gd?.dragging()??false),domSelection:()=>F?Ke(F.text.anchor):D,holdsCellSelection:()=>F!==null,replaceSelectionWith:m=>ve.type(m),discardPaint:()=>t(S)});Xe=$1({session:a,layout:()=>be,sectionAtPage:Gn,revisionDisplayMode:Yt,revisionAuthorFilter:vt,selection:()=>D,setScopeSelection:m=>{en(),Js(),fi(m),Ri.clear(),D=m,F=null,Le=null,Ii();},noteModelMoved:()=>ze.noteModelMoved(),render:()=>Rt(),mirrorToDom:()=>ze.mirrorToDom(),notify:()=>n.onChange?.(xt()),materializedPages:()=>hn,entryRefused:()=>De==="view",leaveOtherStories:()=>{Ye$1?.exitNote(),gt?.exit();}}),Ye$1=UD({session:a,exitHeaderFooter:()=>{Xe?.exitHeaderFooter(),gt?.exit();},applyOps:dt,commit:Be,selection:()=>D,selectionMark:()=>it(),orderedStart:()=>bm(),deleteSelectionPlan:()=>po(),undo:()=>ve.undo(),activeScope:()=>{let m=gt?.active();if(m)return m;let R=Ye$1?.activeNoteScope();return R||(Xe?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:m=>Xe.setActiveScope(m),setSelection:m=>wt(m),noteModelMoved:()=>ze.noteModelMoved(),render:()=>{Wt()||Rt();},revealNote:m=>{Wt();for(let R of be.pages){let L=[...R.footnotes?.notes??[],...R.endnotes?.notes??[]].find(_=>_.scopeId===m);if(L)return nl(L.box.y,L.box.height,{block:"nearest",offsetPx:48}),R.index}return null},notify:()=>n.onChange?.(xt()),lastRejection:()=>K,setLastRejection:m=>{K=m===null?null:Y(m);}});function ud(m){m&&en(),F=m,m&&(fi(m.text),Js(),D=m.text),Le=null,ze.noteSelectionSettled(),ze.mirrorToDom(),el(),Ri.clear(),Aa(),Ii(),n.onChange?.(xt());}let No=null;function b8(){let R=Re(Pe(),D.head)?.pageIndex??0,L=new Set;for(let _=R-1;_<=R+1;_+=1)_>=0&&_<be.pages.length&&L.add(_);return L}function v8(){let m=a.revision(),R=hn??b8();if(No?.layout===be&&No.revision===m&&Ub(No.pages,R))return No.rects;let L=R?_e(be,R):()=>true,_=[];for(let te of Ma()){if(te.kind==="comment"){if(te.range===null||!L(te.range.start.paragraphId,te.range.end.paragraphId))continue;_.push({key:ml(te),from:{paragraphId:te.range.start.paragraphId,offset:te.range.start.offset},to:{paragraphId:te.range.end.paragraphId,offset:te.range.end.offset}});continue}let pe=ml(te),he=te.kind==="revision"?te.ranges:te.range?[te.range]:[];for(let[Ie,ke]of he.entries())L(ke.start.paragraphId,ke.end.paragraphId)&&_.push({key:he.length===1?pe:`${pe}${h}${Ie}`,from:{paragraphId:ke.start.paragraphId,offset:ke.start.offset},to:{paragraphId:ke.end.paragraphId,offset:ke.end.offset}});}let G=sL(be,_,R,v$1),Q=[];for(let[te,pe]of G)for(let he of pe)Q.push({...he,key:te});return No={layout:be,revision:m,pages:R,rects:Q},Q}let Ri=new Set,Xs=null,Ys,Qs=null,fm=false,jx=false;function Js(){fm||(Qs=null);}function Vx(){let m=Qs;if(!m||!D)return null;let R=(_,G)=>_.paragraphId===G.paragraphId&&_.offset===G.offset;if(!R(D.anchor,m.anchor)||!R(D.head,m.head))return null;let L=Ma().find(_=>ml(_)===m.key);return !L||L.kind==="custom"&&!L.carded||L.kind==="revision"&&Xs!==null&&Xs.has(L.revisionKind)&&(L.revisionKind!=="format"||Ys===void 0||Ys.has(L.formattingKind??""))&&!jx?null:L}function pm(){let m=Vx();if(m)return Gx(m);if(!D)return null;let L=vl(Ma(),D.anchor,D.head,c()).filter(_=>!(_.kind==="comment"&&_.resolved)&&!Ri.has(ml(_))&&!(_.kind==="custom"&&!_.carded)&&!(_.kind==="revision"&&Xs!==null&&Xs.has(_.revisionKind)&&(_.revisionKind!=="format"||Ys===void 0||Ys.has(_.formattingKind??""))))[0];return L?Gx(L):null}function Gx(m){if(m.kind!=="comment")return m;let R=xl(Ma(),m);return Ri.has(ml(R))?null:R}function Ma(){return Zn.filterItems(a.reviewItems())}let zx=NL({roster:hr.get,styles:()=>Yn,slots:ka}),Zx=zx.forAuthor,x8=zx.declaredFor;function w8(m,R,L){let _=m.split(h),G=_[0],Q=R.has(G);if(m.startsWith("comment-")){let ke=L.get(G),ge=ke?.kind==="comment"&&ke.resolved;return ge&&!Q?null:Q?`docx-comment-band docx-comment-band--active${ge?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(m.startsWith("custom-"))return Q?"docx-comment-band docx-comment-band--active":null;let te=L.get(G);if(!te||te.kind!=="revision")return null;let pe=_.length>1?Number(_[1]):0;return `docx-revision-band docx-revision-band--${(ke=>ke==="delete"||ke==="moveFrom"?"delete":ke==="insert"||ke==="moveTo"?"insert":ke==="replace"&&te.replacedRangeCount!==void 0?pe<te.replacedRangeCount?"delete":"insert":"other")(te.revisionKind)}${Q?" docx-revision-band--active":""}`}let Xx=null,Yx,Qx=null;function Aa(m=false){let R=pm(),L=R&&ml(R),_=Vf(Ma,L,n.pairsReplacements?.()),G=[..._].join(`
|
|
30
|
+
`),Q=hr.get();if(!m&&Xx===be&&Yx===G&&Qx===Q.resolved)return;let te=yA(Ma()),pe=[];for(let he of v8()){let Ie=w8(he.key,_,te);if(!Ie)continue;let ke=he.key.split(h)[0],ge=te.get(ke),St=ge?jb(ge):null,_r=St===null||St===""?void 0:Q.resolved.get(St),Zt=ge?.kind==="revision"&&_.has(ke)?_r?.style?.activeBackground:void 0;pe.push({...he,className:Ie,..._r?{reviewAuthor:_r}:{},...Zt!==void 0?{activeBackground:Zt}:{}});}w$1(W,be,pe,{scale:f,...Ct?{pageOffsetX:Ct.pageOffsetX}:{}}),Xx=be,Yx=G,Qx=Q.resolved;}function el(){Dt?.update(),fe?.update();let m=F?oa$1(be,F.cellIds):Se$1?Ye(Pe(),Se$1,rt(),v$1):ZO(Pe(),D,rt,v$1);w$1(B,be,m,{scale:f,pageOffsetX:Ct?.pageOffsetX,...F?{}:{className:Se$1?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function Jx(m){return {layer:m,layout:be,revision:a.packageRevision(),scale:f,measurer:v$1,...hn?{pages:hn}:{},...Ct?{pageOffsetX:Ct.pageOffsetX}:{}}}function fd(){U?.(Jx(q));}function pd(){if(!Nr){Z$1.replaceChildren();return}let m=d;if(!m){Z$1.replaceChildren();return}$L(Z$1,be,m.remoteSelections(),{scale:f,pageOffsetX:Ct?.pageOffsetX,...hn?{pages:hn}:{},colorForAuthor:Zx,declaredColorFor:x8,labelHost:ao,measurer:v$1});}function md(m){let R=Bh$1(a.part());if(m)return R.find(G=>G.id===m)??null;let L=Ea?R.find(G=>G.id===Ea):void 0;if(L)return L;let _=D.head.paragraphId;return R.find(G=>G.beginParagraphId===_||G.endParagraphId===_||G.resultParagraphIds.includes(_))??(R.length===1?R[0]:null)}function mm(){return GT(a.part(),D)}function e0(m){return zT(a.part(),m)}function t0(){return new Set(Bh$1(a.part()).flatMap(m=>[m.beginParagraphId,...m.resultParagraphIds,m.endParagraphId]))}function gm(m){return new Set([m.beginParagraphId,m.endParagraphId,...m.resultParagraphIds])}function S8(m){let R=0;for(let L of be.pages)for(let _ of Ja(L))m.has(_.paragraphId)&&(R+=_.lines.length);return R}function hm(m,R){let L=new Set(R),_=new Map;for(let G of m.pages)for(let Q of Ja(G)){if(!L.has(Q.paragraphId)||_.has(Q.paragraphId))continue;let te=G.pageFieldSource;_.set(Q.paragraphId,hd(te?.pageNumber??G.index+1,te?.format));}return _}let{canRefreshToc:ym,pointAtToc:k8,removal:n0}=zM({session:a,editingMode:()=>De,target:md,writeRefusal:m=>vr(true,m,false),apply:(m,R)=>Oa(m,R,void 0,zs),removed:()=>am(null),select:m=>wt(Ke(m)),pointedTocId:()=>Ea,refuse:(m,R)=>{K=Y(m,R);}});function r0(m,R){if(!Number.isInteger(m)||!Number.isInteger(R)||m<1||R<1)return null;let L=On.sectionPropertiesAt(D.head.paragraphId),_=L.pageSize.widthTwips-L.margins.leftTwips-L.margins.rightTwips-L.margins.gutterTwips,G=Math.max(300,Math.floor(_/R));return {op:"insertTable",beforeParagraphId:D.head.paragraphId,rows:m,cols:R,columnWidthTwips:G}}function o0(m,R){if(gt?.active()||De==="view"||!a.editable)return false;let L=r0(m,R),_=a.partFor(je())??a.part();return L!==null&&xn$1(_,L)===null}function I8(m,R){if(!o0(m,R))return false;let L=r0(m,R);if(!L)return false;let _=null,G=a.subscribe(te=>{te.caret&&(_=te.caret);}),Q=false;try{Be(()=>{let te=dt([L],it());return te.committed||(K=Y(te.reason??"the table could not be inserted here",te.reason??"table-insert-refused")),Q=te.committed,te},()=>{let te=_;return te?Ke({paragraphId:te.paragraphId,offset:te.start}):null});}finally{G();}return Q}let i0='TOC \\o "1-3" \\h';function a0(){let m=xh$1(i0);if(!m)return null;let R=a.documentOutline(),L=Ni(a.part(),R,m,hm(ve.layout(),R.map(_=>_.blockId)),t0(),d?.identity.actorId);return {op:"insertToc",beforeParagraphId:D.head.paragraphId,instruction:i0,alias:Hs?.title??"TOC",entries:L.entries,bookmarksToCreate:L.bookmarksToCreate}}function s0(){if(De==="view"||!a.editable||mm())return false;let m=a0();return m!==null&&xn$1(a.part(),m)===null}function R8(){if(!s0())return false;let m=a0();if(!m)return false;let R=new Set(Bh$1(a.part()).map(G=>G.id)),L=Oa([m],it(),void 0,zs);if(!L.committed)return K=Y(L.reason??"the table of contents could not be inserted",L.reason??"table-of-contents-refused"),false;let _=Bh$1(a.part()).find(G=>!R.has(G.id));return _?l0(_.id,"pageNumbers"):true}function l0(m,R="entire"){let L=md(m);if(!L||!ym(L.id))return false;ri(ve);let _=ve.layout(),G=a.documentOutline(),Q=Eh$1(a.part(),G,L.instruction);if(!Q)return false;let te=Q.map(Ie=>Ie.blockId),pe=k8(L);if(R==="entire"){let Ie=Ni(a.part(),G,L.instruction,hm(_,te),gm(L),d?.identity.actorId),ke=Oa([{op:"replaceTocResult",tocId:L.id,entries:Ie.entries,bookmarksToCreate:Ie.bookmarksToCreate}],pe,void 0,zs);if(!ke.committed)return K=Y(ke.reason??"the table of contents could not be refreshed",ke.reason??"table-of-contents-refused"),false;if(_=ve.layout(),L=md(L.id),!L)return true}let he="";for(let Ie=0;Ie<3;Ie+=1){let ke=hm(_,te),ge=Pi(a.part(),L,G,gm(L)),St=L.resultParagraphIds.flatMap((Jn,xm)=>{let rl=ge[xm],er=rl?ke.get(rl):void 0;return er===void 0?[]:[{paragraphId:Jn,pageNumberText:er}]});if(St.length===0)break;let _r=St.map(Jn=>`${Jn.paragraphId}\0${Jn.pageNumberText}`).join("");if(_r===he)break;he=_r;let Zt=Oa([{op:"rewriteTocPageNumbers",tocId:L.id,updates:St}],pe,void 0,zs);if(!Zt.committed){if(Zt.rejected)return K=Y(Zt.reason??"the table of contents page numbers were refused",Zt.reason??"table-of-contents-refused"),false;break}_=ve.layout(),L=md(L.id)??L;}return true}function P8(){return ri(ve),lL({session:a,editingMode:De,collaborationActive:d!==void 0,reviewerFilterActive:Zn.filterForSession(a)!==void 0,layout:ve.layout(),canonicalUnfilteredLayout:Ge,styleCascade:pn(),numberingIndex:zn(),displayMode:Yt()})}let{selectionMark:it,orderedRange:fo,orderedStart:bm,textOf:zt,atomicControlDeletion:T8,splitEndsTheParagraph:E8,deleteSelectionPlan:po,deleteSelectionOps:C8,deleteRangePlan:O8,replacementOffset:vm}=cD({session:a,layout:Pe,selection:()=>D,cellSelection:()=>F,editingMode:()=>De,author:()=>u$1,trackedDate:j$1,storyScope:je,paragraphOrder:rt,flushPendingInputAndLayout:ot,trackedAuthorOrNone:dd,atParagraphEnd:(m,R)=>Lo.atParagraphEnd(m,R),revisionView:Kx}),{insertPlainText:c0,copyFlavoursNow:M8,pasteRichNow:A8,armForcePlainPaste:L8}=lD({session:a,textFormFieldId:()=>Dt?.fieldId()??null,insertOwner:()=>ec(lo()),richPasteAllowed:()=>!gt?.active(),paragraphIds:ga,layout:Pe,cellSelection:()=>F,editingMode:()=>De,storyScope:je,paragraphOrder:rt,actorId:()=>d?.identity.actorId,collaborationGate:(m,R)=>d?.gateOperations(m,R)??null,now:Ee,flushPendingInputAndLayout:ot,orderedRange:fo,selectionMark:it,deleteSelectionPlan:po,consumePendingFormatOps:eo,withoutPendingOnRejection:mr,caretMark:uo,suggestion:()=>{let m=dd();return m===void 0?void 0:{author:m,date:j$1()}},trackedOps:dm,trackedChangeLanded:()=>r.onTrackedChange?.(),revisionDisplayMode:Yt,commit:Be});function tl(m){m&&(sn=null,ot(),Qt=Tn(vt()),yt.invalidateAll(a.packageRevision(),"tracked-change-filter"),yt.flush(),n.onChange?.(xt()));}let mo=false,ve={session:a,applyGatedTreeOps:(m,R,L,_)=>Oa(m,R,L,_??je()),storyScope:je,imageDecodePort:()=>ba,textMeasurer:()=>v$1,layout:()=>(ot(),be),state:xt,currentPage:(m="caret")=>{if(ot(),m==="viewport"){let L=TL(e,be,f);if(L!==null)return L}let R=Re(Pe(),D.head);return R?R.pageIndex+1:1},automationWriteRefusal:(m,R)=>vr(m.some(Wx)||R,m,false),setScale(m){if(!(m>0)||!Number.isFinite(m))return false;if(m===f)return true;let R={scale:f,defaults:w,measurer:v$1,producer:P,furnitureSource:Qt};try{let L=Nt(e),_=L?{x:kL(e,L,f),y:(L.scrollTop-e.offsetTop+L.clientHeight/2)/f}:null;if(f=m,n.measurer||(w=Z(f,{context:ii(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{},serifHangulFace:x}),v$1=w.measurer),P=I(),Qt=Tn(vt()),hn=void 0,Ct=void 0,No=null,yt.invalidateAll(a.packageRevision(),"zoom"),yt.flush(),Us(),L&&_){let G=Math.max(0,_.y*f+e.offsetTop-L.clientHeight/2),Q=Number.isFinite(L.scrollHeight)?Math.max(0,L.scrollHeight-L.clientHeight):null;IL(e,L,_.x,f),L.scrollTop=Q===null?G:Math.min(G,Q),ad();}return !0}catch{(({scale:f,defaults:w,measurer:v$1,producer:P,furnitureSource:Qt}=R)),hn=void 0,Ct=void 0,No=null;try{yt.invalidateAll(a.packageRevision(),"zoom-rollback"),yt.flush();}catch{}return false}},enqueueType:Ks,flushPendingInput:ot,type(m){let R=po(),L=R.replaceAt??R.collapseTo,_=eo(L.paragraphId,L.offset,m.length),G=R.ops.length===0?ec(lo()):void 0,Q=[...R.ops,GE(L,m,G)],te=VE(de(a,L.paragraphId)??a.part(),L.paragraphId,L.offset,m.length),pe={paragraphId:L.paragraphId,start:te,end:te},he=Yc(L,te,m,_);Be(()=>mr([...Q,...he],Q,it(),pe),()=>Ke({paragraphId:L.paragraphId,offset:te}));},proposeTextChange:(m,R,L)=>tn(m,R,L),replaceTextInPlace:Ia,insertPlainText:m=>c0(m),deleteBackward(){let m=pE(Pe(),F,De);if(m)return void ve.applyTableCommandPlan(m);if(Dt?.selectForDeletion("backward")||um("backward"))return;let R=po();if(R.ops.length>0){Be(()=>dt(R.ops,it(),uo(R.collapseTo)),()=>Ke(R.collapseTo));return}if(Ux("backward"))return;let L=Bt()??void 0,_=$t.shown(D.head);if(_.offset===0){for(let Ie of $a(Pe(),_.paragraphId)){let ke=zt(Ie);if(ke.length!==0){Be(()=>dt([{op:"deleteText",paragraphId:Ie,start:ke.length-1,end:ke.length}],it(),uo({paragraphId:Ie,offset:ke.length-1})),()=>Ke({paragraphId:Ie,offset:ke.length-1}),{rearmPending:L});return}}if(ve.removeListNumber(_.paragraphId)||ve.removeParagraphIndent(_.paragraphId))return;let G=rt(),Q=G.indexOf(_.paragraphId),te=G[Q-1];if(!te)return;let pe=$t.joinOps(te,_.paragraphId);if(!pe){wt(Ke({paragraphId:te,offset:zt(te).length}));return}let he=zt(te).length;Be(()=>dt(pe,it(),uo({paragraphId:te,offset:he})),()=>Ke({paragraphId:te,offset:he}),{rearmPending:L});return}Be(()=>dt([{op:"deleteText",paragraphId:_.paragraphId,start:_.offset-1,end:_.offset}],it(),uo({..._,offset:_.offset-1})),()=>Ke({..._,offset:_.offset-1}),{rearmPending:L});},splitParagraph(){let m=po(),R=m.replaceAt??m.collapseTo,L=Bt()??{properties:ei(de(a,R.paragraphId)??a.part(),R.paragraphId,R.offset,Yt(),vt()),base:[]},_=E8(R),G=_?Lo.followerStyleId(R.paragraphId):void 0,Q=li$1(L.base,L.properties,Bs(R.paragraphId,R.offset)),te=_&&De==="edit"&&Q.length>0?[{op:"setParagraphMarkProperties",paragraphId:R.paragraphId,properties:Q}]:[],pe={op:"splitParagraph",paragraphId:R.paragraphId,offset:R.offset,tailStyleId:G},he=dd(),Ie=he?{author:he,date:j$1()}:void 0,ke=a.documentStyles(),ge=Wf(ke),St=ge??"ListParagraph",_r=new Set(ke.map(er=>er.styleId));for(let er=1;!ge&&_r.has(St);er++)St=`ListParagraph${er}`;let Zt=De!=="view"&&m.ops.every(er=>er.op==="deleteText"&&er.paragraphId===R.paragraphId)&&G===void 0?OM(de(a,R.paragraphId)??a.part(),be,R,Q,St,pn(),Ie,d?.identity.actorId):null,Jn=Ie?[{op:"setParagraphMarkRevision",paragraphId:R.paragraphId,kind:"ins",revision:Ie}]:[],xm=Zt?[Zt,...te,...Jn]:[pe],rl=Zt?new Set(ga()):null;DA(a,R.paragraphId,er=>Be(()=>mr([...m.ops,...te,...xm],[...m.ops,...Zt?[Zt,...Jn]:[pe]],it(),void 0,Zt&&!ge?[DM(pn()?.defaultParagraphStyleId??null,St)]:void 0),()=>{if(!rl)return er();let v0=ga().filter($8=>!rl.has($8)),x0=Zt?v0.at(-1):v0[0];return x0?Ke({paragraphId:x0,offset:0}):null},{rearmPending:L}),Ce);},navigate(m,R=false){if(m==="documentEnd"&&ri(ve),ot(),!R&&(m==="left"||m==="right")&&(D.anchor.paragraphId!==D.head.paragraphId||D.anchor.offset!==D.head.offset)){let ge=fo();Le=null;let St=TA(Pe(),ge,rt(),m,v$1);wt(Ke(St),true);return}let L=Pe(),_=Ph(L,$t.shown(D.head),m,Le,Xe?.getActive()??null,pi(),v$1,ze.selectionLineId());if(!_)return;let G=t0(),Q=ZT(a.part(),_.position,["left","wordLeft","lineStart","up","pageUp"].includes(m));if(Q&&(_={..._,position:Q,caret:void 0}),C){let ge=BD(L,D.head,_.position);ge!==_.position&&(_={..._,position:ge,caret:void 0});}if(ir(a.part(),_.position)){if(R)return;let St=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(m)?"up":"down",_r=S8(G)+4;for(let Zt=0;Zt<_r;Zt+=1){let Jn=Ph(Pe(),_.position,St,_.desiredX,Xe?.getActive()??null,pi(),v$1);if(!Jn||Jn.position.paragraphId===_.position.paragraphId&&Jn.position.offset===_.position.offset)return;if(_=Jn,!ir(a.part(),_.position))break}if(ir(a.part(),_.position))return}Le=_.desiredX,Ye$1?.activeNoteScope()&&_.pageIndex!==void 0&&Number.isInteger(_.pageIndex)&&Ye$1.setActiveNotePageIndex(_.pageIndex);let pe={anchor:R?$t.shown(D.anchor):_.position,head:_.position},he=R&&!C?pe:_c(L,pe,{atomic:R&&C}),Ie=!R&&!Ht(he,pe),ke=D;wt(he,true,Ie?"none":"head",Ie?void 0:_.caret),Ie&&(D!==ke||Ht(D,he))&&tm(D.anchor);},deleteWordBackward(){if(ve.deleteSelection())return;let m=D.head,R=(Dt?.wordDeletionBoundary??He)(zt(m.paragraphId),m.offset,-1,Ke$1(Pe(),m.paragraphId));if(R===m.offset){ve.deleteBackward();return}Be(()=>dt([{op:"deleteText",paragraphId:m.paragraphId,start:R,end:m.offset}],it()),()=>Ke({...m,offset:R}),{rearmPending:Bt()??void 0});},deleteWordForward(){if(ve.deleteSelection())return;let m=D.head,R=(Dt?.wordDeletionBoundary??He)(zt(m.paragraphId),m.offset,1,Ke$1(Pe(),m.paragraphId));if(R===m.offset){ve.deleteForward();return}Be(()=>dt([{op:"deleteText",paragraphId:m.paragraphId,start:m.offset,end:R}],it()),void 0,{rearmPending:Bt()??void 0});},deleteForward(){if(Dt?.selectForDeletion("forward")||um("forward")||ve.deleteSelection()||Ux("forward"))return;let m=Bt()??void 0,R=$t.shown(D.head),L=zt(R.paragraphId);if(R.offset<L.length){Be(()=>dt([{op:"deleteText",paragraphId:R.paragraphId,start:R.offset,end:R.offset+1}],it()),void 0,{rearmPending:m});return}rt().at(-1)===R.paragraphId&&ri(ve);let _=rt(),G=_[_.indexOf(R.paragraphId)+1];if(G){if($a(Pe(),G).includes(R.paragraphId)){if(zt(G).length===0)return;Be(()=>dt([{op:"deleteText",paragraphId:G,start:0,end:1}],it()),()=>Ke(R),{rearmPending:m});return}Be(()=>dt($t.forwardJoinOps(R.paragraphId,G)??[{op:"joinParagraphs",firstId:R.paragraphId,secondId:G}],it()),()=>Ke(R),{rearmPending:m});}},...On,...Cn,setSelection:m=>{Ht(m,D)||X({kind:"programmatic"},false),to.discard(),wt(m);},selectDrawing(m,R){Wt();let L=vs(be,m,R);if(!L)return false;let _=Ke(L);return X({kind:"pointer",drawingNodeId:m},Ht(_,D)),wt(_,true,"none"),jn(ve)?.drawingNodeId===m},revealPage(m,R){td();let L=be.pages.find(_=>_.index===m);return !L&&nd(m,()=>ve.revealPage(m,R))?true:L?nl(L.box.y,L.box.height,R):false},revealParagraph(m,R){td();let L={paragraphId:m,offset:0},_=Re(Pe(),L);if(!_&&nd(L,()=>ve.revealParagraph(m,R)))return true;if(!_)return false;let G=be.pages.find(Q=>Q.index===_.pageIndex);return G?nl(G.contentBox.y+_.y,_.height,R):false},revealPosition(m,R){td();let L=Re(Pe(),m);if(!L&&nd(m,()=>ve.revealPosition(m,R)))return true;if(!L)return false;let _=be.pages.find(Q=>Q.index===L.pageIndex);if(!_)return false;let G=ic(_,m.paragraphId).y+L.y;return nl(G,L.height,{block:"nearest",...R})},setEditable(m){lm=m,m||gt?.exit(),sm();},selectAll(){ri(ve);let m=rt(),R=m[0],L=m[m.length-1];!R||!L||wt({anchor:{paragraphId:R,offset:0},head:{paragraphId:L,offset:zt(L).length}});},hyperlinks:A,equations:ne,contentControls:co,formatPainter:bi,canInsertTable:o0,insertTable:I8,canInsertToc:s0,insertToc:R8,canRefreshToc:ym,canEditTextFormField:()=>Dt?.canEdit()??false,editTextFormField:()=>Dt?.edit()??false,refreshToc:l0,...n0,refreshRefFieldResults:P8,save:()=>BA(ve,e,()=>mo),saveSteps:()=>$A(ve,e,()=>mo),isInsideToc:m=>QT(a.part(),m),retainSelection:()=>{let m=Symbol("selection-pin");return Ue.set(m,D),Se$1=D,el(),m},releaseSelection:m=>{Ue.delete(m)&&(_e$1(),el());},retainedSelection:()=>Se$1,publishedLayout:()=>be,drawingSelectionIntent:()=>z,overlayCoordinates:()=>Object.freeze({paintScale:f,pageOffsetX:Ct?.pageOffsetX??new Map}),commitReviewOps:(m,R)=>{ot();let L=D.head.paragraphId,_=zt(L),G=null;return nn(()=>{G=Be(()=>{if(De==="view")return {committed:false,rejected:true,opCount:0,reason:g$1};if(d&&(R===void 0||!AM.has(R)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(d){let Ie=d.gateOperations([],je());if(Ie)return {committed:false,rejected:true,opCount:0,reason:Ie}}let Q=d?.identity.actorId,te=Hb$1(Q,()=>m(oe.value)),pe=typeof te.reason=="string"?{reason:te.reason}:{},he=te.committed;return {committed:he,rejected:!he,opCount:0,...pe}},()=>{Wt(),ze.noteModelMoved();let Q=rt();if(Q.length===0)return null;let te=Hc(D,L,_,zt(L));return Jo(Pe(),Q,te)});}),G},revisionDisplayMode:ro,replacementLanding:oo,applyAutomationOps:(m,R,L,_=false)=>{let G=null,Q=R??zs,pe=Be(()=>{let he=vr(false);if(he!==null)return G={committed:false,rejected:true,opCount:0,reason:he};let Ie=null,ke=m(ge=>{let St=vr(true,[],false);return St===null?Hb$1(d?.identity.actorId,()=>a.ensureHyperlinkRelationship(ge,Q)):(Ie=St,null)});return ke===null?G={committed:false,rejected:true,opCount:0,reason:Ie??"this engine will not author that hyperlink target"}:!n.reviewModel&&(_||ke.some(Oc))?G={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:G=dt(ke,void 0,void 0,Q,false,L)},()=>{Wt(),ze.noteModelMoved();let he=rt();return he.length===0?null:Jo(Pe(),he,D)},{automation:true})??Sc;return G??{committed:false,rejected:true,opCount:0,reason:pe}},editingMode:()=>De,author:()=>u$1,setAuthor:m=>{u$1!==m&&(en(),u$1=m,m?.trim()&&rp(K)&&(K=null,n.onChange?.(xt())));},setDrawingStrings:m=>{no!==m&&n$1(no)!==n$1(m)&&(no=m,ot(),Rt(false));},setLocale:ld$1.set,setTranslate:m=>{if(Zs===m)return;Zs=m,vb(S,m),Dt?.update();let R=j(m),L=k$1(R)!==k$1(va);va=R,L&&Ws.get()&&(ot(),Rt(false));},setTocLabels:m=>{Hs=m;},setEditingMode:m=>{ot();let R=De!==m;De=m,R&&m==="view"&>?.exit(),R&&m==="view"&&Xe?.exitHeaderFooter(),R&&m==="view"&&Ye$1?.exitNote(),R&&m==="view"&&bi.disarm(),id(),sm(),Rh(e,De),R&&Rt(false),K=null,n.onChange?.(xt());},revisionAuthors:()=>hr.get().value,setRevisionDisplayMode(m){mo||m===Fr.view()||(ot(),Fr.set(m),tl(true));},hiddenRevisionAuthors:()=>Zn.hiddenAuthors,setRevisionAuthorVisible(m,R){tl(Zn.setVisible(m,R));},setAllRevisionAuthorsVisible(m){tl(Zn.setAllVisible(hr.get().value.keys(),m));},showAllRevisionAuthors(){tl(Zn.showAll());},setTrackedChangesFilter(m,R){tl(Zn.setPredicate(m,R));},collaborationSession:()=>d??null,remotePresenceColor:Zx,setShowParagraphMarks:Ws.set,setRevisionMarkup:hi.set,setUnsupportedElementRules:m=>{let R=lb(fc(m));if(R.view(a).currentPackage(),s.view(a).currentPackage(),R.geometryKey()===s.geometryKey()){let _=R.includePartial!==s.includePartial;s=R,Qt=Tn(vt()),_&&Rt(false);return}ot(),s=R,Qt=Tn(vt()),yt.invalidateAll(a.packageRevision(),"unsupported-content"),yt.flush(),n.onChange?.(xt());},setRevisionStyles:m=>{m!==Yn&&(Yn=m,ot(),Rt(false));},setHighlightPainter(m){U=m,m||q.replaceChildren(),fd();},repaintHighlights:fd,setRemoteCaretLabelHost:m=>{m!==ao&&(ao=m,pd());},setReviewActivationExclusions(m,R){Ys=R?.formattingKinds?new Set(R.formattingKinds):void 0,Xs=m===null?null:new Set(m),Aa(),n.onChange?.(xt());},activeReviewKey:()=>{let m=pm();return m?ml(m):null},activateReview:(m,R,L)=>{if(Ri.clear(),jx=L?.allowExcluded??false,Qs=R?{key:m,anchor:R.anchor,head:R.head}:{key:m,anchor:D.anchor,head:D.head},R){let _=()=>{fm=true;try{wt(R,!1,L?.preventScroll?"none":"caret");}finally{fm=false;}};L?.preventScroll?nn(_):_();return}Aa(),n.onChange?.(xt());},activatedReviewKey:()=>Vx()===null?null:Qs?.key??null,dismissActiveReview:()=>{let m=pm();m&&(Ri.add(ml(m)),Qs=null,Aa(),n.onChange?.(xt()));},navigation:Oe,bookmarkEditing:Sa,bookmarks:()=>a.bookmarks(),selectedText(){if(F)return KO(be,F);let{from:m,to:R}=fo();return qO(Pe(),m,R,rt())},copyFlavours:()=>M8(),pasteRich:(m,R)=>A8(m,R),armForcePlainPaste:L8,deleteSelection(){if(!Ht(D,Ke(D.head))&&um("backward"))return true;let R=po();return R.ops.length===0?false:(Be(()=>dt(R.ops,it(),uo(R.collapseTo)),()=>Ke(R.collapseTo)),true)},setCellSelection:ud,layoutSession:()=>E,undo:()=>{if(De==="view"||sr(e)){K=Y(g$1),n.onChange?.(xt());return}en(),ae.end(),d?.flushPendingJournals(),st.step("undo",lt,()=>$e("undo"));},redo:()=>{if(De==="view"||sr(e)){K=Y(g$1),n.onChange?.(xt());return}en(),ae.end(),d?.flushPendingJournals(),st.step("redo",lt,()=>$e("redo"));},sectionAtPage:Gn,activeScope:()=>{let m=gt?.active();if(m)return m;let R=Ye$1?.activeNoteScope();return R||Xe.activeScope()},setActiveScope:m=>(ot(),m.kind==="frame"?gt.enter(m):m.kind!=="body"&&m.kind!=="headerFooter"&&m.kind!=="note"?false:(gt?.exit(),m.kind==="note"?Ye$1.enterNote(m.id):(Ye$1?.exitNote(),Xe.setActiveScope(m)))),insertNote:m=>(ot(),Ye$1.insertNote(m)),deleteNote:(m,R)=>Ye$1.deleteNote(m,R),convertNote:(m,R)=>Ye$1.convertNote(m,R),convertAllNotes:m=>Ye$1.convertAllNotes(m),setNoteProperties:m=>Ye$1.setNoteProperties(m),enterNote:(m,R)=>(ot(),Ye$1.enterNote(m,R)),exitNote:()=>(ot(),Ye$1.exitNote()),notePropertiesState:()=>{let m=ve.state().selection.head.paragraphId,R=a.packageRevision(),L=a.currentPackage(),_=a.part(),G=Bf$1(L),Q=pj$1(L,"footnote"),te=pj$1(L,"endnote"),pe=ve.activeScope().kind==="headerFooter",he=ve.headerFooterState(),Ie=he?.rId??null,ke=he?.sectionIndex??null,ge=sn;if(ge&&ge.packageRevision===R&&ge.paragraphId===m&&ge.bodyPart===_&&ge.settingsPart===G&&ge.footnotesPart===Q&&ge.endnotesPart===te&&ge.headerFooterOpen===pe&&ge.headerFooterRId===Ie&&ge.headerFooterSectionIndex===ke)return ge.result;let St=K1(ve,vt());return sn={packageRevision:R,paragraphId:m,bodyPart:_,settingsPart:G,footnotesPart:Q,endnotesPart:te,headerFooterOpen:pe,headerFooterRId:Ie,headerFooterSectionIndex:ke,result:St},St},notePreviewText:m=>U1(a,m),applyTableCommandPlan(m){if(!m.ok)return {ok:false,code:m.code,reason:m.reason};if(m.selection.kind==="selectCells")return ud(m.selection.cells),{ok:true,changed:false};let R=null,L=a.subscribe(_=>{_.caret&&(R=_.caret);});try{let _=it(),G=m.selection.kind==="adoptCommittedCaret";Be(()=>dt(m.ops,_),G?()=>{let Q=R;return Q?Ke({paragraphId:Q.paragraphId,offset:Q.start}):null}:void 0,m.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{L();}return K?{ok:false,code:"invalidArgs",reason:K}:{ok:true,changed:true}},enterHeaderFooter:m=>{ot();let R=Xe.enterHeaderFooter(m);if(!R)return R;let L=Xe.getActive(),_=L?be.pages[L.pageIndex]:void 0;if(L&&_){let G=L.kind==="header"?_.header:_.footer,Q=G?.box.y??(L.kind==="header"?_.box.y:_.box.y+_.box.height-1),te=G?.box.height??1;nl(Q,te,{block:"nearest"});}return R},exitHeaderFooter:()=>(ot(),Xe.exitHeaderFooter()),headerFooterState:()=>Xe.headerFooterStateStable(a.packageRevision()),...H1({applyOps:dt,commit:Be,deleteSelectionOps:C8,deleteSelectionPlan:()=>po(),orderedStart:bm,selectionMark:it,collapsedAt:Ke,isHeaderFooterOpen:()=>Xe?.getActive()!==null,lastRejection:()=>K}),...B1({session:a,applyOps:dt,commit:Be,storyScope:je,selectionMark:it,editingMode:()=>De,author:()=>u$1,trackedDate:j$1,decodePort:()=>ba,actorId:()=>d?.identity.actorId}),focus:()=>{S.ownerDocument.activeElement!==S&&(S.focus({preventScroll:true}),ze.mirrorToDom(true));},setTableInteractionLabel(m){p.resolve=m;},refreshTableInteractionLabels(){La.refreshLabels();},moveTo:Ca.moveTo,park:Ca.park,parked:Ca.parked,hostElement:()=>e,destroy(){if(!mo){mo=true,Xn(),ln=null,En.cancel(),Ra.cancel();try{ed();}finally{S.removeEventListener("pointerdown",b0,{capture:true}),S.removeEventListener("keydown",hd$1,{capture:true}),S.removeEventListener("keydown",mi,{capture:true}),S.removeEventListener("pointerdown",mi,{capture:true}),S.removeEventListener("beforeinput",hd$1,{capture:true}),S.removeEventListener("keydown",p0),B8(),S.removeEventListener("beforeinput",y0),S.removeEventListener("copy",m0),S.removeEventListener("cut",g0),S.removeEventListener("paste",h0),S.removeEventListener("compositionstart",u0),S.removeEventListener("compositionend",d0),Gs?.destroy(),T.clear(),Ca.destroy(),id(),rm.destroy(),Si.destroy(),Dt?.destroy(),cd?.destroy(),cm?.destroy(),gd?.destroy(),La.destroy(),fe?.destroy(),Oe.destroy(),Te.destroy(),ze.destroy(),S.removeEventListener("contextmenu",Nx),S.removeEventListener("click",Hx),S.removeEventListener("pointermove",Ox),S.removeEventListener("pointerleave",Ax),Ve.destroy(),yt.cancel(),We!==null&&Ne.clearTimeout(We),We=null,Qn&&Qn(),Qn=null,wn.dispose(),q$1(S),$.destroy(),wi(),Dr(),It(),xi(),e.replaceChildren();}}}};function F8(m){He$1=null;let R=Dt?.restoreAfterHistory();if(!m&&R&&(D=R),ze.noteModelMoved(),Wt(),!m){wt(Jo(Pe(),rt(),D));return}if("anchor"in m){let _=rt(),G=!d&&[m.anchor,m.head].every(Q=>_.includes(Q.paragraphId));wt(G?m:Jo(Pe(),_,m));return}let L={anchor:{paragraphId:m.paragraphId,offset:m.start},head:{paragraphId:m.paragraphId,offset:m.end}};wt(rt().includes(m.paragraphId)?L:Jo(Pe(),rt(),L));}function nl(m,R,L){let _=Nt(e);if(!_||_.clientHeight===0)return false;Us();let G=m*f+e.offsetTop;return rA(_,G,R*f,L)&&ad(),true}let{onSelectionChange:D8,onCompositionEnd:d0}=o.methods({...ze}),u0=(...m)=>{ze.adoptBeforeInput(),ed(),ze.onCompositionStart(...m);},gd=null,N8=FA({onRequest:n.onRequestTextFormField,onInvalidRequest:n.onRequestInvalidTextFormField,locale:ld$1.get,translate:(m,R)=>Zs?.(m,R)??m,pagesLayer:S,get container(){return e},listeners:T,part:m=>de(a,m??D.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(m=D.head.paragraphId)=>Wk(a.settingsRoot())&&Xk(de(a,m)??a.part(),m),selection:()=>D,select:(m,R)=>wt(m,false,R?"none":"caret"),reveal:tm,editable:()=>De==="edit"&&!gr,apply:m=>Xf(m,Be,dt),save:(m,R)=>qA(m,R,{session:a,commit:Be,refusal:()=>vr(true,m,false),gate:(L,_)=>d?.gateOperations(L,_)??null,collaborationActive:d!==void 0})},r.initialTextFormInput);Dt=hL(N8,{part:m=>de(a,m),selection:()=>D,select:m=>wt(m),writable:()=>De!=="view"&&!gr,compare:Je},o),ZE(ve,Dt.fieldId),XE(ve,n.contentLockPolicy),cm=QA({pagesLayer:S,part:m=>de(a,m??D.head.paragraphId)??a.part(),editable:()=>De!=="view"&&!gr,protected:m=>Wk(a.settingsRoot())&&Xk(de(a,m)??a.part(),m),selection:()=>D,select:m=>wt(m,false,"none"),apply:m=>Xf(m,Be,dt)}),cd=TM({pagesLayer:S,settings:()=>Bf$1(a.currentPackage()),part:m=>de(a,m??D.head.paragraphId)??a.part(),editable:()=>De==="edit"&&!gr,select:m=>wt(m,false,"none"),canApply:m=>a.editable&&vr(true,[m],false)===null,history:m=>ve[m](),apply:m=>Xf(m,Be,dt)});let H8=wF(ve,{...n,onToggleFieldCodes:()=>{ot(),gr=!gr,Qt=Tn(vt()),yt.invalidateAll(a.packageRevision(),"field-code-view"),yt.flush();}}),f0=FD(ve,()=>(de(a,D.head.paragraphId)??a.part()).root),p0=m=>{f0.keydown(m),!cd?.keydown(m)&&(m.defaultPrevented||ze.adoptBeforeInput(),!(cm?.keydown(m)||Dt?.keydown(m))&&H8(m));},{onCopy:m0,onCut:g0,onPaste:h0}=SF(ve),_8=kF(ve,{isComposing:()=>ze.isComposing(),insertPlainText:c0,onBrowserSelectionFixup:()=>{ze.mirrorToDom(),ze.noteBrowserSelectionFixup();}}),y0=m=>{ze.adoptBeforeInput(),_8(m);},{onDrawingPointerGesture:b0,onDrawingKeyGesture:hd$1}=bM({surface:ve,textbox:()=>gt,intent:()=>z,setIntent:m=>X(m,true)});S.addEventListener("pointerdown",b0,{capture:true}),S.addEventListener("keydown",hd$1,{capture:true}),S.addEventListener("beforeinput",hd$1,{capture:true}),S.addEventListener("keydown",mi,{capture:true}),S.addEventListener("pointerdown",mi,{capture:true}),S.addEventListener("keydown",p0);let B8=DD(S,f0);S.addEventListener("beforeinput",y0),S.addEventListener("copy",m0),S.addEventListener("cut",g0),S.addEventListener("paste",h0),S.addEventListener("compositionstart",u0),S.addEventListener("compositionend",d0),Gs=ML({pagesLayer:S,container:()=>e,listeners:T,onSelectionChange:D8,rematerialize:o.wrap(ad)}),gt=xM({session:a,pagesLayer:S,layout:()=>be,selection:()=>D,setSelection:m=>wt(m,false,"none"),flush:ot,...SM(a,Gn,()=>({hfScope:Xe,noteOps:Ye$1})),writable:()=>lm&&De!=="view"&&a.editable}),gd=$D({onTextFormDoubleClick:m=>Dt?.doubleClick(m)??false,onTextFormPointerUp:m=>Dt?.pointerUp(m),pagesLayer:S,get container(){return e},listeners:T,scale:()=>f,pageOffsetX:m=>Ct?.pageOffsetX.get(m)??0,layout:()=>(ki=false,sd.without(Wt),Pe()),measurer:()=>v$1,selection:()=>$t.shownSelection(D),setSelection:(m,R)=>wt(m,false,"none",R),cellSelection:()=>F,setCellSelection:m=>ud(m),focus:()=>S.focus({preventScroll:true}),onSelectionSettled:()=>bi.applyIfArmed(),activeHeaderFooter:()=>MT(fn()),activeNote:()=>{let m=Ye$1?.activeNoteScope();return m?{scopeId:m.id,pageIndex:Ye$1?.activeNotePageIndex()??null}:null},enterHeaderFooter:m=>{ot(),Xe?.enterHeaderFooter({rId:m.rId,pageIndex:m.pageIndex,sectionIndex:Gn(m.pageIndex).sectionIndex,kind:m.kind,...m.position?{position:m.position}:{}});},enterNote:(m,R,L)=>{De!=="view"&&(ot(),Ye$1?.enterNote(m,R,L));},exitNote:m=>{ot(),Ye$1?.exitNote(m);},exitHeaderFooter:()=>(ot(),Xe?.exitHeaderFooter()),enterEmptyHeaderFooter:(m,R)=>{if(De==="view")return;ot();let L=Xe;L&&q1({session:a,layout:be,sectionAtPage:Gn,create:_=>ve.applyHeaderFooterLifecycle?.(_),flushLayout:Wt,enter:_=>L.enterHeaderFooter(_)},m,R);},onContentControlWidget:(m,R)=>m8(m,R),...n.reviewModel?{onChangeBarToggle:Fr.toggleByChangeBar}:{},isReadOnlyPosition:m=>ir(a.part(),m)!==void 0},{...n.pointer?{mode:n.pointer}:{},...C?{atomicInlineControls:true}:{}});let La=PD({pagesLayer:S,furnitureLayer:J,listeners:T,scale:()=>f,pageOffsetX:m=>Ct?.pageOffsetX.get(m)??0,read:()=>({layout:be,storeRevision:a.packageRevision(),selection:D,cellSelection:F,editingMode:De,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:m=>ve.applyTableCommandPlan(m),label:m=>p.resolve(m)});if(fe=ZL({pagesLayer:S,layer:ee,listeners:T,scale:()=>f,pageOffsetX:m=>Ct?.pageOffsetX.get(m)??0,read:()=>({layout:be,selection:D,editingMode:De}),label:m=>p.resolve(m),setCellSelection:m=>ud(m),session:()=>a,applyTableCommandPlan:m=>ve.applyTableCommandPlan(m)}),Rt(),cd?.sync(),Nr=true,pd(),d&&(Dr=d.subscribeStatus(()=>{n.onChange?.(xt());})),d&&Do)try{It=d.attach(Do);}catch{try{d.destroy();}catch{}}return Ii(),sm(),ve.setTableInteractionLabel=m=>{p.resolve=m,La.refreshLabels(),fe?.update();},ve.refreshTableInteractionLabels=()=>{La.refreshLabels(),fe?.update();},XM(ve,()=>({measurer:n.measurer,producer:n.producer,fontAlias:n.fontAlias,defaultFontFamily:n.defaultFontFamily}),m=>{n={...n,...m},v$1=n.measurer??w.measurer,P=I();},()=>{mo||(Qt=Tn(vt()),hn=void 0,Ct=void 0,No=null,yt.invalidateAll(a.packageRevision(),"fonts"),yt.flush());}),PM(ve,()=>ze.isComposing()),{finishPaused:wa,stop:Xn}=tA(ve,()=>e,{pages:()=>S,now:Ee,destroyed:()=>mo,limit:()=>ln,setLimit:m=>ln=m,bodyBlockCount:()=>zg$1(E),bodyBlock:m=>Ag$1(E)?.[m],publish:m=>vi(m),inputPending:()=>gn(false),busy:()=>En.pending(),finishBusy:()=>En.finish(),composing:()=>ze.isComposing(),prefixPass:m=>Fe(a.packageRevision(),void 0,void 0,m),finish:o.wrap(()=>{ln=null,yt.invalidateAll(a.packageRevision(),"opening"),yt.flush();})},kc),{ok:true,surface:o.methods(ve)}}function X1(e,t=()=>null){let n,r={change:new Set,selectionChange:new Set,error:new Set,historyDiagnostic:new Set,diagnostic:new Set,revisionMarkupChange:new Set,reviewItemReveal:new Set,reviewChangesResolved:new Set,hostChange:new Set},o=()=>{let c=t();if(c===n||n===void 0&&c===null)return;n=c;let d=Object.freeze({document:c});for(let u of [...r.hostChange])u(d);},i=0,a=false,s=[],l=c=>{i>0||a?s.push(c):c();};return {defer(c){i+=1;try{return c()}finally{if(i-=1,i===0&&!a){a=true;try{for(;s.length>0;){let d=s;s=[];for(let u of d)try{u();}catch{}}}finally{a=false;}}}},emitError(c,d){l(()=>{for(let u of [...r.error]){if(d&&!d())return;u(c);}});},emitDocumentChange(c){l(()=>{for(let d of [...r.change])d(c);});},emitSelectionChange(){l(()=>{if(o(),!r.selectionChange.size)return;let c=e();for(let d of [...r.selectionChange])d(c);});},emitHistoryDiagnostic(c){l(()=>{for(let d of [...r.historyDiagnostic])d(c);});},emitDiagnostic(c){l(()=>{for(let d of [...r.diagnostic])d(c);});},emitRevisionMarkupChange(c){l(()=>{for(let d of [...r.revisionMarkupChange])d(c);});},emitReviewChangesResolved(c){l(()=>{let d=Object.freeze({...c,skipped:Object.freeze([...c.skipped])});for(let u of [...r.reviewChangesResolved])u(d);});},emitReviewItemReveal(c){l(()=>{let d=Object.freeze({...c});for(let u of [...r.reviewItemReveal])u(d);});},hasErrorHandlers:()=>r.error.size>0,hasDiagnosticHandlers:()=>r.diagnostic.size>0,hasReviewChangesResolvedHandlers:()=>r.reviewChangesResolved.size>0,clear(){s=[];for(let c of Object.values(r))c.clear();},on(c,d){return r[c].add(d),()=>{r[c].delete(d);}}}}var Ap="content controls lock every remaining change; remove the locks to decide them",Lp="every remaining change is in a data-bound content control";var Y1={"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"},eN=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"],[cy,"edit.protected-content"],[Qi,"edit.read-only"],[Ji,"edit.protected-content"],[ea,"edit.protected-content"],[df,"edit.protected-content"],[zr,"edit.suggesting-needs-author"],[sy,"edit.suggesting-needs-author"],[Kt,"edit.review-module-required"],[BE,"edit.unsupported-content"],[Kb,"edit.unsupported-story"],[ia,"edit.field-structure"],[$c,"edit.tracked-structure-unsupported"],[Ey,"edit.tracked-structure-unsupported"],[Py,"edit.tracked-structure-unsupported"],[Ty,"edit.tracked-structure-unsupported"],[Es,"edit.section-mark"],[Tp,"edit.protected-content"],[Wc,"edit.protected-content"],[wc,"edit.refresh-in-progress"],[Cr,"edit.preview-active"],["invalid note scope id","edit.stale-target"],[ny,"edit.tracking-required"],[uf,"edit.tracked-image-replace-unsupported"],[Sy,"edit.picture-selected"],[ss,"edit.revision-unsupported"],["note not found","edit.stale-target"]]);function Os(e){let t=String(e??"refused");return eN.get(t)??t}function Ms(e,t){return (Object.hasOwn(Y1,e)?Y1[e]:void 0)??B(e)??eN.get(e)??(t!==void 0&&Object.hasOwn(Q1,t)?Q1[t]:void 0)??"edit.refused"}function Qme(e){return e===Ap?"review.locked-content":e===Lp?"review.bound-content":D(e.split(":",1)[0])}var Q1={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"},J1={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 tN(e){return e!==void 0&&Object.hasOwn(J1,e)?J1[e]:"font.load-failed"}var Lv=Object.freeze([16,33,50,100,200,500,1e3]),nN=2048,sj=6e4,lj=200,cj=20,dj=256,uj=6e4;function fj(){return {now:()=>globalThis.performance?.now()??Date.now(),afterNextFrame(t,n){let r=globalThis.requestAnimationFrame;return typeof r!="function"?false:(r(()=>{t(),globalThis.setTimeout(n,0);}),true)},setTimer(t,n){let r=globalThis.setTimeout(t,n);return r.unref?.(),r},clearTimer:t=>globalThis.clearTimeout(t)}}function As(){return {count:0,max:0,bands:new Array(Lv.length+1).fill(0),samples:[]}}function rN(e,t){return e[Math.min(e.length-1,Math.ceil(t*e.length)-1)]}function pj(e){let t=[...e.samples].sort((n,r)=>n-r);return Object.freeze({count:e.count,p50Ms:Math.round(rN(t,.5)),p95Ms:Math.round(rN(t,.95)),maxMs:Math.round(e.max),bands:Object.freeze([...e.bands])})}function oN(e){let t=e.clock??fj(),n=e.windowMs??sj,r={interaction:As(),layout:As(),paint:As()},o=null,i=null,a=null,s=[],l=false;function c(p,g){if(!Number.isFinite(g)||g<0)return;let b=r[p];b.count+=1,b.max=Math.max(b.max,g);let y=Lv.findIndex(h=>g<=h);if(b.bands[y===-1?Lv.length:y]+=1,b.samples.length<nN)b.samples.push(g);else {let h=Math.floor(Math.random()*b.count);h<nN&&(b.samples[h]=g);}o===null&&(o=t.now(),i=t.setTimer(d,n));}function d(){i!==null&&t.clearTimer(i),i=null;let p=o;o=null;let g=r;if(r={interaction:As(),layout:As(),paint:As()},p===null)return;let b={};for(let h of ["interaction","layout","paint"])g[h].count>0&&(b[h]=pj(g[h]));let y=(b.interaction?.count??0)>=cj&&b.interaction.p95Ms>lj;e.deliver({kind:"performance",...y?{code:"performance.slow-interaction"}:{},windowMs:Math.max(0,Math.round(t.now()-p)),...a===null?{}:{pagesBucket:F(a)},...b});}let u=()=>{globalThis.document?.visibilityState==="hidden"&&(s=[],d());};globalThis.document?.addEventListener?.("visibilitychange",u);let f=()=>globalThis.document?.visibilityState==="hidden";return {timing(p,g,b){if(l||!e.enabled())return;if(b&&(a=b()),p!=="input"){c(p,g);return}if(s.length>=dj||f())return;let y=t.now(),h=g>0&&g<=y?g:y;if(s.push(h),s.length>1)return;let x=s,w=false;t.afterNextFrame(()=>{x===s&&(s=[],w=true);},()=>{if(!w||l)return;let k=t.now();for(let E of x)k-E<=uj&&c("interaction",k-E);})||(s=[]);},flush:d,dispose(){l||(d(),l=true,globalThis.document?.removeEventListener?.("visibilitychange",u));}}}function mj(){return {now:()=>globalThis.performance?.now()??Date.now(),setTimer:(e,t)=>{let n=globalThis.setTimeout(e,t);return n.unref?.(),n},clearTimer:e=>globalThis.clearTimeout(e)}}var Fv=()=>({activeMs:0,inputEdits:0,commandEdits:0,automationEdits:0}),gj={input:"inputEdits",command:"commandEdits",automation:"automationEdits"};function iN(e){let t=e.clock??mj(),n=e.windowMs??6e4,r=t.now(),o=Fv(),i=Fv(),a=null,s=null,l=null,c=false,d=false;queueMicrotask(()=>{c||!e.enabled()||(d=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=Fv(),!(b===null||!d)){for(let h of Object.keys(y))i[h]+=y[h];e.deliver({kind:"session",phase:"active",durationMs:Math.max(0,Math.round(t.now()-b)),...y,activeMs:Math.round(y.activeMs)});}}function f(){if(c)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 p=()=>{globalThis.document?.visibilityState==="hidden"&&u();};globalThis.document?.addEventListener?.("visibilitychange",p);function g(){c||(u(),c=true,globalThis.document?.removeEventListener?.("visibilitychange",p),d&&e.deliver({kind:"session",phase:"end",durationMs:Math.max(0,Math.round(t.now()-r)),...i,activeMs:Math.round(i.activeMs)}));}return {activity:f,edit(b){c||(o[gj[b]]+=1,f());},flush:u,end:g}}var Dv=new Set,hj=e=>{if(!e.persisted)for(let t of [...Dv])try{t();}catch{}};globalThis.addEventListener?.("pagehide",hj);function aN(e){return Dv.add(e),()=>{Dv.delete(e);}}function yj(e){let t=e.split(":",1)[0];return D(t)?t:"unsupported-revision"}var bj=new Set(["insertImage","openBookmarkDialog","openGoTo","openRevisionMarkupDialog","openCompareDocumentsDialog","compareDocuments","proposeDeletion","proposeInsertion","proposeReplacement","replaceImage","setEditingMode","setReviewDisplayMode","toggleDocumentProtection","toggleParagraphMarks","toggleReviewPane"]);function sN(e){if(bj.has(e.type))return e.type;try{let t=Yi(e);return t.supported||t.reason!==ey(e.type)?e.type:void 0}catch{return}}function vj(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 lN=new WeakMap;function cN(e,t){let n=lN.get(e);return n?n(t):t()}var Nv=new WeakMap;function xj(e,t,n,r){Nv.get(e)?.(t,n,r);}var dN=new WeakMap;function wj(e,t,n,r){dN.get(e)?.(t,n,r);}function Sj(e,t,n){Nv.get(e)?.("edit.internal-invariant",n,"exception",{thrown:t});}function kj(e){let t=e?.code;return t==="notFound"?"save.no-document":t==="invalidState"?"save.document-changed":"save.failed"}var Ij=new Set(["split","possible-ungrouped-gesture","possible-fragmented-gesture"]);function uN(e){let t=()=>globalThis.performance?.now()??Date.now(),n=G(()=>[...e.modules.diagnosticListeners,e.events.emitDiagnostic],e.now),r=n.deliver,o=null,i=0,a=0,s=0,l=false;e.events.on("historyDiagnostic",x=>{Ij.has(x.kind)&&r({kind:"history",code:`history.${x.kind}`});}),e.customNodes?.observe(x=>{let w=x?.code;(w==="payload-invalid"||w==="payload-missing")&&r({kind:"custom-node",code:`custom-node.${w}`});});let c=e.modules.collaboration?.session,d=c?Pj(c,r,t):()=>{},u=oN({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("performance"),...e.performance}),f=iN({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("session"),...e.session}),p=aN(()=>{u.flush(),f.end();}),g=x=>{let w=new Map;for(let[v,k]of x)for(let{reason:E,revision:I$1,detail:P}of v){let C$1=C({reason:E,...P===void 0?{}:{detail:P}});if(!C$1)continue;let O$1=N(I$1?.revisionKind),S=O$1==="format"?O(I$1?.formattingKind):void 0,T=M(I$1?.partName),B=I(P),W=[C$1,B,k,O$1,S,T].join("|"),q=w.get(W);q?q.count+=1:w.set(W,{count:1,event:{code:C$1,...k?{operation:k}:{},...O$1?{changeKind:O$1}:{},...S?{formattingKind:S}:{},...T?{part:T}:{},...B?{cause:B}:{}}});}for(let{event:v,count:k}of w.values())r({kind:"review.skipped",...v,count:k});},b=(x,w)=>g([[w.revisions?.skipped??[],vj(x)],[w.revisionAuthors?.skipped??[],"reassign"]]),y=(x,w,v)=>{try{r({kind:"edit.rejected",code:"edit.internal-invariant",origin:"command",...v,cause:K(),errorName:L(x),stage:w});}catch{}},h=x=>{if(x||i===0&&a===0){f.edit("input");return}l||(l=true,f.edit(a>0?"automation":"command"));};return {editorSessionId:n.editorSessionId,surfaceHooks(x,w){return {onRejection:v=>this.inputRejected(v,x()),onTiming:(v,k)=>this.timing(v,k,w()??void 0),onEdit:h}},openStarted(x){o={sizeBucket:E(x.byteLength),start:t()};},openDeferred(){o&&(o.start=null);},openMounting(){o&&o.start===null&&(o.start=t());},openSettled(x){if(!o)return;let{sizeBucket:w,start:v}=o;o=null,r({kind:"document.open",outcome:"opened",sizeBucket:w,pagesBucket:F(ds(x)),durationMs:v===null?0:Math.max(0,Math.round(t()-v)),...Rj(x)});},openRejected(x,w,v){let k=o?.sizeBucket;o=null;let E=I(x),I$1=M(v);r({kind:"document.open",outcome:"rejected",code:A(x,w),...k?{sizeBucket:k}:{},...E?{cause:E}:{},...I$1?{part:I$1}:{}});},openCrashed(x,w="open-mount"){if(!o)return;let{sizeBucket:v}=o;o=null,r({kind:"document.open",outcome:"rejected",code:"open.failed",sizeBucket:v,cause:K(),errorName:L(x),stage:w}),e.onOpenCrash?.();},continueOpen(x){try{return x()}catch(w){throw this.openCrashed(w,"open-layout"),w}},reviewItem(x,w,v,k){return (E,I$1)=>{let P=w(E),C=s,O;try{O=x(E,I$1);}catch(q){throw i===0&&y(q,"review-item",{tracked:k()}),q}if(O.ok||i>0)return O;let S=Ms(O.reason,O.code),T=S==="edit.refresh-in-progress"||S==="edit.collaboration-not-ready",B=O.code==="locked"&&O.reason.startsWith("locked-content:")||O.code==="bound"&&O.reason.startsWith("bound-content:");if(B&&s===C&&r({kind:"edit.rejected",code:S,origin:"command",tracked:k()}),O.code==="notFound"||(O.code==="unsupported"||B)&&P&&!T){let q=P?v(P,I$1):{},U=P&&{revisionKind:P.revisionKind,partName:q.partName??"",...P.formattingKind?{formattingKind:P.formattingKind}:{}},Z=D(O.reason.split(":",1)[0])!==null,M=O.reason===ss?q.detail??"read-only":Z?q.detail??I(O.reason):I(O.reason)??q.detail;return g([[[{reason:O.code==="notFound"?"unknown-revision":yj(O.reason),...U?{revision:U}:{},detail:M}],I$1]]),O}if(s!==C)return O;let W=I(O.reason);return r({kind:"edit.rejected",code:S,origin:"command",tracked:k(),...W?{cause:W}:{}}),O}},exec(x,w,v,k){i===0&&a===0&&(l=false),i+=1;let E;try{E=v();}catch(I){if(i===1){let P;try{P=sN(x);}catch{P=void 0;}y(I,"command",{tracked:w,...P?{command:P}:{}});}throw I}finally{i-=1;}if(i>0)return E;if(E.ok&&!l&&k?.()&&(l=true,f.edit(a>0?"automation":"command")),!E.ok){let I$1=sN(x),P=I(E.reason);r({kind:"edit.rejected",code:Ms(E.reason,E.code),origin:"command",tracked:w,...I$1?{command:I$1}:{},...P?{cause:P}:{}});}return b(x,E),E},inputRejected(x,w){if(i>0||a>0)return;s+=1;let v=Ms(x),k=I(x);r({kind:"edit.rejected",code:v,origin:"input",tracked:w,...k?{cause:k}:{}});},fontFailed(x){r({kind:"font.failed",code:tN(x)});},attach(x,w){let v=x.exec,k=()=>x.getDocumentHandle().revision;x.exec=(I,P)=>{let C=k();return this.exec(I,w(),()=>v(I,P),()=>k()!==C)};let E=x.save;x.save=()=>this.save(()=>E.call(x)),lN.set(x,I=>{i===0&&a===0&&(l=false),a+=1;try{return I()}finally{a-=1;}}),dC(x,(I,P)=>{this.exec(I,w(),()=>P);}),dN.set(x,(I$1,P,C)=>{let O=I(C);r({kind:"review.skipped",code:I$1,count:1,...P?{operation:P}:{},...O?{cause:O}:{}});}),Nv.set(x,(I$1,P,C,O)=>{let S=I(C);r({kind:"edit.rejected",code:I$1,origin:"automation",tracked:P,...S?{cause:S}:{},...O?{errorName:L(O.thrown),stage:"automation"}:{}});});},async save(x){let w=t(),v=()=>Math.max(0,Math.round(t()-w)),k;try{k=await x();}catch(E){try{let I=kj(E);r({kind:"document.save",outcome:"rejected",code:I,durationMs:v(),...I==="save.failed"?{cause:K(),errorName:L(E),stage:"save"}:{}});}catch{}throw E}return r({kind:"document.save",outcome:"saved",sizeBucket:E(k.byteLength),durationMs:v()}),k},timing(x,w,v){x==="input"&&f.activity(),u.timing(x,w,x==="paint"&&v?()=>ds(v):void 0);},dispose(){u.dispose(),d(),f.end(),p();}}}function Rj(e){try{let{session:t}=e;return {shape:{parts:F(t.currentPackage().parts.size),paragraphs:F(t.paragraphIds().length),reviewItems:F(t.reviewItems().length),embeddedFonts:F(t.embeddedFonts().length)}}}catch{return {}}}function Pj(e,t,n){let r=n(),o="none",i,a=false,s=false,l=-1,c=()=>{let f=e.statusSnapshot(),p=f.reason?.code,g=f.recovering===true;if(f.status===o&&p===i&&g===a)return;let b=f.status==="ready"&&!s,y=b&&o!=="none";b&&(s=true),t({kind:"collab.status",status:f.status,previous:o,...p?{code:`collab.${p}`}:{},recovering:g,...y?{connectMs:Math.max(0,Math.round(n()-r))}:{}}),o=f.status,i=p,a=g;},d=()=>{let f=e.participants().length;f!==l&&(l=f,t({kind:"collab.participants",count:f}));},u=[e.subscribeStatus(c),e.subscribeParticipants(d)];return c(),()=>{for(let f of u)f();}}function fN(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()&&zI(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));}var Tj=50,Ej=7e3,Cj="docx-editor-announcer";function pN(e){let t=nt(e),n=null,r=null;return {announce(o){let i=e();if(!i||!o)return;(!n||n.parentElement!==i)&&(n?.remove(),n=i.ownerDocument.createElement("div"),n.className=`docx-editor-sr-only ${Cj}`,n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.setAttribute("data-docx-marker",""),n.contentEditable="false",i.append(n));let a=n;a.textContent="",r!==null&&t.clearTimeout(r),t.setTimeout(()=>{a.textContent=o;},Tj),r=t.setTimeout(()=>{r=null,a.remove(),n===a&&(n=null);},Ej);},dispose(){r!==null&&t.clearTimeout(r),r=null,n?.remove(),n=null;}}}function ua(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 Oj=()=>ua();function mN(e={}){let t=eO(e.changed),n=lc({}),r=UC(e),o=YC(e),i=Oj(),a=ua(["dropdown","comboBox","date","buildingBlockGallery"]),s=ua();return {surfaceOptions:{onRequestTextFormField:i.request,onRequestContentControlWidget:a.request,onRequestInvalidTextFormField:s.request,onHyperlinkPopover:l=>t.current().onPopover?.(l),onRequestHyperlink:()=>t.open(),onEquationPopover:l=>n.current().onPopover?.(l),...r.surfaceOptions},bookmarkDialog:r.bookmarkDialog,goTo:r.goTo,commentDraft:o.requests,link:t.requests,setters:{setTextFormFieldChrome:i.register,setContentControlWidgetChrome:a.register,setInvalidTextFormFieldChrome:s.register,setHyperlinkChrome:t.register,setEquationChrome:n.push,...r.setters,...o.setters}}}function gN(e,t){QC(e,t.commentDraft),tO(e,t.link);}var yN="documents cannot be compared while a collaboration session is attached",Lj="this document is protected; only form fields can be filled",Fj="this document is protected against edits",bN="the document is open for viewing",vN="the revised document is empty",Fp="the dialog is closed",xN="another compare of this dialog is running",Hv="the document changed while the compare ran",Dj="revised must be a Uint8Array",Nj=createT(en),Hj=.95,hN=e=>e.engineReason===void 0?{}:{reason:e.engineReason};function Dp(e,t){return t||(e.reason===yN?"collaboration":e.reason===bN?"viewing":e.reason===vN?"empty":e.reason===Fp?"closed":e.reason===xN||e.reason===wc||e.reason===Cr?"busy":e.reason===Hv?"documentChanged":e.reason===Kt||e.code==="notFound"?"unavailable":e.code==="locked"||e.code==="protected"?"protected":"failed")}var _j=e=>Object.prototype.toString.call(e)==="[object Uint8Array]",Bj={protected:"locked",invalidOriginal:"unsupported",tooLarge:"unsupported",unsupportedContent:"unsupported"};function $j(e){if(e.authorName!==void 0&&typeof e.authorName!="string")return "authorName must be a string";for(let t of ["detectFormatChanges","removeDateAndTime"])if(e[t]!==void 0&&typeof e[t]!="boolean")return `${t} must be a boolean`;return null}function wN(e,t){return e.type!=="compareDocuments"?t:{...t,compareDocuments:{ok:false,code:Dp(t),message:t.reason}}}function SN(e){let t=null,n=null,r=ua(),o=nt(()=>e.container()),i=pN(()=>e.container()),a=w=>{let v=e.translate()??Nj;i.announce(w>0?v("compareDocuments.recorded",{count:w}):v("compareDocuments.recordedNoRevisions"));},s=()=>new Promise(w=>{let v=o.setTimeout(()=>{o.cancelAnimationFrame(k),w();},250),k=o.requestAnimationFrame(()=>{o.clearTimeout(v),o.setTimeout(w,0);});}),l=()=>{if(e.destroyed())return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(!e.contribution()?.compareDocuments)return {ok:false,code:"unsupported",reason:Kt};let w=e.surface();if(!w)return {ok:false,code:"notFound",reason:"no document is open"};if(w.collaborationSession())return {ok:false,code:"unsupported",reason:yN};if(e.viewing())return {ok:false,code:"locked",reason:bN};let v=e.container();if(v&&sr(v))return {ok:false,code:"unsupported",reason:gs(v)};let k=Un({type:"compareDocuments"},w);if(k)return k;let E=jj$1(Bf$1(w.session.currentPackage())?.root);return E.enforced&&E.edit==="forms"?{ok:false,code:"locked",reason:Lj}:E.enforced&&(E.edit==="comments"||E.edit==="trackedChanges")?{ok:false,code:"locked",reason:Fj}:{ok:true}},c=()=>{let w=l();return w.ok?e.contribution()?.createCompareDocumentsDialog?e.container()?{ok:true}:{ok:false,code:"notFound",reason:"the editor is not attached"}:{ok:false,code:"unsupported",reason:Kt}:w},d=w=>{let v=l();if(!v.ok)return {refused:v};if(!_j(w.revised))return {refused:{ok:false,code:"invalidArgs",reason:Dj,engineCode:"invalidOptions"}};if(w.revised.byteLength===0)return {refused:{ok:false,code:"invalidArgs",reason:vN}};let k=$j(w);if(k)return {refused:{ok:false,code:"invalidArgs",reason:k,engineCode:"invalidOptions"}};let E=e.surface();E.flushPendingInput();let I=w.authorName?.trim()||E.author();return {options:{...I?{authorName:I}:{},detectFormatChanges:w.detectFormatChanges!==false,...w.removeDateAndTime===true?{removeDateAndTime:true}:{}}}},u=w=>({ok:false,code:Bj[w.code]??"invalidArgs",reason:w.message,engineCode:w.code,...w.reason===void 0?{}:{engineReason:w.reason}}),f=(w,v)=>{let k=e.surface().session.replacePackage(w);return k.ok?{ok:true,changed:k.change!==null,revisionCount:v}:{ok:false,code:"unsupported",reason:`the compare result was refused: ${k.reason}`}},p=w=>{let v=d(w);if("refused"in v)return v.refused;let k=e.surface(),E=e.contribution().compareDocuments(k.session.currentPackage(),w.revised,v.options);return E.ok?f(E.package,E.revisionCount):u(E)},g=async(w,v,k,E)=>{let I=d(w);if("refused"in I)return I.refused;let P=e.surface(),C=P.session.currentPackage(),O=false,S;try{S=await v(ng(C),w.revised,I.options,{signal:k,onProgress:U=>{O=!0,E(U);}});}catch(U){if(O||k.aborted)throw U;return E({phase:"comparing",fraction:0}),await s(),k.throwIfAborted(),e.surface()!==P||P.session.currentPackage()!==C?{ok:false,code:"unsupported",reason:Hv}:p(w)}if(!S.ok)return u(S);let T=()=>{let U=l();return U.ok&&(e.surface()!==P||P.session.currentPackage()!==C)?{ok:false,code:"unsupported",reason:Hv}:U},B=T();if(!B.ok)return B;if(!S.changed||!S.bytes)return {ok:true,changed:false,revisionCount:S.revisionCount};E({phase:"applying",fraction:Hj}),await s(),k.throwIfAborted();let W=T();if(!W.ok)return W;let q=lg(S.bytes);return q.ok?f(q.package,S.revisionCount):{ok:false,code:"unsupported",reason:"the compare result cannot be read"}},b=()=>{if(n){n.cancel();return}let w=t;t=null,w?.destroy();},y=()=>{let w=new AbortController,v=e.contribution()?.compareDocumentsInBackground,k=false,E={signal:w.signal,defaultAuthor:e.surface()?.author()??"",originalHasTrackedChanges:e.surface()?.session.reviewItems().some(I=>I.kind==="revision")??false,canApply:()=>n===E&&!w.signal.aborted&&!k&&l().ok,cancelable:v!==void 0,async apply(I,P){let C=0,O=S=>{w.signal.aborted||S.fraction<C||(C=S.fraction,P?.onProgress?.(S));};if(!E.canApply()){if(k&&n===E&&!w.signal.aborted)return {ok:false,code:"busy",message:xN};let S=l();return S.ok?{ok:false,code:"closed",message:Fp}:{ok:false,code:Dp(S),message:S.reason}}k=true,await s();try{if(w.signal.aborted)return {ok:!1,code:"closed",message:Fp};let S=v?await g(I,v,w.signal,O):p(I);if(!S.ok)return {ok:!1,code:Dp(S,S.engineCode),...hN(S),message:S.reason};let T=S.revisionCount??0;return S.changed&&(E.cancel(),e.surface()?.focus(),a(T)),{ok:!0,revisionCount:T,changed:S.changed}}catch(S){return w.signal.aborted?{ok:false,code:"closed",message:Fp}:{ok:false,code:"failed",message:S instanceof Error?S.message:String(S)}}finally{k=false;}},cancel(){if(w.signal.aborted)return;n===E&&(n=null);let I=t;t=null,w.abort(),I?.destroy();}};return E},h=w=>{t=e.contribution().createCompareDocumentsDialog({signal:w.signal,defaultAuthor:w.defaultAuthor,originalHasTrackedChanges:w.originalHasTrackedChanges,cancelable:w.cancelable,canApply:w.canApply,apply:w.apply,cancel:w.cancel,container:e.container(),translate:v=>e.translate()?.(v)}),w.signal.aborted?b():t.open();},x=()=>{let w=c();if(!w.ok)return w;b();let v=y();n=v;try{r.request(v)||h(v);}catch(k){throw v.cancel(),k}return {ok:true,changed:false}};return {canOpen:c,canCompare:l,open:x,compare:p,destroyDialog:b,register(w,v){return r.register(w??{onRequest:h},v)},exec(w){if(w.type==="openCompareDocumentsDialog")return x();if(w.type!=="compareDocuments")return null;let v;try{v=p(w);}catch(k){let E=k instanceof Error?k.message:String(k);return {ok:false,code:"unsupported",reason:E,compareDocuments:{ok:false,code:"failed",message:E}}}return v.ok?{ok:true,changed:v.changed,compareDocuments:{ok:true,revisionCount:v.revisionCount??0,changed:v.changed}}:{ok:false,code:v.code,reason:v.reason,compareDocuments:{ok:false,code:Dp(v,v.engineCode),...hN(v),message:v.reason}}},can(w){return w.type==="openCompareDocumentsDialog"?c():w.type==="compareDocuments"?l():null}}}function kN(e,t){let n=ib$1(e),r=null,o=null,i=null,a=ua(),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=f=>{if(t.destroyed())return;let p=ib$1(f,n);JSON.stringify(p)!==JSON.stringify(n)&&(n=p,t.apply(n),i?.(),t.changed(n));},c=()=>{if(o){o.cancel();return}let f=r;r=null,f?.destroy();},d=()=>{let f=new AbortController,p=new Set,g=n,b=h=>{if(!(f.signal.aborted||JSON.stringify(h)===JSON.stringify(g))){g=h;for(let x of [...p])x();}},y={signal:f.signal,get:()=>g,set(h){f.signal.aborted||b(ib$1(h,g));},reset:()=>b(hb$1),subscribe(h){return f.signal.aborted?()=>{}:(p.add(h),()=>{p.delete(h);})},canApply:()=>o===y&&!f.signal.aborted&&s().ok,apply(){return y.canApply()?(l(g),y.cancel(),true):false},cancel(){if(f.signal.aborted)return;o===y&&(o=null,i=null),p.clear();let h=r;r=null,f.abort(),h?.destroy();}};return i=()=>b(n),y},u=f=>{r=t.contribution().createRevisionMarkupDialog({...f,container:t.container(),translate:p=>t.translate()?.(p)}),f.signal.aborted?c():r.open();};return {current:()=>n,set:l,canOpen:s,register(f,p){return a.register(f??{onRequest:u},p)},open(){let f=s();if(!f.ok)return f;c();let p=d();o=p;try{a.request(p)||u(p);}catch(g){throw p.cancel(),g}return {ok:true,changed:false}},destroyDialog:c}}function IN(e,t){let n=kN(e,t),r=SN(t);return {markup:n,compare:r,destroyDialogs(){n.destroyDialog(),r.destroyDialog();},exec(o){return o.type==="openRevisionMarkupDialog"?n.open():r.exec(o)},can(o){return o.type==="openRevisionMarkupDialog"?n.canOpen():r.can(o)}}}var RN=new WeakMap;function Uj(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$1.story))}function jj(e,t){Uj(t)||(e.summaries=null);}function Vj(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>jj(t,n)));}function TN(e){}function EN(e,t){let n=RN.get(e);return n||(n={summaries:null,subscribed:false},RN.set(e,n)),Vj(e,n),n.summaries||(n.summaries=t()),n.summaries}var Gj=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function zj(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function Zj(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Gt(t)){let o=Kn(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(zj(t)){if(!Gt(t.from)||!Gt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=Kn(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let i=Kn(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 _v(e,t){let n=Gj.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=ra(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=Zj(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 Xj="http://schemas.microsoft.com/office/word/2010/wordml",Yj="http://schemas.microsoft.com/office/word/2012/wordml";function fa(e){return ld(e)}function Uc(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function Qj(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===pa$2)return t.value}}function Bv(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return Qj(n)}}function Jj(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=eV(t);if(n!==void 0)return n}return "richText"}function eV(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===Xj||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===Yj)return "repeatingSection"}function Np(e){let t=Bv(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function tV(e,t){if(Np(Uc(t)))return true;let n=fb$2(e,t.id);for(;n;){if(fa(n)&&Np(Uc(n)))return true;n=fb$2(e,n.id);}return false}function Wv(e,t){let n=Uc(e),r=Bv(n,"tag"),o=Bv(n,"alias"),i=t?tV(t,e):Np(n);return {id:e.id,controlType:Jj(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...i?{locked:true}:{}}}var CN=new WeakMap;function nV(e,t){let n=[],r=fb$2(e,t.id);for(;r;)fa(r)&&n.push(`${r.id}:${Np(Uc(r))?1:0}`),r=fb$2(e,r.id);return n.join("|")}function MN(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function rV(e){return Object.freeze(e.map(t=>MN(t)))}function oV(e,t){let n=e.node,r=Uc(n),o=nV(t,n),i=CN.get(n);if(i&&i.properties===r&&i.lockAncestors===o)return i.summary;let a=MN(Wv(n,t));return CN.set(n,{properties:r,lockAncestors:o,summary:a}),a}function iV(e){let t=sc$1(e.root);return TN(t.length),t.map(n=>oV(n,e))}function aV(e){return rV(e.storyParts().flatMap(t=>iV(t)))}function sV(e){return EN(e,()=>aV(e))}function $v(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 lV(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,i,a)=>{if(a>=Aa$1)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=Fi(e,l);continue}if(Ca(l)){s=n(l.children,s,i,a+1);continue}if(fa(l)){let c=s,d=i+1;s=n(kc$1(l),s,d,a+1),t.push({control:l,start:c,end:s,depth:d});continue}s+=Fi(e,l);}return s};return n(e.children,0,-1,0),t}function qv(e,t,n){return lV(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>Wv(r.control,n))}function Kv(e,t){let n=[],r=fb$2(e,t);for(;r;)fa(r)&&n.push(Wv(r,e)),r=fb$2(e,r.id);return n.reverse()}function AN(e,t){if(!e)return [];let n=sV(e.session);return t?n.filter(r=>$v(r,t)):n}function Uv(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=de(e.session,n)??e.session.part(),i=eb$1(o,n);if(i&&i.kind==="paragraph"){for(let s of qv(i,r,o))if($v(s,t))return s}let a=Kv(o,n);for(let s=a.length-1;s>=0;s-=1){let l=a[s];if($v(l,t))return l}return null}function jv(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function cV(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function dV(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function uV(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 Hp(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||fa(n))&&t.push(n);return t}function fV(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...Hp(r.children));return t}function pV(e){return e.kind==="table"?fV(e):fa(e)?Hp(kc$1(e)):e.kind==="body"?Hp(e.children):[]}function mV(e,t,n){if(fa(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let a of qv(t,r,e))return {ok:true,controlId:a.id};let i=Kv(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 gV(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=uV(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=Hp(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=pV(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let i=mV(e,o,t.offset);return i.ok?i:{...i,target:t}}function hV(e,t,n){let r=Kn(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=eb$1(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 c of qv(i,a,o))return {ok:true,controlId:c.id};let l=Kv(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 LN(e,t){if(t===void 0){let r=Uv(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(dV(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return cV(t)?gV(n,t):Gt(t)?hV(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function FN(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 DN(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 NN(e,t){return {ok:false,code:FN(e),reason:DN(e),...t!==void 0?{target:t}:{}}}function yV(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 Vv(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function Gv(e,t,n,r){let o=yV(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=_v(t,e);return s.ok?ON(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let i=LN(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 ON(t,a,i.controlId)}function ON(e,t,n){let r=de(e.session,n)??e.session.part(),o=Bf$1(e.session.currentPackage()),i=Uk(o,t)??sm(r,o,t)??xn$1(r,t);return i?{ok:false,code:FN(i),reason:DN(i)}:{ok:true}}function HN(e,t,n,r){t?.flushPendingInput();let o=Gv(e,t,n,r);return o.ok?bV(t,e):o}function _N(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 bV(e,t){if(t.type==="insertContentControl")return vV(e,t);let n=LN(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=ra(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},i=_N(e,[o],r,r,Et(e.session,n.controlId,{kind:"body"}));return i.rejected?NN(i.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:i.committed})}function vV(e,t){e.flushPendingInput();let n=_v(e,t);if(!n.ok){let c=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...c!==void 0?{target:c}:{}}}let{paragraphId:r,start:o,end:i}=n.span,a=ra(e.state().selection),s={paragraphId:r,start:o,end:i},l=_N(e,[n.op],a,s,Et(e.session,r,{kind:"body"}));return l.rejected?NN(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}function BN(e,t,n){switch(n.type){case "selectedText":return e?.selectedText()??"";case "selectionFormatting":return e?t():null;case "selection":return hf(e);case "paragraphs":return LC(e,n.container);case "isInsideToc":return BC(e);case "hyperlinkAt":return AC(e);case "contentControls":return AN(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 Uv(e,n.filter);case "tableContext":return bf(e);case "splitCellConfig":return HC(e);case "watermark":return PE(e);case "bookmarks":return e?.bookmarkEditing.list()??[];default:return null}}var xV=40,wV="docx-preview-surface",$N="data-docx-previewing";function SV(e){let t=e.ownerDocument.defaultView;for(let n=e.parentElement;n;n=n.parentElement){let r=t?.getComputedStyle(n),o=`${r?.overflowY??""} ${r?.overflowX??""}`;if(/(auto|scroll|overlay)/.test(o))return n}return null}function WN(e,t,n){let r=e.parentElement;if(!r)return null;let o=e.ownerDocument,i=SV(e),a=i?.scrollTop??0,s=i?.scrollLeft??0,l=o.createElement("div");l.className=wV,l.setAttribute("data-docx-preview",""),l.setAttribute("role","region"),l.setAttribute("aria-label",t),l.style.position="absolute",l.style.margin="0";let c=I=>{I.stopPropagation(),I.type!=="contextmenu"&&I.preventDefault();};for(let I of ["contextmenu","paste","cut","drop","dragover"])l.addEventListener(I,c);let d=()=>{l.style.top=`${e.offsetTop}px`,l.style.left=`${e.offsetLeft}px`,l.style.width=`${e.offsetWidth}px`,l.style.minHeight=`${e.offsetHeight}px`;};d(),r.insertBefore(l,e.nextSibling);let u=n(l);if(!u)return l.remove(),null;l.style.position="absolute",d();let f=o.activeElement,p=f&&e.contains(f)?f:null;p?.blur();let g=e.style.visibility;e.style.visibility="hidden",i&&(i.scrollTop=a,i.scrollLeft=s);let y=o.defaultView,h=y?.ResizeObserver,x=h?new h(d):null;x?.observe(e),x?.observe(r),y?.addEventListener("resize",d);let w=e.closest(".docx-editor")??r;w.setAttribute($N,"");let v=nt(()=>l),k=null,E=()=>{k=null,Ic(u,xV)||(k=v.setTimeout(E,0));};return Or(u)&&(k=v.setTimeout(E,0)),{surface:u,place:d,finishOpening(){for(k!==null&&v.clearTimeout(k),k=null;!Ic(u,Number.POSITIVE_INFINITY););},remove(){k!==null&&v.clearTimeout(k),k=null,x?.disconnect(),y?.removeEventListener("resize",d),w.removeAttribute($N);let I=i?.scrollTop??0,P=i?.scrollLeft??0;e.style.visibility=g,u.destroy(),l.remove(),i&&(i.scrollTop=I,i.scrollLeft=P),p?.isConnected&&p.focus({preventScroll:true});}}}function _p(e){if(e.kind==="paragraph")return e.id;if(!("children"in e)||!Array.isArray(e.children))return null;for(let t of e.children){let n=_p(t);if(n)return n}return null}function qN(e,t){let n=e.parts.get(e.mainDocumentPart)?.root,r=t.parts.get(t.mainDocumentPart)?.root;if(!n||!r||n===r)return null;let o=(a,s)=>{let l=a.children,c=s.children;for(let u=0;u<c.length;u+=1){let f=c[u],p=l[u];if(p!==f)return f.kind==="paragraph"?f.id:p&&p.kind===f.kind&&"children"in p&&"children"in f?o(p,f)??_p(f):_p(f)}let d=c[c.length-1];return d?_p(d):null},i=o(n,r);return i&&eb$1(t.parts.get(t.mainDocumentPart),i)?i:null}var zv="review-module-required",KN="preview-operation-unsupported";function UN(e,t,n){let r=x$1(e),o=t,i=t.collaborationSession(),a=i?.identity.actorId,s=()=>n().reviewModel!==void 0,l=()=>{let u=t.author()?.trim();return t.editingMode()==="suggest"&&u?u:void 0},c=()=>(n().revisionMarkup??hb$1).trackFormatting&&!t.session.trackingSettings().doNotTrackFormatting,d=u=>{let f=l();return f===void 0?u:Mc(u,{author:f,date:j$1()},c())};return {...r,collaborative:()=>!!i,trackedRangeReplacement:()=>!i,suggesting:()=>t.editingMode()==="suggest",revisionDisplayMode:()=>lb$1(t.revisionDisplayMode()),replacementLanding(u,f,p){let g=l();if(g===void 0)return null;if(p<=f)return f;let b=kV(e,u);return b?np(b,f,p,g,j$1()):f},apply(u,f,p=[],g=false){let b=o.automationWriteRefusal([],false);if(b!==null)return {ok:false,reason:b};if(g&&!s())return {ok:false,reason:zv};let y=Hb$1(a,()=>r.apply(h=>{let x=u(h);if(x===null||(b=o.automationWriteRefusal(x,p.length>0),b!==null))return null;let w=d(x);return w.some(Oc)&&!s()?b=zv:b=i?.gateOperations(w,f)??null,b===null?w:null},f,p));return b!==null?{ok:false,reason:b}:y},applyCommentWrites(u,f){let p=o.automationWriteRefusal([],false);if(p!==null)return {ok:false,reason:p};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};if(!s())return {ok:false,reason:zv};let g=i?.gateOperations([],f);return g?{ok:false,reason:g}:Hb$1(a,()=>r.applyCommentWrites(u,f))},applyCustomNodeWrite:()=>({ok:false,reason:KN}),applyLifecycle:()=>({ok:false,reason:KN})}}function kV(e,t){let n=e.currentPackage(),r=n.parts.get(n.mainDocumentPart),o=r?[r,...n.parts.values()]:[...n.parts.values()];for(let i of o){if(!i.root)continue;let a=eb$1(i,t);if(a?.kind==="paragraph")return a}return null}var Bp=new WeakMap;function jN(e,t){Bp.set(e,{...t,active:null});}function VN(e){Bp.get(e)?.active?.end();}function Ls(e){let t=Bp.get(e)?.active;return !!t&&!t.ended&&t.shown}var RV=Object.freeze({document:true,save:false,events:false,selection:false,scrolling:false,layout:false}),PV=new Uint8Array(0);function TV(e){let t=Bp.get(e),n$1=e.surface;if(!t||!n$1||n$1.parked())return {ok:false,reason:"no-document"};if(t.active&&!t.active.ended)return {ok:false,reason:"preview-active"};let r=n$1.hostElement();if(sr(r))return {ok:false,reason:"blocked"};if(n$1.editingMode()==="view")return {ok:false,reason:"viewing"};if($f(n$1))return {ok:false,reason:"composing"};n$1.flushPendingInput();let o=n$1.session.currentPackage(),i=o.parts.get(o.mainDocumentPart);if(!i)return {ok:false,reason:"no-document"};let a=t.displayOptions(),s=new S(o,i,a.contentLockPolicy?{contentLockPolicy:a.contentLockPolicy}:{}),l=u$1({port:UN(s,n$1,t.displayOptions),capabilities:RV}),c=e.mountGeneration,d=new Set,u=null,f=false,p=e.on("change",()=>{if(f)return;if(e.surface!==n$1||e.mountGeneration!==c){g.end();return}if(!u)return;let{scale:b,showParagraphMarks:y}=t.displayOptions();b!==void 0&&u.surface.setScale(b)&&u.place(),u.surface.setShowParagraphMarks(y??false);}),g={deferEvents:t.deferEvents,host:l,get shown(){return u!==null},get ended(){return f},show(){if(f||u)return false;let b=t.displayOptions(),y=n({ok:true,package:s.currentPackage()},{...b.reviewModel?{reviewModel:b.reviewModel}:{},...b.contentLockPolicy?{contentLockPolicy:b.contentLockPolicy}:{}});if(!y.ok)return false;let h=b.translate?.("editor.previewContent")??en.editor.previewContent;return u=WN(r,h,x=>{let w={...b,editingMode:"view",revisionDisplayMode:n$1.revisionDisplayMode(),openedSession:y,progressiveOpen:true},v=Kc(x,PV,w);return v.ok?(v.surface.setEditable(false),v.surface):null}),u?(xb(r,true),t.changed(),true):false},reveal(){if(!u)return false;let b=qN(o,s.currentPackage());return b===null?false:(u.finishOpening(),u.surface.revealPosition({paragraphId:b,offset:0}),true)},end(){if(f)return;f=true,p();let b=u!==null;u?.remove(),u=null,b&&xb(r,false),t.active===g&&(t.active=null),b&&t.changed();for(let y of [...d])try{y();}catch{}d.clear();},onEnd(b){return f?(b(),()=>{}):(d.add(b),()=>d.delete(b))}};return t.active=g,{ok:true,fork:g}}var GN=new WeakMap;function zN(e){let t=GN.get(e);if(!t)throw new Error("External refresh requires a mounted createDocxEditor instance.");return t}function ZN(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,ti(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&&(ti(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 c=Nt(s.container);if(l&&c&&(c.scrollTop=Math.max(0,Math.min(s.top,c.scrollHeight-c.clientHeight)),xs(c,s.left),c.dispatchEvent(new(Ae(c)).Event("scroll"))),r===s){r=null,ti(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=Nt(s);return new Promise(c=>{r={bytes:i,resolve:c,container:s,top:a==="recovery"&&n?n.top:l?.scrollTop??0,left:a==="recovery"&&n?n.left:l?ws(l):0,mountedRevision:null},o.source=a,ti(s,true),t.surface()?.setEditable(false);try{t.load(i);}catch(d){o.mounted(i,d);}})}};return e.on("change",i=>{i.source||o.revision++;}),GN.set(e,o),o}function XN(){let e=new WeakMap,t=new WeakMap;return (n,r,o,i)=>{let a=r?e:t,s=a.get(n);if(s&&s.anchors===r&&s.revision===o)return s;let l=n.map(g=>r?bd(g,r):null),c=n.map(i),d=g=>l[g]?.pageIndex??null,u=s!==void 0&&n.every((g,b)=>d(b)===(s.geometries[b]?.pageIndex??null)&&c[b]===s.groups[b]),f=s?.order;if(!u||!f){let g=n.map((b,y)=>y);g.sort((b,y)=>{let h=d(b)??Number.MAX_SAFE_INTEGER,x=d(y)??Number.MAX_SAFE_INTEGER;return h!==x?h-x:c[b]!==c[y]?c[b]-c[y]:b-y}),f=g;}let p={anchors:r,revision:o,geometries:l,groups:c,order:f};return a.set(n,p),p}}function YN(){let e=new WeakMap,t=new WeakMap;return (n,r,o)=>{let i=r?e:t,a=i.get(n);return a&&a.length===o.length&&a.every((s,l)=>s===o[l])?a:(i.set(n,o),o)}}function Zv(e,t,n,r){return Z(t,{context:e?ii(e.ownerDocument):null,...r?{fontAlias:r}:{},serifHangulFace:u(n.currentPackage())})}function QN(e$1,t,n,r,o,i){let a$1=new Map,s=new Set,l=p=>{let{family:g,weight:b,style:y}=p.request;return `${p.identity}|${g}|${b}|${y}`},c=i?{shape(p){try{return e$1.shaper.shape(p)}catch(g){let b=p.environment.font;if(g instanceof e&&g.code==="fontOverLimit"&&!s.has(l(b))){s.add(l(b));let{family:y,weight:h,style:x}=b.request;try{i(new a("overLimit",g.message,{request:Object.freeze({family:y,weight:h,style:x}),diagnostic:g.diagnostic??g.message,cause:g}));}catch{}}throw g}}}:e$1.shaper,d$1=c!==e$1.shaper&&q$2(e$1.shaper)?p$1(c):c,u=fa$1({...e$1,shaper:d$1},{resolveFont:p=>{let g=p.fontFamily??t.defaultFont.family;if(g.trim().length===0)return null;let b={family:g,weight:p.bold?700:400,style:p.italic?"italic":"normal"},y=h$2(b);if(a$1.has(y))return a$1.get(y)??null;let h;try{h=e$1.fonts.resolve(b);}catch{return a$1.set(y,null),null}let x=h instanceof d?null:h;return a$1.set(y,x),x},fallback:n.measurer}),f=`shaped:${e$1.operation.extensionFingerprint}+algorithm:${e$1.operation.shapingHash}+producer:${e$1.operation.producerVersion}+fallback:${n.producer}@scale:${r}+fonts:${o}`;return {measurer:u,producer:f}}var EV="The quick brown fox 0123 \u2014 {}#@\uF021\uF041\uF061\uF0A1\uF0E1\uE700\uE710",CV=["monospace","serif"],OV=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function eH(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(EV).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!OV.test(r))return t.set(r,true),true;let i=false;for(let a of CV){let s=n(`32px ${a}`);if(n(`32px "${r}", ${a}`)!==s){i=true;break}}return t.set(r,i),i}}var JN=4;function tH(e,t,n){let r=new Set,o=[];for(let d of t){let u=d.toLowerCase();r.has(u)||(r.add(u),o.push(d));}let i=d=>new Set(e.slice(0,Math.max(d,0)).map(u=>u.toLowerCase())),a=0;for(let d=0;d<=JN;d+=1){let u=i(n-a),f=o.filter(g=>!u.has(g.toLowerCase())).length,p=Math.min(f,JN,Math.floor(n/2));if(p===a)break;a=p;}let s=e.slice(0,Math.max(n-a,0)),l=i(n-a),c=o.filter(d=>!l.has(d.toLowerCase()));return [...s,...c].slice(0,n)}function nH(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=W.get(i.toLowerCase());a!==void 0&&n(a)||o.push(i);}return o}function rH(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 oH=new WeakMap,MV=0,AV=w((e,t)=>{if(e.kind==="paragraphProperties"){let n=oH.get(e);return n||(n=String(++MV),oH.set(e,n)),{families:[n],children:[]}}return {families:e.kind==="paragraph"&&!e.children.some(n=>n.kind==="paragraphProperties")?["default-paragraph"]:[],children:x(e,t)}});function $p(e){return AV(e,{key:""})}var iH=new WeakMap,aH=new WeakMap;function Xv(e){let t=aH.get(e);return t||aH.set(e,t=y()),t}function Yv(e,t){Xv(e)(t,e.stylesRoot(),e.documentThemeFonts()),A$1(t),$p(t);}function sH(e,t,n,r){let o=Xv(e).warmTableRows(t,n,r,e.stylesRoot(),e.documentThemeFonts()),i=t.children.slice(n,r);return A$1(i),$p(i),Math.max(o,t.children.length)}function lH(e){let t=e.packageRevision(),n=iH.get(e);if(n?.revision===t)return n.families;let r=n?.eastAsianFonts??Xv(e),o=e.storyParts().map(f=>f.root),i=e.stylesRoot(),a=e.numberingRoot(),s=e.documentThemeFonts(),l=$p(o),d=n&&n.stylesRoot===i&&n.numberingRoot===a&&n.theme===s&&n.numberingInputs.length===l.length&&n.numberingInputs.every((f,p)=>f===l[p])?n.numberingFamilies:C$1(o,a,i,s),u=[...e.symbolFontFamilies(),...r(o,i,s),...A$1(o),...d];return iH.set(e,{eastAsianFonts:r,revision:t,families:u,numberingInputs:l,numberingFamilies:d,numberingRoot:a,stylesRoot:i,theme:s}),u}function cH(e,t,n){let[r]=a$4([[t]]);return tH([...new Set([...r&&r!==n?[r]:[],...e.documentFonts(),...v$1(e.currentPackage(),e.documentThemeFonts())])],lH(e),c$3)}function dH(e,t){let n,r=false,o=()=>{r=false;let s=e();if(!s)return;let l=n?.generation!==s.generation;l&&(n={generation:s.generation,requested:new Set,running:false,late:[]});let c=n;if(c.running)return;let d=c.late.shift();if(d!==void 0){c.running=true;let p=t(s.families(),d);return p.finally(()=>{c.running=false,n===c&&i();}),p}if(!l&&!s.dynamic)return;let u=s.families().filter(p=>!c.requested.has(p.toLowerCase()));if(!l&&u.length===0)return;for(let p of u)c.requested.add(p.toLowerCase());c.running=true;let f=t(u);return f.finally(()=>{c.running=false,n===c&&i();}),f},i=(s=false)=>{if(s)return o();r||(r=true,queueMicrotask(o));};return {schedule:i,deliver:(s,l)=>{n?.generation===s&&(n.late.push(l),i());}}}function uH(){let e=0,t=new AbortController,n=()=>{let r=t;return {generation:e,signal:r.signal,current:()=>t===r&&!r.signal.aborted}};return {get generation(){return e},capture:n,advance(){let r=t;return t=new AbortController,e+=1,{...n(),cancelPrevious:()=>r.abort()}},dispose:()=>t.abort()}}function pr(e,t,n="unsupported"){if(e===null||e===Sc)return {ok:false,code:n,reason:t};if(e.startsWith("locked-content:"))return {ok:false,code:"locked",reason:e};if(e.startsWith("bound-content:"))return {ok:false,code:"bound",reason:e};let r=Ms(e);return {ok:false,code:r==="edit.read-only"||r==="edit.protected-content"?"locked":"unsupported",reason:e}}function pH(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 Qv(e,t){let n=e.review;return n?{reviewModel:j$4({...n,collectReviewItems:r=>n.collectReviewItems(e.customNodes.length>0?{...r,customNodes:e.customNodes,...e.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:t}:{}}:r)},f$2)}:{}}var LV=["all-markup","simple-markup","proposed","original"];function mH(e){let t=()=>e.placements({pairReplacements:true}).filter(v=>v.kind==="revision"&&(v.activatable||v.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(v=>v.kind==="revision")??[],r=()=>{let v=e.surface()?.session;if(!v)return [];let k=e$3(v.currentPackage());return v.storyParts().flatMap(E=>g$4(cm(E),k))},o=(v,k)=>v.keys!==void 0||v.scope==="document"||e.authorVisibility.hasPredicate?[]:k().filter(E=>e.authorVisibility.isVisible(E.author)),i=(v,k=false)=>{let E=n(),I,P=M=>(I??=new Map(e.placements({placement:false,pairReplacements:true}).filter(J=>oi(J.key)).map(J=>[J.key,J])),I.get(M)),C=new Set(v.keys?.flatMap(M=>{if(!oi(M))return [M];let J=P(M);return J?bs(J.item):[M]})??(v.scope==="document"?E:pL(e.surface()?.session.reviewItems()??[],e.authorVisibility)).filter(M=>M.kind==="revision").map(ml)),O=new Map,S=v.keys===void 0&&(v.scope==="document"||!e.authorVisibility.hasFilter);if(S){let M=e.surface().session,J=v.scope==="document"?null:new Set(E.flatMap(ee=>{let fe=ee.kind==="revision"?ll(ee):[],se=fe.length?de(M,fe[0]):null;return se?[se.name]:[]}));for(let ee of M.storyParts())(!J||J.has(ee.name))&&O.set(ee.name,{scope:Et(M,ee.root.id,{kind:"body"}),part:ee,keys:[]});}let T=null,B=()=>T??=r(),W=k?o(v,B):[];for(let M of W)C.add(ml(M));let q=M=>{let J=e.scope(M),ee=de(e.surface().session,ll(M)[0]);if(!ee)return;let fe=O.get(ee.name);fe||(fe={scope:J,part:ee,keys:[]},O.set(ee.name,fe));let se=ml(M);C.delete(se)&&fe.keys.push(se);};for(let M of E)q(M);for(let M of W)q(M);let U=new Set(v.keys??[]);if(U.size>0&&C.size>0)for(let M of B())C.has(ml(M))&&q(M);let Z=k?new Set(B().flatMap(M=>U.has(ml(M))?[]:[ml(M)])):new Set;return {scopes:[...O.values()],missing:[...C],unfilteredDocument:S,silent:Z}},a=v=>!e.surface().session.storyParts().some(k=>k.name===v.name),s=v=>{let k=[],E=[];for(let{scope:I,part:P,ops:C}of v)C.length&&(a(P)?E.push({partName:P.name,ops:C}):k.push({scope:I,ops:C}));return {groups:k,partOps:E}},l=(v,k=false)=>{let{scopes:E,missing:I,unfilteredDocument:P,silent:C}=i(v,k),O=[],S=I.filter(W=>!C.has(W)).map(W=>({key:W,reason:"unknown-revision"})),T=[],B=0;for(let{scope:W,part:q,keys:U}of E){let Z=Aa(q,v.action,P?void 0:U,void 0,{countRemaining:false,explicit:v.keys!==void 0});for(let M of Z.result.resolved)C.has(M.key)||O.push(M);for(let M of Z.result.skipped)C.has(M.key)||S.push(M);B+=Z.result.remaining,T.push({scope:W,part:q,ops:Z.ops});}return {...s(T),result:{resolved:O,skipped:S,remaining:B}}},c=v=>v.author===void 0?e.surface()?.author():v.author,d=v=>{let{scopes:k,missing:E}=i(v),I={author:c(v)??"",...v.date===void 0?{}:{date:v.date}},P=E.map(S=>({key:S,reason:"unknown-revision"})),C=[];for(let{scope:S,part:T,keys:B}of k){if(!B.length)continue;let W=im(T,I,B,void 0,v.authors);C.push({scope:S,part:T,ops:W.ops,plan:W});}let O=S=>({updated:S.flatMap(T=>T.updated),skipped:[...P,...S.flatMap(T=>T.skipped)]});return {...s(C),result:O(C.map(({plan:S})=>S.result)),finish:()=>{let S=e.surface().session.currentPackage().parts;return O(C.map(({part:T,plan:B})=>{let W=S.get(T.name);return W?B.finish(W):B.result}))}}},u=()=>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:Kt},f=v=>v.scope!==void 0&&!["visible","document"].includes(v.scope)||v.unsupported!==void 0&&!["skip","fail"].includes(v.unsupported)||v.keys!==void 0&&(!Array.isArray(v.keys)||v.keys.some(k=>typeof k!="string"))?{ok:false,code:"invalidArgs",reason:"invalid bulk revision selection"}:null,p=v=>{let k=u();if(!k.ok)return {gate:k};if(e.viewing())return {gate:{ok:false,code:"locked",reason:"the document is open for viewing"}};let E=Un(v,e.surface());if(E)return {gate:E};let I=c(v);if(I===void 0)return {gate:{ok:false,code:"invalidArgs",reason:"pass an author, or configure the editor author, to change the author"}};if(typeof I!="string"||v.date!==void 0&&typeof v.date!="string"||hm({author:I,...v.date===void 0?{}:{date:v.date}}))return {gate:{ok:false,code:"invalidArgs",reason:"author must be nonblank text, and date an ISO 8601 date and time"}};let P=f(v);if(P)return {gate:P};if(v.keys!==void 0&&(v.scope!==void 0||v.authors!==void 0)||v.authors!==void 0&&(!Array.isArray(v.authors)||v.authors.some(S=>typeof S!="string")))return {gate:{ok:false,code:"invalidArgs",reason:"select by keys, or by scope and authors; authors must be a list of names"}};let C=d(v),{result:O}=C;return v.unsupported==="fail"&&O.skipped.length?{gate:{ok:false,code:"unsupported",reason:"some selected changes cannot change author"},plan:C}:O.updated.length?{gate:{ok:true},plan:C}:{gate:{ok:false,code:O.skipped.some(S=>S.reason==="unsupported-revision")?"unsupported":"notFound",reason:"no eligible selected changes to update"},plan:C}},g=v=>{e.surface()?.flushPendingInput();let{gate:k,plan:E}=p(v);if(!k.ok)return E?{...k,revisionAuthors:{...E.result,updated:[]}}:k;let I=e.surface(),{groups:P,partOps:C}=E;if(!P.length&&!C.length)return {ok:true,changed:false,revisionAuthors:E.result};let O=e.placements({placement:false,pairReplacements:false}).find(q=>q.isActive)?.key,S,T=I.commitReviewOps(q=>(S=I.session.applyTreeOpsAtomic(P,{partOps:C,historyToken:q}),S),"revision-attribution");if(!S?.committed)return pr(T,"the changes were refused");let B=E.finish(),W=B.updated.find(q=>q.previousKey===O);return W&&e.activate(W.key),{ok:true,changed:true,revisionAuthors:B}},b=v=>{if(v.type==="setReviewChangesAuthor")return p(v).gate;if(v.type!=="navigateReviewChange"&&v.type!=="resolveAllReviewChanges"&&v.type!=="setReviewDisplayMode")return null;let k=u();if(!k.ok)return k;if(v.type==="setReviewDisplayMode")return LV.includes(v.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(v.type==="navigateReviewChange"&&!["next","previous"].includes(v.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(v.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(v.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(v.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 E=Un(v,e.surface());if(E)return E;let I=f(v);if(I)return I;let{result:P,groups:C,partOps:O}=l(v);return v.unsupported==="fail"&&P.skipped.length?{ok:false,code:"unsupported",reason:BV}:!P.resolved.length&&!C.length&&!O.length?{ok:false,code:$V(P.skipped),reason:WV(P.skipped,e.authorVisibility.hasFilter)}:{ok:true}},y=(v,k)=>{let E=u();if(!E.ok)return E;if(e.viewing()){let T=e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve");return pr(T,"the document is open for viewing","locked")}let I=Un({type:"resolveAllReviewChanges"},e.surface());if(I)return I;e.surface().flushPendingInput();let P=Xr(e.placements,v)?.item;if(!P||P.kind!=="revision")return {ok:false,code:"notFound",reason:"unknown-revision: no revision with that key"};if(P.readOnly)return {ok:false,code:"unsupported",reason:ss};let C=UV(de(e.surface().session,ll(P)[0]),P,k);if(C)return C;let O,S=e.surface().commitReviewOps(T=>{let B=e.surface().session,W=de(B,ll(P)[0]);if(W&&a(W)){let Z=fH(P,k,W);return Z.refusal?(O={committed:false,reason:Z.refusal},O):(O=B.applyTreeOpsAtomic([],{partOps:[{partName:W.name,ops:Z.ops}],historyToken:T}),O)}let q=e.surface().session.partFor(e.scope(P)),U=fH(P,k,q);return U.refusal?(O={committed:false,reason:U.refusal},O):(O=e.surface().session.applyTreeOps(U.ops,void 0,void 0,e.scope(P),{historyToken:T}),O)},"revision-resolve");return O?.committed?{ok:true,changed:true}:pr(S??(typeof O?.reason=="string"?O.reason:null),"the revision was refused")},h=v=>{if(v.type==="setReviewChangesAuthor")return g(v);if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(v.type))return null;e.surface()?.flushPendingInput();let k=b(v);if(!k)return null;if(!k.ok){if(v.type==="resolveAllReviewChanges"&&(k.code==="notFound"||k.code==="unsupported"||k.code==="locked"||k.code==="bound")&&u().ok&&!e.viewing()){let{result:T}=l(v);return {...k,revisions:{...T,resolved:[],remaining:n().length}}}return k}let E=e.surface();if(v.type==="setReviewDisplayMode")return e.setDisplayMode(v.mode),{ok:true,changed:false};if(v.type==="navigateReviewChange"){let T=t(),B=T.findIndex(ee=>ee.isActive),W=v.direction==="next"?1:-1,q=B<0?FV(T,E,W):(B+W+T.length)%T.length,U=T[q],Z=ys(U.item),M=Z?ml(Z.deletion):U.key,J=e.activate(U.key,!U.activatable&&U.revisionKind==="format");return J.ok&&e.reveal({key:M,source:"navigate"}),J}if(v.type!=="resolveAllReviewChanges")return null;let{groups:I,partOps:P,result:C}=l(v,true),O,S=E.commitReviewOps(T=>(O=E.session.applyTreeOpsAtomic(I,{partOps:P,historyToken:T}),O),"revision-resolve");return O?.committed?(e.activate(null),e.resolved?.({action:v.action,resolvedCount:C.resolved.length,skipped:C.skipped.map(({key:T,reason:B,detail:W})=>({key:T,reason:B,...W?{detail:W}:{}}))}),{ok:true,changed:true,revisions:{...C,remaining:n().length}}):pr(S,"the revisions were refused")},x=v=>{let k=Xr(e.placements,v)?.item;return k?.kind==="revision"?k:void 0},w=e.report?e.report.diagnostics.reviewItem(y,x,(v,k)=>{let E=e.surface()?.session,I=E&&de(E,ll(v)[0]);if(!I)return {};try{let C=Aa(I,k,bs(v),void 0,{countRemaining:!1,explicit:!0}).result.skipped[0]?.detail;return {partName:I.name,...C?{detail:C}:{}}}catch{return {partName:I.name}}},e.report.tracked):y;return {can:b,exec:h,resolveReviewItem:w}}function FV(e,t,n){let r=t.state().selection.head,o=de(t.session,r.paragraphId),i=o?Sk(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],c=l.kind==="revision"?l.item.ranges[0]?.start:void 0,d=c?i.get(c.paragraphId):void 0;if(c&&d!==void 0&&(n>0?d>a||d===a&&c.offset>=r.offset:d<a||d===a&&c.offset<=r.offset))return s}return n>0?0:e.length-1}var DV="no eligible selected changes to review",NV="these changes would also resolve changes the filter hides; clear the filter to review them first",HV="these changes would also resolve changes the selection leaves out; decide each card",_V="none of the selected changes can be resolved",BV="some selected changes cannot be resolved";function $V(e){return e.length?e.every(t=>t.detail==="locked-content")?"locked":e.every(t=>t.detail==="bound-content")?"bound":"unsupported":"notFound"}function WV(e,t){return e.length?e.every(n=>n.reason==="incomplete-group")?t?NV:HV:e.every(n=>n.detail==="locked-content")?Ap:e.every(n=>n.detail==="bound-content")?Lp:_V:DV}var qV="retained-structure: the row stays because it holds a nested table with untracked rows",KV="incomplete-group: this change resolves only together with another change, such as the deleted row that holds it; decide that change first";function gH(e){return e.reason==="retained-structure"?qV:e.reason==="incomplete-group"?KV:e.detail==="locked-content"||e.detail==="bound-content"?`${e.detail}: the change stays pending`:e.detail?`${e.reason}: ${e.detail}`:e.reason}function UV(e,t,n){let r=e&&jm(e)?lm(e,ll(t),n):null;return r?{ok:false,code:r==="locked-content"?"locked":"bound",reason:gH({reason:"unsupported-revision",detail:r})}:null}function jV(e,t){let n=new Set(ll(t)),r=Ol(e).filter(o=>n.has(o.node.id));return r.some(o=>o.paragraphMark)&&Fl(e,r,"accept").size>0}function VV(e,t){let n=jl$1(e.root);return n==="everywhere"?true:n.size>0&&(t.ranges.length===0||t.ranges.some(r=>n.has(r.start.paragraphId)||n.has(r.end.paragraphId)))}function fH(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return {ops:[]};if(e.revisionKind==="structural"||e.revisionKind==="moveFrom"||e.revisionKind==="moveTo"||e.revisionKind==="paragraphMark"||VV(n,e)||e.revisionKind==="format"||t==="accept"&&jV(n,e)||GV(n,e)){let a=Aa(n,t,bs(e),void 0,{countRemaining:false,explicit:true}),s=a.result.skipped[0];return s?{ops:[],refusal:gH(s)}:{ops:a.ops}}let o=new Set(ll(e)),i=new Map;for(let a of Ol(n)){if(!o.has(a.node.id))continue;let s=f=>a.node.attributes.find(p=>p.namespaceUri===pa$2&&p.localName===f)?.value,l=e.addresses.find(f=>f.id===s("id")&&f.author===(s("author")??"")&&(f.date??"")===(s("date")??""));if(!l)continue;let c=a.node.localName,d=JSON.stringify([l,c]),u=i.get(d);u?u.siteNodeIds.push(a.node.id):i.set(d,{revision:l,localName:c,siteNodeIds:[a.node.id]});}return {ops:[...i.values()].map(({revision:a,localName:s,siteNodeIds:l})=>({op:r,revision:a,...s===void 0?{}:{localName:s},siteNodeIds:l}))}}function GV(e,t){if(t.revisionKind!=="insert"&&t.revisionKind!=="delete")return false;let n=new Set(ll(t));return n.size>1&&Ol(e).some(r=>r.paragraphMark&&n.has(r.node.id))}function hH(e){return e.kind==="comment"?e.comment.date:e.kind==="revision"?e.date:void 0}function bH(e,t,n,r){return e.type!=="toggleReviewPane"&&e.type!=="toggleParagraphMarks"&&e.type!=="toggleBookmarks"&&e.type!=="setEditingMode"?null:t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.type==="toggleReviewPane"&&!n?{ok:false,code:"unsupported",reason:Kt}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function yH(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}function vH(e){let t=0,n=0,r=mN({changed:()=>{t+=1,e.changed();},error:a=>e.emitError(on("hostCallback",`a bookmark mark callback failed: ${a instanceof Error?a.message:String(a)}`))}),o=yH(a=>{e.surface()?.setShowParagraphMarks(a),e.changed();}),i=yH(a=>{e.surface()?.bookmarkEditing.setShown(a),e.changed();});return {popupChrome:r,chromeSettled(){let a=n===t;return n=t,a},capability:e.capability,surfaceOptions:()=>({showParagraphMarks:o.get(),onToggleParagraphMarks:o.toggle,showBookmarks:i.get(),...r.surfaceOptions}),snapshot:()=>({showParagraphMarks:o.get(),showBookmarks:i.get()}),dialog(a,s){if(a.type==="openGoTo"){let l=r.goTo,c=a.fromShortcut===true;return c&&l.canOpen()&&!l.shortcutOn()&&!e.destroyed()?{ok:false,code:"unsupported",reason:"the Go To shortcut is turned off"}:Fy(c?{canOpen:l.canOpen,open:l.openFromShortcut}:l,e.destroyed(),s,"Go To view")}return a.type!=="openBookmarkDialog"?null:Fy(r.bookmarkDialog,e.destroyed(),s)},toggle(a){if(a.type==="toggleParagraphMarks")o.toggle();else if(a.type==="toggleBookmarks")i.toggle();else return null;return {ok:true,changed:false}},isActive(a){return a.type==="toggleParagraphMarks"?o.get():a.type==="toggleBookmarks"?i.get():null}}}function xH(e,t){return e.session.subscribe(n=>{let r={revision:e.session.packageRevision(),created:n.created,deleted:n.deleted,dirty:n.dirty};n.impact!=="text-local"&&t.refitIfPageResized(),t.bump(),t.emit(r);})}var zV=12;function wH(e,t){if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);return}t.setTimeout(e,0);}function SH(e,t){if(!Or(e))return;let n=()=>{t.current()!==e||!Or(e)||(t.slice(()=>Ic(e,zV))?t.settled():wH(n,t.view()));};wH(n,t.view());}function kH(e,t){let n=false;return {...e,slice:r=>{try{return e.slice(r)}catch(o){let i=t.take();if(!i)throw o;return t.crashed(o),t.mounted(i,o),n=true,true}},settled:()=>{if(n)return;let r=t.take();e.settled(),r&&t.mounted(r);}}}function IH(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}}var RH=new WeakMap;function Jv(e,t){let n=t(e?.matches??[]);return RH.set(n,e?.truncated??false),n}function PH(e){return RH.get(e)}function Wp(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}))?(jy(e,n,t.rId),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"the header or footer could not be opened"}}function ZV(e){return e?.kind==="headerFooter"||e?.kind==="note"}function XV(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function qp(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.activeScope().kind==="frame"&&e.setActiveScope({kind:"body"}),e.exitNote?.(),e.exitHeaderFooter?.());}function TH(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(!vs(e.layout(),r,o))return i;let a=t.scope.owner;if(a){let s=Wp(e,a,{paragraphId:o,offset:0});if(!s.ok)return s}else qp(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:i}let n={paragraphId:t.blockId,offset:t.start};if(ZV(t.scope)){let r=Wp(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"};qp(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 EH(e,t,n,r,o){let i={...o?.matchCase!==void 0?{matchCase:o.matchCase}:{},...o?.wholeWord!==void 0?{wholeWord:o.wholeWord}:{},...e?{stories:XV(e,t)}:{}};if(typeof r=="string")return Jv(e?.session.findText(r,i),n);let a=e?.session.findText(r,i);return r.map((s,l)=>Jv(a?.[l],n))}function Fs(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 CH(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=Fs(o??{},"start",n());}catch{return false}t();let a=e();return a&&qp(a,r),a?.revealParagraph(r,i)??false}}}var OH="cubic-bezier(0.23, 1, 0.32, 1)";function pa(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 MH(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:pa(typeof e=="object"?e.durationMs:void 0,e===true||typeof e=="object"?180:t,"animation.durationMs",1e4)}function Kp(e,t,{marker:n,defaultColor:r},o){let i=[],a=new Map,s=new Set,l=null,c=null,d=r,u=.14,f=4,p=6,g=0,b=r,y="solid",h="",x=180,w=180,v,k=OH,E=nt(()=>t.container()),I,P=0,C=()=>{P++,I!==void 0&&E.clearTimeout(I),I=void 0;},O=$=>{let H=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if($!==void 0&&(typeof $!="string"||!$.trim()||/var\(|^(inherit|initial|unset|revert|revert-layer)$/i.test($.trim())||H?.supports&&!H.supports("animation-timing-function",$)))throw new TypeError("animation.easing must be a CSS timing function without variables.");let j=t.container()?.ownerDocument.defaultView?.KeyframeEffect??globalThis.KeyframeEffect;if($!==void 0&&j)try{new j(null,[],{easing:$});}catch{throw new TypeError("animation.easing must be one valid animation timing function.")}return $},S=($,H)=>pa(typeof $=="object"?$.exitDurationMs:void 0,H,"animation.exitDurationMs",1e4),T=($={})=>{if($.includePrevious!==void 0&&typeof $.includePrevious!="boolean")throw new TypeError("includePrevious must be a boolean.");let H=pa($.opacity,.14,"opacity",1),j=pa($.padding,4,"padding"),N=pa($.borderRadius,6,"borderRadius"),D=MH($.animation),z=S($.animation,D),X=O(typeof $.animation=="object"?$.animation.easing:void 0),F=$.timeoutMs===null?null:pa($.timeoutMs,3e3,"timeoutMs",2147483647),K=$.color??r,V=pa($.borderWidth,0,"borderWidth"),Y=$.borderColor??K,le=$.borderStyle??"solid",oe=$.className??"";if(!["solid","dashed","dotted"].includes(le))throw new TypeError("borderStyle must be solid, dashed, or dotted.");if(typeof oe!="string")throw new TypeError("className must be a string.");let ae=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(typeof K!="string"||!K.trim()||ae?.supports&&!ae.supports("color",K))throw new TypeError("color must be a CSS color or var() expression.");if(ae?.supports&&!ae.supports("color",`color-mix(in srgb, ${K} ${H*100}%, transparent)`))throw new TypeError("color must be valid inside color-mix(), including var() expressions.");if(typeof Y!="string"||!Y.trim()||ae?.supports&&!ae.supports("color",Y))throw new TypeError("borderColor must be a CSS color or var() expression.");if($.changeIds!==void 0&&(!Array.isArray($.changeIds)||$.changeIds.length>1e4||$.changeIds.some(xe=>typeof xe!="string"||!xe)))throw new TypeError("changeIds must contain at most 10000 nonempty string IDs.");return {nextOpacity:H,nextPadding:j,nextRadius:N,nextDuration:D,nextExitDuration:z,nextEasing:X,nextTimeout:F,nextColor:K,nextBorderWidth:V,nextBorderColor:Y,nextBorderStyle:le,nextClassName:oe}},B=()=>v||t.container()?.ownerDocument.defaultView?.getComputedStyle(t.container()).getPropertyValue("--doc-motion-ease-out").trim()||OH,W=$=>{$.animation&&($.animation.onfinish=null,$.animation.cancel(),$.animation=void 0);},q=($,H)=>{W(H),H.element.remove(),a.get($)===H&&a.delete($);},U=()=>(c||(c=t.container()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null,c?.addEventListener("change",M)),c?.matches??false),Z=()=>{c?.removeEventListener("change",M),c=null;};function M(){if(c?.matches){for(let[$,H]of a)W(H),H.exiting&&q($,H);a.size||Z();}}let J=($,H,j,N,D=false)=>{if(!D&&H.target===j&&!H.exiting)return;let z=H.element.ownerDocument.defaultView,X=D?0:Number.parseFloat(z?.getComputedStyle(H.element).opacity??String(H.target));W(H),H.target=j,H.element.style.opacity=String(j);let F=U()?Math.min(N,125):N;if(F===0||typeof H.element.animate!="function"){H.exiting&&q($,H);return}try{let K=H.element.animate([{opacity:Number.isFinite(X)?X:j},{opacity:j}],{duration:F,easing:k});H.animation=K,K.onfinish=()=>{H.animation===K&&(H.animation=void 0,H.exiting&&q($,H),a.size||Z());};}catch{H.exiting&&q($,H);}},ee=()=>{l?.disconnect();let $=t.surface(),H=t.container();if(!$||!H||i.length===0)return;k=B();let j=new Set(i.map(F=>F.paragraphId)),N=e.getRenderScale(),D=e.snapshot().zoom,z=new Set,X=new Set;for(let F of $.layout().pages){let K=H.querySelector(`[data-page-index="${F.index}"] > .docx-page-content`);if(K)for(let V of Ja(F)){if(!j.has(V.paragraphId))continue;let Y=`${F.index}:${V.id}`;z.add(Y);let le=jc$1(V),oe=V.lines.length&&!V.clipToBox?1/0:le.y,ae=V.lines.length&&!V.clipToBox?-1/0:le.y+le.height;for(let He of V.clipToBox?[]:V.lines)oe=Math.min(oe,He.box.y),ae=Math.max(ae,He.box.y+He.box.height);let xe=V.clipToBox?0:f*D,we=F.contentBox.x-F.box.x,at=F.contentBox.y-F.box.y,Se=Math.max(-we*N,le.x*N-xe),Ue=Math.min((F.box.width-we)*N,(le.x+le.width)*N+xe);oe=Math.max(-at*N,oe*N-xe),ae=Math.min((F.box.height-at)*N,ae*N+xe);let _e=a.get(Y);_e&&_e.element.parentElement!==K&&(q(Y,_e),_e=void 0);let Je=!_e;if(!_e){let He=H.ownerDocument.createElement("div");He.setAttribute("data-docx-marker",""),He.setAttribute(n,""),He.setAttribute("contenteditable","false"),He.setAttribute("aria-hidden","true"),He.style.cssText="position:absolute;pointer-events:none;box-sizing:border-box;",_e={element:He,paragraphId:V.paragraphId,target:-1,exiting:false},a.set(Y,_e),K.append(He);}let et=_e.exiting;_e.exiting=false,et&&(_e.target=-1),_e.element.className=h,Object.assign(_e.element.style,{border:g?`${g*D}px ${y} ${b}`:"0",backgroundColor:`color-mix(in srgb, ${d} ${u*100}%, transparent)`,borderRadius:`${p*D}px`,left:`${Se}px`,top:`${oe}px`,width:`${Math.max(0,Ue-Se)}px`,height:`${Math.max(0,ae-oe)}px`}),J(Y,_e,1,Je&&s.has(V.paragraphId)?0:x,Je),X.add(V.paragraphId);}}for(let F of X)s.add(F);for(let[F,K]of a)z.has(F)||(!K.element.isConnected||j.has(K.paragraphId)||w===0?q(F,K):K.exiting||(K.exiting=true,J(F,K,0,w)));l??=new(Ae(H)).MutationObserver(ee),l.observe(H,{childList:true,subtree:true});},fe=()=>{C(),i=[],s.clear(),l?.disconnect();for(let[$,H]of a)q($,H);Z();},se=($={})=>{let H=S($.animation,MH($.animation,w));k=O(typeof $.animation=="object"?$.animation.easing:void 0)??B(),C(),i=[],s.clear(),l?.disconnect();for(let[N,D]of a)D.exiting&&H>0||(D.exiting=true,J(N,D,0,H));a.size||Z();};return e.on("selectionChange",()=>{i.length&&ee();}),{show($,H={}){let{nextOpacity:j,nextPadding:N,nextRadius:D,nextDuration:z,nextExitDuration:X,nextEasing:F,nextTimeout:K,nextColor:V,nextBorderWidth:Y,nextBorderColor:le,nextBorderStyle:oe,nextClassName:ae}=T(H),xe=new Set(i.map(we=>we.paragraphId));if(s=new Set([...s].filter(we=>xe.has(we))),d=V,g=Y,b=le,y=oe,h=ae,u=j,f=N,p=D,x=z,w=X,v=F,i=$,x===0)for(let we of a.values())we.exiting||W(we);if(!i.length){se();return}if(ee(),C(),K!==null){let we=P;I=E.setTimeout(()=>{we===P&&(I=void 0,se(),o());},K);}},validate:T,hide:se,clear:fe,repaint:ee}}function AH(e,t){e.flushPendingInput();let n=Kn(e.session.part(),e.session.paragraphAnchors(),t);return n.ok?n.span:null}function LH(e,t,n){let r=null,o=i=>{if(r)return r;let a=e(),s=Kp(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=Fs(a,"centerIfNeeded",s?.container()??null);if(!Gt(i))return false;n();let c=s?.surface();if(!c)return false;let d=AH(c,i);return !!d&&c.revealPosition({paragraphId:d.nodeId,offset:d.start},l)},highlightAnchor(i,a){let s=t();if(!s)return false;let l=o(s);if(l.validate(a),!Gt(i))return false;n();let c=s.surface();if(!c||!s.container()||s.source)return false;let d=AH(c,i)?.nodeId;return !d||!c.layout().pages.some(f=>Ja(f).some(p=>p.paragraphId===d))&&!(Or(c)&&c.session.paragraphIds().includes(d))?false:(l.show([{paragraphId:d}],a),true)},clearAnchorHighlight(i){let a=t();a&&o(a).hide(i);}}}function FH(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=!!vs(n,i.drawingNodeId,i.hostParagraphId),r.set(a,s)),s})}var YV=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,QV=/^-?[A-Za-z_][A-Za-z0-9_-]*$/,JV=1e4,DH=32,ex=1e3;function eG(e,t,n){let r=e?.ownerDocument.defaultView?.CSS??globalThis.CSS;return !r?.supports||r.supports(t,n)}function NH(e,t,n){if(e!==void 0){if(typeof e!="string"||!e.trim()||!eG(n,"color",e))throw new TypeError(`${t} must be a CSS color or var() expression.`);return e}}function HH(e){if(typeof e!="string"||!YV.test(e))throw new TypeError('Highlight set names are 1 to 64 letters, digits, "-", or "_", starting with a letter.');return e}function tG(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,JV),a=t.length-i.length,s=[],l=new Int32Array(i.length),c=new Int32Array(i.length);for(let[y,h]of i.entries()){if(!(typeof h=="object"&&h!==null&&typeof h.blockId=="string"&&h.blockId.length>0&&Number.isSafeInteger(h.start)&&h.start>=0&&Number.isSafeInteger(h.length)&&h.length>=0&&h.start+h.length<=2147483647&&(h.expectedText===void 0||typeof h.expectedText=="string")))throw new TypeError(`ranges[${y}] must have a blockId string, nonnegative integer start and length, and an optional expectedText string.`);s.push(h.blockId),l[y]=h.start,c[y]=h.start+h.length;}let d=n?.activeIndex??-1;if(!Number.isInteger(d)||d<-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)>ex)throw new RangeError(`priority must be an integer from -${ex} to ${ex}.`);let f=n?.className??"";if(typeof f!="string")throw new TypeError("className must be a string.");let p=f.split(/\s+/).filter(Boolean);if(p.some(y=>!QV.test(y)))throw new TypeError("className must hold space-separated CSS class names.");let g=NH(n?.color,"color",o),b=NH(n?.activeColor,"activeColor",o);return {name:e,ranges:i,overflow:a,blockIds:s,starts:l,ends:c,...g!==void 0?{color:g}:{},...b!==void 0?{activeColor:b}:{},activeIndex:d,classes:p,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 nG(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 rG(e,t,n){return t<=n.from?0:e>=n.oldTo?n.delta:0}var ox=new WeakMap,KH=new WeakMap,_H=new WeakSet,tx=new WeakMap,nx=new WeakMap;function oG(e,t){return ox.has(e)?ox.get(e):typeof e.expectedText=="string"?e.expectedText:(tx.has(e)||tx.set(e,t),tx.get(e))}var rx=new WeakMap;function UH(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=de(e.session,n),o=r?eb$1(r,n):null,i=null;return r&&o&&(rx.has(o)?i=rx.get(o):(i=Jm(r,n),rx.set(o,i))),t.set(n,i),i}}function BH(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=UH(t),s=ff$1(n),l=e.expected===null,c=e.expected??new Array(e.ranges.length).fill(null),d=new Map;for(let u=0;u<e.ranges.length;u+=1){let f=e.ranges[u],p=e.ends[u]>e.starts[u]?a(e.blockIds[u]):null;if(!l&&p!==null&&p===e.seen[u]){e.live[u]=e.resolved[u]&&s.has(e.blockIds[u])?1:0;continue}let g=l?KH.get(f)??nx.get(f)??p:e.seen[u];if(p!==null&&g!==null&&g!==p){let w=e.blockIds[u],v=d.get(w);v?.seen!==g&&(v={seen:g,edit:nG(g,p)},d.set(w,v));let k=rG(e.starts[u],e.ends[u],v.edit);e.starts[u]=e.starts[u]+k,e.ends[u]=e.ends[u]+k;}e.seen[u]=p;let b=e.starts[u],y=e.ends[u],h=p!==null&&y<=p.length?p.slice(b,y):null;if(!l&&p!==null&&h!==c[u]&&g!==null){let w=p.length-g.length,v=b+w>=0?p.slice(b+w,y+w):null;w!==0&&v!==null&&v===c[u]&&(e.starts[u]=b+w,e.ends[u]=y+w,h=v);}l&&(c[u]=oG(f,h),p!==null&&!nx.has(f)&&nx.set(f,p));let x=h!==null&&h===c[u];e.resolved[u]=x?1:0,e.live[u]=x&&s.has(e.blockIds[u])?1:0;}e.expected=c,e.checkedAt={session:r,revision:o,layout:n};}var $H=new WeakMap,WH=new WeakMap,qH=new WeakMap;function iG(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 aG(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}`;qH.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`,qH.set(i,{key:s}));}function sG(e){return e?[...e].sort((t,n)=>t-n).join(","):"*"}function lG(e){return e?[...e].map(([t,n])=>`${t}:${n}`).join(","):""}function jH(e){let t=new Map,n=0,r=0,o=[],i=null,a=null,s=null,l=null,c=()=>[...t.values()].sort((y,h)=>y.priority-h.priority||y.order-h.order);function d(y){let h=e.surface();if(i=y.layer,l=y,!h||t.size===0){y.layer.childElementCount>0&&y.layer.replaceChildren(),o=[],a=null;return}let x=c();for(let C of x)BH(C,h,y.layout);let w=sa(y.layout),v=[r,h.session.packageRevision(),sG(y.pages),y.scale,lG(y.pageOffsetX)].join("|");if(v===a&&w===s&&y.layer.childElementCount>0)return;a=v,s=w;let k=y.layer.ownerDocument,E=[],I=[];for(let C of x){let O=u(C,w,y),S=f(k,C),T=0;for(let B of O){let W=w.pages[B.pageIndex];if(!W)continue;let q=y.pageOffsetX?.get(B.pageIndex)??0,U={set:C,index:B.key,left:(W.contentBox.x+B.x+q)*y.scale,top:(W.contentBox.y+B.y)*y.scale,width:B.width*y.scale,height:B.height*y.scale};aG(k,S,T,U,C),T+=1,I.push(U);}for(;S.childElementCount>T;)S.lastElementChild.remove();E.push(S);}let P=y.layer.children;(P.length!==E.length||E.some((C,O)=>P[O]!==C))&&y.layer.replaceChildren(...E),o=I;}function u(y,h,x){let w=$H.get(y);w||(w=new WeakMap,$H.set(y,w));let v=[],k=new Map;for(let I of h.pages)x.pages&&!x.pages.has(I.index)||(v.push(I),w.has(I)||k.set(I.index,{page:I,rects:[]}));if(k.size>0){let I=ef$1(h,iG(y),new Set(k.keys()),x.measurer);for(let P of I)k.get(P.pageIndex).rects.push(P);for(let{page:P,rects:C}of k.values())w.set(P,C);}let E=[];for(let I of v)for(let P of w.get(I))E.push(P);return y.activeIndex>=0&&E.sort((I,P)=>+(I.key===y.activeIndex)-+(P.key===y.activeIndex)),E}function f(y,h){let x=WH.get(h);if(x)return x;let w=y.createElement("div");return w.className="docx-text-highlight-set",w.setAttribute("data-highlight-set",h.name),h.color&&w.style.setProperty("--doc-text-highlight-set-color",h.color),h.activeColor&&w.style.setProperty("--doc-text-highlight-set-active-color",h.activeColor),WH.set(h,w),w}function p(){r+=1,e.surface()?.repaintHighlights();}function g(y){let h=e.surface();if(!h)return {applied:0,unavailable:y.ranges.length+y.overflow};let x=h.publishedLayout();BH(y,h,x);let w=x.revision!==h.session.packageRevision(),v=0;for(let k=0;k<y.ranges.length;k+=1)v+=w?y.resolved[k]:y.live[k];return {applied:v,unavailable:y.ranges.length-v+y.overflow}}return {members:{setHighlights(y,h,x){HH(y),Array.isArray(h)&&h.length>0&&e.flushOpen();let w=t.get(y),v=tG(y,h,x,w?.order??n,e.container());if(!w&&v.ranges.length>0&&t.size>=DH)throw new RangeError(`At most ${DH} highlight sets exist at once.`);if(v.ranges.length===0)return w&&(t.delete(y),p()),{applied:0,unavailable:0};w||(n+=1),t.set(y,v);let k=g(v);return p(),k},clearHighlights(y){if(y===void 0){if(t.size===0)return;t.clear();}else if(!t.delete(HH(y)))return;p();},getHighlightsAt(y,h){if(!Number.isFinite(y)||!Number.isFinite(h))return [];let x=i;if(!x?.isConnected||o.length===0)return [];let w=x.getBoundingClientRect(),v=y-w.left,k=h-w.top,E=[],I=new Set;for(let P=o.length-1;P>=0;P-=1){let C=o[P];if(v<C.left||v>=C.left+C.width||k<C.top||k>=C.top+C.height)continue;let O=`${C.set.name}\0${C.index}`;if(I.has(O)||t.get(C.set.name)!==C.set)continue;I.add(O);let S=w.left+C.left,T=w.top+C.top;E.push({name:C.set.name,index:C.index,range:C.set.ranges[C.index],start:C.set.starts[C.index],length:C.set.ends[C.index]-C.set.starts[C.index],active:C.index===C.set.activeIndex,rect:{x:S,y:T,left:S,top:T,width:C.width,height:C.height,right:S+C.width,bottom:T+C.height}});}return E}},frame:()=>{let y=e.surface();if(!l||!y)return l;let h=y.session.packageRevision();if(l.layout.revision===h)return l;let x=y.layout();return l.layout===x?l:{...l,layout:x,revision:h}},noteMatches(y){let h=e.surface();if(!h||_H.has(y))return y;let x=FH(h,y);_H.add(x);let w=UH(h);for(let v of x){let k=w(v.blockId);k!==null&&KH.set(v,k);let E=v.start+v.length;ox.set(v,k!==null&&E<=k.length?k.slice(v.start,E):null);}return x},attach(y,h=false){a=null,l=null,h&&t.clear(),y?.setHighlightPainter(d);},reset(){t.size!==0&&(t.clear(),p());}}}var VH=new WeakMap;function GH(e){let t=VH.get(e);if(t)return t;let n=new Map,r=new Map,o=(s,l)=>{if(n.has(l))return;let c=r.get(s);c||(c=[],r.set(s,c)),n.set(l,{story:s,index:c.length}),c.push(l);},i=(s,l)=>{for(let c of Ka$1(l)){for(let d of c.lines)for(let u of Za(d))o(s,u.paragraphId);c.lines.length===0&&o(s,c.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 c of l?.notes??[])i(`notes:${c.noteKind}`,c.fragments);}let a={positions:n,paragraphs:r};return VH.set(e,a),a}function cG(e,t,n,r){let o=(d,u,f)=>{if(f<=u)return;let p=r.get(d);p?p.push({key:t,start:u,end:f}):r.set(d,[{key:t,start:u,end:f}]);},{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 c=n.paragraphs.get(s.story);for(let d=s.index+1;d<l.index;d+=1)o(c[d],0,Number.POSITIVE_INFINITY);}function dG(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 uG(e){let t=e.item;return t.kind==="revision"?t.ranges:t.range?[t.range]:[]}var zH={comment:0,custom:1,revision:2};function ZH(e,t){let n=new Map,r=[];return e.forEach((o,i)=>{for(let a of uG(o)){let s=r.length;r.push({placement:i,width:dG(a,t)}),cG(a,s,t,n);}}),{byParagraph:n,sources:r}}function XH(e,t){return !e.pages||e.pages.has(t.index)}function YH(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 QH(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,c=(r-s.top)/a.scale,d=a.layout.pages.find(v=>{if(!XH(a,v))return false;let k=v.box.x+(a.pageOffsetX?.get(v.index)??0);return l>=k&&l<k+v.box.width&&c>=v.box.y&&c<v.box.y+v.box.height});if(!d)return [];let u=e.placements(o);if(u.length===0)return [];let f=GH(a.layout),{byParagraph:p,sources:g}=ZH(u,f),b=l-(a.pageOffsetX?.get(d.index)??0)-d.contentBox.x,y=c-d.contentBox.y,h=new Map,x=ef$1(sa(a.layout),p,new Set([d.index]),a.measurer);for(let v of x){if(b<v.x||b>=v.x+v.width||y<v.y||y>=v.y+v.height)continue;let k=g[v.key],E=h.get(k.placement);(!E||k.width<E.width)&&h.set(k.placement,{width:k.width,rect:v});}let w=[...h.entries()].map(([v,k])=>({at:v,...k}));return w.sort((v,k)=>{if(v.width!==k.width)return v.width-k.width;let E=u[v.at],I=u[k.at];if(E.kind!==I.kind)return zH[E.kind]-zH[I.kind];if(E.kind==="revision"&&I.kind==="revision"){let P=I.item.nesting-E.item.nesting;if(P!==0)return P}return v.at-k.at}),w.map(v=>({placement:u[v.at],rect:YH(a,s,d,v.rect)}))},getReviewItemRects(n){if(typeof n!="string"||n.length===0)return [];let r=t();if(!r)return [];let{frame:o,origin:i}=r,a=Xr(e.placements,n);if(!a)return [];let s=new Set(o.layout.pages.filter(c=>XH(o,c)).map(c=>c.index)),{byParagraph:l}=ZH([a],GH(o.layout));return ef$1(sa(o.layout),l,s,o.measurer).map(c=>YH(o,i,o.layout.pages[c.pageIndex],c))}}}var fG=new WeakMap,pG=new WeakMap;function mG(e,t){return e.anchorY===t.anchorY&&e.pageIndex===t.pageIndex&&e.activatable===t.activatable&&e.isActive===t.isActive&&e.locked===t.locked}function JH(e,t){let n=t.anchorY===null&&t.pageIndex===null?pG:fG,r=n.get(e);if(r&&mG(r.inputs,t))return r.placement;let o=gG(e,t);return n.set(e,{inputs:t,placement:o}),o}function gG(e,t){let n=hH(e),r={key:ml(e),id:e.id,...n!==void 0?{date:n}:{},activatable:t.activatable,anchorY:t.anchorY,pageIndex:t.pageIndex,isActive:t.isActive};return e.kind==="comment"?{...r,kind:"comment",author:e.comment.author,initials:$l$1(e.comment),text:Zl$1(e.comment),resolved:e.resolved,...e.parentId!==void 0?{parentId:e.parentId}:{},...e.parentRevisionId!==void 0?{parentRevisionId:e.parentRevisionId}:{},replyIds:e.replyIds,readOnly:false,item:e}:e.kind==="revision"?{...r,kind:"revision",revisionKind:e.revisionKind,author:e.author,initials:eL(e.author),text:_b$2(e.text),...e.replacedText?{replacedText:_b$2(e.replacedText)}:{},replyIds:e.replyIds,readOnly:e.readOnly||t.locked,item:e}:{...r,kind:"custom",author:"",initials:"",text:e.detail??e.text,replyIds:[],readOnly:true,item:e}}function hG(e){return e==="password"?{ok:false,code:"locked",reason:e2}: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 e2="this document is protected with a password; open it in Word to change that";function t2(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 c=l.session.settingsRoot();return (c!==o||i===null)&&(o=c,i=c?jj$1(c):ij$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:e2}:!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 c=r();c!==t&&(t=c,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 c=s();if(c&&!c.ok)return c;let d=e.surface(),u=!a().enforced,f=d.applyHeaderFooterLifecycle?.({op:"setDocumentProtection",enforce:u});return f?f.ok?(e.publish(),{ok:true,changed:true}):hG(f.reason):{ok:false,code:"unsupported",reason:"document protection is not available"}}}}function n2(e,t){return Og(e.revisionsIn,t)}function r2(e,t){let n=Cu(e);return {current:()=>n,set(r){if(!t.enabled)return {ok:false,code:"unsupported",reason:Kt};let o;try{o=Cu(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=>n2(n,o)),opensOnLoad:r=>n.opening==="auto"&&r.some(o=>n2(n,o)),opensOnTrackedChange:()=>n.opening==="auto"&&n.revisionsIn==="pane",pairsReplacements:()=>n.revisionsIn==="balloons"}}function o2(e,t){let n=sl(t)?.partName;if(!n||!e||n===e.part().name)return null;for(let r of e.headerFooterResolutionBySection())for(let o of ["header","footer"]){let i=o==="header"?r.headers:r.footers;for(let a of i.values())if(a.partName===n)return {kind:o,rId:a.rId}}return null}function i2(e,t){let n=sl(t)?.partName;if(!n||!e)return null;for(let r of ["footnote","endnote"])if(pj$1(e.currentPackage(),r)?.name===n)return {kind:"notesPart",noteKind:r};return null}var Up=class e{constructor(t,n){this.positions=t;this.blocks=n;}positions;blocks;[Symbol.toStringTag]="Map";static from(t){let n=new Map,r=[];for(let[o,i]of t){let a=n.size;n.set(o,a);let s=Math.floor(a/64);(r[s]??=[]).push(i);}return new e(n,r)}updated(t){let n,r=new Map;for(let[o,i]of t){let a=this.positions.get(o);if(a===void 0)throw new Error("Cannot update an absent review anchor");let s=Math.floor(a/64),l=a%64;if(this.blocks[s][l]===i)continue;let c=r.get(s);c||(c=[...this.blocks[s]],r.set(s,c),(n??=[...this.blocks])[s]=c),c[l]=i;}return n?new e(this.positions,n):this}get size(){return this.positions.size}has(t){return this.positions.has(t)}get(t){let n=this.positions.get(t);return n===void 0?void 0:this.blocks[Math.floor(n/64)][n%64]}keys(){return this.positions.keys()}*values(){for(let t of this.blocks)yield*t;}*entries(){for(let[t,n]of this.positions)yield [t,this.blocks[Math.floor(n/64)][n%64]];}[Symbol.iterator](){return this.entries()}forEach(t,n){for(let[r,o]of this)t.call(n,o,r,this);}};function u2(e){let t=a2();if(!e)return t;let n=a2(),r=new WeakMap;return o=>{let i=t(o),a=r.get(i);if(!a){let s=()=>n(qb(o));r.set(i,a=new ax(i,s,e));}return a}}var ax=class{constructor(t,n,r){this.stories=t;this.boxes=n;this.hostOf=r;}stories;boxes;hostOf;[Symbol.toStringTag]="Map";hosted=new Map;get(t){let n=this.stories.get(t);if(n)return n;let r=this.hosted.get(t);if(r===void 0){let o=this.boxes().get(t);if(o)return this.hosted.set(t,o),o;let i=this.hostOf(t),a=i===null?void 0:this.stories.get(i);r=a?{pageIndex:a.pageIndex,contentY:a.contentY,fragmentY:a.fragmentY}:null,this.hosted.set(t,r);}return r??void 0}has(t){return this.get(t)!==void 0}get size(){return this.stories.size}forEach(t,n){this.stories.forEach((r,o)=>t.call(n,r,o,this));}entries(){return this.stories.entries()}keys(){return this.stories.keys()}values(){return this.stories.values()}[Symbol.iterator](){return this.stories[Symbol.iterator]()}};function a2(){let e=new WeakMap,t=null;return n=>{let r=e.get(n);if(r)return r;let o=t&&yG(t,n);if(o)return e.set(n,o),t={pages:yh$1(n.pages),index:yh$1(o)},o;let i=new Map;for(let s of n.pages)for(let[l,c]of cd$1(s))i.has(l)||i.set(l,c);for(let s of n.pages)for(let[l,c]of sx(s))i.has(l)||i.set(l,c);let a=Up.from(i);return e.set(n,a),t={pages:yh$1(n.pages),index:yh$1(a)},a}}function s2(e,t){if(e.size!==t.size)return false;for(let n of e.keys())if(!t.has(n))return false;return true}var l2=new WeakMap;function sx(e){let t=l2.get(e);if(t)return t;let n=new Map;for(let r of [e.header,e.footer])r&&d2(n,r.fragments,e.index,r.box.y);for(let r of [e.footnotes,e.endnotes])if(r)for(let o of r.notes)d2(n,o.fragments,e.index,o.box.y);return l2.set(e,n),n}var c2=e=>cd$1(e);function yG(e,t){let n=e.pages.deref(),r=e.index.deref();if(!n||!r||n.length!==t.pages.length)return null;let o=null;for(let[i,a]of t.pages.entries()){let s=n[i];if(a===s)continue;let l=c2(a),c=c2(s);if(!s2(l,c))return null;let d=sx(a),u=sx(s);if(!s2(d,u))return null;o??=new Map;for(let[f,p]of l)r.get(f)===c.get(f)&&o.set(f,p);for(let[f,p]of d)r.get(f)===u.get(f)&&o.set(f,p);}return o?r.updated(o):r}function d2(e,t,n,r){for(let o of Ka$1(t))for(let i of ab$1(o))e.has(i)||e.set(i,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}var ix=new WeakSet;function f2(e,t,n){if(ix.has(e))return;ix.add(e);let r=()=>{ix.delete(e),n();};typeof t.requestIdleCallback=="function"?t.requestIdleCallback(r,{timeout:1e3}):t.setTimeout(r,200);}var p2=new WeakMap;function g2(e){let t=p2.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 Ka$1(i.fragments))for(let s of ab$1(a))n.has(s)||n.set(s,i.scopeId);return p2.set(e,n),n}var m2=new WeakMap;function h2(e){let t=m2.get(e);if(t)return t;let n=new Map;for(let[r,o]of db$1(e).entries())n.set(o,r);return m2.set(e,n),n}var bG={"open.zip-corrupt":"damaged","open.zip-invalid-entry-name":"damaged","open.xml-malformed":"damaged","open.content-types-invalid":"damaged","open.relationships-invalid":"damaged","open.unsupported-source":"not-docx","open.missing-main-document":"not-docx","open.zip-entry-limit":"too-large","open.zip-size-limit":"too-large","open.zip-ratio-limit":"too-large","open.xml-part-size-limit":"too-large","open.xml-depth-limit":"too-large","open.xml-element-limit":"too-large","open.relationship-limit":"too-large","open.part-limit":"too-large","open.xml-dtd-forbidden":"blocked","open.invalid-limits":"unknown","open.failed":"unknown"};function lx(e){return Object.freeze({code:e,reason:bG[e]??"unknown"})}function y2(e){let t=null,n=null;return {get parseError(){return t},get failure(){return n},reject(r,o,i){t=i?`${r}: ${i}`:r,n=lx(A(r,o));},refuseSource(r,o=false){let i=_E(r);return o||(t=i,n=lx("open.unsupported-source"),e()),i},crash(){t="open failed",n=lx("open.failed"),e();},clear(){t=null,n=null;}}}function b2(e,t){if(e==="")return;let n=(t??globalThis).navigator?.clipboard;if(n?.writeText)try{n.writeText(e).catch(()=>{});}catch{}}function cx(e,t,n){if(e===""&&(t===null||t===""))return;let r=n??globalThis,o=r.navigator?.clipboard;if(!o)return;let i=r.ClipboardItem,a=r.Blob;if(t&&o.write&&i&&a)try{let s=new i({"text/plain":new a([e],{type:"text/plain"}),"text/html":new a([t],{type:"text/html"})});o.write([s]).catch(()=>{b2(e,n);});return}catch{}b2(e,n);}function vG(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function xG(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function v2(e){return x2(e.children)}function x2(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||hc$1(n))&&t.push(n);return t}function wG(e){if(hc$1(e))return x2(kc$1(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(...v2(r));return t}function SG(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"?hd$1(i):fd$1(i).find(p=>r.part==="header"||r.part==="footer"?p.kind===r.part:p.kind==="note"&&Rc$1(p.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=v2(s),c;for(let p=0;p<t.path.length;p+=1){let g=t.path[p];if(!Number.isInteger(g)||g<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(c=l[g],!c)return {ok:false,code:"notFound",reason:`block index ${g} is out of range`};p<t.path.length-1&&(l=wG(c));}if(!c||c.kind!=="paragraph"||!eb$1(i,c.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let d=(Jm(i,c.id)??"").length,u=t.offset??(n==="start"?0:d);if(!Number.isInteger(u)||u<0||u>d)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let f={paragraphId:c.id,offset:u};return {ok:true,selection:{anchor:f,head:f}}}function jp(e,t,n){if(vG(t))return SG(e,t,n);if(!Gt(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=Et(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=Kn(a,r,t);if(!s.ok)return s;let l=n==="start"?s.span.start:s.span.end,c={paragraphId:s.span.nodeId,offset:l};return {ok:true,selection:{anchor:c,head:c}}}function Vp(e,t){if(!xG(t)){let o=jp(e,t,"start");if(!o.ok)return o;let i=jp(e,t,"end");return i.ok?{ok:true,selection:{anchor:o.selection.anchor,head:i.selection.head}}:i}let n=jp(e,t.from,"start");if(!n.ok)return n;let r=jp(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function kG(e){return e.evenPage?"even":e.firstPage?"first":"default"}function w2(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'"}:kG(e)}function dx(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?w2(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 IG(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 jc(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}:IG(n.reason)}function Gp(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 S2(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=w2(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let i=o,s=Gp(e,n,r,i)?.rId,l=false;if(!s){let d=jc(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:i,...i==="first"?{titlePage:true}:{},...i==="even"?{evenAndOddHeaders:true}:{}});if(!d.ok)return d;l=true,s=Gp(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 k2(e,t){let n=dx(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,i=jc(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 I2(e,t){let n=dx(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=jc(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;if(o){let a=Gp(e,n.sectionIndex,n.kind,n.variant);a?e.enterHeaderFooter({rId:a.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return i}function R2(e,t){let n=dx(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=jc(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;let s=Gp(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 P2(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return jc(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 T2(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 E2(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 C2(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 O2(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 M2(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 A2(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 L2(e){return b$2(e)?{ok:false,code:"unsupported",reason:e}:{ok:false,code:rp(e)||e==="the table of contents is generated and read-only"||e===ia?"invalidArgs":"locked",reason:e}}function H2(e,t,n){switch(t.type){case "toggleMark":{let r=Xh.get(t.mark),o=e.toggleRunProperty(r.localName,r.attributes);if(o)return L2(o);break}case "setMarkAttr":{let r=Yh(t);if(!r.ok)return {ok:false,code:r.code,reason:r.reason};let o=e.setRunProperty(r.localName,r.attributes);if(o)return L2(o);break}case "clearFormatting":e.clearFormatting();break;case "copyFormatting":return e.formatPainter.capture()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:Ju};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:Oh};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??Oh};break}case "setLineSpacing":e.setParagraphProperty("spacing",Ip({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...Ts("before",t.beforePt),...Ts("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,c=i??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,c):Math.min(l,c),i=t.orientation==="landscape"?Math.min(l,c):Math.max(l,c);}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 VT(e);case "insertText":if(e.type(t.text),e.state().lastRejection==="the table of contents is generated and read-only"||e.state().lastRejection===ia)return {ok:false,code:"invalidArgs",reason:e.state().lastRejection};break;case "deleteText":if(jn(e))return Iy(e,{type:"deleteImage"},n?.editor);e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let i=Vp(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 "replaceMatch":return AE(e,t);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 "removeToc":if(!e.removeToc(t.tocId))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be removed"};break;case "editHeaderFooter":return S2(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return k2(e,t);case "linkHeaderFooterToPrevious":return I2(e,t);case "unlinkHeaderFooterFromPrevious":return R2(e,t);case "setHeaderFooterOptions":return P2(e,t);case "setWatermark":return EE(e,t.watermark);case "insertBookmark":case "deleteBookmark":case "keepFirstBookmark":case "goToBookmark":return CC(e,t);case "insertPageField":return T2(e,t);case "insertNote":return E2(e,t);case "deleteNote":return C2(e,t);case "convertNote":return O2(e,t);case "convertAllNotes":return M2(e,t);case "setNoteProperties":return A2(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(!Yo(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Tr({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",...nf(e)});return e.applyTableCommandPlan(r)}case "selectAll":return e.selectAll(),{ok:true,changed:false};case "copy":{let r=e.copyFlavours();return r.reason?ux(r.reason):(cx(r.text,r.html,F2(n?.editor)),{ok:true,changed:false})}case "cut":{let r=e.copyFlavours();if(r.reason)return ux(r.reason);cx(r.text,r.html,F2(n?.editor)),e.deleteSelection();break}case "paste":{let r=t.html?jo(t.html):null,o=r?Fc(r.bytes):null;if(o)return ux(o==="chart"?"chart-content":"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&&Qh(t.range)){let a=N2(e,t.range);return a.ok?(e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}let r="anchor"in t&&Gt(t.anchor)?{anchor:t.anchor}:"range"in t&&Xi(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=OE(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let i=N2(e,o.selection);return i.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):i}default:return rc(t)?Iy(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function ux(e){return {ok:false,code:"unsupported",reason:e==="chart-content"?Lc:e}}function F2(e){return e?Ae(wo(e)):void 0}function D2(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 Ka$1(o.fragments))if(i.paragraphId===t)return o.scopeId}return null}function RG(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 Ka$1(i.fragments))if(a.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function PG(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 N2(e,t){let n=Et(e.session,t.head.paragraphId,{kind:"body"}),r=Et(e.session,t.anchor.paragraphId,{kind:"body"});if(!PG(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=RG(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=D2(e,t.head.paragraphId);return i?(t.anchor.paragraphId===t.head.paragraphId?i:D2(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 TG=new Set(["resolveAllReviewChanges","setReviewChangesAuthor","proposeInsertion","proposeDeletion","proposeReplacement","replaceMatch","toggleMark","setMarkAttr","setAlignment","setParagraphDirection","clearFormatting","setLineSpacing","setParagraphSpacing","setParagraphStyle","setParagraphFormat"]),EG=Object.freeze({ok:false,code:"unsupported",reason:"historyGroup must be an open handle from this editor and document; begin a new group after end(), detach, or load"}),fx=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,lastOutcome:null},r=CG(n,new WeakRef(this));return this.records.set(r,n),r}owns(t){return t!==void 0&&t===this.owner()}validate(t){let n=t?.historyGroup;return n===void 0?null:this.token(n)===void 0?EG:null}token(t){let n=this.records.get(t);return n&&t.state==="open"?n.token:void 0}gate(t,n){let r=this.validate(n);return r||n?.historyGroup===void 0?r:TG.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 d=Cs(t,void 0,o);return n&&this.diagnoseWrites(n,d),d}let s,l=Jn(a.token,(d,u)=>s={kind:d,reason:u},()=>Cs(t,a.token,o));if(!l.ok)return l;let c=this.settle(a,s);return c.kind==="started"&&n?this.diagnoseWrites(n,l,true):this.burst=void 0,{...l,history:c}}automationFrames(t){let n=this.token(t)===void 0?void 0:this.records.get(t);if(!n)return null;let r=[];return {bind:(o,i)=>{let a,s=Jn(n.token,(l,c)=>a={kind:l,reason:c},()=>Cs(o,n.token,i));return a&&r.push(a),s},finish:()=>{if(r.length===0)return null;this.burst=void 0;let o=r.find((i,a)=>i.kind==="split"||a>0&&i.kind==="started");return this.settle(n,o?{kind:"split",reason:o.reason}:r[0])}}}settle(t,n){let r=n?.kind==="split"||n?.kind==="started"&&t.committed,o=n===void 0?{kind:"none",reason:"no-history"}:r?{kind:"split",reason:n.reason??(t.undoEpoch!==this.undoEpoch?"undo-redo":"history-boundary")}:{kind:n.kind};return n&&(t.committed=true,t.undoEpoch=this.undoEpoch),t.lastOutcome=o,o.kind==="split"&&this.diagnose({kind:"split",reason:o.reason??"history-boundary"}),o}};function CG(e,t){return Object.freeze({get state(){return !e.closed&&t.deref()?.owns(e.owner?.deref())?"open":"closed"},get lastOutcome(){return e.lastOutcome},end(){e.closed=true,e.owner=void 0;}})}function _2(e,t,n){let r={generation:-1,token:{}};return new fx(()=>{let{mounted:o,generation:i}=e();return o?(r.generation!==i&&(r={generation:i,token:{}}),r.token):null},t,n)}var B2={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none",collaborationStatus:"inactive",pageCount:0};function $2(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:mC(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`,collaborationStatus:e.collaborationStatus,pageCount:e.pageCount}}function W2(){let e={...B2};return {moved(t,n){let r=$2(t,n),o=cf(r.selection,e.selection)&&r.pendingFormat===e.pendingFormat&&r.headerFooter===e.headerFooter&&r.drawingIntent===e.drawingIntent&&r.formatPainter===e.formatPainter&&r.collaborationStatus===e.collaborationStatus,i=r.pageCount!==e.pageCount;return e=r,o?i?"pages":"nothing":"state"},adopt(t){e=$2(t.state(),t);},reset(){e={...B2};}}}var q2=512*1024;function OG(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 c=n-22;c>=o;c-=1)if(r.getUint32(c,true)===101010256){i=c;break}if(i<0)return false;let a=r.getUint16(i+10,true),s=r.getUint32(i+16,true),l=0;for(let c=0;c<a;c+=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 MG=2e3,AG=40;function K2(e){let t=null,n=()=>Ae(e.node?.()??null),r=()=>{if(!t)return null;let{bytes:o}=t;return t.cancel(),t=null,o};return {shouldYield:o=>typeof n().requestAnimationFrame=="function"&&typeof n().cancelAnimationFrame=="function"&&(o.byteLength>=q2||OG(o,q2)),schedule(o){let i=nt(()=>e.node?.()??null),a=null,s=null,l=e.prepare?()=>e.prepare(o):null,c=false,d=false,u=b=>{try{return b()}catch(y){throw t===g&&(t=null,e.scheduled()),y}},f=()=>{if(c)return;if(l){let y=l;l=null;let h;try{h=y();}catch{}if(typeof h=="function"){l=h,Cc(f,n());return}if(!h){a=i.setTimeout(f,0);return}let x=true,w=()=>{x&&(x=false,a!==null&&i.clearTimeout(a),a=i.setTimeout(f,0));};a=i.setTimeout(w,MG),h.then(w,w);return}d=true,u(()=>e.mount(o));let b=()=>{if(c||t!==g)return;let y=!e.continueOpen||u(()=>e.continueOpen(AG));if(!(c||t!==g)){if(!y){Cc(b,n());return}t=null,e.continueOpen&&e.scheduled();}};e.continueOpen?Cc(b,n()):t===g&&(t=null,e.scheduled());},p=i.requestAnimationFrame(()=>{s!==null&&i.clearTimeout(s),s=null,a=i.setTimeout(f,0);});s=i.setTimeout(()=>{i.cancelAnimationFrame(p),f();},250);let g={bytes:o,mounted:()=>d,cancel:()=>{c=true,i.cancelAnimationFrame(p),a!==null&&i.clearTimeout(a),s!==null&&i.clearTimeout(s);}};t=g,e.scheduled();},cancel:r,flush(){let o=t;if(!o)return;let i=o.mounted();r();try{if(i||e.mount(o.bytes),e.continueOpen)for(;!e.continueOpen(Number.POSITIVE_INFINITY););}catch(a){throw e.scheduled(),a}i&&e.scheduled();},isScheduled:()=>t!==null}}var mx=40,px=16,U2=32,gx=new WeakMap;function hx(e,t){let n=Qk(t.contentLockPolicy);return n?{...e,contentLockPolicy:n}:e}function LG(e,t,n$1){let r=mg(e),o=()=>{let i=performance.now()+mx;for(;;){let a=r.next();if(a.done){let s=n(a.value,t);return gx.set(e,s),n$1(s)}if(performance.now()>=i)return o}};return o}function j2(e){let t=gx.get(e);return t===void 0?{}:(gx.delete(e),{openedSession:t,progressiveOpen:true})}function V2(e,t,n){return r=>LG(r,e(),o=>{let i=o.ok?t(r,o.session):null;return o.ok&&i?FG(o.session,i,n):void 0})}function G2(e){let t=null;return {set(n){t=n;let r=e();r&&Rb(r,n);},adopt:n=>Rb(n,t)}}function FG(e,t,n){let r=e.part().root.children.find(g=>g.kind==="body"),o=r?.kind==="body"?r.children:[],i=[];for(let g of o.slice(0,kc)){if(g.kind==="table")for(let b of g.children)i.push(b);i.push(g);}let a=[];for(let g=0;g<o.length;){let b=o[g];if(b.kind==="table"){for(let x=0;x<b.children.length;x+=U2){let w=x;a.push(()=>{sH(e,b,w,w+U2);});}a.push(()=>Yv(e,[b])),g+=1;continue}let y=g;for(;y<o.length&&y-g<px&&o[y].kind!=="table";)y+=1;let h=o.slice(g,y);a.push(()=>Yv(e,h)),g=y;}let s=0,l=0,c=false,d,u=ab$2(e.part().root),f=[()=>{let g=performance.now()+mx;return u(()=>performance.now()>=g)},()=>(e.reviewItems(),true)],p=()=>{if(!t())return;let g=performance.now()+mx;if(!c){for(;s<a.length&&performance.now()<g;)a[s++]();return s<a.length||(c=true,d=n()),p}if(l<i.length){for(;l<i.length&&performance.now()<g;)gf$1(i.slice(l,l+px)),l+=px;return p}let b=f[0];return b?(b()&&f.shift(),p):d};return p}function z2(e){return {...e.tableInteractionLabel?{tableInteractionLabel:e.tableInteractionLabel}:{},...e.imageDecodePort?{imageDecodePort:e.imageDecodePort}:{},...e.lockedControlNavigation==="atomic"?{lockedControlNavigation:"atomic"}:{}}}function Z2(e){let t=[];return Object.assign(r=>{for(let o of [...e.customNodeDiagnostics,...t])try{o(r);}catch{}},{observe(r){t.push(r);}})}function X2(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function Y2(e){return e.kind==="comment"}function Q2(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 c=e.openStoryOrder();a=c.get(r.paragraphId)??-1,s=c.get(o.paragraphId)??-1;}if(a===-1||s===-1){let c=zC(t);a=c.get(r.paragraphId)??-1,s=c.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 NG(e){let t=new Map;for(let n of e){let r=n.item;if(!Y2(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 HG(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(Y2);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 J2(e,t,n){if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:e.proReviewReason};if(e.editingMode==="viewing"){let u=e.surface?.commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"comment-resolve"),f="the document is open for viewing";return pr(u??f,f,"locked")}let r=e.placements({pairReplacements:false}),o=HG(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=NG(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 u=i.get(a.parentId);if(!u)break;a=u;}let l=false,c=false,d=e.surface.commitReviewOps(u=>{let f=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(a.id,n,{historyToken:u}),c=l&&e.surface.session.packageRevision()!==f,{committed:c}},"comment-resolve");return l?(c&&e.bump(),{ok:true,changed:c}):pr(d,"the comment could not be resolved","notFound")}function e_(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 _G=Object.freeze({ok:false,code:"invalidArgs",reason:"pass the author as a string and options last, or options alone in place of the author"});function t_(e,t){if(e==null||typeof e=="string")return [e??void 0,t];let n=typeof e=="object"?Object.getPrototypeOf(e):void 0;return !(n===null||n!==void 0&&Object.getPrototypeOf(n)===null)||Array.isArray(e)||t!==void 0?_G:[void 0,e]}function n_(e){let t=(i,a)=>{let s=e.historyGroups.validate(i);if(s)return s;let l=e.surface();return l?e.historyGroups.run(l,void 0,i,a):a()},n=(i,a)=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Kt};let s=e.surface();s?.flushPendingInput();let l=e.commentTargetRange();if(!l||!s)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let c=(a??e.author()??"").trim();if(c.length===0||i.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let d=null,u=s.commitReviewOps(f=>(d=s.session.replyToComment(null,{paragraphId:l.from.paragraphId,start:l.from.offset,end:l.to.offset,...l.to.paragraphId===l.from.paragraphId?{}:{endParagraphId:l.to.paragraphId}},i,c,j$1(),e.storyScopeOfParagraph(l.from.paragraphId),void 0,{historyToken:f}),{committed:d!==null}),"comment-add");return d===null?pr(u,"the comment could not be committed"):{ok:true,changed:true}},r=i=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Kt};let a=e.surface(),s=Xr(e.placements,i)?.item;if(!s||!a)return {ok:false,code:"notFound",reason:"no review item with that key"};if(s.kind==="revision")return e.resolveReviewItem(i,"reject");if(s.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};let l=false,c=a.commitReviewOps(d=>{let u=e.noteHomeOf(s),f=u===null?null:Ic$1(u);return l=a.session.deleteComment(s.id,e.storyScopeOfReviewItem(s),f?.noteId,{historyToken:d}),{committed:l}},"comment-delete");return l?(e.bump(),{ok:true,changed:true}):pr(c,"the comment could not be deleted")},o=(i,a,s)=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Kt};let l=e.surface();l?.flushPendingInput();let c=Xr(e.placements,i)?.item,d=ys(c)?.insertion??c;if(!d||!l)return {ok:false,code:"notFound",reason:"no review item with that key"};let u=sl(d);if(!u)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let f=(s??e.author()??"").trim(),p=e_(d,a,f);if(p)return p;let g=d.kind==="comment"?d.id:null,b=null,y=l.commitReviewOps(h=>(b=l.session.replyToComment(g,{paragraphId:u.start.paragraphId,start:u.start.offset,end:u.end.offset},a,f,j$1(),e.storyScopeOfReviewItem(d),void 0,{historyToken:h}),{committed:b!==null}),"comment-reply");return b===null?pr(y,"the reply could not be committed"):{ok:true,changed:true}};return {addComment:(i,a,s)=>{let l=t_(a,s);if(!Array.isArray(l))return l;let[c,d]=l;return t(d,()=>n(i,c))},acceptReviewItem:(i,a)=>t(a,()=>e.resolveReviewItem(i,"accept")),rejectReviewItem:(i,a)=>t(a,()=>e.resolveReviewItem(i,"reject")),setCommentResolved:(i,a,s)=>t(s,()=>J2({reviewEnabled:e.reviewEnabled,editingMode:e.editingMode(),placements:e.placements,surface:e.surface(),proReviewReason:Kt,bump:e.bump},i,a)),deleteReviewItem:(i,a)=>t(a,()=>r(i)),replyToReviewItem:(i,a,s,l)=>{let c=t_(s,l);if(!Array.isArray(c))return c;let[d,u]=c;return t(u,()=>o(i,a,d))}}}var r_=new WeakMap;function o_(e,t){t&&r_.set(e,t);}function i_(e){return r_.get(e)}var yx=new WeakMap;function a_(e,t){yx.set(e,t);}function s_(e,t){return yx.get(e)?.automationFrames(t)??null}function l_(e,t){return yx.get(e)?.token(t)!==void 0}function c_(e,t,n){a_(e,t),o_(e,n);}var BG=1e4;function d_(e,t){return t?[e,l$3(t)]:[e]}function u_(e,t){if(!t)return false;try{let n=new Set((t.sources??[]).map(o=>h$2(o.request))),r=new Set((t.substitutions??[]).map(o=>`${h$2(o.from)}>${h$2(o.to)}`));return (e.sources??[]).every(o=>n.has(h$2(o.request)))&&(e.substitutions??[]).every(o=>r.has(`${h$2(o.from)}>${h$2(o.to)}`))}catch{return false}}function f_(e){let t=new Map,n=(r,o=false)=>{let i=t.get(r);i!==void 0&&(globalThis.clearTimeout(i),t.delete(r),o||e.changed());};return {pending:()=>t.size>0,clear:()=>{for(let r of t.values())globalThis.clearTimeout(r);t.clear();},settle:r=>{r&&n(r.token,true);},track(r,o,i,a){let s={};t.set(s,globalThis.setTimeout(()=>n(s),e.waitMs??BG)),r.then(l=>{if(!a())return n(s);let c;try{if(typeof l!="object"||l===null)return n(s);for(let d of k$2(l))e.report(d);if(!j$3(l))return n(s);c=i$2(o,l);}catch(d){return e.report(d),n(s)}e.deliver(i,{full:c,token:s});},()=>n(s));}}}var $G=Object.freeze(["Arial","Calibri","Cambria","Consolas","Courier New","Garamond","Georgia","Helvetica","Open Sans","Roboto","Times New Roman","Verdana"]),WG=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function p_(e,t,n){let r=new Map,o=l=>{if(l===void 0||!WG.test(l))return;let c=l.toLowerCase();r.has(c)||r.set(c,l);};o(g$2(e));let i=e?.substitutions??[],a=new Set(i.map(l=>l.to.family.toLowerCase()));for(let l of i)o(l.from.family);for(let l of e?.sources??[])a.has(l.request.family.toLowerCase())||o(l.request.family);for(let l of a$4([e?.supportedFamilies]))o(l);for(let l of $G)(r.has(l.toLowerCase())||!n||n(l))&&o(l);for(let l of t)o(l);let s=[...r.values()];return s.sort((l,c)=>l<c?-1:l>c?1:0),s}var m_=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),g_=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 h_(e,t){return J$1(e,t)}function bx(e,t,n){return K$2(e,t,n)}var y_=new WeakMap;function qG(e){let t=e.packageRevision(),n=y_.get(e);if(n?.revision===t)return n.faces;let r=e.symbolFontFamilies().length>0?l$2(e.storyParts().map(o=>o.root)):[];return y_.set(e,{revision:t,faces:r}),r}function b_(e){let t=e.renderedFontFamilies(),n=qG(e);if(n.length===0)return t;let r=new Set(t.map(i=>i.toLowerCase())),o=n.filter(i=>!r.has(i.toLowerCase()));return o.length===0?t:[...t,...o]}var v_=a$1;function xn(e,t){if(!e)throw new Error(t)}function x_(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 w_(e,t=0){xn(e instanceof Uint8Array&&e.length>=12&&e.length<=v_,"Unsupported font byte length"),xn(Number.isSafeInteger(t)&&t>=0,"Invalid face index");let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=(v,k)=>{xn(Number.isSafeInteger(v)&&Number.isSafeInteger(k)&&v>=0&&k>=0&&v+k<=e.length,"Font range exceeds source");},o=v=>String.fromCharCode(...e.subarray(v,v+4));if(o(0)!=="ttcf")return xn(t===0,"Face index requires a collection"),xn([65536,1330926671,1953658213].includes(n.getUint32(0)),"Unsupported SFNT version"),e.slice();let i=n.getUint32(4);xn(i===65536||i===131072,"Unsupported TTC version");let a=n.getUint32(8);xn(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 c=n.getUint32(l);xn([65536,1330926671,1953658213,1954115633].includes(c),"Unsupported face version");let d=n.getUint16(l+4);xn(d>0,"Missing face tables"),r(l,12+d*16),xn(l>=s,"Selected directory overlaps collection header");let u=[[0,s],[l,l+12+d*16]],f=[],p=new Set;for(let v=0;v<d;v++){let k=l+12+v*16,E=o(k),I=n.getUint32(k+8),P=n.getUint32(k+12);xn(/^[\x20-\x7e]{4}$/.test(E)&&!p.has(E),"Invalid or duplicate table tag"),p.add(E),r(I,P);for(let[C,O]of u)xn(P===0||I>=O||I+P<=C,"Table overlaps collection directory");f.push({name:E,offset:I,length:P,destination:0});}let g=f.filter(v=>v.length>0).sort((v,k)=>v.offset-k.offset);for(let v=1;v<g.length;v++)xn(g[v].offset>=g[v-1].offset+g[v-1].length,"Selected face tables overlap");let b=f.find(v=>v.name==="head");xn(b&&b.length>=54,"Missing or truncated head table"),f.sort((v,k)=>v.name<k.name?-1:v.name>k.name?1:0);let y=12+d*16;for(let v of f)v.destination=y,y+=v.length+3&-4,xn(y<=v_,"Standalone face exceeds byte ceiling");let h=new Uint8Array(y),x=new DataView(h.buffer);x.setUint32(0,c),x.setUint16(4,d);let w=2**Math.floor(Math.log2(d));x.setUint16(6,w*16),x.setUint16(8,Math.log2(w)),x.setUint16(10,d*16-w*16);for(let[v,k]of f.entries()){let E=12+v*16;for(let I=0;I<4;I++)h[E+I]=k.name.charCodeAt(I);h.set(e.subarray(k.offset,k.offset+k.length),k.destination),k.name==="head"&&x.setUint32(k.destination+8,0),x.setUint32(E+4,x_(h.subarray(k.destination,k.destination+k.length))),x.setUint32(E+8,k.destination),x.setUint32(E+12,k.length);}return x.setUint32(b.destination+8,2981146554-x_(h)>>>0),h}var S_=Object.freeze({installed:0,alias:()=>{},showIn(){},dispose(){}});function KG(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 zp=e=>e.trim().toLowerCase();function Zp(e){let t=e??(typeof globalThis.document<"u"?globalThis.document:void 0),n=t?.fonts,r=t?.defaultView?.FontFace;return !n||typeof r!="function"?{}:{fontSet:n,createFontFace:(o,i,a)=>new r(o,i.slice().buffer,a)}}async function k_(e,t=Zp(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return S_;let i=new Map;for(let f of e){let p=zp(f.request.family),g=i.get(p);g?g.push(f):i.set(p,[f]);}let a=new Map,s=[],l$1=[],c=f=>{let p=f.bytes,g=p.length>=4&&p[0]===116&&p[1]===116&&p[2]===99&&p[3]===102;if(g&&f.faceIndex===0&&!l(p,0).valid)throw new Error("Invalid collection face");if(!g&&f.faceIndex!==0)throw new Error("Font face index requires a collection");return g&&f.faceIndex!==0?w_(p,f.faceIndex):p};if(await Promise.all([...i].map(async([f,p])=>{let g=KG(p.map(y=>`${y.hash}:face:${y.faceIndex}`)),b=false;await Promise.all(p.map(async y=>{try{let h=c(y),x={weight:String(y.request.weight),style:y.request.style},w=o(g,h,x);await w.load(),r.add(w),s.push({set:r,face:w}),l$1.push({alias:g,source:y,descriptors:x}),b=!0;}catch{}})),b&&a.set(f,g);})),s.length===0)return S_;for(let f of n){let p=zp(f.from.family);if(a.has(p))continue;let g=a.get(zp(f.to.family));g!==void 0&&a.set(p,g);}let d=false,u=new WeakSet([r]);return {installed:s.length,alias:f=>d?void 0:a.get(zp(f)),showIn(f){if(d)return;let p=Zp(f);if(!(!p.fontSet||!p.createFontFace||u.has(p.fontSet))){u.add(p.fontSet);for(let{alias:g,source:b,descriptors:y}of l$1)try{let h=p.createFontFace(g,c(b),y);p.fontSet.add(h),s.push({set:p.fontSet,face:h}),h.load().catch(()=>{});}catch{}}},dispose(){if(!d){d=true;for(let{set:f,face:p}of s)try{f.delete(p);}catch{}}}}}function I_(e,t){let n=[];for(let r of e){let o=t.resolve(r.request);if(o instanceof d||o.id!==r.id)continue;let{id:i,hash:a,faceIndex:s}=o;n.push({request:r.request,id:i,get bytes(){return o.bytes},hash:a,faceIndex:s});}return n}var xx=44,Vc=.1,Gc=5;var Ds={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},UG={type:"fit",fit:"pageWidth"},Xp={type:"fixed"};function Yp(e){return e==="auto"?Ds:!e||typeof e!="object"?null:e.type==="fixed"?Xp:e.type==="fit"&&e.fit==="pageWidth"?Qp(e,Ds)?Ds:e:null}function Qp(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 wx(e,t,n="float"){return e?.type!=="fit"?t:n==="shrinkPage"?e.minZoom!==void 0&&Number.isFinite(e.minZoom)?vx(e.minZoom):.1:e.maxZoom!==void 0&&e.maxZoom<5?e.maxZoom:null}function Ns(e){return e.type==="fit"}function R_({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)?vx(r):.1,l=Number.isFinite(o)?vx(o):5,c=Math.floor(a/t*100)/100;return Math.min(Math.max(c,s),Math.max(l,s))}function vx(e){return Math.min(Math.max(e,.1),5)}var jG=88;function VG(e,t=false){let n=Nt(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:jG,c=l/2,d=Number.parseFloat(o?.getPropertyValue("--docx-nav-shift")??""),u=Number.parseFloat(o?.getPropertyValue("--docx-review-gutter-start")??""),f=(Number.isFinite(d)?d:0)+(Number.isFinite(u)?u:c)-c;return Math.max(r-l-Math.max(f,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 P_(e){let t=null,n=null,r=nt(()=>n),o=null,i=null;function a(){o!==null&&(r.cancelAnimationFrame(o),o=null);}function s(){let c=e.mode();if(!Ns(c))return;let d=e.container();if(!d)return;let u=e.reviewPaneScrolls?.()===true&&wx(c,e.zoom())!==null,f=VG(d,u);if(f===null)return;let p=e.pageWidthPx();if(p===null)return;i=e.pageWidthTwips();let g=R_({availableWidthPx:f,pageWidthPx:p,...c.minZoom!==void 0?{minZoom:c.minZoom}:{},...c.maxZoom!==void 0?{maxZoom:c.maxZoom}:{}});if(g===null||g===e.zoom())return;let b=Nt(d),y=b!==null&&b.scrollLeft===0;e.applyZoom(g),y&&b&&b.scrollLeft!==0&&(b.scrollLeft=0);}function l(){if(!n||typeof Ae(n).requestAnimationFrame!="function"){s();return}r.migrate(),o===null&&(o=r.requestAnimationFrame(()=>{o=null,s();}));}return {refitIfPageResized(){let c=e.pageWidthTwips();c===null||c===i||s();},attach(){this.detach();let c=e.container();if(!c)return;let d=Nt(c);if(!d)return;n=d;let u=Ae(d);typeof u.ResizeObserver=="function"&&(t=new u.ResizeObserver(l),t.observe(d)),s();},refit:s,detach(){a(),t?.disconnect(),t=null,n=null,i=null;}}}function E_(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=Yp(e.zoomMode??(n!==null?Xp:"auto"))??Ds;function i(l,c){if(l===r)return c?.(),true;let d=t.surface();return d&&!Sb(d,l*(96/72))?false:(r=l,c?.(),t.bump(),t.emitSelectionChange(),true)}function a(){o=Xp,s.detach();}let s=P_({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:()=>{Ns(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 c=Ns(o);return l===r?c?(a(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:i(l,c?a:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let c=Yp(l);return c?Qp(c,o)?{ok:true,changed:false}:(o=c,Ns(c)?s.attach():s.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(l)}`}}}}function T_(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function C_(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:T_(r.box),contentBox:T_(r.contentBox)})):[]}}}var O_=new Map;function M_(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=g$1(o,t);return n={slots:o,colors:t,value:i},i},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:f$1(t)}),r.value.get(o))}}function A_(e){let t=Dk(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 L_(e){let t=e.mode,n=e.translate,r=n?p(n):o$1,o=A_(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:i=>ry(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?p(i):o$1;return n$1(r)===n$1(a)?(r=a,null):(r=a,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(i){let a=A_(i);return o.locale===a.locale?null:(o=a,o.labels)}}}function F_(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 XG=Object.freeze({kind:"body"}),YG=Object.freeze([]);function QG(e){let t=GI(e.fontShaping),n,r=null,o$1=null,i$1=null,a$3=-1,s=()=>i$1!==null,l=L_(e),c=$b(e.author),d$1=e.container??null,u=a$2(e.modules),f=Z2(u),p=u.review!==null,g=r2(u.review?.pane,{enabled:p,changed:(A,ne)=>{sn&&A.revisionsIn!==ne.revisionsIn&&!g.shows(M?.session.reviewItems()??[])&&(sn=false),Ce(),Ee(),mn.refit();}}),b=null,y=new WeakMap,h=K2({mount:A=>ya(A),prepare:V2(()=>hx(Qv(u,f),e),(A,ne)=>r===A?null:(i$1=ne,()=>i$1===ne),()=>_e.schedule(true)),scheduled:()=>{Ce(),Ee();},node:()=>d$1}),x=l.mode()==="view"?"viewing":"editing",w=null,v,k=false,E=gA(g.pairsReplacements,()=>M),I=op(),P=M_(e.revisionStyles),C=i(),O=false,S=false,T=null,B=()=>({reviewEnabled:p,hasAuthor:!!c}),W=false,q=null,U=WE({stillMissing:()=>!X&&c===void 0&&Yn(null)===zr,emit:A=>rt(A)}),Z=l.openingModeDecision(B());Z.mode!==null&&(x=Z.mode),Z.rejection!==null&&(T=Z.rejection),U.report(Z.rejection);let M=null,J=MO(e.unsupportedElementRules,()=>M),ee=null,fe=G2(()=>M),se=y2(()=>{Ce(),Ee();}),$=null,H=W2(),j=false,N=()=>{j||(j=true,globalThis.queueMicrotask(()=>{j=false,X||Ee();}));},D,z=vH({surface:()=>M,destroyed:()=>X,changed:()=>(Ce(),Ee()),emitError:A=>rt(A),capability:A=>bH(A,X,p,ka)}),X=false,F,K,V=null,Y=()=>{},le=0;function oe(){V?.dispose(),V=null;}let ae=0,xe=0,we=uH(),at=e.fonts,Se,Ue=()=>typeof at=="function"?Se:at,_e=dH(()=>{let A=i$1??M?.session;if(X||!A)return null;let ne=i$1?void 0:ro().formatting?.fontFamily;return {generation:we.generation,dynamic:typeof at=="function",families:()=>cH(A,ne,g$2(Ue()))}},async(A,ne)=>{let ie=i$1?{session:i$1}:M;et.settle(ne);try{ie&&await Jp(ae,ie,A,ne?.full);}finally{ne&&!X&&(Ce(),Ee());}}),Je=false,et=f_({deliver:(A,ne)=>_e.deliver(A,ne),changed:()=>(Ce(),Ee()),report:A=>_s($i(A))}),He=null,st=()=>M?.session.documentFonts()??[],an=A=>!!at&&!Ue()||$e(A),$e=A=>(He||(He=eH(d$1?ii(d$1.ownerDocument):null)),He(A)),lt=new Set,Mt=new Set,Bt=A=>lt.has(A.toLowerCase())||V?.alias(A)!==void 0,fi=()=>!M||Je||et.pending()?YG:nH(b_(M.session),Bt,$e,Mt),mr=0,eo=null,Xe,Ye=null,gt=-1,Pe=0,ga=-1,sn=false,je=e.reviewDisplayMode??(p?"all-markup":"proposed");if(!["all-markup","simple-markup","proposed","original"].includes(je))throw new TypeError("Invalid reviewDisplayMode");if(e.reviewDisplayMode&&e.reviewDisplayMode!=="proposed"&&!p)throw new TypeError("reviewDisplayMode requires a review module");let pi=ip({fieldResults:e.fieldResults,collaborationModel:u.collaboration??void 0}),Gn=t2({surface:()=>M,destroyed:()=>X,editingMode:()=>x,hostViewOnly:()=>l.mode()==="view",publish:()=>{Ce(),Ee();},decision:()=>ln(),tracking:En,adopt:A=>{T=A.rejection??Yn(null),A.mode!==null&&(S=A.mode==="viewing",be(A.mode)),Ce(),Ee();}});function Ce(){mr+=1;}let fn=X1(ro,()=>d$1?.ownerDocument??null),{emitError:rt,emitDocumentChange:to,emitSelectionChange:Ee}=fn,Lt=uN({modules:u,events:fn,customNodes:f,onOpenCrash:se.crash}),ha=()=>x==="suggesting",Pn=IN(e.revisionMarkup,{container:()=>d$1,surface:()=>M,viewing:()=>x==="viewing"||l.mode()==="view",destroyed:()=>X,contribution:()=>u.review,translate:()=>l.translate(),apply:A=>{M?.setRevisionMarkup(A),Ce();},changed:A=>{Ee(),fn.emitRevisionMarkupChange(A);}});function mi(A){Pn.destroyDialogs(),V?.showIn(A),mn.detach(),mn.attach(),Ce(),Ee();}let pn=()=>{};function zn(){pn(),Pn.destroyDialogs(),$?.(),$=null,M?.destroy(),M=null,H.reset(),Pe+=1;}let mn=E_(e,{container:()=>d$1,surface:()=>M,bump:Ce,emitSelectionChange:Ee,reviewPaneScrolls:()=>g.current().overflow==="scroll"}),gi=()=>mn.scale(),Lo=jH({surface:()=>M,container:()=>d$1,flushOpen:()=>h.flush()});function ya(...A){let ne=n?.source!==void 0;try{if(r===A[0]){r=null,no(A[0],{immediate:!0,continueDeferredRefresh:!0});return}wn(...A),ne&&M&&Or(M)?o$1=A[0]:n?.mounted(A[0]);}catch(ie){if(Lt.openCrashed(ie),n?.mounted(A[0],ie),!ne)throw ie}}function ba(){return {unsupportedElementRules:J.current(),scale:gi(),...z.snapshot(),defaultFontFamily:g$2(Ue()),translate:l.translate(),drawingStrings:l.drawingStrings(),locale:l.locale(),...c?{author:c}:{},...P.current()!==void 0?{revisionStyles:P.current()}:{},reviewAuthorSlots:C,revisionAuthorVisibility:I,revisionMarkup:Pn.markup.current(),...hx(Qv(u,f),e),pairsReplacements:E.lightsPair,...F?{measurer:F,...K?{producer:K}:{}}:{},...V?{fontAlias:V.alias}:{},...z2(e),...pi.mode==="editable"?{fieldResults:pi.mode}:{}}}function wn(A,ne,ie){if(ie??=y.get(A),y.delete(A),i$1=null,!d$1){zn(),b=A,ie&&y.set(A,ie),se.clear(),Lt.openDeferred(),Ce();return}Lt.openMounting(),zn();let Oe=I.stateKey,Te=Kc(d$1,A,{...ba(),...z.surfaceOptions(),initialSelection:ne,initialTextFormInput:ie,editingMode:x==="suggesting"?"suggest":x==="viewing"?"view":"edit",revisionDisplayMode:p?je:"proposed",...Lt.surfaceHooks(ha,()=>M),...j2(A),...u.collaboration?{collaborationModel:u.collaboration}:{},onHostMoved:mi,onTrackedChange:()=>{sn||!g.opensOnTrackedChange()||(sn=true,Ce(),Ee());},tocLabels:l.tocLabels(),onChange:Le=>{if(!M)return;Ce(),Gn.sync(),_e.schedule();let ht=M?.session.packageRevision(),Fe=ht!==D;if(D=ht,p&&d$1&&M&&!Fe){let We=M;f2(We,Ae(d$1),()=>{M===We&&We.session.reviewItems().length>0&&Zn(We.publishedLayout());});}let Ge=p&&je!==M.revisionDisplayMode();Ge&&(je=M.revisionDisplayMode());let Ft=Oe!==I.stateKey||Ge;Oe=I.stateKey;let Ne=H.moved(Le,M);!Ft&&Ne==="nothing"||(!Ft&&Ne==="pages"?N():Ee());}});if(!Te.ok){se.reject(Te.reason,Te.limit,Te.detail),Ce(),rt(on(Te.reason,`failed to open document: ${Te.reason}`)),Lt.openRejected(Te.reason,Te.limit,Te.detail);return}se.clear(),M=Te.surface,V?.showIn(d$1.ownerDocument),a$3=ae,Lo.attach(M,n?.source!==void 0),Gn.prime(),sn=p&&g.opensOnLoad(M.session.reviewItems()),H.adopt(M),q!==null?Sa(q,false):Ws(),X2(M,u);let Ve=M;Or(Ve)?SH(Ve,kH({current:()=>M,view:()=>Ae(d$1),slice:Le=>Lt.continueOpen(Le),settled:()=>Lt.openSettled(Ve)},{take:()=>[o$1,o$1=null][0],crashed:Le=>Lt.openCrashed(Le),mounted:(Le,ht)=>n?.mounted(Le,ht)})):Lt.openSettled(Ve),Pe+=1,M.setEditable(x!=="viewing"),ee!==null&&M.setRemoteCaretLabelHost(ee),fe.adopt(M),w!==null&&M.setReviewActivationExclusions(w,{formattingKinds:v}),$=xH(Te.surface,{refitIfPageResized:()=>mn.refitIfPageResized(),bump:Ce,emit:to}),n?.contentMounted(A),mn.attach(),Ce(),to({revision:M.session.packageRevision(),source:n?.source??"load"}),Ee(),_e.schedule(true);}function no(A,ne={}){let ie=ne.immediate??false;if(ne.continueDeferredRefresh||(xe+=1),ie||(h.cancel(),o$1=null),se.clear(),i$1=null,r=null,n?.source&&!ie&&d$1&&h.shouldYield(A)){r=A,h.schedule(A);return}y=new WeakMap,Lt.openStarted(A),sn=false,ae+=1;let Oe=we.advance();try{C=i(),I.showAll(),va(),et.clear(),d$1&&!n?.source&&RL(d$1),!ie&&d$1&&h.shouldYield(A)?(zn(),h.schedule(A)):ya(A);}finally{Oe.cancelPrevious();}}function va(){F=void 0,K=void 0,Se=void 0,lt=new Set,Mt=new Set,oe(),Y(),Y=()=>{},Je=false;}function Hs(){if(va(),M){let A=Zv(d$1,gi(),M.session),ne=`${A.producer}+fonts:${++le}`,ie=g$2(Ue()),Oe={measurer:A.measurer,producer:ne,defaultFontFamily:ie};Ib(M,{...Oe,fontAlias:void 0},false);}Ce(),Ee();}function _s(A,ne=ae,ie=we.generation){fN(A,{config:e,events:fn,diagnostics:Lt},()=>!X&&ne===ae&&ie===we.generation);}async function Jp(A,ne,ie,Oe){let Te=we.capture(),Ve=()=>!X&&A===ae&&Te.current(),Le=Ge=>_s(Ge,A,Te.generation),ht=at,Fe=ne.session.embeddedFonts();if(!(!ht&&Fe.length===0)&&!(Oe&&u_(Oe,Se))){!Oe&&!Se&&c$2().catch(()=>{}),Je=true,Ce();try{let{plan:Ge,request:Ft}=F$2(ne.session,ie,Ue()),Ne={...Ft,signal:Te.signal},ct=!!d$1&&ii(d$1.ownerDocument)!==null?I$1(Ge.fallbacks,$e):Ge.fallbacks,Jt=({cause:It})=>Le($i(It)),Qn=Oe?await s$1(d_(Oe,Se),Ne,{onOriginFailure:Jt}):typeof ht!="function"?ht:Se?await s$1([Se,o(It=>ht(It))],Ne,{onOriginFailure:Jt}):await ht(Ne),{now:Mn,later:io}=Qn?h$1(Qn):{now:Qn},gn=typeof ht=="function"||Oe?b$3(Mn):Mn;if(!Ve()){A===ae&&Te.current()&&(Je=!1);return}if(Se=Mn,io&&et.track(io,Mn,Te.generation,Ve),Fe.length===0&&(!gn||Mn?.supportedFamilies?.length&&!b$3(Mn))){Je=!1,Ce(),Ee();return}let qs=(gn&&"maxFontBytes"in gn?gn.maxFontBytes:void 0)??a$1,yr=h_(gn?.sources??[],qs),br=yr.sources;for(let It of yr.dropped)Le(m_(It));let An=bx(Fe,br,qs),en=!1,Ks=()=>{if(!en){en=!0;for(let It of An.dropped)Le(g_(It));}},tn=G$3(f$4({epoch:A,...gn,sources:br},An),Ge,ct);if(tn.sources.length===0){Ks(),Je=!1,Ce(),gn&&Le(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let nn=await $l(tn,void 0,t),Ia=()=>Ve()?!1:(t$1(nn),A===ae&&Te.current()&&(Je=!1),!0);if(Ia())return;let yt=It=>{Ks(),It&&t$1(It),Je=!1,Ce();},vi=(It,Dr)=>{let Nr=new Set;for(let ao of Dr.sources??[]){let so=It.fonts.resolve(ao.request);so instanceof d&&(Le($i(so)),Nr.add(h$2(ao.request)));}return Nr},Ra=vi(nn,tn);try{if(Ra.size>0){let It=br.filter(wi=>!Ra.has(h$2(wi.request))),Dr=It.length!==br.length;Dr&&(An=bx(Fe,It,qs));let Nr=An.sources.filter(wi=>Dr||!Ra.has(h$2(wi.request))),ao=nn;if(tn=G$3(f$4({epoch:A,...gn,sources:It},{sources:Nr}),Ge,ct),tn.sources.length===0)return yt(ao);if(nn=await $l(tn,void 0,t),t$1(ao),Ia())return;let so=vi(nn,tn);if(so.size>0){let wi=It.filter(Wt=>!so.has(h$2(Wt.request))),Ta=An.sources.filter(Wt=>!so.has(h$2(Wt.request))),Us=nn;if(tn=G$3(f$4({epoch:A,...gn,sources:wi},{sources:Ta}),Ge,ct),tn.sources.length===0)return yt(Us);if(nn=await $l(tn,void 0,t),t$1(Us),Ia())return}}}finally{Ks();}let Pa=I_(tn.sources,nn.fonts),xi=await k_(Pa,Zp(d$1?.ownerDocument),tn.substitutions??[]);if(!Ve()){xi.dispose(),Ia();return}let Do={embeddedFaces:V,coveredFontFamilies:lt,documentSubstitutedFamilies:Mt,shapedMeasurer:F,shapedProducer:K,disposeShapedFonts:Y};try{V=xi,d$1&&xi.showIn(d$1.ownerDocument),lt=rH(Pa,tn.substitutions??[]),Mt=D$3(tn,Ge,nn.fonts,gn?.substitutions);let It=Zv(d$1,gi(),ne.session,V?.alias),Dr=QN(nn,tn,It,gi(),++le,Nr=>Ve()&&Le(Nr));if(F=Dr.measurer,K=Dr.producer,Je=!1,M&&a$3===A&&Ib(M,{measurer:F,producer:K,fontAlias:V?.alias,defaultFontFamily:g$2(Ue())}),!Ve()){xi.dispose(),t$1(nn);return}}catch(It){throw Ve()&&({embeddedFaces:V,coveredFontFamilies:lt,documentSubstitutedFamilies:Mt,shapedMeasurer:F,shapedProducer:K,disposeShapedFonts:Y}=Do),xi.dispose(),t$1(nn),It}Y=()=>t$1(nn),Do.disposeShapedFonts(),Do.embeddedFaces?.dispose(),Ce(),Ee();}catch(Ge){if(!Ve())return;Je=false,Ce(),Le($i(Ge));}}}let Zc=zh();function gr(){let A=M?.state()??null;return {scope:M?.activeScope?.()??XG,isLoading:se.parseError===null&&M===null&&b===null&&!h.isScheduled(),isOpening:h.isScheduled()&&!n?.source,parseError:se.parseError,openFailure:se.failure,editable:M!==null&&M.session.editable&&l.mode()!=="view"&&x!=="viewing"&&!(d$1&&sr(d$1)),zoom:mn.zoom(),zoomMode:mn.mode(),selection:hf(M),selectionCollapsed:A===null||A.selection.anchor.paragraphId===A.selection.head.paragraphId&&A.selection.anchor.offset===A.selection.head.offset,formatting:OC(M),table:bf(M),tocContext:Zc(A?.contextTocId??null),image:Zr(M),page:{current:Hy(M),total:ds(M)},canUndo:A?.canUndo??false,canRedo:A?.canRedo??false,pageSetup:MC(h,M),reviewPaneOpen:sn,reviewPane:g.current(),...z.snapshot(),documentProtection:Gn.state(),revisionMarkup:Pn.markup.current(),reviewDisplayMode:M&&p?M.revisionDisplayMode():je,hasReviewContent:M?.session.hasReviewContent()??false,hiddenReviewAuthors:I.hiddenAuthorList,collaborationStatus:A?.collaborationStatus??"inactive",editingMode:x,lastRejection:T??A?.lastRejection??null,fontSubstitutions:fi(),formatPainter:A?.formatPainter??ef}}let Fr;function ro(){if(eo&&ga===mr)return eo;let A=eo,ne=Ue()===Fr;Fr=Ue();let ie=z.chromeSettled(),Oe=c===Xe&&ie;Xe=c;let Te=M?.state().selection??null,Ve=cf(Te,Ye);Ye=Te;let Le=M?.session.packageRevision()??-1,ht=Le===gt;gt=Le;let Fe=gr(),Ge=Fe;if(A){let Ft=Uh(Fe.formatting,A.formatting)?A.formatting:Fe.formatting,Ne=jh(Fe.page,A.page)?A.page:Fe.page,We=Vh(Fe.pageSetup??null,A.pageSetup??null)?A.pageSetup:Fe.pageSetup,ct=Gh(Fe.selection,A.selection)?A.selection:Fe.selection,Jt=fy(Fe.image,A.image)?A.image:Fe.image,Qn=A.fontSubstitutions!==void 0&&Fe.fontSubstitutions!==void 0&&A.fontSubstitutions.length===Fe.fontSubstitutions.length&&Fe.fontSubstitutions.every((Mn,io)=>A.fontSubstitutions[io]===Mn)?A.fontSubstitutions:Fe.fontSubstitutions;Ge={...Fe,formatting:Ft,page:Ne,pageSetup:We,selection:ct,image:Jt,fontSubstitutions:Qn},Zh(Ge,A)&&Ve&&ht&&Oe&&ne&&(Ge=A);}return eo=lf(Ge),ga=mr,eo}if(e.document){let A=Jh(e.document);A?no(A):(rt(on("unsupported",se.refuseSource(e.document))),Lt.openRejected("unsupported"));}let Yt=fL({surface:()=>M,activeKey:Tn,paneOpen:()=>sn,selectionAnchor:()=>$s()?.anchorY??null,authorFilterKey:()=>I.stateKey});function Xc(A){return sl(A)===null||A.kind==="custom"&&!A.carded?false:!(A.kind==="revision"&&w!==null&&w.includes(A.revisionKind)&&(A.revisionKind!=="format"||v===void 0||v.includes(A.formattingKind??"")))}let Zn=u2(A=>wf(M,A)),$t=A=>o2(M?.session,A),hi=A=>i2(M?.session,A);function vt(A){let ne=sl(A),ie=M?.publishedLayout();return !ne||!ie?null:g2(ie).get(ne.start.paragraphId)??null}function Bs(A){let ne=$t(A);return ne!==null?{kind:"headerFooter",rId:ne.rId}:hi(A)??{kind:"body"}}function Yc(){return Q2({surface:M,bodyOrder:()=>{let A=M?.publishedLayout();return A?h2(A):new Map},openStoryOrder:Qc})}function xa(){let A=M?.activeScope();if(A?.kind==="headerFooter")return {kind:"headerFooter",rId:A.rId};if(A?.kind==="note"){let ne=Ic$1(A.id);if(ne)return {kind:"notesPart",noteKind:ne.noteKind}}return {kind:"body"}}function Qt(A){if(!M)return {kind:"body"};let ne=A.indexOf("#"),ie=ne===-1?de(M.session,A)?.name:A.slice(0,ne);if(ie===void 0)return xa();if(ie.length===0||ie===M.session.part().name)return {kind:"body"};for(let Oe of M.session.headerFooterResolutionBySection())for(let Te of [Oe.headers,Oe.footers])for(let Ve of Te.values())if(Ve.partName===ie)return {kind:"headerFooter",rId:Ve.rId};for(let Oe of ["footnote","endnote"])if(pj$1(M.session.currentPackage(),Oe)?.name===ie)return {kind:"notesPart",noteKind:Oe};return xa()}function Qc(){if(!M)return new Map;let A=xa();if(A.kind==="body")return new Map;let ne=new Map;for(let[ie,Oe]of M.session.paragraphIdsIn(A).entries())ne.set(Oe,ie);return ne}function yi(A){if(A.kind==="revision"){let ie=A.ranges;if(ie.length===0)return null;let Te=A.revisionKind==="replace"||A.revisionKind==="insert"||A.revisionKind==="delete"?ie[ie.length-1]:ie[0];return {start:ie[0].start,end:Te.end}}let ne=sl(A);return ne?{start:ne.start,end:ne.end}:null}function $s(){if(M&&M.activatedReviewKey()!==null)return null;let A=Yc(),ne=M?.publishedLayout();if(!A||!ne)return null;let ie=Zn(ne).get(A.from.paragraphId);return ie?{pageIndex:ie.pageIndex,anchorY:ie.contentY+$c$1(ie,A.from.paragraphId,A.from.offset)}:null}function Tn(){return M?.activeReviewKey()??null}let Fo=XN(),wa=YN();function Xn(A){if(!p)return [];let ne=I.filterItems(M?.session.reviewItems()??[]),ie=mA(ne,A),Oe=A?.placement!==false,Te=null;if(Oe&&ie.length>0){let We=M?.publishedLayout()??null;We&&(Te=Zn(We));}let Ve=Vf(()=>ne,Tn(),E.lightsPair()),Le=We=>{let ct=$t(We);return ct===null?1:ct.kind==="header"?0:2},ht=M?.session.packageRevision()??-1,Fe=Fo(ie,Te,ht,Le),{geometries:Ge,order:Ft}=Fe,Ne=QE(M);return wa(ie,Te!==null,Ft.map(We=>{let ct=ie[We];return JH(ct,{anchorY:Ge[We]?.y??null,pageIndex:Ge[We]?.pageIndex??null,activatable:jf(ct).every(Xc),isActive:Ve.size>0&&jf(ct).some(Jt=>Ve.has(ml(Jt))),locked:Ne})}))}function En(){return M?.session.trackingSettings()??Xj$1}function ln(A=x,ne=O){let ie=En();return oy({...B(),viewOnly:l.mode()==="view",hostChoseMode:l.mode()!==void 0,readerChoseMode:ne,currentMode:A,trackRevisions:ie.trackRevisions,restrictedToTrackedChanges:ie.restrictedToTrackedChanges,restrictedToForms:ie.restrictedToForms,restrictedToReadOnly:ie.restrictedToReadOnly,restrictedToComments:ie.restrictedToComments,engineAdoptedViewing:S})}function be(A){q=null,x=A,M?.setEditingMode(A==="suggesting"?"suggest":A==="viewing"?"view":"edit"),M?.setEditable(A!=="viewing");}function Yn(A){return A!==null?A:x==="suggesting"&&c===void 0?zr:W?zr:O?null:l.openingModeDecision(B()).rejection}function Ws(){let A=ln();T=Yn(A.rejection),A.mode!==null&&(S=A.mode==="viewing",be(A.mode));}function Sa(A="editing",ne=true){if(h.isScheduled()){q=A;return}q=null;let ie=jE(l.mode(),B(),En(),x,A,S);S=ie.mode==="viewing"&&l.mode()!=="view",ie.mode!==x&&be(ie.mode),T=Yn(ie.rejection),U.report(ie.configurationRejection),ne&&(Ce(),Ee());}function ka(A){let ne=l.mode()==="view";return UE(ne,B,En,A)}let hr=mH({surface:()=>M,enabled:()=>p,destroyed:()=>X,viewing:()=>x==="viewing",placements:Xn,authorVisibility:I,scope:Bs,reveal:A=>fn.emitReviewItemReveal(Cb(Xn,A)),resolved:A=>{fn.hasReviewChangesResolvedHandlers()&&fn.emitReviewChangesResolved(hA(Xn,A));},activate:(A,ne)=>{k=ne??false;try{return On.setActiveReviewItem(A,{announce:!1})}finally{k=false;}},setDisplayMode:A=>{je=A,M?.setRevisionDisplayMode(A),Ce(),Ee();},report:{diagnostics:Lt,tracked:()=>x==="suggesting"}}),{resolveReviewItem:Jc}=hr,Cn=_2(()=>({mounted:!!M&&!!d$1,generation:Pe}),fn.emitHistoryDiagnostic,()=>JSON.stringify(M?.state().selection)),bi=n_({reviewEnabled:p,historyGroups:Cn,surface:()=>M,author:()=>c,editingMode:()=>x,commentTargetRange:Yc,storyScopeOfParagraph:Qt,storyScopeOfReviewItem:Bs,noteHomeOf:vt,placements:Xn,resolveReviewItem:Jc,bump:Ce}),On={beginHistoryGroup(){return h.flush(),Cn.begin()},get mountGeneration(){return Pe},get surface(){return M},...z.popupChrome.setters,stateVersion:()=>mr,fontMeasurement:()=>({measurer:F&&!s()?"shaped":"fixed",resolving:Je||et.pending()||s(),...F&&K&&!s()?{producer:K}:{}}),async setFonts(A){if(X)throw on("destroyed","a destroyed editor cannot replace fonts");let ne=++xe;if(h.flush(),M?.flushPendingInput(),X||ne!==xe)return;let ie=we.advance(),Oe=()=>!X&&ie.current();try{at=A,Se=void 0,Je=!1,et.clear(),A||Hs();}finally{ie.cancelPrevious();}let Te=Y;Oe()&&await _e.schedule(true),A&&Oe()&&Y===Te&&Hs();},attach(A,ne){let ie=eR(A);if(ie)return rt(on("invalidTarget",ie));if(d$1!==A&&n?.invalidate(),X){rt(on("destroyed","this editor was destroyed; create a new instance to remount"));return}if(M&&d$1===A)return M.moveTo(A,ne);let Oe=h.cancel();if(Oe&&(zn(),b=Oe),mn.detach(),d$1=A,He=null,M){pn(),M.moveTo(A,ne),Pe+=1,mi(A.ownerDocument);return}let Te=b;b=null,Te&&h.shouldYield(Te)?h.schedule(Te):Te?ya(Te):Ce();},detach(){if(n?.invalidate(),X)return;mn.detach();let A=h.cancel();A?(zn(),b=A):M&&(Pn.destroyDialogs(),pn(),M.park(),Pe+=1),d$1=null,He=null,Ce(),Ee();},load(A){let ne=Jh(A);if(!ne){let ie=M!==null||b!==null||h.isScheduled();rt(on("unsupported",se.refuseSource(A,ie))),Lt.openRejected("unsupported");return}n?.invalidate(),Lo.reset(),no(ne);},save(){return h.flush(),_A(M,M?.hostElement()??d$1,()=>M)},getDocumentHandle(){return Object.freeze({revision:M?.session.packageRevision()??0})},exec(A,ne){let ie=wb(d$1,A)??Cn.gate(A,ne);if(ie)return wN(A,ie);h.flush();let Oe=Pn.exec(A);if(Oe)return Oe;let Te=z.dialog(A,true);if(Te)return Te;Cn.note(A);let Ve=z.capability(A);if(X&&Ve&&!Ve.ok)return Ve;if(A.type==="setEditingMode"){let ct=ka(A.mode);return ct!==null?(ct.reason===zr&&(W=true,T=ct.reason,U.report(ct.reason),Ce(),Ee()),ct):(O=true,W=false,T=null,be(A.mode),Ce(),Ee(),{ok:true,changed:false})}let Le=z.toggle(A);if(Le)return Le;if(A.type==="toggleReviewPane")return p?(sn=!sn,Ce(),Ee(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Kt};let ht=Gn.exec(A);if(ht)return ht;let Fe=M&&(A.type==="resolveAllReviewChanges"||A.type==="setReviewChangesAuthor")?Cn.run(M,A,ne,()=>hr.exec(A)):hr.exec(A);if(Fe)return Fe;if(jv(A))return HN(A,M,Vv(x),ne);let Ge=Yi(A);if(x==="viewing"&&Ge.supported&&Ge.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Ft=ac(A,M,l.modeForGate(),ne);if(!Ft.ok)return Ft.refusal;let Ne=M,We=Ne.session.packageRevision();return Cn.run(Ne,A,ne,()=>{let ct=H2(Ne,A,{...Ft.tablePlan?{admittedTablePlan:Ft.tablePlan}:{},editor:On});return ct||{ok:true,changed:Ne.session.packageRevision()!==We}})},can(A,ne){let ie=wb(d$1,A);if(ie)return ie;let Oe=Pn.can(A);if(Oe)return Oe;let Te=z.dialog(A,false);if(Te)return Te;let Ve=Cn.gate(A,ne);if(Ve)return Ve;if(A.type==="insertImage"||A.type==="replaceImage"){if(X)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(ne?.scope){let Ne=ac(A,M,l.modeForGate(),ne);if(!Ne.ok)return Ne.refusal}return SC(A,M)}let Le=z.capability(A);if(Le)return Le;let ht=Gn.can(A);if(ht)return ht;let Fe=hr.can(A);if(Fe)return Fe;if(jv(A))return Gv(A,M,Vv(x),ne);let Ge=Yi(A);if(x==="viewing"&&Ge.supported&&Ge.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Ft=ac(A,M,l.modeForGate(),ne);if(!Ft.ok)return Ft.refusal;if(A.type==="replaceMatch"){let Ne=Kh(M,A.match);if(Ne)return Ne}if(A.type==="proposeInsertion"||A.type==="proposeDeletion"||A.type==="proposeReplacement"){if(!(A.author??c??"").trim())return {ok:false,code:"invalidArgs",reason:`${A.type} requires a non-empty author`};let We=A.target===void 0?{ok:true,selection:M.state().selection}:Vp(M,A.target);if(!We.ok)return We;let{anchor:ct,head:Jt}=We.selection,Qn=ct.paragraphId===Jt.paragraphId&&ct.offset===Jt.offset,Mn=A.type==="proposeReplacement"&&A.target===void 0&&M.state().cellSelection!==null;if(A.type!=="proposeInsertion"&&Qn&&!Mn)return {ok:false,code:"invalidArgs",reason:`${A.type} needs a non-collapsed selection`}}if(rc(A)&&xy(A)){let Ne=oc(On);if(Ne){let We=wy(On,A,Ne);if(We)return We}}return {ok:true}},isActive(A){let ne=z.isActive(A);return ne!==null?ne:A.type==="toggleDocumentProtection"?Gn.isActive():A.type==="setReviewDisplayMode"?je===A.mode:A.type==="toggleReviewPane"?sn:A.type==="setEditingMode"?x===A.mode:IH(A,M?ro().formatting:null,ie=>M?.isListActive(ie)??false)},getDocumentStyles:()=>M?.session.documentStyles()??[],getDocumentFonts:st,getAvailableFonts:()=>p_(Ue(),st(),an),getDocumentThemeColors:()=>M?.session.documentThemeColors()??[],getOutline:()=>M?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>_C(M?ro().formatting:null),findMatches:((A,ne)=>EH(M,x,Lo.noteMatches,A,ne)),selectMatch(A){return h.flush(),M?TH(M,A):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>ro().image,getSelectedTable:()=>NC(M),getTableCellSelection:()=>{let A=M?.state().cellSelection;return A?{tableId:A.tableId,rows:A.rows,columns:A.columns,cellIds:A.cellIds}:null},setTableInteractionLabel(A){M?.setTableInteractionLabel(A);},canExecuteImageCommand(A,ne){if(X)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(ne?.scope){let ie=ac(A,M,l.modeForGate(),ne);if(!ie.ok)return ie.refusal}return ky(A,M)},executeImageCommand(A){return X?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):Ry(On,A)},getPageSetup:()=>Ny(M),getWatermark:()=>sf(M),getTrackedChanges:()=>(M?.session.reviewItems()??[]).filter(A=>A.kind==="revision").map(A=>{let ne=$t(A);return {id:A.id,kind:A.kind==="revision"?A.revisionKind:"revision",...A.kind==="revision"&&A.author?{author:A.author}:{},story:ne!==null?ne.kind:hi(A)?.noteKind??"body"}}),getReviewItems:A=>Xn(A),getCustomNodeDefinitions:()=>u.customNodes,reportCustomNodeDiagnostic:f,...bi,getSelectionPlacement:()=>$s(),isReviewPaneOpen:()=>sn,getEditingMode:()=>x,getReviewAuthors:()=>P.authorsFor(M?.revisionAuthors()??O_),...mL(I,{enabled:p,surface:()=>M,notify:()=>{Ce(),Ee();}}),setTrackedChangesFilter(A,ne){if(M)return M.setTrackedChangesFilter(A,ne);I.setPredicate(A,ne)&&(Ce(),Ee());},getConfiguredAuthor:()=>c??null,setAuthor(A){let ne=$b(A);if(c!==ne){if(c=ne,M?.setAuthor(c),c!==void 0&&W){W=false;let ie=qE(ka("suggesting"));if(ie.enter)O=true,be("suggesting");else {T=ie.rejection,Ce(),Ee();return}}else if(!O){let ie=q??x;Sa(l.mode()===void 0?ie:"editing");return}T=Yn(null),U.report(T),Ce(),Ee();}},setMode(A){l.setMode(A)&&(O=false,W=false,Sa());},...F_(l,{surface:()=>M,bump:Ce,emitSelectionChange:Ee}),presenceColorFor:A=>M?.remotePresenceColor(A)??"var(--doc-accent)",collaborationSession:()=>M?.collaborationSession()??null,getReviewAuthorStyle:A=>P.styleFor(A),setOpeningIndicatorHost:fe.set,setRemoteCaretLabelHost(A){ee=A,M?.setRemoteCaretLabelHost(A);},setReviewPaneOptions:g.set,setRevisionMarkup:Pn.markup.set,setRevisionMarkupChrome:Pn.markup.register,setCompareDocumentsChrome:Pn.compare.register,setUnsupportedElementRules:J.set,setRevisionStyles(A){P.set(A),M?.setRevisionStyles(A),Ce(),Ee();},setEditingMode:A=>On.exec({type:"setEditingMode",mode:A}),getReviewRevision:()=>Yt(),getActivatedReviewItemKey:A=>Eb(Xn,M?.activatedReviewKey()??null,A),setActiveReviewItem(A,ne){if(A===null)return M?.dismissActiveReview(),Ce(),Ee(),{ok:true,changed:false};if(!M)return {ok:false,code:"notFound",reason:"no document is open"};M.flushPendingInput();let ie=Xr(Xn,A)?.item;if(!ie)return {ok:false,code:"notFound",reason:"no review item with that key"};let Oe=ys(ie),Te=E.set(Oe?ml(Oe.deletion):null)??A,Ve=sl(ie);if(!Ve)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!jf(ie).every(Xc)&&!(k&&ie.kind==="revision"&&ie.revisionKind==="format"))return {ok:false,code:"unsupported",reason:pH(ie)};let Le=ie?$t(ie):null,ht=Le===null&&ie?vt(ie):null;if(Le!==null||ht!==null){let Fe=Le!==null?{kind:"headerFooter",rId:Le.rId,furnitureKind:Le.kind}:{kind:"note",id:ht},Ge=Wp(M,Fe,Ve.start);if(!Ge.ok)return Ge}else {ZC(M,(yi(ie)??Ve).start);let Fe=yi(ie)??Ve,Ge={paragraphId:Fe.start.paragraphId,offset:Fe.start.offset};M.activateReview(Te,{anchor:Ge,head:Ge},{allowExcluded:k,preventScroll:true});let Ft=ne?.reveal??"centerIfNeeded";Ft!==false&&M.revealPosition?.(Fe.start,{block:Ft});}return (Le!==null||ht!==null)&&M.activateReview(Te,void 0,{allowExcluded:k}),Ce(),Ee(),ne?.announce===true&&fn.emitReviewItemReveal(Cb(Xn,{key:A,source:"host"})),{ok:true,changed:false}},setReviewActivationExclusions(A,ne){w=A===null?null:[...A],v=ne?.formattingKinds?[...ne.formattingKinds]:void 0,M?.setReviewActivationExclusions(w,{formattingKinds:v});},getHeaderFooterState:()=>M?.headerFooterState()??null,getNotePropertiesState:()=>M?.notePropertiesState?.()??null,getNotePreviewText:A=>M?.notePreviewText?.(A)??null,setActiveScope(A){M?.setActiveScope(A)&&Ce();},getActiveScope:()=>M?.activeScope()??{kind:"body"},query:A=>BN(M,()=>ro().formatting,A),snapshot:()=>ro(),getTotalPages:()=>ds(M),getCurrentPage:A=>Hy(M,A),...CH(()=>M,()=>h.flush(),()=>d$1),...LH(()=>On,()=>n,()=>h.flush()),...C_(mn,()=>M),...Lo.members,...QH({frame:Lo.frame,placements:Xn}),relayout(A){A?.sync,M?.layout();},retainSelection:()=>d$1?M?.retainSelection()??null:null,releaseSelection:A=>M?.releaseSelection(A),focus(A){return h.flush(),M?A&&A.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:A&&!M.setActiveScope(A)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(M.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){n?.invalidate(),X=true,we.dispose(),et.clear(),U.dispose(),h.cancel(),mn.detach(),oe(),Y(),Y=()=>{},zn(),d$1=null,b=null,y=new WeakMap,Pe+=1,Ce(),Lt.dispose(),fn.clear();},on:fn.on};n=ZN(On,{surface:()=>M,container:()=>d$1,collaboration:()=>u.collaboration!==null,load:no,changed:()=>{Ce(),Ee();},cancelLoad:()=>{r=null,o$1=null,h.cancel();}}),Lt.attach(On,ha);let oo=pi.methods(On);return JI(oo,()=>d$1),c_(oo,Cn,u.review?.compareDocuments),gN(oo,z.popupChrome),pn=()=>VN(oo),jN(oo,{deferEvents:fn.defer,displayOptions:ba,changed:()=>{Ce(),Ee();}}),oo}var D_=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function JG(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 ez(e){let t,n=u$1({port:tz(e,()=>t),capabilities:D_}),r=false,o=i=>(r||e.surface?.flushPendingInput(),cN(e,()=>n.execute(i)));return {...n,save:()=>{try{return n.save()}catch(i){return {ok:false,error:{code:"transaction-refused",message:i instanceof Error?i.message:"Cannot save the document."}}}},dispose:()=>{r=true,n.dispose();},execute:o,beginHistoryGroupRun:i=>{let a=r?null:s_(e,i);if(a===null)return null;let s=false;return {execute:l=>{if(s||r||!l_(e,i))return null;let c=t;t=a;try{return o(l)}finally{t=c;}},finish:()=>{s||(s=true,a.finish());}}}}}function tz(e,t){let n=(u,f)=>{let p=t();return p===void 0?f():p.bind(u,f)},r=0,o=0,i=null,a=false,s=false,l=()=>{if(s)return null;let u=e.surface?.session??null;return u!==i&&(a&&(r+=o+1),a=true,i=u,o=0),u&&(o=u.packageRevision()),u},c,d=null;return {localChangeTracking:true,suggesting:()=>e.surface?.editingMode()==="suggest",async prepare(u){if(!u.operations.some(g=>g.op==="updateFieldResult"))return;c=void 0,d=null;let f=e.surface;if(!f)return;ri(f);let p=f.layout();c=r$1(p),d=l()?.currentPackage()??null;},fieldPageContext(u,f,p){let g=l()?.currentPackage()??null;if(!g||g!==d)return null;let b=q(g).story(u);return b?s$2(c,b.part,f,p):null},revision(){return l(),r+o},currentPackage:()=>l()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?lb$1(e.surface.revisionDisplayMode()):Uh$1,collaborative:()=>!!e.surface?.collaborationSession(),...nz(e),setupOutsideUndo:()=>true,allocationActor:()=>e.surface?.collaborationSession()?.identity.actorId,trackedRangeReplacement:()=>!e.surface?.collaborationSession(),replacementLanding:(u,f,p)=>e.surface?.replacementLanding(u,f,p)??null,apply(u,f,p=[],g=false){if(l(),Ls(e))return {ok:false,reason:Cr};let b=e.surface;if(!b)return {ok:false,reason:"no-document"};let y=n(b,()=>b.applyAutomationOps(u,f,p,g));return y.rejected?{ok:false,reason:Os(y.reason)}:{ok:true,changed:y.committed}},applyLifecycle(u){if(l(),Ls(e))return {ok:false,reason:Cr};let f=e.surface;if(!f)return {ok:false,reason:"no-document"};let p=n(f,()=>f.applyAutomationOps(()=>[u]));return p.rejected?{ok:false,reason:Os(p.reason)}:{ok:true,changed:p.committed}},applyCommentWrites(u,f){let p=e.surface,g=l();if(!p||!g)return {ok:false,reason:"no-document"};if(Ls(e))return {ok:false,reason:Cr};if(u.length===0)return {ok:true,changed:false};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};let b=e.can({type:"toggleReviewPane"});if(!b.ok)return {ok:false,reason:Os(b.reason??"review-module-required")};if(u.length!==1&&!u.every(x=>x.kind==="delete"))return {ok:false,reason:"mixed-comment-writes"};let y=null,h=n(p,()=>p.commitReviewOps(x=>{if(u.every(k=>k.kind==="delete")){let k=u.find(I=>I.kind==="delete"),E=g.deleteComments(u.map(I=>{if(I.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:I.commentId,...I.parentCommentId===void 0?{}:{parentCommentId:I.parentCommentId}}}),f,k?.kind==="delete"?k.noteId:void 0,{historyToken:x});return y=E?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:E}}if(u.length!==1)return y={ok:false,reason:"mixed-comment-writes"},{committed:false};let w=u[0];if(w.kind==="resolve"){let k=g.setCommentResolved(w.commentId,w.resolved,{historyToken:x});return y=k?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:k}}if(w.kind!=="create"&&w.kind!=="reply")return y={ok:false,reason:"unsupported-comment-write"},{committed:false};let v=g.replyToComment(w.kind==="reply"?w.parentCommentId:null,w.anchor,w.text,w.author,w.date,void 0,void 0,{historyToken:x});return y=v===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:v},{committed:v!==null}},JG(u)));return y??{ok:false,reason:Os(h??"refused")}},applyCustomNodeWrite(u,f){let p=e.surface,g=l();if(!p||!g)return {ok:false,reason:"no-document"};if(Ls(e))return {ok:false,reason:Cr};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};let b=null,y=n(p,()=>p.commitReviewOps(h=>{let x=g.insertCustomNode(u,void 0,{historyToken:h});return b=x.ok?{ok:true,changed:x.change!==null}:{ok:false,reason:x.detail?`${x.reason}: ${x.detail}`:x.reason},{committed:x.ok}},"package-scoped"));return b??{ok:false,reason:Os(y??"refused")}},save:()=>l()?e.surface?.save()??null:null,selectRefusal(u,f){if(u.kind==="body")return null;let p=e.surface;return p?.editingMode()==="view"?"a read-only editor does not open a header, footer or note to select in it":p&&!Re(p.layout(),{paragraphId:f,offset:0})?"that header, footer or note is not shown on any page":null},select(u,f){if(!e.surface)return false;let g=f==="end"?u.end:u.start,b=f==="start"?u.start:u.end;return e.exec({type:"setSelection",range:{anchor:{paragraphId:g.paragraphId,offset:g.offset},head:{paragraphId:b.paragraphId,offset:b.offset}}}).ok},subscribe:u=>e.on("change",()=>u()),dispose(){s=true,i=null;}}}function nz(e){let t=i_(e);return t?{compareDocuments:t}:{}}function kx(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}function rz(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=So(i)?i:null,s=a!==null&&e.contains(a);if(!s&&N_(a,e.popup))return;let l=[kx(e.popup),e.chromeRoot?.(),...e.editorElements?.()??[]],c=s||l.some(d=>d!=null&&o.includes(d));e.close(s),c&&(r.preventDefault(),r.stopPropagation());};return t.addEventListener("keydown",n,true),()=>t.removeEventListener("keydown",n,true)}function N_(e,t){let r=(qt(e)?e:e?.parentElement??null)?.closest('[aria-modal="true"], [data-docx-modal]');return r?r.hasAttribute("data-docx-dialog")||r.hasAttribute("data-docx-modal")?true:kx(t)?.contains(r)===true:false}var oz='[aria-expanded="true"], [role="menu"], [role="listbox"], [role="dialog"]';function iz(e){return e?.querySelector(oz)!=null}function az(e){let t=e.popup.ownerDocument,n=r=>{let o=r.composedPath()[0]??r.target;if(!So(o)||e.contains(o))return;let i=qt(o)?o:o.parentElement;i===null||i===t.body||i===t.documentElement||i.closest(".docx-pages")||N_(i,e.popup)||e.close();};return t.addEventListener("focusin",n,true),()=>t.removeEventListener("focusin",n,true)}function sz(e){let t=e.popup,n=Wi(t),r=e.contains??(i=>t?.contains(i)===true),o=i=>{let a=i.composedPath();(a.length>0?a:[i.target]).some(l=>So(l)&&r(l))||e.close(i);};return n.addEventListener("pointerdown",o,true),()=>n.removeEventListener("pointerdown",o,true)}function lz(e){return e*(96/72)}function cz(e,t){return e*t}function dz(e,t){return e/t}function uz(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 fz(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function __(e,t,n,r=false){return t?true:e.length===1?false:r?n:!n}var H_=["e","se","s","sw","w","nw","n","ne"];function pz(e,t){let n=H_.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return H_[(n-r+8)%8]}function mz(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,c=r*s+o*a;return r=l,o=c,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function ma(e){return e/12700}function B_(e){let t=mz(e.deltaXPt,e.deltaYPt,e.transform),n=ma(e.startWidthEmu),r=ma(e.startHeightEmu),o=n/r,i=pz(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/ma(e.startWidthEmu),r/ma(e.startHeightEmu));n=Math.max(1,ma(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=ma(e.startWidthEmu),c=ma(e.startHeightEmu),d=n/l,u=r/c,f=e.kind==="inline"&&Math.abs(e.transform.rotationDegrees%180)===90,p=Math.max(1,f?e.startBounds.width+r-c:e.startBounds.width*d),g=Math.max(1,f?e.startBounds.height+n-l:e.startBounds.height*u),b=e.startBounds.x,y=e.startBounds.y,h=e.handle;h.includes("w")&&(b=e.startBounds.x+e.startBounds.width-p),h.includes("n")&&(y=e.startBounds.y+e.startBounds.height-g);let x=null;if(e.kind==="anchored"&&e.startPosition&&(h.includes("w")||h.includes("n")||e.anchorFrameOrigin&&(e.startPosition.horizontalEmu===void 0&&n!==l||e.startPosition.verticalEmu===void 0&&r!==c)))if(e.startPosition.mode==="simple"){let w=h.includes("w")?At(b-e.startBounds.x):0,v=h.includes("n")?At(y-e.startBounds.y):0;x=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+w,verticalEmu:(e.startPosition.verticalEmu??0)+v});}else if(e.anchorFrameOrigin)x=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...h.includes("w")||e.startPosition.horizontalEmu===void 0&&n!==l?{horizontalEmu:At(b-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...h.includes("n")||e.startPosition.verticalEmu===void 0&&r!==c?{verticalEmu:At(y-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let w=h.includes("w")?At(b-e.startBounds.x):0,v=h.includes("n")?At(y-e.startBounds.y):0;x=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+w}:{},...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:At(n),heightEmu:At(r),previewBounds:Object.freeze({x:b,y,width:p,height:g}),position:x})}function gz(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 hz(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&&mf(e.session.startPosition.mode==="frame"&&e.anchorFrameOrigin?{...e.session.startPosition,horizontalEmu:e.session.startPosition.horizontalEmu??At(e.session.startBounds.x-e.anchorFrameOrigin.x),verticalEmu:e.session.startPosition.verticalEmu??At(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?B_({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:__(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 $_=e=>Math.round(e/1440*100)/100,yz=e=>$_(e).toLocaleString(void 0,{maximumFractionDigits:2}),bz=e=>Math.round(e*1440),vz={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},W_=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",q_=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function xz(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",direction:e.direction??"ltr",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:W_(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 K_={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 wz(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 U_(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 Sz(e,t,n=K_,r=n){let o={},i=false,a=(c,d)=>{o[c]=d,i=true;},s=c=>n[c]&&!r[c];(e.direction!==t.direction||s("direction"))&&a("direction",t.direction);let l=!n.direction&&!n.alignment&&e.direction!==t.direction&&t.alignment===j_(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",q_(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),(!U_(e.tabStops,t.tabStops)||s("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?o:null}function j_(e){return e==="left"?"right":e==="right"?"left":e}function kz(e,t){return [...e.filter(r=>r.positionTwips!==t.positionTwips),t].sort((r,o)=>r.positionTwips-o.positionTwips)}function Iz(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}var Rz=63;function V_(e){return /^\d{1,3}$/.test(e.trim())?Number(e.trim()):null}function Pz(e,t,n){let r=n?.maxCols??63,o=n?.maxRows??63,i=V_(e),a=V_(t);return i===null||i<1||i>r?{counts:null,problem:{kind:"range",field:"columns",max:r}}:a===null||a<1||a>o?{counts:null,problem:{kind:"range",field:"rows",max:o}}:i*a<2?{counts:null,problem:{kind:"oneCell"}}:{counts:{rows:a,cols:i},problem:null}}function Tz(e,t){let n=[[1,2],[2,1],[e?.maxRows??2,1]];for(let[r,o]of n)if(r*o>=2&&t({type:"splitCell",rows:r,cols:o}).ok)return {columns:String(o),rows:String(r)};return {columns:"2",rows:"1"}}function Ez(e,t,n){let r,o=false,i,a=nt(()=>t),s,l=new Set,c=[],d=()=>{a.clearTimeout(s),s=void 0,r?.end(),r=void 0,i=void 0,l.clear();},u=()=>{if(o)throw new Error("history group binding was disposed");return (!r||r.state==="closed")&&(r=e.beginHistoryGroup()),r},f=()=>{d(),u();},p=()=>{let y=r;i=void 0,l.clear(),a.clearTimeout(s),s=a.setTimeout(()=>{r===y&&d();},0);},g=(y,h,x,w=false)=>{y.addEventListener(h,x,w),c.push(()=>y.removeEventListener(h,x,w));},b=y=>n.kind==="native-color"?y==="Enter"||y===" ":["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"," ","Enter"].includes(y);if(g(t,"pointerdown",y=>{let h=y;if(!(h.button!==0||n.kind==="keyboard")&&(f(),i=h.pointerId,n.kind!=="native-color"))try{t.setPointerCapture?.(h.pointerId);}catch{}},true),g(t,"keydown",y=>{let h=y;if(h.key==="Escape"){p();return}!b(h.key)||h.altKey||h.ctrlKey||h.metaKey||(!h.repeat&&l.size===0&&f(),l.add(h.key),u());},true),g(t.ownerDocument,"keyup",y=>{let h=y.key;l.delete(h)&&n.kind!=="native-color"&&l.size===0&&p();},true),n.kind!=="native-color")for(let y of ["pointerup","pointercancel","lostpointercapture"])g(y==="lostpointercapture"?t:t.ownerDocument,y,h=>{i!==void 0&&h.pointerId===i&&p();},true);return g(t,"input",()=>{s!==void 0?f():u();},true),g(t,"change",()=>{(n.kind==="native-color"||i===void 0&&l.size===0)&&p();}),g(t,"blur",p,true),t.ownerDocument.defaultView&&g(t.ownerDocument.defaultView,"blur",p),{options:()=>({historyGroup:u()}),dispose(){if(!o){o=true,d();for(let y of c)y();}}}}var z_=Object.freeze([1,1.15,1.5,2,2.5,3]);function Cz(e){return Number.isInteger(e*10)?e.toFixed(1):String(e)}function G_(e,t,n){let r=e.rule==="multiple";return {spacing:e,command:t?null:{type:"setLineSpacing",rule:e.rule,value:e.value},text:r?Cz(e.value):String(e.value),labelKey:r?null:e.rule==="exact"?"lineSpacing.exactlyPoints":"lineSpacing.atLeastPoints",selected:t,preset:n}}function Oz(e){let t=z_.map(o=>G_({rule:"multiple",value:o},e?.rule==="multiple"&&e.value===o,true));if(!e||t.some(o=>o.selected))return t;let n=G_(e,true,false);if(e.rule!=="multiple")return [n,...t];let r=t.findIndex(o=>o.spacing.value>e.value);return t.splice(r===-1?t.length:r,0,n),t}function Mz(e,t,n){let r={minimumFractionDigits:t,maximumFractionDigits:2};try{return new Intl.NumberFormat(n,r).format(e)}catch{return new Intl.NumberFormat("en",r).format(e)}}function Az(e,t,n){let r=n===void 0?e.text:Mz(e.spacing.value,e.spacing.rule==="multiple"?1:0,n);return e.labelKey?t(e.labelKey).replace("{value}",r):r}var ui=class extends Error{code;constructor(t,n){super(`Document capture failed: ${t}.`,{cause:n}),this.name="DocumentRefreshError",this.code=t;}};function Z_(e){return JSON.stringify([e.revisionKind,e.author,e.date,e.text,e.replacedText])}function X_(e){return new Map(e.surface()?.session.reviewItems().filter(t=>t.kind==="revision").map(t=>[t.id,Z_(t)]))}function Y_(e,t,n,r){let o=e.surface();if(!o)return {located:[],available:false};let i=o.session.part(),a=d$2(i),s=o.session.paragraphAnchors().paraIdByNode,l=new Map,c=new Map;a.forEach((g,b)=>{c.set(g.id,b);let y=s.get(g.id);if(y){let h=y.toUpperCase();l.set(h,l.has(h)?null:g);}});let d=new Set(o.layout().pages.flatMap(g=>Ja(g).map(b=>b.paragraphId))),u=(g,b=JSON.stringify([typeof g.location?.text=="string"?g.location.text:null,g.unavailableReason,g.description]))=>{let y={id:g.id,resultId:t,isNew:r.get(g.id)!==b,...g.description!==void 0?{description:g.description}:{}};if(!g.location)return {fingerprint:b,change:{...y,status:g.unavailableReason??"unavailable",diagnostic:Object.freeze({code:g.unavailableReason==="deleted"?"deleted":"missing-location"})}};let h=g.location,x=E=>({fingerprint:b,change:{...y,status:"invalid",diagnostic:Object.freeze({code:E,location:Object.freeze({...h})})}});if(h.paragraphId===void 0==(h.paragraphIndex===void 0)||h.paragraphIndex!==void 0&&(!Number.isSafeInteger(h.paragraphIndex)||h.paragraphIndex<0))return x("invalid-selector");if(h.paragraphId!==void 0&&(typeof h.paragraphId!="string"||!vb$1(h.paragraphId)))return x("invalid-paragraph-id");let w=h.paragraphId!==void 0?l.get(h.paragraphId.toUpperCase()):a[h.paragraphIndex];if(w===null)return x("ambiguous-paragraph-id");if(!w)return x("paragraph-not-found");let v=w?Jm(i,w.id)??"":"";if(!Number.isSafeInteger(h.start)||!Number.isSafeInteger(h.end)||h.start<0||h.end<=h.start||h.end>v.length)return x("invalid-offsets");if(v.slice(h.start,h.end)!==h.text)return x("text-mismatch");let k=d.has(w.id);return {fingerprint:b,change:{...y,status:k?"available":"unavailable",location:Object.freeze({...h}),...k?{}:{diagnostic:Object.freeze({code:"not-rendered",location:Object.freeze({...h})})}},...k?{paragraphId:w.id,offset:h.start}:{}}};if(n)return {located:n.map(g=>u(g)),available:true};let f=o.session.reviewItems().filter(g=>g.kind==="revision");return {located:f.map(g=>{let b=Z_(g),y=g.ranges[0];if(!y||y.partName!==i.name)return {fingerprint:b,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==b,status:y?"unsupported-story":"unavailable",diagnostic:Object.freeze({code:y?"unsupported-story":"missing-location"})}};let h=c.get(y.start.paragraphId)??-1;if(g.revisionKind==="delete"||g.revisionKind==="moveFrom")return {fingerprint:b,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==b,status:"deleted",diagnostic:Object.freeze({code:"deleted"})}};if(y.start.paragraphId!==y.end.paragraphId)return {fingerprint:b,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==b,status:"unavailable",diagnostic:Object.freeze({code:"multiple-paragraphs"})}};let x=Jm(i,y.start.paragraphId)??"",w={paragraphIndex:h,start:y.start.offset,end:y.end.offset,text:x.slice(y.start.offset,y.end.offset)};return u({id:g.id,location:w},b)}),available:f.length>0}}var Q_=new WeakMap,Lz=0;function Fz(e){let t=Q_.get(e);if(t)return t;let n=zN(e),r=`refresh-${++Lz}`,o=0,i=null,a=new AbortController,s=false,l=Promise.resolve(),c=null,d=[],u=null,f=new Set,p=new Set,g=Object.freeze({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false}),b=I=>{g=Object.freeze({...g,...I});for(let P of f)try{P();}catch{}},y=Kp(e,n,{marker:"data-docx-refresh-highlight",defaultColor:"var(--doc-refresh-highlight-color)"},()=>{g.highlightsVisible&&b({highlightsVisible:false});}),h=(I,P)=>{P&&b({phase:P,result:I,recoveryAvailable:c!==null});for(let C of p)try{C(I);}catch{}return I},x=(I,P,C)=>({ok:false,resultId:I,code:P,...C===void 0?{}:{recovered:C}}),w=()=>n.collaboration()?"collaboration":!n.surface()||!n.container()||e.snapshot().isOpening?"unavailable":null,v=()=>{o++,i=null,a.abort(),a=new AbortController,d=[],u=null,y.clear();};n.invalidated.add(()=>{v(),c=null,b({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});}),e.on("change",I=>{I.source||u===null||n.revision===u||(d=[],y.clear(),u=null,b({changes:[],highlightsVisible:false}));});let k=async I=>{let P=n.surface(),C=n.container();if(!P||!C)throw new Error("unavailable");$f(P)&&await new Promise((T,B)=>{let W=()=>{C.removeEventListener("compositionend",q),I.removeEventListener("abort",U);},q=()=>{W(),T();},U=()=>{W(),B(new Error("cancelled"));};C.addEventListener("compositionend",q),I.addEventListener("abort",U,{once:true}),I.aborted&&U();});let O=Ec(C);if(O&&await O,I.aborted||n.surface()!==P)throw new Error("document-changed");let S=P.save();if(n.surface()!==P)throw new Error("document-changed");return {bytes:S,revision:n.revision}},E={async capture(){let I=w();if(c)throw new ui("recovery-failed");if(I||s)throw new ui(I??"busy");v(),c=null;let P=o,C=n.epoch,O=a.signal;b({phase:"capturing",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});try{let S=await k(O);if(P!==o||C!==n.epoch)throw new Error("superseded");let T=Object.freeze({id:`${r}-${P}`,bytes:S.bytes.slice().buffer});return i={token:T,epoch:C,revision:S.revision,sequence:-1,seen:X_(n)},b({phase:"processing"}),T}catch(S){throw P===o&&b({phase:"failed"}),new ui(P===o?"input-failed":"superseded",S)}},applyUpdate(I){let P=`${I.submission?.id??"unknown"}:${I.sequence}`,C;try{if(!Number.isSafeInteger(I.sequence)||I.sequence<0||!(I.bytes instanceof Uint8Array||I.bytes instanceof ArrayBuffer)||I.failures!==void 0&&(!Array.isArray(I.failures)||I.failures.length>1e4||Array.from(I.failures).some(T=>typeof T!="string"))||I.changes!==void 0&&(!Array.isArray(I.changes)||I.changes.length>1e4||new Set(I.changes.map(T=>T.id)).size!==I.changes.length||Array.from(I.changes).some(T=>!T||typeof T.id!="string"||!T.id||T.description!==void 0&&(typeof T.description!="string"||T.description.length>1e3)||T.location!==void 0&&(!T.location||typeof T.location!="object"||T.location.paragraphId!==void 0&&typeof T.location.paragraphId!="string"||T.location.paragraphIndex!==void 0&&typeof T.location.paragraphIndex!="number"||typeof T.location.start!="number"||typeof T.location.end!="number"||typeof T.location.text!="string")||T.unavailableReason!==void 0&&!["deleted","unavailable"].includes(T.unavailableReason))))throw new Error("invalid-result");C={...I,bytes:new Uint8Array((I.bytes instanceof Uint8Array,I.bytes)).slice(),changes:I.changes?.map(T=>({id:T.id,description:T.description,unavailableReason:T.unavailableReason,location:T.location?{paragraphId:T.location.paragraphId,paragraphIndex:T.location.paragraphIndex,start:T.location.start,end:T.location.end,text:T.location.text}:void 0})),failures:I.failures?.slice()};}catch{return Promise.resolve(h(x(P,"invalid-result")))}let O=async()=>{let T=i,B=w();if(B)return h(x(P,B));if(!T||T.token!==C.submission)return h(x(P,"superseded"));if(C.sequence<=T.sequence)return h(x(P,"out-of-order"));if(T.epoch!==n.epoch)return h(x(P,"document-changed"));s=true;let W=a.signal,q=()=>i===T&&T.epoch===n.epoch&&!W.aborted;try{let U=await k(W);if(!q())return h(x(P,"cancelled"));if(U.revision!==T.revision)return h(x(P,"local-edits"),"failed");let Z=C.bytes;if(!lg(Z).ok)return h(x(P,"invalid-document"),"failed");if(y.clear(),d=[],u=null,b({phase:"refreshing",changes:[],highlightsVisible:!1}),!q())return h(x(P,"cancelled"));let M=n.surface().save();if(!q())return h(x(P,"cancelled"));if(n.revision!==T.revision)return h(x(P,"local-edits"),"failed");c={bytes:M.slice(),epoch:n.epoch};let J=await n.replace(Z,"refresh");if(T.epoch!==n.epoch)return h(x(P,"document-changed"));if(!J&&!q())return c=null,h(x(P,"cancelled"));if(!J){if(b({phase:"recovering"}),T.epoch!==n.epoch)return h(x(P,"document-changed"));let $=c&&await n.replace(c.bytes,"recovery");return T.epoch!==n.epoch?h(x(P,"document-changed")):($&&(c=null),i=null,h(x(P,$?"load-failed":"recovery-failed",!!$),"failed"))}c=null,y.clear(),T.revision=n.mountedRevision,T.sequence=C.sequence;let ee=Y_(n,P,C.changes,T.seen);d=n.revision===T.revision?ee.located:[];for(let $ of d)T.seen.set($.change.id,$.fingerprint);u=T.revision;let fe=Object.freeze(d.map($=>Object.freeze($.change))),se=Object.freeze({ok:!0,resultId:P,changes:fe,changeInformation:n.revision===T.revision&&ee.available?"available":"unavailable",failures:Object.freeze(C.failures??[])});return b({changes:fe,result:se,phase:"complete",recoveryAvailable:!1}),h(se)}catch{return h(x(P,q()?"input-failed":"cancelled"),q()?"failed":void 0)}finally{s=false;}},S=l.then(O);return l=S.then(()=>{},()=>{}),S},cancel(){let I=g.phase==="recovering"||!n.surface()&&c!==null;n.cancel(),o++,i=null,a.abort(),a=new AbortController,I||(c=null),b({phase:I?"failed":g.result?.ok?"complete":"idle",result:I||g.result?.ok?g.result:null,recoveryAvailable:c!==null});},finish(I){i?.token===I&&!s&&(i=null,b({phase:g.phase==="processing"?"idle":g.phase}));},snapshot:()=>g,subscribe(I){return f.add(I),()=>{f.delete(I);}},onResult(I){return p.add(I),()=>{p.delete(I);}},highlightChanges(I){if(y.validate(I),u!==n.revision)return 0;let P=I?.changeIds===void 0?null:new Set(I.changeIds),C=d.filter(O=>O.change.status==="available"&&(P?P.has(O.change.id):I?.includePrevious||O.change.isNew));return y.show(C,I),b({highlightsVisible:C.length>0}),C.length},clearHighlights(I){y.hide(I),b({highlightsVisible:false});},navigateToChange(I,P={}){if(P.focus!==void 0&&typeof P.focus!="boolean")throw new TypeError("focus must be a boolean.");let C=Fs(P,"center",n.container());if(u!==n.revision)return false;let O=d.find(T=>T.change.id===I);if(!O?.paragraphId||O.offset===void 0)return false;let S=n.surface();if(!S?.revealPosition({paragraphId:O.paragraphId,offset:O.offset},C))return false;if(P?.focus){S.setActiveScope({kind:"body"});let T={paragraphId:O.paragraphId,offset:O.offset};S.setSelection({anchor:T,head:T}),S.focus();}return true},recoveryBytes:()=>c?c.bytes.slice().buffer:null,async recover(){if(!c||c.epoch!==n.epoch||s)return false;s=true;let I=c;b({phase:"recovering"});try{if(I.epoch!==n.epoch)return !1;let P=await n.replace(I.bytes,"recovery");return I.epoch!==n.epoch?!1:(P&&(c=null),b({phase:P?"idle":"failed",recoveryAvailable:!P}),P)}finally{s=false;}}};return Q_.set(e,E),E}var J_=150,Dz=1e3,Nz=Object.freeze({applied:0,unavailable:0});function Hz(e,t,n,r={}){let{onResult:o,...i}=r,a=n,s=i,l=Nz,c=false,d=nt(()=>wo(e)),u,f=0,p=h=>{h.applied===l.applied&&h.unavailable===l.unavailable||(l=h,o?.(h));},g=()=>{if(d.clearTimeout(u),u=void 0,f=0,c)return;let h=typeof a=="function"?a(e):a;p(e.setHighlights(t,h,s));},b=()=>{let h=Date.now();f===0&&(f=h),d.clearTimeout(u);let x=Math.min(J_,Dz-(h-f));u=d.setTimeout(g,Math.max(0,x));},y=e.on("change",h=>{typeof a=="function"?h.source?g():b():h.source==="refresh"||h.source==="recovery"?g():h.source==="load"&&p({applied:0,unavailable:a.length});});return g(),{get result(){return l},refresh:g,update(h,x){a=h,x!==void 0&&(s=x),g();},stop(){c||(c=true,d.clearTimeout(u),y(),e.clearHighlights(t));}}}var Rx=150,t8=2e3,n8="search",r8=10,Ix=Object.freeze([]),_z=1e3;function Bz(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 e8=new WeakMap;function $z(e){let t=e8.get(e);if(t)return t;let n={query:"",matchCase:false,wholeWord:false,matches:Ix,truncated:false,activeIndex:-1,activeMatch:null,isPending:false},r="",o={},i=nt(()=>wo(e)),a,s=new Set,l=new Map,c=false;function d(){let I="none";for(let P of l.values()){if(P==="all")return "all";P==="active"&&(I="active");}return I}function u(){let I=d(),{matches:P,activeIndex:C}=n,O=C>=0?P[C]:void 0,S=I==="all"?P:I==="active"&&O?[O]:[];S.length===0&&!c||(e.setHighlights(n8,S,{activeIndex:I==="all"?C:S.length>0?0:-1,priority:r8}),c=S.length>0);}function f(I){let P={...n,...I};if(P.matches!==n.matches&&I.activeIndex===void 0&&(P.activeIndex=Bz(n,P.matches)),P.truncated=PH(P.matches)??P.matches.length>=t8,P.activeMatch=P.matches[P.activeIndex]??null,!!Object.keys(P).some(O=>P[O]!==n[O])){n=P,u();for(let O of [...s])O();}}function p(I=r,P=n){return I.length===0?Ix:e.findMatches(I,{matchCase:P.matchCase??false,wholeWord:P.wholeWord??false})}function g(){i.clearTimeout(a),a=void 0;}function b(){g(),r=n.query,f({matches:p(),isPending:false});}let y,h=0,x=()=>{i.clearTimeout(y),y=void 0,h=0,r.length>0&&f({matches:p()});},w=()=>{y!==void 0&&x();};e.on("change",I=>{if(r.length===0)return;if(I.source)return x();let P=Date.now();h===0&&(h=P),i.clearTimeout(y);let C=Math.min(Rx,_z-(P-h));y=i.setTimeout(x,Math.max(0,C));});let v=e.snapshot().editingMode;e.on("selectionChange",I=>{I.editingMode!==v&&(v=I.editingMode,x());});let k=(I,P)=>{w();let C=n.matches.length;if(C===0)return false;let O=n.activeIndex<0?I>0?-1:0:n.activeIndex;return E.goTo((O+I+C)%C,P)},E={getState:()=>n,subscribe(I){return s.add(I),()=>s.delete(I)},find(I,P={}){g(),r=I;let C=P.matchCase??n.matchCase,O=P.wholeWord??n.wholeWord,S=p(I,{matchCase:C,wholeWord:O});return P.highlight===void 0||P.highlight==="none"?l.delete(o):l.set(o,P.highlight),f({query:I,matchCase:C,wholeWord:O,matches:S,activeIndex:-1,isPending:false}),u(),P.selectFirst&&E.goTo(0),n.matches},setQuery(I){I!==n.query&&(g(),I!==r&&(a=i.setTimeout(b,Rx)),f({query:I,isPending:I!==r}));},setMatchCase(I){f({matchCase:I,matches:p(r,{...n,matchCase:I})});},setWholeWord(I){f({wholeWord:I,matches:p(r,{...n,wholeWord:I})});},goTo(I,P){w();let C=n.matches[I];return !C||(P?.focus&&e.focus(),!e.selectMatch(C).ok)?false:(f({activeIndex:I}),true)},next:I=>k(1,I),previous:I=>k(-1,I),clear(){g(),r="",l.delete(o),f({query:"",matches:Ix,activeIndex:-1,isPending:false});},showHighlights(I){let P={};return l.set(P,I),u(),()=>{l.delete(P)&&u();}}};return e8.set(e,E),E}var Wz=[37,80,68,70,45],zc=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 Px(e,t,n={},r={}){if(t==="markdown"){if(!n.markdown)throw new zc(t);let l=await n.markdown(new Uint8Array(await e.save()));if(typeof l?.markdown!="string")throw new TypeError("The Markdown converter returned no Markdown.");return {bytes:new TextEncoder().encode(l.markdown),extension:"md",mimeType:"text/markdown;charset=utf-8"}}if(t!=="pdf")throw new TypeError("Unsupported export format.");if(!n.pdf)throw new zc(t);let o=e.snapshot?.(),i=r.displayMode!==void 0||r.comments!==void 0,a=o||i?{displayMode:r.displayMode??o?.reviewDisplayMode??"proposed",...r.comments===void 0?{}:{comments:r.comments},revisionMarkup:o?.revisionMarkup??hb$1,...e.getReviewAuthors?{revisionAuthorSlots:Object.freeze(Object.fromEntries(e.getReviewAuthors().map(({author:l,slot:c})=>[l,c])))}:{}}:void 0,s=await n.pdf(new Uint8Array(await e.save()),a);if(!(s?.bytes instanceof Uint8Array)||s.bytes.length===0)throw new TypeError("The PDF converter returned no PDF bytes.");if(!Wz.every((l,c)=>s.bytes[c]===l))throw new TypeError("The PDF converter returned a file without a PDF header.");return {bytes:s.bytes,extension:"pdf",mimeType:"application/pdf"}}var Kz=15e3,Lr=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 Uz(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}var jz=Object.freeze([{mode:"simple-markup",labelKey:"review.simpleMarkup"},{mode:"all-markup",labelKey:"review.allMarkup"},{mode:"proposed",labelKey:"review.noMarkup"},{mode:"original",labelKey:"review.original"}]);function Vz(e){return {displayMode:e?.reviewDisplayMode??"proposed",comments:true}}async function Gz(e,t={},n=globalThis.document,r={}){let{bytes:o,mimeType:i}=await Px(e,"pdf",t,r);return zz(o,i,n)}function zz(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,c=null,d,u=null,f=false,p=y=>{i.clearTimeout(d),u?.(y),u=null,l?.remove(),l=null,c=null;},g=()=>{if(c)return c;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;",c=new Promise((h,x)=>{u=x,d=i.setTimeout(()=>p(new Lr("pdf-load-failed")),Kz),y.addEventListener("load",()=>{if(i.clearTimeout(d),!y.contentWindow){p(new Lr("pdf-load-failed"));return}u=null,h(y.contentWindow);},{once:true});}),c.catch(()=>{}),y.src=s,r.append(y),c};return {url:s,async print(y={}){if(f)throw new Lr("print-ended");if(i.navigator.pdfViewerEnabled===false)throw new Lr("pdf-viewer-unavailable");let h=await g();if(f)throw new Lr("print-ended");if(await y.beforePrint?.(),f)throw new Lr("print-ended");let x=o.activeElement;try{h.focus(),h.print();}catch{throw new Lr("print-refused")}finally{x?.isConnected&&x.focus({preventScroll:true});}},dispose(){f||(f=true,p(new Lr("print-ended")),i.URL.revokeObjectURL(s));}}}var Zz=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document";function Xz(e){return e.reason===void 0?`compareDocuments.errors.${e.code}`:`compareDocuments.reasons.${e.reason}`}var o8="data-docx-compare-phase",Yz=e=>e!==null&&!e.disabled&&!e.closest("[hidden]");function Qz(e,t){if(!e?.isConnected)return;let n=a=>e.querySelector(a),r=n('[data-docx-field="revised"] input, input[type="file"]'),i=(t==="busy"?[n('[data-docx-part="cancel"]'),n(`[${o8}]`)]:t==="unchanged"?[n('[data-docx-part="apply"]'),r]:[r,n('[data-docx-part="apply"]')]).find(Yz)??e;i===e&&!e.hasAttribute("tabindex")&&(e.tabIndex=-1),i.focus({preventScroll:true});}var Jz=new Intl.Collator(void 0,{numeric:true,sensitivity:"base"});function i8(e,t){let n=e.filter(r=>t.showHidden||!r.hidden);return t.sortBy==="location"?[...n].sort((r,o)=>r.order-o.order):[...n].sort((r,o)=>Jz.compare(r.name,o.name)||r.order-o.order)}var Tx=["body","header","footer","footnote","endnote"];function eZ(e,t){let n=i8(e,t),r=Yi$1(t.query.trim()),o=n;if(r.length>0){let i=[],a=[];for(let s of n){let l=Yi$1(s.name);l.startsWith(r)?i.push(s):l.includes(r)&&a.push(s);}o=[...i,...a];}return t.sortBy!=="location"?o:[...o].sort((i,a)=>Tx.indexOf(i.place)-Tx.indexOf(a.place))}function tZ(e,t,n){let r=Yi$1(t.trim());return r.length===0?null:e.find(o=>Yi$1(o.name)===r)??n[0]??null}function nZ(e,t){let n=Yi$1(t.trim()),r=Yi$1(e);if(n.length===0||r.length!==e.length)return null;let o=r.indexOf(n);return o<0?null:{start:o,end:o+n.length}}function rZ(e){return Tx.map(t=>({place:t,rows:e.flatMap((n,r)=>n.place===t?[{row:n,index:r}]:[])})).filter(t=>t.rows.length>0)}function oZ(e){return e.find(t=>t.atSelection&&!t.hidden)?.name??""}function iZ(e,t,n){let r=Wi$1(t)??(Xi$1(t)?"invalidStart":null),o=Yi$1(t),i=t.length===0?null:e.find(a=>Yi$1(a.name)===o)??null;return {problem:r,existing:i,canAdd:n&&r===null,canDelete:n&&i!==null,canGoTo:i!==null}}function aZ(e,t){return (t.support!=="partial"||e.includePartial===true)&&(e.match?.(t)??true)}function sZ(e,t,n){let r=e.surface?.session;return r?Ia(r.currentPackage(),t,n):{ok:false,reason:"drawing-not-found"}}
|
|
31
|
+
export{uE as $,Qy as $a,Xb as $b,Oz as $c,u6 as A,yf as Aa,ib as Ab,cz as Ac,oZ as Ad,O5 as B,us as Ba,sb as Bb,dz as Bc,iZ as Bd,M5 as C,WC as Ca,N$ as Cb,uz as Cc,aZ as Cd,L5 as D,_y as Da,CO as Db,fz as Dc,sZ as Dd,wT as E,sc as Ea,H$ as Eb,__ as Ec,N5 as F,_3 as Fa,OO as Fb,B_ as Fc,_5 as G,qC as Ga,_$ as Gb,gz as Gc,de as H,KC as Ha,B$ as Hb,hz as Hc,Ch as I,B3 as Ia,$$ as Ib,$_ as Ic,G5 as J,na as Ja,kA as Jb,yz as Jc,Z5 as K,By as Ka,Rc as Kb,bz as Kc,X5 as L,K3 as La,Pc as Lb,vz as Lc,_T as M,$y as Ma,XW as Mb,W_ as Mc,Y5 as N,J3 as Na,Ob as Nb,q_ as Nc,Q5 as O,Rf as Oa,aa as Ob,xz as Oc,J5 as P,aO as Pa,Co as Pb,K_ as Pc,e4 as Q,If as Qa,Yf as Qb,wz as Qc,t4 as R,sO as Ra,jA as Rb,U_ as Rc,n4 as S,cO as Sa,VA as Sb,Sz as Sc,$T as T,n$ as Ta,Lb as Tb,j_ as Tc,WT as U,r$ as Ua,Qf as Ub,kz as Uc,qT as V,o$ as Va,Fb as Vb,Iz as Vc,r4 as W,a$ as Wa,Jf as Wb,Rz as Wc,o4 as X,s$ as Xa,Db as Xb,Pz as Xc,i4 as Y,l$ as Ya,Nb as Yb,Tz as Yc,Fh as Z,c$ as Za,Hb as Zb,Ez as Zc,dE as _,d$ as _a,sp as _b,z_ as _c,$i as a,of as aa,u$ as ab,OF as ac,Az as ad,$l as b,Nh as ba,Jy as bb,Kc as bc,ui as bd,Eu as c,Hh as ca,dO as cb,Ms as cc,Fz as cd,Cu as d,u4 as da,f$ as db,Qme as dc,J_ as dd,Og as e,af as ea,p$ as eb,xj as ec,Hz as ed,q8 as f,Jl as fa,eb as fb,wj as fc,Rx as fd,K8 as g,py as ga,m$ as gb,Sj as gc,t8 as gd,Mg as h,c3 as ha,g$ as hb,Ls as hc,n8 as hd,Wi as i,tc as ia,Tf as ib,TV as ic,r8 as id,Ae as j,nc as ja,tb as jb,xx as jc,$z as jd,t6 as k,my as ka,pO as kb,Vc as kc,zc as kd,n6 as l,d3 as la,h$ as lb,Gc as lc,Px as ld,r6 as m,gy as ma,y$ as mb,Ds as mc,Lr as md,qt as n,pf as na,b$ as nb,UG as nc,Uz as nd,Vr as o,At as oa,mO as ob,Yp as oc,jz as od,o6 as p,ta as pa,hO as pb,Qp as pc,Vz as pd,So as q,fC as qa,S$ as qb,wx as qc,Gz as qd,nt as r,mf as ra,yO as rb,QG as rc,Zz as rd,es as s,Zr as sa,nb as sb,D_ as sc,Xz as sd,Mu as t,oc as ta,bO as tb,ez as tc,o8 as td,i6 as u,ky as ua,vO as ub,kx as uc,Qz as ud,Lg as v,Ry as va,xO as vb,rz as vc,i8 as vd,s6 as w,S3 as wa,ob as wb,iz as wc,eZ as wd,l6 as x,k3 as xa,RO as xb,az as xc,tZ as xd,c6 as y,R3 as ya,L$ as yb,sz as yc,nZ as yd,d6 as z,P3 as za,Of as zb,lz as zc,rZ as zd};
|