@docx-editor.dev/core 2.15.0 → 2.16.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 -15
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +11 -9
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +12 -16
- package/dist/binding.js +1 -1
- package/dist/{chunk-Q4AB7E4O.cjs → chunk-4MIFIUEV.cjs} +1 -1
- package/dist/chunk-66DTF4TD.cjs +2 -0
- package/dist/chunk-67U2OZS7.cjs +2 -0
- package/dist/chunk-6EGMDUL7.js +21 -0
- package/dist/chunk-ABXCIZVW.js +2 -0
- package/dist/chunk-AEIAYDCG.js +1 -0
- package/dist/{chunk-YL4Q5LZP.cjs → chunk-BPSGGVP5.cjs} +1 -1
- package/dist/chunk-CMV2MTDE.js +5 -0
- package/dist/chunk-DYPT6YDY.js +1 -0
- package/dist/chunk-EWV5JMJY.cjs +21 -0
- package/dist/chunk-FAD7DH6Q.cjs +1 -0
- package/dist/chunk-GHNTGVKG.cjs +11 -0
- package/dist/chunk-GQVKCK33.js +2 -0
- package/dist/chunk-I4ENGOOZ.js +1 -0
- package/dist/chunk-IZHDCQUC.js +20 -0
- package/dist/chunk-KEXMDQ2Z.js +1 -0
- package/dist/chunk-KQEUFAAG.cjs +20 -0
- package/dist/chunk-QVJO5FUR.js +11 -0
- package/dist/chunk-SIUUTE5M.js +2 -0
- package/dist/chunk-TDHR2QLH.cjs +1 -0
- package/dist/{chunk-PXKZUTHX.cjs → chunk-WGHVIB6B.cjs} +2 -2
- package/dist/chunk-XKQTITOJ.cjs +5 -0
- package/dist/{chunk-KXPVOPR5.js → chunk-YKDRBDI2.js} +1 -1
- package/dist/chunk-YRTRPSSA.cjs +1 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -4
- package/dist/contracts/editor.d.ts +9 -7
- package/dist/contracts/interaction.d.ts +73 -10
- package/dist/contracts/modules.d.ts +8 -8
- package/dist/{custom-node-writes-C9ArIlJh.d.ts → custom-node-writes-4WOL8JB_.d.ts} +2 -2
- package/dist/{editor-sRxrFJd8.d.ts → editor-PDx0fqSo.d.ts} +26 -125
- package/dist/editor-scope-DZJT4ukT.d.ts +53 -0
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.d.ts +32 -26
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +24 -12
- package/dist/export.js +2 -2
- package/dist/{font-resolver-BYEHQGTw.d.ts → font-resolver-CdqOugwZ.d.ts} +2 -2
- package/dist/{headless-document-view-DELC4E5v.d.ts → headless-document-view-C9ONlGtf.d.ts} +2 -2
- package/dist/{hf-references-DTrHkktY.d.ts → hf-references-BZVHctVD.d.ts} +1 -1
- package/dist/{index-C3Gvq4jN.d.ts → index-BVb4a6O3.d.ts} +74 -28
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +20 -18
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-DoGR5cf8.d.ts → layout-shaping-D_U5z-Qh.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +270 -459
- package/dist/layout.js +1 -1
- package/dist/{note-properties-DSe8igrz.d.ts → note-properties-BosjbkGC.d.ts} +1 -1
- package/dist/{omml-equation-BpRmfDAf.d.ts → omml-equation-oLlbPpVy.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-DZzKxH5r.d.ts → protocol-CUsqt13U.d.ts} +28 -6
- package/dist/{review-items-DYRx187i.d.ts → review-items-kC-YI70C.d.ts} +1 -1
- package/dist/{review-reads-LbGUdNzn.d.ts → review-reads-DdvADsmp.d.ts} +8 -7
- package/dist/{revision-projection-DHRJH48u.d.ts → revision-projection-CN_DiOl_.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BXVWCBYm.d.ts → semantic-cell-selection-BMrXDniV.d.ts} +4 -4
- package/dist/{semantic-interaction-DZsDmPg5.d.ts → semantic-interaction-NGeYzYCN.d.ts} +1 -1
- package/dist/{semantic-paint-f7SqN4oW.d.ts → semantic-paint-CM8F-8pH.d.ts} +2 -2
- package/dist/{semantic-records-EIdwId-a.d.ts → semantic-records-BreR44Ki.d.ts} +1231 -947
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +80 -20
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-egdarvH_.d.ts → tree-op-types-C5rZzoAz.d.ts} +131 -53
- package/dist/{tree-package-fragment-DjkH4ESI.d.ts → tree-package-fragment-DDQHk8sv.d.ts} +3 -3
- package/dist/{tree-session-contract-CGOOgPjW.d.ts → tree-session-contract-dKgbKH9A.d.ts} +18 -8
- package/dist/{tree-store-DKJB0IcA.d.ts → tree-store-DU192chS.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-24APKZAN.cjs +0 -11
- package/dist/chunk-2YH4MSHX.cjs +0 -2
- package/dist/chunk-5Y7AADI6.js +0 -1
- package/dist/chunk-AREFLNUP.js +0 -11
- package/dist/chunk-AS7YZNQE.cjs +0 -2
- package/dist/chunk-AVGCKH6A.cjs +0 -20
- package/dist/chunk-CDYVDQRI.cjs +0 -5
- package/dist/chunk-HOEWFH5U.cjs +0 -1
- package/dist/chunk-KFELX7CN.js +0 -2
- package/dist/chunk-LGFKIF4M.cjs +0 -1
- package/dist/chunk-M52QXFKI.js +0 -1
- package/dist/chunk-MNUKSXRO.js +0 -1
- package/dist/chunk-PBOIGBDO.js +0 -2
- package/dist/chunk-PMHGONET.cjs +0 -1
- package/dist/chunk-QJYH6AYD.js +0 -1
- package/dist/chunk-QRC37MWG.cjs +0 -20
- package/dist/chunk-RJSB6RJ7.js +0 -20
- package/dist/chunk-SB54HLFJ.js +0 -20
- package/dist/chunk-XCESLTJL.js +0 -2
- package/dist/chunk-Z4527AXR.js +0 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {a as a$3}from'./chunk-D5EHDHYV.js';import {k,h,e,n,o,f,g as g$1,l as l$1,i as i$1,b,c,a as a$5,d as d$2}from'./chunk-SIUUTE5M.js';import {l,e as e$1,a as a$6,b as b$2,d as d$3,p,r,m,n as n$1}from'./chunk-DYPT6YDY.js';import {d,A,t,H,a as a$1,i,Od as Od$1,Ke,Ib as Ib$1,Ee,md as md$1,ae,be as be$1,Xe,qb as qb$1,Gc as Gc$1,jf,lf,ie,mf,ee,wf,_e as _e$1,xf as xf$1,Oa as Oa$1,gf,of,ef,$c as $c$1,ld as ld$1,sb as sb$1,rb as rb$1,Pd as Pd$1,Zd as Zd$1,uf,Yc as Yc$1,Xc as Xc$1,he,Ze,$e,df as df$1,Sa as Sa$1,cf,ya as ya$1,mb as mb$1,Le,Me as Me$1,Ne,nf,Ra as Ra$1,pf,ff,yf as yf$1,Re,Pe,wc as wc$1,zf as zf$1,zd as zd$1,Id as Id$1,Fd as Fd$1,Td as Td$1,Qd as Qd$1,Rd as Rd$1,Sd as Sd$1,Zc as Zc$2,Fb as Fb$1,Qa,We,Na as Na$1,Af as Af$1,sf,Vc as Vc$1,Wc as Wc$1,if as _if,J,g as g$2,Ve,za as za$1,Pa as Pa$1,Kd as Kd$1,vf as vf$1,rf,_b as _b$1,jc as jc$1,fc as fc$1,xc as xc$1,ce,Ha as Ha$3,tf,Qe as Qe$2,Hd as Hd$1,Bd as Bd$1,Bc as Bc$1,He,id as id$2,Ac as Ac$1,zc as zc$1,jd as jd$1,Ic as Ic$1,Cb as Cb$1,Eb as Eb$2}from'./chunk-6EGMDUL7.js';import {g}from'./chunk-KEXMDQ2Z.js';import {j,d as d$1,i as i$2}from'./chunk-CMV2MTDE.js';import {H as H$1}from'./chunk-ABXCIZVW.js';import {ba as ba$1,za,Ma as Ma$1,sa,ka as ka$1,ja,la,Da as Da$1,pa,Ga as Ga$1,Ha as Ha$2,xa as xa$1,da,na,ia,ha,fa,ra,qa as qa$1,ga as ga$1,Fa as Fa$1,ya as ya$2,ca}from'./chunk-GQVKCK33.js';import {a as a$4}from'./chunk-6JIJOZDW.js';import {a as a$2,cb as cb$1,ye,df,Sh as Sh$1,bf,xf,If,Mb as Mb$1,Zc as Zc$1,Ga,lb as lb$1,db as db$1,eb as eb$1,gb as gb$1,L,Bh as Bh$1,Dh as Dh$1,yh as yh$1,Ch as Ch$1,Ug as Ug$1,Zg as Zg$1,Xg as Xg$1,Wg as Wg$1,uh as uh$1,tg as tg$1,Yc as Yc$2,xe as xe$1,b as b$1,td as td$1,yf,zf,vf,wf as wf$1,Af,Bf,Ha as Ha$1,Nh as Nh$1,qh as qh$1,rh as rh$1,vh as vh$1,wh as wh$1,wd as wd$1,zd as zd$2,pc as pc$1,Cd as Cd$1,Me as Me$2,Eb as Eb$1,Db as Db$1,rd as rd$1,id as id$1,gd as gd$1,Uf,Sf,Qe as Qe$1,Re as Re$1,qg as qg$1,oh as oh$1,ph as ph$1,Fe,De,th as th$1,sh as sh$1,Jf,Ke as Ke$1,rc as rc$1,tc as tc$1,cd as cd$1,fh as fh$1,gh as gh$1,hh as hh$1,yd as yd$1,Vg as Vg$1,la as la$1,ma,na as na$1,Tf,Kh,gc as gc$1,Yg as Yg$1,Ne as Ne$1,Bc as Bc$2,yc as yc$1,N,da as da$1,w,Ce,M,tb as tb$1,yb as yb$1,de,g as g$3,Oa as Oa$2,Ra as Ra$2,Ed as Ed$1,ja as ja$1,Q,ia as ia$1,ha as ha$1,B,$a as $a$1,be as be$2,Vd as Vd$1,of as of$1,Hb as Hb$1,jh as jh$1,Jc as Jc$1}from'./chunk-QVJO5FUR.js';import {a}from'./chunk-GOEBQ26R.js';import {zipSync,strToU8}from'fflate';import {createT,en as en$1,locales,deepMerge}from'@docx-editor.dev/i18n';function _S(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var _m=false;function Bm(e){if(_m)return;_m=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 Xr(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:_S(e.request),diagnostic:e.diagnostic});if(e instanceof A)return new a("overLimit",e.message,{diagnostic:e.message});if(e instanceof t){let t=e.code==="wasmUnavailable"||e.code==="shapingLibraryMismatch"?"wasmUnavailable":"initializationFailed";return new a(t,e.message,{diagnostic:e.diagnostic??e.message,cause:e})}return new a("initializationFailed",e instanceof Error?e.message:"Font initialization failed",{diagnostic:e instanceof Error?e.message:String(e)})}async function ga(e,t){try{return await H(e,t)}catch(n){throw Xr(n)}}var BS=Object.freeze({scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false,collaborationStatus:"inactive"});var $m="http://schemas.openxmlformats.org/wordprocessingml/2006/main",qS="http://schemas.openxmlformats.org/package/2006/content-types",qm="http://schemas.openxmlformats.org/package/2006/relationships",ZS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",zS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",VS=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${qS}"><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>`,KS=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${qm}"><Relationship Id="rId1" Type="${ZS}" Target="word/document.xml"/></Relationships>`,jS=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${qm}"><Relationship Id="rId1" Type="${zS}" Target="styles.xml"/></Relationships>`,US=[{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}],WS=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>",GS=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${$m}"><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>`+US.map(WS).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>',XS=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${$m}"><w:body><w:p/><w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr></w:body></w:document>`;function Ql(){return zipSync({"[Content_Types].xml":strToU8(VS),"_rels/.rels":strToU8(KS),"word/_rels/document.xml.rels":strToU8(jS),"word/document.xml":strToU8(XS),"word/styles.xml":strToU8(GS)})}var Yr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",YS=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<Yr.length;t+=1)e[Yr.charCodeAt(t)]=t;return e})();function Li(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,a=r.length/4*3-o;if(a<=0||a>t)return null;let i=new Uint8Array(a),s=0;for(let l=0;l<r.length;l+=4){let c=0,u=0;for(let g=0;g<4;g+=1){let m=r.charCodeAt(l+g);if(m===61){if(l+g<r.length-o)return null;continue}let y=m<128?YS[m]:-1;if(y<0)return null;c=c<<6|y,u+=6;}c<<=24-u,u>=12&&(i[s++]=c>>>16&255),u>=18&&(i[s++]=c>>>8&255),u>=24&&(i[s++]=c&255);}return s===a?i:null}function Ni(e){let t=[],n="";for(let r=0;r<e.length;r+=3){let o=e[r],a=r+1<e.length?e[r+1]:0,i=r+2<e.length?e[r+2]:0;n+=Yr[o>>2]+Yr[(o&3)<<4|a>>4],n+=r+1<e.length?Yr[(a&15)<<2|i>>6]:"=",n+=r+2<e.length?Yr[i&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var QS=16*1024*1024,zm=64*1024*1024,Vm="data-docx-fragment",Km="data-docx-fragment-end",JS=Ni;function jm(e,t){if(!t)return `<div>${e}</div>`;let n=t.lastMarkCovered?"covered":"open";return `<div ${Vm}="${JS(t.bytes)}" ${Km}="${n}">${e}</div>`}function Zm(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>zm)return null;let o=r+n.length,a=e.indexOf('"',o);return a===-1?null:e.slice(o,a)}function Di(e,t=QS){if(e.length>zm)return null;let n=Zm(e,Vm);if(n===null||n.length===0)return null;let r=Li(n,t);if(r===null||r.byteLength===0)return null;let o=Zm(e,Km);return {bytes:r,lastMarkCovered:o==="covered"}}function yr(e){if(e==null)return null;let t=e.trim();return /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8}){0,3}$/.test(t)?t:null}var ed=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],Jl={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText"},td=new Map([...Object.entries(Jl).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function Um(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(Jl,e)?Jl[e]:null}var nd=Object.fromEntries(k),rd={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function Wm(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:`"${Q(n)}"`}var eI=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 br(e){if(e===null)return null;let t=Ce(e,"val",da$1);if(t===void 0||t==="nil"||t==="none")return null;let n=eI.get(t)??"solid",r=Ce(e,"sz",da$1),o=r!==void 0&&/^\d{1,4}$/.test(r)?Number.parseInt(r,10):0,a=o>0?o/8:.5,i=`${Math.round(a*100)/100}pt`,s=Ce(e,"color",da$1),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${i} ${n} ${l.toLowerCase()}`}function Gm(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 tI=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"]]),nI=new Set(ed);function Xm(e){if(e===null)return [];let t=Ce(e,"val",da$1),n=[],r=t===void 0?void 0:tI.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&nI.has(t)&&n.push(`text-underline:${t}`);let o=Ce(e,"color",da$1);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 Ym(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function Qm(e,t,n,r){if(e.namespaceUri!==da$1)return "";let o=e.localName==="footnoteRef"?"footnote":e.localName==="endnoteRef"?"endnote":null,a=e.localName==="footnoteReference"?"footnote":e.localName==="endnoteReference"?"endnote":null,i=o??a;if(i===null)return "";let s=Ce(e,"id",da$1),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(i,l))return "";let c=i==="footnote",u=o!==null,g=c?"MsoFootnoteReference":"MsoEndnoteReference",m=c?"ftn":"edn",y=u?`#_${m}ref${l}`:`#_${m}${l}`,v=u?`_${m}${l}`:`_${m}ref${l}`;return `<a style="mso-${c?"footnote":"endnote"}-id:${m}${l}" href="${y}" name="${v}"><span class="${g}"><span style="mso-special-character:footnote">[${n(i,l)}]</span></span></a>`}function Jm(e){if(e.namespaceUri!==da$1||e.localName!=="ptab")return "";let t=Ce(e,"alignment",da$1),n=Ce(e,"relativeTo",da$1),r=Ce(e,"leader",da$1)??"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 ng(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 rg(e,t){for(let r of e.classList){let o=/^MsoHeading([1-9])$/.exec(r);if(o)return `Heading${o[1]}`;let a=/^Heading([1-9])$/.exec(r);if(a)return `Heading${a[1]}`;let i=td.get(r);if(i!==void 0)return i}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 og=262144,rI=4096,oI=256,aI=2048,iI=8,sI=new Set(["MsoNormal",...td.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),lI=new Map([["left","left"],["start","left"],["center","center"],["right","right"],["end","right"],["justify","both"]]),dI=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function cI(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 uI(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 fI(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return uI(e,n)}return null}function pI(e){let t=e.split(",");if(t.length===0||t.length>iI)return null;let n=[];for(let r of t){let o=dI.exec(r);if(!o)return null;let a=o[2];if(!sI.has(a))return null;n.includes(a)||n.push(a);}return n}function mI(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 a=n.slice(r+1).trim().toLowerCase();if(a.length===0||a.length>32||a.includes("("))continue;let i=0;for(;i<a.length&&a.charCodeAt(i)>32;)i+=1;let s=lI.get(a.slice(0,i));s!==void 0&&(t=s);}return t}function gI(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>og)return n();let r=cI(e),o=0,a=0;for(;o<r.length&&a<rI;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let m=fI(r,o);if(m===null)return n();o=m;continue}let i=r.indexOf("{",o);if(i<0)return n();let s=r.slice(o,i),l=r.indexOf("}",i+1);if(l<0)return n();let c=r.slice(i+1,l);if(a+=1,o=l+1,s.length>oI||c.length>aI||c.includes("{"))return n();let u=pI(s),g=mI(c);if(!(!u||g===void 0))for(let m of u)t.set(m,g);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function ag(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>og)return new Map;let a=gI(o);if(!a.ok)return new Map;for(let[i,s]of a.alignments)t.set(i,s);}return t}var hI=262144;function ig(e,t=hI){let n=e.getElementsByTagName("style"),r="";for(let o=0;o<n.length&&o<16;o+=1){let a=n[o]?.textContent??"";a.length>t||r.length+a.length>t||(r+=`
|
|
3
|
+
${a}`);}return r}function sg(e,t,n){for(let o of t.classList){let a=n.get(o);if(a!==void 0){e.jc=a;break}}let r=t.getAttribute("align")?.trim().toLowerCase();r==="left"||r==="center"||r==="right"?e.jc=r:r==="justify"&&(e.jc="both");}function od(e,t,n,r){let o=tt(t.get(n)??"");if(o!==null&&o>0)return o/.75;let a=e.getAttribute(n)?.trim()??"";if(!/^[1-9]\d{0,4}$/.test(a))return null;let i=Number.parseInt(a,10);return r?i/.75:i}function Qr(e){return e.nodeType===1}function Qe(e){return e.tagName.toLowerCase()}var yI=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(":"))),bI=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"]]),vI=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,xI=new Map(ed.map(e=>[e.toLowerCase(),e])),eg=new WeakMap;function Je(e){let t=eg.get(e);if(t!==void 0)return t;let n=new Map;eg.set(e,n);let r=e.getAttribute("style");if(!r||r.length>8192)return n;for(let o of r.split(";")){let a=o.indexOf(":");if(a<=0)continue;let i=o.slice(0,a).trim().toLowerCase(),s=o.slice(a+1).trim();i.length>0&&s.length>0&&(n.delete(i),n.set(i,s));}return n}function Vn(e){let t=e.trim().toLowerCase(),n=yI.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[i,s,l]=o[1];return `${i}${i}${s}${s}${l}${l}`.toUpperCase()}let a=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,[^)]*)?\)$/.exec(t);if(a){let i=s=>Math.min(255,Number.parseInt(s,10)).toString(16).padStart(2,"0");return `${i(a[1])}${i(a[2])}${i(a[3])}`.toUpperCase()}return null}function SI(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return bI.get(t)}function tg(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||vI.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:Vn(t)}function Xt(e,t,n){return Math.min(n,Math.max(t,e))}function _i(e){let t=null;for(let[n,r]of e)if(n==="background")t=tg(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let a=tg(r);a!==null&&(t=a);}return t}var II=new Set(["left","center","right","decimal","bar"]),wI=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function kI(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(II.has(o)){t=o;continue}if(o==="list"){t="left";continue}let a=wI.get(o);if(a!==void 0){n=a;continue}let i=tt(o);if(!(i===null||i<0)){if(r.push({val:t,posTwips:Xt(Math.round(i*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 TI=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function ad(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var PI=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Hi(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let a of ad(e)){let i=a.toLowerCase();if(i==="none"||i==="hidden"){n=true;continue}let s=TI.get(i);if(s!==void 0){t=s;continue}let l=PI.get(a.toLowerCase())??tt(a);if(l!==null){r=l;continue}let c=Vn(a);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:Xt(Math.round(r*8),2,96),color:o??"000000"}}function Bi(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function id(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 sd(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let O=Number.parseInt(r,10);r==="bold"||O>=600?n.bold=true:(r==="normal"||O<600)&&(n.bold=false);}let o=t.get("font-style");o!==void 0&&(n.italic=o.toLowerCase().includes("italic"));let a=(t.get("text-decoration")??t.get("text-decoration-line"))?.toLowerCase();a!==void 0&&(a.includes("underline")&&(n.underline=true),a.includes("line-through")&&(n.strike=true),a.includes("none")&&(n.underline=n.strike=false));let i=t.get("font-variant")?.toLowerCase();i!==void 0&&(i.includes("small-caps")?n.smallCaps=true:(i.includes("normal")||i.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 O of l.trim().split(/\s+/)){let D=O.toLowerCase(),L=xI.get(D);if(L!==void 0)n.underline=true,n.underlineVal=L;else {let p=Vn(O);p!==null&&(n.underlineColor=p);}}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 O=Vn(t.get("text-decoration-color")??"");O!==null&&(n.underlineColor=O);}let u=Vn(t.get("color")??"");u&&(n.color=u);let g=SI(t.get("mso-highlight"));if(g)n.highlight=g,delete n.shdFill;else {let O=_i(t);O&&(n.shdFill=O);}let m=tt(t.get("font-size")??"");m!==null&&m>0&&(n.szHalfPoints=Xt(Math.round(m*2),2,3276));let y=t.get("font-family");if(y!==void 0){let O=y.split(",")[0].trim().replace(/^['"]|['"]$/g,"");O.length>0&&O.length<=64&&(n.font=O);}let v=tt(t.get("letter-spacing")??"");v!==null&&(n.charSpacingTwentieths=Xt(Math.round(v*20),-31680,31680));let w=t.get("vertical-align")?.trim().toLowerCase();w==="sub"?n.vertAlign="subscript":w==="super"&&(n.vertAlign="superscript");let b=yr(t.get("mso-ansi-language")),S=yr(t.get("mso-fareast-language")),k=yr(t.get("mso-bidi-language"));return b!==null&&(n.langVal=b),S!==null&&(n.langEastAsia=S),k!==null&&(n.langBidi=k),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function ya(e,t){let n=sd(e,Je(t)),r=yr(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function lg(e,t){let n=t.get("text-align")?.toLowerCase();n==="left"||n==="start"?e.jc="left":n==="center"?e.jc="center":n==="right"||n==="end"?e.jc="right":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 S=o.trim().split(/\s+/).map(k=>tt(k));if(S.length>=1&&S.length<=4&&!S.some(k=>k===null)){let[k,O=k,D=k,L=O]=S.length===2?[S[0],S[1],S[0],S[1]]:S.length===3?[S[0],S[1],S[2],S[1]]:S;r.top=k??null,r.right=O??null,r.bottom=D??null,r.left=L??null;}}let a=tt(t.get("margin-left")??"")??r.left;a!==null&&(a>0||a===0&&!e.numPr)&&(e.indLeftTwips=Xt(Math.round(a*20),0,31680));let i=tt(t.get("margin-right")??"")??r.right;i!==null&&i>=0&&(e.indRightTwips=Xt(Math.round(i*20),0,31680));let s=tt(t.get("text-indent")??"");if(s!==null&&s!==0){let S=Xt(Math.round(s*20),-31680,31680);S!==0&&(e.firstLineTwips=S);}let l=tt(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=Xt(Math.round(l*20),0,31680));let c=tt(t.get("margin-bottom")??"")??r.bottom;c!==null&&c>=0&&(e.spacingAfterTwips=Xt(Math.round(c*20),0,31680));let u=t.get("line-height")?.trim()??"",g=t.get("mso-line-height-rule")?.trim().toLowerCase(),m=tt(u);if(m!==null&&m>0)e.lineTwentieths=Xt(Math.round(m*20),24,31680),e.lineRule=g==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(u)&&Number.parseFloat(u)>0)e.lineTwentieths=Xt(Math.round(240*Number.parseFloat(u)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(u)){let S=Number.parseFloat(u);S>0&&(e.lineTwentieths=Xt(Math.round(2.4*S),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 y=_i(t);y&&(e.shdFill=y);let v=kI(t.get("tab-stops"));v!==void 0&&(e.tabs=v);let w=Hi(t.get("mso-border-alt"))??Hi(t.get("border")),b={};for(let S of ["top","left","bottom","right"]){let k=Hi(t.get(`mso-border-${S}-alt`))??Hi(t.get(`border-${S}`))??w;k!==void 0&&k!=="suppressed"&&(b[S]=k);}Object.keys(b).length>0&&(e.borders=b);}var CI="http://schemas.openxmlformats.org/drawingml/2006/picture",RI=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,EI=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 dg(e,t,n){return Math.min(n,Math.max(t,e))}function cg(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let a=RI.exec(o);if(!a)return;let i=n.mediaBySrc.get(o),s=i===void 0?void 0:n.media.get(i),l=s??Li(a[1],n.maxImageBytes);if(l==null)return;let c=tb$1(l),u=EI.get(c);if(u===void 0)return;let g=c==="image/png"||c==="image/jpeg"||c==="image/gif"||c==="image/bmp"||c==="image/webp"?yb$1(l,c):null,m=Je(e),y=od(e,m,"width",n.wordHtml),v=od(e,m,"height",n.wordHtml);g!==null?y===null&&v===null?(y=g.pixelWidth*96/(g.dpiX??96),v=g.pixelHeight*96/(g.dpiY??96)):y!==null&&v===null?v=y*g.pixelHeight/g.pixelWidth:y===null&&v!==null&&(y=v*g.pixelWidth/g.pixelHeight):y!==null&&v===null?v=y*2/3:y===null&&v!==null&&(y=v*3/2);let w=y===null?381e4:dg(Math.round(y*9525),9525,3e7),b=v===null?254e4:dg(Math.round(v*9525),9525,3e7),S=s===void 0?void 0:i;S===void 0&&(n.imageCount+=1,S=`word/media/image${n.imageCount}.${u}`,n.media.set(S,l),n.mediaBySrc.set(o,S),n.mediaExtensions.has(u)||n.mediaExtensions.set(u,c));let k=r(S.replace("word/",""));n.docPrId+=1,t.push(`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${w}" cy="${b}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${CI}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${k}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${w}" cy="${b}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`);}var FI="http://schemas.openxmlformats.org/wordprocessingml/2006/main",OI='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',ug=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function fg(e,t,n){let r=720*(n+1);if(e==="bullet"){let a=ug[n%ug.length];return `<w:lvl w:ilvl="${n}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${N(a.text)}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${r}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=e==="lowerRoman"||e==="upperRoman";return `<w:lvl w:ilvl="${n}"><w:start w:val="${t}"/><w:numFmt w:val="${e}"/><w:lvlText w:val="%${n+1}."/><w:lvlJc w:val="${o?"right":"left"}"/><w:pPr><w:ind w:left="${r}" w:hanging="${o?180:360}"/></w:pPr></w:lvl>`}var AI=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),MI=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),pg=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function mg(e){let t=new Map;if(e.length===0||e.length>262200)return t;pg.lastIndex=0;let n,r=0;for(;(n=pg.exec(e))!==null&&r<512;){r+=1;let o="decimal",a=null;for(let s of n[4].split(";")){let l=s.indexOf(":");if(l<=0)continue;let c=s.slice(0,l).trim().toLowerCase(),u=s.slice(l+1).trim().toLowerCase();c==="mso-level-number-format"?o=MI.get(u)??null:c==="mso-level-start-at"&&/^\d{1,5}$/.test(u)&&(a=Math.min(32767,Number.parseInt(u,10)));}if(o===null)continue;let i=n[3]===void 0?`l${n[1]}:level${n[2]}`:`l${n[1]}:level${n[2]}:lfo${n[3]}`;t.has(i)||t.set(i,{kind:o,start:a});}return t}function gg(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?hg(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 LI=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function hg(e){let t=e.toLowerCase();if(!LI.test(t))return null;let n=0,r=0;for(let o of t){let a=AI.get(o);if(a===void 0)return null;n+=a,r>0&&r<a&&(n-=2*r),r=a;}return n>0&&n<=32767?n:null}function yg(e){let t=e.trim().replace(/^\(/,""),n=/^(\d{1,5}(?:\.\d{1,5})*)[.)]/.exec(t);if(n){let i=n[1].split(".");return {kind:"decimal",start:Math.min(32767,Number.parseInt(i[i.length-1],10))}}let r=/^([A-Za-z])[.)]/.exec(t);if(r){let i=r[1].toLowerCase();if(i==="i"||i==="v"||i==="x"){let l=i==="i"?1:i==="v"?5:10;return {kind:r[1]===i?"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 i=o[1],s=i===i.toLowerCase(),l=/^([A-Za-z])\1+$/.test(i);if(!l||/^[iI]+$/.test(i)){let c=hg(i);if(c!==null)return {kind:s?"lowerRoman":"upperRoman",start:c}}if(l){let c=i.toLowerCase().charCodeAt(0),u=Math.min(32767,(i.length-1)*26+(c-96));return {kind:s?"lowerLetter":"upperLetter",start:u}}}let a=/\d{1,5}/.exec(t);return a?{kind:"decimal",start:Math.min(32767,Number.parseInt(a[0],10))}:{kind:"bullet",start:1}}var NI=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 bg(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=Je(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:NI.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 ld(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 vg(e){let t=e.map((r,o)=>{let a=r.levels.get(0)??r.levels.values().next().value??{kind:"decimal"},i=Array.from({length:9},(s,l)=>{let c=r.levels.get(l);return c?fg(c.kind,c.start,l):fg(a.kind==="bullet"?"bullet":"decimal",1,l)}).join("");return `<w:abstractNum w:abstractNumId="${o}"><w:multiLevelType w:val="hybridMultilevel"/>${i}</w:abstractNum>`}).join(""),n=e.map((r,o)=>`<w:num w:numId="${r.numId}"><w:abstractNumId w:val="${o}"/></w:num>`).join("");return `${OI}<w:numbering xmlns:w="${FI}">${t}${n}</w:numbering>`}function ln(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 i=0;i<t.length;i+=1)r=(Math.imul(r,33)^t.charCodeAt(i))>>>0;let o=`_${r.toString(36)}`,a=n.slice(0,40-o.length);return /^[A-Za-z_]/.test(a)||(a=`_${a.slice(0,39-o.length)}`),`${a}${o}`}function xg(e){if(e===null)return false;if(e.startsWith("#"))return ln(e.slice(1))!==null;let t=L(e);return t?.ok===true&&t.href.length>0}function Sg(e,t){if(e!==void 0&&e.startsWith("#")){let o=ln(e.slice(1)),a=ln(t)??o;return a===null?null:`#${a}`}let n=e===void 0?null:L(e),r=ln(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function Ig(){let e=null;return (t,n,r)=>{if(e!==null&&e.html===t&&e.key===n){let i=e.value;return e=null,i}let o=r(),a={html:t,key:n,value:o};return e=a,setTimeout(()=>{e===a&&(e=null);},0),o}}var DI=/^(ftn|edn)([1-9]\d{0,9})$/i,HI={footnote:"ftn",endnote:"edn"};function wg(e,t){let n=e===null?null:DI.exec(e);if(!n||n[1].toLowerCase()!==HI[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function dd(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=wg(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function _I(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=wg(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function kg(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],a=_I(o,Je(o));a!==null&&t.push({...a,element:o});}return t}function Tg(e,t,n){let r=new Map(t.map(i=>[i.element,i])),o=i=>{let s=i.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},a=e.getElementsByTagName("a");for(let i=0;i<a.length&&i<2e4;i+=1){let s=a[i],l=dd(Je(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 Pg(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var BI=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function Jr(e,t,n){return e.replace(BI,(r,o,a)=>{let i=`${o}:${a}`;return t.has(i)?n?.get(i)??"":r})}function cd(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">${n}</w:${e}s>`}function Cg(e,t,n,r){let o=new Set,a={footnote:new Set,endnote:new Set},i=()=>{a.footnote.clear(),a.endnote.clear();let s=[],l=(c,u)=>{o.has(`${c}:${u}`)||!e.notes[c].has(u)||a[c].has(u)||(a[c].add(u),s.push({kind:c,id:u}));};for(let c of ["footnote","endnote"])for(let u of e.bodyNoteRefs[c])l(c,u);for(let c of o)for(let u of e.noteNoteRefs.get(c)??[])l(u.kind,u.id);for(;s.length>0;){let c=s.pop();for(let u of e.noteNoteRefs.get(`${c.kind}:${c.id}`)??[])l(u.kind,u.id);}};for(;;){i();let s=false;for(let l of ["footnote","endnote"]){for(let c of e.notes[l].keys()){let u=`${l}:${c}`;if(!(a[l].has(c)||o.has(u))){o.add(u),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(u=>Jr(u,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 u=new Map;for(let g of c){let m=Jr(g.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,(y,v,w)=>{let b=u.get(w);if(b===void 0){let S=e.noteRels[s].find(k=>k.id===w);if(S===void 0)return y;b=r(e,S.type,S.target,S.external),u.set(w,b);}return ` r:${v}="${b}"`});n.push(m),e.lastMarkCovered=false;}}}function ud(e,t,n,r=1,o=0){let a=e.lists.get(t);if(a)return a.levels.has(o)||a.levels.set(o,{kind:n,start:r}),a.numId;let i=String(1001+e.lists.size),s={numId:i,levels:new Map([[o,{kind:n,start:r}]])};return e.lists.set(t,s),e.listsByNumId.set(i,s),i}function Rg(e,t,n,r){let o=t.get("mso-list");if(o===void 0)return;let a=/\bl(\d{1,4})\s+level(\d{1,2})\b/i.exec(o);if(!a)return;let i=Math.min(Math.max(Number.parseInt(a[2],10)-1,0),8),s=$I(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),c=(l!==null?n.listDefinitions.get(`l${a[1]}:level${a[2]}:lfo${l[1]}`):void 0)??n.listDefinitions.get(`l${a[1]}:level${a[2]}`),u,g;c!==void 0?(u=c.kind,g=gg(s,u)??c.start??1):{kind:u,start:g}=yg(s);let y=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${a[1]}${l?`:lfo${l[1]}`:""}`;return {numId:ud(n,y,u,g,i),ilvl:i}}function $I(e,t){let n="",r=(o,a)=>{if(!(n.length>0||a>8||t.nodesLeft<=0)&&Qr(o)){if(Bi(o)){n=(o.textContent??"").slice(0,16);return}for(let i of Array.from(o.childNodes))r(i,a+1);}};for(let o of Array.from(e.childNodes))r(o,0);return n}var qI="http://schemas.openxmlformats.org/package/2006/relationships",ZI="http://schemas.openxmlformats.org/package/2006/content-types",zI="application/vnd.openxmlformats-package.relationships+xml",md='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',VI="http://schemas.openxmlformats.org/wordprocessingml/2006/main",pd="http://schemas.openxmlformats.org/officeDocument/2006/relationships",KI="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",jI="http://schemas.openxmlformats.org/drawingml/2006/main",UI="http://schemas.openxmlformats.org/drawingml/2006/picture",Eg={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 fd(e){let t=e.map(n=>`<Relationship Id="${N(n.id)}" Type="${N(n.type)}" Target="${N(n.target)}"${n.external?' TargetMode="External"':""}/>`).join("");return `${md}<Relationships xmlns="${qI}">${t}</Relationships>`}function WI(e){let t=new Map;t.set("word/document.xml",Oa$2(e.documentXml)),t.set("word/_rels/document.xml.rels",Oa$2(fd(e.rels))),t.set("_rels/.rels",Oa$2(fd([{id:"rId1",type:`${pd}/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="${Eg.document}"/>`;for(let[a,i]of n)i!==void 0&&(t.set(`word/${a}.xml`,Oa$2(i)),r+=`<Override PartName="/word/${a}.xml" ContentType="${Eg[a]}"/>`);for(let[a,i]of [["footnotes",e.footnotesRels],["endnotes",e.endnotesRels]])i!==void 0&&i.length>0&&t.set(`word/_rels/${a}.xml.rels`,Oa$2(fd(i)));for(let[a,i]of e.media)t.set(a,i);let o=`<Default Extension="rels" ContentType="${zI}"/><Default Extension="xml" ContentType="application/xml"/>`;for(let[a,i]of e.mediaExtensions)o+=`<Default Extension="${N(a)}" ContentType="${N(i)}"/>`;return t.set("[Content_Types].xml",Oa$2(`${md}<Types xmlns="${ZI}">${o}${r}</Types>`)),Ra$2(t)}function Fg(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${pd}/${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=`${md}<w:document xmlns:w="${VI}" xmlns:r="${pd}" xmlns:wp="${KI}" xmlns:a="${jI}" xmlns:pic="${UI}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return WI({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:vg(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:cd("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:cd("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}function gd(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(!(r!==9&&(r<32||r===65534||r===65535))){if(r>=55296&&r<=56319){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(t+=e[n]+e[n+1],n+=1);continue}r>=56320&&r<=57343||(t+=e[n]);}}return t}function Kn(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${N(e.rStyle)}"/>`),e.font!==void 0){let i=N(gd(e.font));t+=e.rtl?`<w:rFonts w:cs="${i}"/>`:`<w:rFonts w:ascii="${i}" w:hAnsi="${i}"/>`;}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="${N(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 a=`${n===void 0?"":` w:val="${N(n)}"`}${r===void 0?"":` w:eastAsia="${N(r)}"`}${o===void 0?"":` w:bidi="${N(o)}"`}`;return a.length>0&&(t+=`<w:lang${a}/>`),t.length>0?`<w:rPr>${t}</w:rPr>`:""}function $i(e,t){return `<w:r>${Kn(t)}<w:t xml:space="preserve">${M(gd(e))}</w:t></w:r>`}function GI(e){let t="";if(e.styleId!==void 0&&(t+=`<w:pStyle w:val="${N(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="${N(e.numPr.numId)}"/></w:numPr>`),e.borders!==void 0){let r="";for(let o of ["top","left","bottom","right"]){let a=e.borders[o];a!==void 0&&(r+=`<w:${o} w:val="${a.val}" w:sz="${a.szEighthPoints}" w:space="0" w:color="${a.color}"/>`);}r.length>0&&(t+=`<w:pBdr>${r}</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(r=>`<w:tab w:val="${r.val}" w:pos="${r.posTwips}"`+(r.leader===void 0?"/>":` w:leader="${r.leader}"/>`)).join("")}</w:tabs>`),e.bidi&&(t+="<w:bidi/>"),e.spacingBeforeTwips!==void 0||e.spacingAfterTwips!==void 0||e.lineTwentieths!==void 0){let r="<w:spacing";e.spacingBeforeTwips!==void 0&&(r+=` w:before="${e.spacingBeforeTwips}"`),e.spacingAfterTwips!==void 0&&(r+=` w:after="${e.spacingAfterTwips}"`),e.lineTwentieths!==void 0&&(r+=` w:line="${e.lineTwentieths}" w:lineRule="${e.lineRule??"auto"}"`),t+=`${r}/>`;}let n=e.firstLineTwips;if(e.indLeftTwips!==void 0||e.indRightTwips!==void 0||n!==void 0){let r="<w:ind";e.indLeftTwips!==void 0&&(r+=` w:left="${e.indLeftTwips}"`),e.indRightTwips!==void 0&&(r+=` w:right="${e.indRightTwips}"`),n!==void 0&&(r+=n>=0?` w:firstLine="${n}"`:` w:hanging="${-n}"`),t+=`${r}/>`;}return e.jc!==void 0&&(t+=`<w:jc w:val="${e.jc}"/>`),t.length>0?`<w:pPr>${t}</w:pPr>`:""}function vr(e,t){return `<w:p>${GI(e)}${t.join("")}</w:p>`}var Ag={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function qi(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 XI=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,Og=new WeakMap;function hd(e){let t=Og.get(e);for(t||(t={checked:0,furniture:true},Og.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=XI.test(e[t.checked]),t.checked+=1;return t.furniture}var jn=31680;function Ln(e,t,n){return Math.min(n,Math.max(t,e))}function Mg(e){let t=tt(Je(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 YI(e){return xr(e,"colspan",63)}function Lg(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 xr(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:Ln(Number.parseInt(r,10),1,n)}function Ng(e,t){let n=(Je(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${Ln(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=Mg(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let a=Ln(Math.round(o*20),1,jn);return {xml:`<w:tblW w:w="${a}" w:type="dxa"/>`,twips:a}}function Dg(e){let n=Je(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 Hg(e){let t=Je(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",a=` w:horzAnchor="${o(n)}" w:vertAnchor="${o(r)}"`,i=t.get("mso-table-left")?.trim().toLowerCase();if(i==="left"||i==="center"||i==="right")a+=` w:tblpXSpec="${i}"`;else {let l=tt(i??"");l!==null&&(a+=` w:tblpX="${Ln(Math.round(l*20),-jn,jn)}"`);}let s=tt(t.get("mso-table-top")??"");return s!==null&&(a+=` w:tblpY="${Ln(Math.round(s*20),-jn,jn)}"`),`<w:tblpPr${a}/>`}function _g(e,t,n){let r=Math.max(1,Math.floor(n/t)),o=-1,a=Array.from({length:t},()=>r),i=new Array(t).fill(null);for(let u of e){let g=Array.from({length:t},()=>r),m=0,y=0,v=i.map(S=>S?S.span:null);for(let S=0;S<t;S+=1){let k=i[S];k&&(k.remaining-=1,k.remaining<=0&&(i[S]=null));}let w=Array.from(u.children).filter(S=>/^t[dh]$/.test(Qe(S))),b=0;for(;y<t;){let S=v[y];if(S!==null){y+=S;continue}let k=w[b];if(k===void 0)break;b+=1;let O=Math.min(YI(k),t-y);for(let p=y+1;p<y+O;p+=1)if(v[p]!==null){O=p-y;break}let D=xr(k,"rowspan",1e3);D>1&&(i[y]={remaining:D-1,span:O});let L=Mg(k);if(L!==null){let p=Ln(Math.round(L*20/O),1,jn);for(let A=0;A<O;A+=1)g[y+A]=p;m+=O;}y+=O;}m>o&&(o=m,a=g);}let s=a.reduce((u,g)=>u+g,0);if(s<=0)return a;let l=a.map(u=>Math.max(1,Math.round(u*n/s))),c=n-l.reduce((u,g)=>u+g,0);return l[l.length-1]=Math.max(1,l[l.length-1]+c),l}function yd(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 Bg=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),$g=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function qg(e){return Ln(Math.round(e*8),2,96)}function bn(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of ad(e)){let a=Bg.get(o.toLowerCase());if(a!==void 0){t=a;continue}let i=$g.get(o.toLowerCase())??tt(o);if(i!==null){n=i;continue}let s=Vn(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:qg(n),color:r??"000000"}}}function Zi(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=Bg.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],a=o===void 0||o.length>64?null:$g.get(o.toLowerCase())??tt(o);if(a!==null&&a<=0)return;let i=e.get(`${t}-color`)?.trim().split(/\s+/)[0],s=i===void 0||i.length>64?null:Vn(i);return {val:r,size:a===null?4:qg(a),color:s??"000000"}}function Zg(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function zg(e){let t=Je(e),r=bn(t.get("mso-border-alt"))??bn(t.get("border"))??Zi(t,"border")??(e.getAttribute("border")?.trim()&&e.getAttribute("border")?.trim()!=="0"?{val:"single",size:4,color:"auto"}:void 0),o=[["top","top"],["left","left"],["bottom","bottom"],["right","right"],["insideH","insideh"],["insideV","insidev"]],a="";for(let[i,s]of o){let l=bn(t.get(`mso-border-${s}-alt`))??bn(t.get(`mso-border-${s}`))??bn(t.get(`border-${s}`))??Zi(t,`border-${s}`)??r;l!==void 0&&(a+=Zg(i,l));}return a.length>0?`<w:tblBorders>${a}</w:tblBorders>`:""}function Vg(e){let t=Je(e),n=tt(t.get("height")??"");if(n===null||n<=0)return "";let r=Ln(Math.round(n*20),1,jn),a=t.get("mso-height-rule")?.trim().toLowerCase()==="exactly"?"exact":"atLeast";return `<w:trPr><w:trHeight w:val="${r}" w:hRule="${a}"/></w:trPr>`}function QI(e){let t={top:null,right:null,bottom:null,left:null},n=e.get("padding");if(n!==void 0&&n.length<=128){let o=n.trim().split(/\s+/).map(a=>tt(a));if(o.length>=1&&o.length<=4&&!o.some(a=>a===null||a<0)){let[a,i=a,s=a,l=i]=o.length===2?[o[0],o[1],o[0],o[1]]:o.length===3?[o[0],o[1],o[2],o[1]]:o;t.top=a??null,t.right=i??null,t.bottom=s??null,t.left=l??null;}}for(let o of ["top","right","bottom","left"]){let a=tt(e.get(`padding-${o}`)??"");a!==null&&a>=0&&(t[o]=a);}let r="";for(let o of ["top","left","bottom","right"]){let a=t[o];a!==null&&(r+=`<w:${o} w:w="${Ln(Math.round(a*20),0,jn)}" w:type="dxa"/>`);}return r.length>0?`<w:tcMar>${r}</w:tcMar>`:""}function Kg(e){let t=Je(e),n=bn(t.get("mso-border-alt"))??bn(t.get("border"))??Zi(t,"border"),r="";for(let s of ["top","left","bottom","right"]){let l=bn(t.get(`mso-border-${s}-alt`))??bn(t.get(`mso-border-${s}`))??bn(t.get(`border-${s}`))??Zi(t,`border-${s}`)??n;l!==void 0&&(r+=Zg(s,l));}let o=r.length>0?`<w:tcBorders>${r}</w:tcBorders>`:"",a=_i(t);a&&(o+=`<w:shd w:val="clear" w:color="auto" w:fill="${a}"/>`),o+=QI(t);let i=t.get("vertical-align")?.toLowerCase()??e.getAttribute("valign")?.toLowerCase();return i==="top"?o+='<w:vAlign w:val="top"/>':i==="middle"||i==="center"?o+='<w:vAlign w:val="center"/>':i==="bottom"&&(o+='<w:vAlign w:val="bottom"/>'),o}var JI=9360;function jg(e,t,n,r,o,a){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let L of Array.from(e.children))Qe(L)==="caption"&&a(Array.from(L.childNodes),t+1,n,r,o,true);let i=Lg(e);if(i.length===0)return;let s=1,l=r.nodesLeft,c=[];for(let L of i){if(l<=0||s>=63)break;let p=c.map(P=>P?P.span:null);for(let P=0;P<c.length;P+=1){let N=c[P];N&&(N.remaining-=1,N.remaining<=0&&(c[P]=null));}let A=Array.from(L.children).filter(P=>/^t[dh]$/.test(Qe(P))),Z=0,T=0;for(;T<63&&(l-=1,!(l<=0));){let P=T<p.length?p[T]:null;if(P!=null){T+=P;continue}let N=A[Z];if(N===void 0)break;Z+=1;let _=Math.min(xr(N,"colspan",63),63-T);for(let $=T+1;$<T+_;$+=1)if($<p.length&&p[$]!=null){_=$-T;break}let M=xr(N,"rowspan",1e3);if(M>1){for(;c.length<=T;)c.push(null);c[T]={remaining:M-1,span:_};}T+=_;}for(let P=T;P<p.length&&P<63;P+=1){let N=p[P];N!=null&&(T=Math.max(T,P+N));}s=Math.max(s,T);}s=Math.min(Math.max(s,1),63);let u=Ng(e,JI),g=u.twips,m=i.length>r.nodesLeft?i.slice(0,Math.max(1,r.nodesLeft)):i,y=_g(m,s,g),v=zg(e),w=Hg(e),b=Dg(e),S=b===void 0?"":`<w:jc w:val="${b}"/>`,k=y.map(L=>`<w:gridCol w:w="${L}"/>`).join(""),O=new Array(s).fill(null),D=[];for(let L of i){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let p=O.map(_=>_?_.span:null);for(let _=0;_<s;_+=1){let M=O[_];M&&(M.remaining-=1,M.remaining<=0&&(O[_]=null));}let A=Array.from(L.children).filter(_=>/^t[dh]$/.test(Qe(_))),Z=0,T=[],P=0,N=true;for(;P<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,N=false;break}let _=p[P];if(_!==null){let G=_>1?`<w:gridSpan w:val="${_}"/>`:"";T.push(`<w:tc><w:tcPr><w:tcW w:w="${yd(y,P,_)}" w:type="dxa"/>${G}<w:vMerge/></w:tcPr><w:p/></w:tc>`),P+=_;continue}let M=A[Z];if(M===void 0){T.push(`<w:tc><w:tcPr><w:tcW w:w="${y[P]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),P+=1;continue}Z+=1;let $=Math.min(xr(M,"colspan",63),s-P);for(let G=P+1;G<P+$;G+=1)if(p[G]!==null){$=G-P;break}let E=xr(M,"rowspan",1e3);E>1&&(O[P]={remaining:E-1,span:$}),T.push(ew(M,$,yd(y,P,$),E>1,t,n,r,a)),P+=$;}if(!N)break;D.push(`<w:tr>${Vg(L)}${T.join("")}</w:tr>`);}D.length!==0&&(o.push(`<w:tbl><w:tblPr>${w}${u.xml}${S}${v}</w:tblPr><w:tblGrid>${k}</w:tblGrid>${D.join("")}</w:tbl>`),r.lastMarkCovered=false);}function ew(e,t,n,r,o,a,i,s){let l=Qe(e)==="th",c=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(c+=`<w:gridSpan w:val="${t}"/>`),r&&(c+='<w:vMerge w:val="restart"/>'),c+=Kg(e);let u={run:l?{...a.run,bold:true}:a.run,para:l?{jc:"center"}:{},paragraphMarkCovered:false,pre:false,list:null,...a.noteBody?{noteBody:a.noteBody}:{},...a.rels?{rels:a.rels}:{}},g=[];return s(Array.from(e.childNodes),o+2,u,i,g,true),(g.length===0||g[g.length-1].endsWith("</w:tbl>"))&&g.push("<w:p/>"),`<w:tc><w:tcPr>${c}</w:tcPr>${g.join("")}</w:tc>`}function Ug(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 Wg(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 Gg(e){if(Qe(e)!=="br")return false;let t=Je(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function Xg(e){if(Gg(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||!Gg(r))return false;t=true;}}return t}function Yg(e){if(Qe(e)!=="p")return false;let t=null;for(let o=0;o<e.childNodes.length;o+=1){let a=e.childNodes[o];if(a.nodeType===3){if((a.nodeValue??"").replace(/[\s\u00a0]/g,"").length===0)continue;return false}if(a.nodeType!==1||t!==null)return false;t=a;}if(t===null)return false;let n=Je(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 a=t.childNodes[o];if(a.nodeType!==3)return false;r+=a.nodeValue??"";}return r.includes("\xA0")&&r.replace(/[\s\u00a0]/g,"").length===0}function bd(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var vd=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),xd=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),Sd=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),tw=new Set([...xd,...Sd,"table","ol","ul","w:sdt"]);function Id(e){for(let t=0;t<e.children.length;t+=1)if(tw.has(Qe(e.children[t])))return true;return false}var nw=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function Qg(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 a=0;a<o.children.length&&n<64;a+=1){let i=o.children[a];n+=1;let s=Qe(i);if(nw.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(i);}}return null}var rw=4*1024*1024,ow=1e5,aw=64,iw=2*1024*1024,Jg="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function wd(e,t,n,r,o=e.rels){let a=`rId${o.length+1}`;return o.push({id:a,type:t,target:n,external:r}),a}function zi(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 v=e.nodeValue??"";if(n.pre){let b=v.replace(/\r\n?/g,`
|
|
4
|
+
`).split(`
|
|
5
|
+
`);for(let S=0;S<b.length;S+=1){if(S>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${Kn(n.run)}<w:br/></w:r>`);}let k=b[S];k.length>0&&r.push($i(k,n.run));}return}let w=v.replace(/[ \t\r\n\f\v]+/g," ");if(w.length===0||w===" "&&hd(r))return;r.push($i(w,n.run));return}if(!Qr(e))return;let a=Qe(e);if(vd.has(a))return;let i=Je(e);if(Bi(e)&&n.para.numPr!==void 0||i.get("mso-element")?.trim().toLowerCase()==="comment-reference"||i.get("mso-special-character")?.trim().toLowerCase()==="comment"||e.classList.contains("msocomanchor")||o.definedNoteElements.has(e))return;if(a==="w:ptab"){let v=Wg(e);v.length>0&&r.push(`<w:r>${Kn(n.run)}${v}</w:r>`);return}let l=Ug(i.get("mso-tab-count"));if(l.length>0){if(o.nodesLeft-=l.split("<w:tab/>").length-2,o.nodesLeft<=0){o.truncated=true;return}let v=sd(id(n.run,a),i);if(r.push(`<w:r>${Kn(v)}${l}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let v=i.get("page-break-before")?.trim().toLowerCase()==="always"||i.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${Kn(n.run)}${v?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){cg(e,r,o,v=>wd(o,`${Jg}/image`,v,false,n.rels??o.rels));return}let c=id(n.run,a),u=a==="a"?e.getAttribute("href"):null,g=a==="a"?dd(i):null;g===null&&xg(u)&&(c={...c,rStyle:"Hyperlink"});let m=ya(c,e),y={...n,run:m,pre:n.pre||a==="pre"};if(g!==null){let v={...y.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===g.kind&&n.noteBody.id===g.id){let w=g.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${Kn(v)}<w:${w}/></w:r>`);return}if(o.definedNotes[g.kind].has(g.id)){let w=g.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${Kn(v)}<w:${w} w:id="${g.id}"/></w:r>`);let b=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),S=`${g.kind}:${g.id}`;if(b.length>0&&!o.noteMarkFallbacks.has(S)&&o.noteMarkFallbacks.set(S,$i(b,v)),n.noteBody===void 0)o.bodyNoteRefs[g.kind].add(g.id);else {let k=`${n.noteBody.kind}:${n.noteBody.id}`,O=o.noteNoteRefs.get(k)??[];O.push({kind:g.kind,id:g.id}),o.noteNoteRefs.set(k,O);}return}for(let w of Array.from(e.childNodes))zi(w,t+1,y,r,o);return}if(a==="a"){let v=e.getAttribute("href"),w=ln(e.getAttribute("name")||e.getAttribute("id")),b=[];for(let O of Array.from(e.childNodes))zi(O,t+1,y,b,o);let S=v?.startsWith("#")?ln(v.slice(1)):null,k=b.join("");if(S!==null)k=`<w:hyperlink w:anchor="${N(S)}">${k}</w:hyperlink>`;else if(v!==null&&!v.startsWith("#")){let O=L(v);O.ok&&O.href.length>0&&(k=`<w:hyperlink r:id="${wd(o,`${Jg}/hyperlink`,O.href,true,n.rels??o.rels)}">${k}</w:hyperlink>`);}if(w!==null){let O=String(o.nextBookmarkId++);k=`<w:bookmarkStart w:id="${O}" w:name="${N(w)}"/>${k}<w:bookmarkEnd w:id="${O}"/>`;}k.length>0&&r.push(k);return}for(let v of Array.from(e.childNodes))zi(v,t+1,y,r,o);}function eh(e,t,n,r){let o=Qe(e),a=Je(e),i={};r&&(i.pageBreakBefore=true);let s=rg(e,n.wordHtml);s!==void 0&&(i.styleId=s),t.para.numPr&&(i.numPr=t.para.numPr),t.para.jc&&(i.jc=t.para.jc),t.para.bidi&&(i.bidi=true);let l={...t.run},c=Ag[o];c!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=c);let u=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let g=Rg(e,a,n,t.noteBody);return g&&(i.numPr=g),sg(i,e,n.classAlignments),lg(i,a),l=ya(l,e),e.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(i.bidi=true),{run:l,para:i,paragraphMarkCovered:i.styleId!==void 0||i.numPr!==void 0,pre:u,list:t.list,...t.noteBody?{noteBody:t.noteBody}:{},...t.rels?{rels:t.rels}:{}}}function th(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;let i=eh(e,n,r,a);Un(Array.from(e.childNodes),t+1,i,r,o,true,void 0,false);}function nh(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;let i=bg(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:ud(r,`sem:${r.semanticListCount}`,i,ld(e)),level:0};if(n.list){let u=r.listsByNumId.get(s.numId);u!==void 0&&!u.levels.has(s.level)&&u.levels.set(s.level,{kind:i,start:ld(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},c=a;for(let u of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!Qr(u))continue;let g=Qe(u);if(g==="li")r.nodesLeft-=1,th(u,t+1,l,r,o,c),c=false;else if(g==="ol"||g==="ul"){let m=o.length;nh(u,t+1,{...n,list:s},r,o,c),o.length>m&&(c=false);}}}function Un(e,t,n,r,o,a=false,i,s=true){if(t>r.maxDepth)return;let l=o.length,c=i===void 0,u=[],g=[],m=n.para,y=i??{pending:false,skipSpacer:false},v=()=>({...m,pageBreakBefore:void 0,numPr:void 0}),w=()=>{if(u.length===0)return;if(!u.some(S=>S.includes("<w:r"))){if(o.length===l){g=g.concat(u),u=[];return}let S=o[o.length-1];S?.endsWith("</w:p>")?(o[o.length-1]=`${S.slice(0,-6)}${u.join("")}</w:p>`,u=[]):S!==void 0&&u.length>0&&(o.push(vr(v(),u)),u=[],r.lastMarkCovered=false);return}let b=y.pending?{...m,pageBreakBefore:true}:m;o.push(vr(b,u)),m.pageBreakBefore&&(m={...m,pageBreakBefore:void 0}),y.pending=false,y.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered,u=[];};for(let b of e){if(r.nodesLeft<=0){r.truncated=true;break}if(Qr(b)){let S=Qe(b),k=S==="w:sdt"?Qg(b):null;if(s&&Xg(b)){w(),r.nodesLeft-=1,y.pending&&qi(o),y.pending=true,y.skipSpacer=true;continue}if(vd.has(S)){r.nodesLeft-=1;continue}let O=Je(b);if(O.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(Pg(O)){w(),r.nodesLeft-=1,Un(Array.from(b.childNodes),t+1,n,r,o,false,y,s);continue}if(r.definedNoteElements.has(b)){r.nodesLeft-=1;continue}if(xd.has(S)){if(w(),r.nodesLeft-=1,y.pending&&y.skipSpacer&&Yg(b)){y.skipSpacer=false;continue}if(S==="div"&&Id(b)){let L=eh(b,n,r,false);L.para.pageBreakBefore&&(y.pending=true),Un(Array.from(b.childNodes),t+1,L,r,o,false,y,s);continue}let D=o.length;th(b,t,n,r,o,y.pending),o.length>D&&(y.pending=false,y.skipSpacer=false);continue}if(S==="ol"||S==="ul"){w();let D=o.length;nh(b,t,n,r,o,y.pending),o.length>D&&(y.pending=false,y.skipSpacer=false);continue}if(S==="table"){w(),y.pending&&qi(o),sw(b,t,n,r,o),y.pending=false,y.skipSpacer=false;continue}if(Sd.has(S)||k!==null||S==="span"&&Id(b)){w(),r.nodesLeft-=1,Un(k??Array.from(b.childNodes),t+1,n,r,o,false,y,s);continue}}if(b.nodeType===3&&/^[\s\u00a0]+$/.test(b.nodeValue??"")&&hd(u)){r.nodesLeft-=1;continue}zi(b,t,n,u,r);}if(a&&o.length===l&&u.length>0&&!u.some(b=>b.includes("<w:r"))&&(o.push(vr(m,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered),w(),g.length>0){let b=o[l];b!==void 0&&b.startsWith("<w:p>")?o[l]=b.replace(/^(<w:p>(?:<w:pPr>(?:(?!<\/w:pPr>)[\s\S])*?<\/w:pPr>)?)/,`$1${g.join("")}`):b!==void 0?o.splice(l,0,vr(v(),g)):u=g.concat(u),g=[];}u.length>0&&(o.push(vr(v(),u)),u=[],r.lastMarkCovered=false),c&&y.pending&&(qi(o),y.pending=false,y.skipSpacer=false,r.lastMarkCovered=false),a&&o.length===l&&(o.push(vr(m,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered);}function sw(e,t,n,r,o){jg(e,t,n,r,o,Un);}function lw(e,t){return Fg({blocks:t,rels:e.rels,lists:[...e.lists.values()],notes:e.notes,noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function dw(e,t){let n=t.maxHtmlBytes??rw;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 a=kg(r),i={footnote:new Set,endnote:new Set},s=new Set,l={footnote:new Set,endnote:new Set};Tg(r,a,l);let c={nodesLeft:t.maxNodes??ow,maxDepth:t.maxDepth??aw,maxImageBytes:t.maxImageBytes??iw,wordHtml:ng(e),truncated:false,lastMarkCovered:false,rels:[],media:new Map,mediaExtensions:new Map,mediaBySrc:new Map,lists:new Map,listsByNumId:new Map,semanticListCount:0,imageCount:0,docPrId:0,nextBookmarkId:1,classAlignments:ag(r),listDefinitions:mg(ig(r)),notes:{footnote:new Map,endnote:new Map},noteRels:{footnote:[],endnote:[]},definedNotes:i,bodyNoteRefs:{footnote:new Set,endnote:new Set},noteNoteRefs:new Map,noteMarkFallbacks:new Map,definedNoteElements:s},u={};u=ya(u,r.documentElement),u=ya(u,o);let g={run:u,para:u.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},m=[];for(let S of a)l[S.kind].has(S.id)&&(i[S.kind].has(S.id)||(i[S.kind].add(S.id),s.add(S.element),m.push(S)));m.sort((S,k)=>bd(k.element)-bd(S.element)),c.lastMarkCovered=false;let y=[];Un(Array.from(o.childNodes),0,g,c,y);let v=c.lastMarkCovered,w=c.truncated,b=false;for(let S=0;S<m.length;S+=1){let k=m[S];c.truncated=false;let O=c.nodesLeft,D=[];if(Un(Array.from(k.element.childNodes),0,{...g,noteBody:{kind:k.kind,id:k.id},rels:c.noteRels[k.kind]},c,D,true),c.truncated||D.length===0){b=true;let L=new Set;for(let p=S;p<m.length;p+=1){let A=m[p];i[A.kind].delete(A.id),s.delete(A.element),c.notes[A.kind].delete(A.id),c.bodyNoteRefs[A.kind].delete(A.id),L.add(`${A.kind}:${A.id}`);}if(L.size>0){for(let p=0;p<y.length;p+=1)y[p]=Jr(y[p],L,c.noteMarkFallbacks);for(let p of ["footnote","endnote"])for(let[A,Z]of c.notes[p])c.notes[p].set(A,Z.map(T=>Jr(T,L,c.noteMarkFallbacks)));}c.nodesLeft=O;for(let p=S;p<m.length&&c.nodesLeft>0;p+=1)Un(Array.from(m[p].element.childNodes),0,g,c,y);break}c.notes[k.kind].set(k.id,D);}return c.truncated=w||b,c.lastMarkCovered=v,Cg(c,i,y,wd),y.length===0?{ok:false,reason:"no-content"}:{ok:true,projection:c,blocks:y}}var cw=Ig();function rh(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return cw(e,n,()=>dw(e,t))}function oh(e,t={}){let n=rh(e,t);return n.ok?{ok:true,fragmentBytes:lw(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function ah(e,t={}){let n=rh(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var uw={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function ih(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 uw[n.toLowerCase()]??t})}var fw=new Set(["script","style","title","template"]),pw=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),mw=new Set(["td","th"]),sh=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),gw=e=>sh(e)||e!==void 0&&e>="0"&&e<="9",lh=e=>e===" "||e===" "||e===`
|
|
6
|
+
`||e==="\r"||e==="\f";function hw(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!sh(e[n]))return null;let o=n;for(;n<e.length&&gw(e[n]);)n+=1;let a=e.slice(o,n).toLowerCase(),i="",s=false;for(;n<e.length;){let l=e[n];if(i!=="")l===i&&(i="");else if(l==="=")s=true;else if(s&&(l==='"'||l==="'"))i=l,s=false;else {if(l===">")return {name:a,closing:r,end:n+1};lh(l)||(s=false);}n+=1;}return {name:a,closing:r,end:e.length}}function yw(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 bw(e,t,n){for(let r=n;r<e.length;){let o=e.indexOf("</",r);if(o===-1)return e.length;let a=o+2;if(e.slice(a,a+t.length).toLowerCase()===t){for(a+=t.length;a<e.length&&lh(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function*dh(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=hw(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&fw.has(r.name)?t=bw(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
|
|
7
|
+
`:r.closing&&mw.has(r.name)?yield " ":r.closing&&pw.has(r.name)&&(yield `
|
|
8
|
+
`);}}function vw(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of dh(t))n+=r;return ih(n).replace(/\r\n?/g,`
|
|
9
|
+
`).split(`
|
|
10
|
+
`).map(yw).join(`
|
|
11
|
+
`).replace(/\n{3,}/g,`
|
|
12
|
+
|
|
13
|
+
`).trim()}function ch(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 uh=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function fh(e){return uh.test(e)}function kd(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of dh(t)){let r=n.includes("&")?ih(n):n;if(uh.test(r))return true}return false}function Td(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?vw(n):""}function Pd(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function xw(e){if(!e)return false;if(fh(Pd(e,"text/plain")))return true;let t=Pd(e,"text/html");if(t.length===0)return false;if(kd(t))return true;let n=Di(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:ah(t).imageCount>0}function Sw(e){return e?kd(Pd(e,"text/html")):false}var Iw=Object.freeze({kind:"body"});function at(e,t){let n=t?.indexOf("#")??-1;if(n===-1)return null;let r=t.slice(0,n);return r.length===0?null:e.currentPackage().parts.get(r)??null}function bt(e,t,n){let r=t?.indexOf("#")??-1,o=r===-1?"":t.slice(0,r);if(o.length===0||o===e.part().name)return {kind:"body"};for(let a of e.headerFooterResolutionBySection())for(let i of [a.headers,a.footers])for(let s of i.values())if(s.partName===o)return {kind:"headerFooter",rId:s.rId};for(let a of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:a})?.name===o)return {kind:"notesPart",noteKind:a};return n}function Vi(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=Zc$1(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function mh(e,t){return e?e.scope:t||Iw}function ww(e,t,n){if(n){let o=[];for(let a of [e.footnotes,e.endnotes])if(a)for(let i of a.notes)i.scopeId===n&&o.push(...ph(i.fragments));return o}if(!t)return ya$1(e);let r=eo(e,t);return r?ph(r.fragments):[]}function eo(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 gh(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 Cd(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Rd(e,t,n){let r=Fd$1(e,t.y),o=e.pages[r];if(!o)return false;let a=t.x-n(r),i=t.y,s=o.contentBox;return a>=s.x&&a<s.x+s.width&&i>=s.y&&i<s.y+s.height}function Ed(e,t,n,r,o={}){return Id$1(e,t,n.fragments,r,o)}function kw(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=eo(r,t);return o?_if(e,t.pageIndex,o.fragments,n):null}function Tw(e,t,n){let r=[];for(let o of e.pages)for(let a of [o.footnotes,o.endnotes]){let i=a?.notes.find(s=>s.scopeId===t);i&&r.push(..._if(e,o.index,i.fragments,n));}return r.length>0?r:null}function hh(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function yh(e,t,n){let r=e.querySelectorAll("[data-docx-note-scope]"),o=null;for(let a of r){if(a.dataset.docxNoteScope!==t||!a.matches("[data-docx-note]"))continue;o??=a;let i=Number(a.closest("[data-page-index]")?.dataset.pageIndex);if(n!==null&&i===n)return a}return o}function bh(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!eo(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(eo(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function vh(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function xh(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Fd(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Od(e,t,n,r,o,a,i){let s=o?kw(e,o,i):a?Tw(e,a,i):null,l=pf(e,t,n,r,{...i?{measurer:i}:{},...s?{stops:s}:{}});if(!l)return null;if(!s)return l;let c=s.find(u=>u.position.paragraphId===l.position.paragraphId&&u.position.offset===l.position.offset);return c?{...l,pageIndex:c.pageIndex}:l}function Ad(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of [r.footnotes,r.endnotes])if(a)for(let i of a.notes){let s=i.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:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-l,y:t.y-c},fragments:i.fragments}}}return null}function Sh(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let c=o.y,u=r.y,g=n?Math.max(u,n.box.y+n.box.height):u,m=n?Math.min(c,n.box.y):c;return g<=m?null:{x:r.x,y:m,width:r.width,height:g-m}}let a=r.y+r.height,i=o.y+o.height,s=n?Math.min(a,n.box.y):a,l=n?Math.max(i,n.box.y+n.box.height):i;return l<=s?null:{x:r.x,y:s,width:r.width,height:l-s}}function Md(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){if(r[a])continue;let i=Sh(r,a);if(!i)continue;let s=i.x+o;if(t.x>=s&&t.x<s+i.width&&t.y>=i.y&&t.y<i.y+i.height)return {pageIndex:r.index,kind:a}}}return null}function Ld(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){let i=r[a];if(!i)continue;let s=i.box,l=Sh(r,a)??s,c=l.x+o,u=l.y;if(t.x>=c&&t.x<c+l.width&&t.y>=u&&t.y<u+l.height)return {pageIndex:r.index,kind:a,story:i,local:{x:t.x-(s.x+o),y:t.y-s.y}}}}return null}function to(e,t,n){if(!t&&!n)return Ra$1(e);let r=new Set,o=[];for(let a of e.pages)for(let i of ww(a,t,n)){for(let s of i.lines)for(let l of Na$1(s))r.has(l.paragraphId)||(r.add(l.paragraphId),o.push(l.paragraphId));i.lines.length===0&&!r.has(i.paragraphId)&&(r.add(i.paragraphId),o.push(i.paragraphId));}return o}function Ki(e,t,n,r){let o=to(e,n,r);if(o.length===0)return t;let a=new Set(o),i=s=>a.has(s.paragraphId)?s:{paragraphId:o[0],offset:0};return {anchor:i(t.anchor),head:i(t.head)}}function ph(e){let t=[],n=r=>{for(let o of r){if(o.kind==="paragraph"){t.push(o);continue}for(let a of o.rows)if(!a.isHeaderRepeat)for(let i of a.cells)n(i.blocks);}};return n(e),t}function Ih(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 Pw(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function Cw(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 Rw(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function Ew(e,t){if(e)try{await e.delete(t);}catch{}}async function Fw(e){let t=e.fetcher??fetch,n=e.maxFontBytes??a$1,r=await Pw(e.cacheName??"docx-editor-fonts");async function o(l){let c=Object.freeze({family:l.family,weight:l.weight,style:l.style}),u=Ih(c);if(u)return {failure:{url:l.url,request:c,reason:"invalidRequest",diagnostic:u}};let g=(b,S)=>{if(b.byteLength===0)return {url:l.url,request:c,reason:"emptyResponse"};if(b.byteLength>n)return {url:l.url,request:c,reason:"overLimit"};let k=i(b,l.faceIndex??0);if(!k.valid)return {url:l.url,request:c,reason:"malformed",diagnostic:k.diagnostic};let O=a$2(b);return l.hash!==void 0&&l.hash!==O?{url:l.url,request:c,reason:"hashMismatch",expectedHash:l.hash,actualHash:O,...S?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:c,id:`url:${l.url}`,bytes:b,hash:O,faceIndex:l.faceIndex??0}},m=await Cw(r,l.url);if(m){let b=g(m,true);if(!("reason"in b))return {source:b};await Ew(r,l.url);}let y;try{y=await t(l.url);}catch(b){return {failure:{url:l.url,request:c,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}if(!y.ok)return {failure:{url:l.url,request:c,reason:"httpError",status:y.status}};let v;try{v=new Uint8Array(await y.arrayBuffer());}catch(b){return {failure:{url:l.url,request:c,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}let w=g(v,false);return "reason"in w?{failure:w}:(await Rw(r,l.url,v),{source:w})}let a=await Promise.all(e.sources.map(l=>o(l))),i$1=[],s=[];for(let l of a)"source"in l?i$1.push(l.source):s.push(l.failure);return {sources:i$1,failures:s}}function Ow(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}`,a=Ih(r);if(a)return {failure:{url:o,request:r,reason:"invalidRequest",diagnostic:a}};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 i$1=t.faceIndex??0,s=i(e,i$1);return s.valid?{source:{request:r,id:o,bytes:e,hash:a$2(e),faceIndex:i$1}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:s.diagnostic}}}var Aw=96,wh=37.79527559055118;function Mw(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let i=Math.floor(e/12);for(let s=0;s<=i;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=wh/10,o=Math.floor(e/r);for(let a=0;a<=o;a+=1){let i=a*r;if(a%10===0){let s=a/10;n.push({position:i,height:10,...s>0?{label:String(s)}:{}});}else a%5===0?n.push({position:i,height:6}):n.push({position:i,height:3});}return n}function Lw(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var Nw=1440,Dw=567,Hw=180,_w=56.7,ji=(e,t,n)=>n<t||e<t?t:e>n?n:e;function Bw(e,t,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 kh(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 $w(e,t,n,r,o={}){let a=kh(t,o.unit??"inch",o.precise??false),i=r.pageWidth-r.rightMargin-n.right,s=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let l=ji(a,0,i);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),c=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:ji(a-r.leftMargin,l,c)}}case "hanging":{let l=ji(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=ji(a,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}var Th="no formatting has been copied",Ui="there is nothing at the selection to copy",Nd="the selection has nothing to paint",Wi=Object.freeze({mode:"off",level:"none"});function St(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 Sr(e){if(typeof e!="object"||e===null)return false;let t=e;return St(t.from)&&St(t.to)}function Ph(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 dn(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 a=Nh$1(t.partByNode.get(o)??e,o)??"";if(n.search===void 0)return {ok:true,span:{nodeId:o,start:0,end:a.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=Ph(a,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 i=Ph(a,n.search,2);return i.length===0?{ok:false,code:"notFound",reason:`'${n.search}' does not occur in paragraph '${n.paraId}'`}:i.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:i[0],end:i[0]+n.search.length}}}function Ch(e,t,n){if("anchor"in n){let s=dn(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(!St(r)||!St(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=dn(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=dn(e,t,o);return i.ok?{ok:true,selection:{anchor:{paragraphId:a.span.nodeId,offset:a.span.start},head:{paragraphId:i.span.nodeId,offset:i.span.end}}}:{ok:false,code:i.code,reason:i.reason,target:o}}var ba=/^[0-9A-Fa-f]{6}$/,Rh={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"},qw={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 Dd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function Gi(e){return Math.max(0,Math.min(1,e))}function Eh(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 Fh(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 Oh(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-Gi(t))*255)))/255,o=Eh(e);return Fh(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Ah(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(Gi(t)*255)))/255,o=Eh(e);return Fh(r*o.r,r*o.g,r*o.b)}function Hd(e){return Rh[e]??Rh[e.toLowerCase()]??null}function Zw(e,t){let n=Hd(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&ba.test(r))return r.toUpperCase();let o=qw[n];return o&&ba.test(o)?o.toUpperCase():null}function Xi(e,t){let n=Zw(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Dd(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Dd(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=Oh(r,Gi(e.tint)):e.shade!==void 0&&(r=Ah(r,Gi(e.shade))),{ok:true,hex:r}}var zw="000000";function _d(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return ba.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:zw}};let n=Xi(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Hd(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Bd(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 ba.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=Xi(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Hd(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Vw(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return ba.test(o)?`#${o}`:`#${n}`}let r=Xi(e,t);return `#${r.ok?r.hex:n}`}var Ww=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function no(e){return Ww.has(e.type)}function be(e,t){return {ok:false,code:e,reason:t}}function $d(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return be("invalidArgs","the table target is no longer valid");case "table-has-merge":return be("unsupported","this table has merged cells");case "row-hides-cell":return be("unsupported","this table has a cell the editor cannot place in the grid");case "block-required":return be("unsupported","the table must keep at least one row or column");case "resource-limit":return be("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return be("invalidArgs","the table command arguments are invalid");default:return be("unsupported",`the table operation was refused (${e})`)}}function vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qt(e,t){return !vt(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function Dh(e){if(!vt(e))return false;let t=e.kind;if(t==="hex")return qt(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return qt(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 qt(e,n)}return false}function Hh(e){return vt(e)&&qt(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 _h(e){return vt(e)&&qt(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 Gw(e){return vt(e)&&qt(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 Xw(e){return vt(e)&&qt(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 Yw(e){return !vt(e)||!qt(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&Dh(e.color)}function Mh(e){return !("target"in e)||e.target===void 0||Hh(e.target)}function Lh(e){return !("target"in e)||e.target===void 0||_h(e.target)}function Qw(e){switch(e.type){case "insertRow":return !vt(e)||e.type!=="insertRow"?be("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?be("invalidArgs","insertRow where must be above or below"):Mh(e)?null:be("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !vt(e)||e.type!=="deleteRow"?be("invalidArgs","deleteRow command shape is invalid"):Mh(e)?null:be("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !vt(e)||e.type!=="insertColumn"?be("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?be("invalidArgs","insertColumn where must be left or right"):Lh(e)?null:be("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !vt(e)||e.type!=="deleteColumn"?be("invalidArgs","deleteColumn command shape is invalid"):Lh(e)?null:be("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !vt(e)||!qt(e,["type"])?be("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !vt(e)||!qt(e,["type","color"])?be("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!Dh(e.color)?be("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !vt(e)||!qt(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?be("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !vt(e)||e.type!=="setTableBorders"?be("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?be("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!Yw(e.spec)?be("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !vt(e)||!qt(e,["type","target","leftWidthTwips","rightWidthTwips"])||!Gw(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?be("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !vt(e)||!qt(e,["type","target","columnWidthTwips","tableWidthTwips"])||!Xw(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?be("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function Jw(e){return !("target"in e)||e.target===void 0?null:Hh(e.target)?e.target:null}function ek(e){return !("target"in e)||e.target===void 0?null:_h(e.target)?e.target:null}function tk(e,t){let n=qh$1(e.root,t.tableId);if(!n.ok)return {rowIds:[t.rowId],wholeTable:false};let r=new Set(t.cellIds),o=n.topology.rows.filter(a=>a.cells.some(i=>r.has(i.id))).map(a=>a.row.id);return o.length===0?{rowIds:[t.rowId],wholeTable:false}:{rowIds:o,wholeTable:o.length===n.topology.rows.length}}function nk(e,t){let n=qh$1(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 a of n.topology.rows){let i=0;for(let s of a.cells){let l=Bh(s);if(r.has(s.id))for(let c=0;c<l;c+=1){let u=n.topology.gridColumns[i+c];u&&o.add(u.id);}i+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function Nh(e,t,n){let r=qh$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function rk(e){let t=zf$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 Bh(e){let t=oh$1(e,"tcPr"),n=t&&oh$1(t,"gridSpan"),r=n&&ph$1(n,"val");if(!r||!/^\d{1,7}$/.test(r))return 1;let o=Number(r);return Number.isInteger(o)&&o>1?Math.min(o,1024):1}function ok(e,t,n){let r=e.gridColumns.findIndex(o=>o.id===n);if(r===-1)return null;for(let{row:o,cells:a}of e.rows){let i=0;for(let s of a){let l=Bh(s);if(r>=i&&r<i+l)return {tableId:t,rowId:o.id,cellId:s.id,cellIds:[s.id],gridColumnIndex:r,isHeaderRepeat:false};i+=l;}}return null}function ak(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=qh$1(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(i=>i.row.id===t.rowId);if(r===-1)return null;let a=n.topology.rows[r].cells[0];return a?{tableId:t.tableId,rowId:t.rowId,cellId:a.id,cellIds:[a.id],gridColumnIndex:0,isHeaderRepeat:false}:null}function ik(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=qh$1(e.part.root,t.tableId);return n.ok?ok(n.topology,t.tableId,t.gridColumnId):null}function sk(e,t){for(let n of t){let r=Sh$1(e,n);if(r)return $d(r)}return null}function $t(e,t,n){let r=sk(e,t);return r||{ok:true,ops:t,selection:n}}function lk(e,t){if(!rh$1.includes(e.style))return {ok:false,reason:"border style is not allowlisted"};if(!Number.isInteger(e.size)||e.size<1)return {ok:false,reason:"border size is out of range"};if(e.size>96)return {ok:false,reason:"border size is out of range"};let n=_d(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function va(e,t,n){return n!==e.storeRevision?be("invalidArgs","the table target is stale"):qh$1(e.part.root,t).ok?null:be("invalidArgs","the table target is no longer valid")}function dk(e){return e?.isHeaderRepeat?be("unsupported","repeated header rows cannot be edited"):null}function ck(e,t,n,r){let o=va(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return be("invalidArgs","column widths must be whole twips");if(n<300||r<300)return be("invalidArgs","column widths are below the minimum");let a=qh$1(e.part.root,t.tableId);if(!a.ok){let g=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return $d(g)}if(a.topology.hasMerge)return be("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(g=>g.id===t.leftGridColumnId),s=a.topology.gridColumns.find(g=>g.id===t.rightGridColumnId);if(!i||!s)return be("invalidArgs","the table target is no longer valid");let l=a.topology.gridColumns.indexOf(i);if(a.topology.gridColumns.indexOf(s)!==l+1)return be("invalidArgs","the column divider target is not adjacent");let u={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:t.leftGridColumnId,rightGridColumnId:t.rightGridColumnId,leftWidthTwips:n,rightWidthTwips:r};return $t(e.part,[u],{kind:"preserveSelection"})}function uk(e,t,n,r){let o=va(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return be("invalidArgs","column widths must be whole twips");if(n<300)return be("invalidArgs","column widths are below the minimum");let a=qh$1(e.part.root,t.tableId);if(!a.ok){let l=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return $d(l)}if(a.topology.hasMerge)return be("unsupported","this table has merged cells");let i=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!i||i.id!==t.gridColumnId)return be("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 $t(e.part,[s],{kind:"preserveSelection"})}function $h(e,t,n){if(e.viewing||!e.editable)return be("locked","the document is open for viewing");let r=va(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return be("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return $t(e.part,[o],{kind:"preserveSelection"})}function Nn(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return be("locked","the document is open for viewing");switch(t.type){case "mergeCells":return be("unsupported","cell merge is not supported yet");case "splitCell":return be("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return be("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=Qw(t);if(a)return a;let i=Jw(t),s=ek(t),l=dk(i??s);if(l)return l;if(i){let u=va(e,i.tableId,i.sourceRevision);if(u)return u}if(s){let u=va(e,s.tableId,s.sourceRevision);if(u)return u}let c=i!==null?ak(e,i):s!==null?ik(e,s):rk(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!c)return i||s?be("invalidArgs","the table target is no longer valid"):be("unsupported","the selection is not inside a table");if(c?.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!c)return be("unsupported","the selection is not inside a table");let u={op:"insertTableRow",tableId:c.tableId,rowId:c.rowId,where:t.where};return $t(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!c)return be("unsupported","the selection is not inside a table");let u=tk(n,c),g=u.wholeTable?[{op:"deleteBlock",blockId:c.tableId}]:u.rowIds.map(m=>({op:"deleteTableRow",tableId:c.tableId,rowId:m,...m===c.rowId?{referenceCellId:c.cellId}:{}}));return $t(n,g,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!c)return be("unsupported","the selection is not inside a table");let u=s?.tableId??c.tableId,g=s?.gridColumnId??Nh(n,u,c.gridColumnIndex),m=g?{op:"insertTableColumn",tableId:u,where:t.where,gridColumnId:g}:{op:"insertTableColumn",tableId:u,where:t.where,referenceCellId:c.cellId};return $t(n,[m],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!c)return be("unsupported","the selection is not inside a table");let u=s?.tableId??c.tableId,g=s?.gridColumnId??Nh(n,u,c.gridColumnIndex);if(!g)return be("invalidArgs","the table has no grid column to delete");let m=s?.gridColumnId===void 0?nk(n,c):{gridColumnIds:[g],wholeTable:false};if(m.wholeTable)return $t(n,[{op:"deleteBlock",blockId:u}],{kind:"adoptCommittedCaret"});let v=(m.gridColumnIds.length>0?m.gridColumnIds:[g]).map(w=>({op:"deleteTableColumn",tableId:u,gridColumnId:w}));return $t(n,v,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!c)return be("unsupported","the selection is not inside a table");let u={op:"deleteBlock",blockId:c.tableId};return $t(n,[u],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!c)return be("unsupported","the selection is not inside a table");let u;if(t.color===null)u=null;else {let m=Bd(t.color,e.themeColors);if(!m.ok)return be("invalidArgs",m.reason);u=m.color;}let g={op:"setTableCellFill",tableId:c.tableId,cellIds:c.cellIds,color:u};return $t(n,[g],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!c)return be("unsupported","the selection is not inside a table");let u={op:"setTableCellVerticalAlignment",tableId:c.tableId,cellIds:c.cellIds,alignment:t.alignment};return $t(n,[u],{kind:"preserveSelection"})}case "setTableBorders":{if(!c)return be("unsupported","the selection is not inside a table");if(t.scope==="none"){let m={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:"none",target:t.target};return $t(n,[m],{kind:"preserveSelection"})}let u=lk(t.spec,e.themeColors);if(!u.ok)return be("invalidArgs",u.reason);let g={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:t.scope,spec:u.spec};return $t(n,[g],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return ck(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return uk(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return be("unsupported",`command '${t.type}' is not a table command`)}}function qh(e){if(!no(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}var fk=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function pk(e,t){return e===t?true:!e||!t?false:fk.every(n=>e[n]===t[n])}function qd(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.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.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||!pk(e.disagrees,t.disagrees)||e.tabStops?.length!==t.tabStops?.length||(e.tabStops??[]).some((a,i)=>a.positionTwips!==t.tabStops?.[i]?.positionTwips||a.alignment!==t.tabStops?.[i]?.alignment||(a.leader??"none")!==(t.tabStops?.[i]?.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 a of o)if(n[a]!==r[a])return false;return true}function Zd(e,t){return e.current===t.current&&e.total===t.total}function zd(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 Zh(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 Vd(e,t){return e===t?true:!e||!t||!Sr(e)||!Sr(t)?false:Zh(e.from,t.from)&&Zh(e.to,t.to)}function Kd(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var mk={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",editable:"compared",zoom:"compared",zoomMode:"compared",selection:"compared",selectionCollapsed:"compared",formatting:"compared",table:"compared",tocContext:"compared",image:"compared",page:"compared",canUndo:"compared",canRedo:"compared",pageSetup:"compared",reviewPaneOpen:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},gk=Object.keys(mk);function jd(e,t){return gk.every(n=>e[n]===t[n])}function Yi(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Yi(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Yi(t[n]);return Object.freeze(e)}var Ud=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"}}]]),hk=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),yk=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,bk=/^[0-9A-Fa-f]{6}$/;function Wd(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!yk.test(n)?{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"&&!bk.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"||!hk.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 jh(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function Gd(e){return typeof e=="object"&&e!==null&&jh(e.anchor)&&jh(e.head)}function Zt(e,t){let n=new Error(t);return n.code=e,n}function Qi(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 Xd(e){return e==="blank"?Ql():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Yd(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 xa(e){switch(e.type){case "toggleMark":return Ud.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=Wd(e);return t.ok?{supported:true,mutating:true}:{supported:false,reason:t.reason,code:t.code}}case "setAlignment":return {supported:true,mutating:true};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)>wc$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${wc$1}`};for(let r of ["spaceBeforePt","spaceAfterPt"]){let o=e[r];if(o!=null&&(!Number.isFinite(o)||o<0||o>1584))return {supported:false,code:"invalidArgs",reason:`setParagraphFormat requires ${r} between 0 and 1584 points`}}let n=e.lineSpacing;if(n!=null){if(n.rule!=="multiple"&&n.rule!=="exact"&&n.rule!=="atLeast")return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a rule of 'multiple', 'exact' or 'atLeast'"};let r=n.rule==="multiple"?n.value*240:n.value*20;if(!Number.isFinite(n.value)||n.value<=0||Math.round(r)>31680)return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a positive value no taller than 1584pt"}}if(e.alignment!==void 0&&!["left","center","right","justify"].includes(e.alignment))return {supported:false,code:"invalidArgs",reason:"unknown alignment"};if(e.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)>wc$1)return {supported:false,reason:`indent values must be within \xB1${wc$1} twips`}}return {supported:true,mutating:true}}case "toggleList":return e.kind==="bullet"||e.kind==="ordered"?{supported:true,mutating:true}:{supported:false,reason:`list kind '${e.kind}' is not supported`};case "adjustIndent":return e.direction==="increase"||e.direction==="decrease"?{supported:true,mutating:true}:{supported:false,reason:`indent direction '${e.direction}' is not supported`};case "insertBreak":return e.kind==="line"||e.kind==="page"||e.kind==="section"||e.kind==="sectionContinuous"?{supported:true,mutating:true}:{supported:false,reason:`break kind '${e.kind}' is not supported`};case "insertText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; text inserts at the selection"};case "deleteText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; deletion removes the selection"};case "proposeInsertion":case "proposeReplacement":{let t=e.type==="proposeInsertion"?e.text:e.replaceWith;return typeof t!="string"||t.length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires non-empty text`}:/[\r\n\v\f\u2028\u2029]/.test(t)?{supported:false,code:"invalidArgs",reason:`${e.type} requires text without a paragraph mark`}:e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires a non-empty author`}:{supported:true,mutating:true}}case "proposeDeletion":return e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:"proposeDeletion requires a non-empty author"}:{supported:true,mutating:true};case "setPageSetup":{let t=[e.pageWidth,e.pageHeight],n=[e.marginTop,e.marginRight,e.marginBottom,e.marginLeft];if(t.every(r=>r===void 0)&&n.every(r=>r===void 0)&&e.orientation===void 0)return {supported:false,reason:"setPageSetup requires at least one field"};for(let r of t)if(r!==void 0&&(!Number.isInteger(r)||r<1||r>63360))return {supported:false,code:"invalidArgs",reason:"page dimensions must be integer twips between 1 and 63360"};for(let r of n)if(r!==void 0&&(!Number.isInteger(r)||r<0||r>31680))return {supported:false,code:"invalidArgs",reason:"margins must be integer twips between 0 and 31680"};return e.orientation!==void 0&&e.orientation!=="portrait"&&e.orientation!=="landscape"?{supported:false,code:"invalidArgs",reason:"orientation must be 'portrait' or 'landscape'"}:e.scope!==void 0&&e.scope!=="document"&&e.scope!=="section"?{supported:false,code:"invalidArgs",reason:"scope must be 'document' or 'section'"}:{supported:true,mutating:true}}case "undo":case "redo":return {supported:true,mutating:true};case "insertTable":return Number.isInteger(e.rows)&&Number.isInteger(e.cols)&&e.rows>=1&&e.cols>=1&&e.rows<=32767&&e.cols<=63&&e.rows*e.cols<=2e4?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:`insertTable needs whole rows and cols of at least 1, at most ${32767}\xD7${63}, and at most ${2e4} cells`};case "insertToc":return {supported:true,mutating:true};case "editTextFormField":return {supported:true,mutating:false};case "refreshToc":return e.mode!==void 0&&e.mode!=="entire"&&e.mode!=="pageNumbers"?{supported:false,code:"invalidArgs",reason:"refreshToc mode must be 'entire' or 'pageNumbers'"}:e.tocId!==void 0&&(typeof e.tocId!="string"||e.tocId.length===0)?{supported:false,code:"invalidArgs",reason:"refreshToc tocId must be a non-empty string"}:{supported:true,mutating:true};case "editHeaderFooter":return e.position!=="header"&&e.position!=="footer"?{supported:false,reason:"editHeaderFooter requires position 'header' or 'footer'"}:e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"editHeaderFooter variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "exitHeaderFooter":return {supported:true,mutating:false};case "removeHeaderFooter":case "linkHeaderFooterToPrevious":case "unlinkHeaderFooterFromPrevious":return "variant"in e&&e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"furniture variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "setHeaderFooterOptions":return e.titlePage===void 0&&e.evenAndOddHeaders===void 0&&e.headerDistanceTwips===void 0&&e.footerDistanceTwips===void 0?{supported:false,reason:"setHeaderFooterOptions requires at least one option"}:{supported:true,mutating:true};case "insertPageField":return e.field==="PAGE"||e.field==="NUMPAGES"||e.field==="SECTIONPAGES"||e.field==="PAGE_X_OF_Y"?{supported:true,mutating:true}:{supported:false,reason:"insertPageField field must be 'PAGE', 'NUMPAGES', 'SECTIONPAGES', or 'PAGE_X_OF_Y'"};case "insertNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"insertNote noteKind must be 'footnote' or 'endnote'"};case "deleteNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"deleteNote noteKind must be 'footnote' or 'endnote'"};case "convertNote":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertNote fromKind must be 'footnote' or 'endnote'"};case "convertAllNotes":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertAllNotes fromKind must be 'footnote' or 'endnote'"};case "setNoteProperties":return e.endnote?.position==="pageBottom"?{supported:false,reason:"endnote-pageBottom"}:e.footnote!==void 0||e.endnote!==void 0?{supported:true,mutating:true}:{supported:false,reason:"setNoteProperties requires footnote and/or endnote fields"};case "selectAll":case "copy":return {supported:true,mutating:false};case "cut":return {supported:true,mutating:true};case "paste":case "pasteWithoutFormatting":{if(typeof e.text!="string")return {supported:false,code:"invalidArgs",reason:"paste requires text"};let t=e.type==="paste"?e.html:void 0;return t!==void 0&&typeof t!="string"?{supported:false,code:"invalidArgs",reason:"paste html must be a string"}:e.text===""&&(t===void 0||t==="")?{supported:false,code:"invalidArgs",reason:"there is nothing to paste"}:{supported:true,mutating:true}}case "insertRow":case "deleteRow":case "insertColumn":case "deleteColumn":case "deleteTable":case "setCellFill":case "setTableCellVerticalAlignment":case "setTableBorders":case "commitTableColumnDividerResize":case "commitTableRightEdgeResize":case "mergeCells":case "splitCell":case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":{let t=qh(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(Gd(e.range)||Sr(e.range))||"anchor"in e&&St(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 "insertImage":return e.data instanceof Uint8Array&&(e.mime==="image/png"||e.mime==="image/jpeg"||e.mime==="image/gif")&&Number.isFinite(e.widthPoints)&&Number.isFinite(e.heightPoints)&&e.widthPoints>0&&e.heightPoints>0?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"insertImage requires png/jpeg/gif bytes and finite dimensions"};case "replaceImage":return e.data instanceof Uint8Array?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};case "deleteImage":return {supported:true,mutating:true};case "setImageWrapType":return ["inline","square","squareLeft","squareRight","tight","through","topAndBottom","behind","inFront"].includes(e.target)?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported wrap target"};case "transformImage":return e.action==="rotateCW"||e.action==="rotateCCW"||e.action==="flipH"||e.action==="flipV"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported transform action"};case "setImagePosition":return {supported:true,mutating:true};case "setImageProperties":return {supported:true,mutating:true};default:return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`}}}function vk(e){return [e.left,e.top,e.right,e.bottom]}function Qd(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function xk(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function Sa(e){return Math.round(e*1e3)}function Ia(e){return e/1e3}function Jd(e){return Object.freeze({left:Sa(e.left),top:Sa(e.top),right:Sa(e.right),bottom:Sa(e.bottom)})}function Sk(e){return Object.freeze({left:Ia(e.left),top:Ia(e.top),right:Ia(e.right),bottom:Ia(e.bottom)})}function ec(e){return vk(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Ik=new Set(["insertImage","replaceImage"]),wk=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function tc(e,t,n){return n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function kk(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&tc(o,n,r))return o;return null}function Tk(e,t,n,r){let o=e.layout();for(let a of o.pages){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&tc(i,n,r))return i;for(let i of [a.header,a.footer])if(i){for(let s of i.anchoredDrawings??[])if(s.anchorParagraphId===t&&tc(s,n,r))return s}}return null}function Uh(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function wa(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=ef(e.layout(),n.paragraphId,n.offset),a=t.kind==="pointer"?t.drawingNodeId:null;return kk(o,n.paragraphId,n.offset,a)??Tk(e,n.paragraphId,n.offset,a)}function Wh(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=Ga(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:lb$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:eb$1,limits:db$1,resolveRelationship:gb$1(e.session.currentPackage(),t.ownerPartName)})}function Gh(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 Pk(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 Xh(e){let t=e.locks;return Object.freeze({canResize:!t.resize&&!e.hidden,canMove:!t.move&&!e.hidden,canChangeWrap:!t.move&&e.kind==="anchored"&&!e.hidden,canCrop:!t.resize&&!t.changeAspect&&!e.hidden})}function Ck(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function vn(e){let t=wa(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?Wh(e,t):null;if(!n||n.hidden||n.locks.select)return null;let r=t.transform;return Object.freeze({id:t.drawingNodeId,kind:n.kind,widthEmu:n.extentEmu.cx,heightEmu:n.extentEmu.cy,crop:Qd(t.crop),rotationDegrees:r.rotationDegrees,wrap:Ck(t),position:Gh(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:Pk(t),...Xh(n)})}function Yh(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 nc(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function Qh(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function rc(e){return nc(e)!==void 0||Qh(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function oc(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=Qh(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=nc(t),i=vn(r);if(a!==void 0&&(!i||i.id!==a))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 oo(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function Wn(e,t){let n=vn(e),r=nc(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 Rk(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 Ji(e,t){return Rk(e.applyDrawingOps(t))}function Ek(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 Fk(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function Ok(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function Ak(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||Bh$1(e)}function Jh(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 ka(e){return wk.has(e.type)}function Mk(e){return Ik.has(e.type)}function ey(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function ty(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:"image changes are not supported in suggesting mode"}:null}function Ta(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=vn(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function oo(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:a}=r.state().selection;if(o.paragraphId!==t.selectionParagraphId||o.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(o.paragraphId!==a.paragraphId||o.offset!==a.offset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(n?.requireDrawing){let i=vn(r),s=n.drawingNodeId??t.drawingNodeId;if(!i||!s||i.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function Pa(e,t){if(!ka(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};if(e.type==="insertImage")return !(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;if(e.type==="replaceImage"){if(!(e.data instanceof Uint8Array)||e.data.byteLength===0)return {ok:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};let o=Wn(t,e);return "ok"in o?o:null}let n=Wn(t,e);if("ok"in n)return n;let r=vn(t);if(!r)return {ok:false,code:"notFound",reason:"no drawing is selected"};if(t.editingMode()==="suggest"&&e.type!=="deleteImage")return {ok:false,code:"invalidArgs",reason:"image changes are not supported in suggesting mode"};switch(e.type){case "deleteImage":return r.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return r.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return r.locks.changeAspect||r.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!Ok(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let o=r.position?.mode??"frame";return Dh$1(e,o)?yh$1(Jh(e,r))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(Fk(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!Ak(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!r.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&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!ec(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!r.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!L(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!r.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(Bh$1(e)){if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let a=r.position?.mode??"frame";if(!Dh$1(e,a))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!yh$1(Ch$1(e,r)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function ac(e,t){let n=ty(t,e.type);if(n)return n;let r=Pa(e,t);return r||{ok:true}}function ny(e,t){let n=Pa(e,t);return n||ey(e)}function ry(e,t,n){if(Mk(t))return ey(t);let r=n&&rc(t)?Ta(n):null;if(r&&n){let o=oc(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=Wn(e,t);if("ok"in o)return o;let a=e.deleteImage(o.id);return a.ok?null:{ok:false,code:"invalidArgs",reason:a.detail??a.reason??"deleteImage was refused"}}case "setImageWrapType":{let o=Wn(e,t);return "ok"in o?o:Ji(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=Wn(e,t);return "ok"in o?o:Ji(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=Wn(e,t);if("ok"in o)return o;let a=vn(e),i=Jh(t,a);return Ji(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=Wn(e,t);if("ok"in o)return o;let a=vn(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let c=Ek(a);if(!c)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:c});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??a.widthEmu,cy:t.heightEmu??a.heightEmu}});t.crop!==void 0&&i.push({op:"cropDrawing",drawingNodeId:o.id,crop:Jd(t.crop)});let s=t.title??t.alt,l=t.description??t.alt;if((s!==void 0||l!==void 0)&&i.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:s??a.title,description:l??a.description}),t.wrap!==void 0&&i.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),Bh$1(t)){let c=Ch$1(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:c});}if(t.hyperlink!==void 0){let c=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return c.ok?null:{ok:false,code:"invalidArgs",reason:c.detail??c.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:Ji(e,i)}default:return null}}function Lk(e,t,n,r,o){let a=$c$1(e.sectionPropertiesAt(t)),i=a.width-a.margin.left-a.margin.right,s=a.height-a.margin.top-a.margin.bottom,l=ef(e.layout(),t,n),c=l&&l.box.width>0?Math.min(l.box.width,i):i,u=Math.min(1,c/r,s/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function ic(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=ty(n,t.type);if(r)return r;let o=Pa(t,n);if(o)return o;let a=Ta(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:g}=n.state().selection,m=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let y=Lk(n,g.paragraphId,g.offset,t.widthPoints,t.heightPoints),v=await n.insertImage({paragraphId:g.paragraphId,offset:g.offset,bytes:t.data,mime:t.mime,widthPoints:y.widthPoints,heightPoints:y.heightPoints,expectedPackageRevision:m,commitGuard:()=>oo(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),w=oo(e,a);return w||(v.ok?{ok:true,changed:v.change!==null}:{ok:false,code:"invalidArgs",reason:v.detail==="stale-package-epoch"?"stale package revision":v.detail??v.reason??"insertImage was refused"})}let i=Wn(n,t);if("ok"in i)return i;let s=t.expectedPackageRevision??a.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(i.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>oo(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),u=oo(e,a,{requireDrawing:true,drawingNodeId:i.id});return u||(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 Nk=1,Dk=10,Ca=12700;function Hk(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=Xh(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function _k(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId!==n.paragraphId||t.offset!==n.offset)return null;let r=wa(e);if(!r||r.accessibility.hidden)return null;let o=e.layout(),a=Od$1(o,r.drawingNodeId);if(!a)return null;let i=Wh(e,r);if(!i||i.locks.select)return null;let s=Hk(r,i),c=e.editingMode()==="edit"&&e.session.editable?s:{...s,canResize:false,canMove:false},u=r.kind==="anchoredDrawing"?Object.freeze({x:r.horizontalFrameOrigin,y:r.verticalFrameOrigin}):null;return Object.freeze({id:r.drawingNodeId,pageIndex:a.pageIndex,x:a.x,y:a.y,width:a.width,height:a.height,kind:r.kind==="inlineDrawing"?"inline":"anchored",widthEmu:i.extentEmu.cx,heightEmu:i.extentEmu.cy,position:Gh(i),anchorFrameOrigin:u,transform:r.transform,...c})}function It(e){return Math.round(e*Ca)}function ro(e){return e/Ca}function Bk(e,t,n,r,o,a){let i=ro(e),s=ro(t),l=i/s,c=n.includes("e")?r:n.includes("w")?-r:0,u=n.includes("s")?o:n.includes("n")?-o:0;if(i=Math.max(1,i+c),s=Math.max(1,s+u),a)if(n.length===2){let m=Math.max(i/ro(e),s/ro(t));i=Math.max(1,ro(e)*m),s=Math.max(1,i/l);}else n==="e"||n==="w"?s=Math.max(1,i/l):i=Math.max(1,s*l);return Object.freeze({cx:It(i),cy:It(s)})}function sc(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+It(t),verticalEmu:(e.verticalEmu??0)+It(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+It(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+It(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function $k(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"}:oo(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function oy(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.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}:{}}}function lc(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 dc(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),a=r.paraIdByNode.get(n.paragraphId);if(o===void 0||a===void 0)return null;let i=r.ordinalByNode.get(t.paragraphId)??0,s=r.ordinalByNode.get(n.paragraphId)??0;return s<i||s===i&&n.offset<t.offset?{from:{paraId:a},to:{paraId:o}}:{from:{paraId:o},to:{paraId:a}}}function ay(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 iy(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$1(n).map(o=>{let a=r.paraIdByNode.get(o.id),i=o.kind==="textValue"?void 0:i$2(o);return {...a!==void 0?{paraId:a}:{},text:Nh$1(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function cc(e){return e?e.state().pageCount:0}function uc(e,t="caret"){return e?e.currentPage(t):1}function qk(e,t){if(!no(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=es(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 Zk(e,t){return {command:e,part:t.session.partFor(t.storyScope())??t.session.part(),layout:t.layout(),storeRevision:t.session.packageRevision(),selection:t.state().selection,cellSelection:t.state().cellSelection,themeColors:t.session.documentThemeColors(),editable:t.session.editable,viewing:t.editingMode()==="view"}}function es(e,t){let n=Nn(Zk(e,t));return n.ok?{can:{ok:true},plan:n}:{can:{ok:false,code:n.code,reason:n.reason},plan:n}}function Ra(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 i=t?.activeScope?.()??{kind:"body"};if(i.kind!=="headerFooter"||i.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=xa(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"}};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==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:i,head:s}=t.state().selection;if(i.paragraphId===s.paragraphId&&i.offset===s.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(i=>i.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:Th}};if(e.type==="undo"&&!t.state().canUndo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.state().canRedo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to redo"}};if(e.type==="insertTable"&&!t.canInsertTable(e.rows,e.cols))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table can only be inserted at a caret in editable body, cell, or note text"}};if(e.type==="insertToc"&&!t.canInsertToc())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table of contents can only be inserted in the editable document body"}};if(e.type==="editTextFormField"&&!t.canEditTextFormField())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"field options are unavailable"}};if(e.type==="refreshToc"&&!t.canRefreshToc(e.tocId))return {ok:false,refusal:{ok:false,code:"notFound",reason:"there is no refreshable table of contents at the selection"}};if(e.type==="insertPageField"&&(t.activeScope?.()??{kind:"body"}).kind!=="headerFooter")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}};if(e.type==="insertNote"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertNote requires body scope"}};if(e.type==="insertBreak"&&(e.kind==="section"||e.kind==="sectionContinuous")){if((t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a section break can only be inserted in the editable document body"}};let s=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(s)return {ok:false,refusal:{ok:false,code:"unsupported",reason:s}}}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 i=t.headerFooterState?.();if((e.sectionIndex??i?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(no(e)){let i=qk(e,t);return i.ok?{ok:true,tablePlan:i.tablePlan}:i}let a=Pa(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function sy(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!Ga(n,t))return true;let r=Ha$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=Ha$1(n,r.id);}return false}function ly(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!sy(e,t.selection.head.paragraphId))return null;let r=yf$1(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 fc(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!sy(e,t.selection.head.paragraphId))return null;let r=yf$1(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 dy(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}var Se={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_align_left:["M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"],format_align_center:["M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"],format_align_right:["M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"],format_align_justify:["M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"],format_line_spacing:["M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"],format_list_bulleted:["M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"],format_list_numbered:["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],format_indent_increase:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"],format_indent_decrease:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"],format_color_text:["M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"],ink_highlighter:["M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"],format_color_reset:["M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"],arrow_drop_down:["M480-360 280-560h400L480-360Z"],table:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"],table_chart:["M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"],grid_on:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],table_rows:["M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"],view_column:["M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"],border_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],select_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],border_outer:["M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"],border_inner:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"],border_clear:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],add:["M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"],remove:["M200-440v-80h560v80H200Z"],delete:["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],delete_sweep:["M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"],call_merge:["m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"],call_split:["M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"],drag_indicator:["M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"],image:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"],format_image_left:["M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"],format_image_right:["M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"],horizontal_rule:["M160-440v-80h640v80H160Z"],flip_to_back:["M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],flip_to_front:["M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],open_with:["M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"],tune:["M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"],rotate_right:["M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"],rotate_left:["M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"],swap_horiz:["M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"],swap_vert:["M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"],shapes:["M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"],format_paint:["M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"],expand_more:["M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"],expand_less:["m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"],border_top:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_bottom:["M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_left:["M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_right:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"],border_horizontal:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],border_vertical:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],padding:["M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],text_rotation_none:["M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"],wrap_text:["M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"],height:["M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"],fit_width:["M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],settings:["m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],border_color:["M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"],format_color_fill:["m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"],vertical_align_top:["M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"],vertical_align_center:["M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"],vertical_align_bottom:["M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"],line_weight:["M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"],keyboard_arrow_up:["M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"],keyboard_arrow_down:["M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"],keyboard_arrow_left:["M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"],keyboard_arrow_right:["M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"],more_vert:["M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"],page_break:["M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"],branding_watermark:["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"],arrow_back:["M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"],search:["M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"],toc:["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],done_all:["M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"],check_circle:["m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"],chat_bubble_outline:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],chat_bubble_check:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],check:["M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"],close:["m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"],add_comment:["M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],comment:["M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],edit_note:["M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"],rate_review:["M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],visibility:["M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"],format_textdirection_l_to_r:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"],format_textdirection_r_to_l:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"],"agent-sparkle":["m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"]};var ao={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},uy=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function pc(e){return createT(en$1)(e)}function ts(e){return uy.includes(e)}function Kk(e){return e!=null}var fy=[{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"}],py=[{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"}],jk=[{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 Uk(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function Wk(e){return e==="none"||Uk(e)}function cy(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function Gk(e){return py.some(t=>t.value===e)}function Ir(e,t,n){switch(t){case "table.borderTarget":return Wk(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(!cy(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(!Gk(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&&!cy(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function mc(e,t=ao){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return Ir(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return Ir(t,e,"single")?.command??null;case "table.borderWidth":return Ir(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function Xk(e){return fy.find(n=>n.value===e)?.labelKey??"table.borders.all"}function Yk(e){return Se[e]}function Gn(e){return e.surface??null}var Qk={"review.comments":{type:"toggleReviewPane"},"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"},"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.footnote":{type:"insertNote",noteKind:"footnote"},"insert.endnote":{type:"insertNote",noteKind:"endnote"},"insert.pageNumber":{type:"insertPageField",field:"PAGE"},"insert.totalPages":{type:"insertPageField",field:"NUMPAGES"},"insert.sectionPages":{type:"insertPageField",field:"SECTIONPAGES"},"insert.pageXofY":{type:"insertPageField",field:"PAGE_X_OF_Y"},"insert.pageBreak":{type:"insertBreak",kind:"page"},"insert.sectionBreakNextPage":{type:"insertBreak",kind:"section"},"insert.sectionBreakContinuous":{type:"insertBreak",kind:"sectionContinuous"},"insert.toc":{type:"insertToc"},"contentControl.remove":{type:"removeContentControl"}};function Jk(e){return gy[e]??null}var my=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),gy={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:my,mime:"image/png",widthPoints:72,heightPoints:72},"image.properties":{type:"setImageProperties",description:"probe"},"table.insert":{type:"insertTable",rows:1,cols:1},"file.pageSetup":{type:"setPageSetup",orientation:"portrait"},"paragraph.dialog":{type:"setParagraphFormat",alignment:"left"}};function Ea(e){return Qk[e]??null}var eT={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},tT={"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 hy(e,t,n){return Ir(n,e,t)?.command??null}function ns(e,t){if(e==="review.editingMode")return {type:"setEditingMode",mode:t};if(e==="styles.style")return {type:"setParagraphStyle",styleId:t};if(e==="list.lineSpacing")return {type:"setLineSpacing",rule:"multiple",value:t};if(ts(e))return hy(e,t,ao);if(e==="image.wrap")return typeof t!="string"||!cb$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=eT[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function yy(e,t,n=ao){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=mc(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 nT=["editing","suggesting","viewing"];function by(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(ts(t))return yy(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=nT.filter(c=>c!==a).map(c=>e.can(ns(t,c))),s=i.some(c=>c.ok),l=i.find(c=>!c.ok);return {id:t,enabled:s,disabledReason:!s&&l&&!l.ok?l.reason:null,active:false,value:a}}if(t==="format.painter"){let a=Gn(e);if(!a)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let i=a.formatPainter.state();if(i.mode!=="off")return {id:t,enabled:true,disabledReason:null,active:true,value:i.mode};let s=e.can({type:"clearFormatting"});return s.ok?{id:t,enabled:true,disabledReason:null,active:false,value:i.mode}:{id:t,enabled:false,disabledReason:s.reason,active:false,value:i.mode}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let a=Gn(e),i=a?.state().contentControls,s=t==="contentControl.showAll"?i?.showAll??false:i?.formFill??false;return {id:t,enabled:a!==null,disabledReason:a?null:"editor is not ready",active:s}}if(t==="contentControl.inspector"){let a=Gn(e);return a?a.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.authors"){let a=e.can({type:"toggleReviewPane"});return a.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:a.reason,active:false}}let n=Ea(t);if(!n){let a=tT[t];if(a!==void 0){let s=ns(t,a);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,u=t==="image.wrap"?c?.wrap:t==="image.altText"?c?.description:void 0;return l.ok?{id:t,enabled:true,disabledReason:null,active:false,...u!==void 0?{value:u}:{}}:{id:t,enabled:false,disabledReason:l.reason,active:false,...u!==void 0?{value:u}:{}}}let i=gy[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let l=e.canExecuteImageCommand?.({type:"insertImage",data:my,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="image.properties"&&i.type==="setImageProperties"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="table.insert"&&i.type==="insertTable"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="paragraph.dialog"&&i.type==="setParagraphFormat"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}let s=e.can(i);if(!s.ok)return {id:t,enabled:false,disabledReason:s.reason,active:false}}return 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 rT(e){if(e==="format.painter")return true;let t=Ea(e);return t?.type==="toggleMark"||t?.type==="setAlignment"}function oT(e,t){return t.map(n=>by(e,n))}function aT(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=Ir(r,t,n);if(!o)return {result:{ok:false,code:"unsupported",reason:"invalid table chrome value"},nextDraft:null};let a=e.can(o.command);if(!a.ok)return {result:{ok:false,code:a.code,reason:a.reason},nextDraft:null};let i=e.exec(o.command);return i.ok?{result:i,nextDraft:o.nextDraft}:{result:i,nextDraft:null}}function iT(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="format.painter"){let a=Gn(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(a.formatPainter.state().mode==="off"){let i=e.can({type:"clearFormatting"});if(!i.ok)return {ok:false,code:i.code,reason:i.reason}}return a.formatPainter.press()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:Ui}}if(t==="contentControl.showAll"){let a=Gn(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=Gn(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=Gn(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=Gn(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let i=a.state().contentControls.activeControlId;if(!i)return {ok:false,code:"notFound",reason:"no content control at the selection"};let s=a.contentControls.disabledReason(i,"remove");return s?{ok:false,code:s==="bound"?"bound":"locked",reason:s}:a.contentControls.remove(i)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let r=n===void 0?Ea(t):ns(t,n)??Ea(t);if(!r)return n!==void 0?{ok:false,code:"unsupported",reason:"invalid value for toolbar command"}:t==="file.save"?{ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"}:t==="file.open"?{ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"}:{ok:false,code:"unsupported",reason:"not wired to an editor command"};let o=e.can(r);return o.ok?e.exec(r):{ok:false,code:o.code,reason:o.reason}}function sT(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function lT(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=es(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function dT(e,t){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let n=e.can(t);return n.ok?e.exec(t):{ok:false,code:n.code,reason:n.reason}}function gc(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(gc):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,gc(e[t])]))}function cT(e){return JSON.stringify(gc(e))}var hc=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:Se.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:Se.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:Se.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:Se.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:Se.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:Se.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:Se.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:Se.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:Se.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:Se.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:Se.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:Se.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:Se.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:Se.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:Se.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:Se.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:Se.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:Se.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:Se.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:Se.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:Se.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:Se.format_clear,state:{kind:"command"}}]},{id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:Se.comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:Se.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:Se.edit_note,state:{kind:"command"}}]},{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:Se.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:Se.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:Se.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:Se.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:Se.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:Se.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:Se.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:Se.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:Se.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:Se.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:Se.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:Se.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:Se.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:Se.format_line_spacing,state:{kind:"command"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:Se.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:Se.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:Se.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:Se.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:Se.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:Se.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:Se.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:Se.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:Se.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:Se.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:Se.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:Se.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:Se.toc,state:{kind:"command"}}]}],vy=hc;function uT(e,t){return `${e.id}.${t.id}`}function xy(){return vy.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function fT(e){let t=xy();if(!e)return t;let n=vy.find(r=>r.id==="image");return n?[...t,n]:t}var Sy=[{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:"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:"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:"table.insert",picker:"tableGrid"},{kind:"separator"},{kind:"item",slot:"insert.footnote"},{kind:"item",slot:"insert.endnote"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.break",paths:Se.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"review",labelKey:"toolbar.review",entries:[]},{id:"help",labelKey:"toolbar.help",entries:[]}];function pT(){let e=[],t=n=>{for(let r of n)r.kind==="item"?e.push(r.slot):r.kind==="submenu"&&t(r.items);};for(let n of Sy)t(n.entries);return e}function mT(){return hc.reduce((e,t)=>e+t.controls.length,0)}var gT="formattingBar.unavailableInPreview";var bT=createT(en$1);function io(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return bT(t)}}var Iy=new WeakMap;function rs(e,t){let n=new Map;return Iy.set(e,n),(r,o,a="textContent")=>{let i=n.get(r);i||n.set(r,i=new Map),i.set(a,o),a==="textContent"?r.textContent=t(o):r.setAttribute(a,t(o));}}function wy(e,t){let n=Iy.get(e);if(n)for(let[r,o]of n){if(r!==e&&!e.contains(r)){n.delete(r);continue}for(let[a,i]of o)a==="textContent"?r.textContent=t(i):r.setAttribute(a,t(i));}}function ky(e,t,n,r){let o=io(r),a=e.ownerDocument,i=a.createElement("dialog"),s=rs(i,o);i.className="docx-text-form-dialog",i.setAttribute("role","alertdialog"),s(i,"textFormField.invalidTitle","aria-label"),s(i,`textFormField.invalid${t==="number"?"Number":"Date"}`,"aria-description");let l=a.createElement("h2");l.className="docx-text-form-dialog__header",s(l,"textFormField.invalidTitle");let c=a.createElement("div");c.className="docx-text-form-dialog__body",s(c,`textFormField.invalid${t==="number"?"Number":"Date"}`);let u=a.createElement("div");u.className="docx-text-form-dialog__footer";let g=a.createElement("button");g.type="button",g.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(g,"textFormField.apply");let m=false,y=()=>{m||(m=true,n());};return g.addEventListener("click",y),i.addEventListener("keydown",v=>{v.key==="Enter"&&(v.preventDefault(),v.stopPropagation(),y());}),i.addEventListener("cancel",v=>{v.preventDefault(),y();}),u.append(g),i.append(l,c,u),e.append(i),i.showModal(),g.focus(),i}function Ty(e,t,n,r,o){let a=io(o),i=e.ownerDocument,s=i.createElement("dialog"),l=rs(s,a);s.className="docx-text-form-dialog",l(s,"textFormField.title","aria-label");let c=i.createElement("h2");c.className="docx-text-form-dialog__header",l(c,"textFormField.title");let u=i.createElement("div");u.className="docx-text-form-dialog__body";let g=i.createElement("div");g.className="docx-text-form-dialog__footer",s.append(c,u,g);let m=(P,N)=>{let _=i.createElement("label");_.className="docx-text-form-dialog__row";let M=i.createElement("span");M.className="docx-text-form-dialog__label",l(M,P),N.className="docx-text-form-dialog__input",_.append(M,N),u.append(_);},y=i.createElement("input");y.type="text",y.value=t.defaultText,m("textFormField.defaultText",y);let v=i.createElement("select"),w=["regular","number","date"];for(let P of w){let N=i.createElement("option");N.value=P,l(N,`textFormField.${P}`),v.append(N);}if(!w.includes(t.type)){let P=i.createElement("option");P.value=t.type,l(P,"textFormField.preservedType"),P.disabled=true,v.append(P);}v.value=t.type,m("textFormField.type",v);let b=i.createElement("input");b.type="number",b.min="0",b.max="32767",b.step="1",b.value=String(t.maxLength),m("textFormField.maxLength",b);let S=i.createElement("select"),k=P=>{S.replaceChildren();let N=Vg$1[v.value]??[];for(let _ of N){let M=i.createElement("option");M.value=_;let E={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[_];E||!_?l(M,E??"textFormField.noFormat"):M.textContent=_,S.append(M);}if(!N.includes(P)){let _=i.createElement("option");_.value=P,P?_.textContent=P:l(_,"textFormField.noFormat"),_.disabled=true,S.append(_);}S.value=P;};k(t.format),v.addEventListener("change",()=>k("")),m("textFormField.format",S);let O=i.createElement("input");O.type="checkbox",O.checked=t.enabled;let D=i.createElement("label");D.className="docx-text-form-dialog__checkbox-row";let L=i.createElement("span");l(L,"textFormField.enabled"),D.append(O,L),u.append(D);let p=i.createElement("p");p.className="docx-text-form-dialog__error",p.setAttribute("role","alert"),u.append(p);let A=i.createElement("button");A.type="button",A.className="docx-text-form-dialog__button",l(A,"textFormField.cancel"),A.addEventListener("click",r);let Z=i.createElement("button");Z.type="button",Z.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(Z,"textFormField.apply");let T=()=>{if(!b.value||!b.checkValidity()||!n(y.value,{type:v.value,maxLength:Number(b.value),format:S.value,enabled:O.checked})){l(p,"textFormField.invalidOptions");return}r();};return Z.addEventListener("click",T),s.addEventListener("keydown",P=>{P.key==="Enter"&&P.target instanceof HTMLInputElement&&(P.preventDefault(),T());}),s.addEventListener("cancel",P=>{P.preventDefault(),r();}),g.append(A,Z),e.append(s),s.showModal(),y.focus(),y.select(),s}function Py(e,t,n){let r=[],o=[];for(let i of e)for(let s of xa$1(i).keys()){let l=Ga(i,s);if(l?.kind==="paragraph")for(let c of Zg$1(l)){let u=t.get(c.fieldNodeId);if(!u)continue;let g=(Nh$1(i,s)??"").slice(c.start,c.end),m=Wg$1(g,c,"fill",u.locale);if(m===null)return {reason:"invalidArgs"};if(m===g)continue;let y={op:"commitTextFormField",paragraphId:s,fieldNodeId:c.fieldNodeId,locale:u.locale},v=Sh$1(i,y);if(v)return {reason:v};r.push(y),o.push({paragraphId:s,start:c.start,end:c.end,length:m.length});}}let a=i=>{let s=i.offset;for(let l of o)l.paragraphId!==i.paragraphId||i.offset<=l.start||(s+=i.offset>=l.end?l.length-(l.end-l.start):Math.min(i.offset-l.start,l.length)-(i.offset-l.start));return s===i.offset?i:{...i,offset:s}};return {ops:r,selection:{anchor:a(n.anchor),head:a(n.head)}}}var os=new WeakMap,as=new WeakMap;function Ry(e){return as.get(e)?.()??null}function Cy(e){return [...xa$1(e).keys()].flatMap(t=>{let n=Ga(e,t);return n?.kind==="paragraph"?Zg$1(n):[]})}function is(e){return os.get(e)?.()}function Ey(e,t){let n=io(e.translate),r=e.container.ownerDocument,o,a=false,i=new Map,s=()=>e.parts?.()??[e.part()];if(t?.length)for(let F of s()){let j=t.filter(X=>X.partName===F.name);if(!j.length)continue;let z=Cy(F);for(let X of j){let Q=z[X.fieldIndex];Q&&i.set(Q.fieldNodeId,{text:X.text,locale:X.locale});}}let l=new WeakMap,c=new WeakMap,u=(F=e.part())=>{l.set(F,new Map([...i].filter(([j])=>j.startsWith(`${F.name}#`))));},g=()=>(i=new Map(s().flatMap(F=>[...l.get(F)??[]])),c.get(e.part())??null),m=F=>{i.delete(F),u();};s().forEach(u);let y=()=>{if(!i.size)return null;if(a)return "invalidState";let F=Py(s(),i,e.selection());if("reason"in F)return F.reason;if(F.ops.length&&!e.editable())return "locked";let j=s();s().forEach(u);let z=i;F.ops.length&&c.set(e.part(),e.selection()),i=new Map,a=true;try{let X=F.ops.length?e.save?e.save(F.ops,F.selection):"unsupported":null;return X?i=z:(delete ne.dataset.fieldError,F.ops.length&&c.set(e.part(),F.selection)),s().forEach(u),X}catch(X){throw s().every(Q=>j.includes(Q))&&(i=z),s().forEach(u),X}finally{a=false;}};as.set(e.container,y);let v=()=>i.size?s().flatMap(F=>Cy(F).flatMap((j,z)=>{let X=i.get(j.fieldNodeId);return X?[{partName:F.name,fieldIndex:z,...X}]:[]})):[];os.set(e.container,v);let w,b=(F,j)=>(Nh$1(e.part(),F)??"").slice(j.start,j.end),S=null,k=null,O=()=>{let F=e.selection();S?.remove(),S=null,e.pagesLayer.focus({preventScroll:true}),e.select(F);};function D(F,j){w={paragraphId:F,fieldNodeId:j.fieldNodeId},e.select({anchor:{paragraphId:F,offset:j.start},head:{paragraphId:F,offset:j.end}}),e.selection().head.paragraphId===F&&e.selection().head.offset>=j.start&&e.selection().head.offset<=j.end&&(k=w??k),w=void 0;}function L(F,j){O();let z=e.locale?.()??"en-US";S=Ty(e.container,j,(X,Q)=>{if(!e.editable()||e.protected(F)||!e.apply({op:"setTextFormFieldDefault",locale:z,paragraphId:F,fieldNodeId:j.fieldNodeId,text:X,options:Q}))return false;let H=Ga(e.part(),F),J=H?.kind==="paragraph"?Zg$1(H).find(ee=>ee.fieldNodeId===j.fieldNodeId):null;return J&&D(F,J),true},O,n);}let p=F=>{let z=F.target?.closest('[data-field-atom="form"][data-start]'),X=z?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!z||!X||!e.editable())return null;let Q=Ga(e.part(),X);if(Q?.kind!=="paragraph")return null;let H=Number(z.dataset.start),J=Zg$1(Q).find(ee=>ee.start<=H&&H<ee.end);return J?{paragraphId:X,field:J}:null},A=null,Z=F=>F.shiftKey||F.altKey||F.ctrlKey||F.metaKey,T=F=>{if(o=void 0,A=null,F.button!==0)return;let j=p(F);j&&!Z(F)&&!e.protected(j.paragraphId)&&(A={x:F.clientX,y:F.clientY,paragraphId:j.paragraphId,fieldNodeId:j.field.fieldNodeId,moved:false}),w=j?{paragraphId:j.paragraphId,fieldNodeId:j.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",T,{capture:true});let P=F=>{A&&Math.hypot(F.clientX-A.x,F.clientY-A.y)>4&&(A.moved=true);},N=()=>{A=null;},_=(F,j=false)=>{let z=A;if(A=null,!z||z.moved||S||F.button!==0||F.detail>1||Math.hypot(F.clientX-z.x,F.clientY-z.y)>4||!e.editable()||Z(F)||e.protected(z.paragraphId))return;let X=Ga(e.part(),z.paragraphId),Q=X?.kind==="paragraph"?Zg$1(X).find(J=>J.fieldNodeId===z.fieldNodeId):null;if(!Q)return;let H=e.selection();j&&(H.anchor.paragraphId!==H.head.paragraphId||H.anchor.offset!==H.head.offset)&&!(H.anchor.paragraphId===z.paragraphId&&H.head.paragraphId===z.paragraphId&&Math.min(H.anchor.offset,H.head.offset)===Q.start&&Math.max(H.anchor.offset,H.head.offset)===Q.end)||D(z.paragraphId,Q);};r.addEventListener("pointermove",P),r.addEventListener("pointercancel",N),e.pagesLayer.addEventListener("click",_);let M=F=>{if(F.shiftKey||F.altKey||F.ctrlKey||F.metaKey)return false;let j=p(F);if(!j)return false;let{paragraphId:z,field:X}=j;return F.preventDefault(),D(z,X),e.protected(z)||L(z,X),true};e.pagesLayer.addEventListener("dblclick",M);function $(){let F=e.selection();if(F.anchor.paragraphId!==F.head.paragraphId)return null;let j=F.head.paragraphId,z=Ga(e.part(),j);if(z?.kind!=="paragraph")return null;let X=Math.min(F.anchor.offset,F.head.offset),Q=Math.max(F.anchor.offset,F.head.offset),H=Zg$1(z).filter(ee=>ee.start<=X&&ee.end>=Q),J=H.find(ee=>k?.paragraphId===j&&ee.fieldNodeId===k.fieldNodeId)??H.find(ee=>ee.start===X&&ee.end===Q)??H[0];return J?{paragraphId:j,field:J}:null}function E(){if(o===void 0)return $();if(!o)return null;let F=Ga(e.part(),o.paragraphId),j=F?.kind==="paragraph"?Zg$1(F).find(z=>z.fieldNodeId===o.fieldNodeId):null;return j?{paragraphId:o.paragraphId,field:j}:null}let G=F=>{let j=F.button===-1||F.clientX===0&&F.clientY===0?$():p(F);o=j?{paragraphId:j.paragraphId,fieldNodeId:j.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",G);let le=()=>{let F=E();return !!F&&e.editable()&&!e.protected(F.paragraphId)&&!Sh$1(e.part(),{op:"setTextFormFieldDefault",paragraphId:F.paragraphId,fieldNodeId:F.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},ne=r.createElement("span");return ne.className="docx-text-form-status",e.container.append(ne),{doubleClick:M,pointerUp:F=>_(F,true),canEdit:le,edit(){if(!le())return false;let F=E();return D(F.paragraphId,F.field),L(F.paragraphId,F.field),true},selectForDeletion(F){let j=e.selection(),{paragraphId:z,offset:X}=j.head;if(!e.editable()||e.protected(z)||j.anchor.paragraphId!==z||j.anchor.offset!==X)return false;let Q=Ga(e.part(),z);if(Q?.kind!=="paragraph")return false;let H=Zg$1(Q).find(J=>J.start<J.end&&(F==="backward"?J.end===X:J.start===X));return H?(D(z,H),true):false},beforeSelect(F){let j=we=>{if(w!==void 0)k=w;else if(F.anchor.paragraphId!==F.head.paragraphId||k?.paragraphId!==F.head.paragraphId)k=null;else {let ue=Ga(e.part(),F.head.paragraphId),Be=ue?.kind==="paragraph"?Zg$1(ue).find(ke=>ke.fieldNodeId===k?.fieldNodeId):null;(!Be||Math.min(F.anchor.offset,F.head.offset)<Be.start||Math.max(F.anchor.offset,F.head.offset)>Be.end)&&(k=null);}return w=void 0,delete ne.dataset.fieldError,we};if(a||S?.getAttribute("role")==="alertdialog")return null;if(!e.editable())return F;let z=$();if(!z||!e.protected(z.paragraphId)||!z.field.enabled||!Xg$1(z.field))return j(F);let{field:X,paragraphId:Q}=z;if((!w||w.fieldNodeId===X.fieldNodeId)&&F.anchor.paragraphId===Q&&F.head.paragraphId===Q&&Math.min(F.anchor.offset,F.head.offset)>=X.start&&Math.max(F.anchor.offset,F.head.offset)<=X.end)return j(F);let H=i.get(X.fieldNodeId),J=H?.text,ee=H?.locale??e.locale?.()??"en-US",pe=b(Q,X);if(X.type==="date"&&J===void 0)return m(X.fieldNodeId),j(F);let R=Wg$1(pe,X,"fill",ee);if(R===pe||R===null&&(J===void 0||J===pe))return m(X.fieldNodeId),j(F);a=true;let K=e.part();u(K);let U=i;i=new Map(U),i.delete(X.fieldNodeId);let de;try{de=e.apply({op:"commitTextFormField",locale:ee,paragraphId:Q,fieldNodeId:X.fieldNodeId}),de||(i=U);}catch(we){throw e.part()===K&&(i=U),we}finally{u(),a=false;}if(!de)return w=void 0,ne.setAttribute("role","alert"),ne.dataset.fieldError="true",ne.textContent=n("textFormField.invalidValue"),R===null&&(X.type==="number"||X.type==="date")&&(S=ky(e.container,X.type,()=>{S?.remove(),S=null;let we=e.selection(),ue=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(we);},Be=Ga(e.part(),Q),ke=Be?.kind==="paragraph"?Zg$1(Be).find(Fe=>Fe.fieldNodeId===X.fieldNodeId):null;if(!ke||!e.editable()||!e.protected(Q)||b(Q,ke)!==pe||!ke.enabled||!Xg$1(ke)||ke.type!==X.type||ke.format!==X.format||Wg$1(pe,ke,"fill",ee)!==null){ue();return}a=true;try{if(e.apply({op:"deleteText",paragraphId:Q,start:ke.start,end:ke.end,textFormFieldId:ke.fieldNodeId})){m(ke.fieldNodeId),delete ne.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let Fe={paragraphId:Q,offset:ke.start};a=!1,e.select({anchor:Fe,head:Fe}),k={paragraphId:Q,fieldNodeId:ke.fieldNodeId};}else a=!1,ue();}finally{a=false;}},n)),null;m(X.fieldNodeId);let Ie=Ga(e.part(),Q),ce=Ie?.kind==="paragraph"?Zg$1(Ie).find(we=>we.fieldNodeId===X.fieldNodeId):null,re=ce?ce.end-X.end:0,ye=we=>we.paragraphId===Q&&we.offset>=X.end?{...we,offset:we.offset+re}:we;return j({anchor:ye(F.anchor),head:ye(F.head)})},update(){S&&wy(S,n);let F=$(),j=e.selection(),z=!!F&&j.anchor.offset!==j.head.offset&&Math.min(j.anchor.offset,j.head.offset)===F.field.start&&Math.max(j.anchor.offset,j.head.offset)===F.field.end;for(let X of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let Q=X.closest("[data-paragraph-id]")?.dataset.paragraphId,H=Number(X.dataset.start);!!F&&Q===F.paragraphId&&H>=F.field.start&&H<F.field.end?X.dataset.textFormSelection=z?"whole":"caret":delete X.dataset.textFormSelection;}if(ne.dataset.fieldError){ne.textContent=n("textFormField.invalidValue");return}F?ne.setAttribute("role","status"):ne.removeAttribute("role"),ne.textContent=F?n(z?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>$()?.field.fieldNodeId??null,afterApply(F){F?u():g();},restoreAfterHistory:g,annotate(F){(!a||F.some(z=>z.op!=="commitTextFormField"))&&u(),F.some(z=>z.op==="insertText"||z.op==="deleteText")&&delete ne.dataset.fieldError;let j=$();return k=j?{paragraphId:j.paragraphId,fieldNodeId:j.field.fieldNodeId}:null,F.map(z=>{if(!k||z.op!=="insertText"&&z.op!=="deleteText"||z.revision||z.paragraphId!==k.paragraphId||!e.protected(z.paragraphId))return z;let X=Ga(e.part(),z.paragraphId),Q=X?.kind==="paragraph"?Zg$1(X).find(ee=>ee.fieldNodeId===k.fieldNodeId):null,H=z.op==="insertText"?z.offset:z.start,J=z.op==="insertText"?z.offset:z.end;return !Q||H<Q.start||J>Q.end?z:(i.has(Q.fieldNodeId)||i.set(Q.fieldNodeId,{text:b(z.paragraphId,Q),locale:e.locale?.()??"en-US"}),{...z,textFormFieldId:Q.fieldNodeId})})},keydown(F){if(F.key==="F10"&&F.shiftKey&&!F.altKey&&!F.ctrlKey&&!F.metaKey)return o=void 0,F.preventDefault(),e.pagesLayer.dispatchEvent(new MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(F.key!=="Tab"||F.altKey||F.ctrlKey||F.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let j=[],z=[e.part().root];for(;z.length;){let R=z.pop();if(R.kind==="paragraph")for(let K of Zg$1(R))e.protected(R.id)&&K.enabled&&Xg$1(K)&&!Sh$1(e.part(),{op:"insertText",paragraphId:R.id,offset:K.start,text:"x"})&&j.push({paragraphId:R.id,field:K});else for(let K=R.children.length-1;K>=0;K--){let U=R.children[K];U.kind!=="textValue"&&z.push(U);}}if(!j.length)return false;let X=e.selection(),Q=X.head,H=k?j.findIndex(R=>R.paragraphId===k.paragraphId&&R.field.fieldNodeId===k.fieldNodeId&&R.field.start<=Math.min(X.anchor.offset,Q.offset)&&R.field.end>=Math.max(X.anchor.offset,Q.offset)):-1,J=H>=0?H:j.findIndex(R=>R.paragraphId===Q.paragraphId&&R.field.start<=Math.min(X.anchor.offset,Q.offset)&&R.field.end>=Math.max(X.anchor.offset,Q.offset)),ee=J<0?F.shiftKey?j.length-1:0:(J+(F.shiftKey?-1:1)+j.length)%j.length,pe=j[ee];return F.preventDefault(),D(pe.paragraphId,pe.field),true},destroy(){as.get(e.container)===y&&as.delete(e.container),os.get(e.container)===v&&os.delete(e.container),r.removeEventListener("pointermove",P),r.removeEventListener("pointercancel",N),e.pagesLayer.removeEventListener("click",_),e.pagesLayer.removeEventListener("contextmenu",G),ne.remove(),e.pagesLayer.removeEventListener("dblclick",M),e.pagesLayer.removeEventListener("pointerdown",T,{capture:true}),S?.remove(),S=null;}}}var ss=new WeakMap;function yc(e){let t=ss.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function Fy(e){let t=ss.get(e)??{depth:0};return t.depth++,ss.set(e,t),()=>{--t.depth===0&&(ss.delete(e),t.resolve?.());}}async function Oy(e,t,n){if(!e)throw Zt("notFound","no document is loaded");let r=t?yc(t):void 0;if(r&&(await r,n()!==e))throw Zt("invalidState","The document changed before the pending save could finish.");return e.save().slice().buffer}function Ay(e,t,n){let r=()=>{if(n())throw Zt("destroyed","Cannot save a destroyed surface.")};if(r(),yc(t))throw Zt("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),r();let o=Ry(t);if(o)throw Zt(o,"Cannot save pending text form input. Enter a valid value in each field.");return r(),e.refreshRefFieldResults(),r(),e.session.save()}function My(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function Ly(e,t,n){let r=n.refusal();if(r)return r;let o=new Map;for(let i of e){if(i.op!=="commitTextFormField")return "invalidArgs";let s=bt(n.session,i.paragraphId,{kind:"body"}),l=JSON.stringify(s),c=o.get(l)??{scope:s,ops:[]};c.ops.push(i),o.set(l,c);}for(let i of o.values()){let s=n.gate(i.ops,i.scope);if(s)return s}if(n.collaborationActive)return "unsupported";let a;return n.commit(()=>a=n.session.applyTreeOpsAtomic([...o.values()]),()=>t),a?.rejected?a.reason??"invalidArgs":null}function Ny(e,t){let n=Ug$1(e);return {get:()=>n,set(r){let o=Ug$1(r);n!==o&&(t(),n=o);}}}var vT=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTableRow","deleteTableRow","setRunProperties","setParagraphProperties","setParagraphMarkProperties"]);function bc(e){return vT.has(e.op)}function vc(e){if(bc(e))return e.revision!==void 0;switch(e.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "splitParagraphMany":return e.revision!==void 0;default:return false}}function xc(e){return e?.trim()||void 0}function Dy(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function Hy(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}function ls(e,t,n){if(!e)return null;let r=Od$1(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var _y="docx-field-atom--active",xT="docx-field-atom",By=new WeakMap;function Sc(e,t,n){let r=By.get(e);r||(r={caretKey:null,marked:[]},By.set(e,r));let o=t?`${t.paragraphId}\0${t.offset}`:null;if(!n?.domReplaced&&o===r.caretKey)return;for(let i of r.marked)i.classList.remove(_y);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${xT}`);for(let i of a){if(i.dataset.paragraphId!==t.paragraphId)continue;let s=Number(i.dataset.start),l=Number(i.dataset.end);!Number.isFinite(s)||!Number.isFinite(l)||t.offset<s||t.offset>l||(i.classList.add(_y),r.marked.push(i));}}var ST={kind:"body"};function $y(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??=Le(e.canonicalUnfilteredLayout()),n(l)):Le(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},a=Me$1(t.part(),o),i=Ne(t.part(),o);if(!a&&i.length===0)return true;let s=[];a&&s.push({scope:ST,ops:[a]});for(let l of i)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function Zy(e){let t=0,n=null,r="",o=null,a=true,i=null,s="";return ()=>{let l=e.surface(),c=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,u=e.activeKey(),g=e.paneOpen(),m=e.selectionAnchor(),y=e.authorFilterKey();return (l!==n||c!==r||u!==o||g!==a||m!==i||y!==s)&&(n=l,r=c,o=u,a=g,i=m,s=y,t+=1),t}}function ds(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=sb$1(t),o=null,a="accept",i=null,s="accept",l=new WeakMap,c=null,u=false,g=0,m=null,y=[],v=null,w=[],b=r,S=t,k=new Set,O="accept",D=new WeakSet,L=new WeakMap,p=new Map,A=()=>{g+=1,m=null,y=[],v=null;},Z=N=>JSON.stringify([N.id,ya$2(N)]),T=(N,_,M)=>{let $=IT(M),E=t,G=r?.hiddenAuthors??rb$1,le=a,ne;E===S&&wT($,k)&&($.size===0||le===O)?ne=b:$.size===0&&E.size===0?ne=void 0:ne=Object.freeze({hiddenAuthors:G,includes:j=>!E.has(j.author)&&!$.has(j.nodeId),includesNode:(j,z)=>!E.has(z)&&!$.has(j),excludedNodeMode:(j,z)=>E.has(z)?"proposed":$.has(j)&&le==="reject"?"original":"proposed",cacheKey:kT(E,$,le)});let F=[];for(let j of N){let z=qy(j);z!==null&&E.has(z)||j.kind==="revision"&&_.has(j)||F.push(j);}w=F.length===N.length?N:Ma$1(F),v=N,D=_,b=ne,S=E,k=$,O=le,u=false,i=null,s="accept",l=new WeakMap,c=null;},P=N=>{if(N===v)return;let _=new WeakSet,M=[],$=[];try{for(let G of N){if(G.kind!=="revision")continue;let le=!t.has(G.author),ne=L.get(G);ne===void 0&&(ne=o?.(G)??!0,$.push([G,ne])),!(le&&ne)&&(_.add(G),ne||M.push(G));}}catch(G){if(u)o=i,a=s,L=l,v=c,i=null,s="accept",l=new WeakMap,c=null,g+=1;else {let le=new WeakSet,ne=[];for(let F of N){if(F.kind!=="revision")continue;let j=p.get(Z(F))??true;(t.has(F.author)||!j)&&le.add(F),j||ne.push(F);}T(N,le,ne);}throw u=false,G}for(let[G,le]of $)L.set(G,le);let E=new Map;for(let G of N)G.kind==="revision"&&E.set(Z(G),L.get(G)??true);p=E,T(N,_,M);};return {get hiddenAuthors(){return r?.hiddenAuthors??rb$1},get hiddenAuthorList(){return n},get stateKey(){return String(g)},get hasFilter(){return t.size>0||o!==null},filterFor(N){return o?(P(N),b):r},filterForSession(N){return o?(P(N.reviewItems()),b):r},filterItems(N){if(!o){if(t.size===0)return N;if(N===m)return y;let _=N.filter(M=>{let $=qy(M);return $===null||!t.has($)});return m=N,y=_.length===N.length?N:Ma$1(_),y}return P(N),w},includesRevisionItem(N){return !D.has(N)},setPredicate(N,_="accept"){return o===null&&N===null?false:N===null?(o=null,a="accept",i=null,s="accept",u=false,L=new WeakMap,l=new WeakMap,p=new Map,c=null,w=[],D=new WeakSet,b=r,S=t,k=new Set,O="accept",A(),true):(i=o,s=a,l=L,c=v,u=true,o=N,a=_,L=new WeakMap,A(),true)},isVisible:N=>!t.has(N),setVisible(N,_){if(_===!t.has(N))return false;let M=new Set(t);return _?M.delete(N):M.add(N),t=M,n=Object.freeze([...M]),r=sb$1(M),A(),true},setAllVisible(N,_){let M=_?new Set:new Set(N);return M.size===t.size&&[...M].every($=>t.has($))?false:(t=M,n=Object.freeze([...M]),r=sb$1(M),A(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,A(),true)}}}function zy(e,t){return t.filterItems(e)}function IT(e){let t=new Set;for(let n of e)for(let r of ya$2(n))t.add(r);return t}function wT(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function kT(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function qy(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function Vy(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 a=t.surface();if(a)return a.setRevisionAuthorVisible(r,o);e.setVisible(r,o)&&t.notify();},setAllReviewAuthorsVisible:n,showAllReviewAuthors:()=>n(true)}}function Ic(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function Ky(e){let t=null;return {get(){let n=e.layout(),r=e.items(),o=e.styles(),a=t;if(a?.layout===n&&a.items===r&&a.styles===o)return a;let i=e.slots.resolve(d$2(n),(function*(){for(let m of r){let y=Ic(m);y!==null&&(yield y);}})()),s=a?.value,l=s!==void 0&&s.size===i.size&&[...i].every(([g,m])=>s.get(g)===m),c$1=l?s:i,u=a!==null&&l&&a.styles===o?a.resolved:new Map(c(c$1,o).map(g=>[g.author,g]));return t={layout:n,items:r,styles:o,value:c$1,resolved:u},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function jy(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$4(o.color)??a$5(o.slot);let a=e.slots.resolve(r.value,[n]).get(n);return a===void 0?void 0:a$5(a)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:b(r)}),a$4(t.resolved.get(n)?.color)}}}function so(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function Wy(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 Gy(e,t){let n=Ga(e,t);if(!n||n.kind==="textValue")return null;let r=Eb$1(n);return !r||!Db$1(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var wc=new WeakMap;function TT(e,t,n){return e.map(r=>a$4(n?.(r.name))??a$4(r.color)??a$4(t?.(r.name)))}function PT(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}
|
|
16
|
+
`;return n}function CT(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function RT(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 ET(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 Uy(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function FT(e,t){let n=Af$1(e,t.anchor.nodeId),r=Af$1(e,t.head.nodeId);if(!n||!r)return [];let o=sf(e,n,r);return o?wf(e,o.cellIds).map(a=>({...a,className:"docx-remote-selection-rect"})):[]}function Xy(e,t,n,r){let{scale:o$1,pageOffsetX:a,pages:i,colorForAuthor:s,declaredColorFor:l}=r,c=r.labelHost??null,u=TT(n,s,l),g={layout:t,fingerprint:PT(n,u),pagesKey:CT(i),scale:o$1,offsetKey:RT(a),labelHost:c},m=wc.get(e);if(m&&ET(m,e,g))return;wc.delete(e);let y=[],v=[],w=[],b=[];for(let[D,L]of n.entries())L.kind==="cells"||Uy(L)||b.push({key:String(D),from:{paragraphId:L.anchor.nodeId,offset:L.anchor.offset},to:{paragraphId:L.head.nodeId,offset:L.head.offset}});let S=b.length>0?df$1(t,b,Sa$1(t),i,r.measurer):null;for(let[D,L]of n.entries()){let p=u[D],A=jf(t,{paragraphId:L.head.nodeId,offset:L.head.offset},r.measurer);if(A){let T=cf(t,L.head.nodeId,A.pageIndex);w.push({selection:L,...p?{color:p}:{},pageIndex:A.pageIndex,x:A.x+T.x,y:A.y+T.y});}if(L.kind==="cells"){let T=FT(t,L);if(T.length>0){for(let P of T)y.push(P),v.push(p);continue}}if(Uy(L)){let T=jf(t,{paragraphId:L.anchor.nodeId,offset:L.anchor.offset},r.measurer);if(!T)continue;let P=cf(t,L.anchor.nodeId,T.pageIndex);y.push({pageIndex:T.pageIndex,x:T.x+P.x,y:T.y+P.y,width:Math.max(1/o$1,1),height:T.height,className:"docx-remote-caret"}),v.push(p);continue}let Z=S?.get(String(D));if(Z)for(let T of Z)y.push({...T,className:"docx-remote-selection-rect"}),v.push(p);}o(e,t,y,{scale:o$1,pageOffsetX:a}),[...e.children].forEach((D,L)=>{let p=a$4(v[L]);!p||!(D instanceof HTMLElement)||D.style.setProperty("--doc-remote-color",p);});let k=e.ownerDocument,O=[];for(let D of w){let L=t.pages[D.pageIndex];if(!L)continue;let p=k.createElement("div");p.className="docx-remote-caret-label",c?(p.setAttribute("data-docx-remote-actor",D.selection.actorId),O.push({element:p,selection:D.selection})):p.textContent=D.selection.name,p.style.left=`${(L.contentBox.x+D.x+(a?.get(D.pageIndex)??0))*o$1}px`,p.style.top=`${(L.contentBox.y+D.y)*o$1}px`;let A=a$4(D.color);A&&p.style.setProperty("--doc-remote-color",A),e.append(p);}wc.set(e,{...g,childCount:e.childElementCount}),c&&c.publish(O);}var OT=/[\p{L}\p{N}_'’]/u,Yy=e=>e!==void 0&&OT.test(e);function cs(e,t,n){let r=nf(e,t.paragraphId),o=t.paragraphId,a=Math.max(0,Math.min(t.offset,r.length)),i=-1;if(Yy(r[a])?i=a:a>0&&Yy(r[a-1])&&(i=a-1),i===-1){let s=a,l=a;for(;s>0&&/\s/.test(r[s-1]??"");)s-=1;for(;l<r.length&&/\s/.test(r[l]??"");)l+=1;return s===l&&l<r.length&&(l+=1),{from:{paragraphId:o,offset:s},to:{paragraphId:o,offset:l}}}return {from:{paragraphId:o,offset:gf(r,i+1,-1,n)},to:{paragraphId:o,offset:gf(r,i,1,n)}}}function _e(e){return {anchor:e,head:e}}function wr(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 us(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 a=n??Ra$1(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function Fa(e,t,n){let r=t[0],o=a=>{let i=t.includes(a.paragraphId),s=i?a.paragraphId:r??a.paragraphId,l=i?a.offset:0,c=nf(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,c))}};return {anchor:o(n.anchor),head:o(n.head)}}function fs(e,t,n,r){if(t.paragraphId===n.paragraphId)return nf(e,t.paragraphId).slice(t.offset,n.offset);let o=r??Ra$1(e),a=o.indexOf(t.paragraphId),i=o.indexOf(n.paragraphId);if(a===-1||i===-1)return "";let s=o.slice(a,i+1),l=nf(e,t.paragraphId).slice(t.offset);for(let c=1;c<s.length;c+=1){let u=s[c],g=nf(e,u),m=Oa$1(e,u).includes(s[c-1])?"":`
|
|
17
|
+
`;l+=m+(c===s.length-1?g.slice(0,n.offset):g);}return l}function kc(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 Jy(e){return e.kind}function e0(e){return e.kind!=="textValue"&&Jy(e)==="contentControl"}function Qy(e){return e.kind!=="textValue"&&Jy(e)==="contentControlContent"}function AT(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=kc(o);if(a.length>0&&a.every(i=>t.has(i))){n.set(o.id,a);return}}for(let a of o.children)r(a);}};return r(e.root),n}function MT(e,t,n){let r=new Set,o=(a,i)=>{if(a.kind!=="textValue"){if(a.kind==="table"&&n.has(a.id)){for(let s of a.children)o(s,true);return}if(e0(a)){let s=kc(a);!i&&s.length>0&&s.every(l=>t.has(l))&&r.add(a.id);for(let l of a.children)o(l,i);return}for(let s of a.children)o(s,i);}};return o(e.root,false),r}function t0(e,t,n,r,o,a){let i=new Set;for(let s=n;s<=r;s+=1){let l=t[s];(s===n?o.offset===0&&(s!==r||a.offset===e(l).length):s!==r||a.offset===e(l).length)&&i.add(l);}return i}function LT(e,t,n){let r=[],o=a=>{if(a.kind!=="textValue"){if(a.kind==="table"||e0(a)){let s=kc(a).filter(l=>n.has(l));if(s.length>0&&s.every(l=>t.has(l))){r.push(a.id);return}}for(let i of a.children)o(i);}};return o(e.root),r}function n0(e,t,n,r,o){let a=m=>nf(e,m);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let i=o??Ra$1(e),s=i.indexOf(n.paragraphId),l=i.indexOf(r.paragraphId);if(s===-1||l===-1||s>l)return null;let c=i.slice(s,l+1),u=t0(a,i,s,l,n,r),g=i[l];return {partName:t.name,paragraphIds:c,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...u],fullyCoveredBlockIds:LT(t,u,new Set(i)),lastMarkCovered:r.offset===a(g).length}}function r0(e,t,n,r,o){let a=p=>nf(e,p);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let i=o??Ra$1(e),s=i.indexOf(n.paragraphId),l=i.indexOf(r.paragraphId);if(s===-1||l===-1)return {ops:[],collapseTo:n};let c=t0(a,i,s,l,n,r),u=AT(t,c),g=new Map;for(let[p,A]of u)for(let Z of A)g.set(Z,p);let m=MT(t,c,u),y=s;if(g.has(n.paragraphId)){y=-1;for(let p=s+1;p<=l;p+=1)if(!g.has(i[p])){y=p;break}if(y===-1){let p=g.get(n.paragraphId);for(let A of u.get(p)??[])g.delete(A);u.delete(p),y=s;}}let v=i[y],w=y===s?n:{paragraphId:v,offset:0},b=[];for(let p=s;p<=l;p+=1){let A=i[p];if(g.has(A))continue;let Z=a(A).length,T=p===s?n.offset:0,P=p===l?r.offset:Z;T<P&&b.push({op:"deleteText",paragraphId:A,start:T,end:P});}for(let p of u.keys())b.push({op:"deleteBlock",blockId:p});for(let p of m)b.push({op:"removeContentControl",controlId:p});let S=p=>{let A=Ha$1(t,p);for(;A&&Qy(A);){let Z=Ha$1(t,A.id);if(!Z||!m.has(Z.id))break;A=Ha$1(t,Z.id);}return A},k=p=>{let A=[],Z=T=>{for(let P of T)if(P.kind!=="textValue"&&!u.has(P.id)){if(m.has(P.id)){let N=P.children.find(Qy);N&&N.kind!=="textValue"&&Z(N.children);continue}if(P.kind==="paragraph"){A.push(P.id);continue}A.push(`\0barrier:${P.id}`);}};return Z(p.children),A},O=(p,A)=>{let Z=S(p);if(!Z||S(A)!==Z)return false;let T=k(Z),P=T.indexOf(p),N=T.indexOf(A);return P!==-1&&N===P+1},D=v,L=v;for(let p=y+1;p<=l;p+=1){let A=i[p];g.has(A)||(O(L,A)?b.push({op:"joinParagraphs",firstId:D,secondId:A}):D=A,L=A);}return {ops:b,collapseTo:w}}function NT(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var s0=/^[^\s]{1,512}$/,DT=/["\\\u0000-\u001f\u007f]/;function ps(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!s0.test(t)||t==="__proto__")return null;let r=Number(n),o=e.dataset?.end,a=o!==void 0&&/^\d{1,9}$/.test(o)&&Number(o)>=r?Number(o):r+(e.textContent?.length??0);return {paragraphId:t,start:r,end:a}}function Oa(e,t,n){return DT.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function l0(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=ps(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function d0(e){return e.querySelector("[data-docx-hf-active]")}function kr(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 HT(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function Tc(e,t){let n=d0(e);if(n)return [n,e];let r=HT(e,t);return r&&r!==e?[r,e]:[e]}function o0(e,t){let n=l0(e);if(n)return n;if(e.nodeType!==Node.ELEMENT_NODE)return null;let r=e.querySelectorAll("[data-paragraph-id][data-start]"),o=t?[...r].reverse():[...r];for(let a of o){let i=ps(a);if(i)return {element:a,identity:i}}return null}function _T(e,t){let n=[...e.childNodes];if(n.length===0)return null;for(let r=Math.max(0,t);r<n.length;r+=1){let o=o0(n[r],false);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.start}}for(let r=Math.min(t,n.length)-1;r>=0;r-=1){let o=o0(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function a0(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")||d0(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?c0(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let s=e,l=ps(s);if(l)return {paragraphId:l.paragraphId,offset:t>0?l.end:l.start};let c=_T(s,t);return c||ZT(s)}let i=l0(e);return i?{paragraphId:i.identity.paragraphId,offset:NT(i.identity,t)}:null}function lo(e,t){if(!t||t.rangeCount===0)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:a}=t;if(!n||!o)return null;let i=a0(n,r,e),s=a0(o,a,e);if(!i||!s){let l=i??s;return l?{anchor:l,head:l}:null}return {anchor:i,head:s}}function Pc(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 i0(e,t,n){for(let r of Tc(e,n)){let o=BT(r,t);if(o)return o}return null}function BT(e,t){let n=Oa(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let i of n){let s=ps(i);if(!s||s.paragraphId!==t.paragraphId)continue;let l=$T(i),c=i.textContent?.length??0,u=s.end;if(l&&!i.closest?.("[data-docx-field]")&&(o=true,t.offset>=s.start&&t.offset<=u)){let g={node:l,offset:Math.min(t.offset-s.start,c)};if(t.offset<u)return g;r=g;}}if(r)return r;if(o)return null;let a=qT(e,t.paragraphId);return a?{node:a,offset:0}:null}function $T(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 qT(e,t){let n=null;for(let r of Oa(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 c0(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!s0.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function ZT(e){let t=c0(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function u0(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??kr(n.anchorNode,e),a=i0(e,t.anchor,o),i=i0(e,t.head,o);if(!a||!i)return false;let s=lo(e,n);if(s&&zt(s,t)){let l=kr(n.anchorNode,e);if(o===void 0||l===o)return true}try{return n.setBaseAndExtent(a.node,a.offset,i.node,i.offset),!0}catch{return false}}function zt(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 zT='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function f0(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 p0(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 VT(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function KT(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function m0(e,t,n,r){if(e.dataset.docxField!==void 0){let a=f0(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:f0(e,t,t+o.length),text:o,seq:r}}function g0(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=p0(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(zT))continue;g0(r,t);continue}let a=m0(r,o,t.modelText,t.seq);t.seq+=1,t.end=Math.max(t.end,a.end);let i=`${a.start}:${a.end}`;t.ranges.has(i)||(t.ranges.add(i),t.pieces.push(a));}}function jT(e,t,n,r){let o=[];for(let i of Oa(e,t,"")){let s=i;s.dataset.paragraphId===t&&s.dataset.start===void 0&&(o.some(l=>l.contains(s))||o.push(s));}let a=new Map;for(let i of o){let s=i.dataset.fragmentIndex??"",l=KT(i,n,r),c=a.get(s);(!c||l>c.affinity)&&a.set(s,{element:i,affinity:l});}return [...a.values()].map(i=>i.element)}function UT(e,t,n){for(let r of Oa(e,n.paragraphId,"[data-start]")){let o=r,a=p0(o,n.paragraphId);if(a===null||t.some(l=>l.contains(o)))continue;let i=m0(o,a,n.modelText,n.seq);n.seq+=1;let s=`${i.start}:${i.end}`;n.ranges.has(s)||(n.ranges.add(s),n.pieces.push(i));}}function WT(e,t){let n=[...e].sort((a,i)=>a.start-i.start||a.seq-i.seq),r="",o=0;for(let a of n)a.start>o&&(r+=t.slice(o,a.start)),r+=a.text,o=Math.max(o,a.end);return o<t.length&&(r+=t.slice(o)),r}function h0(e,t,n,r){let o=jT(e,t,r,VT(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)g0(i,a);return UT(e,o,a),a.pieces.length===0?null:WT(a.pieces,n)}var GT={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},y0={l:"left",e:"center",r:"right",j:"both"},b0={1:"240",5:"360",2:"480"},v0={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function XT(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}var YT=/^[a-z]$/;function QT(e){let t=e.key.toLowerCase();if(YT.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function S0(e,t={}){return n=>{if(n.defaultPrevented)return;if(n.key==="Escape"&&e.formatPainter.state().mode!=="off"){e.formatPainter.disarm(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="headerFooter"){e.exitHeaderFooter(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="note"){e.exitNote(),n.preventDefault();return}let r=QT(n);if(XT(n,r)&&!n.shiftKey){let i=r;if(i==="f"){n.preventDefault(),e.insertNote("footnote");return}if(i==="d"){n.preventDefault(),e.insertNote("endnote");return}if(i==="c"){n.preventDefault(),e.formatPainter.capture();return}if(i==="v"){n.preventDefault(),e.formatPainter.apply();return}}let o=n.metaKey||n.ctrlKey,a=GT[n.key];if(a){let i=a;n.key==="Home"||n.key==="End"?o&&(i=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?i=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?i=n.key==="ArrowLeft"?"lineStart":"lineEnd":o&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(i=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(i,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(o?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){o||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){o||n.altKey?e.deleteWordForward():e.deleteForward(),n.preventDefault();return}if(n.key==="Tab"){if(e.contentControls.formFill()&&e.contentControls.navigate(n.shiftKey?"previous":"next")){n.preventDefault();return}e.isListParagraph()?e.adjustIndent(n.shiftKey?"decrease":"increase"):n.shiftKey?e.adjustIndent("decrease"):e.insertTab(),n.preventDefault();return}if(n.key==="Enter"){o?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(o&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="v"){e.armForcePlainPaste();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){t.onRequestHyperlink(),n.preventDefault();return}if(o&&!n.shiftKey&&v0[n.key.toLowerCase()]){let i=v0[n.key.toLowerCase()];e.toggleRunProperty(i.localName,i.attributes),n.preventDefault();return}if(o&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(o&&!n.shiftKey&&y0[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:y0[n.key.toLowerCase()]}),n.preventDefault();return}if(o&&!n.shiftKey&&b0[n.key]){e.setParagraphProperty("spacing",{line:b0[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}if(o&&n.key.toLowerCase()==="y"){e.redo(),n.preventDefault();return}(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="z"&&(n.shiftKey?e.redo():e.undo(),n.preventDefault());}}function I0(e){let t=a=>{let i=e.copyFlavours();return i.text?(a.clipboardData?.setData("text/plain",i.text),i.html&&a.clipboardData?.setData("text/html",i.html),true):false};return {onCopy:a=>{t(a)&&a.preventDefault();},onCut:a=>{t(a)&&(e.deleteSelection(),a.preventDefault());},onPaste:a=>{let i=Td(a.clipboardData),s=a.clipboardData?.getData("text/html")??"";a.preventDefault(),!(!i&&!s)&&e.pasteRich(i,s.length>0?s:null);}}}function x0(e){let t=Td(e.dataTransfer);return t.length>0?t:null}function w0(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??x0(n);if(!r)return;nP(e,eP(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=x0(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function JT(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 eP(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=JT(n);return r?{text:r,paragraphId:tP(n)}:null}function tP(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 nP(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(zt(r.selection,_e(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let i=at(e.session,o.paragraphId)??e.session.part(),s=Nh$1(i,o.paragraphId);s!==null&&s.slice(o.offset-a.length,o.offset)===a&&e.setSelection({anchor:{paragraphId:o.paragraphId,offset:o.offset-a.length},head:o});}}e.type(n);}function k0(e,t,n,r=null){for(let o of Tc(e)){let a=h0(o,t,n,r);if(a!==null)return a}return null}function T0(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 a=n.slice(r,n.length-o),i=[];return t.length-o>r&&i.push({op:"deleteText",paragraphId:e,start:r,end:t.length-o}),a.length>0&&i.push({op:"insertText",paragraphId:e,offset:r,text:a}),i.length===0?null:{ops:i,caret:r+a.length}}function Me(e){return e.kind!=="textValue"}function xe(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Me(n)&&n.localName===t&&n.namespaceUri===da$1)return n;return null}function je(e,t="val"){return e?Ce(e,t,da$1):void 0}function Qt(e,t,n){return e?Ce(e,t,n):void 0}function Cc(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=Cc(n);return t}function co(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=co(r,t,n);if(o)return o}return null}function lt(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function Rc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var xn=Rc;function ms(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function Sn(e){return `${Math.round(e/20*100)/100}pt`}var rP="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",oP=zc$1;function Aa(e,t,n){for(let o of gc$1(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let a=w(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i&&Me(i.root))return i.root}}let r=e.parts.get(n);return r&&Me(r.root)?r.root:null}function P0(e){let t=Aa(e,rP,"/word/styles.xml"),n=new Map,r=null,o=null,a=null,i=null;if(!t)return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i};let s=0;for(let l of t.children){if(!Me(l)||l.namespaceUri!==da$1)continue;if(l.localName==="docDefaults"){r=xe(xe(l,"rPrDefault"),"rPr"),o=xe(xe(l,"pPrDefault"),"pPr");continue}if(l.localName!=="style")continue;if(s>=Ac$1)break;s+=1;let c=Ce(l,"styleId",da$1);if(!c)continue;n.set(c,l);let u=Ce(l,"default",da$1),g=Ce(l,"type",da$1);u==="1"||u==="true"||u==="on"?g==="paragraph"?a=c:g==="character"&&(i=c):(a===c&&(a=null),i===c&&(i=null));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i}}function Dn(e,t,n){let r=[],o=new Set,a=t;for(;a&&!o.has(a)&&r.length<oP;){o.add(a);let i=e.byId.get(a);if(!i)break;if(r.length===0&&n!==void 0){let s=Ce(i,"type",da$1);if(s!==void 0&&s!==n)return []}r.unshift(i),a=je(xe(i,"basedOn"));}return r}function Ec(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let a of n)r.push(a);let o=je(xe(t,"pStyle"));for(let a of Dn(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let i=xe(a,"pPr");i&&r.push(i);}return t&&r.push(t),r}function gs(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let a=[];if(r)for(let g of r)a.push(g);let i=[],s=je(xe(t,"pStyle"));for(let g of Dn(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let m=xe(g,"rPr");m&&i.push(m);}let l=[],c=je(xe(n,"rStyle"))??e.defaultCharacterStyleId??void 0;for(let g of Dn(e,c,"character")){let m=xe(g,"rPr");m&&l.push(m);}let u=[...o,...a,...i,...l];return n&&u.push(n),{all:u,defaults:o,tableLevel:a,paragraphLevel:i,characterLevel:l,direct:n}}function Jt(e,t){let n=null;for(let r of e){let o=xe(r,t);o&&(n=o);}return n}function nt(e,t,n){let r;for(let o of e){let a=xe(o,t);if(!a)continue;let i=Ce(a,n,da$1);i!==void 0&&(r=i);}return r}function hs(e){return !(e==="0"||e==="false"||e==="off")}function Tr(e,t){let n=false;for(let r of e){let o=xe(r,t);o&&(n=hs(je(o)));}return n}function Xn(e,t){let n;for(let r of e){let o=xe(r,t);o&&(n=hs(je(o)));}return n}function cn(e,t){let n=e.direct?xe(e.direct,t):null;if(n)return hs(je(n));let r=Xn(e.tableLevel,t),o=Xn(e.paragraphLevel,t),a=Xn(e.characterLevel,t);return a===false||a===void 0&&o===false||a===void 0&&o===void 0&&r===false?false:Xn(e.defaults,t)===true?true:r===true!=(o===true)!=(a===true)}function Fc(e,t){let n=e.direct?xe(e.direct,t):null;if(n)return hs(je(n));let r=Xn(e.characterLevel,t);if(r!==void 0)return r;let o=Xn(e.paragraphLevel,t);if(o!==void 0)return o;let a=Xn(e.tableLevel,t);return a!==void 0?a:Xn(e.defaults,t)===true}function C0(e){return e.isLgl?"decimal":e.numFmt}function R0(e){let t=id$2(e),n=new Map,r=new Map,o=new Map,a=new Map,i=new Map,s=new Map;for(let[l,c]of t.abstractNums){c.numStyleLink!==void 0&&s.set(l,c.numStyleLink);let u=new Map,g=new Map;for(let[m,y]of c.levels)u.set(String(m),C0(y)),g.set(String(m),y.start);r.set(l,u),o.set(l,g);}for(let[l,c]of t.nums){n.set(l,c.abstractNumId);for(let[u,g]of c.overrides){let m=`${l}:${u}`,y=g.startOverride??g.level?.start;y!==void 0&&a.set(m,y),g.level!==void 0&&i.set(m,C0(g.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:a,formatOverrides:i,styleLinks:s}}function E0(e,t){if(e===null)return null;let n=Ce(e,t,da$1);if(n===void 0||!/^-?\d{1,9}$/.test(n))return null;let r=Number.parseInt(n,10);return Number.isSafeInteger(r)?r:null}function O0(e,t){if(e===null)return null;let n=Ce(e,t,da$1);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function F0(e){return `${Math.round(e/20*100)/100}pt`}var aP=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function uo(e,t,n){if(e===null)return null;let r=Ce(e,t,da$1);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Ce(e,"val",da$1);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function Oc(e,t){let n=new Map,r=new Set(aP);for(let o of e)for(let a of o.children){if(a.kind==="textValue"||a.localName!=="tblStylePr"||a.namespaceUri!==da$1)continue;let i=Ce(a,"type",da$1);i===void 0||!r.has(i)||n.set(i,{fill:O0(xe(xe(a,"tcPr"),"shd"),"fill"),rPr:xe(a,"rPr"),pPr:xe(a,"pPr")});}return {byType:n,firstRowEnabled:uo(t,"firstRow",32)??false,lastRowEnabled:uo(t,"lastRow",64)??false,firstColumnEnabled:uo(t,"firstColumn",128)??false,lastColumnEnabled:uo(t,"lastColumn",256)??false,hBandingEnabled:!(uo(t,"noHBand",512)??false),vBandingEnabled:!(uo(t,"noVBand",1024)??false)}}function Ac(e,t,n,r,o,a){let i=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,c=e.lastColumnEnabled&&o,u=g=>e.byType.get(g)??null;if(s&&l&&u("swCell"))return u("swCell");if(s&&c&&u("seCell"))return u("seCell");if(i&&l&&u("nwCell"))return u("nwCell");if(i&&c&&u("neCell"))return u("neCell");if(s&&u("lastRow"))return u("lastRow");if(i&&u("firstRow"))return u("firstRow");if(c&&u("lastCol"))return u("lastCol");if(l&&u("firstCol"))return u("firstCol");if(e.hBandingEnabled){let g=t-(e.firstRowEnabled?1:0);if(g>=0){let m=u(g%2===0?"band1Horz":"band2Horz");if(m)return m}}if(e.vBandingEnabled){let g=a-(e.firstColumnEnabled?1:0);if(g>=0){let m=u(g%2===0?"band1Vert":"band2Vert");if(m)return m}}return null}function A0(e,t,n,r,o,a,i,s){let l=[],c=xe(e,"tcBorders"),u={top:n===0?"top":"insideH",bottom:n+o>=r?"bottom":"insideH",left:a?"left":"insideV",right:i?"right":"insideV"};for(let k of ["top","left","bottom","right"]){let O=xe(c,k),D=O!==null?br(O):br(xe(t,u[k]));D&&l.push(`border-${k}:${D}`);}let g=O0(xe(e,"shd"),"fill")??s;g&&l.push(`background-color:${g}`);let m=xe(e,"vAlign"),y=m===null?void 0:Ce(m,"val",da$1);y==="center"?l.push("vertical-align:middle"):(y==="bottom"||y==="top")&&l.push(`vertical-align:${y}`);let v=xe(e,"tcW"),w=E0(v,"w"),b=v===null?void 0:Ce(v,"type",da$1);w!==null&&w>0&&(b===void 0||b==="dxa")&&l.push(`width:${F0(w)}`);let S=xe(e,"tcMar");for(let k of ["top","right","bottom","left"]){let O=xe(S,k),D=E0(O,"w"),L=O===null?void 0:Ce(O,"type",da$1);D!==null&&D>=0&&L==="dxa"&&l.push(`padding-${k}:${F0(D)}`);}return l.join(";")}function iP(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===da$1}function M0(e){return e.localName==="customXml"&&e.namespaceUri===da$1}function L0(e){let t=[],n=[],r=o=>{for(let a of o)if(Me(a)){if(a.kind==="tableRow"||a.localName==="tr"&&a.namespaceUri===da$1){n.push({row:t.length}),t.push(a);continue}if(a.kind==="contentControl"){let i=a.children.find(s=>s.kind==="contentControlContent");i&&Me(i)&&r(i.children);continue}if(M0(a)){r(a.children);continue}n.push({skip:a});}};return r(e.children),{rows:t,tableItems:n}}function N0(e){let t=[],n=[];for(let r of e){let o=[],a=[],i=0,s=l=>{for(let c of l)if(Me(c)){if(iP(c)){let u=xe(c,"tcPr"),g=Math.min(Math.max(lt(je(xe(u,"gridSpan")))??1,1),63),m=xe(u,"vMerge"),y=m===null?null:je(m)==="restart"?"restart":"continue",v={cell:c,startColumn:i,span:g,vMerge:y};o.push(v),a.push({placement:v}),i+=g;continue}if(c.kind==="contentControl"){let u=c.children.find(g=>g.kind==="contentControlContent");u&&Me(u)&&s(u.children);continue}if(M0(c)){s(c.children);continue}a.push({skip:c});}};s(r.children),t.push(o),n.push(a);}return {placements:t,items:n}}function D0(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 H0(e,t,n,r){let o=new Map,a=t.byType.get("wholeTable")??null;for(let i=0;i<n.length;i+=1)for(let s of n[i]??[]){if(s.vMerge==="continue")continue;let l=Ac(t,i,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),c=[],u=[];a?.rPr&&c.push(a.rPr),a?.pPr&&u.push(a.pPr),l?.rPr&&c.push(l.rPr),l?.pPr&&u.push(l.pPr),o.set(s.cell,c.length>0||u.length>0?{...e,tableRPr:c,tablePPr:u}:e);}return o}function _0(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Me(n)?n:null,o=Dn(e.styles,je(xe(r,"tblStyle")),"table"),a=Oc(o,xe(r,"tblLook")),{rows:i}=L0(t),{placements:s}=N0(i);return H0(e,a,s,D0(s))}function B0(e,t,n,r){let o=t.children.find(L=>L.kind==="tableProperties"),a=o&&Me(o)?o:null,i=null,s=Dn(e.styles,je(xe(a,"tblStyle")),"table");for(let L of s){let p=xe(xe(L,"tblPr"),"tblBorders");p&&(i=p);}let l=xe(a,"tblBorders");l&&(i=l);let c=Oc(s,xe(a,"tblLook")),{rows:u,tableItems:g}=L0(t),{placements:m,items:y}=N0(u),v=D0(m),w=H0(e,c,m,v),b=["border-collapse:collapse"],S=xe(a,"tblW"),k=lt(Qt(S,"w",da$1));k!==null&&k>0&&Qt(S,"type",da$1)==="dxa"&&b.push(`width:${Sn(k)}`);let O=je(xe(a,"jc"));O==="center"?b.push("margin-left:auto","margin-right:auto"):O==="right"&&b.push("margin-left:auto","margin-right:0");for(let[L,p]of [["insideH","insideh"],["insideV","insidev"]]){let A=br(xe(i,L));A&&b.push(`mso-border-${p}-alt:${A}`);}let D=`<table style="${b.join(";")}">`;for(let L of g){if("skip"in L){r.advanceFieldState(L.skip,n);continue}let p=L.row,A=xe(xe(u[p]??null,"trPr"),"trHeight"),Z=lt(Qt(A,"val",da$1)),T=Ym(Z,Qt(A,"hRule",da$1)),P=T===""?"":` style="${T}"`;D+=`<tr${P}>`;for(let N of y[p]??[]){if("skip"in N){r.advanceFieldState(N.skip,n);continue}let _=N.placement;if(_.vMerge==="continue"){r.advanceFieldState(_.cell,n);continue}let M=1;if(_.vMerge==="restart")for(let z=p+1;z<m.length&&m[z].find(Q=>Q.startColumn===_.startColumn&&Q.vMerge==="continue");z+=1)M+=1;let $=xe(_.cell,"tcPr"),E=_.startColumn+_.span>=v,G=Ac(c,p,m.length,_.startColumn===0,E,_.startColumn),le=c.byType.get("wholeTable")??null,ne=A0($,i,p,m.length,M,_.startColumn===0,E,G?.fill??le?.fill??null),F=(_.span>1?` colspan="${_.span}"`:"")+(M>1?` rowspan="${M}"`:"")+(ne===""?"":` style="${xn(ne)}"`),j=w.get(_.cell)??e;D+=`<td${F}>${r.renderBlocks(j,_.cell.children,n)}</td>`;}D+="</tr>";}return `${D}</table>`}function ys(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 Mc(e){let t=Ce(e,"type",da$1);return t==="separator"||t==="continuationSeparator"}function Lc(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Me(r)||r.namespaceUri!==da$1||r.localName!==t||Mc(r))continue;let o=ys(Ce(r,"id",da$1));o!==null&&n.add(o);}return n}function Ma(e,t,n,r,o,a,i){for(let s of t.children)if(Me(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){Ma(e,s,n,r,o,a,_0(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===da$1&&s.localName==="tc"){let l=i?.get(s);if(l===void 0){r.inert||o(s,r);continue}Ma(l,s,n,r,o,a,i);continue}if(s.kind==="paragraph"){let l=s.children.find(c=>c.kind==="paragraphProperties");Ma(e,s,n,r,o,l&&Me(l)?l:null,i);continue}if(s.kind==="run"){if(s.children.some(u=>u.kind==="fldChar")){r.inert||o(s,r);continue}if(s.children.some(u=>u.kind==="instrText")||!r.inert&&r.stack.some(u=>u==="instr"))continue;let l=s.children.find(u=>u.kind==="runProperties"),c=gs(e.styles,a,l&&Me(l)?l:null,e.tableRPr);if(cn(c,"vanish"))continue}if(s.namespaceUri===da$1&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=ys(Ce(s,"id",da$1));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}Ma(e,s,n,r,o,a,i);}}function sP(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Me(r)||r.namespaceUri!==da$1)&&!(r.localName!==t||Mc(r))&&ys(Ce(r,"id",da$1))===n)return r;return null}function $0(e,t,n){let r={footnote:new Set(e.noteOrdinals.footnote.keys()),endnote:new Set(e.noteOrdinals.endnote.keys())},o=[];for(let a of ["footnote","endnote"])for(let i of r[a])o.push({kind:a,id:i});for(;o.length>0;){let a=o.pop(),i=sP(t[a.kind],a.kind,a.id);if(i===null)continue;let s={stack:[],inert:false};n(i,s);let l={stack:[],inert:s.stack.length>0},c=[];Ma(e,i,c,l,n,null);for(let u of c)e.availableNotes[u.kind].has(u.id)&&(r[u.kind].has(u.id)||(r[u.kind].add(u.id),o.push(u)));}return r}function Nc(e,t,n,r,o){if(n===null)return "";let a=`/word/${t}s.xml`;for(let[l,c]of e.pkg.parts)c.root===n&&(a=l);let i=gc$1(e.pkg,a),s="";for(let l of n.children){if(!Me(l)||l.namespaceUri!==da$1||l.localName!==t||Mc(l))continue;let c=Ce(l,"id",da$1),u=ys(c);if(c===void 0||u===null||!r.has(u))continue;let g=o({...e,noteBody:{kind:t,id:u},docRels:i},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${u}">${g===""?"<p></p>":g}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}var Dc="http://schemas.openxmlformats.org/officeDocument/2006/relationships",lP=`${Dc}/numbering`,dP=`${Dc}/footnotes`,cP=`${Dc}/endnotes`,uP=2*1024*1024,fP=8*1024*1024,q0=9525,pP=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 bs(e,t,n,r){let o=e.direct!==null&&xe(e.direct,r)!==null||Jt(e.defaults,r)!==null||Jt(e.tableLevel,r)!==null||Jt(e.paragraphLevel,r)!==null||Jt(e.characterLevel,r)!==null;return cn(e,t&&o?r:n)}function mP(e){let t=e.all;if(cn(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=Tr(t,"rtl"),o=(r?nt(t,"rFonts","cs"):void 0)??nt(t,"rFonts","ascii")??nt(t,"rFonts","hAnsi")??nt(t,"rFonts","eastAsia")??(r?void 0:nt(t,"rFonts","cs"));if(o!==void 0){let D=Wm(o);D&&n.push(`font-family:${D}`);}let a=lt((r?nt(t,"szCs","val"):void 0)??nt(t,"sz","val")??(r?void 0:nt(t,"szCs","val")));a!==null&&a>0&&n.push(`font-size:${Math.round(a/2*100)/100}pt`);let i={...e,direct:null},s=e.direct?t.slice(0,-1):t;bs(e,r,"b","bCs")?n.push("font-weight:bold"):bs(i,r,"b","bCs")&&n.push("font-weight:normal"),bs(e,r,"i","iCs")?n.push("font-style:italic"):bs(i,r,"i","iCs")&&n.push("font-style:normal");let l=[],c=Jt(t,"u"),u=c!==null&&je(c)!=="none";u&&l.push("underline");let g=Fc(e,"dstrike");if((cn(e,"strike")||g)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let D=Jt(s,"u");(D!==null&&je(D)!=="none"||cn(i,"strike")||Fc(i,"dstrike"))&&n.push("text-decoration:none");}u&&n.push(...Xm(c)),g&&!u&&n.push("text-decoration-style:double");let m=ms(nt(t,"color","val"));m&&n.push(`color:${m}`);let y=lt(nt(t,"spacing","val"));y!==null&&n.push(`letter-spacing:${Math.round(y/20*100)/100}pt`);let v=je(Jt(t,"highlight")),w=v!==void 0&&Object.hasOwn(nd,v)?nd[v]:void 0,b=ms(nt(t,"shd","fill"));w?n.push(`background-color:${w}`,`mso-highlight:${v}`):b&&n.push(`background-color:${b}`),cn(e,"caps")?n.push("text-transform:uppercase"):cn(i,"caps")&&n.push("text-transform:none"),cn(e,"smallCaps")?n.push("font-variant:small-caps"):cn(i,"smallCaps")&&n.push("font-variant:normal");let S=je(Jt(t,"vertAlign")),k=S==="superscript"||S==="subscript"?S:null,O=yr((r?nt(t,"lang","bidi"):void 0)??nt(t,"lang","val")??nt(t,"lang","bidi")??nt(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:k,lang:O,rtl:r}}function gP(e,t){let n=[],r=je(Jt(e,"jc")),o=r!==void 0&&Object.hasOwn(rd,r)?rd[r]:void 0;o&&n.push(`text-align:${o}`);let a=lt(nt(e,"spacing","before"));a!==null&&a>=0&&n.push(`margin-top:${Sn(a)}`);let i=lt(nt(e,"spacing","after"));i!==null&&i>=0&&n.push(`margin-bottom:${Sn(i)}`);let s=lt(nt(e,"spacing","line")),l=nt(e,"spacing","lineRule");n.push(...Gm(s,l));let c=null,u=null,g=null,m=null;for(let b of e){let S=xe(b,"ind");if(!S)continue;let k=lt(Qt(S,"left",da$1)??Qt(S,"start",da$1));k!==null&&(c=k);let O=lt(Qt(S,"right",da$1)??Qt(S,"end",da$1));O!==null&&(u=O);let D=lt(Qt(S,"hanging",da$1)),L=lt(Qt(S,"firstLine",da$1));D!==null?(g=D,m=null):L!==null&&(m=L,g=null);}!t&&c!==null&&n.push(`margin-left:${Sn(c)}`),u!==null&&n.push(`margin-right:${Sn(u)}`),g!==null&&g!==0?n.push(`text-indent:${Sn(-g)}`):m!==null&&m!==0&&n.push(`text-indent:${Sn(m)}`);let y=Jt(e,"tabs");if(y){let b=[];for(let S of y.children){if(!Me(S)||S.localName!=="tab")continue;let k=je(S),O=lt(Ce(S,"pos",da$1));if(O===null||O<0||k!=="left"&&k!=="center"&&k!=="right"&&k!=="decimal"&&k!=="bar")continue;let D=je(S,"leader"),L=D==="dot"?"dotted":D==="hyphen"?"dashed":D==="underscore"?"lined":D==="middleDot"?"middledot":D==="heavy"?"heavy":"";b.push(`${k}${L?` ${L}`:""} ${Sn(O)}`);}b.length>0&&n.push(`tab-stops:${b.join(" ")}`);}Tr(e,"pageBreakBefore")&&n.push("page-break-before:always"),Tr(e,"keepNext")&&n.push("page-break-after:avoid"),Tr(e,"keepLines")&&n.push("page-break-inside:avoid"),Tr(e,"widowControl")&&n.push("widows:2","orphans:2");let v=ms(nt(e,"shd","fill"));v&&n.push(`background-color:${v}`);let w=Jt(e,"pBdr");if(w)for(let b of ["top","left","bottom","right"]){let S=br(xe(w,b));S&&n.push(`border-${b}:${S}`,`mso-border-${b}-alt:${S}`);}return n.join(";")}function hP(e,t,n){let r=e.noteOrdinals[t],o=r.get(n);if(o!==void 0)return o;let a=r.size+1;return r.set(n,a),a}var Z0={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function V0(e,t,n,r){let o=e.numbering.formatOverrides.get(`${t}:${r}`)??e.numbering.levelFormats.get(n)?.get(String(r))??"decimal",a=e.numbering.startOverrides.get(`${t}:${r}`)??e.numbering.levelStarts.get(n)?.get(String(r))??1;return {fmt:o,start:a}}function yP(e,t){let n,r;for(let s of t){let l=xe(s,"numPr");if(!l)continue;let c=je(xe(l,"numId"));c!==void 0&&(n=c);let u=je(xe(l,"ilvl"));u!==void 0&&(r=u);}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),u=je(xe(xe(xe(c??null,"pPr"),"numPr"),"numId")),g=u===void 0?void 0:e.numbering.numToAbstract.get(u);if(g===void 0||g===o)break;o=g;}let a=Math.min(Math.max(lt(r)??0,0),8),i=V0(e,n,o,a);return {numId:n,abstractId:o,level:a,fmt:i.fmt,start:i.start}}function bP(e,t){let n=B(e.pkg.contentTypes,t);if(n.ok){let a=pP.get(n.contentType.toLowerCase());if(a!==void 0)return a}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 vP(e,t){let n=co(t,"inline",ia$1)??co(t,"anchor",ia$1);if(!n)return "";let r=co(n,"blip",ha$1);if(!r)return "";let o=Ce(r,"embed",ja$1);if(!o)return "";let a=e.docRels.find(w=>w.id===o&&w.targetMode!=="External");if(!a)return "";let i=w(a.ownerPart,a.rawTarget);if(!i.ok)return "";let s=e.pkg.partBytes.get(i.partName.replace(/^\//,""))??e.pkg.partBytes.get(i.partName);if(!s)return "";let l=bP(e,i.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(i.partName);c==null&&(c=`data:${l};base64,${Ni(s)}`,e.imageDataUris.set(i.partName,c));let u=co(n,"extent",ia$1),g=u?lt(Ce(u,"cx","")):null,m=u?lt(Ce(u,"cy","")):null,y=w=>Math.round(w/12700*100)/100,v=g!==null&&m!==null&&g>0&&m>0?` width="${Math.round(g/q0)}" height="${Math.round(m/q0)}" style="width:${y(g)}pt;height:${y(m)}pt"`:"";return `<img src="${c}"${v}>`}function Cr(e,t,n=0){if(n>=la$1)return;let r=de(e)?n+1:ma(e,n);for(let o of e.children)if(Me(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let a=o.children.find(i=>i.kind==="contentControlContent");a&&Me(a)&&Cr(a,t,r+1);continue}if(o.kind==="fldChar"){K0(o,t);continue}Cr(o,t,r);}}function K0(e,t){let n=Ce(e,"fldCharType",da$1);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 xP(e,t,n,r){let o=t.children.find(c=>c.kind==="runProperties"),a=gs(e.styles,n,o&&Me(o)?o:null,e.tableRPr),i=mP(a),s="";for(let c of t.children){if(!Me(c))continue;if(c.kind==="fldChar"){r.inert||K0(c,r);continue}if(c.kind==="instrText"||!r.inert&&r.stack.some(m=>m==="instr")||i.vanish)continue;let u=Jm(c);if(u!==""){s+=u;continue}let g=Qm(c,e.noteBody,(m,y)=>hP(e,m,y),(m,y)=>e.availableNotes[m].has(y));if(g!==""){s+=g;continue}switch(c.kind){case "text":s+=Rc(Cc(c));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let m=Ce(c,"type",da$1);s+=m==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let m=ln(Ce(c,"name",da$1));m!==null&&(s+=`<a id="${xn(m)}"></a>`);break}case "drawing":s+=vP(e,c);break;}}if(s==="")return "";i.vertAlign==="superscript"?s=`<sup>${s}</sup>`:i.vertAlign==="subscript"&&(s=`<sub>${s}</sub>`);let l=`${i.lang===null?"":` lang="${i.lang}"`}${i.rtl?' dir="rtl"':""}${i.css===""?"":` style="${xn(i.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function Pr(e,t,n,r,o=0){if(o>=la$1)return "";let a="";for(let i of t)if(Me(i))switch(de(i)?"fldSimple":i.kind){case "run":a+=xP(e,i,n,r);break;case "hyperlink":{let s=Pr(e,i.children,n,r,o+1);if(s==="")break;let l=Ce(i,"id",ja$1),c=l?e.docRels.find(m=>m.id===l):void 0,u=c===void 0?void 0:c.targetMode==="External"||c.rawTarget.startsWith("#")?c.rawTarget:void 0,g=Sg(u,Ce(i,"anchor",da$1));a+=g!==null?`<a href="${xn(g)}">${s}</a>`:s;break}case "bookmarkStart":{let s=ln(Ce(i,"name",da$1));s!==null&&(a+=`<a id="${xn(s)}"></a>`);break}case "fldSimple":a+=Pr(e,i.children,n,r,o+1);break;case "contentControl":{let s=i.children.find(l=>l.kind==="contentControlContent");s&&Me(s)&&(a+=Pr(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":a+=Pr(e,i.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":Cr(i,r,o);break;case "generic":if(na$1(i))a+=Pr(e,i.children,n,r,o+1);else {let s=Ed$1(i);s&&(a+=Pr(e,s,n,r,o+1));}break}return a}function SP(e,t){let n=je(xe(t,"pStyle")),r=Dn(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let a=Ce(r[o],"styleId",da$1),i=a?/^Heading([1-6])$/.exec(a):null;if(i)return {level:Number(i[1]),fromStyle:true}}if(n===void 0){let o=lt(je(xe(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function IP(e,t){let n=Dn(e.styles,je(xe(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=Um(Ce(n[r],"styleId",da$1));if(o!==null)return o}return null}function z0(e,t,n,r){let o=t.children.find(b=>b.kind==="paragraphProperties"),a=o&&Me(o)?o:null,i=Ec(e.styles,a,e.tablePPr),s=gP(i,n.asListItem),l=Pr(e,t.children,a,r),c=s===""?"":` style="${xn(s)}"`,u=Tr(i,"bidi")?' dir="rtl"':"",g=IP(e,a),m=g===null?"":` class="${g}"`,y=SP(e,a);if(n.asListItem)return `<li${y?.fromStyle===true?` class="Heading${y.level}"`:m}${u}${c}>${l}</li>`;let v=y===null?"p":`h${y.level}`,w=y===null?m:y.fromStyle?` class="Heading${y.level}"`:' class="docx-outline"';return `<${v}${w}${u}${c}>${l}</${v}>`}var wP={renderBlocks:(e,t,n)=>vs(e,t,n),advanceFieldState:Cr};function vs(e,t,n){let r="",o=[],a=null,i=new Map,s=n;if(s===void 0){let m={stack:[]};for(let y of t)Me(y)&&Cr(y,m);s={stack:[],inert:m.stack.length>0};}let l=()=>{let m=o.pop();m&&(r+=`</${m.tag}>`);},c=()=>{for(;o.length>0;)l();a=null;},u=(m,y)=>{for(a!==null&&y.level<a&&c();o.length>0&&o[o.length-1].abstractId!==y.abstractId;)l();o.length===0&&(a=y.level);let v=a??y.level,w=y.level-v+1;for(;o.length>w;)l();for(o.length===w&&o[w-1].numId!==y.numId&&l();o.length<w;){let k=v+o.length,O=V0(e,y.numId,y.abstractId,k),D=i.get(`${y.abstractId}:${y.numId}:${k}`)??0,L=O.start+D,p=O.fmt==="bullet"?"ul":"ol",A=p==="ol"?Object.hasOwn(Z0,O.fmt)?Z0[O.fmt]:"decimal":null,Z=p==="ol"&&L!==1?` start="${L}"`:"";r+=A?`<${p}${Z} style="list-style-type:${xn(A)}">`:`<${p}>`,o.push({tag:p,numId:y.numId,abstractId:y.abstractId});}let b=`${y.abstractId}:${y.numId}:${y.level}`;i.set(b,(i.get(b)??0)+1);let S=`${y.abstractId}:`;for(let k of i.keys()){if(!k.startsWith(S))continue;let O=k.slice(k.lastIndexOf(":")+1);/^\d+$/.test(O)&&Number(O)>y.level&&i.delete(k);}r+=z0(e,m,{asListItem:true},s);},g=m=>{for(let y of m)if(Me(y))switch(y.kind){case "paragraph":{let v=y.children.find(S=>S.kind==="paragraphProperties"),w=v&&Me(v)?v:null,b=yP(e,Ec(e.styles,w));b?u(y,b):(c(),r+=z0(e,y,{asListItem:false},s));break}case "table":c(),r+=B0(e,y,s,wP);break;case "contentControl":{let v=y.children.find(w=>w.kind==="contentControlContent");v&&Me(v)&&g(v.children);break}case "generic":g(y.children);break;case "bookmarkStart":{let v=ln(Ce(y,"name",da$1));v!==null&&(r+=`<a id="${xn(v)}"></a>`);break}default:s.inert||Cr(y,s);break}};return g(t),c(),r}function j0(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Me(n.root))return "";let r=n.root.children.find(c=>c.kind==="body");if(!r||!Me(r))return "";let o=Aa(e,dP,"/word/footnotes.xml"),a=Aa(e,cP,"/word/endnotes.xml"),i={pkg:e,styles:P0(e),numbering:R0(Aa(e,lP,"/word/numbering.xml")),docRels:gc$1(e,e.mainDocumentPart),maxImageBytes:uP,maxTotalImageBytes:fP,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:Lc(o,"footnote"),endnote:Lc(a,"endnote")},noteBody:null},s=vs(i,r.children),l=$0(i,{footnote:o,endnote:a},Cr);return s+Nc(i,"footnote",o,l.footnote,vs)+Nc(i,"endnote",a,l.endnote,vs)}var kP=12*1024*1024;function TP(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function PP(e){return `<div><table>${e.split(`
|
|
18
|
+
`).map(n=>`<tr>${n.split(" ").map(r=>`<td>${TP(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function Hc(e){if(e.cellRectangle)return {text:e.text,html:PP(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=H$1(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null};let n=e.maxFragmentBytes??kP,r=t.bytes;if(t.bytes.byteLength>n){let i=H$1(e.pkg,e.coverage,{omitMedia:true});r=i.ok&&i.bytes.byteLength<=n?i.bytes:null;}let o;try{o=j0(t.package);}catch(i){console.error("docx-editor: copy HTML flavour failed to render",i),o="";}let a=jm(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:a}}function U0(e,t){let n=()=>t.text.length===0?"none":(e.insertPlainText(t.text),"plain");if(t.forcePlain||!e.richLaneOpen)return n();let r=t.html;if(r===null||r.length===0)return n();let o=Di(r);if(o&&e.pasteFragment(o.bytes,o.lastMarkCovered))return "fragment";let a=oh(r);return a.ok&&a.truncated&&t.text.length>0?n():a.ok&&e.pasteFragment(a.fragmentBytes,a.lastMarkCovered)?"external-html":n()}function W0(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!fh$1(e.settingsRoot()))return r;let a=at(e,t.paragraphId)??e.part();if(!gh$1(a,t.paragraphId))return r;let i=Ga(a,t.paragraphId);if(i?.kind!=="paragraph")return r;let s=Zg$1(i).find(b=>b.fieldNodeId===o&&b.start<=t.offset&&b.end>=n.offset);if(!s?.enabled||!Xg$1(s)||s.maxLength<=0)return r;let l=(Nh$1(a,t.paragraphId)??"").slice(s.start,s.end),c=l.slice(0,t.offset-s.start),u=l.slice(n.offset-s.start),g=c+u,m=b=>Yg$1(c+b+u,s,g)<=s.maxLength;if(m(r))return r;let y=[...r],v=s.maxLength-[...g].length;if(s.type==="number"&&s.format)for(let b of g)(b===","&&s.format.includes(",")||b==="%"&&s.format.endsWith("%"))&&v++;let w=new Set;if(s.type==="date"){let b=0;for(let S=0;S<y.length;S++)if(/\S/.test(y[S])){if(++b>18)break;w.add(S+1);}else (S+1===y.length||/\S/.test(y[S+1]))&&w.add(S+1);}else if(s.type==="number"&&s.format)for(let b=1;b<=3;b++)w.add(v+b);for(let b of [...w].sort((S,k)=>k-S)){if(b<=Math.max(0,v)||b>y.length)continue;let S=y.slice(0,b).join("");if(m(S))return S}return y.slice(0,Math.max(0,v)).join("")}var CP=2e3;function G0(e){let{session:t}=e,n=null;function r(s){let l=ch(s),c=e.orderedRange(),u=W0(t,c.from,c.to,l,e.textFormFieldId?.()??null).split(`
|
|
19
|
+
`),g=e.deleteSelectionPlan(),m=g.replaceAt??g.collapseTo,y=u.join(""),v=[...g.ops],w=e.consumePendingFormatOps(m.paragraphId,m.offset,y.length);y.length>0&&(v.push({op:"insertText",paragraphId:m.paragraphId,offset:m.offset,text:y}),v.push(...w));let b=[],S=0;for(let p=0;p<u.length-1;p+=1)S+=u[p].length,b.push(m.offset+S);if(b.length>0&&v.push({op:"splitParagraphMany",paragraphId:m.paragraphId,offsets:b}),v.length===0)return;let k=new Set(t.paragraphIdsIn(e.storyScope())),O=u[u.length-1],D=b.length===0?e.caretMark({paragraphId:m.paragraphId,offset:m.offset+O.length}):void 0,L=v.filter(p=>!w.includes(p));e.commit(()=>e.withoutPendingOnRejection(v,L,e.selectionMark(),D),()=>{if(b.length===0)return _e({paragraphId:m.paragraphId,offset:m.offset+O.length});let p=t.paragraphIdsIn(e.storyScope()).filter(Z=>!k.has(Z)),A=p[p.length-1];return A?_e({paragraphId:A,offset:O.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection();if(s)return Hc({text:xf$1(e.layout(),s),cellRectangle:true,coverage:null,pkg:null});let{from:l,to:c}=e.orderedRange(),u=fs(e.layout(),l,c,e.paragraphOrder()),g=e.storyScope();if(l.paragraphId===c.paragraphId&&l.offset===c.offset||g.kind!=="body")return {text:u,html:null};let y=t.part(),v=n0(e.layout(),y,l,c,e.paragraphOrder());return Hc({text:u,cellRectangle:false,coverage:v,pkg:t.currentPackage()})}function a(s,l){if(e.editingMode()!=="edit"||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let c=e.deleteSelectionPlan(),u=c.replaceAt??c.collapseTo,g=false;return e.commit(()=>{let m=e.collaborationGate(c.ops,{kind:"body"});if(m)return {committed:false,rejected:true,opCount:0,reason:m};let y=e.actorId(),v=t.applyFragmentPaste({kind:"body"},{paragraphId:u.paragraphId,offset:u.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:c.ops,...y!==void 0?{actorId:y}:{}});return g=v.ok,{committed:v.ok,rejected:!v.ok,opCount:v.ok?1:0,...v.ok?{}:{reason:v.detail??v.reason}}},()=>_e(u)),g}function i(s,l){let c=n!==null&&e.now()-n<CP;return n=null,U0({richLaneOpen:e.editingMode()==="edit"&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(g,m)=>a(g,m),insertPlainText:r},{html:l,text:s,forcePlain:c})!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:i,armForcePlainPaste:()=>{n=e.now();}}}function X0(e){let{session:t}=e;function n(){return wr(e.selection())}function r(){return e.flushPendingInputAndLayout(),us(e.layout(),e.selection(),e.paragraphOrder())}function o(){return r().from}function a(v){return nf(e.layout(),v)}function i(v,w){let b=t.partFor(e.storyScope())??t.part(),S=Ga(b,v.paragraphId);return !S||S.kind!=="paragraph"?null:w==="before"?Qe$1(S,v.offset):Re$1(S,v.offset)}function s(v){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let w=r();return w.from.paragraphId===w.to.paragraphId&&w.from.offset===w.to.offset?e.atParagraphEnd(v.paragraphId,v.offset):e.atParagraphEnd(w.to.paragraphId,w.to.offset)}function l(v){let w=v?.trim()||void 0,b=c(),S=e.cellSelection(),k=null;return {...b,get replaceAt(){return k??=m(b,w,S),k}}}function c(){e.flushPendingInputAndLayout();let v=e.cellSelection();if(v){let k=[];for(let O of uf(e.layout(),v.cellIds)){let D=nf(e.layout(),O).length;D>0&&k.push({op:"deleteText",paragraphId:O,start:0,end:D});}return {ops:k,collapseTo:o()}}let w=e.selection();if(w.anchor.paragraphId===w.head.paragraphId&&w.anchor.offset===w.head.offset)return {ops:[],collapseTo:ff(e.layout(),w.head)};let{from:b,to:S}=r();return r0(e.layout(),t.partFor(e.storyScope())??t.part(),b,S,e.paragraphOrder())}function u(){return l().ops}function g(v,w,b){if(!(b!==void 0||e.editingMode()==="suggest")||v.paragraphId!==w.paragraphId||w.offset<=v.offset)return v.offset;let k=(b??e.author())?.trim();if(!k)return ff(e.layout(),w).offset;let O=at(t,w.paragraphId)??t.part(),D=Ga(O,w.paragraphId);if(!D||D.kind!=="paragraph")return ff(e.layout(),w).offset;let L={start:v.offset,end:w.offset},{past:p,landing:A}=Uf(D,L,w.offset,k,e.trackedDate()),Z=Sf(D,v.offset,p,k);return (p-v.offset>Z?A:p)-Z}function m(v,w,b){let S=v.collapseTo;if(w===void 0&&e.editingMode()!=="suggest")return S;if(b){for(let $ of b.cellIds){let E=tf(e.layout(),[$]),G=E.length>0?E:uf(e.layout(),[$]);if(G.length===0)continue;let le=new Map,ne=X=>{let Q=le.get(X);return Q===void 0&&(Q=g({paragraphId:X,offset:0},{paragraphId:X,offset:a(X).length},w),le.set(X,Q)),Q},F=(w??e.author())?.trim(),j=X=>{let Q=a(X);if(!F)return /\S/.test(Q);let H=Ga(at(t,X)??t.part(),X);if(!H||H.kind!=="paragraph")return /\S/.test(Q);let J="",ee=0;for(let pe of Tf(H,0,Q.length,F))J+=Q.slice(ee,Math.max(ee,pe.start)),ee=Math.max(ee,pe.end);return J+=Q.slice(ee),/\S/.test(J)},z=null;for(let X=G.length-1;X>=0;X-=1){let Q=G[X];if(j(Q)){z=Q;break}}if(z===null)for(let X=G.length-1;X>=0;X-=1){let Q=G[X];if(ne(Q)!==0){z=Q;break}}return z??=G[G.length-1],{paragraphId:z,offset:ne(z)}}return S}let{from:k,to:O}=r();if(k.paragraphId===O.paragraphId&&k.offset===O.offset)return S;if(k.paragraphId===O.paragraphId)return {paragraphId:O.paragraphId,offset:g(k,O,w)};let D=new Set(v.ops.flatMap($=>$.op==="deleteBlock"?[$.blockId]:[])),L=at(t,O.paragraphId)??t.part();if(D.size>0)for(let $=Ha$1(L,O.paragraphId);$;$=Ha$1(L,$.id)){if(!D.has($.id))continue;let E={paragraphId:S.paragraphId,offset:a(S.paragraphId).length};return {paragraphId:S.paragraphId,offset:g(S,E,w)}}let p=(w??e.author())?.trim();if(!p)return S;let A=new Set(v.ops.flatMap($=>$.op==="joinParagraphs"?[$.secondId]:[])),Z=e.paragraphOrder(),T=Z.indexOf(k.paragraphId),P=Z.indexOf(O.paragraphId);if(T===-1||P===-1)return S;let N=$=>{let E=Ga(L,$);return E?.kind==="paragraph"&&Kh(E,p)},_=P;for(;_>T&&A.has(Z[_])&&N(Z[_-1]);)_-=1;let M=0;for(let $=_;$<=P;$+=1){let E=Z[$],G={paragraphId:E,offset:E===k.paragraphId?k.offset:0},le=E===O.paragraphId?ff(e.layout(),O):{paragraphId:E,offset:a(E).length};$===_&&(M+=G.offset),M+=le.offset-G.offset-y(G,le,p);}return {paragraphId:Z[_],offset:M}}function y(v,w,b){let S=b?.trim();if(!S||v.paragraphId!==w.paragraphId)return 0;let k=at(t,w.paragraphId)??t.partFor(e.storyScope())??t.part(),O=Ga(k,w.paragraphId);return !O||O.kind!=="paragraph"?0:Sf(O,v.offset,w.offset,S)}return {selectionMark:n,orderedRange:r,orderedStart:o,textOf:a,inlineControlBeside:i,splitEndsTheParagraph:s,deleteSelectionPlan:l,deleteSelectionOps:u,replacementOffset:g}}function Y0(e){return {atParagraphEnd(t,n){let r=Nh$1(e.partOf(t),t);return r!==null&&n===r.length},followerStyleId(t){let n=e.partOf(t),r=e.styleCascade();if(!r)return;let a=ja(n,t).find(l=>l.localName==="pStyle")?.attributes?.val??r.defaultParagraphStyleId;if(a==null)return;let i=r.styles.get(a)?.next;if(!i||i===a)return;let s=r.styles.get(i);if(!(!s||s.type!=="paragraph"))return i===r.defaultParagraphStyleId?null:i}}}var Q0=ld$1;function J0(e){let{session:t,...n}=e;return Zd$1({view:t,...n})}function Vt(e){return e.closest(".docx-editor__scroll-container")}function eb(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 tb(e,t,n){let r=Vt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=eb(e,r,n),a=o.top+o.height/2;for(let i of t.pages)if(a<i.box.y+i.box.height)return i.index+1;return t.pages.length}function nb(e,t,n,r){let o=Vt(e);if(!o||o.clientHeight===0)return;let a=eb(e,o,r),i=[];for(let s of [n.anchor,n.head]){let l=jf(t,s);l&&i.push(l.pageIndex);}return We({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function _c(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 xs(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,a=0;for(let s of o)a=Math.max(a,s.box.x+s.box.width);let i=new Map;if(new Set(o.map(s=>s.box.width)).size>1)for(let s of e.pages)i.set(s.index,(a-s.box.width)/2-s.box.x);return {width:a,height:r,pageOffsetX:i}}function rb(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 ab(e){if(typeof e.defaultView?.createImageBitmap!="function")return null;let t=e.defaultView;return Object.freeze({async decode(n,r,o){let a=new Blob([new Uint8Array(n)],{type:r}),i;try{i=await t.createImageBitmap(a,{imageOrientation:"from-image"});}catch(s){if(s?.name!=="TypeError")throw s;i=await t.createImageBitmap(a);}try{let s=i.width,l=i.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{i.close();}},convertPreserved(n,r,o){return r==="image/tiff"?FP(e,n,o):RP(n,r)}})}async function RP(e,t,n){let{convertEmfToDataUrl:r,convertWmfToDataUrl:o}=await import('emf-converter'),a=new Uint8Array(e),i=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),s={maxWidth:4096,maxHeight:4096},l=t==="image/x-emf"?await r(i,s):await o(i,s);if(!l)return null;let c="data:image/png;base64,";if(!l.startsWith(c))return null;let u=atob(l.slice(c.length)),g=new Uint8Array(u.length);for(let m=0;m<u.length;m+=1)g[m]=u.charCodeAt(m);return Object.freeze({bytes:g,mime:"image/png"})}function ob(e,t){let n=e[t];if(!Array.isArray(n)||n.length===0)return null;let r=Number(n[0]);return Number.isSafeInteger(r)&&r>0?r:null}async function EP(e,t){let n=await import('utif2'),r=n.default??n,o=e.slice().buffer,a=r.decode(o)[0];if(!a)return null;let i=ob(a,"t256"),s=ob(a,"t257");if(i===null||s===null||i>t.maxDimension||s>t.maxDimension||i>t.maxPixels/s)return null;let l=i*s;if(l*4>t.maxDecodedBytes||(r.decodeImage(o,a),a.width!==i||a.height!==s))return null;let c=r.toRGBA8(a);return c.length!==l*4?null:Object.freeze({rgba:c,pixelWidth:i,pixelHeight:s})}async function FP(e,t,n){let r=await EP(t,n);if(r===null)return null;let o=await OP(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function OP(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 a=o.getContext("2d");if(!a)return null;let i=a.createImageData(n,r);i.data.set(t),a.putImageData(i,0,0);let s=await new Promise(l=>{o.toBlob(c=>l(c),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function ib(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function sb(e){return typeof URL.createObjectURL!="function"||typeof URL.revokeObjectURL!="function"?null:Object.freeze({create(t,n){let r=e.mintValidatedBytes(t,t.contentId);if(!r)throw new Error(`PaintImageUrlSource: validated bytes unavailable for ${t.resourceKey}`);let o=new Uint8Array(r);return URL.createObjectURL(new Blob([o],{type:n}))},revoke(t){URL.revokeObjectURL(t);}})}var AP="docx-editor-one-surface__caret",Bc="docx-editor-one-surface__caret--steady",MP=530;function lb(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=AP,o.dataset.docxCaret="",o.dataset.docxMarker="",o.setAttribute("contenteditable","false"),o.setAttribute("aria-hidden","true"),o.dataset.noColorInvert="",o.style.position="absolute",o.style.pointerEvents="none",o.style.userSelect="none",o.style.setProperty("-webkit-user-select","none");let a=false,i=null,s=null,l=null;function c(){let k=r.activeElement;return k===e||!!k&&e.contains(k)}function u(k){return k.anchor.paragraphId===k.head.paragraphId&&k.anchor.offset===k.head.offset}function g(){s=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(Bc),o.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function m(){o.classList.add(Bc),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(Bc);},MP);}function y(){if(a||!c()||n().suppress){g();return}let{layout:k,selection:O,scopedHost:D,scopedHostKind:L,preferredPageIndex:p,measurer:A}=n(),Z=t();if(!u(O)){g();return}let T=jf(k,O.head,{...A?{measurer:A}:{},...p!==void 0?{preferredPageIndex:p}:{}});if(!T||!Number.isInteger(T.pageIndex)){g();return}let P=D??e.querySelector(`[data-page-index="${T.pageIndex}"] > .docx-page-content`);if(!P){g();return}if(!(T.height>0)){g();return}o.style.left=`${T.x*Z}px`,o.style.top=`${T.y*Z}px`,o.style.height=`${T.height*Z}px`;let N=zd$1(T);o.style.transformOrigin=N?"0 0":"",o.style.transform=N?"rotate(-90deg)":"",o.parentNode!==P&&P.append(o),e.style.caretColor="transparent",l&&l!==D&&l.style.removeProperty("caret-color"),l=D??null,l?.style.setProperty("caret-color","transparent");let _=P===D?L??"scoped":"body",M=`${T.pageIndex}:${_}:${T.x}:${T.y}:${T.height}`;M!==s&&(s=M,m());}let v=()=>{a=true,y();},w=()=>{a=false,y();},b=()=>y(),S=k=>{let O=k.relatedTarget;O&&e.contains(O)||g();};return e.addEventListener("compositionstart",v),e.addEventListener("compositionend",w),e.addEventListener("focusin",b),e.addEventListener("focusout",S),{update:y,destroy(){e.removeEventListener("compositionstart",v),e.removeEventListener("compositionend",w),e.removeEventListener("focusin",b),e.removeEventListener("focusout",S),g();}}}function $c(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function Rr(e,t){let n=$c(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function qc(e,t){return !e||e.kind==="tableBody"?null:$c(e.tableId)===$c(t)?e:null}function La(e,t,n){let r=i=>{for(let s of i)if(s.kind==="table"){if(s.tableId===t)return s;for(let l of s.rows)for(let c of l.cells){let u=r(c.blocks);if(u)return u}}return null},o=e.pages[n];if(!o)return null;let a=r(o.fragments);if(a)return {table:a,origin:o.contentBox};for(let i of [o.header,o.footer]){if(!i)continue;let s=r(i.fragments);if(s)return {table:s,origin:i.box}}return null}function Zc(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)Zc(o.blocks,t);}}function LP(e,t){for(let n of e.pages){let r=o=>{for(let a=0;a<o.rows.length;a+=1)t({table:o,row:o.rows[a],rowIndex:a});};Zc(n.fragments,r);for(let o of [n.header,n.footer])o&&Zc(o.fragments,r);}}function zc(e,t,n,r){let o=null;return LP(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Vc(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function db(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function cb(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function ub(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var NP=120,fb=20;function Ss(e){let t=ph$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function DP(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Kc(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function jc(e,t){return t.kind==="insertColumn"?zc(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?zc(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function pb(e){let t=e.furnitureLayer;t.className="docx-table-furniture",t.setAttribute("contenteditable","false"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.pointerEvents="none";let n=null,r=null,o=null,a=null,i=null,s=null,l=false,c=0,u=0,g=null,m=null,y=null;function v(R){return R instanceof HTMLButtonElement&&(R.classList.contains("docx-table-insert-row")||R.classList.contains("docx-table-insert-column"))}function w(){let R=document.activeElement;return R!==null&&v(R)&&R.closest(".docx-table-furniture")===t?R:null}function b(R){for(let K of [...t.children])v(K)&&K!==R&&K.remove();}function S(){m=null,y=null;}function k(){n!==null&&(clearTimeout(n),n=null);}function O(){for(let K of [...t.children])v(K)||K.remove();let R=w();if(!R){b(null),S();return}m=R,b(R);}function D(R){let K=m??w(),U=K!==null&&document.activeElement===K;S(),t.replaceChildren(),R&&U&&e.pagesLayer.focus({preventScroll:true});}function L(){for(let R of [...t.children])v(R)||R.remove();}function p(R,K,U,de){let ce=e.read().layout.pages[R];if(!ce)return {left:0,top:0};let re=de??ce.contentBox,ye=e.scale(),we=e.pageOffsetX(R);return {left:(re.x+K+we)*ye,top:(re.y+U)*ye}}function A(R,K){let U=e.read(),de=La(U.layout,K.tableId,K.pageIndex);if(!de)return;let{table:Ie,origin:ce}=de,re=document.createElement("div");re.className="docx-table-resize-preview",re.style.position="absolute",re.style.pointerEvents="none";let ye=K.kind!=="rowDivider",we=p(K.pageIndex,ye?Ie.box.x+R:Ie.box.x,ye?Ie.box.y:Ie.box.y+R,ce);re.style.left=`${we.left}px`,re.style.top=`${we.top}px`,re.style.width=ye?"2px":`${Ie.box.width*e.scale()}px`,re.style.height=ye?`${Ie.box.height*e.scale()}px`:"2px",t.append(re);}function Z(){let R=document.createElement("button");return R.type="button",R.textContent="+",R.style.position="absolute",R.style.pointerEvents="auto",R}function T(R){M(R);let K=y;if(!K)return;let U=e.read();K.kind==="insertRow"?E(K,U):K.kind==="insertColumn"&&G(K,U);}function P(){queueMicrotask(()=>{!m||document.activeElement===m||l||r?.kind==="insertRow"||r?.kind==="insertColumn"||(m.remove(),S());});}function N(){if(m&&t.contains(m))return m;let R=w();if(R)return m=R,R;let K=Z();return K.addEventListener("pointerenter",()=>{l=true,k();}),K.addEventListener("pointerleave",()=>{l=false;}),K.addEventListener("pointerdown",M),K.addEventListener("mousedown",M),K.addEventListener("click",T),K.addEventListener("blur",P),m=K,K}function _(R,K){let U=La(K.layout,R.tableId,R.pageIndex);if(!U)return;let{table:de,origin:Ie}=U,ce=N();if(b(ce),y=R,ce.dataset.tableId=R.tableId,R.kind==="insertRow"){let re=de.rows.find(ue=>ue.id===R.rowId);if(!re)return;ce.dataset.rowId=R.rowId,delete ce.dataset.gridColumnId,ce.className="docx-table-insert-row",ce.setAttribute("aria-label",e.label("table.insertRowBelow"));let ye=re.box.y+re.box.height/2,we=p(R.pageIndex,de.box.x-14,ye,Ie);ce.style.left=`${we.left}px`,ce.style.top=`${we.top-8}px`;}else {let re=de.rows[0]?.cells.find(Be=>Be.gridColumnId===R.gridColumnId);if(!re)return;ce.dataset.gridColumnId=R.gridColumnId,delete ce.dataset.rowId;let ye=de.columnEdges[re.gridColumn]??0,we=de.columnEdges[re.gridColumn+1]??de.box.width;ce.className="docx-table-insert-column",ce.setAttribute("aria-label",e.label("table.insertColumnRight"));let ue=p(R.pageIndex,de.box.x+(ye+we)/2-8,de.box.y-14,Ie);ce.style.left=`${ue.left}px`,ce.style.top=`${ue.top}px`;}t.contains(ce)||t.append(ce);}function M(R){R.preventDefault(),R.stopPropagation();}function $(R,K){if(L(),b(m??w()),!(s||K.editingMode==="view")){if((R.kind==="columnDivider"||R.kind==="rightEdge")&&!R.isHeaderRepeat){let U=La(K.layout,R.tableId,R.pageIndex);if(!U)return;let{table:de,origin:Ie}=U,ce=document.createElement("div");ce.className=R.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",ce.style.position="absolute",ce.style.pointerEvents="auto",ce.style.cursor="col-resize",ce.dataset.active="true";let re=p(R.pageIndex,de.box.x+R.edgeX,de.box.y,Ie);ce.style.left=`${re.left-3}px`,ce.style.top=`${re.top}px`,ce.style.width="6px",ce.style.height=`${de.box.height*e.scale()}px`,ce.addEventListener("pointerdown",le),t.append(ce);}if(R.kind==="rowDivider"&&!R.isHeaderRepeat){let U=La(K.layout,R.tableId,R.pageIndex);if(!U)return;let{table:de,origin:Ie}=U,ce=document.createElement("div");ce.className="docx-table-row-divider-handle layout-table-row-resize-handle",ce.style.position="absolute",ce.style.pointerEvents="auto",ce.style.cursor="row-resize",ce.dataset.active="true";let re=p(R.pageIndex,de.box.x,de.box.y+R.edgeY,Ie);ce.style.left=`${re.left}px`,ce.style.top=`${re.top-3}px`,ce.style.width=`${de.box.width*e.scale()}px`,ce.style.height="6px",ce.addEventListener("pointerdown",le),t.append(ce);}R.kind==="insertRow"&&!R.isHeaderRepeat&&_(R,K),R.kind==="insertColumn"&&!R.isHeaderRepeat&&_(R,K);}}function E(R,K){let U=jc(K.layout,R);if(!U)return;let de=Kc(K),Ie=Nn({command:{type:"insertRow",where:"below",target:Vc(R.sourceRevision,U)},part:Rr(e.session(),R.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...de});e.applyTableCommandPlan(Ie);}function G(R,K){let U=jc(K.layout,R);if(!U)return;let de=U.row.cells.find(ye=>ye.gridColumnId===R.gridColumnId);if(!de)return;let Ie=db(R.sourceRevision,U,de);if(!Ie)return;let ce=Kc(K),re=Nn({command:{type:"insertColumn",where:"right",target:Ie},part:Rr(e.session(),R.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...ce});e.applyTableCommandPlan(re);}function le(R){if(R.button!==0)return;let K=e.read();if(K.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;R.preventDefault(),R.stopPropagation();let U=r,de=jc(K.layout,U);if(!de)return;let Ie=qh$1(Rr(e.session(),U.tableId).root,U.tableId);if(!Ie.ok||U.kind!=="rowDivider"&&Ie.topology.hasMerge)return;let ce=0,re=0,ye=0,we=Ie.topology.gridColumns.reduce((ke,Fe)=>ke+Ss(Fe),0),ue;if(U.kind==="columnDivider"){let ke=Ie.topology.gridColumns.find(Oe=>Oe.id===U.leftGridColumnId),Fe=Ie.topology.gridColumns.find(Oe=>Oe.id===U.rightGridColumnId);if(!ke||!Fe)return;ce=Ss(ke),re=Ss(Fe),ue=cb(U.sourceRevision,de,U.leftGridColumnId,U.rightGridColumnId);}else if(U.kind==="rightEdge"){let ke=Ie.topology.gridColumns.find(Fe=>Fe.id===U.gridColumnId);if(!ke)return;ce=Ss(ke),re=0,ue=ub(U.sourceRevision,de,U.gridColumnId);}else ye=Math.max(20,Math.round(de.row.box.height*fb)),ue=Vc(U.sourceRevision,de);let Be=R.currentTarget;Be.setPointerCapture(R.pointerId),c=R.clientX,u=R.clientY,s={pointerId:R.pointerId,startClientX:R.clientX,startClientY:R.clientY,startEdgePt:U.kind==="rowDivider"?U.edgeY:U.edgeX,leftTwips:ce,rightTwips:re,tableWidthTwips:we,rowHeightTwips:ye,target:U,ref:de,resizeTarget:ue,captureElement:Be,rightEdge:U.kind==="rightEdge",vertical:U.kind==="rowDivider",cancelled:false};for(let ke of [...t.children])ke!==Be&&ke.remove();A(U.kind==="rowDivider"?U.edgeY:U.edgeX,U);}function ne(){if(s){try{s.captureElement.hasPointerCapture(s.pointerId)&&s.captureElement.releasePointerCapture(s.pointerId);}catch{}s.cancelled=true,s=null,O(),r=null;}}function F(){if(!s||s.cancelled){s=null,O();return}let R=s;s=null;try{R.captureElement.hasPointerCapture(R.pointerId)&&R.captureElement.releasePointerCapture(R.pointerId);}catch{}if(R.vertical?u===R.startClientY:c===R.startClientX){O();return}let K=e.read(),U=Kc(K),de=(R.vertical?u-R.startClientY:c-R.startClientX)/e.scale(),Ie=Math.round(de*fb),ce;if(R.target.kind==="rowDivider")ce=$h({part:Rr(e.session(),R.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...U},R.resizeTarget,Math.max(20,R.rowHeightTwips+Ie));else if(R.rightEdge&&R.target.kind==="rightEdge"){let re=Math.max(300,R.leftTwips+Ie),ye=Math.max(re,R.tableWidthTwips+Ie);ce=Nn({command:{type:"commitTableRightEdgeResize",target:R.resizeTarget,columnWidthTwips:re,tableWidthTwips:ye},part:Rr(e.session(),R.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...U});}else if(R.target.kind==="columnDivider"){let re=R.leftTwips+Ie,ye=R.rightTwips-Ie;re=Math.max(300,re),ye=Math.max(300,ye);let we=R.leftTwips+R.rightTwips;re+ye!==we&&(re>we-300?(re=we-300,ye=300):ye=we-re),ce=Nn({command:{type:"commitTableColumnDividerResize",target:R.resizeTarget,leftWidthTwips:re,rightWidthTwips:ye},part:Rr(e.session(),R.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...U});}else {O();return}e.applyTableCommandPlan(ce),O();}function j(R){if(!o||!g)return null;let K=e.pageOffsetX(g.pageIndex);return Td$1(o,g.x,g.y,R.layout,K,g.pageIndex)}function z(R){if(!r||s||R.editingMode==="view")return;k();let K=j(R),U=qc(K,R.selection.head.paragraphId);if(!U){r=null,O();return}if(Rd$1(U)!==Rd$1(r)){r=null,O();return}r=U,$(U,R);}function X(){let R=m??w(),K=R!==null&&document.activeElement===R;S(),R&&t.contains(R)&&R.remove(),K&&e.pagesLayer.focus({preventScroll:true});}function Q(R){if(s||R.editingMode==="view")return;let K=m??w();if(!K||!t.contains(K)){y&&S();return}if(m=K,!y||y.kind!=="insertRow"&&y.kind!=="insertColumn")return;if(!o){X();return}let U=Rd$1(y),de=Sd$1(o,y);if(!de||Rd$1(de)!==U){X();return}y=de,_(de,R);}function H(R){let K=e.read();if(s&&R.pointerId===s.pointerId){c=R.clientX,u=R.clientY;let ye=(s.vertical?R.clientY-s.startClientY:R.clientX-s.startClientX)/e.scale();for(let we of [...t.children])we!==s.captureElement&&we.remove();A(s.startEdgePt+ye,s.target);return}if(K.editingMode==="view"){D(false);return}let U=DP(e,R.clientX,R.clientY),de=Fd$1(K.layout,U.y);de>=0&&(g={x:U.x,y:U.y,pageIndex:de});let Ie=de>=0?e.pageOffsetX(de):0,ce=o?Td$1(o,U.x,U.y,K.layout,Ie,de>=0?de:void 0):null,re=qc(ce,K.selection.head.paragraphId);if(!re){if(l)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,O();},NP));return}n&&(clearTimeout(n),n=null),!(r&&Qd$1(re)===Qd$1(r))&&(r=re,$(re,K));}function J(R){if(!(!s||R.pointerId!==s.pointerId)){if(e.read().editingMode==="view"){ne();return}F();}}function ee(R){!s||R.pointerId!==s.pointerId||ne();}function pe(R){R.key!=="Escape"||!s||ne();}return e.pagesLayer.addEventListener("pointermove",H),document.addEventListener("pointermove",H),document.addEventListener("pointerup",J),document.addEventListener("pointercancel",ee),e.pagesLayer.addEventListener("keydown",pe),{update(){let R=e.read(),K=a,U=i;o=Pd$1(R.layout),a=R.layout.revision,i=R.storeRevision,R.editingMode==="view"?(ne(),r=null,k(),D(true)):K!==null&&(K!==R.layout.revision||U!==R.storeRevision)&&(r!==null&&z(R),Q(R)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let R=e.read();if(R.editingMode==="view")return;let K=m??w();if(K&&t.contains(K)&&y&&(y.kind==="insertRow"||y.kind==="insertColumn")){_(y,R);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&_(r,R);},destroy(){k(),ne(),S(),O(),e.pagesLayer.removeEventListener("pointermove",H),document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",J),document.removeEventListener("pointercancel",ee),e.pagesLayer.removeEventListener("keydown",pe),t.remove();}}}function Uc(e,t){let n=(r,o)=>{for(let a of r){if(a.kind==="paragraph"){t(a,o);continue}for(let i of a.rows)if(!i.isHeaderRepeat)for(let s of i.cells)n(s.blocks,true);}};n(e.fragments,false),e.header&&n(e.header.fragments,false),e.footer&&n(e.footer.fragments,false);for(let r of [e.footnotes,e.endnotes])if(r)for(let o of r.notes)n(o.fragments,false);}function Wc(e,t,n){e.has(t.paragraphId)||e.set(t.paragraphId,n);for(let r of t.lines)for(let o of Na$1(r))e.has(o.paragraphId)||e.set(o.paragraphId,n);}var mb=new WeakMap,gb=new WeakMap;function HP(e){let t=gb.get(e);if(t)return t;let n=new Map;return Uc(e,r=>Wc(n,r,r.props)),gb.set(e,n),n}function po(e,t){let n=mb.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of HP(r))n.has(o)||n.set(o,a);mb.set(e,n);}return n.get(t)??[]}var hb=new WeakMap;function _P(e){let t=hb.get(e);if(t)return t;let n=new Map;return Uc(e,r=>Wc(n,r,r.tabStops)),hb.set(e,n),n}function Na(e,t){let n=yb.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of _P(o))r.has(a)||r.set(a,i);n=r,yb.set(e,r);}return n.get(t)??null}var yb=new WeakMap,bb=new WeakMap,vb=new WeakMap;function BP(e){let t=vb.get(e);if(t)return t;let n=new Map;return Uc(e,(r,o)=>Wc(n,r,{indent:r.indent,inTable:o})),vb.set(e,n),n}function $P(e,t){let n=bb.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of BP(o))r.has(a)||r.set(a,i);n=r,bb.set(e,r);}return n.get(t)??null}function xb(e,t,n,r,o=ba$1,a){let i=Ga(e,t);if(!i||i.kind!=="paragraph")return false;for(let s of da(i,na(i),n,r,o,a))if(ia(ha(s.run,"runProperties","rPr"),fa).length>0)return true;return false}function Sb(e,t,n,r=ba$1,o){let a=Ga(e,t);if(!a||a.kind!=="paragraph")return [];let i=na(a),s=null,l=null;for(let u of ca(a,r,o)){let g=i.get(u.id);!g||g.end<=g.start||(g.start<n&&n<=g.end&&(s=u),l===null&&g.start<=n&&n<g.end&&(l=u));}let c=s??l;return c?ia(ha(c,"runProperties","rPr"),fa):ka$1(e,t)}function fo(e,t,n){let r=e?.find(a=>a.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 Ib(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:fo(t,"b")===true};break;case "i":n={...n,italic:fo(t,"i")===true};break;case "u":n={...n,underline:fo(t,"u")===true};break;case "strike":n={...n,strikethrough:fo(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 a=Number(o);Number.isFinite(a)&&(n={...n,fontSizeHalfPoints:a});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 Gc(e,t,n,r){return n&&n.length>0?vf$1(e,n):rf(e,t,r??Sa$1(e))}function Is(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 wb(e,t,n,r){return Gc(e,t,n,r)[0]?.style??null}function Xc(e,t,n,r,o,a){let i=Gc(e,t,r,a);if(i.length===0)return false;let s=l=>{switch(n){case "b":return l.style.bold;case "i":return l.style.italic;case "u":return l.style.underline!==null;case "strike":return l.style.strike;case "vertAlign":return l.style.verticalAlign===o;default:return false}};return i.every(s)}function kb(e,t,n,r,o,a){let i=Gc(e,t,r,a),s=i.map(M=>M.style),l=M=>{if(s.length===0)return null;let $=M(s[0]);return s.every(E=>M(E)===$)?$:null},c=(M,$=(E,G)=>E===G)=>M.length>0&&M.every(E=>$(E,M[0]))?M[0]:null,u=(M,$)=>M.props.some(E=>E.localName===$),g=M=>M.style.fontFamily??n?.(M.range.paragraphId,M.props).fontFamily??null,m=M=>u(M,"sz")?Math.round(M.style.fontSizePt*2):n?.(M.range.paragraphId,M.props).fontSizeHalfPoints??Math.round(M.style.fontSizePt*2),y=i.length===0?n?.(t.head.paragraphId,[]):void 0,v=qP(e,t,r,a),w=M=>c(v.map($=>M(po(e,$)))),b=(M,$=(E,G)=>E===G)=>{if(v.length<2)return false;let E=M(po(e,v[0]));return v.some((G,le)=>le>0&&!$(M(po(e,G)),E))},S=w(M=>xc$1(M)),k=w(M=>fc$1(M,"pStyle")?.val??o??void 0)??null,O=M=>fc$1(M,"spacing")??void 0,D=M=>{let $=O(M),E=Number($?.line);if(!Number.isFinite(E))return "";let G=$?.lineRule??"auto";return G==="auto"?`multiple:${Math.round(E/240*100)/100}`:`${G==="exact"?"exact":"atLeast"}:${Math.round(E/20*100)/100}`},L=w(D),p=(()=>{if(!L)return null;let[M,$]=L.split(":");return {rule:M,value:Number($)}})(),A=(M,$)=>{let E=Number(O(M)?.[$]);return Number.isFinite(E)?Math.round(E/20*100)/100:null},Z=M=>w($=>A($,M)),T=(()=>{let M=v.map(z=>$P(e,z)),$=M[0];if(!$||M.some(z=>z===null||z.inTable))return null;let E=z=>Math.round(z*20),G=z=>E(z.hanging>0?-z.hanging:z.firstLine),le=M,ne=E($.indent.left),F=E($.indent.right),j=G($.indent);return {left:ne,right:F,firstLine:j,mixed:{left:le.some(z=>E(z.indent.left)!==ne),right:le.some(z=>E(z.indent.right)!==F),firstLine:le.some(z=>G(z.indent)!==j)}}})(),P=M=>w($=>M(ce($))),N=w(_b$1),_=w(jc$1);return {bold:s.length>0&&s.every(M=>M.bold),italic:s.length>0&&s.every(M=>M.italic),underline:s.length>0&&s.every(M=>M.underline!==null),strikethrough:s.length>0&&s.every(M=>M.strike),superscript:s.length>0&&s.every(M=>M.verticalAlign==="superscript"),subscript:s.length>0&&s.every(M=>M.verticalAlign==="subscript"),fontFamily:i.length>0?c(i.map(g)):y?.fontFamily??null,fontSizeHalfPoints:i.length>0?c(i.map(m)):y?.fontSizeHalfPoints??null,color:l(M=>M.color),highlight:l(M=>M.highlight),alignment:S,styleId:k,lineSpacing:p,spaceBeforePt:Z("before"),spaceAfterPt:Z("after"),disagrees:{alignment:b(M=>xc$1(M)),spaceBeforePt:b(M=>A(M,"before")),spaceAfterPt:b(M=>A(M,"after")),lineSpacing:b(D),tabStops:(()=>{if(v.length<2)return false;let M=JSON.stringify(Na(e,v[0])?.stops??null);return v.some(($,E)=>E>0&&JSON.stringify(Na(e,$)?.stops??null)!==M)})()},indent:T,tabStops:c(v.map(M=>Na(e,M)?.stops??null),(M,$)=>M===null||$===null?M===$:M.length===$.length&&M.every((E,G)=>Math.round(E.positionPt*20)===Math.round($[G].positionPt*20)&&E.alignment===$[G].alignment&&(E.leader??"none")===($[G].leader??"none")))?.map(M=>({positionTwips:Math.round(M.positionPt*20),alignment:M.alignment,...M.leader?{leader:M.leader}:{}}))??null,paragraphFlags:{contextualSpacing:_,keepNext:P(M=>M.keepNext),keepLines:P(M=>M.keepLines),widowControl:P(M=>M.widowControl),pageBreakBefore:N}}}function qP(e,t,n,r){if(n&&n.length>0)return [...uf(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??Sa$1(e),a=o.indexOf(t.anchor.paragraphId),i=o.indexOf(t.head.paragraphId);return a===-1||i===-1?[t.head.paragraphId]:o.slice(Math.min(a,i),Math.max(a,i)+1)}function Tb(e,t,n,r){return t.paragraphId!==n.paragraphId?[]:t.offset!==0||n.offset!==e.length?[]:e.length===0?[]:[{op:"setParagraphMarkProperties",paragraphId:t.paragraphId,properties:r}]}function Pb(e){let{session:t,commit:n,orderedRange:r,selectionMark:o,textOf:a}=e,i=()=>e.displayMode(),s=()=>e.authorFilter(),l=()=>t.partFor(e.storyScope())??t.part(),c=(b,S,k)=>t.applyTreeOps(b,S,k,e.storyScope()),u={get value(){return e.layout()}},g={get value(){return e.selection()}},m=(b,S,k)=>{let O=l();if(b.paragraphId===S.paragraphId){let Z=ra(O,b.paragraphId,b.offset,S.offset,k,i(),s());if(Z.length===0)return;let T=qa$1(O,b.paragraphId,k);n(()=>c([...Z.map(P=>({op:"setRunProperties",paragraphId:b.paragraphId,start:P.start,end:P.end,properties:P.properties,...P.targetRunIds?{targetRunIds:P.targetRunIds}:{}})),...e.paragraphMarkVisible(b.paragraphId)?Tb(a(b.paragraphId),b,S,T):[]],o()));return}let D=e.paragraphOrder(),L=D.indexOf(b.paragraphId),p=D.indexOf(S.paragraphId);if(L===-1||p===-1)return;let A=[];for(let Z=L;Z<=p;Z+=1){let T=D[Z],P=a(T),N=Z===L?b.offset:0,_=Z===p?S.offset:P.length,M=N<_?ra(O,T,N,_,k,i(),s()):[];for(let E of M)A.push({op:"setRunProperties",paragraphId:T,start:E.start,end:E.end,properties:E.properties,...E.targetRunIds?{targetRunIds:E.targetRunIds}:{}});(Z<p||N===0&&_===P.length&&P.length>0)&&e.paragraphMarkVisible(T)&&A.push({op:"setParagraphMarkProperties",paragraphId:T,properties:qa$1(O,T,k)});}A.length!==0&&n(()=>c(A,o()));},y=(b,S)=>{let k=l(),O=[];for(let D of uf(u.value,b)){let L=a(D);for(let p of ra(k,D,0,L.length,S,i(),s()))O.push({op:"setRunProperties",paragraphId:D,start:p.start,end:p.end,properties:p.properties,...p.targetRunIds?{targetRunIds:p.targetRunIds}:{}});e.paragraphMarkVisible(D)&&O.push({op:"setParagraphMarkProperties",paragraphId:D,properties:qa$1(k,D,S)});}return O.length===0?false:(n(()=>c(O,o()),void 0,{keepCellSelection:true}),true)},v=b=>{ga$1(b.localName)&&e.setPendingFormats(la(e.pendingFormats()??[],b));},w=b=>{if(b.length===0)return;let S=e.selectedCells?.(),k=S&&S.length>0?[...uf(u.value,S)]:null,{from:O,to:D}=r(),L=k??e.paragraphOrder(),p=k?0:L.indexOf(O.paragraphId),A=k?L.length-1:L.indexOf(D.paragraphId);if(p===-1||A===-1)return;let Z=l(),T=L.slice(p,A+1).filter(P=>e.paragraphMarkVisible(P)).map(P=>{let N=ja(Z,P);for(let _ of b){let M=_.mergeAttributes?{...N.find(E=>E.localName===_.localName)?.attributes??{},..._.attributes}:_.attributes??{},$=Object.fromEntries(Object.entries(M).filter(([,E])=>E!=null));N=la(N,{localName:_.localName,...Object.keys($).length>0?{attributes:$}:{}});}return {op:"setParagraphProperties",paragraphId:P,properties:N}});T.length!==0&&n(()=>c(T,o()),void 0,{keepCellSelection:k!==null});};return {setRunProperty(b,S){let k={localName:b,...S?{attributes:S}:{}},O=e.selectedCells?.();if(O&&O.length>0){y(O,k);return}let{from:D,to:L}=r();if(D.paragraphId===L.paragraphId&&D.offset===L.offset){v(k);return}m(D,L,k);},setParagraphProperty(b,S,k){w([{localName:b,...S?{attributes:S}:{},...k??{}}]);},setParagraphProperties:w,formatting:()=>Ib(kb(u.value,g.value,(b,S)=>{let k=t.effectiveRunDefaults(b,S);if(k.fontFamily!==null)return k;let O=e.defaultFontFamily?.()??null;return O===null?k:{...k,fontFamily:O}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder()),e.pendingFormats()),toggleRunProperty(b,S){let k=e.selectedCells?.(),O=S?.val,D=fo(e.pendingFormats(),b,O)??Xc(u.value,g.value,b,k,O,e.paragraphOrder()),L=D?{localName:b,attributes:{val:ZP[b]??"0"}}:{localName:b,...S?{attributes:S}:{}};if(k&&k.length>0){y(k,L);return}let{from:p,to:A}=r();if(p.paragraphId===A.paragraphId&&p.offset===A.offset){let Z=e.pendingFormats()??[],T=Xc(u.value,g.value,b,void 0,O,e.paragraphOrder());if(!D===T){let P=Z.filter(N=>N.localName!==b);e.setPendingFormats(P.length>0?P:null);}else v(L);return}m(p,A,L);},clearFormatting(){e.setPendingFormats(null);let b=u.value,S=e.paragraphOrder(),k=e.selectedCells?.(),O=k&&k.length>0?[...uf(b,k)]:Is(S,r());if(O.length===0)return;let{from:D,to:L}=r(),p=k!==void 0&&k.length>0,A=l(),Z=[];for(let T of O){let P=a(T),N=p||T!==D.paragraphId?0:D.offset,_=p||T!==L.paragraphId?P.length:L.offset;for(let M of sa(A,T,N,_,i(),s()))xb(A,T,M.start,M.end,i(),s())&&Z.push({op:"setRunProperties",paragraphId:T,start:M.start,end:M.end,properties:[]});e.paragraphMarkVisible(T)&&ka$1(A,T).length>0&&Z.push({op:"setParagraphMarkProperties",paragraphId:T,properties:[]}),e.paragraphMarkVisible(T)&&ja(A,T).length>0&&Z.push({op:"setParagraphProperties",paragraphId:T,properties:[]});}Z.length!==0&&n(()=>c(Z,o()),void 0,{keepCellSelection:p});}}}var ZP={u:"none",vertAlign:"baseline"};var zP=new Set,Cb=500;function VP(e){let t=o=>({val:o?"1":"0"}),n=String(Math.max(2,Math.min(3276,Math.round(e.fontSizePt*2)))),r=[{localName:"b",attributes:t(e.bold)},{localName:"i",attributes:t(e.italic)},{localName:"bCs",attributes:t(e.bold)},{localName:"iCs",attributes:t(e.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:n}},{localName:"szCs",attributes:{val:n}},{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))}}];return (e.fontFamily||e.fontFamilyEastAsia)&&r.push({localName:"rFonts",attributes:{...e.fontFamily?{ascii:e.fontFamily,hAnsi:e.fontFamily}:{},...e.fontFamilyEastAsia?{eastAsia:e.fontFamilyEastAsia}:{}}}),r}function Rb(e){let t=e.session,n=()=>t.partFor(e.storyScope())??t.part(),r="off",o=null,a=null,i=null,s=Wi,l=()=>{let b=o===null?"none":o.paragraphProperties?"paragraph":"run";return (s.mode!==r||s.level!==b)&&(s={mode:r,level:b}),s},c=(b,S,k)=>{if(k||b.paragraphId!==S.paragraphId||b.offset===S.offset)return true;let O=e.textOf(b.paragraphId);return b.offset===0&&S.offset===O.length&&O.length>0},u=()=>{let b=e.selectedCells?.(),S=b!==void 0&&b.length>0,{from:k,to:O}=e.orderedRange();if(!e.paragraphOrder().includes(k.paragraphId))return false;let D=wb(e.layout(),e.selection(),b,e.paragraphOrder()),L=c(k,O,S)?ja(n(),k.paragraphId):null;return !D&&L===null?false:(o={runProperties:D?VP(D):[],paragraphProperties:L},true)},g=()=>u()?(e.publish(),true):false,m=()=>{let b=o;if(!b)return {wrote:false,armed:false,built:false};let S=e.selectedCells?.(),k=S!==void 0&&S.length>0,{from:O,to:D}=e.orderedRange(),L=!k&&O.paragraphId===D.paragraphId&&O.offset===D.offset,p=L?cs(e.layout(),O,zP):null,A=p?.from??O,Z=p?.to??D,T=L&&A.offset===Z.offset,P=k?[...uf(e.layout(),S)]:Is(e.paragraphOrder(),{from:A,to:Z});if(P.length===0)return {wrote:false,armed:false,built:false};let N=n(),_=e.displayMode(),M=[];for(let le of P){let ne=e.textOf(le),F=k||le!==A.paragraphId?0:A.offset,j=k||le!==Z.paragraphId?ne.length:Z.offset;if(F<j&&b.runProperties.length>0)for(let Q of ra(N,le,F,j,b.runProperties,_,e.authorFilter()))M.push({op:"setRunProperties",paragraphId:le,start:Q.start,end:Q.end,properties:Q.properties,...Q.targetRunIds?{targetRunIds:Q.targetRunIds}:{}});let z=b.paragraphProperties!==null||k||le!==Z.paragraphId||F===0&&j===ne.length&&ne.length>0,X=e.paragraphMarkVisible(le);z&&X&&b.runProperties.length>0&&M.push({op:"setParagraphMarkProperties",paragraphId:le,properties:qa$1(N,le,b.runProperties)}),b.paragraphProperties&&X&&M.push({op:"setParagraphProperties",paragraphId:le,properties:[...b.paragraphProperties]});}let $=t.packageRevision();M.length>0&&e.commit(()=>t.applyTreeOps(M,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:k});let E=t.packageRevision()!==$,G=T&&b.runProperties.length>0&&(E||M.length===0);return G&&e.armPendingFormats(b.runProperties),{wrote:E,armed:G,built:M.length>0}},y=()=>{let b=m();return b.wrote&&r==="once"&&w(),b.wrote?"painted":b.armed?"armed":b.built?"refused":"nothingToPaint"},v=()=>{r!=="off"&&(r="off",e.publish());},w=()=>{a=null,i=null,v();};return {state:l,capture:g,apply:y,disarm:w,press(){let b=e.now(),S=a!==null&&b-a<Cb,k=r;a=b;let O=()=>(a=null,false);return k==="once"&&S?u()?(r="locked",e.publish(),true):(v(),O()):k!=="off"?(v(),i=k==="locked"?b:null,true):i!==null&&b-i<Cb?(i=null,true):u()?(r="once",i=null,e.publish(),true):O()},applyIfArmed(){r==="off"||o===null||m().wrote&&r==="once"&&w();}}}var KP=500,Eb=4,mo=40,ws=12;function jP(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),a=Math.min(e.y+e.height,t.y+t.height);return o<=n||a<=r?0:(o-n)*(a-r)}function Fb(e,t){return jP(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 en(e,t,n){let r=Ra$1(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function Mb(e,t,n){if(!(t>Bd$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Bd$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)Mb(a.blocks,t+1,n);}}}function Yc(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,s)=>{(!n||en(e,i,n)<0)&&(n=i),(!r||en(e,s,r)>0)&&(r=s);},a=t.level!=="inline";for(let i of t.fragments){let s=e.pages[i.pageIndex];s&&Mb(s.fragments,0,l=>{if(Fb(i.box,l.box)){if(a){let c=nf(e,l.paragraphId).length;o({paragraphId:l.paragraphId,offset:0},{paragraphId:l.paragraphId,offset:c});return}for(let c of l.lines)for(let u of c.spans)Fb(i.box,u.box)&&o({paragraphId:u.range.paragraphId,offset:u.range.start},{paragraphId:u.range.paragraphId,offset:u.range.end});}});}return !n||!r?null:{from:n,to:r}}function UP(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function Ob(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=Kd$1(e,t.pageIndex,o);return a?.placeholder?a:null}let r=UP(e,n);return r?.placeholder?r:null}function Ab(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=en(e,t.anchor,t.head)<=0?t.anchor:t.head,o=en(e,t.anchor,t.head)<=0?t.head:t.anchor,a=true;for(;a;){a=false;for(let s of n){if(!s.placeholder)continue;let l=Yc(e,s);!l||!(en(e,r,o)===0?en(e,r,l.from)>=0&&en(e,r,l.to)<0:en(e,r,l.to)<0&&en(e,o,l.from)>0)||(en(e,l.from,r)<0&&(r=l.from,a=true),en(e,l.to,o)>0&&(o=l.to,a=true));}}return en(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function Lb(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=n.ownerDocument,a=o.defaultView,i=null,s=null,l=0,c=0,u=0,g=0,m=null;function y(H,J){if(!s){let pe=n.getBoundingClientRect();s={left:pe.left,top:pe.top};}let ee=e.scale()||1;return {x:(H-s.left)/ee,y:(J-s.top)/ee}}function v(H){return {scope:{kind:"headerFooter",rId:H.rId},pageIndex:H.pageIndex,kind:H.kind,partName:H.partName,variant:H.variant}}function w(H,J){let ee=e.layout(),pe=y(H,J),R=Fd$1(ee,pe.y),K=ee.pages[R];if(!K)return null;let U=e.measurer();return Hd$1(ee,R,{x:pe.x-K.contentBox.x-e.pageOffsetX(R),y:pe.y-K.contentBox.y},U?{measurer:U}:{})}function b(H,J){let ee=e.activeNote?.()??null;if(ee){let de=e.layout(),Ie=Ad(de,y(H,J),e.pageOffsetX);if(!Ie||Ie.scopeId!==ee.scopeId)return null;let ce=e.measurer();return Id$1(de,Ie.pageIndex,Ie.fragments,Ie.local,{...ce?{measurer:ce}:{}})}let pe=e.activeHeaderFooter?.()??null;if(!pe)return w(H,J);let R=e.layout(),K=y(H,J),U=Ld(R,K,e.pageOffsetX);if(U&&Cd(U.story,v(pe))){let de=e.measurer();return Ed(R,U.pageIndex,U.story,U.local,de?{measurer:de}:{})}return null}function S(H,J){let{story:ee,pageIndex:pe,kind:R}=H;return {rId:ee.rId,pageIndex:pe,kind:R,partName:ee.partName,variant:ee.variant,...J?{position:J}:{}}}function k(H){let J=e.measurer();return Ed(e.layout(),H.pageIndex,H.story,H.local,J?{measurer:J}:{})?.position??void 0}let O=new WeakMap;function D(H,J){let ee=e.activeNote?.();if(ee){let U=to(H,null,ee.scopeId).indexOf(J);return U===-1?-1:U}let pe=e.activeHeaderFooter?.();if(pe){let U=to(H,v(pe)).indexOf(J);return U===-1?-1:U}let R=O.get(H);return R||(R=new Map(Ra$1(H).map((K,U)=>[K,U])),O.set(H,R)),R.get(J)??-1}function L(H,J,ee){let pe=D(H,J.paragraphId),R=D(H,ee.paragraphId);return pe!==R?pe<R:J.offset<ee.offset}function p(H,J,ee){if(ee==="character")return {from:J,to:J};let pe=J.paragraphId;if(ee==="paragraph"){let R=nf(H,pe);return {from:{paragraphId:pe,offset:0},to:{paragraphId:pe,offset:R.length}}}return cs(H,J,of(H,pe))}function A(H,J,ee,pe,R){let K=R?Ob(H,R):null,U=K?Yc(H,K)??p(H,ee,pe):p(H,ee,pe),de=L(H,U.from,J.from)?{anchor:J.to,head:U.from}:{anchor:J.from,head:U.to};return Ab(H,de)}let Z=r.closest(".docx-editor__scroll-container");function T(){return r.closest(".docx-editor__scroll-container")}function P(H,J,ee){if(ee<H+mo){let pe=Math.max(0,H+mo-ee);return -Math.min(ws,pe/mo*ws)}if(ee>J-mo){let pe=Math.max(0,ee-(J-mo));return Math.min(ws,pe/mo*ws)}return 0}function N(){m!==null&&(a?.cancelAnimationFrame(m),m=null);}function _(){m=null;let H=i,J=T();if(!H||!J||!a)return;let ee=J.getBoundingClientRect(),pe=P(ee.top,ee.bottom,H.clientY);pe!==0&&(J.scrollTop+=pe,s=null,$(H.clientX,H.clientY),m=a.requestAnimationFrame(_));}function M(){if(m!==null||!a||!i)return;let H=T();if(!H)return;let J=H.getBoundingClientRect();P(J.top,J.bottom,i.clientY)!==0&&(m=a.requestAnimationFrame(_));}function $(H,J){let ee=i;if(!ee)return;let pe=b(H,J);pe&&(e.isReadOnlyParagraph?.(pe.position.paragraphId)||E(ee,pe)||e.setSelection(A(e.layout(),ee.anchorRange,pe.position,ee.granularity,pe)));}function E(H,J){let ee=H.anchorCell;if(!ee)return false;if(!J.cell||J.cell.tableId!==ee.tableId)return H.cellDragging;if(!H.cellDragging&&J.cell.cellId===ee.cellId)return false;let pe=sf(e.layout(),ee,J.cell);return pe?(H.cellDragging=true,e.setCellSelection(pe),true):H.cellDragging}function G(H){let J=Date.now(),ee=J-c;return l=Math.abs(H.clientX-u)<=Eb&&Math.abs(H.clientY-g)<=Eb&&ee>=0&&ee<=KP?l+1:1,c=J,u=H.clientX,g=H.clientY,l}let le=["character","word","paragraph"],ne=H=>{if(H.button!==0)return;let J=H.target?.closest?.("[data-docx-cc-widget]");if(J){if(H.preventDefault(),H.stopPropagation(),J.hasAttribute("disabled")||J.dataset.disabledReason)return;let Ce=J.dataset.docxCcId,Ae=J.dataset.docxCcWidget;Ce&&Ae&&e.onContentControlWidget?.(Ce,Ae);return}if(H.pointerType==="touch")return;i&&X(),s=null;let ee=e.layout(),pe=y(H.clientX,H.clientY),R=e.activeHeaderFooter?.()??null,K=e.activeNote?.()??null,U=Ld(ee,pe,e.pageOffsetX),de=Ad(ee,pe,e.pageOffsetX),Ie=H.target?.closest("[data-docx-hf]"),ce=!!(Ie||U),re=H.target,ye=re?.closest("[data-docx-note-ref]"),we=re?.closest("[data-docx-note-mark-back]"),ue=null,Be=()=>ue??=G(H);if(ye?.dataset.docxNoteScope){H.preventDefault(),e.focus(),e.enterNote?.(ye.dataset.docxNoteScope);return}if(we){H.preventDefault(),e.focus(),e.exitNote?.(true);return}if(de&&!ce){let Ce=e.measurer?.(),Ae=Id$1(ee,de.pageIndex,de.fragments,de.local,{...Ce?{measurer:Ce}:{}});if(!K||K.scopeId!==de.scopeId){H.preventDefault(),e.focus(),e.enterNote?.(de.scopeId,Ae?{paragraphId:Ae.position.paragraphId,offset:Ae.position.offset}:void 0,de.pageIndex);return}if(K.pageIndex!==de.pageIndex){H.preventDefault(),e.focus(),e.enterNote?.(de.scopeId,Ae?{paragraphId:Ae.position.paragraphId,offset:Ae.position.offset}:void 0,de.pageIndex);return}}else if(K){if(!Rd(ee,pe,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(R)if(U&&Cd(U.story,v(R)))U.pageIndex!==R.pageIndex&&e.enterHeaderFooter?.(S(U,k(U)));else if(U&&U.story.rId){H.preventDefault(),e.focus(),e.enterHeaderFooter?.(S(U,k(U)));return}else if(Rd(ee,pe,e.pageOffsetX)){H.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let Ce=Be()>=2?Md(ee,pe,e.pageOffsetX):null;Ce&&(H.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ce.kind,Ce.pageIndex));return}else if(ce&&Be()>=2){if(U?.story.rId)H.preventDefault(),e.focus(),e.enterHeaderFooter?.(S(U,k(U)));else if(Ie instanceof HTMLElement){let Ce=Ie.dataset.docxRId,Ae=Ie.dataset.docxHf,pt=Ie.closest("[data-page-index]")?.getAttribute("data-page-index"),At=pt!=null?Number(pt):NaN;if((Ae==="header"||Ae==="footer")&&Number.isInteger(At))if(Ce){let Qn=ee.pages[At]?.[Ae];H.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:Ce,pageIndex:At,kind:Ae,partName:Qn?.partName??"",variant:Qn?.variant??"default"});}else ee.pages[At]?.[Ae]||(H.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ae,At));}return}else if(Be()>=2){let Ce=Md(ee,pe,e.pageOffsetX);if(Ce){H.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ce.kind,Ce.pageIndex);return}}let ke=b(H.clientX,H.clientY);if(!ke)return;if(e.isReadOnlyParagraph?.(ke.position.paragraphId)){H.preventDefault();return}if(Be()===2&&e.onTextFormDoubleClick?.(H))return;H.preventDefault(),e.focus();try{n.setPointerCapture(H.pointerId);}catch{}o.addEventListener("pointermove",j),o.addEventListener("pointerup",z),o.addEventListener("pointercancel",z);let Fe=Be(),Oe=H.shiftKey?"character":le[(Fe-1)%le.length],Ot=Ob(ee,ke);if(Ot&&!H.shiftKey){if(e.selectContentControl?.(Ot.id)){let Ae=e.selection(),pt=L(ee,Ae.anchor,Ae.head)||Ae.anchor.paragraphId===Ae.head.paragraphId&&Ae.anchor.offset===Ae.head.offset?{from:Ae.anchor,to:Ae.head}:{from:Ae.head,to:Ae.anchor};i={pointerId:H.pointerId,granularity:"character",anchorRange:pt,anchorCell:ke.cell,cellDragging:false,clientX:H.clientX,clientY:H.clientY};return}let Ce=Yc(ee,Ot);if(Ce){i={pointerId:H.pointerId,granularity:"character",anchorRange:Ce,anchorCell:ke.cell,cellDragging:false,clientX:H.clientX,clientY:H.clientY},F(()=>e.setSelection({anchor:Ce.from,head:Ce.to}));return}}if(H.shiftKey){let Ce=e.selection();i={pointerId:H.pointerId,granularity:Oe,anchorRange:{from:Ce.anchor,to:Ce.anchor},anchorCell:ke.cell,cellDragging:false,clientX:H.clientX,clientY:H.clientY},F(()=>e.setSelection(A(ee,{from:Ce.anchor,to:Ce.anchor},ke.position,Oe,ke)));}else {let Ce=p(ee,ke.position,Oe);i={pointerId:H.pointerId,granularity:Oe,anchorRange:Ce,anchorCell:ke.cell,cellDragging:false,clientX:H.clientX,clientY:H.clientY},F(()=>e.setSelection(Ab(ee,{anchor:Ce.from,head:Ce.to})));}};function F(H){try{H();}catch(J){throw X(),J}}let j=H=>{let J=i;!J||H.pointerId!==J.pointerId||(H.preventDefault(),J.clientX=H.clientX,J.clientY=H.clientY,$(H.clientX,H.clientY),M());},z=H=>{let J=i;if(!J||H.pointerId!==J.pointerId)return;X();try{n.releasePointerCapture(J.pointerId);}catch{}let ee=e.cellSelection();ee?e.setCellSelection(ee):e.setSelection(e.selection()),H.type==="pointerup"&&(e.onTextFormPointerUp?.(H),e.onSelectionSettled?.());};function X(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,s=null,N(),o.removeEventListener("pointermove",j),o.removeEventListener("pointerup",z),o.removeEventListener("pointercancel",z);}let Q=()=>{s=null;};return n.addEventListener("pointerdown",ne),Z?.addEventListener("scroll",Q,{passive:true}),a?.addEventListener("scroll",Q,{capture:true,passive:true}),a?.addEventListener("resize",Q,{passive:true}),{dragging:()=>i!==null,destroy(){X(),n.removeEventListener("pointerdown",ne),Z?.removeEventListener("scroll",Q),a?.removeEventListener("scroll",Q,{capture:true}),a?.removeEventListener("resize",Q);}}}function Nb(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i;function s(A){let Z=kr(A?.anchorNode,n)??kr(A?.focusNode,n);Z!==void 0&&(i=Z);}function l(A){return i??kr(A?.anchorNode,n)??kr(A?.focusNode,n)}let c=false,u=false,g=false,m=null,y=false;function v(){let A=t.getSelection(),Z=lo(n,A);return !Z||(s(A),zt(Z,e.selection()))?false:(e.adoptSelection(Z),true)}function w(){let A=t.activeElement;if(A&&n.contains(A))return true;if(A&&A!==t.body&&A!==t.documentElement)return false;let Z=t.getSelection();if(!Z||Z.rangeCount===0)return true;let T=Z.anchorNode;return !T||!T.isConnected?true:n.contains(T)}let b=()=>{let A=t.getSelection(),Z=lo(n,A);if(!Z){if(!Pc(n,A))return;c=false;let T=_e(e.selection().head);if(zt(T,e.selection()))return;e.setSelection(T);return}c=false,s(A),!zt(Z,e.selection())&&e.setSelection(Z);};function S(A){let Z=e.textOf(A),T=k0(n,A,Z,t.getSelection()?.anchorNode??null);if(T===null)return;let P=T0(A,Z,T);if(!P)return;let N=P.ops.find(le=>le.op==="deleteText"),_=P.ops.find(le=>le.op==="insertText"),M=_&&N?e.replacementOffset?.(A,N.start,N.end):void 0,$=_&&M!==void 0&&M!==_.offset?P.ops.map(le=>le===_?{..._,offset:M}:le):P.ops,E=_?e.pendingFormatOps?.(A,M??_.offset,_.text.length,N?{start:N.start,end:N.end}:void 0)??[]:[],G=e.storyScope();e.commit(()=>{let le=e.applyOps([...$,...E],e.selectionMark(),G);return E.length===0||!le.rejected?le:e.applyOps($,e.selectionMark(),G)}),e.setSelection(_e({paragraphId:A,offset:_&&M!==void 0?M+_.text.length:P.caret}));}function k(){o||g||e.isGesturing?.()||e.holdsCellSelection?.()||O()||c&&b();}function O(){if(!u||c)return false;if(!a)return true;let A=lo(n,t.getSelection());return A!==null&&zt(A,a)}function D(A){A instanceof PointerEvent&&A.button!==0||(c=true);}let L=false;function p(A=false){if(e.updateCaret(),!A&&!w())return;o=true;let Z=e.now(),T=e.domSelection?.()??e.selection();c=false;let P=t.getSelection(),N=l(P),_=u0(n,T,P,N!==void 0?{preferredPageIndex:N}:void 0);_&&s(P),a=_?T:null,_||(u=true),e.recordSelectionMs(e.now()-Z),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",D,true),n.addEventListener("selectstart",D,true),{adoptBeforePaint(){let A=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,Z=u||A||!c?false:v();return e.hasPendingInput?.()!==true&&(u=false),Z},noteModelMoved(){u=true;},noteSelectionSettled(){u=false;},mirrorToDom:p,adoptBeforeInput:k,isComposing:()=>g,noteBrowserSelectionFixup(){L=true;},onSelectionChange:()=>{if(!o&&!g&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(L&&Pc(n,t.getSelection())){let A=lo(n,t.getSelection());if((A===null||!zt(A,e.selection()))&&(L=false,!c)){p();return}}O()||b();}},onCompositionStart:()=>{k(),g=true;let A=e.selection();y=A.anchor.paragraphId!==A.head.paragraphId,m=A.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:A=>{g=false;let Z=m??e.selection().head.paragraphId;m=null;let T=y;y=false;let P=e.storyScope(),N=r.revisionFor(P);if(T){let _=A?.data??"";_.length>0&&e.replaceSelectionWith?.(_);}else S(Z);r.endComposition(),r.revisionFor(P)===N&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>i,destroy(){n.removeEventListener("pointerdown",D,true),n.removeEventListener("selectstart",D,true),c=false;}}}var WP=32;function Hb(e,t,n,r){if(!(e.kind==="textValue"||r>WP)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)Hb(o,t,n,r+1);}}function YP(e){let t=Fb$1(e),n=Yc$1(e),r=new Map;for(let o=0;o<n.length;o+=1){let a=n[o];for(let i=a.blockStart;i<a.blockEndExclusive;i+=1){let s=t[i];s&&Hb(s,o,r,0);}}return r}var Db=new WeakMap;function QP(e){return !(!e.story||e.origin===b$1.mutationUndo||e.origin===b$1.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.includes(g$3.section))}function JP(e,t){t.story&&t.story.kind!=="body"||QP(t)||(e.map=null);}function eC(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>JP(t,n)));}function tC(e,t){let n=Db.get(e);return n||(n={map:null,subscribed:false},Db.set(e,n)),eC(e,n),n.map||(n.map=YP(t)),n.map}function _b(e,t,n){return n.startsWith(`${t.name}#`)?tC(e,t).get(n)??null:null}var Bb=32;function Da(e,t,n,r,o="all-markup",a){let i=e.part(),s=Yc$1(i,o,a);if(s.length<=1)return 0;let l=Zc$2(i,o,a),c=m=>{let y=l.indexOf(m);if(y!==-1)return y;let v=l.findIndex(w=>w>m);return v===-1?Math.max(0,l.length-1):v},u=Qc(e,t);if(u!==null)return c(u);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let m=e.headerFooterResolutionBySection().findIndex(y=>[y.headers,y.footers].some(v=>[...v.values()].some(w=>w.rId===n.rId)));return m===-1?0:c(m)}let g=rC(e,t);if(g!==null){let m=Qc(e,g);if(m!==null)return c(m)}return 0}function $b(e,t,n,r,o="all-markup",a){let i=e.part(),s=Yc$1(i);if(s.length<=1)return {kind:"whole-document"};let l=Zc$2(i,o,a),c=Qc(e,t),u=Da(e,t,n,r,o,a),g=l[u]??u;if(c!==null&&c===g)return {kind:"anchor",paragraphId:t};let m=s[g];if(!m)return {kind:"unaddressable"};let y=Fb$1(i);for(let v=m.blockStart;v<m.blockEndExclusive;v+=1){let w=nC(y[v]);if(w!==null)return {kind:"anchor",paragraphId:w}}return {kind:"unaddressable"}}function nC(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>Bb)return null;if(n.kind==="paragraph")return n.id;for(let o of n.children){let a=t(o,r+1);if(a!==null)return a}return null};return t(e,0)}function Qc(e,t){return _b(e,e.part(),t)}function rC(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=If(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of rd$1(o.root)){let i=gd$1(a);if(i===null||!oC(a,t))continue;return Jf(e.part()).find(l=>l.noteKind===r&&l.noteId===i)?.paragraphId??null}}return null}function oC(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>Bb)return false;if(r.kind==="paragraph"&&r.id===t)return true;for(let a of r.children)if(n(a,o+1))return true;return false};return n(e,0)}function go(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 ks(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 qb(e){return {val:e?"1":"0"}}var aC="list paragraph",iC="ListParagraph";function Zb(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function zb(e){let{session:t}=e;function n(){let a=null;for(let i of t.documentStyles())if(i.type==="paragraph"){if(i.name.trim().toLowerCase()===aC)return i.styleId;a===null&&i.styleId===iC&&(a=i.styleId);}return a}let r;function o(){let a=t.stylesRoot();return (r===void 0||r.root!==a)&&(r={root:a,styleId:Bc$1(a,t.documentThemeFonts()).defaultParagraphStyleId}),r.styleId}return {applyOps(a){let i=n();if(i===null)return [];let s=o(),l=e.storyPart(),c=[];for(let u of a){let g=ja(l,u),m=Zb(g);m!==void 0&&m!==s||c.push({op:"setParagraphProperties",paragraphId:u,properties:la(g,{localName:"pStyle",attributes:{val:i}})});}return c},clearOp(a){let i=n();if(i===null)return null;let s=ja(e.storyPart(),a);return Zb(s)!==i?null:{op:"setParagraphProperties",paragraphId:a,properties:s.filter(l=>l.localName!=="pStyle")}}}}var Jc="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",Ps="a section break cannot be inserted inside a table cell",Vb="a section break cannot change a section that a locked or linked content control holds",tu="a section break cannot be inserted in locked or linked content";function sC(e){let t=new Set,n=new Set,r=a=>{if(a.kind==="textValue"||!("localName"in a)||a.localName!=="sdt")return false;let i=a.children?.find(s=>s.kind!=="textValue"&&"localName"in s&&s.localName==="sdtPr");return !i||i.kind==="textValue"?false:(i.children??[]).some(s=>{if(s.kind==="textValue"||!("localName"in s)||s.namespaceUri!==da$1)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===da$1)?.value;return l==="contentLocked"||l==="sdtContentLocked"})},o=(a,i,s)=>{if(a.kind==="textValue")return;if(a.kind==="paragraph"){i&&t.add(a.id),s&&n.add(a.id);return}let l=i||a.kind==="table",c=s||r(a);for(let u of a.children??[])o(u,l,c);};return o(e.root,false,false),{inCell:t,held:n}}var lC=32;function dC(e){let t=new Set(th$1(e).map(n=>wh$1(n)));return sh$1(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function nu(e,t){let n=t.replaceAt??t.collapseTo;return uh$1(e,n.paragraphId)?t.collapseTo:n}var eu=(e,t)=>Fe(e,t)||De(e,t).content;function Ts(e,t,n,r){if(uh$1(e,t))return Ps;if(eu(e,t))return tu;let{section:o,ownerId:a}=vh$1(e,t);return wh$1(o)===n?null:a!==null&&eu(e,a)?Vb:r?Jc:null}function Kb(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return Ps;if(e.caretParagraphId!==null)return Ts(e.part(),e.caretParagraphId,t,n);let r=sC(e.part());if(!n&&r.inCell.size===0&&r.held.size===0)return null;let{from:o,to:a}=e.orderedRange(),i=e.part(),s=vh$1(i,o.paragraphId),l=vh$1(i,a.paragraphId),c=s.section===l.section,u=c?wh$1(s.section):dC(i),g=e.paragraphOrder(),m=g.indexOf(o.paragraphId),y=g.indexOf(a.paragraphId),v=m===-1||y===-1?null:g.slice(m,y+1),w=v!==null&&!v.some(S=>r.inCell.has(S))&&!v.some(S=>r.held.has(S));if(u!==null&&u!==t){if(w&&c&&s.ownerId!==null&&eu(i,s.ownerId))return Vb;if(n&&w)return Jc}if(w&&u!==null)return null;if(v===null||v.length-1>lC)return n&&u!==null&&u!==t?Jc:null;let b=nu(i,e.deleteSelectionPlan());return Ts(i,b.paragraphId,t,n)}var cC=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function uC(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 Cs(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 a=String(r),i=e[n]!==void 0;return i&&(o[n]=a),(!i||e[t]!==void 0)&&(o[t]=a),o}function jb(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 Ub(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:a,collapsedAt:i}=e,s=e.deleteSelectionPlan,l=()=>t.partFor(e.storyScope())??t.part(),c=(T,P,N)=>t.applyTreeOps(T,P,N,e.storyScope()),u=zb({session:t,storyPart:l}),g=()=>e.paragraphOrder(),m={get value(){return e.layout()}};function y(){let T=e.selectedCells?.();return T&&T.length>0?T:null}function v(T){let P=false;return n(()=>{let N=T();return P=N.committed,N},void 0,{keepCellSelection:y()!==null}),P}function w(){if(y()!==null)return [...uf(m.value,y())];let{from:T,to:P}=o(),N=g(),_=N.indexOf(T.paragraphId),M=N.indexOf(P.paragraphId);return _===-1||M===-1?null:N.slice(_,M+1)}let b=720,S=8;function k(T){return O(T)?.level??null}function O(T){return Qa(m.value,T)?.marker??null}function D(T){let P=O(T);return P?P.numFmt==="bullet"?"bullet":"ordered":null}function L(T,P){let N=g(),_=N.indexOf(T[0]??""),M=N.indexOf(T[T.length-1]??"");if(_===-1||M===-1)return null;for(let $ of [_-1,M+1]){let E=N[$];if(!E)continue;let G=O(E);if(G&&(G.numFmt==="bullet"?"bullet":"ordered")===P)return G.numId}return null}function p(T,P){return P<0||P>S?false:e.numberingLevelExists(T.numId,P)}function A(T,P){return P<0||P>S?false:e.numberingLevelExists(T.numId,P)?true:t.ensureNumberingLevel(T.numId,P,T.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(T.numId,P)}function Z(T){let P;for(let N of T){if(N.localName!=="ind")continue;let _=N.attributes?.left??N.attributes?.start;_!==void 0&&(P=_);}return !P||!/^-?\d{1,7}$/.test(P)?0:Number(P)}return {insertTab(){let T=s(),P=T.replaceAt??T.collapseTo;n(()=>c([...T.ops,{op:"insertTab",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},insertLineBreak(){let T=s(),P=T.replaceAt??T.collapseTo;n(()=>c([...T.ops,{op:"insertHardBreak",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},insertPageBreak(){let T=s(),P=T.replaceAt??T.collapseTo;n(()=>c([...T.ops,{op:"insertPageBreak",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},exitListOnEmptyItem(){let{from:T,to:P}=o();if(T.paragraphId!==P.paragraphId||T.offset!==P.offset)return false;let N=O(T.paragraphId);if(!N||e.paragraphTextOf(T.paragraphId).length>0)return false;let M=N.level>0&&p(N,N.level-1),$=[];if(M)$.push({op:"setListLevel",paragraphId:T.paragraphId,level:N.level-1});else {let G=u.clearOp(T.paragraphId);G&&$.push(G),$.push({op:"setListNumbering",paragraphId:T.paragraphId,numId:null});}let E=false;return n(()=>{let G=c($,a());return E=G.committed,G}),E},isListParagraph(){let{paragraphId:T}=r();return k(T)!==null},isListActive(T){let P=w();if(P===null)return false;let N=T==="bullet"?"bullet":"ordered";return P.length>0&&P.every(_=>D(_)===N)},toggleList(T){let P=w();if(P===null||P.length===0)return false;let N=P.every($=>D($)===T),_=N?null:L(P,T)??t.ensureListDefinition(T);if(!N&&_===null)return false;let M=N?[]:u.applyOps(P);for(let $ of P){let E=k($);M.push({op:"setListNumbering",paragraphId:$,numId:_,...E!==null?{level:E}:{}});}return v(()=>c(M,a()))},canAdjustIndent(T){let P=w();if(P===null)return false;let N=T==="increase"?1:-1;return P.some(_=>{let M=O(_);if(M){let E=M.level+N;return E>=0&&E<=S}let $=Z(po(m.value,_));return Math.max(0,$+N*b)!==$})},adjustIndent(T){let P=w();if(P===null)return false;let N=T==="increase"?1:-1,_=[];for(let M of P){let $=po(m.value,M),E=O(M),G=E?.level??null;if(E&&G!==null){let z=G+N;if(z<0||z>S||!A(E,z))continue;_.push({op:"setListLevel",paragraphId:M,level:z});continue}let le=Z($),ne=Math.max(0,le+N*b);if(ne===le)continue;let F=ja(l(),M),j=F.find(z=>z.localName==="ind");_.push({op:"setParagraphProperties",paragraphId:M,properties:la(F,{localName:"ind",attributes:uC(j?.attributes,String(ne))})});}return _.length===0?false:v(()=>c(_,a()))},setIndent(T){if(T.left===void 0&&T.right===void 0&&T.firstLine===void 0)return false;let P=w();if(P===null)return false;let N=[];for(let _ of P){let M=ja(l(),_),E={...M.find(G=>G.localName==="ind")?.attributes??{}};T.left!==void 0&&(E=Cs(E,"left","start",T.left)),T.right!==void 0&&(E=Cs(E,"right","end",T.right)),T.firstLine!==void 0&&(E=jb(E,T.firstLine)),N.push({op:"setParagraphProperties",paragraphId:_,properties:la(M,{localName:"ind",...Object.keys(E).length>0?{attributes:E}:{}})});}return N.length===0?false:v(()=>c(N,a()))},setParagraphFormat(T){let P=w();if(P===null||P.length===0)return false;let N=[];T.alignment!==void 0&&N.push({localName:"jc",attributes:{val:T.alignment}});let _={...go("before",T.spaceBeforePt),...go("after",T.spaceAfterPt),...ks(T.lineSpacing)};Object.keys(_).length>0&&N.push({localName:"spacing",attributes:_,mergeAttributes:true});for(let[G,le]of cC){let ne=T[G];ne!==void 0&&N.push({localName:le,attributes:qb(ne)});}let M=T.tabStops!==void 0,$=T.indentLeftTwips!==void 0||T.indentRightTwips!==void 0||T.indentFirstLineTwips!==void 0;if(N.length===0&&!$&&!M)return false;let E=[];for(let G of P){let le=ja(l(),G),ne=le;if($){let j={...le.find(z=>z.localName==="ind")?.attributes??{}};T.indentLeftTwips!==void 0&&(j=Cs(j,"left","start",T.indentLeftTwips)),T.indentRightTwips!==void 0&&(j=Cs(j,"right","end",T.indentRightTwips)),T.indentFirstLineTwips!==void 0&&(j=jb(j,T.indentFirstLineTwips)),ne=la(ne,{localName:"ind",...Object.keys(j).length>0?{attributes:j}:{}});}for(let F of N){let j=F.mergeAttributes?{...ne.find(X=>X.localName===F.localName)?.attributes??{},...F.attributes}:F.attributes??{},z=Object.fromEntries(Object.entries(j).filter(([,X])=>X!=null));ne=la(ne,{localName:F.localName,...Object.keys(z).length>0?{attributes:z}:{}});}if((N.length>0||$)&&E.push({op:"setParagraphProperties",paragraphId:G,properties:ne}),M){let F=Na(e.layout(),G);E.push({op:"setParagraphTabStops",paragraphId:G,stops:T.tabStops.map(j=>({positionTwips:Math.round(j.positionTwips),alignment:j.alignment,...j.leader&&j.leader!=="none"?{leader:j.leader}:{}})),...F?{inForcePositionsTwips:F.stops.map(j=>Math.round(j.positionPt*20))}:{}});}}return E.length===0?false:v(()=>c(E,a()))},sectionProperties:()=>Xc$1(t.part()),sectionPropertiesAt(T){let P=Yc$1(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),N=Da(t,T,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (P[N]??P[P.length-1]).properties},sectionAnchorParagraphAt(T){return $b(t,T,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(T){let P=false;return n(()=>{let N=e.storyScope().kind==="body",_=t.applyTreeOps([{op:"setSectionProperties",...T}],N?a():void 0,void 0,{kind:"body"});return P=_.committed,_}),P},sectionBreakRefusal(T="nextPage"){return e.storyScope().kind!=="body"?null:Kb({part:()=>t.part(),breakType:T,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:g,deleteSelectionPlan:s})},insertSectionBreak(T="nextPage"){if(e.storyScope().kind!=="body")return false;let P=s(),N=nu(t.part(),P),_=(uh$1(t.part(),N.paragraphId)?Ps:null)??Ts(t.part(),N.paragraphId,T,e.editingMode?.()==="suggest");if(_!==null)return e.publishRefusal?.(_),false;let M=new Set(t.paragraphIds()),$=false,E=false;return n(()=>{let G=t.applyTreeOps([...P.ops,{op:"splitParagraph",paragraphId:N.paragraphId,offset:N.offset},{op:"setSectionMark",paragraphId:N.paragraphId,breakType:T}],a(),void 0,{kind:"body"});return $=G.committed,E=G.reason==="locked"||G.reason==="bound",G},()=>{let G=t.paragraphIds().find(le=>!M.has(le));return G?i({paragraphId:G,offset:0}):null}),!$&&E&&e.publishRefusal?.(tu),$}}}var Qb="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function Jb(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===Qb}function fC(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===Qb}function ru(e){return e.kind==="textValue"?[]:e.children}function ev(e,t=0){if(e.kind==="textValue")return e.value;if(t>=la$1||e.kind==="deletedText"||pC(e.kind)||be$2(e)||e.kind==="runProperties"||e.kind==="generic"&&!na$1(e)&&!Jb(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return Vd$1(e);let n=ma(e,t),r="";for(let o of e.children)r+=ev(o,n);return r}function pC(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function ou(e,t,n){if(!(t>=la$1))for(let r of e){if(r.kind==="hyperlink"){ma(r,t)<la$1&&n(r,t);continue}if(na$1(r)){ou(ru(r),ma(r,t),n);continue}if(Jb(r)){for(let o of ru(r))fC(o)&&ou(ru(o),ma(r,t),n);continue}n(r,t);}}function Wb(e,t,n){let r=mC(e,t);if(!r||r.kind!=="paragraph")return [];let o=Me$2(r),a=[],i=0;return ou(r.children,0,(s,l)=>{let c=o.spanOf(s);if(c&&(i=Math.max(i,c.end)),s.kind!=="hyperlink")return;let u=c?c.start:i,g=c?c.end:i,m=$a$1(s,n);a.push({id:s.id,paragraphId:t,start:u,end:g,text:ev(s,l),kind:m.kind,href:m.href,authored:m.authored,...m.anchor!==void 0?{anchor:m.anchor}:{},...m.tooltip!==void 0?{tooltip:m.tooltip}:{}});}),a}function mC(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 a=n(o);if(a)return a}return null};return n(e.root)}function gC(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 hC(e,t){for(let n of Ha$3(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 tv(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=c=>e.session.relationshipTarget(c,t()),o=(c,u,g)=>e.session.applyTreeOps(c,u,g,t()),a=c=>{let u=n();return u?Wb(u,c,r):[]},i=()=>gC(a(e.selection().head.paragraphId),e.selection().head),s=()=>{let c=e.selection().head,u=hC(e.layout(),c);return u===null?null:e.fieldLinkById(u)},l=c=>{let u=e.selection().head.paragraphId,g=a(u).find(m=>m.id===c);if(g)return g;for(let m of e.session.storyParts()){let y=v=>of$1(e.session.currentPackage(),m.name,v);for(let v of wd$1(m))for(let w of zd$2(v.root)){let b=w.id,S=Wb(m,b,y).find(k=>k.id===c);if(S)return S}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:s,linkById:l,applyHyperlink(c){let u=c.url!==void 0&&c.url.length>0,g=c.anchor!==void 0&&c.anchor.length>0;if(u===g)return false;let m=t();if(!n()||e.refusesWrite())return false;let y;if(u){let T=()=>e.session.ensureHyperlinkRelationship(c.url,m),P=e.withMintActor?e.withMintActor(T):T();if(!P)return false;y=P;}let v={...y!==void 0?{relationshipId:y}:{},...g?{anchor:c.anchor}:{},...c.tooltip!==void 0?{tooltip:c.tooltip}:{}},w=i(),b=e.orderedRange(),S=b.from.paragraphId===b.to.paragraphId&&b.from.offset===b.to.offset;if(w&&(S||yC(w,b))){let T=[];if(c.text!==void 0&&c.text!==w.text){if(c.text.length===0)return false;let N=e.replacementLanding?.(w.paragraphId,w.start,w.end),_=e.textOf(w.paragraphId).slice(w.start,w.start+2),M=w.start+(_.length===2&&_.charCodeAt(0)>=55296&&_.charCodeAt(0)<=56319&&_.charCodeAt(1)>=56320&&_.charCodeAt(1)<=57343?2:1);if(N!=null&&N>w.start&&M<w.end)T.push({op:"setHyperlinkTarget",linkId:w.id,...v},{op:"deleteText",paragraphId:w.paragraphId,start:w.start,end:w.end},{op:"insertText",paragraphId:w.paragraphId,offset:M,text:c.text});else if(N!=null){let $=Gb(e.session);T.push({op:"setHyperlinkTarget",linkId:w.id,...v},...Xb(w,N,c.text),{op:"insertHyperlink",paragraphId:w.paragraphId,start:N,end:N+c.text.length,...v,...$?{styleId:$}:{}});}else {let $=Yb(w.paragraphId,w.start,w.end,c.text);if(!$)return false;T.push({op:"setHyperlinkTarget",linkId:w.id,...v},...$);}}else T.push({op:"setHyperlinkTarget",linkId:w.id,...v});let P=false;return e.commit(()=>{let N=o(T,e.selectionMark());return P=N.committed,N},()=>null),P}let k=b.from.paragraphId;if(b.to.paragraphId!==k)return false;let O=[],D=b.from.offset,L=b.to.offset;if(S){let T=c.text??c.url??c.anchor??"";if(T.length===0)return false;D=e.insertionLanding?.(k,D)??D,O.push({op:"insertText",paragraphId:k,offset:D,text:T}),L=D+T.length;}else {let T=e.replacementLanding?.(k,D,L);if(T!=null){let P=c.text??e.textOf(k).slice(D,L);if(P.length===0)return false;O.push(...Xb({paragraphId:k,start:D,end:L},T,P)),D=T,L=T+P.length;}else if(c.text!==void 0&&c.text!==e.textOf(k).slice(D,L)){let P=Yb(k,D,L,c.text);if(!P)return false;O.push(...P),L=D+c.text.length;}}if(L<=D)return false;let p=Gb(e.session);O.push({op:"insertHyperlink",paragraphId:k,start:D,end:L,...v,...p?{styleId:p}:{}});let A=false,Z={paragraphId:k,offset:L};return e.commit(()=>{let T=o(O,e.selectionMark(),{paragraphId:k,start:L,end:L});return A=T.committed,T},()=>({anchor:Z,head:Z})),A},removeHyperlink(c){if(!n())return false;let u=c?l(c):i();if(!u)return false;let g=false,m={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let y=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return g=y.committed,y},()=>({anchor:m,head:m})),g}}}function Gb(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function yC(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function Xb(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 Yb(e,t,n,r){if(r.length===0)return null;let o=[{op:"insertText",paragraphId:e,offset:t,text:r,bias:"right"}];return n>t&&o.push({op:"deleteText",paragraphId:e,start:t+r.length,end:n+r.length}),o}var bC="equation replacement and removal are not supported in suggesting mode",nv=new WeakMap;function rv(e,t){let n=Ga(e,t);if(!n||n.kind!=="paragraph")return [];let r=nv.get(n);if(r)return r;let o=[];for(let i of Ke$1(n)){let s=i.node;if(s.kind==="textValue"||s.kind!=="generic"||s.namespaceUri!==pc$1||s.localName!=="oMath")continue;let l=rc$1(s);l&&o.push(Object.freeze({id:s.id,paragraphId:t,start:i.start,end:i.end,linear:tc$1(l.expression),fallbackText:l.fallbackText,supported:tn(l.expression)}));}let a=Object.freeze(o);return nv.set(n,a),a}function tn(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(tn);case "fraction":return tn(e.numerator)&&tn(e.denominator);case "radical":return tn(e.radicand)&&(e.degree===void 0||tn(e.degree));case "script":return tn(e.base)&&(e.subscript===void 0||tn(e.subscript))&&(e.superscript===void 0||tn(e.superscript));case "nary":return tn(e.body)&&(e.lowerLimit===void 0||tn(e.lowerLimit))&&(e.upperLimit===void 0||tn(e.upperLimit))}}function ov(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function av(e){let t=null,n=i=>{let s=e.pagesLayer.ownerDocument.defaultView;if(!s||!(i instanceof s.Element))return null;let l=i.closest("[data-docx-equation]");return l&&e.pagesLayer.contains(l)?l:null},r=(i,s)=>{let l=e.equationById(i);l&&(e.setSelection({anchor:{paragraphId:l.paragraphId,offset:l.start},head:{paragraphId:l.paragraphId,offset:l.end}}),e.onPopover?.({equation:l,rect:s}));},o=i=>{t=null;let s=n(i.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}};},a=i=>{let s=n(i.target),l=s?.dataset.docxEquation,c=t;if(t=null,!s||!l){if(!c)return;i.preventDefault(),r(c.equationId,c.rect);return}let u=s.getBoundingClientRect();i.preventDefault(),r(l,{left:u.left,top:u.top,right:u.right,bottom:u.bottom});};return e.pagesLayer.addEventListener("pointerdown",o,true),e.pagesLayer.addEventListener("click",a),{destroy:()=>{e.pagesLayer.removeEventListener("pointerdown",o,true),e.pagesLayer.removeEventListener("click",a);}}}function iv(e){let t=()=>e.session.partFor(e.storyScope()),n=l=>{let c=t();return c?rv(c,l):[]},r=()=>{let l=e.selection().head;return ov(n(l.paragraphId),l)},o=l=>{let c=n(e.selection().head.paragraphId).find(u=>u.id===l);if(c)return c;for(let u of e.session.storyParts()){let g=Ga(u,l);if(!g||g.kind!=="generic"||g.namespaceUri!==pc$1||g.localName!=="oMath")continue;let m=g;for(;m&&m.kind!=="paragraph";)m=Ha$1(u,m.id);return !m||m.kind!=="paragraph"?null:rv(u,m.id).find(y=>y.id===l)??null}return null},a=(l,c)=>{let u=false,g={paragraphId:l.paragraphId,offset:l.start};return e.commit(()=>{let m=e.session.applyTreeOps([c],e.selectionMark(),{paragraphId:g.paragraphId,start:g.offset,end:g.offset},e.storyScope());return u=m.committed,m},()=>({anchor:g,head:g})),u},i=(l,c)=>{let u=o(l);if(!u)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest")return {ok:false,code:"unsupported",reason:bC};let g=c==="replace"?{op:"setMathEquation",equationId:l,linear:u.linear}:{op:"removeMathEquation",equationId:l},m=e.writeRefusal(g);return m===null?{ok:true}:{ok:false,code:"locked",reason:m}},s=l=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:l.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:i,applyEquation(l,c){let u=o(l);if(!u)return false;let g=i(l,"replace");return g.ok?u.supported&&u.linear===c?true:a(u,{op:"setMathEquation",equationId:l,linear:c}):s(g)},removeEquation(l){let c=o(l);if(!c)return false;let u=i(l,"remove");return u.ok?a(c,{op:"removeMathEquation",equationId:l}):s(u)}}}var vC=24;function sv(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=m=>{if(!m||m.length===0||m.startsWith("#"))return false;let y=L(m);return !y.ok||!y.href||!n?false:(n.open(y.href,"_blank","noopener,noreferrer"),true)},a=m=>{if(e.enterStoryFor&&!e.enterStoryFor(m.paragraphId))return false;let y=e.layout(),v=jf(y,m);if(!v)return false;let w=y.pages[v.pageIndex];if(!w)return false;let b=w.box.y+(w.contentBox.y-w.box.y)+v.y,S=r();return S&&(S.scrollTop=Math.max(0,b*e.scale()-vC),e.onScrolled?.()),e.setSelection(m),true},i=m=>{let y=e.bookmarks().get(m);return y?a(y):false},s=null;function l(m){if(!m||m.closest("[data-docx-hf]"))return null;let y=m.closest("a.docx-hyperlink");if(y){let w=y.dataset.docxLink;return w?{linkId:w,drawing:false}:null}let v=m.closest("[data-docx-drawing-link]");if(v){let w=v.dataset.docxDrawingLink;return w?{linkId:w,drawing:true}:null}return null}let c=m=>{s=null;let y=m.target,v=l(y);if(!v)return;let b=y.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();s={linkId:v.linkId,drawing:v.drawing,rect:{left:b.left,top:b.top,bottom:b.bottom,right:b.right}};},u=m=>{let y=m.target,v=l(y);if(!v){let S=s;if(s=null,!S)return;m.preventDefault(),g(S.linkId,S.rect,m,S.drawing);return}s=null,m.preventDefault();let b=y.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();g(v.linkId,{left:b.left,top:b.top,bottom:b.bottom,right:b.right},m,v.drawing);};function g(m,y,v,w){let b=w?e.drawingLinkById?.(m)??null:e.linkById(m);if(!b)return;if(v.metaKey||v.ctrlKey){b.kind==="external"?o(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:y});}}return t.addEventListener("pointerdown",c,true),t.addEventListener("click",u),{goToPosition:a,goToBookmark:i,openExternal:o,destroy(){t.removeEventListener("pointerdown",c,true),t.removeEventListener("click",u);}}}function xC(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 au(e,t){return e.drawingNodeId!==t?null:xC(e)}function lv(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=au(n,t);if(r)return r}return null}function SC(e,t){for(let r of e.anchoredDrawings??[]){let o=au(r,t);if(o)return o}for(let r of e.fragments){if(r.kind==="table"){for(let a of r.rows)for(let i of a.cells)for(let s of i.blocks){let l=cv(s,t);if(l)return l}continue}let o=dv(r,t);if(o)return o}let n=lv(e.header,t);return n||lv(e.footer,t)}function dv(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=au(r,t);if(o)return o}return null}function cv(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 a=cv(o,t);if(a)return a}return null}return dv(e,t)}function uv(e,t){for(let n of e.pages){let r=SC(n,t);if(r)return r}return null}function fv(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 Ha="the document is open for viewing",iu="image changes are not supported in suggesting mode",pv="tracked changes need a non-empty author";function mv(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Ha}}function n(){return {committed:false,rejected:true,opCount:0,reason:iu}}return {applyDrawingOps(r){if(e.editingMode()==="view")return t();if(e.editingMode()==="suggest")return n();let o=e.selectionMark(),a={committed:false,rejected:true,opCount:0};return e.commit(()=>(a=e.applyOps(r,o,o),a)),a},applyImageProperties(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Ha};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:iu};let o={ok:false,reason:"invalidArgs"};return e.commit(()=>(o=e.session.applyImageProperties(e.storyScope(),r),{committed:o.ok,rejected:!o.ok,opCount:o.ok?1:0,...o.ok?{}:{reason:o.detail??o.reason}})),o},deleteImage(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Ha};let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return {ok:false,reason:"invalidArgs",detail:pv};let i={ok:false,reason:"invalidArgs"};return e.commit(()=>(i=o?e.session.deleteImageTracked(e.storyScope(),r,{author:a,date:e.trackedDate()}):e.session.deleteImage(e.storyScope(),r),{committed:i.ok,rejected:!i.ok,opCount:i.ok?1:0,...i.ok?{}:{reason:i.detail??i.reason}})),i},insertImage(r){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Ha});let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:pv});let i=e.actorId();return e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort(),...o?{revision:{author:a,date:e.trackedDate()}}:{},...i?{actorId:i}:{}})},replaceImage(r,o,a,i){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Ha});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:iu});let s=e.actorId();return e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),{...i,...s?{actorId:s}:{}})}}}function gv(e){let t=null,n=null,r="",o=()=>{let c=e.session.part(),u=e.revisionDisplayMode(),g=e.revisionAuthorFilter();return {sections:Yc$1(c,u,g),sourceIndexes:Zc$2(c,u,g)}},a=c=>{let{sourceIndexes:u}=o(),g=u.indexOf(c);if(g!==-1)return g;let m=u.findIndex(y=>y>c);return m===-1?Math.max(0,u.length-1):m},i=()=>{if(!t)return;let c=bh(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;t?.scope.rId!==c.rId&&e.leaveOtherStories?.();let u=e.layout(),g=gh(u,c.rId),m=t,y=m?.scope.rId===c.rId,v=g?null:IC(e.session,c.rId);if(!g&&!v)return false;let w=c.pageIndex??(y&&m?m.pageIndex:g?.pageIndex??0),b=c.kind??(y&&m?m.kind:g?.kind??v.kind),S=c.variant??(y&&m?m.variant:g?.story.variant??v.variant),k=y&&m?m.partName:g?.story.partName??v.partName,O=u.pages[w]??u.pages[g?.pageIndex??0],D=(O?eo(O,{scope:{kind:"headerFooter",rId:c.rId},kind:b,partName:k}):null)??g?.story??{scope:{rId:c.rId},variant:S,partName:k},L=e.selection(),p=m?m.savedBodySelection:{anchor:{...L.anchor},head:{...L.head}},A=y&&m?.sectionIndex!==void 0&&w===m.pageIndex,Z=c.sectionIndex??(A?m.sectionIndex:g?e.sectionAtPage(w).sectionIndex:v?a(v.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:c.rId},pageIndex:w,...Z!==void 0?{sectionIndex:Z}:{},kind:b,variant:D.variant,partName:D.partName,savedBodySelection:p};let P=e.session.paragraphIdsIn(Vi(t))[0];if(!P)return t=null,false;let N=c.position?Ki(u,{anchor:c.position,head:c.position},t):y?Ki(u,L,t):{anchor:{paragraphId:P,offset:0},head:{paragraphId:P,offset:0}};return e.setScopeSelection(N),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;let c=t.savedBodySelection;t=null,e.setScopeSelection(Ki(e.layout(),c,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>mh(t),setActiveScope(c){return c.kind==="body"?(l(),true):c.kind==="headerFooter"?s({rId:c.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:i,headerFooterState(){if(!t)return null;let c=e.session.headerFooterResolutionBySection(),u=t.sectionIndex??0,g=o(),m,y,v,w=O=>{let D=g.sourceIndexes[O]??O,L=c[D];if(!L)return false;let A=(t.kind==="header"?L.headers:L.footers).get(t.variant);return !A||A.rId!==t.scope.rId?false:(u=O,m=A.inherited,y=L.titlePage,v=L.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&w(t.sectionIndex))){let O;c.forEach((D,L)=>{let A=(t.kind==="header"?D.headers:D.footers).get(t.variant);!A||A.rId!==t.scope.rId||!(O===void 0||O&&!A.inherited||O===A.inherited&&a(L)<u)||(u=a(L),m=A.inherited,y=D.titlePage,v=D.evenAndOddHeaders,O=A.inherited);});}let b=g.sections[u]?.properties??g.sections.at(-1)?.properties,S=b?.margins.headerTwips,k=b?.margins.footerTwips;return {editing:t.kind,sectionIndex:u,variant:t.variant,rId:t.scope.rId,partName:t.partName,...m!==void 0?{inherited:m}:{},...y!==void 0?{titlePage:y}:{},...v!==void 0?{evenAndOddHeaders:v}:{},...S!==void 0?{headerDistanceTwips:S}:{},...k!==void 0?{footerDistanceTwips:k}:{}}},headerFooterStateStable(c){if(!t)return n=null,r="",null;let u=this.headerFooterState();if(!u)return null;let g=[c,u.editing,u.sectionIndex,u.variant??"",u.rId??"",u.partName??"",String(u.inherited),String(u.titlePage),String(u.evenAndOddHeaders),String(u.headerDistanceTwips??""),String(u.footerDistanceTwips??"")].join("|");return n&&r===g||(n=Object.freeze({...u}),r=g),n}}}function IC(e,t){let n=e.headerFooterResolutionBySection();for(let r=0;r<n.length;r+=1){let o=n[r];for(let a of ["header","footer"]){let i=a==="header"?o.headers:o.footers;for(let[s,l]of i)if(l.rId===t)return {sectionIndex:r,kind:a,variant:s,partName:l.partName}}}return null}function yv(e){let t=null,n=null,r=null,o=(i,s)=>(e.setLastRejection(null),e.commit(()=>{let l=e.applyOps(Array.isArray(i)?i:[i],e.selectionMark());return l.rejected&&e.setLastRejection(String(l.reason??"rejected")),l},s),e.lastRejection()===null),a=(i,s,l)=>{let c=Zc$1(i);if(!c)return e.setLastRejection("invalid note scope id"),false;let u=e.session.currentPackage(),g=If(u,c.noteKind),m=g?td$1(g.root,c.noteId):null;if(!g||!m)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let y=e.selection();r={anchor:{paragraphId:y.anchor.paragraphId,offset:y.anchor.offset},head:{paragraphId:y.head.paragraphId,offset:y.head.offset}};}if(t={kind:"note",id:Yc$2(c.noteKind,c.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let y=wC(m),v=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:c.noteKind})),w=y.find(b=>v.has(b.id));if(w){let b=kC(w);e.setSelection({anchor:{paragraphId:w.id,offset:b},head:{paragraphId:w.id,offset:b}});}}return e.noteModelMoved(),e.render(),n??=e.revealNote(t.id),e.notify(),true};return {insertNote(i){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 u=hv(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset},()=>{let v={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:v,head:v}}))return s.ops.length>0&&e.undo(),false;let y=[...hv(e.session.currentPackage(),i)].find(v=>!u.has(v));return y===void 0?true:a(Yc$2(i,y))},deleteNote(i,s){return o({op:"deleteNote",noteKind:i,noteId:s})},convertNote(i,s){return o({op:"convertNote",fromKind:i,noteId:s})},convertAllNotes(i){return o({op:"convertAllNotes",fromKind:i})},setNoteProperties(i){return o({op:"setNoteProperties",scope:i.scope,sectionIndex:i.sectionIndex,footnote:i.footnote,endnote:i.endnote})},enterNote:a,exitNote(i=true){if(!t)return;let s=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),i&&s&&e.setSelection(s),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(i){!t||!Number.isInteger(i)||n!==i&&(n=i);}}}function wC(e){let t=[],n=(r,o)=>{if(!(o>32)){if(r.kind==="paragraph"){t.push(r);return}if("children"in r)for(let a of r.children)n(a,o+1);}};return n(e,0),t}function kC(e){let t=Ke$1(e)[0];return t&&cd$1(t.node)?t.end:0}function hv(e,t){let n=If(e,t),r=new Set;if(!n)return r;for(let o of rd$1(n.root)){if(!id$1(o))continue;let a=gd$1(o);a!==null&&r.add(a);}return r}var TC=500;function PC(e,t,n,r){let o=e.part(),a=Fb$1(o,n,r),i=Vc$1(o);return t.map((s,l)=>{let c=s.blockStart<s.blockEndExclusive?a[s.blockEndExclusive-1]:void 0,u=c?.kind==="paragraph"?Wc$1(c):void 0;return u||(l===t.length-1&&i?.kind!=="textValue"?i:void 0)})}function bv(e,t){if(!e)return null;let n=e.session,r=e.revisionDisplayMode(),o=e.state().selection.head.paragraphId,a=Da(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:bt(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),i=n.currentPackage(),s=xf(i),l=yf(s),c=zf(s),u=Yc$1(n.part(),r,t),g=PC(n,u,r,t),m=vf(g[a]),y=wf$1(g[a]),v=Af(m,l),w=Bf(y,c);return {sectionIndex:a,footnote:{resolved:v,...l?{documentAuthored:l}:{},...m?{sectionAuthored:m}:{}},endnote:{resolved:w,...c?{documentAuthored:c}:{},...y?{sectionAuthored:y}:{}}}}function vv(e,t){let n=Zc$1(t);if(!n)return null;let r=If(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=td$1(o.root,n.noteId);if(!a)return null;let i=[],s=TC,l=(u,g)=>{if(!(g>32||s<=0)){if(u.kind==="paragraph"&&typeof u.id=="string"){let m=(Nh$1(o,u.id)??"").replace(/\uFFFC/g,"").trim();if(m){let y=m.slice(0,s);i.push(y),s-=y.length;}return}if(u.kind!=="textValue")for(let m of u.children)l(m,g+1);}};l(a,0);let c=i.filter(Boolean).join(" ").trim();return c.length>0?c:null}function xv(e){return [()=>{Hb$1(e().root);},()=>{xa$1(e());},()=>{jh$1(e());}]}var CC=50,RC=16;function Sv(e){let t=e.schedule??((s,l)=>{let c=setTimeout(s,l);return ()=>clearTimeout(c)}),n=false,r=null,o=0,a=0,i=s=>{r=t(()=>{if(r=null,!(n||a>=e.steps.length||!e.shouldRun())){if(e.hasPendingInput()){if(o+=1,o>CC)return;i(RC);return}try{e.steps[a]();}catch{return}a+=1,a<e.steps.length&&i(0);}},s);};return i(0),()=>{n=true,r&&r(),r=null;}}var EC=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve"]);function Iv(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function su(e$1,t,n$1={}){let r=n$1,o$1=j(t,n$1.reviewModel?{reviewModel:n$1.reviewModel}:{});if(!o$1.ok)return {ok:false,reason:o$1.reason,...o$1.detail?{detail:o$1.detail}:{}};let a=o$1.session,i=n$1.collaborationModel?.session,s=n$1.author,l$2=n$1.scale??96/72,c={resolve:n$1.tableInteractionLabel??(d=>pc(d))},u="the document is open for viewing",g="the document is read-only",m="the table of contents is generated and read-only",y="\0range\0",v=()=>`${new Date().toISOString().slice(0,19)}Z`,w=n$1.measurer?null:Ke(l$2,{context:so(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),b=n$1.measurer??w.measurer,S=Ib$1(),k=Ee();function O(){return n$1.measurer?n$1.producer??"host-measurer":`${n$1.producer??w?.producer??"fixed-measurer"}@scale:${l$2}`}let D=O(),L=e$1.ownerDocument,p=L.createElement("div");p.className="docx-pages",p.style.position="relative",p.contentEditable="true",p.spellcheck=false,p.setAttribute("role","textbox"),p.setAttribute("aria-multiline","true"),p.style.outline="none";let A=L.createElement("div");A.className="docx-selection-overlay",A.contentEditable="false",A.setAttribute("aria-hidden","true"),A.style.position="absolute",A.style.left="0",A.style.top="0",A.style.pointerEvents="none";let Z=L.createElement("div");Z.className="docx-comment-overlay",Z.contentEditable="false",Z.setAttribute("aria-hidden","true"),Z.style.position="absolute",Z.style.left="0",Z.style.top="0",Z.style.pointerEvents="none";let T=L.createElement("div");T.className="docx-remote-selection-overlay",T.contentEditable="false",T.setAttribute("aria-hidden","true"),T.style.position="absolute",T.style.left="0",T.style.top="0",T.style.pointerEvents="none";let P=L.createElement("div");P.className="docx-table-furniture",P.contentEditable="false",P.style.position="absolute",P.style.left="0",P.style.top="0",P.style.pointerEvents="none",e$1.style.position="relative",e$1.replaceChildren(p,P,Z,T,A);let N=lb(p,()=>l$2,()=>{let d=re?.getActive()??null,f=ye$1?.activeNoteScope()??null,h=ye$1?.activeNotePageIndex()??null,I=d?hh(p,d.pageIndex):f?yh(p,f.id,h):null;return {layout:ae$1,selection:E,measurer:b,...d?{preferredPageIndex:d.pageIndex}:h!==null?{preferredPageIndex:h}:Ue.selectionPageIndex()!==void 0?{preferredPageIndex:Ue.selectionPageIndex()}:{},scopedHost:I,...d?{scopedHostKind:"headerFooter"}:f?{scopedHostKind:"note"}:{}}}),_=new Set(ye(a.part()).flatMap(d=>[d.beginParagraphId,...d.resultParagraphIds,d.endParagraphId])),M=a.paragraphIds(),$=M.find(d=>!_.has(d))??M[0]??"",E=r.initialSelection??{anchor:{paragraphId:$,offset:0},head:{paragraphId:$,offset:0}},G=r.initialDrawingSelectionIntent??{kind:"none"};function le(d,f){d.kind===G.kind&&(d.kind!=="pointer"||G.kind==="pointer"&&d.drawingNodeId===G.drawingNodeId)||(G=d,f&&n$1.onChange?.(Ze$1()));}let ne=null,F=null,j$1="suggesting needs an author before it can propose a change",z=false,X=false,Q=null,H=new Map;function J(){Q=null;for(let d of H.values())Q=d;}function ee$1(d,f){if(d.paragraphId===f.paragraphId)return d.offset-f.offset;let h=Fe();return h.indexOf(d.paragraphId)-h.indexOf(f.paragraphId)}function pe(d){if(!Q)return;let{from:f,to:h}=us(ae$1,Q),I=d.head;ee$1(I,f)>=0&&ee$1(I,h)<=0||(H.clear(),Q=null);}let R=null;function K(){return U()?.properties??null}function U(){if(!R)return null;let d=R.position,f=h=>h.paragraphId===d.paragraphId&&h.offset===d.offset;return f(E.anchor)&&f(E.head)?R:null}function de(d){if(!R)return;let f=R.position;d.anchor.paragraphId===f.paragraphId&&d.anchor.offset===f.offset&&d.head.paragraphId===f.paragraphId&&d.head.offset===f.offset||(R=null);}function Ie(d,f,h,I){let C=We([...d],h,I);return d.length===f.length||!C.rejected?C:We([...f],h,I)}function ce(d,f,h,I){let C=U();if(!C||h===0)return [];let B=R.position,q=I&&B.paragraphId===d&&B.offset>=I.start&&B.offset<=I.end?{paragraphId:d,offset:el({paragraphId:d,offset:I.start},{paragraphId:d,offset:I.end})}:ff(ae$1,B);return q.paragraphId!==d||q.offset!==f?[]:[{op:"setRunProperties",paragraphId:d,start:f,end:f+h,properties:C.properties.reduce((W,Y)=>la(W,pa(W,Y)),[...C.base])}]}let re=null,ye$1=null,we=null,ue=()=>Vi(re?.getActive()??null,ye$1?.activeNoteScope()??null),Be=()=>ye$1?.activeNoteScope()?.id??null,ke=d=>{let f=k.multi?.spans,h=0,I=0;if(f&&f.length>0)for(let C=0;C<f.length;C+=1){let B=f[C];if(h=C,I=B.startIndex,d<B.startIndex+B.pageCount)break}return {sectionIndex:h,sectionStart:I}},Fe=()=>to(ae$1,re?.getActive()??null,Be()),Oe=()=>globalThis.performance?.now()??Date.now(),Ot=0,Ce=0,Ae=0,{styleCascade:pt,numberingIndex:At,defaultTabStopPt:un,compatibilityMode:Qn}=Q0(a),Za=Y0({styleCascade:pt,partOf:d=>at(a,d)??a.part()}),za$2=null,fn=n$1.imageDecodePort??ab(L)??ib(),Et=md$1({session:a,decodePort:fn,onResourcesChanged:()=>za$2?.()}),Kt=n$1.drawingStrings??h,bo=n$1.tocLabels,vo=()=>E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset?null:{paragraphId:E.head.paragraphId,offset:E.head.offset},xo=-1,Va=true,Or=()=>{let d=a.packageRevision();return xo!==d&&(xo=d,Va=!tg$1(a.settingsRoot()).doNotShadeFormData),Va},So=sb({mintValidatedBytes:(d,f)=>Et.mintValidatedBytes(d,f)}),Mt=()=>n$1.revisionDisplayMode??qb$1,nn=r.revisionAuthorVisibility??ds(n$1.hiddenRevisionAuthors),wt=()=>nn.filterForSession(a),Io=d=>{let f=at(a,d)??a.part(),h=Ga(f,d);if(h?.kind!=="paragraph")return false;let I=Mt(),C=wt();if(!Cb$1(h,I,C))return true;let B=Ha$1(f,d);return B?Eb$2(B.children,I,C).some(q=>q.kind==="paragraph"&&q.id===d):false},_n,wo=ae(a),Jn=be$1(),Ar=d=>J0({session:a,measurer:b,producer:D,cache:S,styleCascade:pt,numberingIndex:At,defaultTabStopPt:un,compatibilityMode:Qn,displayMode:Mt(),revisionAuthorFilter:d,inlineDrawingLayoutForPart:f=>Et.contextForPart(f),drawingLayoutTokenForPart:f=>Et.cacheTokenForPart(f),drawingTokenForParagraphForPart:(f,h)=>Et.drawingTokenForParagraph(h,f),linkProjectors:wo,projectFieldLink:f=>Jn.project(f)});_n=Ar(wt());let er={...a,applyTreeOps:(d,f,h,I)=>We(d,f,h,I),ensureListDefinition:d=>Mb$1(i?.identity.actorId,()=>a.ensureListDefinition(d)),applyPmDoc:d=>ze==="view"?{committed:false,rejected:true,opCount:0,reason:u}:i?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:Gs()?{committed:false,rejected:true,opCount:0,reason:m}:a.applyPmDoc(d)},ae$1=oe(),In=n$1.revisionStyles,Mr=r.reviewAuthorSlots??e(),Lt=Ky({layout:()=>ae$1,items:()=>a.reviewItems(),styles:()=>In,slots:Mr});function Lr(d){if(d===null||d.length===0){if(!R)return;R=null;}else {let{anchor:f,head:h}=E;if(f.paragraphId!==h.paragraphId||f.offset!==h.offset)return;let I=U()?.base??Sb(a.partFor(ue())??a.part(),h.paragraphId,h.offset,Mt(),wt());R={position:h,properties:d,base:I};}n$1.onChange?.(Ze$1());}let Bs=Pb({session:er,storyScope:ue,paragraphOrder:Fe,layout:()=>ae$1,selection:()=>E,displayMode:()=>Mt(),authorFilter:wt,paragraphMarkVisible:Io,commit:(d,f,h)=>Ne(d,f,h),orderedRange:()=>qn(),selectionMark:()=>Ve(),textOf:d=>Ct(d),selectedCells:()=>ne?.cellIds,defaultParagraphStyleId:()=>pt()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n$1.defaultFontFamily??null,pendingFormats:()=>K(),setPendingFormats:Lr}),pn=Rb({session:er,storyScope:ue,layout:()=>ae$1,selection:()=>E,displayMode:()=>Mt(),authorFilter:wt,paragraphMarkVisible:Io,commit:(d,f,h)=>Ne(d,f,h),orderedRange:()=>qn(),selectionMark:()=>Ve(),textOf:d=>Ct(d),paragraphOrder:Fe,selectedCells:()=>ne?.cellIds,armPendingFormats:d=>Lr(d),now:Oe,publish:()=>{pn.state().mode!=="off"?p.dataset.formatPainter="":delete p.dataset.formatPainter,n$1.onChange?.(Ze$1());}}),tr=Ub({session:er,storyScope:ue,headerFooterSectionIndex:()=>re?.getActive()?.sectionIndex,revisionDisplayMode:Mt,revisionAuthorFilter:wt,paragraphOrder:Fe,selectedCells:()=>ne?.cellIds,editingMode:()=>ze,publishRefusal:d=>{F=d,n$1.onChange?.(Ze$1());},caretParagraphId:()=>E.anchor.paragraphId===E.head.paragraphId&&E.anchor.offset===E.head.offset?E.head.paragraphId:null,layout:()=>ae$1,commit:(d,f,h)=>Ne(d,f,{rearmPending:U()??void 0,...h?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Js(),orderedRange:()=>qn(),selectionMark:()=>Ve(),collapsedAt:d=>_e(d),deleteSelectionPlan:()=>Pn(),paragraphTextOf:d=>Ct(d),numberingLevelExists:(d,f)=>jd$1(Ic$1(At(),pt()),d,f)!==null});function Ka(d,f,h){return ze!=="suggest"?null:el({paragraphId:d,offset:f},{paragraphId:d,offset:h})}let Nr=tv({session:er,layout:()=>ae$1,fieldLinkById:d=>Jn.linkById(d),refusesWrite:()=>rr(true)!==null,withMintActor:d=>Mb$1(i?.identity.actorId,d),storyScope:ue,replacementLanding:Ka,insertionLanding:(d,f)=>ff(ae$1,{paragraphId:d,offset:f}).offset,selection:()=>E,orderedRange:()=>qn(),selectionMark:()=>Ve(),textOf:d=>Ct(d),commit:(d,f)=>Ne(d,f)}),ko=iv({session:er,storyScope:ue,editingMode:()=>ze,writeRefusal:d=>rr(true,[d]),selection:()=>E,selectionMark:()=>Ve(),commit:(d,f)=>Ne(d,f)}),ja=d=>{let f=bt(a,d,{kind:"body"});if(f.kind==="body")return ye$1?.exitNote(),re?.exitHeaderFooter(),true;if(f.kind==="headerFooter"){let I=re?.activeScope();return I?.kind==="headerFooter"&&I.rId===f.rId?true:(ye$1?.exitNote(),re?.enterHeaderFooter({rId:f.rId})??false)}let h=To(d);return h?ye$1?.activeNoteScope()?.id===h?true:(re?.exitHeaderFooter(),ye$1?.enterNote(h)??false):false},To=d=>{for(let f of ae$1.pages)for(let h of [f.footnotes,f.endnotes])if(h){for(let I of h.notes)for(let C of za$1(I.fragments))if(C.paragraphId===d)return I.scopeId}return null},mn=sv({pagesLayer:p,container:e$1,scale:()=>l$2,layout:()=>ae$1,bookmarks:()=>a.bookmarks(),linkById:d=>Jn.linkById(d)??Nr.linkById(d),drawingLinkById:d=>uv(ae$1,d),setSelection:d=>gt(_e(d)),enterStoryFor:d=>ja(d),isCollapsedSelection:()=>E.anchor.paragraphId===E.head.paragraphId&&E.anchor.offset===E.head.offset,onScrolled:()=>Xa(),...n$1.onHyperlinkPopover?{onPopover:n$1.onHyperlinkPopover}:{}}),x=av({pagesLayer:p,equationById:d=>ko.equationById(d),setSelection:gt,...n$1.onEquationPopover?{onPopover:n$1.onEquationPopover}:{}});p.addEventListener("contextmenu",Du),p.addEventListener("click",Hu),p.addEventListener("pointermove",Eu),p.addEventListener("pointerleave",Ou);let V=null;function te(d,f,h){let I=h?h.authorFilter:wt(),C=h?.layoutSession??k,B=h?.furnitureSource??_n;return f&&Gc$1(C,f),Et.sync(a),l({view:a,revision:d,measurer:b,cache:S,session:C,producer:D,styleCascade:pt,defaultTabStopPt:un,numberingIndex:At,furniture:B,compatibilityMode:Qn,linkProjectors:wo,projectFieldLink:q=>Jn.project(q),inlineDrawingLayout:Et.bodyContext,inlineDrawingLayoutForPart:q=>Et.contextForPart(q),drawingTokenForParagraph:q=>Et.drawingTokenForParagraph(q,a.part().name),drawingTokenForParagraphForPart:(q,W)=>Et.drawingTokenForParagraph(W,q),drawingLayoutEpoch:Et.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:q=>Et.cacheTokenForPart(q),displayMode:Mt(),revisionAuthorFilter:I})}function ve(){return te(a.packageRevision(),void 0,{layoutSession:Ee(),furnitureSource:Ar(void 0)})}function oe(){let d=Oe(),f=te(a.packageRevision());return Ot=Oe()-d,f}let he$1=null,Pe=null,Ee$1=false;function ge(){if(Ee$1)return;Ee$1=true;let d=a.packageRevision();Pe=Sv({steps:xv(()=>a.part()),shouldRun:()=>ze!=="view"&&a.editable&&a.packageRevision()===d,hasPendingInput:He});}function He(d=true){return e$1.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:d})??false}function qe(){if(!He()){Pt(),ge();return}he$1===null&&(he$1=setTimeout(()=>{he$1=null,ct.pending()===null&&(Pt(),ge());},0));}let Le="",Ge=null,gn=false;function dt(){if(gn||(Ge!==null&&(clearTimeout(Ge),Ge=null),Le.length===0))return;let d=Le;Le="",gn=true;try{Ke$1.type(d);}catch(f){throw Le=d+Le,f}finally{gn=false;}}function Dr(d){Le+=d,Ge===null&&(Ge=setTimeout(()=>{Ge=null,dt();},0));}function Po(d,f,h){dt();let I=h?.trim()||s?.trim();if(!I)return F="tracked changes need a non-empty author",n$1.onChange?.(Ze$1()),false;if(d!=="deletion"&&f.length===0)return F=`${d} requires non-empty text`,n$1.onChange?.(Ze$1()),false;if(d!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(f))return F=`${d} requires text without a paragraph mark`,n$1.onChange?.(Ze$1()),false;let C={author:I,date:v()},B=qn(),q=B.from.paragraphId===B.to.paragraphId&&B.from.offset===B.to.offset;if(d!=="insertion"&&q&&!(d==="replacement"&&ne))return F=`${d} needs a non-collapsed selection`,n$1.onChange?.(Ze$1()),false;let W=d==="insertion"?{ops:[],collapseTo:ff(ae$1,B.from)}:Pn(I),Y=Vu(W.ops,C,zu()),me=W.collapseTo;if(d==="insertion"||d==="replacement"){let se=d==="replacement"?W.replaceAt??W.collapseTo:W.collapseTo;Y.push({op:"insertText",paragraphId:se.paragraphId,offset:se.offset,text:f,revision:C}),me={paragraphId:se.paragraphId,offset:se.offset+f.length};}let ie=false;return Ne(()=>{let se=We(Y,Ve(),$n(me));return ie=se.committed,se},()=>_e(me)),ie}let ct=Xe({run:d=>{let f=Oe(),h=te(d.revision,d);return Ot=Oe()-f,h},currentRevision:()=>a.packageRevision(),schedule:d=>{let f=setTimeout(d,0);return ()=>clearTimeout(f)},publish:d=>{Lt.releaseLayout(),ae$1=d,qe();}}),Hr=false;za$2=()=>{ct.invalidateAll(a.packageRevision(),"drawing-resources"),!Hr&&(Hr=true,setTimeout(()=>{Hr=false,it();},0));};let Ua=a.subscribe(d=>{hS(d),R=null,ct.notify(d);}),Bn=i?a.collaborationPort(i.documentId):null,$e$1=()=>{},rt=()=>{},kt=false,mt=null,Tt=null,jt=i?i.subscribeRemoteSelections(()=>{kt&&Qa();}):()=>{};function Wa(){let d=nb(e$1,ae$1,E,l$2),f=re?.getActive()?.pageIndex??Ue.selectionPageIndex();return f===void 0||d===void 0||d.has(f)?d:new Set([...d,f])}function it(){return ct.pending()?ct.flush():false}let Co=8;function zx(d){!d&&ct.pending()!==null&&Ot>Co&&He(false)||it()||Pt();}function Xe$1(){dt(),it();}function $s(){dt();let d=it();return he$1!==null?(Pt(),ge(),true):d}let Ro=null;function Vx(d){return d.contentControlId??`toc:${d.id}`}function Cu(d){return ye(a.part()).find(f=>f.beginParagraphId===d||f.endParagraphId===d||f.resultParagraphIds.includes(d))}function Kx(){for(let d of p.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(d.getAttribute("data-docx-content-control")===Ro){d.dataset.hover="",d.dataset.boundaryVisible="";continue}delete d.dataset.hover,z||delete d.dataset.boundaryVisible;}}function Ru(d){Ro!==d&&(Ro=d,Kx());}function Eu(d){let h=d.target?.closest("[data-paragraph-id]")?.dataset.paragraphId,I=h?Cu(h):null;Ru(I?Vx(I):null);}function Fu(d){let f=d.target,h=f?.isConnected?f.closest("[data-paragraph-id]"):void 0;if(h)return h.dataset.paragraphId;let I=p.ownerDocument;return typeof I.elementFromPoint!="function"?void 0:I.elementFromPoint(d.clientX,d.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function Ou(){Ru(null);}function jx(){let d=nr(),f=ee(a.part()),I=ye(a.part()).map(se=>{let st=Ux(se);return st?{...st,empty:f.has(se.beginParagraphId)}:null}).filter(se=>se!==null),C=new Set(I.map(se=>se.boundary.id)),B=new Set(I.filter(se=>se.empty).map(se=>se.boundary.id)),q=d&&!C.has(d.id)?new Set([d.id]):void 0,W=Ro?new Set([Ro]):void 0,Y=new Set(mf(ae$1).filter(se=>se.controlType==="checkbox"&&Nu(se.id)).map(se=>se.id)),me=I.filter(se=>se.additional&&!se.empty).map(se=>se.boundary),ie=Zu()!==null;if(!(!z&&!q&&!W&&!ie&&Y.size===0&&me.length===0&&C.size===0))return {...ie?{readOnly:true}:{},...z?{showAll:true}:{},...q?{activeIds:q}:{},...W?{hoverIds:W}:{},...Y.size>0?{checkedIds:Y}:{},...me.length>0?{additionalBoundaries:me}:{},...C.size>0?{tocControlIds:C}:{},...B.size>0?{suppressedIds:B}:{}}}function Ux(d){let f=d.contentControlId?mf(ae$1).find(C=>C.id===d.contentControlId):void 0;if(f)return {tocId:d.id,boundary:f,additional:false};let h=new Set([d.beginParagraphId,...d.resultParagraphIds,d.endParagraphId]),I=ae$1.pages.flatMap(C=>{let B=ya$1(C).filter(ie=>h.has(ie.paragraphId)).map(ie=>ie.box);if(B.length===0)return [];let q=Math.min(...B.map(ie=>ie.x)),W=Math.min(...B.map(ie=>ie.y)),Y=Math.max(...B.map(ie=>ie.x+ie.width)),me=Math.max(...B.map(ie=>ie.y+ie.height));return [{pageIndex:C.index,box:{x:q,y:W,width:Y-q,height:me-W}}]});return I.length===0?null:{tocId:d.id,additional:true,boundary:{id:`toc:${d.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:I}}}let Eo=null;function nr(){let d=ue();if(d.kind!=="body")return Xx(d);if(Eo&&Eo.layout===ae$1&&Eo.selection===E)return Eo.result;let f=Wx();return Eo={layout:ae$1,selection:E,result:f},f}function Wx(){let d=jf(ae$1,E.head,b);if(!d)return null;let f=lf(ae$1,{x:d.x,y:d.y+d.height/2,pageIndex:d.pageIndex});return f&&Gx(f.id)===a.part().name?f:null}function Gx(d){let f=d.indexOf("#");return f===-1?"":d.slice(0,f)}function Xx(d){let f=a.partFor(d);return f?ie(f,E.head.paragraphId):null}function Au(d){return d.bound?"bound":d.effectiveLock==="contentLocked"||d.effectiveLock==="sdtContentLocked"?"locked":null}function Yx(d){return d.effectiveLock==="sdtLocked"||d.effectiveLock==="sdtContentLocked"?"locked":null}function Qx(d){return Cd$1(d)}function _r(d){let f=at(a,d),h=Ga(f??a.part(),d);return !h||!Qx(h)?null:h}function Mu(d){let f=_r(d);if(!f)return null;for(let h of f.children)if(h.kind!=="textValue"&&(h.kind==="contentControlProperties"||h.localName==="sdtPr"))for(let I of h.children){if(I.kind==="textValue"||I.localName!=="tabIndex")continue;let C=I.attributes.find(q=>q.localName==="val")?.value;if(C===void 0)return null;let B=Number(C);return Number.isFinite(B)?B:null}return null}function Jx(){let d=ue(),f=d.kind==="body"?null:a.partFor(d),h=d.kind==="notesPart"?new Set(Fe()):void 0;return (f?[...he(f,h)]:[...mf(ae$1)]).filter(C=>Au(C)===null).sort((C,B)=>{let q=Mu(C.id),W=Mu(B.id);return q!==null&&W!==null&&q!==W?q-W:q!==null&&W===null?-1:q===null&&W!==null?1:0})}function Lu(d){for(let f of d.children)if(f.kind!=="textValue"&&(f.kind==="contentControlContent"||f.localName==="sdtContent"))return f.children;return []}function eS(d){let f=_r(d);if(!f)return false;let h=Lu(f),I=[],C=me=>{for(let ie of me){if(ie.kind==="paragraph"){I.push({id:ie.id,length:Me$2(ie).length});continue}if(ie.kind==="textValue")continue;if(ie.kind==="contentControl"){C(Lu(ie));continue}C(ie.children);}};if(C(h),I.length>0){let me=I[0],ie=I[I.length-1];return gt({anchor:{paragraphId:me.id,offset:0},head:{paragraphId:ie.id,offset:ie.length}}),true}let B=null,q=0,W=0,Y=me=>{for(let ie of me){if(ie.kind==="paragraph"){let se=Me$2(ie).spanOf(f);if(!se)continue;return B=ie.id,q=se.start,W=se.end,true}if(ie.kind!=="textValue"&&Y(ie.children))return true}return false};return Y((a.partFor(bt(a,d,ue()))??a.part()).root.children),B?(gt({anchor:{paragraphId:B,offset:q},head:{paragraphId:B,offset:W}}),true):false}function tS(d){let f=_r(d);if(!f)return [];for(let h of f.children)if(h.kind!=="textValue"&&!(h.kind!=="contentControlProperties"&&h.localName!=="sdtPr"))for(let I of h.children){if(I.kind==="textValue"||I.localName!=="dropDownList"&&I.localName!=="comboBox")continue;let C=[];for(let B of I.children){if(B.kind==="textValue"||B.localName!=="listItem")continue;let q=B.attributes.find(Y=>Y.localName==="value")?.value??"",W=B.attributes.find(Y=>Y.localName==="displayText")?.value??q;C.push({displayText:W,value:q});}return C}return []}function Nu(d){let f=_r(d);if(!f)return false;for(let h of f.children)if(h.kind!=="textValue"&&!(h.kind!=="contentControlProperties"&&h.localName!=="sdtPr")){for(let I of h.children)if(I.kind==="contentControlCheckbox")for(let C of I.children){if(C.kind!=="contentControlChecked")continue;let B=C.attributes.find(q=>q.localName==="val")?.value;return !(B==="0"||B==="false"||B==="off")}}return false}function nS(d){let f=_r(d);if(f){for(let h of f.children)if(h.kind==="contentControlProperties"){for(let I of h.children)if(I.kind==="contentControlDate")return I.attributes.find(C=>C.localName==="fullDate")?.value}}}function qs(d,f){for(let h of p.querySelectorAll("[data-docx-content-control]"))h.getAttribute("data-docx-content-control")===d&&(f?h.dataset.open="":delete h.dataset.open);}function wn(d){let f=d.dataset.docxCcId;d.remove(),f&&qs(f,false);}function Zs(){let d=p.querySelector(".docx-content-control-menu");d&&wn(d);}function Du(d){let f=Fu(d),h=f?Cu(f):void 0;rS(h&&Qs(h.id)?h.id:null);}let Fo=null;function rS(d){Fo!==d&&(Fo=d,n$1.onChange?.(Ze$1()));}function Hu(d){if(d.button!==0||d.target?.closest("a.docx-hyperlink")||E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)return;let f=Fu(d);if(!f)return;let h=ye(a.part()).find(B=>B.resultParagraphIds.includes(f));if(!h)return;let C=df(a.part(),h,a.documentOutline(),Xs(h))[h.resultParagraphIds.indexOf(f)];C&&(d.preventDefault(),mn.goToPosition({paragraphId:C,offset:0}));}function oS(d,f){let h=kn.disabledReason(d,"edit");if(h){F=h,n$1.onChange?.(Ze$1());return}if(f==="checkbox"){kn.setValue(d,Nu(d)?"false":"true");return}if(f==="dropdown"||f==="comboBox"){let I=tS(d);if(I.length===0&&f==="dropdown")return;Zs();let C=L.createElement("div");C.className="docx-content-control-menu",C.dataset.docxMarker="",C.dataset.docxCcId=d,C.setAttribute("contenteditable","false"),C.setAttribute("role","listbox"),C.style.position="absolute",C.style.zIndex="20",C.style.pointerEvents="auto",C.addEventListener("pointerdown",Y=>Y.stopPropagation());let q=mf(ae$1).find(Y=>Y.id===d)?.fragments[0];if(q){let Y=ae$1.pages[q.pageIndex],me=et?.pageOffsetX.get(q.pageIndex)??0;if(Y){let ie=Y.contentBox.x-Y.box.x,se=Y.contentBox.y-Y.box.y;C.style.left=`${(Y.box.x+me+ie+q.box.x+q.box.width)*l$2}px`,C.style.top=`${(Y.box.y+se+q.box.y+q.box.height)*l$2}px`,C.style.transform="translateX(-100%)";}}for(let Y of I){let me=L.createElement("button");me.type="button",me.className="docx-content-control-menu-item",me.dataset.docxMarker="",me.setAttribute("contenteditable","false"),me.setAttribute("role","option"),me.textContent=Y.displayText,me.addEventListener("mousedown",ie=>{ie.preventDefault(),ie.stopPropagation(),wn(C),kn.setValue(d,Y.value);}),C.append(me);}if(f==="comboBox"){let Y=L.createElement("input");Y.type="text",Y.className="docx-content-control-menu-input",Y.dataset.docxMarker="",Y.setAttribute("contenteditable","false"),Y.addEventListener("mousedown",me=>me.stopPropagation()),Y.addEventListener("keydown",me=>{me.key==="Enter"&&(me.preventDefault(),wn(C),kn.setValue(d,Y.value));}),C.append(Y);}p.append(C),qs(d,true);let W=Y=>{C.contains(Y.target)||(wn(C),L.removeEventListener("mousedown",W,true));};L.addEventListener("mousedown",W,true);return}if(f==="date"){Zs();let I=L.createElement("div");I.className="docx-content-control-menu",I.dataset.docxMarker="",I.dataset.docxCcId=d,I.setAttribute("contenteditable","false"),I.style.position="absolute",I.style.zIndex="20",I.style.pointerEvents="auto",I.addEventListener("pointerdown",De=>De.stopPropagation());let C=mf(ae$1).find(De=>De.id===d),B=C?.fragments[0];if(B){let De=ae$1.pages[B.pageIndex],ir=et?.pageOffsetX.get(B.pageIndex)??0;if(De){let zo=De.contentBox.x-De.box.x,Vo=De.contentBox.y-De.box.y;I.style.left=`${(De.box.x+ir+zo+B.box.x+B.box.width)*l$2}px`,I.style.top=`${(De.box.y+Vo+B.box.y+B.box.height)*l$2}px`,I.style.transform="translateX(-100%)";}}I.classList.add("docx-content-control-calendar");let q=nS(d),W=q?new Date(q):new Date,Y=Number.isNaN(W.getTime())?null:W,me=Y??new Date,ie=me.getFullYear(),se=me.getMonth(),st=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Zn=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),qr=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),qo=De=>`${De.getFullYear().toString().padStart(4,"0")}-${(De.getMonth()+1).toString().padStart(2,"0")}-${De.getDate().toString().padStart(2,"0")}`,Zo=(De,ir)=>De.getFullYear()===ir.getFullYear()&&De.getMonth()===ir.getMonth()&&De.getDate()===ir.getDate(),Sf=null,sl=()=>{let De=L.createElement("input");De.type="date",De.className="docx-content-control-calendar-input",De.value=Y?qo(Y):"";let ir=De.value;C?.alias&&De.setAttribute("aria-label",C.alias);let zo=()=>{if(!De.value||De.value===ir)return false;let xt=De.value;return wn(I),kn.setValue(d,xt),true};Sf=zo,De.addEventListener("keydown",xt=>{xt.key==="Enter"&&(xt.preventDefault(),zo()||wn(I));}),De.addEventListener("blur",()=>{queueMicrotask(()=>{!I.isConnected||I.contains(L.activeElement)||zo()||wn(I);});});let Vo=L.createElement("div");Vo.className="docx-content-control-calendar-header";let sr=L.createElement("button");sr.type="button",sr.className="docx-content-control-calendar-nav",sr.textContent="\u2039";let MS=new Date(ie,se-1,1);sr.setAttribute("aria-label",st.format(MS));let ll=L.createElement("div");ll.className="docx-content-control-calendar-title",ll.textContent=st.format(new Date(ie,se,1));let lr=L.createElement("button");lr.type="button",lr.className="docx-content-control-calendar-nav",lr.textContent="\u203A";let LS=new Date(ie,se+1,1);lr.setAttribute("aria-label",st.format(LS)),sr.addEventListener("mousedown",xt=>xt.stopPropagation()),lr.addEventListener("mousedown",xt=>xt.stopPropagation()),sr.addEventListener("click",()=>{se-=1,se<0&&(se=11,ie-=1),sl();}),lr.addEventListener("click",()=>{se+=1,se>11&&(se=0,ie+=1),sl();}),Vo.append(sr,ll,lr);let dl=L.createElement("div");dl.className="docx-content-control-calendar-weekdays";for(let xt=0;xt<7;xt+=1){let Cn=L.createElement("span");Cn.textContent=qr.format(new Date(2024,0,1+xt)),dl.append(Cn);}let oi=L.createElement("div");oi.className="docx-content-control-calendar-grid",oi.setAttribute("role","grid");let NS=(new Date(ie,se,1).getDay()+6)%7,DS=new Date;for(let xt=0;xt<42;xt+=1){let Cn=new Date(ie,se,xt-NS+1),Wt=L.createElement("button");Wt.type="button",Wt.className="docx-content-control-calendar-day",Wt.textContent=String(Cn.getDate()),Wt.setAttribute("role","gridcell"),Wt.setAttribute("aria-label",Zn.format(Cn)),Cn.getMonth()!==se&&(Wt.dataset.otherMonth=""),Y&&Zo(Cn,Y)&&(Wt.dataset.selected="",Wt.setAttribute("aria-selected","true")),Zo(Cn,DS)&&(Wt.dataset.today=""),Wt.addEventListener("mousedown",HS=>HS.stopPropagation()),Wt.addEventListener("click",()=>{wn(I),kn.setValue(d,qo(Cn));}),oi.append(Wt);}I.replaceChildren(De,Vo,dl,oi);};sl(),p.append(I),qs(d,true);let If=De=>{I.contains(De.target)||(Sf?.()||wn(I),L.removeEventListener("mousedown",If,true));};L.addEventListener("mousedown",If,true),I.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}let kn={setShowAll(d){z!==d&&(z=d,Pt());},setFormFill(d){X!==d&&(X=d,n$1.onChange?.(Ze$1()));},showAll:()=>z,formFill:()=>X,atCaret:()=>nr(),navigate(d){let f=Jx();if(f.length===0)return false;let h=nr(),I=h?f.findIndex(B=>B.id===h.id):-1;d==="next"?I=I<0?0:(I+1)%f.length:I=I<0?f.length-1:(I-1+f.length)%f.length;let C=f[I];return eS(C.id)},setValue(d,f){let h=kn.disabledReason(d,"edit");if(h)return F=h,n$1.onChange?.(Ze$1()),false;let I=false;return Ne(()=>{let C=We([{op:"setContentControlValue",controlId:d,value:f}],Ve(),void 0,bt(a,d,ue()),false);return I=C.committed,C}),I},remove(d){let f=d??nr()?.id;if(!f)return F="notFound",n$1.onChange?.(Ze$1()),false;let h=kn.disabledReason(f,"remove");if(h)return F=h,n$1.onChange?.(Ze$1()),false;let I=false;return Ne(()=>{let C=We([{op:"removeContentControl",controlId:f}],Ve(),void 0,bt(a,f,ue()),false);return I=C.committed,C}),I},disabledReason(d,f){let h=Zu();if(h!==null)return h;let I=mf(ae$1).find(B=>B.id===d);if(I)return f==="remove"?Yx(I):Au(I);let C=_r(d);if(!C)return "notFound";for(let B of C.children)if(B.kind!=="textValue"&&!(B.kind!=="contentControlProperties"&&B.localName!=="sdtPr")){if(B.children.some(q=>q.kind!=="textValue"&&q.localName==="dataBinding")&&f==="edit")return "bound";for(let q of B.children){if(q.kind==="textValue"||q.localName!=="lock")continue;let W=q.attributes.find(Y=>Y.localName==="val")?.value;if(f==="remove"){if(W==="sdtLocked"||W==="sdtContentLocked")return "locked"}else if(W==="contentLocked"||W==="sdtContentLocked")return "locked"}}return null}};function zs(){let d=Bu&&ze!=="view";p.contentEditable=d?"true":"false",p.setAttribute("aria-readonly",d?"false":"true");}function Ze$1(){return {revision:a.packageRevision(),pageCount:ae$1.pages.length,selection:E,cellSelection:ne,canUndo:i?.canUndo()??a.canUndo(),canRedo:i?.canRedo()??a.canRedo(),collaborationStatus:i?.status()??"inactive",lastRejection:F,pendingFormat:K(),contentControls:{showAll:z,formFill:X,activeControlId:nr()?.id??null},contextTocId:Fo,formatPainter:pn.state(),perf:{layoutMs:Ot,paintMs:Ce,selectionMs:Ae,placed:k.stats.placed,total:k.stats.total,reusedPages:k.stats.reusedPages,fullPasses:k.stats.fullPasses,staleDiscards:ct.staleDiscards,cancelledRuns:ct.cancelledRuns}}}let Ut,et,Vs=null,Ga$1=false,Oo=null,Ks=null;function aS(d){for(let f of ae$1.pages){let h=p.children.item(f.index);if(h?.dataset.pageIndex!==String(f.index))continue;let I=d.pageOffsetX.get(f.index)??0;h.style.left=`${(f.box.x+I)*l$2}px`;}}function Pt(d=true){he$1!==null&&(clearTimeout(he$1),he$1=null,d=true);let f=Ue.adoptBeforePaint(),h=Oe();Ut=Wa(),re?.reconcileOccurrence();let I=re?.getActive()??null,C=jx(),B=ee(a.part());n(p,ae$1,{scale:l$2,readOnlyParagraphIds:ei(),...B.size>0?{emptyTocPlaceholderIds:B}:{},...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},...n$1.defaultFontFamily?{defaultFontFamily:n$1.defaultFontFamily}:{},materialize:Ut,ariaHidden:false,drawingStrings:Kt,...n$1.fieldShading?{fieldShading:n$1.fieldShading}:{},...In!==void 0?{revisionStyles:In}:{},shadeFormFields:Or(),...So?{imageUrlPort:So}:{},...I?{activeHeaderFooterRId:I.scope.rId,activeHeaderFooterPageIndex:I.pageIndex}:{},...C?{contentControlChrome:C}:{}},Lt.get().value),Sc(p,vo(),{domReplaced:true}),xh(e$1,p,I!=null),Fd(e$1,ze),et=xs(ae$1,Ut),aS(et),p.style.width=`${et.width*l$2}px`,p.style.height=`${et.height*l$2}px`,e$1.style.width=`${et.width*l$2}px`,e$1.style.height=`${et.height*l$2}px`,A.style.width=`${et.width*l$2}px`,A.style.height=`${et.height*l$2}px`,Z.style.width=A.style.width,Z.style.height=A.style.height,T.style.width=A.style.width,T.style.height=A.style.height,P.style.width=A.style.width,P.style.height=A.style.height,$o.update(),Ce=Oe()-h,Ho(),Qa(),$r(true),xf$2(),Ue.mirrorToDom(),_u(Ga$1),Ga$1=false,(d||f)&&n$1.onChange?.(Ze$1());}function Xa(){Xe$1();let d=Wa(),f=xs(ae$1,d);et&&_c(d,Ut)&&rb(f,et)||Pt(false);}function _u(d=false){if(re?.getActive()||ye$1?.activeNoteScope()||E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)return;let f=L.activeElement;if(f!==p&&(!f||!p.contains(f)))return;let h=jf(ae$1,E.head,{measurer:b,...Ue.selectionPageIndex()!==void 0?{preferredPageIndex:Ue.selectionPageIndex()}:{}});if(!h)return;let I=Vs!==null&&Vs!==h.pageIndex;if(Vs=h.pageIndex,!d&&!I)return;let C=ae$1.pages[h.pageIndex],B=Vt(e$1);if(!C||!B||B.clientHeight<=0)return;let q=24,W=C.contentBox.y-C.box.y,Y=(C.box.y+W+h.y)*l$2+e$1.offsetTop,me=Y+h.height*l$2,ie=B.scrollTop,se=ie+B.clientHeight,st=ie;if(Y<ie+q)st=Y-q;else if(me>se-q)st=me+q-B.clientHeight;else return;let Zn=Math.max(0,B.scrollHeight-B.clientHeight),qr=Math.max(0,Math.min(st,Zn));Math.abs(qr-B.scrollTop)<.5||(B.scrollTop=qr,ol());}let ze=n$1.editingMode??"edit",Bu=true,Ya=Object.freeze({kind:"body"}),$u=0,qu=Ny(n$1.locale,dt),js=n$1.translate,ut=null;function We(d,f,h,I=ue(),C=true){dt();let B=rr(d.some(iS),d,C);if(B!==null)return {committed:false,rejected:true,opCount:0,reason:B};let q=lS(C&&ut?ut.annotate(d):d),W=Ao(q,f,h,I);return C&&ut?.afterApply(W.committed),W.committed&&q.some(vc)&&r.onTrackedChange?.(),W}function Ao(d,f,h,I=ue()){let C=i?.gateOperations(d,I);return C?{committed:false,rejected:true,opCount:0,reason:C}:($u+=1,a.applyTreeOps(d,f,h,I,i?{origin:b$1.mutationHuman,actorId:i.identity.actorId,operationId:`${i.identity.actorId}:${i.sessionId}:browser:${$u}`,recordsHistory:false}:void 0))}function rr(d,f=[],h=true){return ze==="view"?u:d&&(h&&Gs()||f.some(I=>xS(I)))?m:ze==="suggest"&&!s?.trim()&&d?j$1:ze==="suggest"&&f.some(I=>I.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}function Zu(){let d=rr(true,[],false);return d!==null?d:a.editable?null:g}function iS(d){return d.op!=="acceptRevision"&&d.op!=="rejectRevision"&&d.op!=="acceptAllRevisions"&&d.op!=="rejectAllRevisions"}let sS=d=>hh$1.has(d),zu=()=>!a.trackingSettings().doNotTrackFormatting;function Vu(d,f,h){return d.flatMap(I=>bc(I)?!h&&sS(I.op)?[I]:[I.revision!==void 0?I:{...I,revision:f}]:I.op==="splitParagraphMany"?[{...I,revision:f}]:I.op==="splitParagraph"?[I,{op:"setParagraphMarkRevision",paragraphId:I.paragraphId,kind:"ins",revision:f}]:I.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:I.secondId,revision:f}]:[I])}function Ku(){let d=s?.trim();return ze==="suggest"&&d?d:void 0}function lS(d){let f=Ku();return f===void 0?[...d]:Vu(d,{author:f,date:v()},zu())}function dS(d,f,h){let I=Ct(f);if(I===h)return d;let C=0;for(;C<h.length&&C<I.length&&h[C]===I[C];)C+=1;let B=0;for(;B<h.length-C&&B<I.length-C&&h[h.length-1-B]===I[I.length-1-B];)B+=1;let q=I.length-h.length,W=Y=>Y.paragraphId!==f||Y.offset<=C?Y:Y.offset>=h.length-B?{...Y,offset:Y.offset+q}:{...Y,offset:C};return {anchor:W(d.anchor),head:W(d.head)}}function cS(d,f){let h=a.partFor(ue())??a.part(),I=Ha$1(h,d),C=Ha$1(h,f);return I!==null&&C!==null&&I.id===C.id}function $n(d){return {paragraphId:d.paragraphId,start:d.offset,end:d.offset}}function Ne(...d){let f=Fy(e$1);try{uS(...d);}finally{f();}}function uS(d,f,h={}){dt(),h?.keepCellSelection||(ne=null),R=null,Ue.noteModelMoved();let I=d(),C=typeof I=="boolean"||!I.rejected?null:I;if(C)F=String(C.reason??"rejected");else {F=null;let B=f?.();B&&(No(),E=B,le({kind:"none"},false),V=null,Ga$1=true);let q=h?.rearmPending;if(q&&q.properties.length>0){let{anchor:W,head:Y}=E;W.paragraphId===Y.paragraphId&&W.offset===Y.offset&&(R={properties:q.properties,base:q.base,position:Y});}}Br(),zx(C!==null);}function fS(){if(!Ut)return true;for(let d of [E.anchor,E.head]){let f=jf(ae$1,d);if(f&&!Ut.has(f.pageIndex))return false}return true}function Br(){let d=i;if(!d)return;let f=Bn?Wy(ne?.text??E,I=>{let C=at(a,I)??a.part();return Gy(C,I)},ne?"cells":void 0):null,h=f?`${f.anchor.paragraphId}:${f.anchor.offset}|${f.head.paragraphId}:${f.head.offset}|${f.kind??""}`:"";h!==Tt&&(Tt=h,d.setLocalSelection(f));}function gt(d,f=false){let h=!zt(d,E);Le.length>0&&h&&dt();let I=ut?.beforeSelect(d);if(I===null)return;d=I??d,de(d),pe(d);let C=nr()?.id??null,B=_o(E.head.paragraphId);No(),E=d,ne=null,f||(V=null),fS()||(Ue.noteModelMoved(),Pt(false)),Ue.noteSelectionSettled(),Ue.mirrorToDom(true),_u(true),Ho(),ar.clear(),$r();let q=nr()?.id??null,W=_o(E.head.paragraphId);(C!==q||B!==W)&&Pt(false),Br(),n$1.onChange?.(Ze$1());}let Ue=Nb({session:a,storyScope:ue,document:L,pagesLayer:p,selection:()=>E,setSelection:d=>gt(d),adoptSelection:d=>{let f=ut?.beforeSelect(d);f!==null&&(d=f??d,de(d),pe(d),No(),E=d,V=null,Ga$1=true,Br());},commit:d=>Ne(d),applyOps:(d,f,h)=>We(d,f,void 0,h),hasPendingInput:()=>Le.length>0,replacementOffset:(d,f,h)=>el({paragraphId:d,offset:f},{paragraphId:d,offset:h}),render:()=>Pt(),flushLayout:()=>it(),flushToPaint:()=>$s(),updateCaret:()=>{N.update(),Sc(p,vo());},textOf:d=>Ct(d),pendingFormatOps:(d,f,h,I)=>ce(d,f,h,I),selectionMark:()=>Ve(),now:Oe,recordSelectionMs:d=>{Ae=d;},isGesturing:()=>nl?.dragging()??false,domSelection:()=>ne?_e(ne.text.anchor):E,holdsCellSelection:()=>ne!==null,replaceSelectionWith:d=>Ke$1.type(d),discardPaint:()=>l$1(p)});re=gv({session:a,layout:()=>ae$1,sectionAtPage:ke,revisionDisplayMode:Mt,revisionAuthorFilter:wt,selection:()=>E,setScopeSelection:d=>{dt(),No(),de(d),ar.clear(),E=d,ne=null,V=null,Br();},noteModelMoved:()=>Ue.noteModelMoved(),render:()=>Pt(),mirrorToDom:()=>Ue.mirrorToDom(),notify:()=>n$1.onChange?.(Ze$1()),materializedPages:()=>Ut,entryRefused:()=>ze==="view",leaveOtherStories:()=>ye$1?.exitNote()}),ye$1=yv({session:a,exitHeaderFooter:()=>re?.exitHeaderFooter(),applyOps:We,commit:Ne,selection:()=>E,selectionMark:()=>Ve(),orderedStart:()=>Js(),deleteSelectionPlan:()=>Pn(),undo:()=>Ke$1.undo(),activeScope:()=>{let d=ye$1?.activeNoteScope();return d||(re?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:d=>re.setActiveScope(d),setSelection:d=>gt(d),noteModelMoved:()=>Ue.noteModelMoved(),render:()=>{it()||Pt();},revealNote:d=>{it();for(let f of ae$1.pages){let h=[...f.footnotes?.notes??[],...f.endnotes?.notes??[]].find(I=>I.scopeId===d);if(h)return Bo(h.box.y,h.box.height,{block:"nearest",offsetPx:48}),f.index}return null},notify:()=>n$1.onChange?.(Ze$1()),lastRejection:()=>F,setLastRejection:d=>{F=d;}});function ju(d){d&&dt(),ne=d,d&&(de(d.text),No(),E=d.text),V=null,Ue.noteSelectionSettled(),Ue.mirrorToDom(),Ho(),ar.clear(),$r(),Br(),n$1.onChange?.(Ze$1());}let or=null;function pS(){let f=jf(ae$1,E.head)?.pageIndex??0,h=new Set;for(let I=f-1;I<=f+1;I+=1)I>=0&&I<ae$1.pages.length&&h.add(I);return h}let Uu=new WeakMap;function mS(d){let f=Uu.get(d);if(f)return f;let h=new Map;for(let I of d.pages)for(let C of ya$1(I))h.has(C.paragraphId)||h.set(C.paragraphId,I.index);return Uu.set(d,h),h}function gS(){let d=a.revision(),f=Ut??pS();if(or?.layout===ae$1&&or.revision===d&&_c(or.pages,f))return or.rects;let h=mS(ae$1),I=(W,Y)=>{if(!f)return true;let me=h.get(W),ie=h.get(Y);if(me===void 0||ie===void 0)return true;for(let se=Math.min(me,ie);se<=Math.max(me,ie);se+=1)if(f.has(se))return true;return false},C=[];for(let W of Do()){if(W.kind==="comment"){if(W.range===null||!I(W.range.start.paragraphId,W.range.end.paragraphId))continue;C.push({key:za(W),from:{paragraphId:W.range.start.paragraphId,offset:W.range.start.offset},to:{paragraphId:W.range.end.paragraphId,offset:W.range.end.offset}});continue}let Y=za(W),me=W.kind==="revision"?W.ranges:W.range?[W.range]:[];for(let[ie,se]of me.entries())I(se.start.paragraphId,se.end.paragraphId)&&C.push({key:me.length===1?Y:`${Y}${y}${ie}`,from:{paragraphId:se.start.paragraphId,offset:se.start.offset},to:{paragraphId:se.end.paragraphId,offset:se.end.offset}});}let B=$e(ae$1,C,f,b),q=[];for(let[W,Y]of B)for(let me of Y)q.push({...me,key:W});return or={layout:ae$1,revision:d,pages:f,rects:q},q}let Tn=null;function hS(d){Tn&&(d.impact==="text-local"&&d.created.length===0&&d.deleted.length===0&&d.splitJoin.length===0?Tn={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:Tn.index}:Tn=null);}function yS(){let d=a.packageRevision(),f=a.part().root;if(Tn&&Tn.packageRevision===d&&Tn.bodyRoot===f)return Tn.index;let h=new Map,I=B=>{let q=h.size;for(let[W,Y]of B)h.has(W)||h.set(W,q+Y);};I(xa$1(a.part()));let C=new Set([a.part()]);for(let B of a.headerFooterPartsBySection())for(let q of [B.headers,B.footers])for(let W of q.values())C.has(W)||(C.add(W),I(xa$1(W)));for(let B of ["footnote","endnote"]){let q=a.partFor({kind:"notesPart",noteKind:B});!q||C.has(q)||(C.add(q),I(xa$1(q)));}return Tn={packageRevision:d,bodyRoot:f,index:h},h}let ar=new Set,Mo=null,Lo=null,Us=false;function No(){Us||(Lo=null);}function Wu(){let d=Lo;if(!d||!E)return null;let f=(I,C)=>I.paragraphId===C.paragraphId&&I.offset===C.offset;if(!f(E.anchor,d.anchor)||!f(E.head,d.head))return null;let h=Do().find(I=>za(I)===d.key);return !h||h.kind==="revision"&&Mo!==null&&Mo.has(h.revisionKind)?null:h}function Ws(){let d=Wu();if(d)return Gu(d);let f=E?.head;if(!f)return null;let I=Da$1(Do(),f,yS()).filter(C=>!(C.kind==="comment"&&C.resolved)&&!ar.has(za(C))&&!(C.kind==="revision"&&Mo!==null&&Mo.has(C.revisionKind)))[0];return I?Gu(I):null}function Gu(d){if(d.kind!=="comment")return d;let f=Fa$1(Do(),d);return ar.has(za(f))?null:f}function Do(){return nn.filterItems(a.reviewItems())}let Xu=jy({roster:Lt.get,styles:()=>In,slots:Mr}),Yu=Xu.forAuthor,bS=Xu.declaredFor;function vS(d,f,h){let I=d.split(y),C=I[0],B=f!==null&&C===za(f);if(d.startsWith("comment-")){let ie=h.get(C),se=ie?.kind==="comment"&&ie.resolved;return se&&!B?null:B?`docx-comment-band docx-comment-band--active${se?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(d.startsWith("custom-"))return B?"docx-comment-band docx-comment-band--active":null;let q=h.get(C);if(!q||q.kind!=="revision")return null;let W=I.length>1?Number(I[1]):0;return `docx-revision-band docx-revision-band--${(ie=>ie==="delete"||ie==="moveFrom"?"delete":ie==="insert"||ie==="moveTo"?"insert":ie==="replace"&&q.replacedRangeCount!==void 0?W<q.replacedRangeCount?"delete":"insert":"other")(q.revisionKind)}${B?" docx-revision-band--active":""}`}let Qu=null,Ju,ef=null;function $r(d=false){let f=Ws(),h=f?za(f):null,I=Lt.get();if(!d&&Qu===ae$1&&Ju===h&&ef===I.resolved)return;let C=new Map;for(let q of Do())C.set(za(q),q);let B=[];for(let q of gS()){let W=vS(q.key,f,C);if(!W)continue;let Y=C.get(q.key.split(y)[0]),me=Y?Ic(Y):null,ie=me===null||me===""?void 0:I.resolved.get(me);B.push({...q,className:W,...ie?{reviewAuthor:ie}:{}});}o(Z,ae$1,B,{scale:l$2,...et?{pageOffsetX:et.pageOffsetX}:{}}),Qu=ae$1,Ju=h,ef=I.resolved;}function Ho(){ut?.update();let d=ne?wf(ae$1,ne.cellIds):Q?Ze(ae$1,Q,Fe(),b):_e$1(ae$1,E,Fe(),b);o(A,ae$1,d,{scale:l$2,pageOffsetX:et?.pageOffsetX,...ne?{}:{className:Q?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function Qa(){if(!kt){T.replaceChildren();return}let d=i;if(!d){T.replaceChildren();return}Xy(T,ae$1,d.remoteSelections(),{scale:l$2,pageOffsetX:et?.pageOffsetX,...Ut?{pages:Ut}:{},colorForAuthor:Yu,declaredColorFor:bS,labelHost:mt,measurer:b});}function Ja(d){let f=ye(a.part());if(d)return f.find(C=>C.id===d)??null;let h=Fo?f.find(C=>C.id===Fo):void 0;if(h)return h;let I=E.head.paragraphId;return f.find(C=>C.beginParagraphId===I||C.endParagraphId===I||C.resultParagraphIds.includes(I))??(f.length===1?f[0]:null)}function _o(d){return ye(a.part()).find(h=>h.beginParagraphId===d||h.endParagraphId===d||h.resultParagraphIds.includes(d))?.id??null}function Gs(){return _o(E.anchor.paragraphId)!==null||_o(E.head.paragraphId)!==null}function xS(d){let f=ei(),h=(I,C="")=>typeof I=="string"?/(?:Id|Ids)$/.test(C)&&f.has(I):Array.isArray(I)?I.some(B=>h(B,C)):!I||typeof I!="object"?false:Object.entries(I).some(([B,q])=>h(q,B));return h(d)}function ei(){return new Set(ye(a.part()).flatMap(d=>[d.beginParagraphId,...d.resultParagraphIds,d.endParagraphId]))}function Xs(d){return new Set([d.beginParagraphId,d.endParagraphId,...d.resultParagraphIds])}function SS(d){let f=0;for(let h of ae$1.pages)for(let I of ya$1(h))d.has(I.paragraphId)&&(f+=I.lines.length);return f}function Ys(d,f){let h=new Set(f),I=new Map;for(let C of d.pages)for(let B of ya$1(C)){if(!h.has(B.paragraphId)||I.has(B.paragraphId))continue;let q=C.pageFieldSource;I.set(B.paragraphId,mb$1(q?.pageNumber??C.index+1,q?.format));}return I}function Qs(d){if(ze==="view"||!a.editable)return false;let f=Ja(d);return f?Sh$1(a.part(),{op:"rewriteTocPageNumbers",tocId:f.id,updates:[]})===null:false}function tf(d,f){if(!Number.isInteger(d)||!Number.isInteger(f)||d<1||f<1)return null;let h=tr.sectionPropertiesAt(E.head.paragraphId),I=h.pageSize.widthTwips-h.margins.leftTwips-h.margins.rightTwips-h.margins.gutterTwips,C=Math.max(300,Math.floor(I/f));return {op:"insertTable",beforeParagraphId:E.head.paragraphId,rows:d,cols:f,columnWidthTwips:C}}function nf(d,f){if(ze==="view"||!a.editable)return false;let h=tf(d,f),I=a.partFor(ue())??a.part();return h!==null&&Sh$1(I,h)===null}function IS(d,f){if(!nf(d,f))return false;let h=tf(d,f);if(!h)return false;let I=null,C=a.subscribe(q=>{q.caret&&(I=q.caret);}),B=false;try{Ne(()=>{let q=We([h],Ve());return q.committed||(F=q.reason??"the table could not be inserted here"),B=q.committed,q},()=>{let q=I;return q?_e({paragraphId:q.paragraphId,offset:q.start}):null});}finally{C();}return B}let rf='TOC \\o "1-3" \\h';function of$1(){let d=xe$1(rf);if(!d)return null;let f=a.documentOutline(),h=bf(a.part(),f,d,Ys(Ke$1.layout(),f.map(I=>I.blockId)),ei(),i?.identity.actorId);return {op:"insertToc",beforeParagraphId:E.head.paragraphId,instruction:rf,alias:bo?.title??"TOC",entries:h.entries,bookmarksToCreate:h.bookmarksToCreate}}function af(){if(ze==="view"||!a.editable||Gs())return false;let d=of$1();return d!==null&&Sh$1(a.part(),d)===null}function wS(){if(!af())return false;let d=of$1();if(!d)return false;let f=new Set(ye(a.part()).map(C=>C.id)),h=Ao([d],void 0,void 0,Ya);if(!h.committed)return F=h.reason??"the table of contents could not be inserted",false;let I=ye(a.part()).find(C=>!f.has(C.id));return I?sf(I.id,"pageNumbers"):true}function sf(d,f="entire"){let h=Ja(d);if(!h||!Qs(h.id))return false;let I=Ke$1.layout(),C=a.documentOutline(),B=C.map(W=>W.blockId);if(f==="entire"){let W=bf(a.part(),C,h.instruction,Ys(I,B),Xs(h),i?.identity.actorId),Y=Ao([{op:"replaceTocResult",tocId:h.id,entries:W.entries,bookmarksToCreate:W.bookmarksToCreate}],void 0,void 0,Ya);if(!Y.committed)return F=Y.reason??"the table of contents could not be refreshed",false;if(I=Ke$1.layout(),h=Ja(h.id),!h)return true}let q="";for(let W=0;W<3;W+=1){let Y=Ys(I,B),me=df(a.part(),h,C,Xs(h)),ie=h.resultParagraphIds.flatMap((Zn,qr)=>{let qo=me[qr],Zo=qo?Y.get(qo):void 0;return Zo===void 0?[]:[{paragraphId:Zn,pageNumberText:Zo}]});if(ie.length===0)break;let se=ie.map(Zn=>`${Zn.paragraphId}\0${Zn.pageNumberText}`).join("");if(se===q)break;q=se;let st=Ao([{op:"rewriteTocPageNumbers",tocId:h.id,updates:ie}],void 0,void 0,Ya);if(!st.committed){if(st.rejected)return F=st.reason??"the table of contents page numbers were refused",false;break}I=Ke$1.layout(),h=Ja(h.id)??h;}return true}function kS(){return $y({session:a,editingMode:ze,collaborationActive:i!==void 0,reviewerFilterActive:wt()!==void 0,layout:Ke$1.layout(),canonicalUnfilteredLayout:ve,styleCascade:pt(),numberingIndex:At(),displayMode:Mt()})}let{selectionMark:Ve,orderedRange:qn,orderedStart:Js,textOf:Ct,inlineControlBeside:lf$1,splitEndsTheParagraph:TS,deleteSelectionPlan:Pn,deleteSelectionOps:PS,replacementOffset:el}=X0({session:a,layout:()=>ae$1,selection:()=>E,cellSelection:()=>ne,editingMode:()=>ze,author:()=>s,trackedDate:v,storyScope:ue,paragraphOrder:Fe,flushPendingInputAndLayout:Xe$1,trackedAuthorOrNone:Ku,atParagraphEnd:(d,f)=>Za.atParagraphEnd(d,f)}),{insertPlainText:df$1,copyFlavoursNow:CS,pasteRichNow:RS,armForcePlainPaste:ES}=G0({session:a,textFormFieldId:()=>ut?.fieldId()??null,layout:()=>ae$1,cellSelection:()=>ne,editingMode:()=>ze,storyScope:ue,paragraphOrder:Fe,actorId:()=>i?.identity.actorId,collaborationGate:(d,f)=>i?.gateOperations(d,f)??null,now:Oe,flushPendingInputAndLayout:Xe$1,orderedRange:qn,selectionMark:Ve,deleteSelectionPlan:Pn,consumePendingFormatOps:ce,withoutPendingOnRejection:Ie,caretMark:$n,commit:Ne});function ti(d){d&&(we=null,Xe$1(),_n=Ar(wt()),ct.invalidateAll(a.packageRevision(),"tracked-change-filter"),ct.flush(),n$1.onChange?.(Ze$1()));}let tl=false,Ke$1={session:a,applyGatedTreeOps:(d,f,h,I)=>Ao(d,f,h,I??ue()),storyScope:ue,imageDecodePort:()=>fn,layout:()=>(Xe$1(),ae$1),state:Ze$1,currentPage:(d="caret")=>{if(Xe$1(),d==="viewport"){let h=tb(e$1,ae$1,l$2);if(h!==null)return h}let f=jf(ae$1,E.head);return f?f.pageIndex+1:1},setScale(d){if(!(d>0)||!Number.isFinite(d))return false;if(d===l$2)return true;let f={scale:l$2,defaults:w,measurer:b,producer:D,furnitureSource:_n};try{let h=Vt(e$1),I=h?{x:(h.scrollLeft-e$1.offsetLeft+h.clientWidth/2)/l$2,y:(h.scrollTop-e$1.offsetTop+h.clientHeight/2)/l$2}:null;if(l$2=d,n$1.measurer||(w=Ke(l$2,{context:so(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),b=w.measurer),D=O(),_n=Ar(wt()),Ut=void 0,et=void 0,or=null,ct.invalidateAll(a.packageRevision(),"zoom"),ct.flush(),h&&I){let C=Math.max(0,I.x*l$2+e$1.offsetLeft-h.clientWidth/2),B=Math.max(0,I.y*l$2+e$1.offsetTop-h.clientHeight/2),q=Number.isFinite(h.scrollWidth)?Math.max(0,h.scrollWidth-h.clientWidth):null,W=Number.isFinite(h.scrollHeight)?Math.max(0,h.scrollHeight-h.clientHeight):null;h.scrollLeft=q===null?C:Math.min(C,q),h.scrollTop=W===null?B:Math.min(B,W),Xa();}return !0}catch{(({scale:l$2,defaults:w,measurer:b,producer:D,furnitureSource:_n}=f)),Ut=void 0,et=void 0,or=null;try{ct.invalidateAll(a.packageRevision(),"zoom-rollback"),ct.flush();}catch{}return false}},enqueueType:Dr,flushPendingInput:Xe$1,type(d){let f=Pn(),h=f.replaceAt??f.collapseTo,I=ce(h.paragraphId,h.offset,d.length),C=[...f.ops,{op:"insertText",paragraphId:h.paragraphId,offset:h.offset,text:d}],B={paragraphId:h.paragraphId,start:h.offset+d.length,end:h.offset+d.length};Ne(()=>Ie([...C,...I],C,Ve(),B),()=>_e({paragraphId:h.paragraphId,offset:h.offset+d.length}));},proposeTextChange:(d,f,h)=>Po(d,f,h),insertPlainText:d=>df$1(d),deleteBackward(){if(ut?.selectForDeletion("backward"))return;let d=Pn();if(d.ops.length>0){Ne(()=>We(d.ops,Ve(),$n(d.collapseTo)),()=>_e(d.collapseTo));return}let f=U()??void 0,h=E.head;if(h.offset===0){for(let Y of Oa$1(ae$1,h.paragraphId)){let me=Ct(Y);if(me.length!==0){Ne(()=>We([{op:"deleteText",paragraphId:Y,start:me.length-1,end:me.length}],Ve(),$n({paragraphId:Y,offset:me.length-1})),()=>_e({paragraphId:Y,offset:me.length-1}),{rearmPending:f});return}}let C=Fe(),B=C.indexOf(h.paragraphId),q=C[B-1];if(!q)return;if(!cS(q,h.paragraphId)){gt(_e({paragraphId:q,offset:Ct(q).length}));return}let W=Ct(q).length;Ne(()=>We([{op:"joinParagraphs",firstId:q,secondId:h.paragraphId}],Ve(),$n({paragraphId:q,offset:W})),()=>_e({paragraphId:q,offset:W}),{rearmPending:f});return}let I=lf$1(h,"before");if(I){Ne(()=>We([{op:"removeContentControl",controlId:I.controlId,keepContent:false}],Ve(),$n({paragraphId:h.paragraphId,offset:I.start})),()=>_e({paragraphId:h.paragraphId,offset:I.start}),{rearmPending:f});return}Ne(()=>We([{op:"deleteText",paragraphId:h.paragraphId,start:h.offset-1,end:h.offset}],Ve(),$n({...h,offset:h.offset-1})),()=>_e({...h,offset:h.offset-1}),{rearmPending:f});},splitParagraph(){let d=Pn(),f=d.replaceAt??d.collapseTo,h=new Set(a.paragraphIdsIn(ue())),I=U()??void 0,C=TS(f)?Za.followerStyleId(f.paragraphId):void 0;Ne(()=>We([...d.ops,{op:"splitParagraph",paragraphId:f.paragraphId,offset:f.offset,tailStyleId:C}],Ve()),()=>{let B=a.paragraphIdsIn(ue()).find(q=>!h.has(q));return B?_e({paragraphId:B,offset:0}):null},{rearmPending:I});},navigate(d,f=false){if(Xe$1(),!f&&(d==="left"||d==="right")&&(E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)){let C=qn();V=null,gt(_e(d==="left"?C.from:C.to),true);return}let h=Od(ae$1,E.head,d,V,re?.getActive()??null,Be(),b);if(!h)return;let I=ei();if(I.has(h.position.paragraphId)){if(f)return;let B=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(d)?"up":"down",q=SS(I)+4;for(let W=0;W<q;W+=1){let Y=Od(ae$1,h.position,B,h.desiredX,re?.getActive()??null,Be(),b);if(!Y||Y.position.paragraphId===h.position.paragraphId&&Y.position.offset===h.position.offset)return;if(h=Y,!I.has(h.position.paragraphId))break}if(I.has(h.position.paragraphId))return}V=h.desiredX,ye$1?.activeNoteScope()&&h.pageIndex!==void 0&&Number.isInteger(h.pageIndex)&&ye$1.setActiveNotePageIndex(h.pageIndex),gt({anchor:f?E.anchor:h.position,head:h.position},true);},deleteWordBackward(){if(Ke$1.deleteSelection())return;let d=E.head,f=gf(Ct(d.paragraphId),d.offset,-1,of(ae$1,d.paragraphId));if(f===d.offset){Ke$1.deleteBackward();return}Ne(()=>We([{op:"deleteText",paragraphId:d.paragraphId,start:f,end:d.offset}],Ve()),()=>_e({...d,offset:f}),{rearmPending:U()??void 0});},deleteWordForward(){if(Ke$1.deleteSelection())return;let d=E.head,f=gf(Ct(d.paragraphId),d.offset,1,of(ae$1,d.paragraphId));if(f===d.offset){Ke$1.deleteForward();return}Ne(()=>We([{op:"deleteText",paragraphId:d.paragraphId,start:d.offset,end:f}],Ve()),void 0,{rearmPending:U()??void 0});},deleteForward(){if(ut?.selectForDeletion("forward")||Ke$1.deleteSelection())return;let d=U()??void 0,f=E.head,h=Ct(f.paragraphId);if(f.offset<h.length){let B=lf$1(f,"after");if(B){Ne(()=>We([{op:"removeContentControl",controlId:B.controlId,keepContent:false}],Ve()),()=>_e(f),{rearmPending:d});return}Ne(()=>We([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset,end:f.offset+1}],Ve()),void 0,{rearmPending:d});return}let I=Fe(),C=I[I.indexOf(f.paragraphId)+1];if(C){if(Oa$1(ae$1,C).includes(f.paragraphId)){if(Ct(C).length===0)return;Ne(()=>We([{op:"deleteText",paragraphId:C,start:0,end:1}],Ve()),()=>_e(f),{rearmPending:d});return}Ne(()=>We([{op:"joinParagraphs",firstId:f.paragraphId,secondId:C}],Ve()),()=>_e(f),{rearmPending:d});}},...tr,...Bs,setSelection:d=>{zt(d,E)||le({kind:"programmatic"},false),gt(d);},selectDrawing(d,f){it();let h=ls(ae$1,d,f);if(!h)return false;let I=_e(h);return le({kind:"pointer",drawingNodeId:d},zt(I,E)),gt(I),wa(Ke$1)?.drawingNodeId===d},revealPage(d,f){it();let h=ae$1.pages.find(I=>I.index===d);return h?Bo(h.box.y,h.box.height,f):false},revealParagraph(d,f){it();let h=jf(ae$1,{paragraphId:d,offset:0});if(!h)return false;let I=ae$1.pages.find(C=>C.index===h.pageIndex);return I?Bo(I.contentBox.y+h.y,h.height,f):false},revealPosition(d,f){it();let h=jf(ae$1,d);if(!h)return false;let I=ae$1.pages.find(C=>C.index===h.pageIndex);return I?Bo(I.contentBox.y+h.y,h.height,{block:"nearest",...f}):false},setEditable(d){Bu=d,zs();},selectAll(){let d=Fe(),f=d[0],h=d[d.length-1];!f||!h||gt({anchor:{paragraphId:f,offset:0},head:{paragraphId:h,offset:Ct(h).length}});},hyperlinks:Nr,equations:ko,contentControls:kn,formatPainter:pn,canInsertTable:nf,insertTable:IS,canInsertToc:af,insertToc:wS,canRefreshToc:Qs,canEditTextFormField:()=>ut?.canEdit()??false,editTextFormField:()=>ut?.edit()??false,refreshToc:sf,refreshRefFieldResults:kS,save:()=>Ay(Ke$1,e$1,()=>tl),isInsideToc:d=>ye(a.part()).some(f=>f.beginParagraphId===d||f.endParagraphId===d||f.resultParagraphIds.includes(d)),retainSelection:()=>{let d=Symbol("selection-pin");return H.set(d,E),Q=E,Ho(),d},releaseSelection:d=>{H.delete(d)&&(J(),Ho());},retainedSelection:()=>Q,publishedLayout:()=>ae$1,drawingSelectionIntent:()=>G,overlayCoordinates:()=>Object.freeze({paintScale:l$2,pageOffsetX:et?.pageOffsetX??new Map}),commitReviewOps:(d,f)=>{Xe$1();let h=E.head.paragraphId,I=Ct(h);return Ne(()=>{if(ze==="view")return {committed:false,rejected:true,opCount:0,reason:u};if(i&&(f===void 0||!EC.has(f)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(i){let B=i.gateOperations([],ue());if(B)return {committed:false,rejected:true,opCount:0,reason:B}}let C=Mb$1(i?.identity.actorId,d);return {committed:C.committed,rejected:!C.committed,opCount:0,...typeof C.reason=="string"?{reason:C.reason}:{}}},()=>{it(),Ue.noteModelMoved();let C=Fe();if(C.length===0)return null;let B=dS(E,h,I);return Fa(ae$1,C,B)})},revisionDisplayMode:Mt,replacementLanding:Ka,applyAutomationOps:(d,f)=>{let h={committed:false,rejected:false,opCount:0},I=f??Ya;return Ne(()=>{let C=rr(false);if(C!==null)return h={committed:false,rejected:true,opCount:0,reason:C};let B=null,q=d(W=>{let Y=rr(true,[],false);return Y===null?Mb$1(i?.identity.actorId,()=>a.ensureHyperlinkRelationship(W,I)):(B=Y,null)});return q===null?h={committed:false,rejected:true,opCount:0,reason:B??"this engine will not author that hyperlink target"}:!n$1.reviewModel&&q.some(vc)?h={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:h=We(q,void 0,void 0,I,false)},()=>{it(),Ue.noteModelMoved();let C=Fe();return C.length===0?null:Fa(ae$1,C,E)}),h},editingMode:()=>ze,setAuthor:d=>{s!==d&&(dt(),s=d,d?.trim()&&Hy(F)&&(F=null,n$1.onChange?.(Ze$1())));},setDrawingStrings:d=>{Kt!==d&&g$1(Kt)!==g$1(d)&&(Kt=d,Xe$1(),Pt(false));},setLocale:qu.set,setTranslate:d=>{js!==d&&(js=d,ut?.update());},setTocLabels:d=>{bo=d;},setEditingMode:d=>{Xe$1();let f=ze!==d;ze=d,f&&d==="view"&&re?.exitHeaderFooter(),f&&d==="view"&&pn.disarm(),Zs(),zs(),Fd(e$1,ze),f&&Pt(false),F=null,n$1.onChange?.(Ze$1());},revisionAuthors:()=>Lt.get().value,hiddenRevisionAuthors:()=>nn.hiddenAuthors,setRevisionAuthorVisible(d,f){ti(nn.setVisible(d,f));},setAllRevisionAuthorsVisible(d){ti(nn.setAllVisible(Lt.get().value.keys(),d));},showAllRevisionAuthors(){ti(nn.showAll());},setTrackedChangesFilter(d,f){ti(nn.setPredicate(d,f));},collaborationSession:()=>i??null,remotePresenceColor:Yu,setRevisionStyles:d=>{d!==In&&(In=d,Xe$1(),Pt(false));},setRemoteCaretLabelHost:d=>{d!==mt&&(mt=d,Qa());},setReviewActivationExclusions(d){Mo=d===null?null:new Set(d),$r(),n$1.onChange?.(Ze$1());},activeReviewKey:()=>{let d=Ws();return d?za(d):null},activateReview:(d,f)=>{if(ar.clear(),Lo=f?{key:d,anchor:f.anchor,head:f.head}:{key:d,anchor:E.anchor,head:E.head},f){Us=true;try{gt(f);}finally{Us=false;}return}$r(),n$1.onChange?.(Ze$1());},activatedReviewKey:()=>Wu()===null?null:Lo?.key??null,dismissActiveReview:()=>{let d=Ws();d&&(ar.add(za(d)),Lo=null,$r(),n$1.onChange?.(Ze$1()));},navigation:mn,bookmarks:()=>a.bookmarks(),selectedText(){if(ne)return xf$1(ae$1,ne);let{from:d,to:f}=qn();return fs(ae$1,d,f,Fe())},copyFlavours:()=>CS(),pasteRich:(d,f)=>RS(d,f),armForcePlainPaste:ES,deleteSelection(){let d=Pn();return d.ops.length===0?false:(Ne(()=>We(d.ops,Ve(),$n(d.collapseTo)),()=>_e(d.collapseTo)),true)},setCellSelection:ju,layoutSession:()=>k,undo:()=>{if(ze==="view"){F=u,n$1.onChange?.(Ze$1());return}if(dt(),i){i.undo()&&ni(null);return}let d=a.packageRevision(),f=a.undo();a.packageRevision()!==d&&ni(f);},redo:()=>{if(ze==="view"){F=u,n$1.onChange?.(Ze$1());return}if(dt(),i){i.redo()&&ni(null);return}let d=a.packageRevision(),f=a.redo();a.packageRevision()!==d&&ni(f);},sectionAtPage:ke,activeScope:()=>{let d=ye$1?.activeNoteScope();return d||re.activeScope()},setActiveScope:d=>(Xe$1(),d.kind==="note"?ye$1.enterNote(d.id):d.kind!=="body"&&d.kind!=="headerFooter"?false:(ye$1?.exitNote(),re.setActiveScope(d))),insertNote:d=>(Xe$1(),ye$1.insertNote(d)),deleteNote:(d,f)=>ye$1.deleteNote(d,f),convertNote:(d,f)=>ye$1.convertNote(d,f),convertAllNotes:d=>ye$1.convertAllNotes(d),setNoteProperties:d=>ye$1.setNoteProperties(d),enterNote:(d,f)=>(Xe$1(),ye$1.enterNote(d,f)),exitNote:()=>(Xe$1(),ye$1.exitNote()),notePropertiesState:()=>{let d=Ke$1.state().selection.head.paragraphId,f=a.packageRevision(),h=a.currentPackage(),I=a.part(),C=xf(h),B=If(h,"footnote"),q=If(h,"endnote"),W=Ke$1.activeScope().kind==="headerFooter",Y=Ke$1.headerFooterState(),me=Y?.rId??null,ie=Y?.sectionIndex??null,se=we;if(se&&se.packageRevision===f&&se.paragraphId===d&&se.bodyPart===I&&se.settingsPart===C&&se.footnotesPart===B&&se.endnotesPart===q&&se.headerFooterOpen===W&&se.headerFooterRId===me&&se.headerFooterSectionIndex===ie)return se.result;let st=bv(Ke$1,wt());return we={packageRevision:f,paragraphId:d,bodyPart:I,settingsPart:C,footnotesPart:B,endnotesPart:q,headerFooterOpen:W,headerFooterRId:me,headerFooterSectionIndex:ie,result:st},st},notePreviewText:d=>vv(a,d),applyTableCommandPlan(d){if(!d.ok)return {ok:false,code:d.code,reason:d.reason};let f=null,h=a.subscribe(I=>{I.caret&&(f=I.caret);});try{let I=Ve(),C=d.selection.kind==="adoptCommittedCaret";Ne(()=>We(d.ops,I),C?()=>{let B=f;return B?_e({paragraphId:B.paragraphId,offset:B.start}):null}:void 0,d.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{h();}return F?{ok:false,code:"invalidArgs",reason:F}:{ok:true,changed:true}},enterHeaderFooter:d=>{Xe$1();let f=re.enterHeaderFooter(d);if(!f)return f;let h=re.getActive(),I=h?ae$1.pages[h.pageIndex]:void 0;if(h&&I){let C=h.kind==="header"?I.header:I.footer,B=C?.box.y??(h.kind==="header"?I.box.y:I.box.y+I.box.height-1),q=C?.box.height??1;Bo(B,q,{block:"nearest"});}return f},exitHeaderFooter:()=>(Xe$1(),re.exitHeaderFooter()),headerFooterState:()=>re.headerFooterStateStable(a.packageRevision()),...fv({applyOps:We,commit:Ne,deleteSelectionOps:PS,deleteSelectionPlan:()=>Pn(),orderedStart:Js,selectionMark:Ve,collapsedAt:_e,isHeaderFooterOpen:()=>re?.getActive()!==null,lastRejection:()=>F}),...mv({session:a,applyOps:We,commit:Ne,storyScope:ue,selectionMark:Ve,editingMode:()=>ze,author:()=>s,trackedDate:v,decodePort:()=>fn,actorId:()=>i?.identity.actorId}),focus:()=>p.focus({preventScroll:true}),setTableInteractionLabel(d){c.resolve=d;},refreshTableInteractionLabels(){$o.refreshLabels();},destroy(){if(!tl){tl=true;try{$s();}finally{L.removeEventListener("selectionchange",cf),p.removeEventListener("pointerdown",bf$1,{capture:true}),p.removeEventListener("keydown",ri,{capture:true}),p.removeEventListener("beforeinput",ri,{capture:true}),p.removeEventListener("keydown",pf),p.removeEventListener("beforeinput",yf),p.removeEventListener("copy",mf$1),p.removeEventListener("cut",gf$1),p.removeEventListener("paste",hf),p.removeEventListener("compositionstart",ff$1),p.removeEventListener("compositionend",uf),L.removeEventListener("scroll",vf,{capture:true}),e$1.ownerDocument.defaultView?.removeEventListener("resize",al),Oo?.disconnect(),Ks=null,ut?.destroy(),nl?.destroy(),$o.destroy(),mn.destroy(),x.destroy(),Ue.destroy(),p.removeEventListener("contextmenu",Du),p.removeEventListener("click",Hu),p.removeEventListener("pointermove",Eu),p.removeEventListener("pointerleave",Ou),ct.cancel(),he$1!==null&&clearTimeout(he$1),he$1=null,Pe&&Pe(),Pe=null,Et.dispose(),f(p),N.destroy(),jt(),rt(),$e$1(),Ua(),e$1.replaceChildren();}}}};function ni(d){R=null;let f=ut?.restoreAfterHistory();if(!d&&f&&(E=f),Ue.noteModelMoved(),it(),!d){gt(Fa(ae$1,Fe(),E));return}let h={anchor:{paragraphId:d.paragraphId,offset:d.start},head:{paragraphId:d.paragraphId,offset:d.end}};gt(Fe().includes(d.paragraphId)?h:Fa(ae$1,Fe(),h));}function Bo(d,f,h){let I=Vt(e$1);if(!I||I.clientHeight===0)return false;let C=d*l$2+e$1.offsetTop,B=f*l$2,q=h?.offsetPx??24,W=h?.block??"start",Y=I.clientHeight;if(W==="nearest"||W==="centerIfNeeded"){let se=C<I.scrollTop,st=C+B>I.scrollTop+Y;if(!se&&!st)return true}let me=W==="center"||W==="centerIfNeeded"?C-Math.max(0,(Y-B)/2):W==="nearest"&&C>I.scrollTop?C+B+q-Y:C-q,ie=Math.max(0,I.scrollHeight-Y);return I.scrollTo({top:Math.max(0,Math.min(me,ie)),behavior:h?.behavior??"auto"}),Xa(),true}let{onSelectionChange:cf,onCompositionEnd:uf}=Ue,ff$1=(...d)=>{Ue.adoptBeforeInput(),$s(),Ue.onCompositionStart(...d);},nl=null;ut=Ey({locale:qu.get,translate:(d,f)=>js?.(d,f)??d,pagesLayer:p,container:e$1,part:()=>at(a,E.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(d=E.head.paragraphId)=>fh$1(a.settingsRoot())&&gh$1(at(a,d)??a.part(),d),selection:()=>E,select:d=>gt(d),editable:()=>ze==="edit",apply:d=>My(d,Ne,We),save:(d,f)=>Ly(d,f,{session:a,commit:Ne,refusal:()=>rr(true,d,false),gate:(h,I)=>i?.gateOperations(h,I)??null,collaborationActive:i!==void 0})},r.initialTextFormInput);let FS=S0(Ke$1,n$1.onRequestHyperlink?{onRequestHyperlink:n$1.onRequestHyperlink}:{}),pf=d=>{d.defaultPrevented||Ue.adoptBeforeInput(),ut?.keydown(d)||FS(d);},{onCopy:mf$1,onCut:gf$1,onPaste:hf}=I0(Ke$1),OS=w0(Ke$1,{isComposing:()=>Ue.isComposing(),insertPlainText:df$1,onBrowserSelectionFixup:()=>{Ue.mirrorToDom(),Ue.noteBrowserSelectionFixup();}}),yf=d=>{Ue.adoptBeforeInput(),OS(d);};L.addEventListener("selectionchange",cf);let AS=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),bf$1=d=>{if(d instanceof PointerEvent&&d.button!==0)return;let h=(d.target instanceof Element?d.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");le(h?{kind:"pointer",drawingNodeId:h}:{kind:"none"},true);},ri=d=>{if(d instanceof KeyboardEvent&&AS.has(d.key))return;if((d instanceof KeyboardEvent&&(d.key==="Delete"||d.key==="Backspace")&&!d.altKey&&!d.ctrlKey&&!d.metaKey||d instanceof InputEvent&&(d.inputType==="deleteContentBackward"||d.inputType==="deleteContentForward"))&&G.kind==="pointer"){let h=wa(Ke$1);if(h!==null){d.preventDefault(),d.stopImmediatePropagation(),le({kind:"none"},true),Ke$1.deleteImage(h.drawingNodeId);return}}le({kind:"none"},true);};p.addEventListener("pointerdown",bf$1,{capture:true}),p.addEventListener("keydown",ri,{capture:true}),p.addEventListener("beforeinput",ri,{capture:true}),p.addEventListener("keydown",pf),p.addEventListener("beforeinput",yf),p.addEventListener("copy",mf$1),p.addEventListener("cut",gf$1),p.addEventListener("paste",hf),p.addEventListener("compositionstart",ff$1),p.addEventListener("compositionend",uf);let rl=false;function ol(){if(rl)return;rl=true;let d=e$1.ownerDocument.defaultView?.requestAnimationFrame,f=()=>{rl=false,Xa();};d?d(f):queueMicrotask(f);}let vf=d=>{let f=Vt(e$1);!f||d.target!==f||ol();};L.addEventListener("scroll",vf,{capture:true,passive:true});let al=()=>{ol();},il=e$1.ownerDocument.defaultView;il?.addEventListener("resize",al,{passive:true}),Oo=typeof il?.ResizeObserver=="function"?new il.ResizeObserver(al):null;function xf$2(){if(!Oo)return;let d=Vt(e$1);d!==Ks&&(Oo.disconnect(),Ks=d,d&&Oo.observe(d));}xf$2(),nl=Lb({onTextFormDoubleClick:d=>ut?.doubleClick(d)??false,onTextFormPointerUp:d=>ut?.pointerUp(d),pagesLayer:p,container:e$1,scale:()=>l$2,pageOffsetX:d=>et?.pageOffsetX.get(d)??0,layout:()=>(it(),ae$1),measurer:()=>b,selection:()=>E,setSelection:d=>gt(d),cellSelection:()=>ne,setCellSelection:d=>ju(d),focus:()=>p.focus({preventScroll:true}),onSelectionSettled:()=>pn.applyIfArmed(),activeHeaderFooter:()=>vh(re?.getActive()??null),activeNote:()=>{let d=ye$1?.activeNoteScope();return d?{scopeId:d.id,pageIndex:ye$1?.activeNotePageIndex()??null}:null},enterHeaderFooter:d=>{Xe$1(),re?.enterHeaderFooter({rId:d.rId,pageIndex:d.pageIndex,sectionIndex:ke(d.pageIndex).sectionIndex,kind:d.kind,...d.position?{position:d.position}:{}});},enterNote:(d,f,h)=>{Xe$1(),ye$1?.enterNote(d,f,h);},exitNote:d=>{Xe$1(),ye$1?.exitNote(d);},exitHeaderFooter:()=>(Xe$1(),re?.exitHeaderFooter()),enterEmptyHeaderFooter:(d,f)=>{if(ze==="view")return;Xe$1();let{sectionIndex:h,sectionStart:I}=ke(f),C=a.headerFooterResolutionBySection(),B=C[Math.min(h,Math.max(0,C.length-1))],q=ae$1.pages[f]?.pageFieldSource?.pageNumber??f+1,W=B?.evenAndOddHeaders&&q%2===0?"even":B?.titlePage&&f===I?"first":"default",Y=ie=>{let se=ie[Math.min(h,Math.max(0,ie.length-1))];return d==="header"?se?.headers:se?.footers},me=Y(C)?.get(W)?.rId;if(!me){if(!Ke$1.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:h,kind:d,variant:W,...W==="first"?{titlePage:true}:{},...W==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;me=Y(a.headerFooterResolutionBySection())?.get(W)?.rId,it();}me&&re?.enterHeaderFooter({rId:me,pageIndex:f,sectionIndex:h,kind:d,variant:W});},onContentControlWidget:(d,f)=>oS(d,f),isReadOnlyParagraph:d=>_o(d)!==null},n$1.pointer?{mode:n$1.pointer}:{});let $o=pb({pagesLayer:p,furnitureLayer:P,scale:()=>l$2,pageOffsetX:d=>et?.pageOffsetX.get(d)??0,read:()=>({layout:ae$1,storeRevision:a.packageRevision(),selection:E,cellSelection:ne,editingMode:ze,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:d=>Ke$1.applyTableCommandPlan(d),label:d=>c.resolve(d)});if(Pt(),kt=true,Qa(),i&&(rt=i.subscribeStatus(()=>{n$1.onChange?.(Ze$1());})),i&&Bn)try{$e$1=i.attach(Bn);}catch{try{i.destroy();}catch{}}return Br(),zs(),Ke$1.setTableInteractionLabel=d=>{c.resolve=d,$o.refreshLabels();},Ke$1.refreshTableInteractionLabels=()=>{$o.refreshLabels();},{ok:true,surface:Ke$1}}var FC=e=>ya$1(e);function kv(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=Qe$2(t,FC);for(let o of t.pages){for(let a of [o.header,o.footer])a&&wv(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)wv(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function wv(e,t,n,r){for(let o of za$1(t))for(let a of Pa$1(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function Rs(e,t,n){return t.kind==="note"?e.enterNote?.(t.id,n)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the note could not be opened"}:(t.furnitureKind?e.enterHeaderFooter?.({rId:t.rId,kind:t.furnitureKind,position:n}):e.enterHeaderFooter?.({rId:t.rId,position:n}))?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the header or footer could not be opened"}}function OC(e){return e?.kind==="headerFooter"||e?.kind==="note"}function Tv(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function Es(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.exitNote?.(),e.exitHeaderFooter?.());}function Pv(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 a={ok:false,code:"unsupported",reason:"the text box drawing could not be selected"};if(!ls(e.layout(),r,o))return a;let i=t.scope.owner;if(i){let s=Rs(e,i,{paragraphId:o,offset:0});if(!s.ok)return s}else Es(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:a}let n={paragraphId:t.blockId,offset:t.start};if(OC(t.scope)){let r=Rs(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"};Es(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 Cv(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function lu(e,t){if(e===""&&(t===null||t===""))return;let n=globalThis.navigator?.clipboard;if(!n)return;let r=globalThis.ClipboardItem;if(t&&n.write&&r&&typeof Blob<"u")try{let o=new r({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})});n.write([o]).catch(()=>{Cv(e);});return}catch{}Cv(e);}function AC(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function MC(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function Rv(e){return Ev(e.children)}function Ev(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||yc$1(n))&&t.push(n);return t}function LC(e){if(yc$1(e))return Ev(Bc$2(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(...Rv(r));return t}function NC(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"},a=e.session.partFor(o);if(!a)return {ok:false,code:"notFound",reason:"the target story was not found"};let i="noteId"in r?r.noteId:null,s=r.part==="body"?yd$1(a):wd$1(a).find(y=>r.part==="header"||r.part==="footer"?y.kind===r.part:y.kind==="note"&&gd$1(y.root)===i)?.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=Rv(s),c;for(let y=0;y<t.path.length;y+=1){let v=t.path[y];if(!Number.isInteger(v)||v<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(c=l[v],!c)return {ok:false,code:"notFound",reason:`block index ${v} is out of range`};y<t.path.length-1&&(l=LC(c));}if(!c||c.kind!=="paragraph"||!Ga(a,c.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let u=(Nh$1(a,c.id)??"").length,g=t.offset??(n==="start"?0:u);if(!Number.isInteger(g)||g<0||g>u)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let m={paragraphId:c.id,offset:g};return {ok:true,selection:{anchor:m,head:m}}}function Fs(e,t,n){if(AC(t))return NC(e,t,n);if(!St(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 a=bt(e.session,o,{kind:"body"}),i=e.session.partFor(a);if(!i)return {ok:false,code:"notFound",reason:"the target story was not found"};let s=dn(i,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 Os(e,t){if(!MC(t)){let o=Fs(e,t,"start");if(!o.ok)return o;let a=Fs(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=Fs(e,t.from,"start");if(!n.ok)return n;let r=Fs(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function DC(e){return e.evenPage?"even":e.firstPage?"first":"default"}function Fv(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'"}:DC(e)}function du(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 a=t.variant!==void 0||t.firstPage!==void 0||t.evenPage!==void 0?Fv(t):n?.variant??"default";if(typeof a=="object"&&a.ok===false)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:a.reason}};let i=a,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:i}}function HC(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 _a(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}:HC(n.reason)}function As(e,t,n,r){let a=e.session.headerFooterResolutionBySection()[t];if(!a)return null;let s=(n==="header"?a.headers:a.footers).get(r);return s?{rId:s.rId,partName:s.partName,inherited:s.inherited,titlePage:a.titlePage,evenAndOddHeaders:a.evenAndOddHeaders}:null}function Ov(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=Fv(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,s=As(e,n,r,a)?.rId,l=false;if(!s){let u=_a(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!u.ok)return u;l=true,s=As(e,n,r,a)?.rId;}return s?e.enterHeaderFooter({rId:s,kind:r,sectionIndex:n,variant:a})?{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 Av(e,t){let n=du(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=_a(e,{op:"deleteHeaderFooter",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});return a.ok&&o&&r?.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant&&e.exitHeaderFooter(),a}function Mv(e,t){let n=du(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,a=_a(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=As(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function Lv(e,t){let n=du(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,a=r?.rId,i=_a(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let s=As(e,n.sectionIndex,n.kind,n.variant);return o&&s&&s.rId!==a&&e.enterHeaderFooter({rId:s.rId,kind:n.kind,sectionIndex:n.sectionIndex}),i}function Nv(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return _a(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 Dv(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 Hv(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 _v(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 Bv(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 $v(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 qv(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 zv(e,t,n){switch(t.type){case "toggleMark":{let r=Ud.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=Wd(t);if(!r.ok)return {ok:false,code:r.code,reason:r.reason};e.setRunProperty(r.localName,r.attributes);break}case "clearFormatting":e.clearFormatting();break;case "copyFormatting":return e.formatPainter.capture()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:Ui};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:Nd};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??Nd};break}case "setLineSpacing":e.setParagraphProperty("spacing",ks({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...go("before",t.beforePt),...go("after",t.afterPt)},{mergeAttributes:true});break;case "setAlignment":e.setParagraphProperty("jc",{val:t.align==="justify"?"both":t.align});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.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,a=t.pageHeight;if(t.orientation!==void 0&&(o!==void 0||a!==void 0)){let s=r?e.sectionPropertiesAt(r):e.sectionProperties(),l=o??s.pageSize.widthTwips,c=a??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,c):Math.min(l,c),a=t.orientation==="landscape"?Math.min(l,c):Math.max(l,c);}if(!e.setSectionProperties({...o!==void 0?{pageWidthTwips:o}:{},...a!==void 0?{pageHeightTwips:a}:{},...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 "insertText":e.type(t.text);break;case "deleteText":e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=Os(e,t.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};e.setSelection(a.selection);}let r=t.type==="proposeInsertion"?"insertion":t.type==="proposeDeletion"?"deletion":"replacement",o=t.type==="proposeInsertion"?t.text:t.type==="proposeReplacement"?t.replaceWith:"";if(!e.proposeTextChange(r,o,t.author))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??`${t.type} was refused`};break}case "undo":e.undo();break;case "redo":e.redo();break;case "insertTable":if(!e.insertTable(t.rows,t.cols))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table could not be inserted here"};break;case "insertToc":if(!e.insertToc())return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be inserted"};break;case "editTextFormField":return e.editTextFormField()?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"field options are unavailable"};case "refreshToc":if(!e.refreshToc(t.tocId,t.mode))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be refreshed"};break;case "editHeaderFooter":return Ov(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return Av(e,t);case "linkHeaderFooterToPrevious":return Mv(e,t);case "unlinkHeaderFooterFromPrevious":return Lv(e,t);case "setHeaderFooterOptions":return Nv(e,t);case "insertPageField":return Dv(e,t);case "insertNote":return Hv(e,t);case "deleteNote":return _v(e,t);case "convertNote":return Bv(e,t);case "convertAllNotes":return $v(e,t);case "setNoteProperties":return qv(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(!no(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Nn({command:t,part:e.session.part(),layout:e.layout(),storeRevision:e.session.packageRevision(),selection:e.state().selection,cellSelection:e.state().cellSelection,themeColors:e.session.documentThemeColors(),editable:e.session.editable,viewing:e.editingMode()==="view"});return e.applyTableCommandPlan(r)}case "selectAll":return e.selectAll(),{ok:true,changed:false};case "copy":{let r=e.copyFlavours();return lu(r.text,r.html),{ok:true,changed:false}}case "cut":{let r=e.copyFlavours();lu(r.text,r.html),e.deleteSelection();break}case "paste":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&&Gd(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&St(t.anchor)?{anchor:t.anchor}:"range"in t&&Sr(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Ch(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=$C(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return ka(t)?ry(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function Zv(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 a of za$1(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function _C(e,t){let n=e.layout().pages;for(let r=0;r<n.length;r+=1){let o=n[r];for(let a of [o.header,o.footer])if(a){for(let i of za$1(a.fragments))if(i.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function BC(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 $C(e,t){let n=bt(e.session,t.head.paragraphId,{kind:"body"}),r=bt(e.session,t.anchor.paragraphId,{kind:"body"});if(!BC(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=_C(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 a=Zv(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:Zv(e,t.anchor.paragraphId))!==a?{ok:false,code:"unsupported",reason:"a selection cannot span two stories"}:o.kind==="note"&&o.id===a?{ok:true,changed:false}:(e.exitHeaderFooter?.(),e.enterNote?.(a)?{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 Vv={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none"};function Kv(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:Uh(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`}}function jv(){let e={...Vv};return {moved(t,n){let r=Kv(t,n),o=Qi(r.selection,e.selection)&&r.pendingFormat===e.pendingFormat&&r.headerFooter===e.headerFooter&&r.drawingIntent===e.drawingIntent&&r.formatPainter===e.formatPainter;return e=r,!o},adopt(t){e=Kv(t.state(),t);},reset(){e={...Vv};}}}function qC(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)),a=-1;for(let c=n-22;c>=o;c-=1)if(r.getUint32(c,true)===101010256){a=c;break}if(a<0)return false;let i=r.getUint16(a+10,true),s=r.getUint32(a+16,true),l=0;for(let c=0;c<i;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}function Uv(e){let t=null,n=()=>{if(!t)return null;let{bytes:r}=t;return t.cancel(),t=null,r};return {shouldYield:r=>typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"&&(r.byteLength>=524288||qC(r,524288)),schedule(r){let o=null,a=null,i=()=>{t=null,e.mount(r);},s=requestAnimationFrame(()=>{a!==null&&clearTimeout(a),a=null,o=setTimeout(i,0);});a=setTimeout(()=>{cancelAnimationFrame(s),i();},250),t={bytes:r,cancel:()=>{cancelAnimationFrame(s),o!==null&&clearTimeout(o),a!==null&&clearTimeout(a);}},e.scheduled();},cancel:n,flush(){let r=n();r&&e.mount(r);},isScheduled:()=>t!==null}}function Wv(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function Gv(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function Xv(e){return e.kind==="comment"}function Yv(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 a=e.bodyOrder(),i=a.get(r.paragraphId)??-1,s=a.get(o.paragraphId)??-1;if(i===-1||s===-1){let c=e.openStoryOrder();i=c.get(r.paragraphId)??-1,s=c.get(o.paragraphId)??-1;}return i===-1||s===-1?null:i<s||i===s&&r.offset<=o.offset?{from:r,to:o}:{from:o,to:r}}function ZC(e){let t=new Map;for(let n of e){let r=n.item;if(!Xv(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 zC(e,t){let n=e.filter(a=>a.key===t);if(n.length===0)return {ok:false,code:"notFound",reason:"no review item with that key"};let r=n.map(a=>a.item).filter(Xv);if(r.length===0)return {ok:false,code:"kindMismatch",reason:"the review item is not a comment"};let o=r[0];for(let a of r)if(a.comment!==o.comment)return {ok:false,code:"ambiguous",reason:"duplicate comment records share that key"};return o}function Qv(e,t,n){if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:e.proReviewReason};if(e.editingMode==="viewing")return {ok:false,code:"locked",reason:"the document is open for viewing"};let r=e.placements(),o=zC(r,t);if(!("kind"in o))return o;if(!e.surface)return {ok:false,code:"notFound",reason:"no review item with that key"};let a=ZC(r);if(a==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let i=o,s=new Set;for(;i.parentId!==void 0&&!s.has(i.id);){s.add(i.id);let u=a.get(i.parentId);if(!u)break;i=u;}let l=false,c=false;return e.surface.commitReviewOps(()=>{let u=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(i.id,n),c=l&&e.surface.session.packageRevision()!==u,{committed:c}},"comment-resolve"),l?(c&&e.bump(),{ok:true,changed:c}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function Jv(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 ex=new WeakMap;function UC(e){return !(!e.story||e.origin===b$1.mutationUndo||e.origin===b$1.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.some(t=>t!==g$3.story))}function WC(e,t){UC(t)||(e.summaries=null);}function GC(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>WC(t,n)));}function nx(e){}function rx(e,t){let n=ex.get(e);return n||(n={summaries:null,subscribed:false},ex.set(e,n)),GC(e,n),n.summaries||(n.summaries=t()),n.summaries}var XC=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function YC(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function QC(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(St(t)){let o=dn(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(YC(t)){if(!St(t.from)||!St(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=dn(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=dn(n,r,t.to);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:t};if(o.span.nodeId!==a.span.nodeId)return {ok:false,code:"unsupported",reason:"wrapping several paragraphs in one content control is not supported",target:t};let i=Math.min(o.span.start,a.span.start),s=Math.max(o.span.end,a.span.end);return {ok:true,span:{paragraphId:o.span.nodeId,start:i,end:s}}}return {ok:false,code:"unsupported",reason:"address the span with a paraId anchor; DocLocation targeting is not supported",target:t}}function cu(e,t){let n=XC.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=wr(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=QC(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 JC="http://schemas.microsoft.com/office/word/2010/wordml",eR="http://schemas.microsoft.com/office/word/2012/wordml";function Er(e){return Cd$1(e)}function Ba(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function tR(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===da$1)return t.value}}function uu(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return tR(n)}}function nR(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=rR(t);if(n!==void 0)return n}return "richText"}function rR(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(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===JC||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===eR)return "repeatingSection"}function Ms(e){let t=uu(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function oR(e,t){if(Ms(Ba(t)))return true;let n=Ha$1(e,t.id);for(;n;){if(Er(n)&&Ms(Ba(n)))return true;n=Ha$1(e,n.id);}return false}function pu(e,t){let n=Ba(e),r=uu(n,"tag"),o=uu(n,"alias"),a=t?oR(t,e):Ms(n);return {id:e.id,controlType:nR(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var ox=new WeakMap;function aR(e,t){let n=[],r=Ha$1(e,t.id);for(;r;)Er(r)&&n.push(`${r.id}:${Ms(Ba(r))?1:0}`),r=Ha$1(e,r.id);return n.join("|")}function ix(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function iR(e){return Object.freeze(e.map(t=>ix(t)))}function sR(e,t){let n=e.node,r=Ba(n),o=aR(t,n),a=ox.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=ix(pu(n,t));return ox.set(n,{properties:r,lockAncestors:o,summary:i}),i}function lR(e){let t=Jc$1(e.root);return nx(t.length),t.map(n=>sR(n,e))}function dR(e){return iR(e.storyParts().flatMap(t=>lR(t)))}function cR(e){return rx(e,()=>dR(e))}function fu(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 uR(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,a,i)=>{if(i>=la$1)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=Ne$1(e,l);continue}if(na$1(l)){s=n(l.children,s,a,i+1);continue}if(Er(l)){let c=s,u=a+1;s=n(Bc$2(l),s,u,i+1),t.push({control:l,start:c,end:s,depth:u});continue}s+=Ne$1(e,l);}return s};return n(e.children,0,-1,0),t}function mu(e,t,n){return uR(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>pu(r.control,n))}function gu(e,t){let n=[],r=Ha$1(e,t);for(;r;)Er(r)&&n.push(pu(r,e)),r=Ha$1(e,r.id);return n.reverse()}function sx(e,t){if(!e)return [];let n=cR(e.session);return t?n.filter(r=>fu(r,t)):n}function hu(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=at(e.session,n)??e.session.part(),a=Ga(o,n);if(a&&a.kind==="paragraph"){for(let s of mu(a,r,o))if(fu(s,t))return s}let i=gu(o,n);for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(fu(l,t))return l}return null}function yu(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function fR(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function pR(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function mR(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 Ls(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||Er(n))&&t.push(n);return t}function gR(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...Ls(r.children));return t}function hR(e){return e.kind==="table"?gR(e):Er(e)?Ls(Bc$2(e)):e.kind==="body"?Ls(e.children):[]}function yR(e,t,n){if(Er(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of mu(t,r,e))return {ok:true,controlId:i.id};let a=gu(e,t.id).at(-1);if(a)return {ok:true,controlId:a.id}}return {ok:false,code:"notFound",reason:"no content control at the addressed block"}}function bR(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=mR(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=Ls(n.children),o=null;for(let i=0;i<t.path.length;i+=1){if(o=r[t.path[i]]??null,!o)return {ok:false,code:"notFound",reason:`block index ${t.path[i]} is out of range`,target:t};i<t.path.length-1&&(r=hR(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=yR(e,o,t.offset);return a.ok?a:{...a,target:t}}function vR(e,t,n){let r=dn(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,a=Ga(o,r.span.nodeId);if(!a||a.kind!=="paragraph")return {ok:false,code:"notFound",reason:`paragraph '${n.paraId}' was not found`,target:n};let i=r.span.start;for(let c of mu(a,i,o))return {ok:true,controlId:c.id};let l=gu(o,a.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 lx(e,t){if(t===void 0){let r=hu(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(pR(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return fR(t)?bR(n,t):St(t)?vR(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function dx(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 cx(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 ux(e,t){return {ok:false,code:dx(e),reason:cx(e),...t!==void 0?{target:t}:{}}}function xR(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 bu(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function vu(e,t,n,r){let o=xR(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=cu(t,e);return s.ok?ax(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let a=lx(t,e.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};let i=e.type==="setContentControlValue"?{op:"setContentControlValue",controlId:a.controlId,value:e.value}:{op:"removeContentControl",controlId:a.controlId};return ax(t,i,a.controlId)}function ax(e,t,n){let r=Sh$1(at(e.session,n)??e.session.part(),t);return r?{ok:false,code:dx(r),reason:cx(r)}:{ok:true}}function fx(e,t,n,r){t?.flushPendingInput();let o=vu(e,t,n,r);return o.ok?SR(t,e):o}function px(e,t,n,r,o){let a=e.applyGatedTreeOps;return typeof a=="function"?a.call(e,t,n,r,o):e.session.applyTreeOps(t,n,r,o)}function SR(e,t){if(t.type==="insertContentControl")return IR(e,t);let n=lx(e,t.target);if(!n.ok){let i=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...i!==void 0?{target:i}:{}}}e.flushPendingInput();let r=wr(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=px(e,[o],r,r,bt(e.session,n.controlId,{kind:"body"}));return a.rejected?ux(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function IR(e,t){e.flushPendingInput();let n=cu(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:a}=n.span,i=wr(e.state().selection),s={paragraphId:r,start:o,end:a},l=px(e,[n.op],i,s,bt(e.session,r,{kind:"body"}));return l.rejected?ux(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}var wR=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function mx(e,t){let n=new Map,r=s=>{if(s===void 0||!wR.test(s))return;let l=s.toLowerCase();n.has(l)||n.set(l,s);};r(e$1(e));let o=e?.substitutions??[],a=new Set(o.map(s=>s.to.family.toLowerCase()));for(let s of o)r(s.from.family);for(let s of e?.sources??[])a.has(s.request.family.toLowerCase())||r(s.request.family);for(let s of t)r(s);let i=[...n.values()];return i.sort((s,l)=>s<l?-1:s>l?1:0),i}var gx=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),hx=e=>new a(e.reason,e.reason==="overLimit"?`embedded font ${e.request.family} (${e.partName}) exceeds the font byte budget`:`embedded font part ${e.partName} declares an invalid family name`,{request:e.request});function yx(e,t){return m(e,t)}function xu(e,t,n){return n$1(e,t,n)}var kR="The quick brown fox 0123 \u2014 {}#@",TR=["monospace","serif"],PR=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function vx(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(kR).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!PR.test(r))return t.set(r,true),true;let a=false;for(let i of TR){let s=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==s){a=true;break}}return t.set(r,a),a}}var bx=4;function xx(e,t,n){let r=new Set,o=[];for(let u of t){let g=u.toLowerCase();r.has(g)||(r.add(g),o.push(u));}let a=u=>new Set(e.slice(0,Math.max(u,0)).map(g=>g.toLowerCase())),i=0;for(let u=0;u<=bx;u+=1){let g=a(n-i),m=o.filter(v=>!g.has(v.toLowerCase())).length,y=Math.min(m,bx,Math.floor(n/2));if(y===i)break;i=y;}let s=e.slice(0,Math.max(n-i,0)),l=a(n-i),c=o.filter(u=>!l.has(u.toLowerCase()));return [...s,...c].slice(0,n)}function Sx(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=He.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}function Ix(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 a of t){let i=a.from.family.toLowerCase();n.has(i)||!n.has(a.to.family.toLowerCase())||(n.add(i),o=true);}if(!o)break}return n}function wx(e){let t=e.storyParts().map(n=>n.root);return [...e.symbolFontFamilies(),...p(t),...r(t,e.numberingRoot(),e.stylesRoot(),e.documentThemeFonts())]}var kx=Object.freeze({installed:0,alias:()=>{},dispose(){}});function CR(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)}`}function RR(){let t=(typeof document<"u"?document:void 0)?.fonts;return !t||typeof FontFace>"u"?{}:{fontSet:t,createFontFace:(n,r,o)=>new FontFace(n,r.slice().buffer,o)}}async function Tx(e,t=RR(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return kx;let a=new Map;for(let c of e){let u=c.request.family,g=a.get(u);g?g.push(c):a.set(u,[c]);}let i=new Map,s=[];if(await Promise.all([...a].map(async([c,u])=>{let g=CR(u.map(y=>y.hash)),m=false;await Promise.all(u.map(async y=>{try{let v=o(g,y.bytes,{weight:String(y.request.weight),style:y.request.style});await v.load(),r.add(v),s.push(v),m=!0;}catch{}})),m&&i.set(c,g);})),s.length===0)return kx;for(let c of n){if(i.has(c.from.family))continue;let u=i.get(c.to.family);u!==void 0&&i.set(c.from.family,u);}let l=false;return {installed:s.length,alias:c=>l?void 0:i.get(c),dispose(){if(!l){l=true;for(let c of s)try{r.delete(c);}catch{}}}}}var $a=.1,qa=5;var ho={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},ER={type:"fit",fit:"pageWidth"},Ns={type:"fixed"};function Ds(e){return e==="auto"?ho:!e||typeof e!="object"?null:e.type==="fixed"?Ns:e.type==="fit"&&e.fit==="pageWidth"?Hs(e,ho)?ho:e:null}function Hs(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 yo(e){return e.type==="fit"}function Cx({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 a=Number.isFinite(n)&&n>0?n:0,i=Math.max(e-2*a,e*.5),s=Number.isFinite(r)?Px(r):.1,l=Number.isFinite(o)?Px(o):5,c=Math.floor(i/t*100)/100;return Math.min(Math.max(c,s),Math.max(l,s))}function Px(e){return Math.min(Math.max(e,.1),5)}function FR(e){let t=Vt(e);if(!t)return null;let n=t.clientWidth;if(!Number.isFinite(n)||n<=0)return null;let r=t.ownerDocument.defaultView?.getComputedStyle(t);if(!r)return n;let o=Number.parseFloat(r.paddingLeft)||0,a=Number.parseFloat(r.paddingRight)||0;return Math.max(n-o-a,0)}function Rx(e){let t=null,n=null,r=null,o=null;function a(){if(r===null)return;n?.ownerDocument.defaultView?.cancelAnimationFrame(r),r=null;}function i(){let l=e.mode();if(!yo(l))return;let c=e.container();if(!c)return;let u=FR(c);if(u===null)return;let g=e.pageWidthPx();if(g===null)return;o=e.pageWidthTwips();let m=Cx({availableWidthPx:u,pageWidthPx:g,...l.minZoom!==void 0?{minZoom:l.minZoom}:{},...l.maxZoom!==void 0?{maxZoom:l.maxZoom}:{}});m===null||m===e.zoom()||e.applyZoom(m);}function s(){let l=n?.ownerDocument.defaultView;if(!l?.requestAnimationFrame){i();return}r===null&&(r=l.requestAnimationFrame(()=>{r=null,i();}));}return {refitIfPageResized(){let l=e.pageWidthTwips();l===null||l===o||i();},attach(){this.detach();let l=e.container();if(!l)return;let c=Vt(l);c&&(n=c,typeof ResizeObserver<"u"&&(t=new ResizeObserver(s),t.observe(c)),i());},refit:i,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function Fx(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=Ds(e.zoomMode??(n!==null?Ns:"auto"))??ho;function a(l,c){if(l===r)return c?.(),true;let u=t.surface();return u&&!Iv(u,l*(96/72))?false:(r=l,c?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=Ns,s.detach();}let s=Rx({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=>{a(l);}});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{yo(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=yo(o);return l===r?c?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(l,c?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let c=Ds(l);return c?Hs(c,o)?{ok:true,changed:false}:(o=c,yo(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 Ex(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function Ox(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:Ex(r.box),contentBox:Ex(r.contentBox)})):[]}}}var Hn="comments and tracked changes require the pro review module (@docx-editor.dev/pro)";var Yn="suggesting mode needs an author; configure author before enabling it",OR="this document asks for tracked changes, but no author is configured",_s={mode:null,rejection:null};function Su(e,t){if(e===void 0||e==="view")return _s;if(e==="edit")return {mode:"editing",rejection:null};let n=Iu(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function Iu(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:Yn}:{ok:false,code:"unsupported",reason:Hn}}function Ax(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==Yn||t||n!==null||(n=setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let a=`${Yn}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(Zt("suggestingNeedsAuthor",a)),r(`[@docx-editor.dev/core] ${a}`);},0));},dispose(){n!==null&&clearTimeout(n),n=null;}}}function wu(e){return e.viewOnly||e.currentMode!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?_s:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:OR}}function ku(e,t){return t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function Mx(e,t,n,r,o){let a=Su(e,t),i=e==="view"?"viewing":a.mode??o,s=wu({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:i});s.mode!==null&&(i=s.mode);let l=ku(n,i);return {mode:l===null?i:r,rejection:s.rejection??l?.reason??null,configurationRejection:a.rejection}}var Lx=new Map;function Nx(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 a=c(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:b(t)}),r.value.get(o))}}function Tu(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 Dx(e){let t=Ug$1(e),n=new Intl.Locale(t).baseName;for(;n&&!Object.hasOwn(locales,n);){let s=n.lastIndexOf("-");n=s<0?"":n.slice(0,s);}let r=new Intl.Locale(t).maximize(),o=n?void 0:Object.keys(locales).find(s=>{let l=new Intl.Locale(s).maximize();return l.language===r.language&&l.script===r.script}),a=n||o||"en",i=createT(deepMerge(en$1,a==="en"?void 0:locales[a]),a);return {locale:t,labels:{title:i("toolbar.tableOfContents")}}}function Hx(e){let t=e.mode,n=e.translate,r=n?i$1(n):h,o=Dx(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:a=>Su(t,a),setMode(a){return t===a?false:(t=a,true)},translate:()=>n,drawingStrings:()=>r,setTranslate(a){if(n===a)return null;n=a;let i=a?i$1(a):h;return g$1(r)===g$1(i)?(r=i,null):(r=i,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(a){let i=Dx(a);return o.locale===i.locale?null:(o=i,o.labels)}}}function _x(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 NR=Object.freeze({kind:"body"}),DR=Object.freeze([]);function HR(e$2){let t$1=Hx(e$2),n=xc(e$2.author),r=e$2.container??null,o=a$3(e$2.modules),a$2=Wv(o),i=o.review!==null,s=null,l=new WeakMap,c=Uv({mount:x=>pt(x),scheduled:()=>{ue(),Oe();}}),u=t$1.mode()==="view"?"viewing":"editing",g=null,m=ds(),y=Nx(e$2.revisionStyles),v=e(),w=false,b=null,S=()=>({reviewEnabled:i,hasAuthor:!!n}),k=false,O=null,D=Ax({stillMissing:()=>!$&&n===void 0&&tr(null)===Yn,emit:x=>ke(x)}),L=t$1.openingModeDecision(S());L.mode!==null&&(u=L.mode),L.rejection!==null&&(b=L.rejection),D.report(L.rejection);let p=null,A=null,Z=null,T=null,P=jv(),N={kind:"none"},_=Tu({}),M=Tu({}),$=false,E,G,le=null;function ne(){le?.dispose(),le=null;}let F=0,j,z=()=>typeof e$2.fonts=="function"?j:e$2.fonts,X=-1,Q=false,H=null,J$1=x=>(H||(H=vx(r?so(r.ownerDocument):null)),H(x)),ee=new Set,pe=x=>ee.has(x.toLowerCase())||le?.alias(x)!==void 0,R=()=>!p||Q?DR:Sx(p.session.renderedFontFamilies(),pe,J$1),K=0,U=null,de,Ie=null,ce=-1,re=0,ye=-1,we=false;function ue(){K+=1;}let Be={change:new Set,selectionChange:new Set,error:new Set};function ke(x){for(let V of [...Be.error])V(x);}function Fe(x){for(let V of [...Be.change])V(x);}function Oe(){if(Be.selectionChange.size===0)return;let x=fn();for(let V of [...Be.selectionChange])V(x);}function Ot(){T?.(),T=null,p?.destroy(),p=null,P.reset(),re+=1;}let Ce=Fx(e$2,{container:()=>r,surface:()=>p,bump:ue,emitSelectionChange:Oe}),Ae=()=>Ce.scale();function pt(x,V,te){if(te??=l.get(x),l.delete(x),!r){s=x,te&&l.set(x,te),Z=null,ue();return}Ot();let ve=m.stateKey,oe=su(r,x,{scale:Ae(),defaultFontFamily:e$1(z()),translate:t$1.translate(),drawingStrings:t$1.drawingStrings(),locale:t$1.locale(),...n?{author:n}:{},...y.current()!==void 0?{revisionStyles:y.current()}:{},reviewAuthorSlots:v,revisionAuthorVisibility:m,initialDrawingSelectionIntent:N,initialSelection:V,initialTextFormInput:te,editingMode:u==="suggesting"?"suggest":u==="viewing"?"view":"edit",...i?{}:{revisionDisplayMode:"proposed"},...o.review?{reviewModel:{...o.review,collectReviewItems:he=>o.review.collectReviewItems(o.customNodes.length>0?{...he,customNodes:o.customNodes,...o.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:a$2}:{}}:he)}}:{},...E?{measurer:E,...G?{producer:G}:{}}:{},...le?{fontAlias:le.alias}:{},...e$2.tableInteractionLabel?{tableInteractionLabel:e$2.tableInteractionLabel}:{},...e$2.imageDecodePort?{imageDecodePort:e$2.imageDecodePort}:{},...o.collaboration?{collaborationModel:o.collaboration}:{},onHyperlinkPopover:he=>_.current().onPopover?.(he),onRequestHyperlink:()=>_.current().onRequest?.(),onEquationPopover:he=>M.current().onPopover?.(he),onTrackedChange:()=>{we||(we=true,ue(),Oe());},tocLabels:t$1.tocLabels(),onChange:he=>{if(!p)return;ue();let Pe=ve!==m.stateKey;ve=m.stateKey,!(!Pe&&!P.moved(he,p))&&Oe();}});if(!oe.ok){Z=oe.detail?`${oe.reason}: ${oe.detail}`:oe.reason,ue(),ke(Zt(oe.reason,`failed to open document: ${Z}`));return}Z=null,p=oe.surface,we=i&&p.session.reviewItems().length>0,P.adopt(p),O!==null?Nr(O,false):Ka(),Gv(p,o),re+=1,p.setEditable(u!=="viewing"),A!==null&&p.setRemoteCaretLabelHost(A),g!==null&&p.setReviewActivationExclusions(g),T=oe.surface.session.subscribe(he=>{let Pe={revision:oe.surface.session.packageRevision(),created:he.created,deleted:he.deleted,dirty:he.dirty};Ce.refitIfPageResized(),ue(),Fe(Pe);}),Ce.attach(),ue(),Fe({revision:p.session.packageRevision()}),Oe(),X!==F&&(X=F,Qn(F,p));}function At(x){if(c.cancel(),l=new WeakMap,we=false,F+=1,v=e(),m.showAll(),E=void 0,G=void 0,j=void 0,ee=new Set,ne(),Q=false,r){let V=Vt(r);V&&(V.scrollTop=0,V.scrollLeft=0);}r&&c.shouldYield(x)?c.schedule(x):pt(x);}function un(x){(x.code==="wasmUnavailable"||x.cause instanceof t&&x.cause.code==="unsupportedRuntime")&&!e$2.onFontError&&Be.error.size===0&&Bm(x);try{e$2.onFontError?.(x);}catch{}ke(x);}async function Qn(x,V){let te=e$2.fonts,ve=V.session.embeddedFonts();if(!(!te&&ve.length===0)){Q=true,ue();try{let oe=typeof te=="function"?a$6(await te({families:xx(V.session.documentFonts(),wx(V.session),b$2),defaultFamily:e$1(z())})):te;if($||x!==F){x===F&&(Q=!1);return}if(j=oe,!oe&&ve.length===0){Q=!1,ue();return}let he=(oe&&"maxFontBytes"in oe?oe.maxFontBytes:void 0)??a$1,Pe=yx(oe?.sources??[],he),Ee=Pe.sources;for(let $e of Pe.dropped)un(gx($e));let ge=xu(ve,Ee,he),He=!1,qe=()=>{if(!He){He=!0;for(let $e of ge.dropped)un(hx($e));}},Le=d$3({epoch:x,...oe,sources:Ee},ge);if(Le.sources.length===0){qe(),Q=!1,ue(),oe&&un(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let Ge=await ga(Le),gn=()=>!$&&x===F?!1:(J(Ge),x===F&&(Q=!1),!0);if(gn())return;let dt=$e=>{qe(),$e&&J($e),Q=!1,ue();},Dr=($e,rt)=>{let kt=new Set;for(let mt of rt.sources??[]){let Tt=$e.fonts.resolve(mt.request);Tt instanceof d&&(un(Xr(Tt)),kt.add(g$2(mt.request)));}return kt},Po=Dr(Ge,Le);try{if(Po.size>0){let $e=Ee.filter(jt=>!Po.has(g$2(jt.request))),rt=$e.length!==Ee.length;rt&&(ge=xu(ve,$e,he));let kt=ge.sources.filter(jt=>rt||!Po.has(g$2(jt.request))),mt=Ge;if(Le=d$3({epoch:x,...oe,sources:$e},{sources:kt}),Le.sources.length===0)return dt(mt);if(Ge=await ga(Le),J(mt),gn())return;let Tt=Dr(Ge,Le);if(Tt.size>0){let jt=$e.filter(Co=>!Tt.has(g$2(Co.request))),Wa=ge.sources.filter(Co=>!Tt.has(g$2(Co.request))),it=Ge;if(Le=d$3({epoch:x,...oe,sources:jt},{sources:Wa}),Le.sources.length===0)return dt(it);if(Ge=await ga(Le),J(it),gn())return}}}finally{qe();}let ct=Le.sources.map($e=>{let rt=Ge.fonts.resolve($e.request);return rt instanceof d||rt.id!==$e.id?null:{request:$e.request,id:rt.id,bytes:rt.bytes,hash:rt.hash,faceIndex:rt.faceIndex}}).filter($e=>$e!==null),Hr=await Tx(ct,void 0,Le.substitutions??[]);if($||x!==F){Hr.dispose(),gn();return}ne(),le=Hr,ee=Ix(ct,Le.substitutions??[]);let Ua=Ke(Ae(),{context:r?so(r.ownerDocument):null,...le?{fontAlias:le.alias}:{}}),Bn=new Map;if(E=Ve(Ge,{resolveFont:$e=>{let rt=$e.fontFamily??Le.defaultFont.family;if(rt.trim().length===0)return null;let kt={family:rt,weight:$e.bold?700:400,style:$e.italic?"italic":"normal"},mt=g$2(kt);if(Bn.has(mt))return Bn.get(mt)??null;let Tt;try{Tt=Ge.fonts.resolve(kt);}catch{return Bn.set(mt,null),null}let jt=Tt instanceof d?null:Tt;return Bn.set(mt,jt),jt},fallback:Ua.measurer}),G=`shaped:${Ge.operation.extensionFingerprint}+algorithm:${Ge.operation.shapingHash}+producer:${Ge.operation.producerVersion}+fallback:${Ua.producer}@scale:${Ae()}`,Q=!1,p){p.flushPendingInput();let $e=p.session.save(),rt=r?is(r):void 0,kt=p.state().selection;N=p.drawingSelectionIntent();let mt=r?.ownerDocument.activeElement,Tt=!!mt&&!!r?.contains(mt);try{pt($e,kt,rt);}catch(jt){E=void 0,G=void 0,p||(s=$e,pt($e,kt,rt)),un(Xr(jt));}Tt&&(p?.focus(),p?.setSelection(kt)),N={kind:"none"};}else ue();}catch(oe){if($||x!==F)return;Q=false,ue(),un(Xr(oe));}}}let Za=Kd();function za$2(){let x=p?.state()??null;return {scope:p?.activeScope?.()??NR,isLoading:Z===null&&p===null&&s===null&&!c.isScheduled(),isOpening:c.isScheduled(),parseError:Z,editable:p!==null&&p.session.editable&&t$1.mode()!=="view"&&u!=="viewing",zoom:Ce.zoom(),zoomMode:Ce.mode(),selection:dc(p),selectionCollapsed:x===null||x.selection.anchor.paragraphId===x.selection.head.paragraphId&&x.selection.anchor.offset===x.selection.head.offset,formatting:oy(p),table:fc(p),tocContext:Za(x?.contextTocId??null),image:vn(p),page:{current:uc(p),total:cc(p)},canUndo:x?.canUndo??false,canRedo:x?.canRedo??false,pageSetup:lc(p),reviewPaneOpen:we,hasReviewContent:p?.session.hasReviewContent()??false,hiddenReviewAuthors:m.hiddenAuthorList,collaborationStatus:x?.collaborationStatus??"inactive",editingMode:u,lastRejection:b??x?.lastRejection??null,fontSubstitutions:R(),formatPainter:x?.formatPainter??Wi}}function fn(){if(U&&ye===K)return U;let x=U,V=n===de;de=n;let te=p?.state().selection??null,ve=Qi(te,Ie);Ie=te;let oe=p?.session.packageRevision()??-1,he=oe===ce;ce=oe;let Pe=za$2(),Ee=Pe;if(x){let ge=qd(Pe.formatting,x.formatting)?x.formatting:Pe.formatting,He=Zd(Pe.page,x.page)?x.page:Pe.page,qe=zd(Pe.pageSetup??null,x.pageSetup??null)?x.pageSetup:Pe.pageSetup,Le=Vd(Pe.selection,x.selection)?x.selection:Pe.selection,Ge=Yh(Pe.image,x.image)?x.image:Pe.image,gn=x.fontSubstitutions!==void 0&&Pe.fontSubstitutions!==void 0&&x.fontSubstitutions.length===Pe.fontSubstitutions.length&&Pe.fontSubstitutions.every((dt,Dr)=>x.fontSubstitutions[Dr]===dt)?x.fontSubstitutions:Pe.fontSubstitutions;Ee={...Pe,formatting:ge,page:He,pageSetup:qe,selection:Le,image:Ge,fontSubstitutions:gn},jd(Ee,x)&&ve&&he&&V&&(Ee=x);}return U=Yi(Ee),ye=K,U}if(e$2.document){let x=Xd(e$2.document);x?At(x):(Z=Yd(e$2.document),ke(Zt("unsupported",Z)));}let Et=Zy({surface:()=>p,activeKey:Mr,paneOpen:()=>we,selectionAnchor:()=>In()?.anchorY??null,authorFilterKey:()=>m.stateKey});function Kt(x){return x.kind==="revision"?x.ranges[0]??null:x.range}function bo(x){return Kt(x)===null?false:!(x.kind==="revision"&&g!==null&&g.includes(x.revisionKind))}let vo=kv(),xo=new WeakMap;function Va(x){let V=xo.get(x);if(V)return V;let te=new Map;for(let ve of x.pages)for(let oe of [ve.footnotes,ve.endnotes])if(oe)for(let he of oe.notes)for(let Pe of za$1(he.fragments))for(let Ee of Pa$1(Pe))te.has(Ee)||te.set(Ee,he.scopeId);return xo.set(x,te),te}function Or(x){let V=Kt(x)?.partName;if(!V||!p||V===p.session.part().name)return null;for(let te of p.session.headerFooterResolutionBySection())for(let ve of ["header","footer"]){let oe=ve==="header"?te.headers:te.footers;for(let he of oe.values())if(he.partName===V)return {kind:ve,rId:he.rId}}return null}function So(x){let V=Kt(x),te=p?.publishedLayout();return !V||!te?null:Va(te).get(V.start.paragraphId)??null}function Mt(x){let V=Kt(x)?.partName;if(!V||!p)return null;for(let te of ["footnote","endnote"])if(If(p.session.currentPackage(),te)?.name===V)return {kind:"notesPart",noteKind:te};return null}function nn(x){let V=Or(x);return V!==null?{kind:"headerFooter",rId:V.rId}:Mt(x)??{kind:"body"}}let wt=()=>`${new Date().toISOString().slice(0,19)}Z`,Io=new WeakMap;function _n(x){let V=Io.get(x);if(V)return V;let te=new Map;for(let[ve,oe]of Ra$1(x).entries())te.set(oe,ve);return Io.set(x,te),te}function wo(){return Yv({surface:p,bodyOrder:()=>{let x=p?.publishedLayout();return x?_n(x):new Map},openStoryOrder:er})}function Jn(){let x=p?.activeScope();if(x?.kind==="headerFooter")return {kind:"headerFooter",rId:x.rId};if(x?.kind==="note"){let V=Zc$1(x.id);if(V)return {kind:"notesPart",noteKind:V.noteKind}}return {kind:"body"}}function Ar(x){if(!p)return {kind:"body"};let V=x.slice(0,x.indexOf("#"));if(V.length===0||V===p.session.part().name)return {kind:"body"};for(let te of p.session.headerFooterResolutionBySection())for(let ve of [te.headers,te.footers])for(let oe of ve.values())if(oe.partName===V)return {kind:"headerFooter",rId:oe.rId};for(let te of ["footnote","endnote"])if(If(p.session.currentPackage(),te)?.name===V)return {kind:"notesPart",noteKind:te};return Jn()}function er(){if(!p)return new Map;let x=Jn();if(x.kind==="body")return new Map;let V=new Map;for(let[te,ve]of p.session.paragraphIdsIn(x).entries())V.set(ve,te);return V}function ae(x){if(x.kind==="revision"){let te=x.ranges;if(te.length===0)return null;let oe=x.revisionKind==="replace"||x.revisionKind==="insert"||x.revisionKind==="delete"?te[te.length-1]:te[0];return {start:te[0].start,end:oe.end}}let V=Kt(x);return V?{start:V.start,end:V.end}:null}function In(){if(p&&p.activatedReviewKey()!==null)return null;let x=wo(),V=p?.publishedLayout();if(!x||!V)return null;let te=vo(V).get(x.from.paragraphId);return te?{pageIndex:te.pageIndex,anchorY:te.contentY+Pe(te,x.from.paragraphId,x.from.offset)}:null}function Mr(){return p?.activeReviewKey()??null}function Lt(x){if(!i)return [];let V=zy(p?.session.reviewItems()??[],m),te=x?.excludeRevisionKinds;if(te&&te.length>0){let ge=new Set(te);V=V.filter(qe=>qe.kind!=="revision"||!ge.has(qe.revisionKind));let He=new Set(V.filter(qe=>qe.kind==="revision").map(qe=>qe.id));V=V.map(qe=>{if(qe.kind!=="comment"||qe.parentRevisionId===void 0||He.has(qe.parentRevisionId))return qe;let{parentRevisionId:Le,...Ge}=qe;return Ge});}let ve=x?.placement!==false,oe=null;if(ve&&V.length>0){let ge=p?.publishedLayout()??null;ge&&(oe=vo(ge));}let he=Mr(),Pe=ge=>{let He=Or(ge);return He===null?1:He.kind==="header"?0:2},Ee=V.map((ge,He)=>({item:ge,position:He,pageIndex:oe?Re(ge,oe)?.pageIndex??null:null,group:Pe(ge)}));return Ee.sort((ge,He)=>{let qe=ge.pageIndex??Number.MAX_SAFE_INTEGER,Le=He.pageIndex??Number.MAX_SAFE_INTEGER;return qe!==Le?qe-Le:ge.group!==He.group?ge.group-He.group:ge.position-He.position}),Ee.map(({item:ge})=>{let He=za(ge),qe=oe?Re(ge,oe):null,Le={key:He,id:ge.id,...ja(ge)!==void 0?{date:ja(ge)}:{},activatable:bo(ge),anchorY:qe?.y??null,pageIndex:qe?.pageIndex??null,isActive:He===he};return ge.kind==="comment"?{...Le,kind:"comment",author:ge.comment.author,initials:Ha$2(ge.comment),text:Ga$1(ge.comment),resolved:ge.resolved,...ge.parentId!==void 0?{parentId:ge.parentId}:{},...ge.parentRevisionId!==void 0?{parentRevisionId:ge.parentRevisionId}:{},replyIds:ge.replyIds,readOnly:false,item:ge}:ge.kind==="revision"?{...Le,kind:"revision",revisionKind:ge.revisionKind,author:ge.author,initials:Dy(ge.author),text:ge.text,...ge.replacedText?{replacedText:ge.replacedText}:{},replyIds:ge.replyIds,readOnly:ge.readOnly,item:ge}:{...Le,kind:"custom",author:"",initials:"",text:ge.detail??ge.text,replyIds:[],readOnly:true,item:ge}})}function Lr(){return p?.session.trackingSettings()??qg$1}function Bs(x=u,V=w){let te=Lr();return wu({...S(),viewOnly:t$1.mode()==="view",hostChoseMode:t$1.mode()!==void 0,readerChoseMode:V,currentMode:x,trackRevisions:te.trackRevisions,restrictedToTrackedChanges:te.restrictedToTrackedChanges})}function pn(x){O=null,u=x,p?.setEditingMode(x==="suggesting"?"suggest":x==="viewing"?"view":"edit"),p?.setEditable(x!=="viewing");}function tr(x){return x!==null?x:u==="suggesting"&&n===void 0?Yn:k?Yn:w?null:t$1.openingModeDecision(S()).rejection}function Ka(){let x=Bs();b=tr(x.rejection),x.mode==="suggesting"&&pn("suggesting");}function Nr(x="editing",V=true){if(c.isScheduled()){O=x;return}O=null;let te=Mx(t$1.mode(),S(),Lr(),u,x);te.mode!==u&&pn(te.mode),b=tr(te.rejection),D.report(te.configurationRejection),V&&(ue(),Oe());}function ko(x){return t$1.mode()==="view"&&x!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(x==="suggesting"?Iu(S()):null)??ku(Lr(),x)}function ja(x){return x.kind==="comment"?x.comment.date:x.kind==="revision"?x.date:void 0}function To(x,V){if(!i)return {ok:false,code:"unsupported",reason:Hn};let ve=Lt().find(he=>he.key===x)?.item;if(!ve||ve.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(ve.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let oe;return p?.commitReviewOps(()=>(oe=p.session.applyTreeOps(ve.addresses.map(he=>V==="accept"?{op:"acceptRevision",revision:he}:{op:"rejectRevision",revision:he}),void 0,void 0,nn(ve)),oe),"revision-resolve"),oe?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof oe?.reason=="string"?oe.reason:"the revision was refused"}}let mn={get mountGeneration(){return re},get surface(){return p},setHyperlinkChrome:_.push,setEquationChrome:M.push,stateVersion:()=>K,fontMeasurement:()=>({measurer:E?"shaped":"fixed",resolving:Q,...E&&G?{producer:G}:{}}),attach(x){if($){ke(Zt("destroyed","this editor was destroyed; create a new instance to remount"));return}if(p&&r===x)return;if(p){p.flushPendingInput(),s=p.session.save();let ve=r?is(r):void 0;ve&&l.set(s,ve),Ot();}let V=c.cancel();V&&(s=V),Ce.detach(),r=x,H=null;let te=s;s=null,te&&c.shouldYield(te)?c.schedule(te):te?pt(te):ue();},detach(){if($)return;Ce.detach();let x=c.cancel();if(p){p.flushPendingInput(),s=p.session.save();let V=r?is(r):void 0;V&&l.set(s,V),Ot();}x&&(s=x),r=null,H=null,ue();},load(x){let V=Xd(x);if(!V){ke(Zt("unsupported",Yd(x)));return}At(V);},save(){return c.flush(),Oy(p,r,()=>p)},getDocumentHandle(){return Object.freeze({revision:p?.session.packageRevision()??0})},exec(x,V){if(c.flush(),$&&(x.type==="toggleReviewPane"||x.type==="setEditingMode"))return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(x.type==="setEditingMode"){let Ee=ko(x.mode);return Ee!==null?(Ee.reason===Yn&&(k=true,b=Ee.reason,D.report(Ee.reason),ue(),Oe()),Ee):(w=true,k=false,b=null,pn(x.mode),ue(),Oe(),{ok:true,changed:false})}if(x.type==="toggleReviewPane")return i?(we=!we,ue(),Oe(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Hn};if(yu(x))return fx(x,p,bu(u),V);let te=xa(x);if(u==="viewing"&&te.supported&&te.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let ve=Ra(x,p,t$1.modeForGate(),V);if(!ve.ok)return ve.refusal;let oe=p,he=oe.session.packageRevision(),Pe=zv(oe,x,{...ve.tablePlan?{admittedTablePlan:ve.tablePlan}:{},editor:mn});return Pe||{ok:true,changed:oe.session.packageRevision()!==he}},can(x,V){if(x.type==="insertImage"||x.type==="replaceImage"){if($)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(V?.scope){let oe=Ra(x,p,t$1.modeForGate(),V);if(!oe.ok)return oe.refusal}return ny(x,p)}if(x.type==="toggleReviewPane"||x.type==="setEditingMode"){if($)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(x.type==="toggleReviewPane"&&!i)return {ok:false,code:"unsupported",reason:Hn};if(x.type==="setEditingMode"){let oe=ko(x.mode);if(oe!==null)return oe}return {ok:true}}if(yu(x))return vu(x,p,bu(u),V);let te=xa(x);if(u==="viewing"&&te.supported&&te.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let ve=Ra(x,p,t$1.modeForGate(),V);if(!ve.ok)return ve.refusal;if(x.type==="proposeInsertion"||x.type==="proposeDeletion"||x.type==="proposeReplacement"){if(!(x.author??n??"").trim())return {ok:false,code:"invalidArgs",reason:`${x.type} requires a non-empty author`};let he=x.target===void 0?{ok:true,selection:p.state().selection}:Os(p,x.target);if(!he.ok)return he;let{anchor:Pe,head:Ee}=he.selection,ge=Pe.paragraphId===Ee.paragraphId&&Pe.offset===Ee.offset,He=x.type==="proposeReplacement"&&x.target===void 0&&p.state().cellSelection!==null;if(x.type!=="proposeInsertion"&&ge&&!He)return {ok:false,code:"invalidArgs",reason:`${x.type} needs a non-collapsed selection`}}if(ka(x)&&rc(x)){let oe=Ta(mn);if(oe){let he=oc(mn,x,oe);if(he)return he}}return {ok:true}},isActive(x){if(x.type==="toggleReviewPane")return we;if(x.type==="setEditingMode")return u===x.mode;let V=p?fn().formatting:null;if(!V)return false;switch(x.type){case "toggleMark":switch(x.mark){case "bold":return V.bold===true;case "italic":return V.italic===true;case "underline":return V.underline===true;case "strike":return V.strike===true;case "superscript":return V.superscript===true;case "subscript":return V.subscript===true;default:return false}case "setAlignment":return V.alignment===(x.align==="justify"?"both":x.align);case "toggleList":return p?.isListActive(x.kind)??false;default:return false}},getDocumentStyles:()=>p?.session.documentStyles()??[],getDocumentFonts:()=>p?.session.documentFonts()??[],getAvailableFonts:()=>mx(z(),p?.session.documentFonts()??[]),getDocumentThemeColors:()=>p?.session.documentThemeColors()??[],getOutline:()=>p?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>dy(p?fn().formatting:null),findMatches:(x,V)=>p?.session.findText(x,{...V?.matchCase!==void 0?{matchCase:V.matchCase}:{},...V?.wholeWord!==void 0?{wholeWord:V.wholeWord}:{},stories:Tv(p,u)}).matches??[],selectMatch(x){return c.flush(),p?Pv(p,x):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>fn().image,getSelectedTable:()=>ly(p),getTableCellSelection:()=>{let x=p?.state().cellSelection;return x?{tableId:x.tableId,rows:x.rows,columns:x.columns,cellIds:x.cellIds}:null},setTableInteractionLabel(x){p?.setTableInteractionLabel(x);},canExecuteImageCommand(x,V){if($)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(V?.scope){let te=Ra(x,p,t$1.modeForGate(),V);if(!te.ok)return te.refusal}return ac(x,p)},executeImageCommand(x){return $?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):ic(mn,x)},getPageSetup:()=>lc(p),getWatermark:()=>null,getTrackedChanges:()=>(p?.session.reviewItems()??[]).filter(x=>x.kind==="revision").map(x=>{let V=Or(x);return {id:x.id,kind:x.kind==="revision"?x.revisionKind:"revision",...x.kind==="revision"&&x.author?{author:x.author}:{},story:V!==null?V.kind:Mt(x)?.noteKind??"body"}}),getReviewItems:x=>Lt(x),getCustomNodeDefinitions:()=>o.customNodes,reportCustomNodeDiagnostic:a$2,addComment(x,V){if(!i)return {ok:false,code:"unsupported",reason:Hn};p?.flushPendingInput();let te=wo();if(!te||!p)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let ve=(V??n??"").trim();if(ve.length===0||x.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let oe=null;return p.commitReviewOps(()=>(oe=p.session.replyToComment(null,{paragraphId:te.from.paragraphId,start:te.from.offset,end:te.to.offset,...te.to.paragraphId===te.from.paragraphId?{}:{endParagraphId:te.to.paragraphId}},x,ve,wt(),Ar(te.from.paragraphId)),{committed:oe!==null}),"comment-add"),oe===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>In(),isReviewPaneOpen:()=>we,getEditingMode:()=>u,getReviewAuthors:()=>y.authorsFor(p?.revisionAuthors()??Lx),...Vy(m,{enabled:i,surface:()=>p,notify:()=>{ue(),Oe();}}),setTrackedChangesFilter(x,V){if(p)return p.setTrackedChangesFilter(x,V);m.setPredicate(x,V)&&(ue(),Oe());},getConfiguredAuthor:()=>n??null,setAuthor(x){let V=xc(x);if(n!==V){if(n=V,p?.setAuthor(n),n!==void 0&&k)k=false,w=true,pn("suggesting");else if(!w){let te=O??u;Nr(t$1.mode()===void 0?te:"editing");return}b=tr(null),D.report(b),ue(),Oe();}},setMode(x){t$1.setMode(x)&&(w=false,k=false,Nr());},..._x(t$1,{surface:()=>p,bump:ue,emitSelectionChange:Oe}),presenceColorFor:x=>p?.remotePresenceColor(x)??"var(--doc-accent)",collaborationSession:()=>p?.collaborationSession()??null,getReviewAuthorStyle:x=>y.styleFor(x),setRemoteCaretLabelHost(x){A=x,p?.setRemoteCaretLabelHost(x);},setRevisionStyles(x){y.set(x),p?.setRevisionStyles(x),ue(),Oe();},setEditingMode:x=>mn.exec({type:"setEditingMode",mode:x}),getReviewRevision:()=>Et(),setActiveReviewItem(x,V){if(x===null)return p?.dismissActiveReview(),ue(),Oe(),{ok:true,changed:false};if(!p)return {ok:false,code:"notFound",reason:"no document is open"};p.flushPendingInput();let ve=Lt().find(Ee=>Ee.key===x)?.item;if(!ve)return {ok:false,code:"notFound",reason:"no review item with that key"};let oe=Kt(ve);if(!oe)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!bo(ve))return {ok:false,code:"unsupported",reason:`review items of kind '${ve.revisionKind}' are excluded from activation`};let he=ve?Or(ve):null,Pe=he===null&&ve?So(ve):null;if(he!==null||Pe!==null){let Ee=he!==null?{kind:"headerFooter",rId:he.rId,furnitureKind:he.kind}:{kind:"note",id:Pe},ge=Rs(p,Ee,oe.start);if(!ge.ok)return ge}else {p.exitNote?.(),p.exitHeaderFooter?.();let Ee=ae(ve)??oe,ge={paragraphId:Ee.start.paragraphId,offset:Ee.start.offset};p.activateReview(x,{anchor:ge,head:ge});let He=V?.reveal??"centerIfNeeded";He!==false&&p.revealPosition?.(Ee.start,{block:He});}return (he!==null||Pe!==null)&&p.activateReview(x),ue(),Oe(),{ok:true,changed:false}},setReviewActivationExclusions(x){g=x===null?null:[...x],p?.setReviewActivationExclusions(g);},acceptReviewItem:x=>To(x,"accept"),rejectReviewItem:x=>To(x,"reject"),setCommentResolved(x,V){return Qv({reviewEnabled:i,editingMode:u,placements:Lt,surface:p,proReviewReason:Hn,bump:ue},x,V)},deleteReviewItem(x){if(!i)return {ok:false,code:"unsupported",reason:Hn};let te=Lt().find(oe=>oe.key===x)?.item;if(!te||!p)return {ok:false,code:"notFound",reason:"no review item with that key"};if(te.kind==="revision")return To(x,"reject");if(te.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};Mr()===x&&p.dismissActiveReview();let ve=false;return p.commitReviewOps(()=>{let oe=So(te),he=oe===null?null:Zc$1(oe);return ve=p.session.deleteComment(te.id,nn(te),he?.noteId),{committed:ve}},"comment-delete"),ve?(ue(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(x,V,te){if(!i)return {ok:false,code:"unsupported",reason:Hn};p?.flushPendingInput();let oe=Lt().find(qe=>qe.key===x)?.item;if(!oe||!p)return {ok:false,code:"notFound",reason:"no review item with that key"};let he=Kt(oe);if(!he)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let Pe=(te??n??"").trim(),Ee=Jv(oe,V,Pe);if(Ee)return Ee;let ge=oe.kind==="comment"?oe.id:null,He=null;return p.commitReviewOps(()=>(He=p.session.replyToComment(ge,{paragraphId:he.start.paragraphId,start:he.start.offset,end:he.end.offset},V,Pe,wt(),nn(oe)),{committed:He!==null}),"comment-reply"),He===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>p?.headerFooterState()??null,getNotePropertiesState:()=>p?.notePropertiesState?.()??null,getNotePreviewText:x=>p?.notePreviewText?.(x)??null,setActiveScope(x){p?.setActiveScope(x)&&ue();},getActiveScope:()=>p?.activeScope()??{kind:"body"},query(x){switch(x.type){case "selectedText":return p?.selectedText()??"";case "selectionFormatting":return p?fn().formatting:null;case "selection":return dc(p);case "paragraphs":return iy(p,x.container);case "isInsideToc":return p?p.isInsideToc(p.state().selection.head.paragraphId):false;case "hyperlinkAt":return ay(p);case "contentControls":return sx(p,x.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 hu(p,x.filter);case "tableContext":return fc(p);default:return null}},snapshot:()=>fn(),getTotalPages:()=>cc(p),getCurrentPage:x=>uc(p,x),scrollToPage:x=>!Number.isInteger(x)||x<1?false:(c.flush(),p?.revealPage(x-1)??false),scrollToBlock:x=>typeof x!="string"||x.length===0?false:(c.flush(),p&&Es(p,x),p?.revealParagraph(x)??false),...Ox(Ce,()=>p),relayout(x){x?.sync,p?.layout();},retainSelection:()=>p?.retainSelection()??null,releaseSelection:x=>p?.releaseSelection(x),focus(x){return c.flush(),p?x&&x.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:x&&!p.setActiveScope(x)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(p.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){$=true,D.dispose(),c.cancel(),Ce.detach(),ne(),Ot(),r=null,s=null,l=new WeakMap,re+=1,ue();for(let x of Object.values(Be))x.clear();},on(x,V){return Be[x].add(V),()=>{Be[x].delete(V);}}};return mn}var Bx=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function _R(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 BR(e){let t=g({port:$R(e),capabilities:Bx}),n=false;return {...t,save:()=>{try{return t.save()}catch(r){return {ok:false,error:{code:"transaction-refused",message:r instanceof Error?r.message:"Cannot save the document."}}}},dispose:()=>{n=true,t.dispose();},execute:r=>(n||e.surface?.flushPendingInput(),t.execute(r))}}function $R(e){let t=0,n=0,r=null,o=false,a=false,i=()=>{if(a)return null;let s=e.surface?.session??null;return s!==r&&(o&&(t+=n+1),o=true,r=s,n=0),s&&(n=s.packageRevision()),s};return {revision(){return i(),t+n},currentPackage:()=>i()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?.revisionDisplayMode()??ba$1,replacementLanding:(s,l,c)=>e.surface?.replacementLanding(s,l,c)??null,apply(s,l){i();let c=e.surface;if(!c)return {ok:false,reason:"no-document"};let u=c.applyAutomationOps(s,l);return u.rejected?{ok:false,reason:String(u.reason??"refused")}:{ok:true,changed:u.committed}},applyLifecycle(s){i();let l=e.surface;if(!l)return {ok:false,reason:"no-document"};let c=l.applyAutomationOps(()=>[s]);return c.rejected?{ok:false,reason:String(c.reason??"refused")}:{ok:true,changed:c.committed}},applyCommentWrites(s,l){let c=e.surface,u=i();if(!c||!u)return {ok:false,reason:"no-document"};if(s.length===0)return {ok:true,changed:false};if(l.kind!=="body")return {ok:false,reason:"unsupported-story"};let g=e.can({type:"toggleReviewPane"});if(!g.ok)return {ok:false,reason:g.reason??"review-module-required"};let m={ok:false,reason:"refused"};return c.commitReviewOps(()=>{if(s.every(w=>w.kind==="delete")){let w=s.find(S=>S.kind==="delete"),b=u.deleteComments(s.map(S=>{if(S.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:S.commentId,...S.parentCommentId===void 0?{}:{parentCommentId:S.parentCommentId}}}),l,w?.kind==="delete"?w.noteId:void 0);return m=b?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:b}}if(s.length!==1)return m={ok:false,reason:"mixed-comment-writes"},{committed:false};let y=s[0];if(y.kind==="resolve"){let w=u.setCommentResolved(y.commentId,y.resolved);return m=w?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:w}}if(y.kind!=="create"&&y.kind!=="reply")return m={ok:false,reason:"unsupported-comment-write"},{committed:false};let v=u.replyToComment(y.kind==="reply"?y.parentCommentId:null,y.anchor,y.text,y.author,y.date);return m=v===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:v},{committed:v!==null}},_R(s)),m},applyCustomNodeWrite(s,l){let c=e.surface,u=i();if(!c||!u)return {ok:false,reason:"no-document"};if(l.kind!=="body")return {ok:false,reason:"unsupported-story"};let g={ok:false,reason:"refused"};return c.commitReviewOps(()=>{let m=u.insertCustomNode(s);return g=m.ok?{ok:true,changed:m.change!==null}:{ok:false,reason:m.detail?`${m.reason}: ${m.detail}`:m.reason},{committed:m.ok}},"package-scoped"),g},save:()=>i()?e.surface?.save()??null:null,select(s,l){if(!e.surface)return;let u=l==="end"?s.end:s.start,g=l==="start"?s.start:s.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:u.paragraphId,offset:u.offset},head:{paragraphId:g.paragraphId,offset:g.offset}}});},subscribe:s=>e.on("change",()=>s()),dispose(){a=true,r=null;}}}function qR(e){return e*(96/72)}function ZR(e,t){return e*t}function zR(e,t){return e/t}function VR(e,t,n){let r=e.pages.find(i=>i.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,a=n.paintScale;return Object.freeze({left:(r.contentBox.x+t.x+o)*a,top:(r.contentBox.y+t.y)*a,width:t.width*a,height:t.height*a})}function KR(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function qx(e,t,n){return t?true:e.length===1?false:!n}var $x=["e","se","s","sw","w","nw","n","ne"];function jR(e,t){let n=$x.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return $x[(n-r+8)%8]}function UR(e,t,n){let r=e,o=t,a=-n.rotationDegrees*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=r*i-o*s,c=r*s+o*i;return r=l,o=c,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function Fr(e){return e/Ca}function Zx(e){let t=UR(e.deltaXPt,e.deltaYPt,e.transform),n=Fr(e.startWidthEmu),r=Fr(e.startHeightEmu),o=n/r,a=jR(e.handle,e.transform),i=a.includes("e")?t.x:a.includes("w")?-t.x:0,s=a.includes("s")?t.y:a.includes("n")?-t.y:0;if(n=Math.max(1,n+i),r=Math.max(1,r+s),e.preserveAspect)if(a.length===2){let O=Math.max(n/Fr(e.startWidthEmu),r/Fr(e.startHeightEmu));n=Math.max(1,Fr(e.startWidthEmu)*O),r=Math.max(1,n/o);}else a==="e"||a==="w"?r=Math.max(1,n/o):n=Math.max(1,r*o);let l=Fr(e.startWidthEmu),c=Fr(e.startHeightEmu),u=n/l,g=r/c,m=Math.max(1,e.startBounds.width*u),y=Math.max(1,e.startBounds.height*g),v=e.startBounds.x,w=e.startBounds.y,b=e.handle;b.includes("w")&&(v=e.startBounds.x+e.startBounds.width-m),b.includes("n")&&(w=e.startBounds.y+e.startBounds.height-y);let S=null;if(e.kind==="anchored"&&e.startPosition&&(b.includes("w")||b.includes("n")))if(e.startPosition.mode==="simple"){let k=b.includes("w")?It(v-e.startBounds.x):0,O=b.includes("n")?It(w-e.startBounds.y):0;S=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+k,verticalEmu:(e.startPosition.verticalEmu??0)+O});}else if(e.anchorFrameOrigin)S=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...b.includes("w")?{horizontalEmu:It(v-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...b.includes("n")?{verticalEmu:It(w-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let k=b.includes("w")?It(v-e.startBounds.x):0,O=b.includes("n")?It(w-e.startBounds.y):0;S=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+k}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+O}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:It(n),heightEmu:It(r),previewBounds:Object.freeze({x:v,y:w,width:m,height:y}),position:S})}function WR(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 GR(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&&sc(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?Zx({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:qx(e.session.handle,e.aspectLocked,e.shiftKey),kind:e.session.kind}):Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:e.session.startBounds,position:null})}
|
|
20
|
+
export{fy as $,Vw as A,mT as Aa,Qd as B,gT as Ba,xk as C,xs as Ca,Sa as D,ov as Da,Ia as E,su as Ea,Jd as F,$a as Fa,Sk as G,qa as Ga,ec as H,ho as Ha,vn as I,ER as Ia,Ta as J,Ds as Ja,ac as K,Hs as Ka,ic as L,HR as La,Nk as M,Bx as Ma,Dk as N,BR as Na,Ca as O,qR as Oa,_k as P,ZR as Pa,It as Q,zR as Qa,ro as R,VR as Ra,Bk as S,KR as Sa,sc as T,qx as Ta,$k as U,Zx as Ua,es as V,WR as Va,ao as W,GR as Wa,uy as X,pc as Y,ts as Z,Kk as _,Xr as a,py as aa,ga as b,jk as ba,BS as c,Ir as ca,Ql as d,mc as da,xw as e,Xk as ea,Sw as f,Yk as fa,at as g,Jk as ga,Fw as h,Ea as ha,Ow as i,hy as ia,Aw as j,ns as ja,wh as k,yy as ka,Mw as l,by as la,Lw as m,rT as ma,Nw as n,oT as na,Dw as o,aT as oa,Hw as p,iT as pa,_w as q,sT as qa,Bw as r,lT as ra,kh as s,dT as sa,$w as t,cT as ta,Dd as u,hc as ua,Oh as v,uT as va,Ah as w,xy as wa,Xi as x,fT as xa,_d as y,Sy as ya,Bd as z,pT as za};
|