@docx-editor.dev/core 2.16.2 → 2.17.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/dist/chunk-27YEILW4.cjs +20 -0
- package/dist/chunk-CHRMIA3I.js +20 -0
- package/dist/editor.cjs +1 -1
- package/dist/editor.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-QQP2SGAT.js +0 -20
- package/dist/chunk-XC7YDJBL.cjs +0 -20
package/dist/chunk-QQP2SGAT.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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-4RDCLCLB.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-MBXGQN6J.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,qb as qb$1,ae,be,Xe,Gc as Gc$1,jf,lf,ie,mf,ee,wf,_e,xf,Oa as Oa$1,gf,of,ef as ef$1,$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,Sa,cf as cf$1,ya,mb as mb$1,Le as Le$1,Me,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,rf,_b as _b$1,jc as jc$1,fc as fc$1,xc as xc$1,ce,Ha as Ha$3,tf,Qe,Hd as Hd$1,Bd as Bd$1,Bc as Bc$1,He as He$1,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-RXPOTTQQ.js';import {g}from'./chunk-7QG5FJ4X.js';import {j,d as d$1,i as i$2}from'./chunk-FRRMJK2G.js';import {H as H$1}from'./chunk-BML3CNUT.js';import {ba,xa as xa$1,Ma as Ma$1,sa,ka as ka$1,ja as ja$1,la,Ba as Ba$1,pa,ua,va,Ha as Ha$2,da,na,ia,ha,fa,ra,qa as qa$1,ga,Da as Da$1,wa as wa$1,ca}from'./chunk-W7GY2IJC.js';import {a as a$4}from'./chunk-6JIJOZDW.js';import {a as a$2,cb as cb$1,ye as ye$1,ef,Vh as Vh$1,cf,yf,Jf,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,Eh as Eh$1,Gh,Bh as Bh$1,Fh as Fh$1,Wg as Wg$1,$g as $g$1,Zg as Zg$1,Yg as Yg$1,xh as xh$1,vg as vg$1,Yc as Yc$2,xe as xe$1,b as b$1,td,zf,Af,wf as wf$1,xf as xf$1,Bf,Cf,Ha as Ha$1,Qh as Qh$1,th as th$1,uh as uh$1,yh as yh$1,zh as zh$1,wd as wd$1,zd as zd$2,pc as pc$1,Cd as Cd$1,Ne as Ne$1,Eb as Eb$1,Db as Db$1,rd,id as id$1,gd as gd$1,Wf,Tf,Re as Re$1,Se,sg as sg$1,rh as rh$1,sh as sh$1,Ge,Ee as Ee$1,wh as wh$1,vh as vh$1,Kf,Le as Le$2,rc as rc$1,tc as tc$1,cd as cd$1,hh as hh$1,ih as ih$1,jh as jh$1,mh as mh$1,yd as yd$1,Xg as Xg$1,la as la$1,ma,na as na$1,Uf,Nh as Nh$1,gc as gc$1,_g as _g$1,Oe,Bc as Bc$2,da as da$1,yc as yc$1,N,w,De,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$2,Q,ia as ia$1,ha as ha$1,B,$a as $a$1,be as be$1,Vd as Vd$1,pf as pf$1,Hb as Hb$1,Jc as Jc$1}from'./chunk-MDMM3XVQ.js';import {a}from'./chunk-GOEBQ26R.js';import {zipSync,strToU8}from'fflate';import {createT,en,locales,deepMerge}from'@docx-editor.dev/i18n';function WS(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var Km=false;function Vm(e){if(Km)return;Km=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 Qr(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:WS(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 xa(e,t){try{return await H(e,t)}catch(n){throw Qr(n)}}var GS=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 zm="http://schemas.openxmlformats.org/wordprocessingml/2006/main",YS="http://schemas.openxmlformats.org/package/2006/content-types",jm="http://schemas.openxmlformats.org/package/2006/relationships",QS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",JS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",ew=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${YS}"><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>`,tw=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${jm}"><Relationship Id="rId1" Type="${QS}" Target="word/document.xml"/></Relationships>`,nw=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${jm}"><Relationship Id="rId1" Type="${JS}" Target="styles.xml"/></Relationships>`,rw=[{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}],ow=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>",aw=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${zm}"><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>`+rw.map(ow).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>',iw=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${zm}"><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 od(){return zipSync({"[Content_Types].xml":strToU8(ew),"_rels/.rels":strToU8(tw),"word/_rels/document.xml.rels":strToU8(nw),"word/document.xml":strToU8(iw),"word/styles.xml":strToU8(aw)})}var Jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sw=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<Jr.length;t+=1)e[Jr.charCodeAt(t)]=t;return e})();function $i(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 d=0,u=0;for(let p=0;p<4;p+=1){let m=r.charCodeAt(l+p);if(m===61){if(l+p<r.length-o)return null;continue}let g=m<128?sw[m]:-1;if(g<0)return null;d=d<<6|g,u+=6;}d<<=24-u,u>=12&&(i[s++]=d>>>16&255),u>=18&&(i[s++]=d>>>8&255),u>=24&&(i[s++]=d&255);}return s===a?i:null}function qi(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+=Jr[o>>2]+Jr[(o&3)<<4|a>>4],n+=r+1<e.length?Jr[(a&15)<<2|i>>6]:"=",n+=r+2<e.length?Jr[i&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var lw=16*1024*1024,Wm=64*1024*1024,Gm="data-docx-fragment",Xm="data-docx-fragment-end",dw=qi;function Ym(e,t){if(!t)return `<div>${e}</div>`;let n=t.lastMarkCovered?"covered":"open";return `<div ${Gm}="${dw(t.bytes)}" ${Xm}="${n}">${e}</div>`}function Um(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>Wm)return null;let o=r+n.length,a=e.indexOf('"',o);return a===-1?null:e.slice(o,a)}function Zi(e,t=lw){if(e.length>Wm)return null;let n=Um(e,Gm);if(n===null||n.length===0)return null;let r=$i(n,t);if(r===null||r.byteLength===0)return null;let o=Um(e,Xm);return {bytes:r,lastMarkCovered:o==="covered"}}function xr(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 id=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],ad={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText"},sd=new Map([...Object.entries(ad).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function Qm(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(ad,e)?ad[e]:null}var ld=Object.fromEntries(k),dd={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function Jm(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 cw=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 Sr(e){if(e===null)return null;let t=De(e,"val",da$1);if(t===void 0||t==="nil"||t==="none")return null;let n=cw.get(t)??"solid",r=De(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=De(e,"color",da$1),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${i} ${n} ${l.toLowerCase()}`}function eg(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 uw=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"]]),fw=new Set(id);function tg(e){if(e===null)return [];let t=De(e,"val",da$1),n=[],r=t===void 0?void 0:uw.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&fw.has(t)&&n.push(`text-underline:${t}`);let o=De(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 ng(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function rg(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=De(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 d=i==="footnote",u=o!==null,p=d?"MsoFootnoteReference":"MsoEndnoteReference",m=d?"ftn":"edn",g=u?`#_${m}ref${l}`:`#_${m}${l}`,x=u?`_${m}${l}`:`_${m}ref${l}`;return `<a style="mso-${d?"footnote":"endnote"}-id:${m}${l}" href="${g}" name="${x}"><span class="${p}"><span style="mso-special-character:footnote">[${n(i,l)}]</span></span></a>`}function og(e){if(e.namespaceUri!==da$1||e.localName!=="ptab")return "";let t=De(e,"alignment",da$1),n=De(e,"relativeTo",da$1),r=De(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 rt(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 sg(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 lg(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=sd.get(r);if(i!==void 0)return i}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(Je(e)):null;return n?`Heading${n[1]}`:void 0}var dg=262144,pw=4096,mw=256,gw=2048,hw=8,yw=new Set(["MsoNormal",...sd.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),bw=new Map([["left","left"],["start","left"],["center","center"],["right","right"],["end","right"],["justify","both"]]),vw=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function xw(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 Sw(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 ww(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return Sw(e,n)}return null}function Iw(e){let t=e.split(",");if(t.length===0||t.length>hw)return null;let n=[];for(let r of t){let o=vw.exec(r);if(!o)return null;let a=o[2];if(!yw.has(a))return null;n.includes(a)||n.push(a);}return n}function kw(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=bw.get(a.slice(0,i));s!==void 0&&(t=s);}return t}function Tw(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>dg)return n();let r=xw(e),o=0,a=0;for(;o<r.length&&a<pw;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let m=ww(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 d=r.slice(i+1,l);if(a+=1,o=l+1,s.length>mw||d.length>gw||d.includes("{"))return n();let u=Iw(s),p=kw(d);if(!(!u||p===void 0))for(let m of u)t.set(m,p);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function cg(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>dg)return new Map;let a=Tw(o);if(!a.ok)return new Map;for(let[i,s]of a.alignments)t.set(i,s);}return t}var Pw=262144;function ug(e,t=Pw){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 fg(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 cd(e,t,n,r){let o=rt(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 eo(e){return e.nodeType===1}function Je(e){return e.tagName.toLowerCase()}var Rw=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(":"))),Cw=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"]]),Ew=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,Fw=new Map(id.map(e=>[e.toLowerCase(),e])),ag=new WeakMap;function et(e){let t=ag.get(e);if(t!==void 0)return t;let n=new Map;ag.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 Kn(e){let t=e.trim().toLowerCase(),n=Rw.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 Ow(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return Cw.get(t)}function ig(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||Ew.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:Kn(t)}function Wt(e,t,n){return Math.min(n,Math.max(t,e))}function Vi(e){let t=null;for(let[n,r]of e)if(n==="background")t=ig(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let a=ig(r);a!==null&&(t=a);}return t}var Aw=new Set(["left","center","right","decimal","bar"]),Mw=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function Lw(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(Aw.has(o)){t=o;continue}if(o==="list"){t="left";continue}let a=Mw.get(o);if(a!==void 0){n=a;continue}let i=rt(o);if(!(i===null||i<0)){if(r.push({val:t,posTwips:Wt(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 Nw=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function ud(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var Dw=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Ki(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let a of ud(e)){let i=a.toLowerCase();if(i==="none"||i==="hidden"){n=true;continue}let s=Nw.get(i);if(s!==void 0){t=s;continue}let l=Dw.get(a.toLowerCase())??rt(a);if(l!==null){r=l;continue}let d=Kn(a);if(d!==null){o=d;continue}return}if(n)return "suppressed";if(t!==void 0)return r===void 0?{val:t,szEighthPoints:4,color:o??"000000"}:r<=0?"suppressed":{val:t,szEighthPoints:Wt(Math.round(r*8),2,96),color:o??"000000"}}function zi(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function fd(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 pd(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 N=O.toLowerCase(),M=Fw.get(N);if(M!==void 0)n.underline=true,n.underlineVal=M;else {let R=Kn(O);R!==null&&(n.underlineColor=R);}}let d=t.get("text-decoration-style")?.trim().toLowerCase();if(d==="double"&&n.strike&&!n.underline&&(n.doubleStrike=true),n.underline){d==="double"?n.underlineVal="double":d==="dotted"?n.underlineVal="dotted":d==="dashed"?n.underlineVal="dash":d==="wavy"&&(n.underlineVal="wave");let O=Kn(t.get("text-decoration-color")??"");O!==null&&(n.underlineColor=O);}let u=Kn(t.get("color")??"");u&&(n.color=u);let p=Ow(t.get("mso-highlight"));if(p)n.highlight=p,delete n.shdFill;else {let O=Vi(t);O&&(n.shdFill=O);}let m=rt(t.get("font-size")??"");m!==null&&m>0&&(n.szHalfPoints=Wt(Math.round(m*2),2,3276));let g=t.get("font-family");if(g!==void 0){let O=g.split(",")[0].trim().replace(/^['"]|['"]$/g,"");O.length>0&&O.length<=64&&(n.font=O);}let x=rt(t.get("letter-spacing")??"");x!==null&&(n.charSpacingTwentieths=Wt(Math.round(x*20),-31680,31680));let T=t.get("vertical-align")?.trim().toLowerCase();T==="sub"?n.vertAlign="subscript":T==="super"&&(n.vertAlign="superscript");let b=xr(t.get("mso-ansi-language")),S=xr(t.get("mso-fareast-language")),P=xr(t.get("mso-bidi-language"));return b!==null&&(n.langVal=b),S!==null&&(n.langEastAsia=S),P!==null&&(n.langBidi=P),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function wa(e,t){let n=pd(e,et(t)),r=xr(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function pg(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(P=>rt(P));if(S.length>=1&&S.length<=4&&!S.some(P=>P===null)){let[P,O=P,N=P,M=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=P??null,r.right=O??null,r.bottom=N??null,r.left=M??null;}}let a=rt(t.get("margin-left")??"")??r.left;a!==null&&(a>0||a===0&&!e.numPr)&&(e.indLeftTwips=Wt(Math.round(a*20),0,31680));let i=rt(t.get("margin-right")??"")??r.right;i!==null&&i>=0&&(e.indRightTwips=Wt(Math.round(i*20),0,31680));let s=rt(t.get("text-indent")??"");if(s!==null&&s!==0){let S=Wt(Math.round(s*20),-31680,31680);S!==0&&(e.firstLineTwips=S);}let l=rt(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=Wt(Math.round(l*20),0,31680));let d=rt(t.get("margin-bottom")??"")??r.bottom;d!==null&&d>=0&&(e.spacingAfterTwips=Wt(Math.round(d*20),0,31680));let u=t.get("line-height")?.trim()??"",p=t.get("mso-line-height-rule")?.trim().toLowerCase(),m=rt(u);if(m!==null&&m>0)e.lineTwentieths=Wt(Math.round(m*20),24,31680),e.lineRule=p==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(u)&&Number.parseFloat(u)>0)e.lineTwentieths=Wt(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=Wt(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 g=Vi(t);g&&(e.shdFill=g);let x=Lw(t.get("tab-stops"));x!==void 0&&(e.tabs=x);let T=Ki(t.get("mso-border-alt"))??Ki(t.get("border")),b={};for(let S of ["top","left","bottom","right"]){let P=Ki(t.get(`mso-border-${S}-alt`))??Ki(t.get(`border-${S}`))??T;P!==void 0&&P!=="suppressed"&&(b[S]=P);}Object.keys(b).length>0&&(e.borders=b);}var Hw="http://schemas.openxmlformats.org/drawingml/2006/picture",_w=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,Bw=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 mg(e,t,n){return Math.min(n,Math.max(t,e))}function gg(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let a=_w.exec(o);if(!a)return;let i=n.mediaBySrc.get(o),s=i===void 0?void 0:n.media.get(i),l=s??$i(a[1],n.maxImageBytes);if(l==null)return;let d=tb$1(l),u=Bw.get(d);if(u===void 0)return;let p=d==="image/png"||d==="image/jpeg"||d==="image/gif"||d==="image/bmp"||d==="image/webp"?yb$1(l,d):null,m=et(e),g=cd(e,m,"width",n.wordHtml),x=cd(e,m,"height",n.wordHtml);p!==null?g===null&&x===null?(g=p.pixelWidth*96/(p.dpiX??96),x=p.pixelHeight*96/(p.dpiY??96)):g!==null&&x===null?x=g*p.pixelHeight/p.pixelWidth:g===null&&x!==null&&(g=x*p.pixelWidth/p.pixelHeight):g!==null&&x===null?x=g*2/3:g===null&&x!==null&&(g=x*3/2);let T=g===null?381e4:mg(Math.round(g*9525),9525,3e7),b=x===null?254e4:mg(Math.round(x*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,d));let P=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="${T}" cy="${b}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${Hw}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${P}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${T}" 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 $w="http://schemas.openxmlformats.org/wordprocessingml/2006/main",qw='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',hg=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function yg(e,t,n){let r=720*(n+1);if(e==="bullet"){let a=hg[n%hg.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 Zw=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),Kw=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),bg=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function vg(e){let t=new Map;if(e.length===0||e.length>262200)return t;bg.lastIndex=0;let n,r=0;for(;(n=bg.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 d=s.slice(0,l).trim().toLowerCase(),u=s.slice(l+1).trim().toLowerCase();d==="mso-level-number-format"?o=Kw.get(u)??null:d==="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 xg(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?Sg(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 Vw=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function Sg(e){let t=e.toLowerCase();if(!Vw.test(t))return null;let n=0,r=0;for(let o of t){let a=Zw.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 wg(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 d=Sg(i);if(d!==null)return {kind:s?"lowerRoman":"upperRoman",start:d}}if(l){let d=i.toLowerCase().charCodeAt(0),u=Math.min(32767,(i.length-1)*26+(d-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 zw=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 Ig(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=et(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:zw.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 md(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 kg(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 d=r.levels.get(l);return d?yg(d.kind,d.start,l):yg(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 `${qw}<w:numbering xmlns:w="${$w}">${t}${n}</w:numbering>`}function an(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 Tg(e){if(e===null)return false;if(e.startsWith("#"))return an(e.slice(1))!==null;let t=L(e);return t?.ok===true&&t.href.length>0}function Pg(e,t){if(e!==void 0&&e.startsWith("#")){let o=an(e.slice(1)),a=an(t)??o;return a===null?null:`#${a}`}let n=e===void 0?null:L(e),r=an(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function Rg(){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 jw=/^(ftn|edn)([1-9]\d{0,9})$/i,Uw={footnote:"ftn",endnote:"edn"};function Cg(e,t){let n=e===null?null:jw.exec(e);if(!n||n[1].toLowerCase()!==Uw[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function gd(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=Cg(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function Ww(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=Cg(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function Eg(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],a=Ww(o,et(o));a!==null&&t.push({...a,element:o});}return t}function Fg(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 d=r.get(s);if(d!==void 0)return d;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=gd(et(s));if(l===null)continue;let d=o(s);d!==null&&d.kind===l.kind&&d.id===l.id||n[l.kind].add(l.id);}}function Og(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var Gw=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function to(e,t,n){return e.replace(Gw,(r,o,a)=>{let i=`${o}:${a}`;return t.has(i)?n?.get(i)??"":r})}function hd(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 Ag(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=(d,u)=>{o.has(`${d}:${u}`)||!e.notes[d].has(u)||a[d].has(u)||(a[d].add(u),s.push({kind:d,id:u}));};for(let d of ["footnote","endnote"])for(let u of e.bodyNoteRefs[d])l(d,u);for(let d of o)for(let u of e.noteNoteRefs.get(d)??[])l(u.kind,u.id);for(;s.length>0;){let d=s.pop();for(let u of e.noteNoteRefs.get(`${d.kind}:${d.id}`)??[])l(u.kind,u.id);}};for(;;){i();let s=false;for(let l of ["footnote","endnote"]){for(let d of e.notes[l].keys()){let u=`${l}:${d}`;if(!(a[l].has(d)||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,d]of e.notes[s])o.has(`${s}:${l}`)||e.notes[s].set(l,d.map(u=>to(u,o,e.noteMarkFallbacks)));for(let s of ["footnote","endnote"])for(let[l,d]of [...e.notes[s]]){if(!o.has(`${s}:${l}`))continue;e.notes[s].delete(l),t[s].delete(l);let u=new Map;for(let p of d){let m=to(p.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,(g,x,T)=>{let b=u.get(T);if(b===void 0){let S=e.noteRels[s].find(P=>P.id===T);if(S===void 0)return g;b=r(e,S.type,S.target,S.external),u.set(T,b);}return ` r:${x}="${b}"`});n.push(m),e.lastMarkCovered=false;}}}function yd(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 Mg(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=Xw(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),d=(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,p;d!==void 0?(u=d.kind,p=xg(s,u)??d.start??1):{kind:u,start:p}=wg(s);let g=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${a[1]}${l?`:lfo${l[1]}`:""}`;return {numId:yd(n,g,u,p,i),ilvl:i}}function Xw(e,t){let n="",r=(o,a)=>{if(!(n.length>0||a>8||t.nodesLeft<=0)&&eo(o)){if(zi(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 Yw="http://schemas.openxmlformats.org/package/2006/relationships",Qw="http://schemas.openxmlformats.org/package/2006/content-types",Jw="application/vnd.openxmlformats-package.relationships+xml",xd='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',eI="http://schemas.openxmlformats.org/wordprocessingml/2006/main",vd="http://schemas.openxmlformats.org/officeDocument/2006/relationships",tI="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",nI="http://schemas.openxmlformats.org/drawingml/2006/main",rI="http://schemas.openxmlformats.org/drawingml/2006/picture",Lg={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 bd(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 `${xd}<Relationships xmlns="${Yw}">${t}</Relationships>`}function oI(e){let t=new Map;t.set("word/document.xml",Oa$2(e.documentXml)),t.set("word/_rels/document.xml.rels",Oa$2(bd(e.rels))),t.set("_rels/.rels",Oa$2(bd([{id:"rId1",type:`${vd}/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="${Lg.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="${Lg[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(bd(i)));for(let[a,i]of e.media)t.set(a,i);let o=`<Default Extension="rels" ContentType="${Jw}"/><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(`${xd}<Types xmlns="${Qw}">${o}${r}</Types>`)),Ra$2(t)}function Ng(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${vd}/${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=`${xd}<w:document xmlns:w="${eI}" xmlns:r="${vd}" xmlns:wp="${tI}" xmlns:a="${nI}" xmlns:pic="${rI}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return oI({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:kg(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:hd("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:hd("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}function Sd(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 Vn(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${N(e.rStyle)}"/>`),e.font!==void 0){let i=N(Sd(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 ji(e,t){return `<w:r>${Vn(t)}<w:t xml:space="preserve">${M(Sd(e))}</w:t></w:r>`}function aI(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 wr(e,t){return `<w:p>${aI(e)}${t.join("")}</w:p>`}var Hg={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function Ui(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 iI=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,Dg=new WeakMap;function wd(e){let t=Dg.get(e);for(t||(t={checked:0,furniture:true},Dg.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=iI.test(e[t.checked]),t.checked+=1;return t.furniture}var zn=31680;function Mn(e,t,n){return Math.min(n,Math.max(t,e))}function _g(e){let t=rt(et(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 sI(e){return Ir(e,"colspan",63)}function Bg(e){return Array.from(e.children).flatMap(t=>{let n=Je(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>Je(r)==="tr")})}function Ir(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:Mn(Number.parseInt(r,10),1,n)}function $g(e,t){let n=(et(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${Mn(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=_g(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let a=Mn(Math.round(o*20),1,zn);return {xml:`<w:tblW w:w="${a}" w:type="dxa"/>`,twips:a}}function qg(e){let n=et(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 Zg(e){let t=et(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=rt(i??"");l!==null&&(a+=` w:tblpX="${Mn(Math.round(l*20),-zn,zn)}"`);}let s=rt(t.get("mso-table-top")??"");return s!==null&&(a+=` w:tblpY="${Mn(Math.round(s*20),-zn,zn)}"`),`<w:tblpPr${a}/>`}function Kg(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 p=Array.from({length:t},()=>r),m=0,g=0,x=i.map(S=>S?S.span:null);for(let S=0;S<t;S+=1){let P=i[S];P&&(P.remaining-=1,P.remaining<=0&&(i[S]=null));}let T=Array.from(u.children).filter(S=>/^t[dh]$/.test(Je(S))),b=0;for(;g<t;){let S=x[g];if(S!==null){g+=S;continue}let P=T[b];if(P===void 0)break;b+=1;let O=Math.min(sI(P),t-g);for(let R=g+1;R<g+O;R+=1)if(x[R]!==null){O=R-g;break}let N=Ir(P,"rowspan",1e3);N>1&&(i[g]={remaining:N-1,span:O});let M=_g(P);if(M!==null){let R=Mn(Math.round(M*20/O),1,zn);for(let y=0;y<O;y+=1)p[g+y]=R;m+=O;}g+=O;}m>o&&(o=m,a=p);}let s=a.reduce((u,p)=>u+p,0);if(s<=0)return a;let l=a.map(u=>Math.max(1,Math.round(u*n/s))),d=n-l.reduce((u,p)=>u+p,0);return l[l.length-1]=Math.max(1,l[l.length-1]+d),l}function Id(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 Vg=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),zg=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function jg(e){return Mn(Math.round(e*8),2,96)}function mn(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of ud(e)){let a=Vg.get(o.toLowerCase());if(a!==void 0){t=a;continue}let i=zg.get(o.toLowerCase())??rt(o);if(i!==null){n=i;continue}let s=Kn(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:jg(n),color:r??"000000"}}}function Wi(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=Vg.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:zg.get(o.toLowerCase())??rt(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:Kn(i);return {val:r,size:a===null?4:jg(a),color:s??"000000"}}function Ug(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function Wg(e){let t=et(e),r=mn(t.get("mso-border-alt"))??mn(t.get("border"))??Wi(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=mn(t.get(`mso-border-${s}-alt`))??mn(t.get(`mso-border-${s}`))??mn(t.get(`border-${s}`))??Wi(t,`border-${s}`)??r;l!==void 0&&(a+=Ug(i,l));}return a.length>0?`<w:tblBorders>${a}</w:tblBorders>`:""}function Gg(e){let t=et(e),n=rt(t.get("height")??"");if(n===null||n<=0)return "";let r=Mn(Math.round(n*20),1,zn),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 lI(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=>rt(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=rt(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="${Mn(Math.round(a*20),0,zn)}" w:type="dxa"/>`);}return r.length>0?`<w:tcMar>${r}</w:tcMar>`:""}function Xg(e){let t=et(e),n=mn(t.get("mso-border-alt"))??mn(t.get("border"))??Wi(t,"border"),r="";for(let s of ["top","left","bottom","right"]){let l=mn(t.get(`mso-border-${s}-alt`))??mn(t.get(`mso-border-${s}`))??mn(t.get(`border-${s}`))??Wi(t,`border-${s}`)??n;l!==void 0&&(r+=Ug(s,l));}let o=r.length>0?`<w:tcBorders>${r}</w:tcBorders>`:"",a=Vi(t);a&&(o+=`<w:shd w:val="clear" w:color="auto" w:fill="${a}"/>`),o+=lI(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 dI=9360;function Yg(e,t,n,r,o,a){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let M of Array.from(e.children))Je(M)==="caption"&&a(Array.from(M.childNodes),t+1,n,r,o,true);let i=Bg(e);if(i.length===0)return;let s=1,l=r.nodesLeft,d=[];for(let M of i){if(l<=0||s>=63)break;let R=d.map(C=>C?C.span:null);for(let C=0;C<d.length;C+=1){let L=d[C];L&&(L.remaining-=1,L.remaining<=0&&(d[C]=null));}let y=Array.from(M.children).filter(C=>/^t[dh]$/.test(Je(C))),q=0,k=0;for(;k<63&&(l-=1,!(l<=0));){let C=k<R.length?R[k]:null;if(C!=null){k+=C;continue}let L=y[q];if(L===void 0)break;q+=1;let H=Math.min(Ir(L,"colspan",63),63-k);for(let G=k+1;G<k+H;G+=1)if(G<R.length&&R[G]!=null){H=G-k;break}let U=Ir(L,"rowspan",1e3);if(U>1){for(;d.length<=k;)d.push(null);d[k]={remaining:U-1,span:H};}k+=H;}for(let C=k;C<R.length&&C<63;C+=1){let L=R[C];L!=null&&(k=Math.max(k,C+L));}s=Math.max(s,k);}s=Math.min(Math.max(s,1),63);let u=$g(e,dI),p=u.twips,m=i.length>r.nodesLeft?i.slice(0,Math.max(1,r.nodesLeft)):i,g=Kg(m,s,p),x=Wg(e),T=Zg(e),b=qg(e),S=b===void 0?"":`<w:jc w:val="${b}"/>`,P=g.map(M=>`<w:gridCol w:w="${M}"/>`).join(""),O=new Array(s).fill(null),N=[];for(let M of i){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let R=O.map(H=>H?H.span:null);for(let H=0;H<s;H+=1){let U=O[H];U&&(U.remaining-=1,U.remaining<=0&&(O[H]=null));}let y=Array.from(M.children).filter(H=>/^t[dh]$/.test(Je(H))),q=0,k=[],C=0,L=true;for(;C<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,L=false;break}let H=R[C];if(H!==null){let Z=H>1?`<w:gridSpan w:val="${H}"/>`:"";k.push(`<w:tc><w:tcPr><w:tcW w:w="${Id(g,C,H)}" w:type="dxa"/>${Z}<w:vMerge/></w:tcPr><w:p/></w:tc>`),C+=H;continue}let U=y[q];if(U===void 0){k.push(`<w:tc><w:tcPr><w:tcW w:w="${g[C]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),C+=1;continue}q+=1;let G=Math.min(Ir(U,"colspan",63),s-C);for(let Z=C+1;Z<C+G;Z+=1)if(R[Z]!==null){G=Z-C;break}let I=Ir(U,"rowspan",1e3);I>1&&(O[C]={remaining:I-1,span:G}),k.push(cI(U,G,Id(g,C,G),I>1,t,n,r,a)),C+=G;}if(!L)break;N.push(`<w:tr>${Gg(M)}${k.join("")}</w:tr>`);}N.length!==0&&(o.push(`<w:tbl><w:tblPr>${T}${u.xml}${S}${x}</w:tblPr><w:tblGrid>${P}</w:tblGrid>${N.join("")}</w:tbl>`),r.lastMarkCovered=false);}function cI(e,t,n,r,o,a,i,s){let l=Je(e)==="th",d=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(d+=`<w:gridSpan w:val="${t}"/>`),r&&(d+='<w:vMerge w:val="restart"/>'),d+=Xg(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}:{}},p=[];return s(Array.from(e.childNodes),o+2,u,i,p,true),(p.length===0||p[p.length-1].endsWith("</w:tbl>"))&&p.push("<w:p/>"),`<w:tc><w:tcPr>${d}</w:tcPr>${p.join("")}</w:tc>`}function Qg(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 Jg(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 eh(e){if(Je(e)!=="br")return false;let t=et(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function th(e){if(eh(e))return true;if(Je(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||!eh(r))return false;t=true;}}return t}function nh(e){if(Je(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=et(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(Je(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 kd(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var Td=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),Pd=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),Rd=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),uI=new Set([...Pd,...Rd,"table","ol","ul","w:sdt"]);function Cd(e){for(let t=0;t<e.children.length;t+=1)if(uI.has(Je(e.children[t])))return true;return false}var fI=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function rh(e){if(Je(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=Je(i);if(fI.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(i);}}return null}var pI=4*1024*1024,mI=1e5,gI=64,hI=2*1024*1024,oh="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Ed(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 Gi(e,t,n,r,o){if(o.nodesLeft<=0){o.truncated=true;return}if(t>o.maxDepth)return;if(o.nodesLeft-=1,e.nodeType===3){let x=e.nodeValue??"";if(n.pre){let b=x.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>${Vn(n.run)}<w:br/></w:r>`);}let P=b[S];P.length>0&&r.push(ji(P,n.run));}return}let T=x.replace(/[ \t\r\n\f\v]+/g," ");if(T.length===0||T===" "&&wd(r))return;r.push(ji(T,n.run));return}if(!eo(e))return;let a=Je(e);if(Td.has(a))return;let i=et(e);if(zi(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 x=Jg(e);x.length>0&&r.push(`<w:r>${Vn(n.run)}${x}</w:r>`);return}let l=Qg(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 x=pd(fd(n.run,a),i);if(r.push(`<w:r>${Vn(x)}${l}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let x=i.get("page-break-before")?.trim().toLowerCase()==="always"||i.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${Vn(n.run)}${x?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){gg(e,r,o,x=>Ed(o,`${oh}/image`,x,false,n.rels??o.rels));return}let d=fd(n.run,a),u=a==="a"?e.getAttribute("href"):null,p=a==="a"?gd(i):null;p===null&&Tg(u)&&(d={...d,rStyle:"Hyperlink"});let m=wa(d,e),g={...n,run:m,pre:n.pre||a==="pre"};if(p!==null){let x={...g.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===p.kind&&n.noteBody.id===p.id){let T=p.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${Vn(x)}<w:${T}/></w:r>`);return}if(o.definedNotes[p.kind].has(p.id)){let T=p.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${Vn(x)}<w:${T} w:id="${p.id}"/></w:r>`);let b=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),S=`${p.kind}:${p.id}`;if(b.length>0&&!o.noteMarkFallbacks.has(S)&&o.noteMarkFallbacks.set(S,ji(b,x)),n.noteBody===void 0)o.bodyNoteRefs[p.kind].add(p.id);else {let P=`${n.noteBody.kind}:${n.noteBody.id}`,O=o.noteNoteRefs.get(P)??[];O.push({kind:p.kind,id:p.id}),o.noteNoteRefs.set(P,O);}return}for(let T of Array.from(e.childNodes))Gi(T,t+1,g,r,o);return}if(a==="a"){let x=e.getAttribute("href"),T=an(e.getAttribute("name")||e.getAttribute("id")),b=[];for(let O of Array.from(e.childNodes))Gi(O,t+1,g,b,o);let S=x?.startsWith("#")?an(x.slice(1)):null,P=b.join("");if(S!==null)P=`<w:hyperlink w:anchor="${N(S)}">${P}</w:hyperlink>`;else if(x!==null&&!x.startsWith("#")){let O=L(x);O.ok&&O.href.length>0&&(P=`<w:hyperlink r:id="${Ed(o,`${oh}/hyperlink`,O.href,true,n.rels??o.rels)}">${P}</w:hyperlink>`);}if(T!==null){let O=String(o.nextBookmarkId++);P=`<w:bookmarkStart w:id="${O}" w:name="${N(T)}"/>${P}<w:bookmarkEnd w:id="${O}"/>`;}P.length>0&&r.push(P);return}for(let x of Array.from(e.childNodes))Gi(x,t+1,g,r,o);}function ah(e,t,n,r){let o=Je(e),a=et(e),i={};r&&(i.pageBreakBefore=true);let s=lg(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},d=Hg[o];d!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=d);let u=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let p=Mg(e,a,n,t.noteBody);return p&&(i.numPr=p),fg(i,e,n.classAlignments),pg(i,a),l=wa(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 ih(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;let i=ah(e,n,r,a);jn(Array.from(e.childNodes),t+1,i,r,o,true,void 0,false);}function sh(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=Ig(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:yd(r,`sem:${r.semanticListCount}`,i,md(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:md(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},d=a;for(let u of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!eo(u))continue;let p=Je(u);if(p==="li")r.nodesLeft-=1,ih(u,t+1,l,r,o,d),d=false;else if(p==="ol"||p==="ul"){let m=o.length;sh(u,t+1,{...n,list:s},r,o,d),o.length>m&&(d=false);}}}function jn(e,t,n,r,o,a=false,i,s=true){if(t>r.maxDepth)return;let l=o.length,d=i===void 0,u=[],p=[],m=n.para,g=i??{pending:false,skipSpacer:false},x=()=>({...m,pageBreakBefore:void 0,numPr:void 0}),T=()=>{if(u.length===0)return;if(!u.some(S=>S.includes("<w:r"))){if(o.length===l){p=p.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(wr(x(),u)),u=[],r.lastMarkCovered=false);return}let b=g.pending?{...m,pageBreakBefore:true}:m;o.push(wr(b,u)),m.pageBreakBefore&&(m={...m,pageBreakBefore:void 0}),g.pending=false,g.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered,u=[];};for(let b of e){if(r.nodesLeft<=0){r.truncated=true;break}if(eo(b)){let S=Je(b),P=S==="w:sdt"?rh(b):null;if(s&&th(b)){T(),r.nodesLeft-=1,g.pending&&Ui(o),g.pending=true,g.skipSpacer=true;continue}if(Td.has(S)){r.nodesLeft-=1;continue}let O=et(b);if(O.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(Og(O)){T(),r.nodesLeft-=1,jn(Array.from(b.childNodes),t+1,n,r,o,false,g,s);continue}if(r.definedNoteElements.has(b)){r.nodesLeft-=1;continue}if(Pd.has(S)){if(T(),r.nodesLeft-=1,g.pending&&g.skipSpacer&&nh(b)){g.skipSpacer=false;continue}if(S==="div"&&Cd(b)){let M=ah(b,n,r,false);M.para.pageBreakBefore&&(g.pending=true),jn(Array.from(b.childNodes),t+1,M,r,o,false,g,s);continue}let N=o.length;ih(b,t,n,r,o,g.pending),o.length>N&&(g.pending=false,g.skipSpacer=false);continue}if(S==="ol"||S==="ul"){T();let N=o.length;sh(b,t,n,r,o,g.pending),o.length>N&&(g.pending=false,g.skipSpacer=false);continue}if(S==="table"){T(),g.pending&&Ui(o),yI(b,t,n,r,o),g.pending=false,g.skipSpacer=false;continue}if(Rd.has(S)||P!==null||S==="span"&&Cd(b)){T(),r.nodesLeft-=1,jn(P??Array.from(b.childNodes),t+1,n,r,o,false,g,s);continue}}if(b.nodeType===3&&/^[\s\u00a0]+$/.test(b.nodeValue??"")&&wd(u)){r.nodesLeft-=1;continue}Gi(b,t,n,u,r);}if(a&&o.length===l&&u.length>0&&!u.some(b=>b.includes("<w:r"))&&(o.push(wr(m,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered),T(),p.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${p.join("")}`):b!==void 0?o.splice(l,0,wr(x(),p)):u=p.concat(u),p=[];}u.length>0&&(o.push(wr(x(),u)),u=[],r.lastMarkCovered=false),d&&g.pending&&(Ui(o),g.pending=false,g.skipSpacer=false,r.lastMarkCovered=false),a&&o.length===l&&(o.push(wr(m,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered);}function yI(e,t,n,r,o){Yg(e,t,n,r,o,jn);}function bI(e,t){return Ng({blocks:t,rels:e.rels,lists:[...e.lists.values()],notes:e.notes,noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function vI(e,t){let n=t.maxHtmlBytes??pI;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=Eg(r),i={footnote:new Set,endnote:new Set},s=new Set,l={footnote:new Set,endnote:new Set};Fg(r,a,l);let d={nodesLeft:t.maxNodes??mI,maxDepth:t.maxDepth??gI,maxImageBytes:t.maxImageBytes??hI,wordHtml:sg(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:cg(r),listDefinitions:vg(ug(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=wa(u,r.documentElement),u=wa(u,o);let p={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,P)=>kd(P.element)-kd(S.element)),d.lastMarkCovered=false;let g=[];jn(Array.from(o.childNodes),0,p,d,g);let x=d.lastMarkCovered,T=d.truncated,b=false;for(let S=0;S<m.length;S+=1){let P=m[S];d.truncated=false;let O=d.nodesLeft,N=[];if(jn(Array.from(P.element.childNodes),0,{...p,noteBody:{kind:P.kind,id:P.id},rels:d.noteRels[P.kind]},d,N,true),d.truncated||N.length===0){b=true;let M=new Set;for(let R=S;R<m.length;R+=1){let y=m[R];i[y.kind].delete(y.id),s.delete(y.element),d.notes[y.kind].delete(y.id),d.bodyNoteRefs[y.kind].delete(y.id),M.add(`${y.kind}:${y.id}`);}if(M.size>0){for(let R=0;R<g.length;R+=1)g[R]=to(g[R],M,d.noteMarkFallbacks);for(let R of ["footnote","endnote"])for(let[y,q]of d.notes[R])d.notes[R].set(y,q.map(k=>to(k,M,d.noteMarkFallbacks)));}d.nodesLeft=O;for(let R=S;R<m.length&&d.nodesLeft>0;R+=1)jn(Array.from(m[R].element.childNodes),0,p,d,g);break}d.notes[P.kind].set(P.id,N);}return d.truncated=T||b,d.lastMarkCovered=x,Ag(d,i,g,Ed),g.length===0?{ok:false,reason:"no-content"}:{ok:true,projection:d,blocks:g}}var xI=Rg();function lh(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return xI(e,n,()=>vI(e,t))}function dh(e,t={}){let n=lh(e,t);return n.ok?{ok:true,fragmentBytes:bI(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function ch(e,t={}){let n=lh(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var SI={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function uh(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 SI[n.toLowerCase()]??t})}var wI=new Set(["script","style","title","template"]),II=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),kI=new Set(["td","th"]),fh=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),TI=e=>fh(e)||e!==void 0&&e>="0"&&e<="9",ph=e=>e===" "||e===" "||e===`
|
|
6
|
-
`||e==="\r"||e==="\f";function PI(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!fh(e[n]))return null;let o=n;for(;n<e.length&&TI(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};ph(l)||(s=false);}n+=1;}return {name:a,closing:r,end:e.length}}function RI(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 CI(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&&ph(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function*mh(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=PI(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&wI.has(r.name)?t=CI(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
|
|
7
|
-
`:r.closing&&kI.has(r.name)?yield " ":r.closing&&II.has(r.name)&&(yield `
|
|
8
|
-
`);}}function EI(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of mh(t))n+=r;return uh(n).replace(/\r\n?/g,`
|
|
9
|
-
`).split(`
|
|
10
|
-
`).map(RI).join(`
|
|
11
|
-
`).replace(/\n{3,}/g,`
|
|
12
|
-
|
|
13
|
-
`).trim()}function gh(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 hh=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function yh(e){return hh.test(e)}function Fd(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of mh(t)){let r=n.includes("&")?uh(n):n;if(hh.test(r))return true}return false}function Od(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?EI(n):""}function Ad(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function FI(e){if(!e)return false;if(yh(Ad(e,"text/plain")))return true;let t=Ad(e,"text/html");if(t.length===0)return false;if(Fd(t))return true;let n=Zi(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:ch(t).imageCount>0}function OI(e){return e?Fd(Ad(e,"text/html")):false}var AI=Object.freeze({kind:"body"});function lt(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 ht(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 Xi(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 vh(e,t){return e?e.scope:t||AI}function MI(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(...bh(i.fragments));return o}if(!t)return ya(e);let r=no(e,t);return r?bh(r.fragments):[]}function no(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 xh(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 Md(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Ld(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 Nd(e,t,n,r,o={}){return Id$1(e,t,n.fragments,r,o)}function LI(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=no(r,t);return o?_if(e,t.pageIndex,o.fragments,n):null}function NI(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 Sh(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function wh(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 Ih(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!no(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(no(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function kh(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function Th(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Dd(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Hd(e,t,n,r,o,a,i){let s=o?LI(e,o,i):a?NI(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 d=s.find(u=>u.position.paragraphId===l.position.paragraphId&&u.position.offset===l.position.offset);return d?{...l,pageIndex:d.pageIndex}:l}function _d(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,d=s.y;if(t.x>=l&&t.x<l+s.width&&t.y>=d&&t.y<d+s.height)return {pageIndex:r.index,scopeId:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-l,y:t.y-d},fragments:i.fragments}}}return null}function Ph(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let d=o.y,u=r.y,p=n?Math.max(u,n.box.y+n.box.height):u,m=n?Math.min(d,n.box.y):d;return p<=m?null:{x:r.x,y:m,width:r.width,height:p-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 Bd(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=Ph(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 $d(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=Ph(r,a)??s,d=l.x+o,u=l.y;if(t.x>=d&&t.x<d+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 ro(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 MI(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 Yi(e,t,n,r){let o=ro(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 bh(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 Rh(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 DI(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function HI(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 _I(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function BI(e,t){if(e)try{await e.delete(t);}catch{}}async function $I(e){let t=e.fetcher??fetch,n=e.maxFontBytes??a$1,r=await DI(e.cacheName??"docx-editor-fonts");async function o(l){let d=Object.freeze({family:l.family,weight:l.weight,style:l.style}),u=Rh(d);if(u)return {failure:{url:l.url,request:d,reason:"invalidRequest",diagnostic:u}};let p=(b,S)=>{if(b.byteLength===0)return {url:l.url,request:d,reason:"emptyResponse"};if(b.byteLength>n)return {url:l.url,request:d,reason:"overLimit"};let P=i(b,l.faceIndex??0);if(!P.valid)return {url:l.url,request:d,reason:"malformed",diagnostic:P.diagnostic};let O=a$2(b);return l.hash!==void 0&&l.hash!==O?{url:l.url,request:d,reason:"hashMismatch",expectedHash:l.hash,actualHash:O,...S?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:d,id:`url:${l.url}`,bytes:b,hash:O,faceIndex:l.faceIndex??0}},m=await HI(r,l.url);if(m){let b=p(m,true);if(!("reason"in b))return {source:b};await BI(r,l.url);}let g;try{g=await t(l.url);}catch(b){return {failure:{url:l.url,request:d,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}if(!g.ok)return {failure:{url:l.url,request:d,reason:"httpError",status:g.status}};let x;try{x=new Uint8Array(await g.arrayBuffer());}catch(b){return {failure:{url:l.url,request:d,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}let T=p(x,false);return "reason"in T?{failure:T}:(await _I(r,l.url,x),{source:T})}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 qI(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=Rh(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 ZI=96,Ch=37.79527559055118;function KI(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 d=s/8;n.push({position:l,height:10,...d>0?{label:String(d)}:{}});}else s%4===0?n.push({position:l,height:6}):s%2===0?n.push({position:l,height:4}):n.push({position:l,height:2});}return n}let r=Ch/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 VI(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var zI=1440,jI=567,UI=180,WI=56.7,Qi=(e,t,n)=>n<t||e<t?t:e>n?n:e;function GI(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 Eh(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 XI(e,t,n,r,o={}){let a=Eh(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=Qi(a,0,i);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),d=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:Qi(a-r.leftMargin,l,d)}}case "hanging":{let l=Qi(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=Qi(a,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}var Fh="no formatting has been copied",Ji="there is nothing at the selection to copy",qd="the selection has nothing to paint",es=Object.freeze({mode:"off",level:"none"});function wt(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 kr(e){if(typeof e!="object"||e===null)return false;let t=e;return wt(t.from)&&wt(t.to)}function Oh(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 sn(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=Qh$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=Oh(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=Oh(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 Ah(e,t,n){if("anchor"in n){let s=sn(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(!wt(r)||!wt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=sn(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=sn(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 Ia=/^[0-9A-Fa-f]{6}$/,Mh={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"},YI={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 Zd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function ts(e){return Math.max(0,Math.min(1,e))}function Lh(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 Nh(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 Dh(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-ts(t))*255)))/255,o=Lh(e);return Nh(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Hh(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(ts(t)*255)))/255,o=Lh(e);return Nh(r*o.r,r*o.g,r*o.b)}function Kd(e){return Mh[e]??Mh[e.toLowerCase()]??null}function QI(e,t){let n=Kd(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&Ia.test(r))return r.toUpperCase();let o=YI[n];return o&&Ia.test(o)?o.toUpperCase():null}function ns(e,t){let n=QI(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Zd(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Zd(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=Dh(r,ts(e.tint)):e.shade!==void 0&&(r=Hh(r,ts(e.shade))),{ok:true,hex:r}}var JI="000000";function Vd(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return Ia.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:JI}};let n=ns(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Kd(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function zd(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 Ia.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=ns(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Kd(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function ek(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return Ia.test(o)?`#${o}`:`#${n}`}let r=ns(e,t);return `#${r.ok?r.hex:n}`}var ok=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function oo(e){return ok.has(e.type)}function ve(e,t){return {ok:false,code:e,reason:t}}function jd(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return ve("invalidArgs","the table target is no longer valid");case "table-has-merge":return ve("unsupported","this table has merged cells");case "row-hides-cell":return ve("unsupported","this table has a cell the editor cannot place in the grid");case "block-required":return ve("unsupported","the table must keep at least one row or column");case "resource-limit":return ve("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return ve("invalidArgs","the table command arguments are invalid");default:return ve("unsupported",`the table operation was refused (${e})`)}}function yt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $t(e,t){return !yt(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function qh(e){if(!yt(e))return false;let t=e.kind;if(t==="hex")return $t(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return $t(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 $t(e,n)}return false}function Zh(e){return yt(e)&&$t(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 Kh(e){return yt(e)&&$t(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 ak(e){return yt(e)&&$t(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 ik(e){return yt(e)&&$t(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 sk(e){return !yt(e)||!$t(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&qh(e.color)}function _h(e){return !("target"in e)||e.target===void 0||Zh(e.target)}function Bh(e){return !("target"in e)||e.target===void 0||Kh(e.target)}function lk(e){switch(e.type){case "insertRow":return !yt(e)||e.type!=="insertRow"?ve("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?ve("invalidArgs","insertRow where must be above or below"):_h(e)?null:ve("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !yt(e)||e.type!=="deleteRow"?ve("invalidArgs","deleteRow command shape is invalid"):_h(e)?null:ve("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !yt(e)||e.type!=="insertColumn"?ve("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?ve("invalidArgs","insertColumn where must be left or right"):Bh(e)?null:ve("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !yt(e)||e.type!=="deleteColumn"?ve("invalidArgs","deleteColumn command shape is invalid"):Bh(e)?null:ve("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !yt(e)||!$t(e,["type"])?ve("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !yt(e)||!$t(e,["type","color"])?ve("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!qh(e.color)?ve("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !yt(e)||!$t(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?ve("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !yt(e)||e.type!=="setTableBorders"?ve("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?ve("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!sk(e.spec)?ve("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !yt(e)||!$t(e,["type","target","leftWidthTwips","rightWidthTwips"])||!ak(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?ve("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !yt(e)||!$t(e,["type","target","columnWidthTwips","tableWidthTwips"])||!ik(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?ve("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function dk(e){return !("target"in e)||e.target===void 0?null:Zh(e.target)?e.target:null}function ck(e){return !("target"in e)||e.target===void 0?null:Kh(e.target)?e.target:null}function uk(e,t){let n=th$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 fk(e,t){let n=th$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=Vh(s);if(r.has(s.id))for(let d=0;d<l;d+=1){let u=n.topology.gridColumns[i+d];u&&o.add(u.id);}i+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function $h(e,t,n){let r=th$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function pk(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 Vh(e){let t=rh$1(e,"tcPr"),n=t&&rh$1(t,"gridSpan"),r=n&&sh$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 mk(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=Vh(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 gk(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=th$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 hk(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=th$1(e.part.root,t.tableId);return n.ok?mk(n.topology,t.tableId,t.gridColumnId):null}function yk(e,t){for(let n of t){let r=Vh$1(e,n);if(r)return jd(r)}return null}function Bt(e,t,n){let r=yk(e,t);return r||{ok:true,ops:t,selection:n}}function bk(e,t){if(!uh$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=Vd(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function ka(e,t,n){return n!==e.storeRevision?ve("invalidArgs","the table target is stale"):th$1(e.part.root,t).ok?null:ve("invalidArgs","the table target is no longer valid")}function vk(e){return e?.isHeaderRepeat?ve("unsupported","repeated header rows cannot be edited"):null}function xk(e,t,n,r){let o=ka(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return ve("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return ve("invalidArgs","column widths must be whole twips");if(n<300||r<300)return ve("invalidArgs","column widths are below the minimum");let a=th$1(e.part.root,t.tableId);if(!a.ok){let p=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return jd(p)}if(a.topology.hasMerge)return ve("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(p=>p.id===t.leftGridColumnId),s=a.topology.gridColumns.find(p=>p.id===t.rightGridColumnId);if(!i||!s)return ve("invalidArgs","the table target is no longer valid");let l=a.topology.gridColumns.indexOf(i);if(a.topology.gridColumns.indexOf(s)!==l+1)return ve("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 Bt(e.part,[u],{kind:"preserveSelection"})}function Sk(e,t,n,r){let o=ka(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return ve("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return ve("invalidArgs","column widths must be whole twips");if(n<300)return ve("invalidArgs","column widths are below the minimum");let a=th$1(e.part.root,t.tableId);if(!a.ok){let l=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return jd(l)}if(a.topology.hasMerge)return ve("unsupported","this table has merged cells");let i=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!i||i.id!==t.gridColumnId)return ve("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 Bt(e.part,[s],{kind:"preserveSelection"})}function zh(e,t,n){if(e.viewing||!e.editable)return ve("locked","the document is open for viewing");let r=ka(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return ve("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return ve("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return Bt(e.part,[o],{kind:"preserveSelection"})}function Ln(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return ve("locked","the document is open for viewing");switch(t.type){case "mergeCells":return ve("unsupported","cell merge is not supported yet");case "splitCell":return ve("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return ve("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=lk(t);if(a)return a;let i=dk(t),s=ck(t),l=vk(i??s);if(l)return l;if(i){let u=ka(e,i.tableId,i.sourceRevision);if(u)return u}if(s){let u=ka(e,s.tableId,s.sourceRevision);if(u)return u}let d=i!==null?gk(e,i):s!==null?hk(e,s):pk(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!d)return i||s?ve("invalidArgs","the table target is no longer valid"):ve("unsupported","the selection is not inside a table");if(d?.isHeaderRepeat)return ve("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!d)return ve("unsupported","the selection is not inside a table");let u={op:"insertTableRow",tableId:d.tableId,rowId:d.rowId,where:t.where};return Bt(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!d)return ve("unsupported","the selection is not inside a table");let u=uk(n,d),p=u.wholeTable?[{op:"deleteBlock",blockId:d.tableId}]:u.rowIds.map(m=>({op:"deleteTableRow",tableId:d.tableId,rowId:m,...m===d.rowId?{referenceCellId:d.cellId}:{}}));return Bt(n,p,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!d)return ve("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,p=s?.gridColumnId??$h(n,u,d.gridColumnIndex),m=p?{op:"insertTableColumn",tableId:u,where:t.where,gridColumnId:p}:{op:"insertTableColumn",tableId:u,where:t.where,referenceCellId:d.cellId};return Bt(n,[m],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!d)return ve("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,p=s?.gridColumnId??$h(n,u,d.gridColumnIndex);if(!p)return ve("invalidArgs","the table has no grid column to delete");let m=s?.gridColumnId===void 0?fk(n,d):{gridColumnIds:[p],wholeTable:false};if(m.wholeTable)return Bt(n,[{op:"deleteBlock",blockId:u}],{kind:"adoptCommittedCaret"});let x=(m.gridColumnIds.length>0?m.gridColumnIds:[p]).map(T=>({op:"deleteTableColumn",tableId:u,gridColumnId:T}));return Bt(n,x,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!d)return ve("unsupported","the selection is not inside a table");let u={op:"deleteBlock",blockId:d.tableId};return Bt(n,[u],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!d)return ve("unsupported","the selection is not inside a table");let u;if(t.color===null)u=null;else {let m=zd(t.color,e.themeColors);if(!m.ok)return ve("invalidArgs",m.reason);u=m.color;}let p={op:"setTableCellFill",tableId:d.tableId,cellIds:d.cellIds,color:u};return Bt(n,[p],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!d)return ve("unsupported","the selection is not inside a table");let u={op:"setTableCellVerticalAlignment",tableId:d.tableId,cellIds:d.cellIds,alignment:t.alignment};return Bt(n,[u],{kind:"preserveSelection"})}case "setTableBorders":{if(!d)return ve("unsupported","the selection is not inside a table");if(t.scope==="none"){let m={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:"none",target:t.target};return Bt(n,[m],{kind:"preserveSelection"})}let u=bk(t.spec,e.themeColors);if(!u.ok)return ve("invalidArgs",u.reason);let p={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:t.scope,spec:u.spec};return Bt(n,[p],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return xk(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return Sk(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return ve("unsupported",`command '${t.type}' is not a table command`)}}function jh(e){if(!oo(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 wk=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function Ik(e,t){return e===t?true:!e||!t?false:wk.every(n=>e[n]===t[n])}function Ud(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||!Ik(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 Wd(e,t){return e.current===t.current&&e.total===t.total}function Gd(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 Uh(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 Xd(e,t){return e===t?true:!e||!t||!kr(e)||!kr(t)?false:Uh(e.from,t.from)&&Uh(e.to,t.to)}function Yd(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var kk={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",showParagraphMarks:"compared",reviewDisplayMode:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},Tk=Object.keys(kk);function Qd(e,t){return Tk.every(n=>e[n]===t[n])}function rs(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)rs(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))rs(t[n]);return Object.freeze(e)}var Jd=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"}}]]),Pk=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),Rk=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,Ck=/^[0-9A-Fa-f]{6}$/;function ec(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!Rk.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"&&!Ck.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"||!Pk.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 Yh(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function tc(e){return typeof e=="object"&&e!==null&&Yh(e.anchor)&&Yh(e.head)}function qt(e,t){let n=new Error(t);return n.code=e,n}function os(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 nc(e){return e==="blank"?od():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function rc(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 Ta(e){switch(e.type){case "toggleMark":return Jd.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=ec(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=jh(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(tc(e.range)||kr(e.range))||"anchor"in e&&wt(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 Ek(e){return [e.left,e.top,e.right,e.bottom]}function oc(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function Fk(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function Pa(e){return Math.round(e*1e3)}function Ra(e){return e/1e3}function ac(e){return Object.freeze({left:Pa(e.left),top:Pa(e.top),right:Pa(e.right),bottom:Pa(e.bottom)})}function Ok(e){return Object.freeze({left:Ra(e.left),top:Ra(e.top),right:Ra(e.right),bottom:Ra(e.bottom)})}function ic(e){return Ek(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Ak=new Set(["insertImage","replaceImage"]),Mk=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function sc(e,t,n){return n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function Lk(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&sc(o,n,r))return o;return null}function Nk(e,t,n,r){let o=e.layout();for(let a of o.pages){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&sc(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&&sc(s,n,r))return s}}return null}function Qh(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function Ca(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$1(e.layout(),n.paragraphId,n.offset),a=t.kind==="pointer"?t.drawingNodeId:null;return Lk(o,n.paragraphId,n.offset,a)??Nk(e,n.paragraphId,n.offset,a)}function Jh(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 ey(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 Dk(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 ty(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 Hk(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function gn(e){let t=Ca(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?Jh(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:oc(t.crop),rotationDegrees:r.rotationDegrees,wrap:Hk(t),position:ey(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:Dk(t),...ty(n)})}function ny(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 lc(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function ry(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function dc(e){return lc(e)!==void 0||ry(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function cc(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=ry(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=lc(t),i=gn(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 io(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function Un(e,t){let n=gn(e),r=lc(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 _k(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 as(e,t){return _k(e.applyDrawingOps(t))}function Bk(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 $k(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function qk(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function Zk(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||Eh$1(e)}function oy(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 Ea(e){return Mk.has(e.type)}function Kk(e){return Ak.has(e.type)}function ay(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function iy(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 Fa(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=gn(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function io(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=gn(r),s=n.drawingNodeId??t.drawingNodeId;if(!i||!s||i.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function Oa(e,t){if(!Ea(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=Un(t,e);return "ok"in o?o:null}let n=Un(t,e);if("ok"in n)return n;let r=gn(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(!qk(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let o=r.position?.mode??"frame";return Gh(e,o)?Bh$1(oy(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($k(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!Zk(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&&!ic(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(Eh$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(!Gh(e,a))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!Bh$1(Fh$1(e,r)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function uc(e,t){let n=iy(t,e.type);if(n)return n;let r=Oa(e,t);return r||{ok:true}}function sy(e,t){let n=Oa(e,t);return n||ay(e)}function ly(e,t,n){if(Kk(t))return ay(t);let r=n&&dc(t)?Fa(n):null;if(r&&n){let o=cc(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=Un(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=Un(e,t);return "ok"in o?o:as(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=Un(e,t);return "ok"in o?o:as(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=Un(e,t);if("ok"in o)return o;let a=gn(e),i=oy(t,a);return as(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=Un(e,t);if("ok"in o)return o;let a=gn(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let d=Bk(a);if(!d)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:d});}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:ac(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}),Eh$1(t)){let d=Fh$1(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:d});}if(t.hyperlink!==void 0){let d=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return d.ok?null:{ok:false,code:"invalidArgs",reason:d.detail??d.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:as(e,i)}default:return null}}function Vk(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$1(e.layout(),t,n),d=l&&l.box.width>0?Math.min(l.box.width,i):i,u=Math.min(1,d/r,s/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function fc(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=iy(n,t.type);if(r)return r;let o=Oa(t,n);if(o)return o;let a=Fa(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:p}=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 g=Vk(n,p.paragraphId,p.offset,t.widthPoints,t.heightPoints),x=await n.insertImage({paragraphId:p.paragraphId,offset:p.offset,bytes:t.data,mime:t.mime,widthPoints:g.widthPoints,heightPoints:g.heightPoints,expectedPackageRevision:m,commitGuard:()=>io(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),T=io(e,a);return T||(x.ok?{ok:true,changed:x.change!==null}:{ok:false,code:"invalidArgs",reason:x.detail==="stale-package-epoch"?"stale package revision":x.detail??x.reason??"insertImage was refused"})}let i=Un(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",d=await n.replaceImage(i.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>io(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),u=io(e,a,{requireDrawing:true,drawingNodeId:i.id});return u||(d.ok?{ok:true,changed:d.change!==null}:{ok:false,code:"invalidArgs",reason:d.detail==="stale-package-epoch"?"stale package revision":d.detail??d.reason??"replaceImage was refused"})}var zk=1,jk=10,Aa=12700;function Uk(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=ty(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function Wk(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=Ca(e);if(!r||r.accessibility.hidden)return null;let o=e.layout(),a=Od$1(o,r.drawingNodeId);if(!a)return null;let i=Jh(e,r);if(!i||i.locks.select)return null;let s=Uk(r,i),d=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:ey(i),anchorFrameOrigin:u,transform:r.transform,...d})}function It(e){return Math.round(e*Aa)}function ao(e){return e/Aa}function Gk(e,t,n,r,o,a){let i=ao(e),s=ao(t),l=i/s,d=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+d),s=Math.max(1,s+u),a)if(n.length===2){let m=Math.max(i/ao(e),s/ao(t));i=Math.max(1,ao(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 pc(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 Xk(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"}:io(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function dy(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 mc(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 gc(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let d=e.session.paraIdOf(t.paragraphId);return d===null?null:{from:{paraId:d},to:{paraId:d}}}let r=e.session.paragraphAnchors(),o=r.paraIdByNode.get(t.paragraphId),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 cy(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 uy(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:Qh$1(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function hc(e){return e?e.state().pageCount:0}function yc(e,t="caret"){return e?e.currentPage(t):1}function Yk(e,t){if(!oo(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=is(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 Qk(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 is(e,t){let n=Ln(Qk(e,t));return n.ok?{can:{ok:true},plan:n}:{can:{ok:false,code:n.code,reason:n.reason},plan:n}}function Ma(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=Ta(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:Fh}};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(oo(e)){let i=Yk(e,t);return i.ok?{ok:true,tablePlan:i.tablePlan}:i}let a=Oa(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function fy(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 py(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!fy(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 bc(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!fy(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 my(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 ye={undo:["M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"],redo:["M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"],print:["M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"],file_download:["M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],file_upload:["M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],format_bold:["M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"],format_italic:["M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"],format_underlined:["M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"],strikethrough_s:["M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"],superscript:["M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"],subscript:["M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"],link:["M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"],format_clear:["m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"],format_paragraph:["M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"],format_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 so={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},hy=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function vc(e){return createT(en)(e)}function ss(e){return hy.includes(e)}function tT(e){return e!=null}var yy=[{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"}],by=[{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"}],nT=[{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 rT(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function oT(e){return e==="none"||rT(e)}function gy(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function aT(e){return by.some(t=>t.value===e)}function Tr(e,t,n){switch(t){case "table.borderTarget":return oT(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(!gy(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(!aT(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&&!gy(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function xc(e,t=so){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return Tr(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return Tr(t,e,"single")?.command??null;case "table.borderWidth":return Tr(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function iT(e){return yy.find(n=>n.value===e)?.labelKey??"table.borders.all"}function sT(e){return ye[e]}function Wn(e){return e.surface??null}var lT={"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.allMarkup":{type:"setReviewDisplayMode",mode:"all-markup"},"review.noMarkup":{type:"setReviewDisplayMode",mode:"proposed"},"review.original":{type:"setReviewDisplayMode",mode:"original"},"review.previousChange":{type:"navigateReviewChange",direction:"previous"},"review.nextChange":{type:"navigateReviewChange",direction:"next"},"review.acceptAllChanges":{type:"resolveAllReviewChanges",action:"accept"},"review.rejectAllChanges":{type:"resolveAllReviewChanges",action:"reject"},"history.undo":{type:"undo"},"history.redo":{type:"redo"},"text.bold":{type:"toggleMark",mark:"bold"},"text.italic":{type:"toggleMark",mark:"italic"},"text.underline":{type:"toggleMark",mark:"underline"},"text.strike":{type:"toggleMark",mark:"strike"},"script.super":{type:"toggleMark",mark:"superscript"},"script.sub":{type:"toggleMark",mark:"subscript"},"format.clear":{type:"clearFormatting"},"alignment.left":{type:"setAlignment",align:"left"},"alignment.center":{type:"setAlignment",align:"center"},"alignment.right":{type:"setAlignment",align:"right"},"alignment.justify":{type:"setAlignment",align:"justify"},"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 dT(e){return xy[e]??null}var vy=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),xy={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:vy,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 La(e){return lT[e]??null}var cT={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},uT={"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 Sy(e,t,n){return Tr(n,e,t)?.command??null}function ls(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(ss(e))return Sy(e,t,so);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=cT[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function wy(e,t,n=so){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=xc(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 fT=["editing","suggesting","viewing"];function Iy(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(ss(t))return wy(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=fT.filter(d=>d!==a).map(d=>e.can(ls(t,d))),s=i.some(d=>d.ok),l=i.find(d=>!d.ok);return {id:t,enabled:s,disabledReason:!s&&l&&!l.ok?l.reason:null,active:false,value:a}}if(t==="format.painter"){let a=Wn(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=Wn(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=Wn(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=La(t);if(!n){let a=uT[t];if(a!==void 0){let s=ls(t,a);if(!s)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let l=e.can(s),d=e.getSelectedImage?.()??null,u=t==="image.wrap"?d?.wrap:t==="image.altText"?d?.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=xy[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let l=e.canExecuteImageCommand?.({type:"insertImage",data:vy,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 pT(e){if(e==="format.painter")return true;let t=La(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"}function mT(e,t){return t.map(n=>Iy(e,n))}function gT(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=Tr(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 hT(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="format.painter"){let a=Wn(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:Ji}}if(t==="contentControl.showAll"){let a=Wn(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=Wn(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=Wn(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=Wn(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?La(t):ls(t,n)??La(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 yT(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function bT(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=is(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function vT(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 Sc(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Sc):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Sc(e[t])]))}function xT(e){return JSON.stringify(Sc(e))}var ky={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:ye.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:ye.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:ye.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:ye.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:ye.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:ye.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:ye.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:ye.format_paragraph,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:ye.comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:ye.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:ye.edit_note,state:{kind:"command"}}]};var wc=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:ye.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:ye.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:ye.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:ye.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:ye.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:ye.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:ye.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:ye.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:ye.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:ye.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:ye.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:ye.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:ye.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:ye.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:ye.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:ye.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:ye.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:ye.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:ye.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:ye.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:ye.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:ye.format_clear,state:{kind:"command"}}]},ky,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:ye.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:ye.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:ye.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:ye.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:ye.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:ye.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:ye.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:ye.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:ye.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:ye.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:ye.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:ye.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:ye.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:ye.format_line_spacing,state:{kind:"command"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:ye.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:ye.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:ye.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:ye.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:ye.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:ye.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:ye.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:ye.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:ye.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:ye.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:ye.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:ye.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:ye.toc,state:{kind:"command"}}]}],Ty=wc;function ST(e,t){return `${e.id}.${t.id}`}function Py(){return Ty.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function wT(e){let t=Py();if(!e)return t;let n=Ty.find(r=>r.id==="image");return n?[...t,n]:t}var Ry=[{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:ye.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"review",labelKey:"toolbar.review",entries:[{kind:"submenu",labelKey:"review.displayForReview",paths:ye.visibility,items:[{kind:"item",slot:"review.allMarkup"},{kind:"item",slot:"review.noMarkup"},{kind:"item",slot:"review.original"}]},{kind:"separator"},{kind:"item",slot:"review.previousChange"},{kind:"item",slot:"review.nextChange"},{kind:"separator"},{kind:"item",slot:"review.acceptAllChanges"},{kind:"item",slot:"review.rejectAllChanges"},{kind:"separator"},{kind:"item",slot:"review.paragraphMarks"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function IT(){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 Ry)t(n.entries);return e}function kT(){return wc.reduce((e,t)=>e+t.controls.length,0)}var TT="formattingBar.unavailableInPreview";function Cy(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}var CT=createT(en);function lo(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return CT(t)}}var Ey=new WeakMap;function ds(e,t){let n=new Map;return Ey.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 Fy(e,t){let n=Ey.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 Oy(e,t,n,r){let o=lo(r),a=e.ownerDocument,i=a.createElement("dialog"),s=ds(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 d=a.createElement("div");d.className="docx-text-form-dialog__body",s(d,`textFormField.invalid${t==="number"?"Number":"Date"}`);let u=a.createElement("div");u.className="docx-text-form-dialog__footer";let p=a.createElement("button");p.type="button",p.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(p,"textFormField.apply");let m=false,g=()=>{m||(m=true,n());};return p.addEventListener("click",g),i.addEventListener("keydown",x=>{x.key==="Enter"&&(x.preventDefault(),x.stopPropagation(),g());}),i.addEventListener("cancel",x=>{x.preventDefault(),g();}),u.append(p),i.append(l,d,u),e.append(i),i.showModal(),p.focus(),i}function Ay(e,t,n,r,o){let a=lo(o),i=e.ownerDocument,s=i.createElement("dialog"),l=ds(s,a);s.className="docx-text-form-dialog",l(s,"textFormField.title","aria-label");let d=i.createElement("h2");d.className="docx-text-form-dialog__header",l(d,"textFormField.title");let u=i.createElement("div");u.className="docx-text-form-dialog__body";let p=i.createElement("div");p.className="docx-text-form-dialog__footer",s.append(d,u,p);let m=(C,L)=>{let H=i.createElement("label");H.className="docx-text-form-dialog__row";let U=i.createElement("span");U.className="docx-text-form-dialog__label",l(U,C),L.className="docx-text-form-dialog__input",H.append(U,L),u.append(H);},g=i.createElement("input");g.type="text",g.value=t.defaultText,m("textFormField.defaultText",g);let x=i.createElement("select"),T=["regular","number","date"];for(let C of T){let L=i.createElement("option");L.value=C,l(L,`textFormField.${C}`),x.append(L);}if(!T.includes(t.type)){let C=i.createElement("option");C.value=t.type,l(C,"textFormField.preservedType"),C.disabled=true,x.append(C);}x.value=t.type,m("textFormField.type",x);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"),P=C=>{S.replaceChildren();let L=Xg$1[x.value]??[];for(let H of L){let U=i.createElement("option");U.value=H;let I={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[H];I||!H?l(U,I??"textFormField.noFormat"):U.textContent=H,S.append(U);}if(!L.includes(C)){let H=i.createElement("option");H.value=C,C?H.textContent=C:l(H,"textFormField.noFormat"),H.disabled=true,S.append(H);}S.value=C;};P(t.format),x.addEventListener("change",()=>P("")),m("textFormField.format",S);let O=i.createElement("input");O.type="checkbox",O.checked=t.enabled;let N=i.createElement("label");N.className="docx-text-form-dialog__checkbox-row";let M=i.createElement("span");l(M,"textFormField.enabled"),N.append(O,M),u.append(N);let R=i.createElement("p");R.className="docx-text-form-dialog__error",R.setAttribute("role","alert"),u.append(R);let y=i.createElement("button");y.type="button",y.className="docx-text-form-dialog__button",l(y,"textFormField.cancel"),y.addEventListener("click",r);let q=i.createElement("button");q.type="button",q.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(q,"textFormField.apply");let k=()=>{if(!b.value||!b.checkValidity()||!n(g.value,{type:x.value,maxLength:Number(b.value),format:S.value,enabled:O.checked})){l(R,"textFormField.invalidOptions");return}r();};return q.addEventListener("click",k),s.addEventListener("keydown",C=>{C.key==="Enter"&&C.target instanceof HTMLInputElement&&(C.preventDefault(),k());}),s.addEventListener("cancel",C=>{C.preventDefault(),r();}),p.append(y,q),e.append(s),s.showModal(),g.focus(),g.select(),s}function My(e,t,n){let r=[],o=[];for(let i of e)for(let s of Ha$2(i).keys()){let l=Ga(i,s);if(l?.kind==="paragraph")for(let d of $g$1(l)){let u=t.get(d.fieldNodeId);if(!u)continue;let p=(Qh$1(i,s)??"").slice(d.start,d.end),m=Yg$1(p,d,"fill",u.locale);if(m===null)return {reason:"invalidArgs"};if(m===p)continue;let g={op:"commitTextFormField",paragraphId:s,fieldNodeId:d.fieldNodeId,locale:u.locale},x=Vh$1(i,g);if(x)return {reason:x};r.push(g),o.push({paragraphId:s,start:d.start,end:d.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 cs=new WeakMap,us=new WeakMap;function Ny(e){return us.get(e)?.()??null}function Ly(e){return [...Ha$2(e).keys()].flatMap(t=>{let n=Ga(e,t);return n?.kind==="paragraph"?$g$1(n):[]})}function fs(e){return cs.get(e)?.()}function Dy(e,t){let n=lo(e.translate),r=e.container.ownerDocument,o,a=false,i=new Map,s=()=>e.parts?.()??[e.part()];if(t?.length)for(let A of s()){let $=t.filter(X=>X.partName===A.name);if(!$.length)continue;let z=Ly(A);for(let X of $){let Y=z[X.fieldIndex];Y&&i.set(Y.fieldNodeId,{text:X.text,locale:X.locale});}}let l=new WeakMap,d=new WeakMap,u=(A=e.part())=>{l.set(A,new Map([...i].filter(([$])=>$.startsWith(`${A.name}#`))));},p=()=>(i=new Map(s().flatMap(A=>[...l.get(A)??[]])),d.get(e.part())??null),m=A=>{i.delete(A),u();};s().forEach(u);let g=()=>{if(!i.size)return null;if(a)return "invalidState";let A=My(s(),i,e.selection());if("reason"in A)return A.reason;if(A.ops.length&&!e.editable())return "locked";let $=s();s().forEach(u);let z=i;A.ops.length&&d.set(e.part(),e.selection()),i=new Map,a=true;try{let X=A.ops.length?e.save?e.save(A.ops,A.selection):"unsupported":null;return X?i=z:(delete Q.dataset.fieldError,A.ops.length&&d.set(e.part(),A.selection)),s().forEach(u),X}catch(X){throw s().every(Y=>$.includes(Y))&&(i=z),s().forEach(u),X}finally{a=false;}};us.set(e.container,g);let x=()=>i.size?s().flatMap(A=>Ly(A).flatMap(($,z)=>{let X=i.get($.fieldNodeId);return X?[{partName:A.name,fieldIndex:z,...X}]:[]})):[];cs.set(e.container,x);let T,b=(A,$)=>(Qh$1(e.part(),A)??"").slice($.start,$.end),S=null,P=null,O=()=>{let A=e.selection();S?.remove(),S=null,e.pagesLayer.focus({preventScroll:true}),e.select(A);};function N(A,$){T={paragraphId:A,fieldNodeId:$.fieldNodeId},e.select({anchor:{paragraphId:A,offset:$.start},head:{paragraphId:A,offset:$.end}}),e.selection().head.paragraphId===A&&e.selection().head.offset>=$.start&&e.selection().head.offset<=$.end&&(P=T??P),T=void 0;}function M(A,$){O();let z=e.locale?.()??"en-US";S=Ay(e.container,$,(X,Y)=>{if(!e.editable()||e.protected(A)||!e.apply({op:"setTextFormFieldDefault",locale:z,paragraphId:A,fieldNodeId:$.fieldNodeId,text:X,options:Y}))return false;let D=Ga(e.part(),A),ee=D?.kind==="paragraph"?$g$1(D).find(ne=>ne.fieldNodeId===$.fieldNodeId):null;return ee&&N(A,ee),true},O,n);}let R=A=>{let z=A.target?.closest('[data-field-atom="form"][data-start]'),X=z?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!z||!X||!e.editable())return null;let Y=Ga(e.part(),X);if(Y?.kind!=="paragraph")return null;let D=Number(z.dataset.start),ee=$g$1(Y).find(ne=>ne.start<=D&&D<ne.end);return ee?{paragraphId:X,field:ee}:null},y=null,q=A=>A.shiftKey||A.altKey||A.ctrlKey||A.metaKey,k=A=>{if(o=void 0,y=null,A.button!==0)return;let $=R(A);$&&!q(A)&&!e.protected($.paragraphId)&&(y={x:A.clientX,y:A.clientY,paragraphId:$.paragraphId,fieldNodeId:$.field.fieldNodeId,moved:false}),T=$?{paragraphId:$.paragraphId,fieldNodeId:$.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",k,{capture:true});let C=A=>{y&&Math.hypot(A.clientX-y.x,A.clientY-y.y)>4&&(y.moved=true);},L=()=>{y=null;},H=(A,$=false)=>{let z=y;if(y=null,!z||z.moved||S||A.button!==0||A.detail>1||Math.hypot(A.clientX-z.x,A.clientY-z.y)>4||!e.editable()||q(A)||e.protected(z.paragraphId))return;let X=Ga(e.part(),z.paragraphId),Y=X?.kind==="paragraph"?$g$1(X).find(ee=>ee.fieldNodeId===z.fieldNodeId):null;if(!Y)return;let D=e.selection();$&&(D.anchor.paragraphId!==D.head.paragraphId||D.anchor.offset!==D.head.offset)&&!(D.anchor.paragraphId===z.paragraphId&&D.head.paragraphId===z.paragraphId&&Math.min(D.anchor.offset,D.head.offset)===Y.start&&Math.max(D.anchor.offset,D.head.offset)===Y.end)||N(z.paragraphId,Y);};r.addEventListener("pointermove",C),r.addEventListener("pointercancel",L),e.pagesLayer.addEventListener("click",H);let U=A=>{if(A.shiftKey||A.altKey||A.ctrlKey||A.metaKey)return false;let $=R(A);if(!$)return false;let{paragraphId:z,field:X}=$;return A.preventDefault(),N(z,X),e.protected(z)||M(z,X),true};e.pagesLayer.addEventListener("dblclick",U);function G(){let A=e.selection();if(A.anchor.paragraphId!==A.head.paragraphId)return null;let $=A.head.paragraphId,z=Ga(e.part(),$);if(z?.kind!=="paragraph")return null;let X=Math.min(A.anchor.offset,A.head.offset),Y=Math.max(A.anchor.offset,A.head.offset),D=$g$1(z).filter(ne=>ne.start<=X&&ne.end>=Y),ee=D.find(ne=>P?.paragraphId===$&&ne.fieldNodeId===P.fieldNodeId)??D.find(ne=>ne.start===X&&ne.end===Y)??D[0];return ee?{paragraphId:$,field:ee}:null}function I(){if(o===void 0)return G();if(!o)return null;let A=Ga(e.part(),o.paragraphId),$=A?.kind==="paragraph"?$g$1(A).find(z=>z.fieldNodeId===o.fieldNodeId):null;return $?{paragraphId:o.paragraphId,field:$}:null}let Z=A=>{let $=A.button===-1||A.clientX===0&&A.clientY===0?G():R(A);o=$?{paragraphId:$.paragraphId,fieldNodeId:$.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",Z);let te=()=>{let A=I();return !!A&&e.editable()&&!e.protected(A.paragraphId)&&!Vh$1(e.part(),{op:"setTextFormFieldDefault",paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},Q=r.createElement("span");return Q.className="docx-text-form-status",e.container.append(Q),{doubleClick:U,pointerUp:A=>H(A,true),canEdit:te,edit(){if(!te())return false;let A=I();return N(A.paragraphId,A.field),M(A.paragraphId,A.field),true},selectForDeletion(A){let $=e.selection(),{paragraphId:z,offset:X}=$.head;if(!e.editable()||e.protected(z)||$.anchor.paragraphId!==z||$.anchor.offset!==X)return false;let Y=Ga(e.part(),z);if(Y?.kind!=="paragraph")return false;let D=$g$1(Y).find(ee=>ee.start<ee.end&&(A==="backward"?ee.end===X:ee.start===X));return D?(N(z,D),true):false},beforeSelect(A){let $=Ee=>{if(T!==void 0)P=T;else if(A.anchor.paragraphId!==A.head.paragraphId||P?.paragraphId!==A.head.paragraphId)P=null;else {let we=Ga(e.part(),A.head.paragraphId),qe=we?.kind==="paragraph"?$g$1(we).find(Pe=>Pe.fieldNodeId===P?.fieldNodeId):null;(!qe||Math.min(A.anchor.offset,A.head.offset)<qe.start||Math.max(A.anchor.offset,A.head.offset)>qe.end)&&(P=null);}return T=void 0,delete Q.dataset.fieldError,Ee};if(a||S?.getAttribute("role")==="alertdialog")return null;if(!e.editable())return A;let z=G();if(!z||!e.protected(z.paragraphId)||!z.field.enabled||!Zg$1(z.field))return $(A);let{field:X,paragraphId:Y}=z;if((!T||T.fieldNodeId===X.fieldNodeId)&&A.anchor.paragraphId===Y&&A.head.paragraphId===Y&&Math.min(A.anchor.offset,A.head.offset)>=X.start&&Math.max(A.anchor.offset,A.head.offset)<=X.end)return $(A);let D=i.get(X.fieldNodeId),ee=D?.text,ne=D?.locale??e.locale?.()??"en-US",fe=b(Y,X);if(X.type==="date"&&ee===void 0)return m(X.fieldNodeId),$(A);let F=Yg$1(fe,X,"fill",ne);if(F===fe||F===null&&(ee===void 0||ee===fe))return m(X.fieldNodeId),$(A);a=true;let K=e.part();u(K);let j=i;i=new Map(j),i.delete(X.fieldNodeId);let le;try{le=e.apply({op:"commitTextFormField",locale:ne,paragraphId:Y,fieldNodeId:X.fieldNodeId}),le||(i=j);}catch(Ee){throw e.part()===K&&(i=j),Ee}finally{u(),a=false;}if(!le)return T=void 0,Q.setAttribute("role","alert"),Q.dataset.fieldError="true",Q.textContent=n("textFormField.invalidValue"),F===null&&(X.type==="number"||X.type==="date")&&(S=Oy(e.container,X.type,()=>{S?.remove(),S=null;let Ee=e.selection(),we=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(Ee);},qe=Ga(e.part(),Y),Pe=qe?.kind==="paragraph"?$g$1(qe).find(he=>he.fieldNodeId===X.fieldNodeId):null;if(!Pe||!e.editable()||!e.protected(Y)||b(Y,Pe)!==fe||!Pe.enabled||!Zg$1(Pe)||Pe.type!==X.type||Pe.format!==X.format||Yg$1(fe,Pe,"fill",ne)!==null){we();return}a=true;try{if(e.apply({op:"deleteText",paragraphId:Y,start:Pe.start,end:Pe.end,textFormFieldId:Pe.fieldNodeId})){m(Pe.fieldNodeId),delete Q.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let he={paragraphId:Y,offset:Pe.start};a=!1,e.select({anchor:he,head:he}),P={paragraphId:Y,fieldNodeId:Pe.fieldNodeId};}else a=!1,we();}finally{a=false;}},n)),null;m(X.fieldNodeId);let Se=Ga(e.part(),Y),de=Se?.kind==="paragraph"?$g$1(Se).find(Ee=>Ee.fieldNodeId===X.fieldNodeId):null,oe=de?de.end-X.end:0,ge=Ee=>Ee.paragraphId===Y&&Ee.offset>=X.end?{...Ee,offset:Ee.offset+oe}:Ee;return $({anchor:ge(A.anchor),head:ge(A.head)})},update(){S&&Fy(S,n);let A=G(),$=e.selection(),z=!!A&&$.anchor.offset!==$.head.offset&&Math.min($.anchor.offset,$.head.offset)===A.field.start&&Math.max($.anchor.offset,$.head.offset)===A.field.end;for(let X of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let Y=X.closest("[data-paragraph-id]")?.dataset.paragraphId,D=Number(X.dataset.start);!!A&&Y===A.paragraphId&&D>=A.field.start&&D<A.field.end?X.dataset.textFormSelection=z?"whole":"caret":delete X.dataset.textFormSelection;}if(Q.dataset.fieldError){Q.textContent=n("textFormField.invalidValue");return}A?Q.setAttribute("role","status"):Q.removeAttribute("role"),Q.textContent=A?n(z?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>G()?.field.fieldNodeId??null,afterApply(A){A?u():p();},restoreAfterHistory:p,annotate(A){(!a||A.some(z=>z.op!=="commitTextFormField"))&&u(),A.some(z=>z.op==="insertText"||z.op==="deleteText")&&delete Q.dataset.fieldError;let $=G();return P=$?{paragraphId:$.paragraphId,fieldNodeId:$.field.fieldNodeId}:null,A.map(z=>{if(!P||z.op!=="insertText"&&z.op!=="deleteText"||z.revision||z.paragraphId!==P.paragraphId||!e.protected(z.paragraphId))return z;let X=Ga(e.part(),z.paragraphId),Y=X?.kind==="paragraph"?$g$1(X).find(ne=>ne.fieldNodeId===P.fieldNodeId):null,D=z.op==="insertText"?z.offset:z.start,ee=z.op==="insertText"?z.offset:z.end;return !Y||D<Y.start||ee>Y.end?z:(i.has(Y.fieldNodeId)||i.set(Y.fieldNodeId,{text:b(z.paragraphId,Y),locale:e.locale?.()??"en-US"}),{...z,textFormFieldId:Y.fieldNodeId})})},keydown(A){if(A.key==="F10"&&A.shiftKey&&!A.altKey&&!A.ctrlKey&&!A.metaKey)return o=void 0,A.preventDefault(),e.pagesLayer.dispatchEvent(new MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(A.key!=="Tab"||A.altKey||A.ctrlKey||A.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let $=[],z=[e.part().root];for(;z.length;){let F=z.pop();if(F.kind==="paragraph")for(let K of $g$1(F))e.protected(F.id)&&K.enabled&&Zg$1(K)&&!Vh$1(e.part(),{op:"insertText",paragraphId:F.id,offset:K.start,text:"x"})&&$.push({paragraphId:F.id,field:K});else for(let K=F.children.length-1;K>=0;K--){let j=F.children[K];j.kind!=="textValue"&&z.push(j);}}if(!$.length)return false;let X=e.selection(),Y=X.head,D=P?$.findIndex(F=>F.paragraphId===P.paragraphId&&F.field.fieldNodeId===P.fieldNodeId&&F.field.start<=Math.min(X.anchor.offset,Y.offset)&&F.field.end>=Math.max(X.anchor.offset,Y.offset)):-1,ee=D>=0?D:$.findIndex(F=>F.paragraphId===Y.paragraphId&&F.field.start<=Math.min(X.anchor.offset,Y.offset)&&F.field.end>=Math.max(X.anchor.offset,Y.offset)),ne=ee<0?A.shiftKey?$.length-1:0:(ee+(A.shiftKey?-1:1)+$.length)%$.length,fe=$[ne];return A.preventDefault(),N(fe.paragraphId,fe.field),true},destroy(){us.get(e.container)===g&&us.delete(e.container),cs.get(e.container)===x&&cs.delete(e.container),r.removeEventListener("pointermove",C),r.removeEventListener("pointercancel",L),e.pagesLayer.removeEventListener("click",H),e.pagesLayer.removeEventListener("contextmenu",Z),Q.remove(),e.pagesLayer.removeEventListener("dblclick",U),e.pagesLayer.removeEventListener("pointerdown",k,{capture:true}),S?.remove(),S=null;}}}var ps=new WeakMap;function Ic(e){let t=ps.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function Hy(e){let t=ps.get(e)??{depth:0};return t.depth++,ps.set(e,t),()=>{--t.depth===0&&(ps.delete(e),t.resolve?.());}}async function _y(e,t,n){if(!e)throw qt("notFound","no document is loaded");let r=t?Ic(t):void 0;if(r&&(await r,n()!==e))throw qt("invalidState","The document changed before the pending save could finish.");return e.save().slice().buffer}function By(e,t,n){let r=()=>{if(n())throw qt("destroyed","Cannot save a destroyed surface.")};if(r(),Ic(t))throw qt("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),r();let o=Ny(t);if(o)throw qt(o,"Cannot save pending text form input. Enter a valid value in each field.");return r(),e.refreshRefFieldResults(),r(),e.session.save()}function $y(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function qy(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=ht(n.session,i.paragraphId,{kind:"body"}),l=JSON.stringify(s),d=o.get(l)??{scope:s,ops:[]};d.ops.push(i),o.set(l,d);}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 Zy(e,t){let n=Wg$1(e);return {get:()=>n,set(r){let o=Wg$1(r);n!==o&&(t(),n=o);}}}var ET=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTableRow","deleteTableRow","setRunProperties","setParagraphProperties","setParagraphMarkProperties"]);function kc(e){return ET.has(e.op)}function Tc(e){if(kc(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 Pc(e){return e?.trim()||void 0}function Ky(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function Vy(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}function ms(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 zy="docx-field-atom--active",FT="docx-field-atom",jy=new WeakMap;function Rc(e,t,n){let r=jy.get(e);r||(r={caretKey:null,marked:[]},jy.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(zy);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${FT}`);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(zy),r.marked.push(i));}}var OT={kind:"body"};function Uy(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$1(e.canonicalUnfilteredLayout()),n(l)):Le$1(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},a=Me(t.part(),o),i=Ne(t.part(),o);if(!a&&i.length===0)return true;let s=[];a&&s.push({scope:OT,ops:[a]});for(let l of i)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function Gy(e){let t=0,n=null,r="",o=null,a=true,i=null,s="";return ()=>{let l=e.surface(),d=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,u=e.activeKey(),p=e.paneOpen(),m=e.selectionAnchor(),g=e.authorFilterKey();return (l!==n||d!==r||u!==o||p!==a||m!==i||g!==s)&&(n=l,r=d,o=u,a=p,i=m,s=g,t+=1),t}}function gs(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,d=null,u=false,p=0,m=null,g=[],x=null,T=[],b=r,S=t,P=new Set,O="accept",N=new WeakSet,M=new WeakMap,R=new Map,y=()=>{p+=1,m=null,g=[],x=null;},q=L=>JSON.stringify([L.id,wa$1(L)]),k=(L,H,U)=>{let G=AT(U),I=t,Z=r?.hiddenAuthors??rb$1,te=a,Q;I===S&&MT(G,P)&&(G.size===0||te===O)?Q=b:G.size===0&&I.size===0?Q=void 0:Q=Object.freeze({hiddenAuthors:Z,includes:$=>!I.has($.author)&&!G.has($.nodeId),includesNode:($,z)=>!I.has(z)&&!G.has($),excludedNodeMode:($,z)=>I.has(z)?"proposed":G.has($)&&te==="reject"?"original":"proposed",cacheKey:LT(I,G,te)});let A=[];for(let $ of L){let z=Wy($);z!==null&&I.has(z)||$.kind==="revision"&&H.has($)||A.push($);}T=A.length===L.length?L:Ma$1(A),x=L,N=H,b=Q,S=I,P=G,O=te,u=false,i=null,s="accept",l=new WeakMap,d=null;},C=L=>{if(L===x)return;let H=new WeakSet,U=[],G=[];try{for(let Z of L){if(Z.kind!=="revision")continue;let te=!t.has(Z.author),Q=M.get(Z);Q===void 0&&(Q=o?.(Z)??!0,G.push([Z,Q])),!(te&&Q)&&(H.add(Z),Q||U.push(Z));}}catch(Z){if(u)o=i,a=s,M=l,x=d,i=null,s="accept",l=new WeakMap,d=null,p+=1;else {let te=new WeakSet,Q=[];for(let A of L){if(A.kind!=="revision")continue;let $=R.get(q(A))??true;(t.has(A.author)||!$)&&te.add(A),$||Q.push(A);}k(L,te,Q);}throw u=false,Z}for(let[Z,te]of G)M.set(Z,te);let I=new Map;for(let Z of L)Z.kind==="revision"&&I.set(q(Z),M.get(Z)??true);R=I,k(L,H,U);};return {get hiddenAuthors(){return r?.hiddenAuthors??rb$1},get hiddenAuthorList(){return n},get stateKey(){return String(p)},get hasFilter(){return t.size>0||o!==null},filterFor(L){return o?(C(L),b):r},filterForSession(L){return o?(C(L.reviewItems()),b):r},filterItems(L){if(!o){if(t.size===0)return L;if(L===m)return g;let H=L.filter(U=>{let G=Wy(U);return G===null||!t.has(G)});return m=L,g=H.length===L.length?L:Ma$1(H),g}return C(L),T},includesRevisionItem(L){return !N.has(L)},setPredicate(L,H="accept"){return o===null&&L===null?false:L===null?(o=null,a="accept",i=null,s="accept",u=false,M=new WeakMap,l=new WeakMap,R=new Map,d=null,T=[],N=new WeakSet,b=r,S=t,P=new Set,O="accept",y(),true):(i=o,s=a,l=M,d=x,u=true,o=L,a=H,M=new WeakMap,y(),true)},isVisible:L=>!t.has(L),setVisible(L,H){if(H===!t.has(L))return false;let U=new Set(t);return H?U.delete(L):U.add(L),t=U,n=Object.freeze([...U]),r=sb$1(U),y(),true},setAllVisible(L,H){let U=H?new Set:new Set(L);return U.size===t.size&&[...U].every(G=>t.has(G))?false:(t=U,n=Object.freeze([...U]),r=sb$1(U),y(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,y(),true)}}}function Xy(e,t){return t.filterItems(e)}function AT(e){let t=new Set;for(let n of e)for(let r of wa$1(n))t.add(r);return t}function MT(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function LT(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function Wy(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function Yy(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 Cc(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function Qy(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 g=Cc(m);g!==null&&(yield g);}})()),s=a?.value,l=s!==void 0&&s.size===i.size&&[...i].every(([p,m])=>s.get(p)===m),d=l?s:i,u=a!==null&&l&&a.styles===o?a.resolved:new Map(c(d,o).map(p=>[p.author,p]));return t={layout:n,items:r,styles:o,value:d,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 co(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function t0(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 n0(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 Ec=new WeakMap;function NT(e,t,n){return e.map(r=>a$4(n?.(r.name))??a$4(r.color)??a$4(t?.(r.name)))}function DT(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 HT(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function _T(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 BT(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 e0(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function $T(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 r0(e,t,n,r){let{scale:o$1,pageOffsetX:a,pages:i,colorForAuthor:s,declaredColorFor:l}=r,d=r.labelHost??null,u=NT(n,s,l),p={layout:t,fingerprint:DT(n,u),pagesKey:HT(i),scale:o$1,offsetKey:_T(a),labelHost:d},m=Ec.get(e);if(m&&BT(m,e,p))return;Ec.delete(e);let g=[],x=[],T=[],b=[];for(let[N,M]of n.entries())M.kind==="cells"||e0(M)||b.push({key:String(N),from:{paragraphId:M.anchor.nodeId,offset:M.anchor.offset},to:{paragraphId:M.head.nodeId,offset:M.head.offset}});let S=b.length>0?df(t,b,Sa(t),i,r.measurer):null;for(let[N,M]of n.entries()){let R=u[N],y=jf(t,{paragraphId:M.head.nodeId,offset:M.head.offset},r.measurer);if(y){let k=cf$1(t,M.head.nodeId,y.pageIndex);T.push({selection:M,...R?{color:R}:{},pageIndex:y.pageIndex,x:y.x+k.x,y:y.y+k.y});}if(M.kind==="cells"){let k=$T(t,M);if(k.length>0){for(let C of k)g.push(C),x.push(R);continue}}if(e0(M)){let k=jf(t,{paragraphId:M.anchor.nodeId,offset:M.anchor.offset},r.measurer);if(!k)continue;let C=cf$1(t,M.anchor.nodeId,k.pageIndex);g.push({pageIndex:k.pageIndex,x:k.x+C.x,y:k.y+C.y,width:Math.max(1/o$1,1),height:k.height,className:"docx-remote-caret"}),x.push(R);continue}let q=S?.get(String(N));if(q)for(let k of q)g.push({...k,className:"docx-remote-selection-rect"}),x.push(R);}o(e,t,g,{scale:o$1,pageOffsetX:a}),[...e.children].forEach((N,M)=>{let R=a$4(x[M]);!R||!(N instanceof HTMLElement)||N.style.setProperty("--doc-remote-color",R);});let P=e.ownerDocument,O=[];for(let N of T){let M=t.pages[N.pageIndex];if(!M)continue;let R=P.createElement("div");R.className="docx-remote-caret-label",d?(R.setAttribute("data-docx-remote-actor",N.selection.actorId),O.push({element:R,selection:N.selection})):R.textContent=N.selection.name,R.style.left=`${(M.contentBox.x+N.x+(a?.get(N.pageIndex)??0))*o$1}px`,R.style.top=`${(M.contentBox.y+N.y)*o$1}px`;let y=a$4(N.color);y&&R.style.setProperty("--doc-remote-color",y),e.append(R);}Ec.set(e,{...p,childCount:e.childElementCount}),d&&d.publish(O);}var qT=/[\p{L}\p{N}_'’]/u,o0=e=>e!==void 0&&qT.test(e);function hs(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(o0(r[a])?i=a:a>0&&o0(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 He(e){return {anchor:e,head:e}}function Pr(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 ys(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 Na(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,d=nf(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,d))}};return {anchor:o(n.anchor),head:o(n.head)}}function bs(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 d=1;d<s.length;d+=1){let u=s[d],p=nf(e,u),m=Oa$1(e,u).includes(s[d-1])?"":`
|
|
17
|
-
`;l+=m+(d===s.length-1?p.slice(0,n.offset):p);}return l}function Fc(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 i0(e){return e.kind}function s0(e){return e.kind!=="textValue"&&i0(e)==="contentControl"}function a0(e){return e.kind!=="textValue"&&i0(e)==="contentControlContent"}function ZT(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=Fc(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 KT(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(s0(a)){let s=Fc(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 l0(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 VT(e,t,n){let r=[],o=a=>{if(a.kind!=="textValue"){if(a.kind==="table"||s0(a)){let s=Fc(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 d0(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 d=i.slice(s,l+1),u=l0(a,i,s,l,n,r),p=i[l];return {partName:t.name,paragraphIds:d,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...u],fullyCoveredBlockIds:VT(t,u,new Set(i)),lastMarkCovered:r.offset===a(p).length}}function c0(e,t,n,r,o){let a=R=>nf(e,R);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 d=l0(a,i,s,l,n,r),u=ZT(t,d),p=new Map;for(let[R,y]of u)for(let q of y)p.set(q,R);let m=KT(t,d,u),g=s;if(p.has(n.paragraphId)){g=-1;for(let R=s+1;R<=l;R+=1)if(!p.has(i[R])){g=R;break}if(g===-1){let R=p.get(n.paragraphId);for(let y of u.get(R)??[])p.delete(y);u.delete(R),g=s;}}let x=i[g],T=g===s?n:{paragraphId:x,offset:0},b=[];for(let R=s;R<=l;R+=1){let y=i[R];if(p.has(y))continue;let q=a(y).length,k=R===s?n.offset:0,C=R===l?r.offset:q;k<C&&b.push({op:"deleteText",paragraphId:y,start:k,end:C});}for(let R of u.keys())b.push({op:"deleteBlock",blockId:R});for(let R of m)b.push({op:"removeContentControl",controlId:R});let S=R=>{let y=Ha$1(t,R);for(;y&&a0(y);){let q=Ha$1(t,y.id);if(!q||!m.has(q.id))break;y=Ha$1(t,q.id);}return y},P=R=>{let y=[],q=k=>{for(let C of k)if(C.kind!=="textValue"&&!u.has(C.id)){if(m.has(C.id)){let L=C.children.find(a0);L&&L.kind!=="textValue"&&q(L.children);continue}if(C.kind==="paragraph"){y.push(C.id);continue}y.push(`\0barrier:${C.id}`);}};return q(R.children),y},O=(R,y)=>{let q=S(R);if(!q||S(y)!==q)return false;let k=P(q),C=k.indexOf(R),L=k.indexOf(y);return C!==-1&&L===C+1},N=x,M=x;for(let R=g+1;R<=l;R+=1){let y=i[R];p.has(y)||(O(M,y)?b.push({op:"joinParagraphs",firstId:N,secondId:y}):N=y,M=y);}return {ops:b,collapseTo:T}}function zT(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var m0=/^[^\s]{1,512}$/,jT=/["\\\u0000-\u001f\u007f]/;function vs(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!m0.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 Da(e,t,n){return jT.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function g0(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=vs(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function h0(e){return e.querySelector("[data-docx-hf-active]")}function Rr(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 UT(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function Oc(e,t){let n=h0(e);if(n)return [n,e];let r=UT(e,t);return r&&r!==e?[r,e]:[e]}function u0(e,t){let n=g0(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=vs(a);if(i)return {element:a,identity:i}}return null}function WT(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=u0(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=u0(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function f0(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")||h0(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?y0(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let s=e,l=vs(s);if(l)return {paragraphId:l.paragraphId,offset:t>0?l.end:l.start};let d=WT(s,t);return d||QT(s)}let i=g0(e);return i?{paragraphId:i.identity.paragraphId,offset:zT(i.identity,t)}:null}function uo(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=f0(n,r,e),s=f0(o,a,e);if(!i||!s){let l=i??s;return l?{anchor:l,head:l}:null}return {anchor:i,head:s}}function Ac(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 p0(e,t,n){for(let r of Oc(e,n)){let o=GT(r,t);if(o)return o}return null}function GT(e,t){let n=Da(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let i of n){let s=vs(i);if(!s||s.paragraphId!==t.paragraphId)continue;let l=XT(i),d=i.textContent?.length??0,u=s.end;if(l&&!i.closest?.("[data-docx-field]")&&(o=true,t.offset>=s.start&&t.offset<=u)){let p={node:l,offset:Math.min(t.offset-s.start,d)};if(t.offset<u)return p;r=p;}}if(r)return r;if(o)return null;let a=YT(e,t.paragraphId);return a?{node:a,offset:0}:null}function XT(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 YT(e,t){let n=null;for(let r of Da(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 y0(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!m0.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function QT(e){let t=y0(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function b0(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??Rr(n.anchorNode,e),a=p0(e,t.anchor,o),i=p0(e,t.head,o);if(!a||!i)return false;let s=uo(e,n);if(s&&Zt(s,t)){let l=Rr(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 JT='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function v0(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 x0(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 eP(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function tP(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function S0(e,t,n,r){if(e.dataset.docxField!==void 0){let a=v0(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:v0(e,t,t+o.length),text:o,seq:r}}function w0(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=x0(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(JT))continue;w0(r,t);continue}let a=S0(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 nP(e,t,n,r){let o=[];for(let i of Da(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=tP(i,n,r),d=a.get(s);(!d||l>d.affinity)&&a.set(s,{element:i,affinity:l});}return [...a.values()].map(i=>i.element)}function rP(e,t,n){for(let r of Da(e,n.paragraphId,"[data-start]")){let o=r,a=x0(o,n.paragraphId);if(a===null||t.some(l=>l.contains(o)))continue;let i=S0(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 oP(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 I0(e,t,n,r){let o=nP(e,t,r,eP(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)w0(i,a);return rP(e,o,a),a.pieces.length===0?null:oP(a.pieces,n)}var aP={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},k0={l:"left",e:"center",r:"right",j:"both"},T0={1:"240",5:"360",2:"480"},P0={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function iP(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}var sP=/^[a-z]$/;function lP(e){let t=e.key.toLowerCase();if(sP.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function C0(e,t={}){return n=>{if(n.defaultPrevented)return;if(!n.altKey&&!n.isComposing&&(n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.key==="8"||n.ctrlKey&&!n.metaKey&&n.shiftKey&&(n.code==="Digit8"||n.key==="*"))&&t.onToggleParagraphMarks){n.preventDefault(),t.onToggleParagraphMarks();return}if(n.key==="Escape"&&e.formatPainter.state().mode!=="off"){e.formatPainter.disarm(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="headerFooter"){e.exitHeaderFooter(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="note"){e.exitNote(),n.preventDefault();return}let r=lP(n);if(iP(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=aP[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&&P0[n.key.toLowerCase()]){let i=P0[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&&k0[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:k0[n.key.toLowerCase()]}),n.preventDefault();return}if(o&&!n.shiftKey&&T0[n.key]){e.setParagraphProperty("spacing",{line:T0[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 E0(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=Od(a.clipboardData),s=a.clipboardData?.getData("text/html")??"";a.preventDefault(),!(!i&&!s)&&e.pasteRich(i,s.length>0?s:null);}}}function R0(e){let t=Od(e.dataTransfer);return t.length>0?t:null}function F0(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??R0(n);if(!r)return;fP(e,cP(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=R0(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function dP(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 cP(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=dP(n);return r?{text:r,paragraphId:uP(n)}:null}function uP(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 fP(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(Zt(r.selection,He(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let i=lt(e.session,o.paragraphId)??e.session.part(),s=Qh$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 O0(e,t,n,r=null){for(let o of Oc(e)){let a=I0(o,t,n,r);if(a!==null)return a}return null}function A0(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 Le(e){return e.kind!=="textValue"}function xe(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Le(n)&&n.localName===t&&n.namespaceUri===da$1)return n;return null}function Ue(e,t="val"){return e?De(e,t,da$1):void 0}function Xt(e,t,n){return e?De(e,t,n):void 0}function Mc(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=Mc(n);return t}function fo(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=fo(r,t,n);if(o)return o}return null}function ct(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function Lc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var hn=Lc;function xs(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function yn(e){return `${Math.round(e/20*100)/100}pt`}var pP="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",mP=zc$1;function Ha(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&&Le(i.root))return i.root}}let r=e.parts.get(n);return r&&Le(r.root)?r.root:null}function M0(e){let t=Ha(e,pP,"/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(!Le(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 d=De(l,"styleId",da$1);if(!d)continue;n.set(d,l);let u=De(l,"default",da$1),p=De(l,"type",da$1);u==="1"||u==="true"||u==="on"?p==="paragraph"?a=d:p==="character"&&(i=d):(a===d&&(a=null),i===d&&(i=null));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i}}function Nn(e,t,n){let r=[],o=new Set,a=t;for(;a&&!o.has(a)&&r.length<mP;){o.add(a);let i=e.byId.get(a);if(!i)break;if(r.length===0&&n!==void 0){let s=De(i,"type",da$1);if(s!==void 0&&s!==n)return []}r.unshift(i),a=Ue(xe(i,"basedOn"));}return r}function Nc(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let a of n)r.push(a);let o=Ue(xe(t,"pStyle"));for(let a of Nn(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let i=xe(a,"pPr");i&&r.push(i);}return t&&r.push(t),r}function Ss(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let a=[];if(r)for(let p of r)a.push(p);let i=[],s=Ue(xe(t,"pStyle"));for(let p of Nn(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let m=xe(p,"rPr");m&&i.push(m);}let l=[],d=Ue(xe(n,"rStyle"))??e.defaultCharacterStyleId??void 0;for(let p of Nn(e,d,"character")){let m=xe(p,"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 Yt(e,t){let n=null;for(let r of e){let o=xe(r,t);o&&(n=o);}return n}function ot(e,t,n){let r;for(let o of e){let a=xe(o,t);if(!a)continue;let i=De(a,n,da$1);i!==void 0&&(r=i);}return r}function ws(e){return !(e==="0"||e==="false"||e==="off")}function Cr(e,t){let n=false;for(let r of e){let o=xe(r,t);o&&(n=ws(Ue(o)));}return n}function Gn(e,t){let n;for(let r of e){let o=xe(r,t);o&&(n=ws(Ue(o)));}return n}function ln(e,t){let n=e.direct?xe(e.direct,t):null;if(n)return ws(Ue(n));let r=Gn(e.tableLevel,t),o=Gn(e.paragraphLevel,t),a=Gn(e.characterLevel,t);return a===false||a===void 0&&o===false||a===void 0&&o===void 0&&r===false?false:Gn(e.defaults,t)===true?true:r===true!=(o===true)!=(a===true)}function Dc(e,t){let n=e.direct?xe(e.direct,t):null;if(n)return ws(Ue(n));let r=Gn(e.characterLevel,t);if(r!==void 0)return r;let o=Gn(e.paragraphLevel,t);if(o!==void 0)return o;let a=Gn(e.tableLevel,t);return a!==void 0?a:Gn(e.defaults,t)===true}function L0(e){return e.isLgl?"decimal":e.numFmt}function N0(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,d]of t.abstractNums){d.numStyleLink!==void 0&&s.set(l,d.numStyleLink);let u=new Map,p=new Map;for(let[m,g]of d.levels)u.set(String(m),L0(g)),p.set(String(m),g.start);r.set(l,u),o.set(l,p);}for(let[l,d]of t.nums){n.set(l,d.abstractNumId);for(let[u,p]of d.overrides){let m=`${l}:${u}`,g=p.startOverride??p.level?.start;g!==void 0&&a.set(m,g),p.level!==void 0&&i.set(m,L0(p.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:a,formatOverrides:i,styleLinks:s}}function D0(e,t){if(e===null)return null;let n=De(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 _0(e,t){if(e===null)return null;let n=De(e,t,da$1);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function H0(e){return `${Math.round(e/20*100)/100}pt`}var gP=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function po(e,t,n){if(e===null)return null;let r=De(e,t,da$1);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=De(e,"val",da$1);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function Hc(e,t){let n=new Map,r=new Set(gP);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=De(a,"type",da$1);i===void 0||!r.has(i)||n.set(i,{fill:_0(xe(xe(a,"tcPr"),"shd"),"fill"),rPr:xe(a,"rPr"),pPr:xe(a,"pPr")});}return {byType:n,firstRowEnabled:po(t,"firstRow",32)??false,lastRowEnabled:po(t,"lastRow",64)??false,firstColumnEnabled:po(t,"firstColumn",128)??false,lastColumnEnabled:po(t,"lastColumn",256)??false,hBandingEnabled:!(po(t,"noHBand",512)??false),vBandingEnabled:!(po(t,"noVBand",1024)??false)}}function _c(e,t,n,r,o,a){let i=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,d=e.lastColumnEnabled&&o,u=p=>e.byType.get(p)??null;if(s&&l&&u("swCell"))return u("swCell");if(s&&d&&u("seCell"))return u("seCell");if(i&&l&&u("nwCell"))return u("nwCell");if(i&&d&&u("neCell"))return u("neCell");if(s&&u("lastRow"))return u("lastRow");if(i&&u("firstRow"))return u("firstRow");if(d&&u("lastCol"))return u("lastCol");if(l&&u("firstCol"))return u("firstCol");if(e.hBandingEnabled){let p=t-(e.firstRowEnabled?1:0);if(p>=0){let m=u(p%2===0?"band1Horz":"band2Horz");if(m)return m}}if(e.vBandingEnabled){let p=a-(e.firstColumnEnabled?1:0);if(p>=0){let m=u(p%2===0?"band1Vert":"band2Vert");if(m)return m}}return null}function B0(e,t,n,r,o,a,i,s){let l=[],d=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 P of ["top","left","bottom","right"]){let O=xe(d,P),N=O!==null?Sr(O):Sr(xe(t,u[P]));N&&l.push(`border-${P}:${N}`);}let p=_0(xe(e,"shd"),"fill")??s;p&&l.push(`background-color:${p}`);let m=xe(e,"vAlign"),g=m===null?void 0:De(m,"val",da$1);g==="center"?l.push("vertical-align:middle"):(g==="bottom"||g==="top")&&l.push(`vertical-align:${g}`);let x=xe(e,"tcW"),T=D0(x,"w"),b=x===null?void 0:De(x,"type",da$1);T!==null&&T>0&&(b===void 0||b==="dxa")&&l.push(`width:${H0(T)}`);let S=xe(e,"tcMar");for(let P of ["top","right","bottom","left"]){let O=xe(S,P),N=D0(O,"w"),M=O===null?void 0:De(O,"type",da$1);N!==null&&N>=0&&M==="dxa"&&l.push(`padding-${P}:${H0(N)}`);}return l.join(";")}function hP(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===da$1}function $0(e){return e.localName==="customXml"&&e.namespaceUri===da$1}function q0(e){let t=[],n=[],r=o=>{for(let a of o)if(Le(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&&Le(i)&&r(i.children);continue}if($0(a)){r(a.children);continue}n.push({skip:a});}};return r(e.children),{rows:t,tableItems:n}}function Z0(e){let t=[],n=[];for(let r of e){let o=[],a=[],i=0,s=l=>{for(let d of l)if(Le(d)){if(hP(d)){let u=xe(d,"tcPr"),p=Math.min(Math.max(ct(Ue(xe(u,"gridSpan")))??1,1),63),m=xe(u,"vMerge"),g=m===null?null:Ue(m)==="restart"?"restart":"continue",x={cell:d,startColumn:i,span:p,vMerge:g};o.push(x),a.push({placement:x}),i+=p;continue}if(d.kind==="contentControl"){let u=d.children.find(p=>p.kind==="contentControlContent");u&&Le(u)&&s(u.children);continue}if($0(d)){s(d.children);continue}a.push({skip:d});}};s(r.children),t.push(o),n.push(a);}return {placements:t,items:n}}function K0(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 V0(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=_c(t,i,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),d=[],u=[];a?.rPr&&d.push(a.rPr),a?.pPr&&u.push(a.pPr),l?.rPr&&d.push(l.rPr),l?.pPr&&u.push(l.pPr),o.set(s.cell,d.length>0||u.length>0?{...e,tableRPr:d,tablePPr:u}:e);}return o}function z0(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Le(n)?n:null,o=Nn(e.styles,Ue(xe(r,"tblStyle")),"table"),a=Hc(o,xe(r,"tblLook")),{rows:i}=q0(t),{placements:s}=Z0(i);return V0(e,a,s,K0(s))}function j0(e,t,n,r){let o=t.children.find(M=>M.kind==="tableProperties"),a=o&&Le(o)?o:null,i=null,s=Nn(e.styles,Ue(xe(a,"tblStyle")),"table");for(let M of s){let R=xe(xe(M,"tblPr"),"tblBorders");R&&(i=R);}let l=xe(a,"tblBorders");l&&(i=l);let d=Hc(s,xe(a,"tblLook")),{rows:u,tableItems:p}=q0(t),{placements:m,items:g}=Z0(u),x=K0(m),T=V0(e,d,m,x),b=["border-collapse:collapse"],S=xe(a,"tblW"),P=ct(Xt(S,"w",da$1));P!==null&&P>0&&Xt(S,"type",da$1)==="dxa"&&b.push(`width:${yn(P)}`);let O=Ue(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[M,R]of [["insideH","insideh"],["insideV","insidev"]]){let y=Sr(xe(i,M));y&&b.push(`mso-border-${R}-alt:${y}`);}let N=`<table style="${b.join(";")}">`;for(let M of p){if("skip"in M){r.advanceFieldState(M.skip,n);continue}let R=M.row,y=xe(xe(u[R]??null,"trPr"),"trHeight"),q=ct(Xt(y,"val",da$1)),k=ng(q,Xt(y,"hRule",da$1)),C=k===""?"":` style="${k}"`;N+=`<tr${C}>`;for(let L of g[R]??[]){if("skip"in L){r.advanceFieldState(L.skip,n);continue}let H=L.placement;if(H.vMerge==="continue"){r.advanceFieldState(H.cell,n);continue}let U=1;if(H.vMerge==="restart")for(let z=R+1;z<m.length&&m[z].find(Y=>Y.startColumn===H.startColumn&&Y.vMerge==="continue");z+=1)U+=1;let G=xe(H.cell,"tcPr"),I=H.startColumn+H.span>=x,Z=_c(d,R,m.length,H.startColumn===0,I,H.startColumn),te=d.byType.get("wholeTable")??null,Q=B0(G,i,R,m.length,U,H.startColumn===0,I,Z?.fill??te?.fill??null),A=(H.span>1?` colspan="${H.span}"`:"")+(U>1?` rowspan="${U}"`:"")+(Q===""?"":` style="${hn(Q)}"`),$=T.get(H.cell)??e;N+=`<td${A}>${r.renderBlocks($,H.cell.children,n)}</td>`;}N+="</tr>";}return `${N}</table>`}function Is(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 Bc(e){let t=De(e,"type",da$1);return t==="separator"||t==="continuationSeparator"}function $c(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Le(r)||r.namespaceUri!==da$1||r.localName!==t||Bc(r))continue;let o=Is(De(r,"id",da$1));o!==null&&n.add(o);}return n}function _a(e,t,n,r,o,a,i){for(let s of t.children)if(Le(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){_a(e,s,n,r,o,a,z0(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}_a(l,s,n,r,o,a,i);continue}if(s.kind==="paragraph"){let l=s.children.find(d=>d.kind==="paragraphProperties");_a(e,s,n,r,o,l&&Le(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"),d=Ss(e.styles,a,l&&Le(l)?l:null,e.tableRPr);if(ln(d,"vanish"))continue}if(s.namespaceUri===da$1&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=Is(De(s,"id",da$1));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}_a(e,s,n,r,o,a,i);}}function yP(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Le(r)||r.namespaceUri!==da$1)&&!(r.localName!==t||Bc(r))&&Is(De(r,"id",da$1))===n)return r;return null}function U0(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=yP(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},d=[];_a(e,i,d,l,n,null);for(let u of d)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 qc(e,t,n,r,o){if(n===null)return "";let a=`/word/${t}s.xml`;for(let[l,d]of e.pkg.parts)d.root===n&&(a=l);let i=gc$1(e.pkg,a),s="";for(let l of n.children){if(!Le(l)||l.namespaceUri!==da$1||l.localName!==t||Bc(l))continue;let d=De(l,"id",da$1),u=Is(d);if(d===void 0||u===null||!r.has(u))continue;let p=o({...e,noteBody:{kind:t,id:u},docRels:i},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${u}">${p===""?"<p></p>":p}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}var Zc="http://schemas.openxmlformats.org/officeDocument/2006/relationships",bP=`${Zc}/numbering`,vP=`${Zc}/footnotes`,xP=`${Zc}/endnotes`,SP=2*1024*1024,wP=8*1024*1024,W0=9525,IP=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 ks(e,t,n,r){let o=e.direct!==null&&xe(e.direct,r)!==null||Yt(e.defaults,r)!==null||Yt(e.tableLevel,r)!==null||Yt(e.paragraphLevel,r)!==null||Yt(e.characterLevel,r)!==null;return ln(e,t&&o?r:n)}function kP(e){let t=e.all;if(ln(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=Cr(t,"rtl"),o=(r?ot(t,"rFonts","cs"):void 0)??ot(t,"rFonts","ascii")??ot(t,"rFonts","hAnsi")??ot(t,"rFonts","eastAsia")??(r?void 0:ot(t,"rFonts","cs"));if(o!==void 0){let N=Jm(o);N&&n.push(`font-family:${N}`);}let a=ct((r?ot(t,"szCs","val"):void 0)??ot(t,"sz","val")??(r?void 0:ot(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;ks(e,r,"b","bCs")?n.push("font-weight:bold"):ks(i,r,"b","bCs")&&n.push("font-weight:normal"),ks(e,r,"i","iCs")?n.push("font-style:italic"):ks(i,r,"i","iCs")&&n.push("font-style:normal");let l=[],d=Yt(t,"u"),u=d!==null&&Ue(d)!=="none";u&&l.push("underline");let p=Dc(e,"dstrike");if((ln(e,"strike")||p)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let N=Yt(s,"u");(N!==null&&Ue(N)!=="none"||ln(i,"strike")||Dc(i,"dstrike"))&&n.push("text-decoration:none");}u&&n.push(...tg(d)),p&&!u&&n.push("text-decoration-style:double");let m=xs(ot(t,"color","val"));m&&n.push(`color:${m}`);let g=ct(ot(t,"spacing","val"));g!==null&&n.push(`letter-spacing:${Math.round(g/20*100)/100}pt`);let x=Ue(Yt(t,"highlight")),T=x!==void 0&&Object.hasOwn(ld,x)?ld[x]:void 0,b=xs(ot(t,"shd","fill"));T?n.push(`background-color:${T}`,`mso-highlight:${x}`):b&&n.push(`background-color:${b}`),ln(e,"caps")?n.push("text-transform:uppercase"):ln(i,"caps")&&n.push("text-transform:none"),ln(e,"smallCaps")?n.push("font-variant:small-caps"):ln(i,"smallCaps")&&n.push("font-variant:normal");let S=Ue(Yt(t,"vertAlign")),P=S==="superscript"||S==="subscript"?S:null,O=xr((r?ot(t,"lang","bidi"):void 0)??ot(t,"lang","val")??ot(t,"lang","bidi")??ot(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:P,lang:O,rtl:r}}function TP(e,t){let n=[],r=Ue(Yt(e,"jc")),o=r!==void 0&&Object.hasOwn(dd,r)?dd[r]:void 0;o&&n.push(`text-align:${o}`);let a=ct(ot(e,"spacing","before"));a!==null&&a>=0&&n.push(`margin-top:${yn(a)}`);let i=ct(ot(e,"spacing","after"));i!==null&&i>=0&&n.push(`margin-bottom:${yn(i)}`);let s=ct(ot(e,"spacing","line")),l=ot(e,"spacing","lineRule");n.push(...eg(s,l));let d=null,u=null,p=null,m=null;for(let b of e){let S=xe(b,"ind");if(!S)continue;let P=ct(Xt(S,"left",da$1)??Xt(S,"start",da$1));P!==null&&(d=P);let O=ct(Xt(S,"right",da$1)??Xt(S,"end",da$1));O!==null&&(u=O);let N=ct(Xt(S,"hanging",da$1)),M=ct(Xt(S,"firstLine",da$1));N!==null?(p=N,m=null):M!==null&&(m=M,p=null);}!t&&d!==null&&n.push(`margin-left:${yn(d)}`),u!==null&&n.push(`margin-right:${yn(u)}`),p!==null&&p!==0?n.push(`text-indent:${yn(-p)}`):m!==null&&m!==0&&n.push(`text-indent:${yn(m)}`);let g=Yt(e,"tabs");if(g){let b=[];for(let S of g.children){if(!Le(S)||S.localName!=="tab")continue;let P=Ue(S),O=ct(De(S,"pos",da$1));if(O===null||O<0||P!=="left"&&P!=="center"&&P!=="right"&&P!=="decimal"&&P!=="bar")continue;let N=Ue(S,"leader"),M=N==="dot"?"dotted":N==="hyphen"?"dashed":N==="underscore"?"lined":N==="middleDot"?"middledot":N==="heavy"?"heavy":"";b.push(`${P}${M?` ${M}`:""} ${yn(O)}`);}b.length>0&&n.push(`tab-stops:${b.join(" ")}`);}Cr(e,"pageBreakBefore")&&n.push("page-break-before:always"),Cr(e,"keepNext")&&n.push("page-break-after:avoid"),Cr(e,"keepLines")&&n.push("page-break-inside:avoid"),Cr(e,"widowControl")&&n.push("widows:2","orphans:2");let x=xs(ot(e,"shd","fill"));x&&n.push(`background-color:${x}`);let T=Yt(e,"pBdr");if(T)for(let b of ["top","left","bottom","right"]){let S=Sr(xe(T,b));S&&n.push(`border-${b}:${S}`,`mso-border-${b}-alt:${S}`);}return n.join(";")}function PP(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 G0={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function Y0(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 RP(e,t){let n,r;for(let s of t){let l=xe(s,"numPr");if(!l)continue;let d=Ue(xe(l,"numId"));d!==void 0&&(n=d);let u=Ue(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),d=l===void 0?void 0:e.styles.byId.get(l),u=Ue(xe(xe(xe(d??null,"pPr"),"numPr"),"numId")),p=u===void 0?void 0:e.numbering.numToAbstract.get(u);if(p===void 0||p===o)break;o=p;}let a=Math.min(Math.max(ct(r)??0,0),8),i=Y0(e,n,o,a);return {numId:n,abstractId:o,level:a,fmt:i.fmt,start:i.start}}function CP(e,t){let n=B(e.pkg.contentTypes,t);if(n.ok){let a=IP.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 EP(e,t){let n=fo(t,"inline",ia$1)??fo(t,"anchor",ia$1);if(!n)return "";let r=fo(n,"blip",ha$1);if(!r)return "";let o=De(r,"embed",ja$2);if(!o)return "";let a=e.docRels.find(T=>T.id===o&&T.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=CP(e,i.partName);if(!l||s.byteLength>e.maxImageBytes||e.imageBudget.used+s.byteLength>e.maxTotalImageBytes)return "";e.imageBudget.used+=s.byteLength;let d=e.imageDataUris.get(i.partName);d==null&&(d=`data:${l};base64,${qi(s)}`,e.imageDataUris.set(i.partName,d));let u=fo(n,"extent",ia$1),p=u?ct(De(u,"cx","")):null,m=u?ct(De(u,"cy","")):null,g=T=>Math.round(T/12700*100)/100,x=p!==null&&m!==null&&p>0&&m>0?` width="${Math.round(p/W0)}" height="${Math.round(m/W0)}" style="width:${g(p)}pt;height:${g(m)}pt"`:"";return `<img src="${d}"${x}>`}function Fr(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(Le(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let a=o.children.find(i=>i.kind==="contentControlContent");a&&Le(a)&&Fr(a,t,r+1);continue}if(o.kind==="fldChar"){Q0(o,t);continue}Fr(o,t,r);}}function Q0(e,t){let n=De(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 FP(e,t,n,r){let o=t.children.find(d=>d.kind==="runProperties"),a=Ss(e.styles,n,o&&Le(o)?o:null,e.tableRPr),i=kP(a),s="";for(let d of t.children){if(!Le(d))continue;if(d.kind==="fldChar"){r.inert||Q0(d,r);continue}if(d.kind==="instrText"||!r.inert&&r.stack.some(m=>m==="instr")||i.vanish)continue;let u=og(d);if(u!==""){s+=u;continue}let p=rg(d,e.noteBody,(m,g)=>PP(e,m,g),(m,g)=>e.availableNotes[m].has(g));if(p!==""){s+=p;continue}switch(d.kind){case "text":s+=Lc(Mc(d));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let m=De(d,"type",da$1);s+=m==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let m=an(De(d,"name",da$1));m!==null&&(s+=`<a id="${hn(m)}"></a>`);break}case "drawing":s+=EP(e,d);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="${hn(i.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function Er(e,t,n,r,o=0){if(o>=la$1)return "";let a="";for(let i of t)if(Le(i))switch(de(i)?"fldSimple":i.kind){case "run":a+=FP(e,i,n,r);break;case "hyperlink":{let s=Er(e,i.children,n,r,o+1);if(s==="")break;let l=De(i,"id",ja$2),d=l?e.docRels.find(m=>m.id===l):void 0,u=d===void 0?void 0:d.targetMode==="External"||d.rawTarget.startsWith("#")?d.rawTarget:void 0,p=Pg(u,De(i,"anchor",da$1));a+=p!==null?`<a href="${hn(p)}">${s}</a>`:s;break}case "bookmarkStart":{let s=an(De(i,"name",da$1));s!==null&&(a+=`<a id="${hn(s)}"></a>`);break}case "fldSimple":a+=Er(e,i.children,n,r,o+1);break;case "contentControl":{let s=i.children.find(l=>l.kind==="contentControlContent");s&&Le(s)&&(a+=Er(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":a+=Er(e,i.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":Fr(i,r,o);break;case "generic":if(na$1(i))a+=Er(e,i.children,n,r,o+1);else {let s=Ed$1(i);s&&(a+=Er(e,s,n,r,o+1));}break}return a}function OP(e,t){let n=Ue(xe(t,"pStyle")),r=Nn(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let a=De(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=ct(Ue(xe(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function AP(e,t){let n=Nn(e.styles,Ue(xe(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=Qm(De(n[r],"styleId",da$1));if(o!==null)return o}return null}function X0(e,t,n,r){let o=t.children.find(b=>b.kind==="paragraphProperties"),a=o&&Le(o)?o:null,i=Nc(e.styles,a,e.tablePPr),s=TP(i,n.asListItem),l=Er(e,t.children,a,r),d=s===""?"":` style="${hn(s)}"`,u=Cr(i,"bidi")?' dir="rtl"':"",p=AP(e,a),m=p===null?"":` class="${p}"`,g=OP(e,a);if(n.asListItem)return `<li${g?.fromStyle===true?` class="Heading${g.level}"`:m}${u}${d}>${l}</li>`;let x=g===null?"p":`h${g.level}`,T=g===null?m:g.fromStyle?` class="Heading${g.level}"`:' class="docx-outline"';return `<${x}${T}${u}${d}>${l}</${x}>`}var MP={renderBlocks:(e,t,n)=>Ts(e,t,n),advanceFieldState:Fr};function Ts(e,t,n){let r="",o=[],a=null,i=new Map,s=n;if(s===void 0){let m={stack:[]};for(let g of t)Le(g)&&Fr(g,m);s={stack:[],inert:m.stack.length>0};}let l=()=>{let m=o.pop();m&&(r+=`</${m.tag}>`);},d=()=>{for(;o.length>0;)l();a=null;},u=(m,g)=>{for(a!==null&&g.level<a&&d();o.length>0&&o[o.length-1].abstractId!==g.abstractId;)l();o.length===0&&(a=g.level);let x=a??g.level,T=g.level-x+1;for(;o.length>T;)l();for(o.length===T&&o[T-1].numId!==g.numId&&l();o.length<T;){let P=x+o.length,O=Y0(e,g.numId,g.abstractId,P),N=i.get(`${g.abstractId}:${g.numId}:${P}`)??0,M=O.start+N,R=O.fmt==="bullet"?"ul":"ol",y=R==="ol"?Object.hasOwn(G0,O.fmt)?G0[O.fmt]:"decimal":null,q=R==="ol"&&M!==1?` start="${M}"`:"";r+=y?`<${R}${q} style="list-style-type:${hn(y)}">`:`<${R}>`,o.push({tag:R,numId:g.numId,abstractId:g.abstractId});}let b=`${g.abstractId}:${g.numId}:${g.level}`;i.set(b,(i.get(b)??0)+1);let S=`${g.abstractId}:`;for(let P of i.keys()){if(!P.startsWith(S))continue;let O=P.slice(P.lastIndexOf(":")+1);/^\d+$/.test(O)&&Number(O)>g.level&&i.delete(P);}r+=X0(e,m,{asListItem:true},s);},p=m=>{for(let g of m)if(Le(g))switch(g.kind){case "paragraph":{let x=g.children.find(S=>S.kind==="paragraphProperties"),T=x&&Le(x)?x:null,b=RP(e,Nc(e.styles,T));b?u(g,b):(d(),r+=X0(e,g,{asListItem:false},s));break}case "table":d(),r+=j0(e,g,s,MP);break;case "contentControl":{let x=g.children.find(T=>T.kind==="contentControlContent");x&&Le(x)&&p(x.children);break}case "generic":p(g.children);break;case "bookmarkStart":{let x=an(De(g,"name",da$1));x!==null&&(r+=`<a id="${hn(x)}"></a>`);break}default:s.inert||Fr(g,s);break}};return p(t),d(),r}function J0(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Le(n.root))return "";let r=n.root.children.find(d=>d.kind==="body");if(!r||!Le(r))return "";let o=Ha(e,vP,"/word/footnotes.xml"),a=Ha(e,xP,"/word/endnotes.xml"),i={pkg:e,styles:M0(e),numbering:N0(Ha(e,bP,"/word/numbering.xml")),docRels:gc$1(e,e.mainDocumentPart),maxImageBytes:SP,maxTotalImageBytes:wP,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:$c(o,"footnote"),endnote:$c(a,"endnote")},noteBody:null},s=Ts(i,r.children),l=U0(i,{footnote:o,endnote:a},Fr);return s+qc(i,"footnote",o,l.footnote,Ts)+qc(i,"endnote",a,l.endnote,Ts)}var LP=12*1024*1024;function NP(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function DP(e){return `<div><table>${e.split(`
|
|
18
|
-
`).map(n=>`<tr>${n.split(" ").map(r=>`<td>${NP(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function Kc(e){if(e.cellRectangle)return {text:e.text,html:DP(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??LP,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=Ym(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:a}}function eb(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=Zi(r);if(o&&e.pasteFragment(o.bytes,o.lastMarkCovered))return "fragment";let a=dh(r);return a.ok&&a.truncated&&t.text.length>0?n():a.ok&&e.pasteFragment(a.fragmentBytes,a.lastMarkCovered)?"external-html":n()}function tb(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!hh$1(e.settingsRoot()))return r;let a=lt(e,t.paragraphId)??e.part();if(!ih$1(a,t.paragraphId))return r;let i=Ga(a,t.paragraphId);if(i?.kind!=="paragraph")return r;let s=$g$1(i).find(b=>b.fieldNodeId===o&&b.start<=t.offset&&b.end>=n.offset);if(!s?.enabled||!Zg$1(s)||s.maxLength<=0)return r;let l=(Qh$1(a,t.paragraphId)??"").slice(s.start,s.end),d=l.slice(0,t.offset-s.start),u=l.slice(n.offset-s.start),p=d+u,m=b=>_g$1(d+b+u,s,p)<=s.maxLength;if(m(r))return r;let g=[...r],x=s.maxLength-[...p].length;if(s.type==="number"&&s.format)for(let b of p)(b===","&&s.format.includes(",")||b==="%"&&s.format.endsWith("%"))&&x++;let T=new Set;if(s.type==="date"){let b=0;for(let S=0;S<g.length;S++)if(/\S/.test(g[S])){if(++b>18)break;T.add(S+1);}else (S+1===g.length||/\S/.test(g[S+1]))&&T.add(S+1);}else if(s.type==="number"&&s.format)for(let b=1;b<=3;b++)T.add(x+b);for(let b of [...T].sort((S,P)=>P-S)){if(b<=Math.max(0,x)||b>g.length)continue;let S=g.slice(0,b).join("");if(m(S))return S}return g.slice(0,Math.max(0,x)).join("")}var HP=2e3;function nb(e){let{session:t}=e,n=null;function r(s){let l=gh(s),d=e.orderedRange(),u=tb(t,d.from,d.to,l,e.textFormFieldId?.()??null).split(`
|
|
19
|
-
`),p=e.deleteSelectionPlan(),m=p.replaceAt??p.collapseTo,g=u.join(""),x=[...p.ops],T=e.consumePendingFormatOps(m.paragraphId,m.offset,g.length);g.length>0&&(x.push({op:"insertText",paragraphId:m.paragraphId,offset:m.offset,text:g}),x.push(...T));let b=[],S=0;for(let R=0;R<u.length-1;R+=1)S+=u[R].length,b.push(m.offset+S);if(b.length>0&&x.push({op:"splitParagraphMany",paragraphId:m.paragraphId,offsets:b}),x.length===0)return;let P=new Set(t.paragraphIdsIn(e.storyScope())),O=u[u.length-1],N=b.length===0?e.caretMark({paragraphId:m.paragraphId,offset:m.offset+O.length}):void 0,M=x.filter(R=>!T.includes(R));e.commit(()=>e.withoutPendingOnRejection(x,M,e.selectionMark(),N),()=>{if(b.length===0)return He({paragraphId:m.paragraphId,offset:m.offset+O.length});let R=t.paragraphIdsIn(e.storyScope()).filter(q=>!P.has(q)),y=R[R.length-1];return y?He({paragraphId:y,offset:O.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection();if(s)return Kc({text:xf(e.layout(),s),cellRectangle:true,coverage:null,pkg:null});let{from:l,to:d}=e.orderedRange(),u=bs(e.layout(),l,d,e.paragraphOrder()),p=e.storyScope();if(l.paragraphId===d.paragraphId&&l.offset===d.offset||p.kind!=="body")return {text:u,html:null};let g=t.part(),x=d0(e.layout(),g,l,d,e.paragraphOrder());return Kc({text:u,cellRectangle:false,coverage:x,pkg:t.currentPackage()})}function a(s,l){if(e.editingMode()!=="edit"||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let d=e.deleteSelectionPlan(),u=d.replaceAt??d.collapseTo,p=false;return e.commit(()=>{let m=e.collaborationGate(d.ops,{kind:"body"});if(m)return {committed:false,rejected:true,opCount:0,reason:m};let g=e.actorId(),x=t.applyFragmentPaste({kind:"body"},{paragraphId:u.paragraphId,offset:u.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:d.ops,...g!==void 0?{actorId:g}:{}});return p=x.ok,{committed:x.ok,rejected:!x.ok,opCount:x.ok?1:0,...x.ok?{}:{reason:x.detail??x.reason}}},()=>He(u)),p}function i(s,l){let d=n!==null&&e.now()-n<HP;return n=null,eb({richLaneOpen:e.editingMode()==="edit"&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(p,m)=>a(p,m),insertPlainText:r},{html:l,text:s,forcePlain:d})!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:i,armForcePlainPaste:()=>{n=e.now();}}}function rb(e){let{session:t}=e;function n(){return Pr(e.selection())}function r(){return e.flushPendingInputAndLayout(),ys(e.layout(),e.selection(),e.paragraphOrder())}function o(){return r().from}function a(x){return nf(e.layout(),x)}function i(x,T){let b=t.partFor(e.storyScope())??t.part(),S=Ga(b,x.paragraphId);return !S||S.kind!=="paragraph"?null:T==="before"?Re$1(S,x.offset):Se(S,x.offset)}function s(x){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let T=r();return T.from.paragraphId===T.to.paragraphId&&T.from.offset===T.to.offset?e.atParagraphEnd(x.paragraphId,x.offset):e.atParagraphEnd(T.to.paragraphId,T.to.offset)}function l(x){let T=x?.trim()||void 0,b=d(),S=e.cellSelection(),P=null;return {...b,get replaceAt(){return P??=m(b,T,S),P}}}function d(){e.flushPendingInputAndLayout();let x=e.cellSelection();if(x){let P=[];for(let O of uf(e.layout(),x.cellIds)){let N=nf(e.layout(),O).length;N>0&&P.push({op:"deleteText",paragraphId:O,start:0,end:N});}return {ops:P,collapseTo:o()}}let T=e.selection();if(T.anchor.paragraphId===T.head.paragraphId&&T.anchor.offset===T.head.offset)return {ops:[],collapseTo:ff(e.layout(),T.head)};let{from:b,to:S}=r();return c0(e.layout(),t.partFor(e.storyScope())??t.part(),b,S,e.paragraphOrder())}function u(){return l().ops}function p(x,T,b){if(!(b!==void 0||e.editingMode()==="suggest")||x.paragraphId!==T.paragraphId||T.offset<=x.offset)return x.offset;let P=(b??e.author())?.trim();if(!P)return ff(e.layout(),T).offset;let O=lt(t,T.paragraphId)??t.part(),N=Ga(O,T.paragraphId);if(!N||N.kind!=="paragraph")return ff(e.layout(),T).offset;let M={start:x.offset,end:T.offset},{past:R,landing:y}=Wf(N,M,T.offset,P,e.trackedDate()),q=Tf(N,x.offset,R,P);return (R-x.offset>q?y:R)-q}function m(x,T,b){let S=x.collapseTo;if(T===void 0&&e.editingMode()!=="suggest")return S;if(b){for(let G of b.cellIds){let I=tf(e.layout(),[G]),Z=I.length>0?I:uf(e.layout(),[G]);if(Z.length===0)continue;let te=new Map,Q=X=>{let Y=te.get(X);return Y===void 0&&(Y=p({paragraphId:X,offset:0},{paragraphId:X,offset:a(X).length},T),te.set(X,Y)),Y},A=(T??e.author())?.trim(),$=X=>{let Y=a(X);if(!A)return /\S/.test(Y);let D=Ga(lt(t,X)??t.part(),X);if(!D||D.kind!=="paragraph")return /\S/.test(Y);let ee="",ne=0;for(let fe of Uf(D,0,Y.length,A))ee+=Y.slice(ne,Math.max(ne,fe.start)),ne=Math.max(ne,fe.end);return ee+=Y.slice(ne),/\S/.test(ee)},z=null;for(let X=Z.length-1;X>=0;X-=1){let Y=Z[X];if($(Y)){z=Y;break}}if(z===null)for(let X=Z.length-1;X>=0;X-=1){let Y=Z[X];if(Q(Y)!==0){z=Y;break}}return z??=Z[Z.length-1],{paragraphId:z,offset:Q(z)}}return S}let{from:P,to:O}=r();if(P.paragraphId===O.paragraphId&&P.offset===O.offset)return S;if(P.paragraphId===O.paragraphId)return {paragraphId:O.paragraphId,offset:p(P,O,T)};let N=new Set(x.ops.flatMap(G=>G.op==="deleteBlock"?[G.blockId]:[])),M=lt(t,O.paragraphId)??t.part();if(N.size>0)for(let G=Ha$1(M,O.paragraphId);G;G=Ha$1(M,G.id)){if(!N.has(G.id))continue;let I={paragraphId:S.paragraphId,offset:a(S.paragraphId).length};return {paragraphId:S.paragraphId,offset:p(S,I,T)}}let R=(T??e.author())?.trim();if(!R)return S;let y=new Set(x.ops.flatMap(G=>G.op==="joinParagraphs"?[G.secondId]:[])),q=e.paragraphOrder(),k=q.indexOf(P.paragraphId),C=q.indexOf(O.paragraphId);if(k===-1||C===-1)return S;let L=G=>{let I=Ga(M,G);return I?.kind==="paragraph"&&Nh$1(I,R)},H=C;for(;H>k&&y.has(q[H])&&L(q[H-1]);)H-=1;let U=0;for(let G=H;G<=C;G+=1){let I=q[G],Z={paragraphId:I,offset:I===P.paragraphId?P.offset:0},te=I===O.paragraphId?ff(e.layout(),O):{paragraphId:I,offset:a(I).length};G===H&&(U+=Z.offset),U+=te.offset-Z.offset-g(Z,te,R);}return {paragraphId:q[H],offset:U}}function g(x,T,b){let S=b?.trim();if(!S||x.paragraphId!==T.paragraphId)return 0;let P=lt(t,T.paragraphId)??t.partFor(e.storyScope())??t.part(),O=Ga(P,T.paragraphId);return !O||O.kind!=="paragraph"?0:Tf(O,x.offset,T.offset,S)}return {selectionMark:n,orderedRange:r,orderedStart:o,textOf:a,inlineControlBeside:i,splitEndsTheParagraph:s,deleteSelectionPlan:l,deleteSelectionOps:u,replacementOffset:p}}function ob(e){return {atParagraphEnd(t,n){let r=Qh$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$1(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 ab=ld$1;function ib(e){let{session:t,...n}=e;return Zd$1({view:t,...n})}function Kt(e){return e.closest(".docx-editor__scroll-container")}function sb(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 lb(e,t,n){let r=Kt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=sb(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 db(e,t,n,r){let o=Kt(e);if(!o||o.clientHeight===0)return;let a=sb(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 Vc(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 Ps(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 cb(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 fb(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"?$P(e,n,o):_P(n,r)}})}async function _P(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 d="data:image/png;base64,";if(!l.startsWith(d))return null;let u=atob(l.slice(d.length)),p=new Uint8Array(u.length);for(let m=0;m<u.length;m+=1)p[m]=u.charCodeAt(m);return Object.freeze({bytes:p,mime:"image/png"})}function ub(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 BP(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=ub(a,"t256"),s=ub(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 d=r.toRGBA8(a);return d.length!==l*4?null:Object.freeze({rgba:d,pixelWidth:i,pixelHeight:s})}async function $P(e,t,n){let r=await BP(t,n);if(r===null)return null;let o=await qP(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function qP(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(d=>l(d),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function pb(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function mb(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 ZP="docx-editor-one-surface__caret",zc="docx-editor-one-surface__caret--steady",KP=530;function gb(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=ZP,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 d(){let P=r.activeElement;return P===e||!!P&&e.contains(P)}function u(P){return P.anchor.paragraphId===P.head.paragraphId&&P.anchor.offset===P.head.offset}function p(){s=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(zc),o.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function m(){o.classList.add(zc),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(zc);},KP);}function g(){if(a||!d()||n().suppress){p();return}let{layout:P,selection:O,scopedHost:N,scopedHostKind:M,preferredPageIndex:R,measurer:y}=n(),q=t();if(!u(O)){p();return}let k=jf(P,O.head,{...y?{measurer:y}:{},...R!==void 0?{preferredPageIndex:R}:{}});if(!k||!Number.isInteger(k.pageIndex)){p();return}let C=N??e.querySelector(`[data-page-index="${k.pageIndex}"] > .docx-page-content`);if(!C){p();return}if(!(k.height>0)){p();return}o.style.left=`${k.x*q}px`,o.style.top=`${k.y*q}px`,o.style.height=`${k.height*q}px`;let L=zd$1(k);o.style.transformOrigin=L?"0 0":"",o.style.transform=L?"rotate(-90deg)":"",o.parentNode!==C&&C.append(o),e.style.caretColor="transparent",l&&l!==N&&l.style.removeProperty("caret-color"),l=N??null,l?.style.setProperty("caret-color","transparent");let H=C===N?M??"scoped":"body",U=`${k.pageIndex}:${H}:${k.x}:${k.y}:${k.height}`;U!==s&&(s=U,m());}let x=()=>{a=true,g();},T=()=>{a=false,g();},b=()=>g(),S=P=>{let O=P.relatedTarget;O&&e.contains(O)||p();};return e.addEventListener("compositionstart",x),e.addEventListener("compositionend",T),e.addEventListener("focusin",b),e.addEventListener("focusout",S),{update:g,destroy(){e.removeEventListener("compositionstart",x),e.removeEventListener("compositionend",T),e.removeEventListener("focusin",b),e.removeEventListener("focusout",S),p();}}}function jc(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function Or(e,t){let n=jc(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function Uc(e,t){return !e||e.kind==="tableBody"?null:jc(e.tableId)===jc(t)?e:null}function Ba(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 d of l.cells){let u=r(d.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 Wc(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)Wc(o.blocks,t);}}function VP(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});};Wc(n.fragments,r);for(let o of [n.header,n.footer])o&&Wc(o.fragments,r);}}function Gc(e,t,n,r){let o=null;return VP(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Xc(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function hb(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function yb(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function bb(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var zP=120,vb=20;function Rs(e){let t=sh$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function jP(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Yc(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Qc(e,t){return t.kind==="insertColumn"?Gc(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Gc(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function xb(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,d=0,u=0,p=null,m=null,g=null;function x(F){return F instanceof HTMLButtonElement&&(F.classList.contains("docx-table-insert-row")||F.classList.contains("docx-table-insert-column"))}function T(){let F=document.activeElement;return F!==null&&x(F)&&F.closest(".docx-table-furniture")===t?F:null}function b(F){for(let K of [...t.children])x(K)&&K!==F&&K.remove();}function S(){m=null,g=null;}function P(){n!==null&&(clearTimeout(n),n=null);}function O(){for(let K of [...t.children])x(K)||K.remove();let F=T();if(!F){b(null),S();return}m=F,b(F);}function N(F){let K=m??T(),j=K!==null&&document.activeElement===K;S(),t.replaceChildren(),F&&j&&e.pagesLayer.focus({preventScroll:true});}function M(){for(let F of [...t.children])x(F)||F.remove();}function R(F,K,j,le){let de=e.read().layout.pages[F];if(!de)return {left:0,top:0};let oe=le??de.contentBox,ge=e.scale(),Ee=e.pageOffsetX(F);return {left:(oe.x+K+Ee)*ge,top:(oe.y+j)*ge}}function y(F,K){let j=e.read(),le=Ba(j.layout,K.tableId,K.pageIndex);if(!le)return;let{table:Se,origin:de}=le,oe=document.createElement("div");oe.className="docx-table-resize-preview",oe.style.position="absolute",oe.style.pointerEvents="none";let ge=K.kind!=="rowDivider",Ee=R(K.pageIndex,ge?Se.box.x+F:Se.box.x,ge?Se.box.y:Se.box.y+F,de);oe.style.left=`${Ee.left}px`,oe.style.top=`${Ee.top}px`,oe.style.width=ge?"2px":`${Se.box.width*e.scale()}px`,oe.style.height=ge?`${Se.box.height*e.scale()}px`:"2px",t.append(oe);}function q(){let F=document.createElement("button");return F.type="button",F.textContent="+",F.style.position="absolute",F.style.pointerEvents="auto",F}function k(F){U(F);let K=g;if(!K)return;let j=e.read();K.kind==="insertRow"?I(K,j):K.kind==="insertColumn"&&Z(K,j);}function C(){queueMicrotask(()=>{!m||document.activeElement===m||l||r?.kind==="insertRow"||r?.kind==="insertColumn"||(m.remove(),S());});}function L(){if(m&&t.contains(m))return m;let F=T();if(F)return m=F,F;let K=q();return K.addEventListener("pointerenter",()=>{l=true,P();}),K.addEventListener("pointerleave",()=>{l=false;}),K.addEventListener("pointerdown",U),K.addEventListener("mousedown",U),K.addEventListener("click",k),K.addEventListener("blur",C),m=K,K}function H(F,K){let j=Ba(K.layout,F.tableId,F.pageIndex);if(!j)return;let{table:le,origin:Se}=j,de=L();if(b(de),g=F,de.dataset.tableId=F.tableId,F.kind==="insertRow"){let oe=le.rows.find(we=>we.id===F.rowId);if(!oe)return;de.dataset.rowId=F.rowId,delete de.dataset.gridColumnId,de.className="docx-table-insert-row",de.setAttribute("aria-label",e.label("table.insertRowBelow"));let ge=oe.box.y+oe.box.height/2,Ee=R(F.pageIndex,le.box.x-14,ge,Se);de.style.left=`${Ee.left}px`,de.style.top=`${Ee.top-8}px`;}else {let oe=le.rows[0]?.cells.find(qe=>qe.gridColumnId===F.gridColumnId);if(!oe)return;de.dataset.gridColumnId=F.gridColumnId,delete de.dataset.rowId;let ge=le.columnEdges[oe.gridColumn]??0,Ee=le.columnEdges[oe.gridColumn+1]??le.box.width;de.className="docx-table-insert-column",de.setAttribute("aria-label",e.label("table.insertColumnRight"));let we=R(F.pageIndex,le.box.x+(ge+Ee)/2-8,le.box.y-14,Se);de.style.left=`${we.left}px`,de.style.top=`${we.top}px`;}t.contains(de)||t.append(de);}function U(F){F.preventDefault(),F.stopPropagation();}function G(F,K){if(M(),b(m??T()),!(s||K.editingMode==="view")){if((F.kind==="columnDivider"||F.kind==="rightEdge")&&!F.isHeaderRepeat){let j=Ba(K.layout,F.tableId,F.pageIndex);if(!j)return;let{table:le,origin:Se}=j,de=document.createElement("div");de.className=F.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",de.style.position="absolute",de.style.pointerEvents="auto",de.style.cursor="col-resize",de.dataset.active="true";let oe=R(F.pageIndex,le.box.x+F.edgeX,le.box.y,Se);de.style.left=`${oe.left-3}px`,de.style.top=`${oe.top}px`,de.style.width="6px",de.style.height=`${le.box.height*e.scale()}px`,de.addEventListener("pointerdown",te),t.append(de);}if(F.kind==="rowDivider"&&!F.isHeaderRepeat){let j=Ba(K.layout,F.tableId,F.pageIndex);if(!j)return;let{table:le,origin:Se}=j,de=document.createElement("div");de.className="docx-table-row-divider-handle layout-table-row-resize-handle",de.style.position="absolute",de.style.pointerEvents="auto",de.style.cursor="row-resize",de.dataset.active="true";let oe=R(F.pageIndex,le.box.x,le.box.y+F.edgeY,Se);de.style.left=`${oe.left}px`,de.style.top=`${oe.top-3}px`,de.style.width=`${le.box.width*e.scale()}px`,de.style.height="6px",de.addEventListener("pointerdown",te),t.append(de);}F.kind==="insertRow"&&!F.isHeaderRepeat&&H(F,K),F.kind==="insertColumn"&&!F.isHeaderRepeat&&H(F,K);}}function I(F,K){let j=Qc(K.layout,F);if(!j)return;let le=Yc(K),Se=Ln({command:{type:"insertRow",where:"below",target:Xc(F.sourceRevision,j)},part:Or(e.session(),F.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...le});e.applyTableCommandPlan(Se);}function Z(F,K){let j=Qc(K.layout,F);if(!j)return;let le=j.row.cells.find(ge=>ge.gridColumnId===F.gridColumnId);if(!le)return;let Se=hb(F.sourceRevision,j,le);if(!Se)return;let de=Yc(K),oe=Ln({command:{type:"insertColumn",where:"right",target:Se},part:Or(e.session(),F.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...de});e.applyTableCommandPlan(oe);}function te(F){if(F.button!==0)return;let K=e.read();if(K.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;F.preventDefault(),F.stopPropagation();let j=r,le=Qc(K.layout,j);if(!le)return;let Se=th$1(Or(e.session(),j.tableId).root,j.tableId);if(!Se.ok||j.kind!=="rowDivider"&&Se.topology.hasMerge)return;let de=0,oe=0,ge=0,Ee=Se.topology.gridColumns.reduce((Pe,he)=>Pe+Rs(he),0),we;if(j.kind==="columnDivider"){let Pe=Se.topology.gridColumns.find(Ge=>Ge.id===j.leftGridColumnId),he=Se.topology.gridColumns.find(Ge=>Ge.id===j.rightGridColumnId);if(!Pe||!he)return;de=Rs(Pe),oe=Rs(he),we=yb(j.sourceRevision,le,j.leftGridColumnId,j.rightGridColumnId);}else if(j.kind==="rightEdge"){let Pe=Se.topology.gridColumns.find(he=>he.id===j.gridColumnId);if(!Pe)return;de=Rs(Pe),oe=0,we=bb(j.sourceRevision,le,j.gridColumnId);}else ge=Math.max(20,Math.round(le.row.box.height*vb)),we=Xc(j.sourceRevision,le);let qe=F.currentTarget;qe.setPointerCapture(F.pointerId),d=F.clientX,u=F.clientY,s={pointerId:F.pointerId,startClientX:F.clientX,startClientY:F.clientY,startEdgePt:j.kind==="rowDivider"?j.edgeY:j.edgeX,leftTwips:de,rightTwips:oe,tableWidthTwips:Ee,rowHeightTwips:ge,target:j,ref:le,resizeTarget:we,captureElement:qe,rightEdge:j.kind==="rightEdge",vertical:j.kind==="rowDivider",cancelled:false};for(let Pe of [...t.children])Pe!==qe&&Pe.remove();y(j.kind==="rowDivider"?j.edgeY:j.edgeX,j);}function Q(){if(s){try{s.captureElement.hasPointerCapture(s.pointerId)&&s.captureElement.releasePointerCapture(s.pointerId);}catch{}s.cancelled=true,s=null,O(),r=null;}}function A(){if(!s||s.cancelled){s=null,O();return}let F=s;s=null;try{F.captureElement.hasPointerCapture(F.pointerId)&&F.captureElement.releasePointerCapture(F.pointerId);}catch{}if(F.vertical?u===F.startClientY:d===F.startClientX){O();return}let K=e.read(),j=Yc(K),le=(F.vertical?u-F.startClientY:d-F.startClientX)/e.scale(),Se=Math.round(le*vb),de;if(F.target.kind==="rowDivider")de=zh({part:Or(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...j},F.resizeTarget,Math.max(20,F.rowHeightTwips+Se));else if(F.rightEdge&&F.target.kind==="rightEdge"){let oe=Math.max(300,F.leftTwips+Se),ge=Math.max(oe,F.tableWidthTwips+Se);de=Ln({command:{type:"commitTableRightEdgeResize",target:F.resizeTarget,columnWidthTwips:oe,tableWidthTwips:ge},part:Or(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...j});}else if(F.target.kind==="columnDivider"){let oe=F.leftTwips+Se,ge=F.rightTwips-Se;oe=Math.max(300,oe),ge=Math.max(300,ge);let Ee=F.leftTwips+F.rightTwips;oe+ge!==Ee&&(oe>Ee-300?(oe=Ee-300,ge=300):ge=Ee-oe),de=Ln({command:{type:"commitTableColumnDividerResize",target:F.resizeTarget,leftWidthTwips:oe,rightWidthTwips:ge},part:Or(e.session(),F.target.tableId),layout:K.layout,storeRevision:K.storeRevision,selection:K.selection,cellSelection:K.cellSelection,themeColors:K.themeColors,...j});}else {O();return}e.applyTableCommandPlan(de),O();}function $(F){if(!o||!p)return null;let K=e.pageOffsetX(p.pageIndex);return Td$1(o,p.x,p.y,F.layout,K,p.pageIndex)}function z(F){if(!r||s||F.editingMode==="view")return;P();let K=$(F),j=Uc(K,F.selection.head.paragraphId);if(!j){r=null,O();return}if(Rd$1(j)!==Rd$1(r)){r=null,O();return}r=j,G(j,F);}function X(){let F=m??T(),K=F!==null&&document.activeElement===F;S(),F&&t.contains(F)&&F.remove(),K&&e.pagesLayer.focus({preventScroll:true});}function Y(F){if(s||F.editingMode==="view")return;let K=m??T();if(!K||!t.contains(K)){g&&S();return}if(m=K,!g||g.kind!=="insertRow"&&g.kind!=="insertColumn")return;if(!o){X();return}let j=Rd$1(g),le=Sd$1(o,g);if(!le||Rd$1(le)!==j){X();return}g=le,H(le,F);}function D(F){let K=e.read();if(s&&F.pointerId===s.pointerId){d=F.clientX,u=F.clientY;let ge=(s.vertical?F.clientY-s.startClientY:F.clientX-s.startClientX)/e.scale();for(let Ee of [...t.children])Ee!==s.captureElement&&Ee.remove();y(s.startEdgePt+ge,s.target);return}if(K.editingMode==="view"){N(false);return}let j=jP(e,F.clientX,F.clientY),le=Fd$1(K.layout,j.y);le>=0&&(p={x:j.x,y:j.y,pageIndex:le});let Se=le>=0?e.pageOffsetX(le):0,de=o?Td$1(o,j.x,j.y,K.layout,Se,le>=0?le:void 0):null,oe=Uc(de,K.selection.head.paragraphId);if(!oe){if(l)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,O();},zP));return}n&&(clearTimeout(n),n=null),!(r&&Qd$1(oe)===Qd$1(r))&&(r=oe,G(oe,K));}function ee(F){if(!(!s||F.pointerId!==s.pointerId)){if(e.read().editingMode==="view"){Q();return}A();}}function ne(F){!s||F.pointerId!==s.pointerId||Q();}function fe(F){F.key!=="Escape"||!s||Q();}return e.pagesLayer.addEventListener("pointermove",D),document.addEventListener("pointermove",D),document.addEventListener("pointerup",ee),document.addEventListener("pointercancel",ne),e.pagesLayer.addEventListener("keydown",fe),{update(){let F=e.read(),K=a,j=i;o=Pd$1(F.layout),a=F.layout.revision,i=F.storeRevision,F.editingMode==="view"?(Q(),r=null,P(),N(true)):K!==null&&(K!==F.layout.revision||j!==F.storeRevision)&&(r!==null&&z(F),Y(F)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let F=e.read();if(F.editingMode==="view")return;let K=m??T();if(K&&t.contains(K)&&g&&(g.kind==="insertRow"||g.kind==="insertColumn")){H(g,F);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&H(r,F);},destroy(){P(),Q(),S(),O(),e.pagesLayer.removeEventListener("pointermove",D),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",ee),document.removeEventListener("pointercancel",ne),e.pagesLayer.removeEventListener("keydown",fe),t.remove();}}}function Cs(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 Es(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 Sb=new WeakMap,wb=new WeakMap;function UP(e,t){let n=wb.get(e);if(!n){let r=new Map;for(let o of e.pages)Cs(o,a=>{a.emptyParagraphStyle&&Es(r,a,a.emptyParagraphStyle);});n=r,wb.set(e,n);}return n.get(t)}var Ib=new WeakMap;function WP(e){let t=Ib.get(e);if(t)return t;let n=new Map;return Cs(e,r=>Es(n,r,r.props)),Ib.set(e,n),n}function go(e,t){let n=Sb.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of WP(r))n.has(o)||n.set(o,a);Sb.set(e,n);}return n.get(t)??[]}var kb=new WeakMap;function GP(e){let t=kb.get(e);if(t)return t;let n=new Map;return Cs(e,r=>Es(n,r,r.tabStops)),kb.set(e,n),n}function $a(e,t){let n=Tb.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of GP(o))r.has(a)||r.set(a,i);n=r,Tb.set(e,r);}return n.get(t)??null}var Tb=new WeakMap,Pb=new WeakMap,Rb=new WeakMap;function XP(e){let t=Rb.get(e);if(t)return t;let n=new Map;return Cs(e,(r,o)=>Es(n,r,{indent:r.indent,inTable:o})),Rb.set(e,n),n}function YP(e,t){let n=Pb.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of XP(o))r.has(a)||r.set(a,i);n=r,Pb.set(e,r);}return n.get(t)??null}function Eb(e,t,n,r,o=ba,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 Fb(e,t,n,r=ba,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 p=i.get(u.id);!p||p.end<=p.start||(p.start<n&&n<=p.end&&(s=u),l===null&&p.start<=n&&n<p.end&&(l=u));}let d=s??l;return d?ia(ha(d,"runProperties","rPr"),fa):ka$1(e,t)}function mo(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 Ob(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:mo(t,"b")===true};break;case "i":n={...n,italic:mo(t,"i")===true};break;case "u":n={...n,underline:mo(t,"u")===true};break;case "strike":n={...n,strikethrough:mo(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 Jc(e,t,n,r){return n&&n.length>0?vf(e,n):rf(e,t,r??Sa(e))}function Fs(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 Ab(e,t,n,r){return Jc(e,t,n,r)[0]?.style??null}function eu(e,t,n,r,o,a){let i=Jc(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 Mb(e,t,n,r,o,a,i){let s=Jc(e,t,r,a),l=s.length===0?Cb(e,t,r,a).map(I=>UP(e,I)).filter(I=>I!==void 0):[],d=l.length>0?l:s.map(I=>I.style),u=I=>{if(d.length===0)return null;let Z=I(d[0]);return d.every(te=>I(te)===Z)?Z:null},p=(I,Z=(te,Q)=>te===Q)=>I.length>0&&I.every(te=>Z(te,I[0]))?I[0]:null,m=(I,Z)=>I.props.some(te=>te.localName===Z),g=I=>I.style.fontFamily??n?.(I.range.paragraphId,I.props).fontFamily??null,x=I=>m(I,"sz")?Math.round(I.style.fontSizePt*2):n?.(I.range.paragraphId,I.props).fontSizeHalfPoints??Math.round(I.style.fontSizePt*2),T=l.length>0?{fontFamily:u(I=>I.fontFamily??i??null),fontSizeHalfPoints:u(I=>Math.round(I.fontSizePt*2))}:s.length===0?n?.(t.head.paragraphId,[]):void 0,b=Cb(e,t,r,a),S=I=>p(b.map(Z=>I(go(e,Z)))),P=(I,Z=(te,Q)=>te===Q)=>{if(b.length<2)return false;let te=I(go(e,b[0]));return b.some((Q,A)=>A>0&&!Z(I(go(e,Q)),te))},O=S(I=>xc$1(I)),N=S(I=>fc$1(I,"pStyle")?.val??o??void 0)??null,M=I=>fc$1(I,"spacing")??void 0,R=I=>{let Z=M(I),te=Number(Z?.line);if(!Number.isFinite(te))return "";let Q=Z?.lineRule??"auto";return Q==="auto"?`multiple:${Math.round(te/240*100)/100}`:`${Q==="exact"?"exact":"atLeast"}:${Math.round(te/20*100)/100}`},y=S(R),q=(()=>{if(!y)return null;let[I,Z]=y.split(":");return {rule:I,value:Number(Z)}})(),k=(I,Z)=>{let te=Number(M(I)?.[Z]);return Number.isFinite(te)?Math.round(te/20*100)/100:null},C=I=>S(Z=>k(Z,I)),L=(()=>{let I=b.map(Y=>YP(e,Y)),Z=I[0];if(!Z||I.some(Y=>Y===null||Y.inTable))return null;let te=Y=>Math.round(Y*20),Q=Y=>te(Y.hanging>0?-Y.hanging:Y.firstLine),A=I,$=te(Z.indent.left),z=te(Z.indent.right),X=Q(Z.indent);return {left:$,right:z,firstLine:X,mixed:{left:A.some(Y=>te(Y.indent.left)!==$),right:A.some(Y=>te(Y.indent.right)!==z),firstLine:A.some(Y=>Q(Y.indent)!==X)}}})(),H=I=>S(Z=>I(ce(Z))),U=S(_b$1),G=S(jc$1);return {bold:d.length>0&&d.every(I=>I.bold),italic:d.length>0&&d.every(I=>I.italic),underline:d.length>0&&d.every(I=>I.underline!==null),strikethrough:d.length>0&&d.every(I=>I.strike),superscript:d.length>0&&d.every(I=>I.verticalAlign==="superscript"),subscript:d.length>0&&d.every(I=>I.verticalAlign==="subscript"),fontFamily:s.length>0?p(s.map(g)):T?.fontFamily??null,fontSizeHalfPoints:s.length>0?p(s.map(x)):T?.fontSizeHalfPoints??null,color:u(I=>I.color),highlight:u(I=>I.highlight),alignment:O,styleId:N,lineSpacing:q,spaceBeforePt:C("before"),spaceAfterPt:C("after"),disagrees:{alignment:P(I=>xc$1(I)),spaceBeforePt:P(I=>k(I,"before")),spaceAfterPt:P(I=>k(I,"after")),lineSpacing:P(R),tabStops:(()=>{if(b.length<2)return false;let I=JSON.stringify($a(e,b[0])?.stops??null);return b.some((Z,te)=>te>0&&JSON.stringify($a(e,Z)?.stops??null)!==I)})()},indent:L,tabStops:p(b.map(I=>$a(e,I)?.stops??null),(I,Z)=>I===null||Z===null?I===Z:I.length===Z.length&&I.every((te,Q)=>Math.round(te.positionPt*20)===Math.round(Z[Q].positionPt*20)&&te.alignment===Z[Q].alignment&&(te.leader??"none")===(Z[Q].leader??"none")))?.map(I=>({positionTwips:Math.round(I.positionPt*20),alignment:I.alignment,...I.leader?{leader:I.leader}:{}}))??null,paragraphFlags:{contextualSpacing:G,keepNext:H(I=>I.keepNext),keepLines:H(I=>I.keepLines),widowControl:H(I=>I.widowControl),pageBreakBefore:U}}}function Cb(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(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 Lb(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 Nb(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(),d=(b,S,P)=>t.applyTreeOps(b,S,P,e.storyScope()),u={get value(){return e.layout()}},p={get value(){return e.selection()}},m=(b,S,P)=>{let O=l();if(b.paragraphId===S.paragraphId){let q=ra(O,b.paragraphId,b.offset,S.offset,P,i(),s());if(q.length===0)return;let k=qa$1(O,b.paragraphId,P);n(()=>d([...q.map(C=>({op:"setRunProperties",paragraphId:b.paragraphId,start:C.start,end:C.end,properties:C.properties,...C.targetRunIds?{targetRunIds:C.targetRunIds}:{}})),...e.paragraphMarkVisible(b.paragraphId)?Lb(a(b.paragraphId),b,S,k):[]],o()));return}let N=e.paragraphOrder(),M=N.indexOf(b.paragraphId),R=N.indexOf(S.paragraphId);if(M===-1||R===-1)return;let y=[];for(let q=M;q<=R;q+=1){let k=N[q],C=a(k),L=q===M?b.offset:0,H=q===R?S.offset:C.length,U=L<H?ra(O,k,L,H,P,i(),s()):[];for(let I of U)y.push({op:"setRunProperties",paragraphId:k,start:I.start,end:I.end,properties:I.properties,...I.targetRunIds?{targetRunIds:I.targetRunIds}:{}});(q<R||L===0&&H===C.length&&C.length>0)&&e.paragraphMarkVisible(k)&&y.push({op:"setParagraphMarkProperties",paragraphId:k,properties:qa$1(O,k,P)});}y.length!==0&&n(()=>d(y,o()));},g=(b,S)=>{let P=l(),O=[];for(let N of uf(u.value,b)){let M=a(N);for(let R of ra(P,N,0,M.length,S,i(),s()))O.push({op:"setRunProperties",paragraphId:N,start:R.start,end:R.end,properties:R.properties,...R.targetRunIds?{targetRunIds:R.targetRunIds}:{}});e.paragraphMarkVisible(N)&&O.push({op:"setParagraphMarkProperties",paragraphId:N,properties:qa$1(P,N,S)});}return O.length===0?false:(n(()=>d(O,o()),void 0,{keepCellSelection:true}),true)},x=b=>{ga(b.localName)&&e.setPendingFormats(la(e.pendingFormats()??[],b));},T=b=>{if(b.length===0)return;let S=e.selectedCells?.(),P=S&&S.length>0?[...uf(u.value,S)]:null,{from:O,to:N}=r(),M=P??e.paragraphOrder(),R=P?0:M.indexOf(O.paragraphId),y=P?M.length-1:M.indexOf(N.paragraphId);if(R===-1||y===-1)return;let q=l(),k=M.slice(R,y+1).filter(C=>e.paragraphMarkVisible(C)).map(C=>{let L=ja$1(q,C);for(let H of b){let U=H.mergeAttributes?{...L.find(I=>I.localName===H.localName)?.attributes??{},...H.attributes}:H.attributes??{},G=Object.fromEntries(Object.entries(U).filter(([,I])=>I!=null));L=la(L,{localName:H.localName,...Object.keys(G).length>0?{attributes:G}:{}});}return {op:"setParagraphProperties",paragraphId:C,properties:L}});k.length!==0&&n(()=>d(k,o()),void 0,{keepCellSelection:P!==null});};return {setRunProperty(b,S){let P={localName:b,...S?{attributes:S}:{}},O=e.selectedCells?.();if(O&&O.length>0){g(O,P);return}let{from:N,to:M}=r();if(N.paragraphId===M.paragraphId&&N.offset===M.offset){x(P);return}m(N,M,P);},setParagraphProperty(b,S,P){T([{localName:b,...S?{attributes:S}:{},...P??{}}]);},setParagraphProperties:T,formatting:()=>Ob(Mb(u.value,p.value,(b,S)=>{let P=t.effectiveRunDefaults(b,S);if(P.fontFamily!==null)return P;let O=e.defaultFontFamily?.()??null;return O===null?P:{...P,fontFamily:O}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder(),e.defaultFontFamily?.()??null),e.pendingFormats()),toggleRunProperty(b,S){let P=e.selectedCells?.(),O=S?.val,N=mo(e.pendingFormats(),b,O)??eu(u.value,p.value,b,P,O,e.paragraphOrder()),M=N?{localName:b,attributes:{val:QP[b]??"0"}}:{localName:b,...S?{attributes:S}:{}};if(P&&P.length>0){g(P,M);return}let{from:R,to:y}=r();if(R.paragraphId===y.paragraphId&&R.offset===y.offset){let q=e.pendingFormats()??[],k=eu(u.value,p.value,b,void 0,O,e.paragraphOrder());if(!N===k){let C=q.filter(L=>L.localName!==b);e.setPendingFormats(C.length>0?C:null);}else x(M);return}m(R,y,M);},clearFormatting(){e.setPendingFormats(null);let b=u.value,S=e.paragraphOrder(),P=e.selectedCells?.(),O=P&&P.length>0?[...uf(b,P)]:Fs(S,r());if(O.length===0)return;let{from:N,to:M}=r(),R=P!==void 0&&P.length>0,y=l(),q=[];for(let k of O){let C=a(k),L=R||k!==N.paragraphId?0:N.offset,H=R||k!==M.paragraphId?C.length:M.offset;for(let U of sa(y,k,L,H,i(),s()))Eb(y,k,U.start,U.end,i(),s())&&q.push({op:"setRunProperties",paragraphId:k,start:U.start,end:U.end,properties:[]});e.paragraphMarkVisible(k)&&ka$1(y,k).length>0&&q.push({op:"setParagraphMarkProperties",paragraphId:k,properties:[]}),e.paragraphMarkVisible(k)&&ja$1(y,k).length>0&&q.push({op:"setParagraphProperties",paragraphId:k,properties:[]});}q.length!==0&&n(()=>d(q,o()),void 0,{keepCellSelection:R});}}}var QP={u:"none",vertAlign:"baseline"};var JP=new Set,Db=500;function eR(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 Hb(e){let t=e.session,n=()=>t.partFor(e.storyScope())??t.part(),r="off",o=null,a=null,i=null,s=es,l=()=>{let b=o===null?"none":o.paragraphProperties?"paragraph":"run";return (s.mode!==r||s.level!==b)&&(s={mode:r,level:b}),s},d=(b,S,P)=>{if(P||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:P,to:O}=e.orderedRange();if(!e.paragraphOrder().includes(P.paragraphId))return false;let N=Ab(e.layout(),e.selection(),b,e.paragraphOrder()),M=d(P,O,S)?ja$1(n(),P.paragraphId):null;return !N&&M===null?false:(o={runProperties:N?eR(N):[],paragraphProperties:M},true)},p=()=>u()?(e.publish(),true):false,m=()=>{let b=o;if(!b)return {wrote:false,armed:false,built:false};let S=e.selectedCells?.(),P=S!==void 0&&S.length>0,{from:O,to:N}=e.orderedRange(),M=!P&&O.paragraphId===N.paragraphId&&O.offset===N.offset,R=M?hs(e.layout(),O,JP):null,y=R?.from??O,q=R?.to??N,k=M&&y.offset===q.offset,C=P?[...uf(e.layout(),S)]:Fs(e.paragraphOrder(),{from:y,to:q});if(C.length===0)return {wrote:false,armed:false,built:false};let L=n(),H=e.displayMode(),U=[];for(let te of C){let Q=e.textOf(te),A=P||te!==y.paragraphId?0:y.offset,$=P||te!==q.paragraphId?Q.length:q.offset;if(A<$&&b.runProperties.length>0)for(let Y of ra(L,te,A,$,b.runProperties,H,e.authorFilter()))U.push({op:"setRunProperties",paragraphId:te,start:Y.start,end:Y.end,properties:Y.properties,...Y.targetRunIds?{targetRunIds:Y.targetRunIds}:{}});let z=b.paragraphProperties!==null||P||te!==q.paragraphId||A===0&&$===Q.length&&Q.length>0,X=e.paragraphMarkVisible(te);z&&X&&b.runProperties.length>0&&U.push({op:"setParagraphMarkProperties",paragraphId:te,properties:qa$1(L,te,b.runProperties)}),b.paragraphProperties&&X&&U.push({op:"setParagraphProperties",paragraphId:te,properties:[...b.paragraphProperties]});}let G=t.packageRevision();U.length>0&&e.commit(()=>t.applyTreeOps(U,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:P});let I=t.packageRevision()!==G,Z=k&&b.runProperties.length>0&&(I||U.length===0);return Z&&e.armPendingFormats(b.runProperties),{wrote:I,armed:Z,built:U.length>0}},g=()=>{let b=m();return b.wrote&&r==="once"&&T(),b.wrote?"painted":b.armed?"armed":b.built?"refused":"nothingToPaint"},x=()=>{r!=="off"&&(r="off",e.publish());},T=()=>{a=null,i=null,x();};return {state:l,capture:p,apply:g,disarm:T,press(){let b=e.now(),S=a!==null&&b-a<Db,P=r;a=b;let O=()=>(a=null,false);return P==="once"&&S?u()?(r="locked",e.publish(),true):(x(),O()):P!=="off"?(x(),i=P==="locked"?b:null,true):i!==null&&b-i<Db?(i=null,true):u()?(r="once",i=null,e.publish(),true):O()},applyIfArmed(){r==="off"||o===null||m().wrote&&r==="once"&&T();}}}var tR=500,_b=4,ho=40,Os=12;function nR(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 Bb(e,t){return nR(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 Qt(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 Zb(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)Zb(a.blocks,t+1,n);}}}function tu(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,s)=>{(!n||Qt(e,i,n)<0)&&(n=i),(!r||Qt(e,s,r)>0)&&(r=s);},a=t.level!=="inline";for(let i of t.fragments){let s=e.pages[i.pageIndex];s&&Zb(s.fragments,0,l=>{if(Bb(i.box,l.box)){if(a){let d=nf(e,l.paragraphId).length;o({paragraphId:l.paragraphId,offset:0},{paragraphId:l.paragraphId,offset:d});return}for(let d of l.lines)for(let u of d.spans)Bb(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 rR(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function $b(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=rR(e,n);return r?.placeholder?r:null}function qb(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=Qt(e,t.anchor,t.head)<=0?t.anchor:t.head,o=Qt(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=tu(e,s);!l||!(Qt(e,r,o)===0?Qt(e,r,l.from)>=0&&Qt(e,r,l.to)<0:Qt(e,r,l.to)<0&&Qt(e,o,l.from)>0)||(Qt(e,l.from,r)<0&&(r=l.from,a=true),Qt(e,l.to,o)>0&&(o=l.to,a=true));}}return Qt(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function Kb(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,d=0,u=0,p=0,m=null;function g(D,ee){if(!s){let fe=n.getBoundingClientRect();s={left:fe.left,top:fe.top};}let ne=e.scale()||1;return {x:(D-s.left)/ne,y:(ee-s.top)/ne}}function x(D){return {scope:{kind:"headerFooter",rId:D.rId},pageIndex:D.pageIndex,kind:D.kind,partName:D.partName,variant:D.variant}}function T(D,ee){let ne=e.layout(),fe=g(D,ee),F=Fd$1(ne,fe.y),K=ne.pages[F];if(!K)return null;let j=e.measurer();return Hd$1(ne,F,{x:fe.x-K.contentBox.x-e.pageOffsetX(F),y:fe.y-K.contentBox.y},j?{measurer:j}:{})}function b(D,ee){let ne=e.activeNote?.()??null;if(ne){let le=e.layout(),Se=_d(le,g(D,ee),e.pageOffsetX);if(!Se||Se.scopeId!==ne.scopeId)return null;let de=e.measurer();return Id$1(le,Se.pageIndex,Se.fragments,Se.local,{...de?{measurer:de}:{}})}let fe=e.activeHeaderFooter?.()??null;if(!fe)return T(D,ee);let F=e.layout(),K=g(D,ee),j=$d(F,K,e.pageOffsetX);if(j&&Md(j.story,x(fe))){let le=e.measurer();return Nd(F,j.pageIndex,j.story,j.local,le?{measurer:le}:{})}return null}function S(D,ee){let{story:ne,pageIndex:fe,kind:F}=D;return {rId:ne.rId,pageIndex:fe,kind:F,partName:ne.partName,variant:ne.variant,...ee?{position:ee}:{}}}function P(D){let ee=e.measurer();return Nd(e.layout(),D.pageIndex,D.story,D.local,ee?{measurer:ee}:{})?.position??void 0}let O=new WeakMap;function N(D,ee){let ne=e.activeNote?.();if(ne){let j=ro(D,null,ne.scopeId).indexOf(ee);return j===-1?-1:j}let fe=e.activeHeaderFooter?.();if(fe){let j=ro(D,x(fe)).indexOf(ee);return j===-1?-1:j}let F=O.get(D);return F||(F=new Map(Ra$1(D).map((K,j)=>[K,j])),O.set(D,F)),F.get(ee)??-1}function M(D,ee,ne){let fe=N(D,ee.paragraphId),F=N(D,ne.paragraphId);return fe!==F?fe<F:ee.offset<ne.offset}function R(D,ee,ne){if(ne==="character")return {from:ee,to:ee};let fe=ee.paragraphId;if(ne==="paragraph"){let F=nf(D,fe);return {from:{paragraphId:fe,offset:0},to:{paragraphId:fe,offset:F.length}}}return hs(D,ee,of(D,fe))}function y(D,ee,ne,fe,F){let K=F?$b(D,F):null,j=K?tu(D,K)??R(D,ne,fe):R(D,ne,fe),le=M(D,j.from,ee.from)?{anchor:ee.to,head:j.from}:{anchor:ee.from,head:j.to};return qb(D,le)}let q=r.closest(".docx-editor__scroll-container");function k(){return r.closest(".docx-editor__scroll-container")}function C(D,ee,ne){if(ne<D+ho){let fe=Math.max(0,D+ho-ne);return -Math.min(Os,fe/ho*Os)}if(ne>ee-ho){let fe=Math.max(0,ne-(ee-ho));return Math.min(Os,fe/ho*Os)}return 0}function L(){m!==null&&(a?.cancelAnimationFrame(m),m=null);}function H(){m=null;let D=i,ee=k();if(!D||!ee||!a)return;let ne=ee.getBoundingClientRect(),fe=C(ne.top,ne.bottom,D.clientY);fe!==0&&(ee.scrollTop+=fe,s=null,G(D.clientX,D.clientY),m=a.requestAnimationFrame(H));}function U(){if(m!==null||!a||!i)return;let D=k();if(!D)return;let ee=D.getBoundingClientRect();C(ee.top,ee.bottom,i.clientY)!==0&&(m=a.requestAnimationFrame(H));}function G(D,ee){let ne=i;if(!ne)return;let fe=b(D,ee);fe&&(e.isReadOnlyParagraph?.(fe.position.paragraphId)||I(ne,fe)||e.setSelection(y(e.layout(),ne.anchorRange,fe.position,ne.granularity,fe)));}function I(D,ee){let ne=D.anchorCell;if(!ne)return false;if(!ee.cell||ee.cell.tableId!==ne.tableId)return D.cellDragging;if(!D.cellDragging&&ee.cell.cellId===ne.cellId)return false;let fe=sf(e.layout(),ne,ee.cell);return fe?(D.cellDragging=true,e.setCellSelection(fe),true):D.cellDragging}function Z(D){let ee=Date.now(),ne=ee-d;return l=Math.abs(D.clientX-u)<=_b&&Math.abs(D.clientY-p)<=_b&&ne>=0&&ne<=tR?l+1:1,d=ee,u=D.clientX,p=D.clientY,l}let te=["character","word","paragraph"],Q=D=>{if(D.button!==0)return;let ee=D.target?.closest?.("[data-docx-cc-widget]");if(ee){if(D.preventDefault(),D.stopPropagation(),ee.hasAttribute("disabled")||ee.dataset.disabledReason)return;let Ae=ee.dataset.docxCcId,Te=ee.dataset.docxCcWidget;Ae&&Te&&e.onContentControlWidget?.(Ae,Te);return}if(D.pointerType==="touch")return;i&&X(),s=null;let ne=e.layout(),fe=g(D.clientX,D.clientY),F=e.activeHeaderFooter?.()??null,K=e.activeNote?.()??null,j=$d(ne,fe,e.pageOffsetX),le=_d(ne,fe,e.pageOffsetX),Se=D.target?.closest("[data-docx-hf]"),de=!!(Se||j),oe=D.target,ge=oe?.closest("[data-docx-note-ref]"),Ee=oe?.closest("[data-docx-note-mark-back]"),we=null,qe=()=>we??=Z(D);if(ge?.dataset.docxNoteScope){D.preventDefault(),e.focus(),e.enterNote?.(ge.dataset.docxNoteScope);return}if(Ee){D.preventDefault(),e.focus(),e.exitNote?.(true);return}if(le&&!de){let Ae=e.measurer?.(),Te=Id$1(ne,le.pageIndex,le.fragments,le.local,{...Ae?{measurer:Ae}:{}});if(!K||K.scopeId!==le.scopeId){D.preventDefault(),e.focus(),e.enterNote?.(le.scopeId,Te?{paragraphId:Te.position.paragraphId,offset:Te.position.offset}:void 0,le.pageIndex);return}if(K.pageIndex!==le.pageIndex){D.preventDefault(),e.focus(),e.enterNote?.(le.scopeId,Te?{paragraphId:Te.position.paragraphId,offset:Te.position.offset}:void 0,le.pageIndex);return}}else if(K){if(!Ld(ne,fe,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(F)if(j&&Md(j.story,x(F)))j.pageIndex!==F.pageIndex&&e.enterHeaderFooter?.(S(j,P(j)));else if(j&&j.story.rId){D.preventDefault(),e.focus(),e.enterHeaderFooter?.(S(j,P(j)));return}else if(Ld(ne,fe,e.pageOffsetX)){D.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let Ae=qe()>=2?Bd(ne,fe,e.pageOffsetX):null;Ae&&(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ae.kind,Ae.pageIndex));return}else if(de&&qe()>=2){if(j?.story.rId)D.preventDefault(),e.focus(),e.enterHeaderFooter?.(S(j,P(j)));else if(Se instanceof HTMLElement){let Ae=Se.dataset.docxRId,Te=Se.dataset.docxHf,bt=Se.closest("[data-page-index]")?.getAttribute("data-page-index"),at=bt!=null?Number(bt):NaN;if((Te==="header"||Te==="footer")&&Number.isInteger(at))if(Ae){let en=ne.pages[at]?.[Te];D.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:Ae,pageIndex:at,kind:Te,partName:en?.partName??"",variant:en?.variant??"default"});}else ne.pages[at]?.[Te]||(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Te,at));}return}else if(qe()>=2){let Ae=Bd(ne,fe,e.pageOffsetX);if(Ae){D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Ae.kind,Ae.pageIndex);return}}let Pe=b(D.clientX,D.clientY);if(!Pe)return;if(e.isReadOnlyParagraph?.(Pe.position.paragraphId)){D.preventDefault();return}if(qe()===2&&e.onTextFormDoubleClick?.(D))return;D.preventDefault(),e.focus();try{n.setPointerCapture(D.pointerId);}catch{}o.addEventListener("pointermove",$),o.addEventListener("pointerup",z),o.addEventListener("pointercancel",z);let he=qe(),Ge=D.shiftKey?"character":te[(he-1)%te.length],kt=$b(ne,Pe);if(kt&&!D.shiftKey){if(e.selectContentControl?.(kt.id)){let Te=e.selection(),bt=M(ne,Te.anchor,Te.head)||Te.anchor.paragraphId===Te.head.paragraphId&&Te.anchor.offset===Te.head.offset?{from:Te.anchor,to:Te.head}:{from:Te.head,to:Te.anchor};i={pointerId:D.pointerId,granularity:"character",anchorRange:bt,anchorCell:Pe.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY};return}let Ae=tu(ne,kt);if(Ae){i={pointerId:D.pointerId,granularity:"character",anchorRange:Ae,anchorCell:Pe.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},A(()=>e.setSelection({anchor:Ae.from,head:Ae.to}));return}}if(D.shiftKey){let Ae=e.selection();i={pointerId:D.pointerId,granularity:Ge,anchorRange:{from:Ae.anchor,to:Ae.anchor},anchorCell:Pe.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},A(()=>e.setSelection(y(ne,{from:Ae.anchor,to:Ae.anchor},Pe.position,Ge,Pe)));}else {let Ae=R(ne,Pe.position,Ge);i={pointerId:D.pointerId,granularity:Ge,anchorRange:Ae,anchorCell:Pe.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},A(()=>e.setSelection(qb(ne,{anchor:Ae.from,head:Ae.to})));}};function A(D){try{D();}catch(ee){throw X(),ee}}let $=D=>{let ee=i;!ee||D.pointerId!==ee.pointerId||(D.preventDefault(),ee.clientX=D.clientX,ee.clientY=D.clientY,G(D.clientX,D.clientY),U());},z=D=>{let ee=i;if(!ee||D.pointerId!==ee.pointerId)return;X();try{n.releasePointerCapture(ee.pointerId);}catch{}let ne=e.cellSelection();ne?e.setCellSelection(ne):e.setSelection(e.selection()),D.type==="pointerup"&&(e.onTextFormPointerUp?.(D),e.onSelectionSettled?.());};function X(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,s=null,L(),o.removeEventListener("pointermove",$),o.removeEventListener("pointerup",z),o.removeEventListener("pointercancel",z);}let Y=()=>{s=null;};return n.addEventListener("pointerdown",Q),q?.addEventListener("scroll",Y,{passive:true}),a?.addEventListener("scroll",Y,{capture:true,passive:true}),a?.addEventListener("resize",Y,{passive:true}),{dragging:()=>i!==null,destroy(){X(),n.removeEventListener("pointerdown",Q),q?.removeEventListener("scroll",Y),a?.removeEventListener("scroll",Y,{capture:true}),a?.removeEventListener("resize",Y);}}}function Vb(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i;function s(y){let q=Rr(y?.anchorNode,n)??Rr(y?.focusNode,n);q!==void 0&&(i=q);}function l(y){return i??Rr(y?.anchorNode,n)??Rr(y?.focusNode,n)}let d=false,u=false,p=false,m=null,g=false;function x(){let y=t.getSelection(),q=uo(n,y);return !q||(s(y),Zt(q,e.selection()))?false:(e.adoptSelection(q),true)}function T(){let y=t.activeElement;if(y&&n.contains(y))return true;if(y&&y!==t.body&&y!==t.documentElement)return false;let q=t.getSelection();if(!q||q.rangeCount===0)return true;let k=q.anchorNode;return !k||!k.isConnected?true:n.contains(k)}let b=()=>{let y=t.getSelection(),q=uo(n,y);if(!q){if(!Ac(n,y))return;d=false;let k=He(e.selection().head);if(Zt(k,e.selection()))return;e.setSelection(k);return}d=false,s(y),!Zt(q,e.selection())&&e.setSelection(q);};function S(y){let q=e.textOf(y),k=O0(n,y,q,t.getSelection()?.anchorNode??null);if(k===null)return;let C=A0(y,q,k);if(!C)return;let L=C.ops.find(te=>te.op==="deleteText"),H=C.ops.find(te=>te.op==="insertText"),U=H&&L?e.replacementOffset?.(y,L.start,L.end):void 0,G=H&&U!==void 0&&U!==H.offset?C.ops.map(te=>te===H?{...H,offset:U}:te):C.ops,I=H?e.pendingFormatOps?.(y,U??H.offset,H.text.length,L?{start:L.start,end:L.end}:void 0)??[]:[],Z=e.storyScope();e.commit(()=>{let te=e.applyOps([...G,...I],e.selectionMark(),Z);return I.length===0||!te.rejected?te:e.applyOps(G,e.selectionMark(),Z)}),e.setSelection(He({paragraphId:y,offset:H&&U!==void 0?U+H.text.length:C.caret}));}function P(){o||p||e.isGesturing?.()||e.holdsCellSelection?.()||O()||d&&b();}function O(){if(!u||d)return false;if(!a)return true;let y=uo(n,t.getSelection());return y!==null&&Zt(y,a)}function N(y){y instanceof PointerEvent&&y.button!==0||(d=true);}let M=false;function R(y=false){if(e.updateCaret(),!y&&!T())return;o=true;let q=e.now(),k=e.domSelection?.()??e.selection();d=false;let C=t.getSelection(),L=l(C),H=b0(n,k,C,L!==void 0?{preferredPageIndex:L}:void 0);H&&s(C),a=H?k:null,H||(u=true),e.recordSelectionMs(e.now()-q),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",N,true),n.addEventListener("selectstart",N,true),{adoptBeforePaint(){let y=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,q=u||y||!d?false:x();return e.hasPendingInput?.()!==true&&(u=false),q},noteModelMoved(){u=true;},noteSelectionSettled(){u=false;},mirrorToDom:R,adoptBeforeInput:P,isComposing:()=>p,noteBrowserSelectionFixup(){M=true;},onSelectionChange:()=>{if(!o&&!p&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(M&&Ac(n,t.getSelection())){let y=uo(n,t.getSelection());if((y===null||!Zt(y,e.selection()))&&(M=false,!d)){R();return}}O()||b();}},onCompositionStart:()=>{P(),p=true;let y=e.selection();g=y.anchor.paragraphId!==y.head.paragraphId,m=y.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:y=>{p=false;let q=m??e.selection().head.paragraphId;m=null;let k=g;g=false;let C=e.storyScope(),L=r.revisionFor(C);if(k){let H=y?.data??"";H.length>0&&e.replaceSelectionWith?.(H);}else S(q);r.endComposition(),r.revisionFor(C)===L&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>i,destroy(){n.removeEventListener("pointerdown",N,true),n.removeEventListener("selectstart",N,true),d=false;}}}var oR=32;function jb(e,t,n,r){if(!(e.kind==="textValue"||r>oR)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)jb(o,t,n,r+1);}}function sR(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&&jb(s,o,r,0);}}return r}var zb=new WeakMap;function lR(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 dR(e,t){t.story&&t.story.kind!=="body"||lR(t)||(e.map=null);}function cR(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>dR(t,n)));}function uR(e,t){let n=zb.get(e);return n||(n={map:null,subscribed:false},zb.set(e,n)),cR(e,n),n.map||(n.map=sR(t)),n.map}function Ub(e,t,n){return n.startsWith(`${t.name}#`)?uR(e,t).get(n)??null:null}var Wb=32;function qa(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),d=m=>{let g=l.indexOf(m);if(g!==-1)return g;let x=l.findIndex(T=>T>m);return x===-1?Math.max(0,l.length-1):x},u=nu(e,t);if(u!==null)return d(u);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let m=e.headerFooterResolutionBySection().findIndex(g=>[g.headers,g.footers].some(x=>[...x.values()].some(T=>T.rId===n.rId)));return m===-1?0:d(m)}let p=pR(e,t);if(p!==null){let m=nu(e,p);if(m!==null)return d(m)}return 0}function Gb(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),d=nu(e,t),u=qa(e,t,n,r,o,a),p=l[u]??u;if(d!==null&&d===p)return {kind:"anchor",paragraphId:t};let m=s[p];if(!m)return {kind:"unaddressable"};let g=Fb$1(i);for(let x=m.blockStart;x<m.blockEndExclusive;x+=1){let T=fR(g[x]);if(T!==null)return {kind:"anchor",paragraphId:T}}return {kind:"unaddressable"}}function fR(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>Wb)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 nu(e,t){return Ub(e,e.part(),t)}function pR(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=Jf(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of rd(o.root)){let i=gd$1(a);if(i===null||!mR(a,t))continue;return Kf(e.part()).find(l=>l.noteKind===r&&l.noteId===i)?.paragraphId??null}}return null}function mR(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>Wb)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 yo(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 As(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 Xb(e){return {val:e?"1":"0"}}var gR="list paragraph",hR="ListParagraph";function Yb(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function Qb(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()===gR)return i.styleId;a===null&&i.styleId===hR&&(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(),d=[];for(let u of a){let p=ja$1(l,u),m=Yb(p);m!==void 0&&m!==s||d.push({op:"setParagraphProperties",paragraphId:u,properties:la(p,{localName:"pStyle",attributes:{val:i}})});}return d},clearOp(a){let i=n();if(i===null)return null;let s=ja$1(e.storyPart(),a);return Yb(s)!==i?null:{op:"setParagraphProperties",paragraphId:a,properties:s.filter(l=>l.localName!=="pStyle")}}}}var ru="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",Ls="a section break cannot be inserted inside a table cell",Jb="a section break cannot change a section that a locked or linked content control holds",au="a section break cannot be inserted in locked or linked content";function yR(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(d=>d.localName==="val"&&d.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",d=s||r(a);for(let u of a.children??[])o(u,l,d);};return o(e.root,false,false),{inCell:t,held:n}}var bR=32;function vR(e){let t=new Set(wh$1(e).map(n=>zh$1(n)));return vh$1(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function iu(e,t){let n=t.replaceAt??t.collapseTo;return xh$1(e,n.paragraphId)?t.collapseTo:n}var ou=(e,t)=>Ge(e,t)||Ee$1(e,t).content;function Ms(e,t,n,r){if(xh$1(e,t))return Ls;if(ou(e,t))return au;let{section:o,ownerId:a}=yh$1(e,t);return zh$1(o)===n?null:a!==null&&ou(e,a)?Jb:r?ru:null}function ev(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return Ls;if(e.caretParagraphId!==null)return Ms(e.part(),e.caretParagraphId,t,n);let r=yR(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=yh$1(i,o.paragraphId),l=yh$1(i,a.paragraphId),d=s.section===l.section,u=d?zh$1(s.section):vR(i),p=e.paragraphOrder(),m=p.indexOf(o.paragraphId),g=p.indexOf(a.paragraphId),x=m===-1||g===-1?null:p.slice(m,g+1),T=x!==null&&!x.some(S=>r.inCell.has(S))&&!x.some(S=>r.held.has(S));if(u!==null&&u!==t){if(T&&d&&s.ownerId!==null&&ou(i,s.ownerId))return Jb;if(n&&T)return ru}if(T&&u!==null)return null;if(x===null||x.length-1>bR)return n&&u!==null&&u!==t?ru:null;let b=iu(i,e.deleteSelectionPlan());return Ms(i,b.paragraphId,t,n)}var xR=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function SR(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 Ns(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 tv(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 nv(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(),d=(k,C,L)=>t.applyTreeOps(k,C,L,e.storyScope()),u=Qb({session:t,storyPart:l}),p=()=>e.paragraphOrder(),m={get value(){return e.layout()}};function g(){let k=e.selectedCells?.();return k&&k.length>0?k:null}function x(k){let C=false;return n(()=>{let L=k();return C=L.committed,L},void 0,{keepCellSelection:g()!==null}),C}function T(){if(g()!==null)return [...uf(m.value,g())];let{from:k,to:C}=o(),L=p(),H=L.indexOf(k.paragraphId),U=L.indexOf(C.paragraphId);return H===-1||U===-1?null:L.slice(H,U+1)}let b=720,S=8;function P(k){return O(k)?.level??null}function O(k){return Qa(m.value,k)?.marker??null}function N(k){let C=O(k);return C?C.numFmt==="bullet"?"bullet":"ordered":null}function M(k,C){let L=p(),H=L.indexOf(k[0]??""),U=L.indexOf(k[k.length-1]??"");if(H===-1||U===-1)return null;for(let G of [H-1,U+1]){let I=L[G];if(!I)continue;let Z=O(I);if(Z&&(Z.numFmt==="bullet"?"bullet":"ordered")===C)return Z.numId}return null}function R(k,C){return C<0||C>S?false:e.numberingLevelExists(k.numId,C)}function y(k,C){return C<0||C>S?false:e.numberingLevelExists(k.numId,C)?true:t.ensureNumberingLevel(k.numId,C,k.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(k.numId,C)}function q(k){let C;for(let L of k){if(L.localName!=="ind")continue;let H=L.attributes?.left??L.attributes?.start;H!==void 0&&(C=H);}return !C||!/^-?\d{1,7}$/.test(C)?0:Number(C)}return {insertTab(){let k=s(),C=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertTab",paragraphId:C.paragraphId,offset:C.offset}],a()),()=>i({...C,offset:C.offset+1}));},insertLineBreak(){let k=s(),C=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertHardBreak",paragraphId:C.paragraphId,offset:C.offset}],a()),()=>i({...C,offset:C.offset+1}));},insertPageBreak(){let k=s(),C=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertPageBreak",paragraphId:C.paragraphId,offset:C.offset}],a()),()=>i({...C,offset:C.offset+1}));},exitListOnEmptyItem(){let{from:k,to:C}=o();if(k.paragraphId!==C.paragraphId||k.offset!==C.offset)return false;let L=O(k.paragraphId);if(!L||e.paragraphTextOf(k.paragraphId).length>0)return false;let U=L.level>0&&R(L,L.level-1),G=[];if(U)G.push({op:"setListLevel",paragraphId:k.paragraphId,level:L.level-1});else {let Z=u.clearOp(k.paragraphId);Z&&G.push(Z),G.push({op:"setListNumbering",paragraphId:k.paragraphId,numId:null});}let I=false;return n(()=>{let Z=d(G,a());return I=Z.committed,Z}),I},isListParagraph(){let{paragraphId:k}=r();return P(k)!==null},isListActive(k){let C=T();if(C===null)return false;let L=k==="bullet"?"bullet":"ordered";return C.length>0&&C.every(H=>N(H)===L)},toggleList(k){let C=T();if(C===null||C.length===0)return false;let L=C.every(G=>N(G)===k),H=L?null:M(C,k)??t.ensureListDefinition(k);if(!L&&H===null)return false;let U=L?[]:u.applyOps(C);for(let G of C){let I=P(G);U.push({op:"setListNumbering",paragraphId:G,numId:H,...I!==null?{level:I}:{}});}return x(()=>d(U,a()))},canAdjustIndent(k){let C=T();if(C===null)return false;let L=k==="increase"?1:-1;return C.some(H=>{let U=O(H);if(U){let I=U.level+L;return I>=0&&I<=S}let G=q(go(m.value,H));return Math.max(0,G+L*b)!==G})},adjustIndent(k){let C=T();if(C===null)return false;let L=k==="increase"?1:-1,H=[];for(let U of C){let G=go(m.value,U),I=O(U),Z=I?.level??null;if(I&&Z!==null){let z=Z+L;if(z<0||z>S||!y(I,z))continue;H.push({op:"setListLevel",paragraphId:U,level:z});continue}let te=q(G),Q=Math.max(0,te+L*b);if(Q===te)continue;let A=ja$1(l(),U),$=A.find(z=>z.localName==="ind");H.push({op:"setParagraphProperties",paragraphId:U,properties:la(A,{localName:"ind",attributes:SR($?.attributes,String(Q))})});}return H.length===0?false:x(()=>d(H,a()))},setIndent(k){if(k.left===void 0&&k.right===void 0&&k.firstLine===void 0)return false;let C=T();if(C===null)return false;let L=[];for(let H of C){let U=ja$1(l(),H),I={...U.find(Z=>Z.localName==="ind")?.attributes??{}};k.left!==void 0&&(I=Ns(I,"left","start",k.left)),k.right!==void 0&&(I=Ns(I,"right","end",k.right)),k.firstLine!==void 0&&(I=tv(I,k.firstLine)),L.push({op:"setParagraphProperties",paragraphId:H,properties:la(U,{localName:"ind",...Object.keys(I).length>0?{attributes:I}:{}})});}return L.length===0?false:x(()=>d(L,a()))},setParagraphFormat(k){let C=T();if(C===null||C.length===0)return false;let L=[];k.alignment!==void 0&&L.push({localName:"jc",attributes:{val:k.alignment}});let H={...yo("before",k.spaceBeforePt),...yo("after",k.spaceAfterPt),...As(k.lineSpacing)};Object.keys(H).length>0&&L.push({localName:"spacing",attributes:H,mergeAttributes:true});for(let[Z,te]of xR){let Q=k[Z];Q!==void 0&&L.push({localName:te,attributes:Xb(Q)});}let U=k.tabStops!==void 0,G=k.indentLeftTwips!==void 0||k.indentRightTwips!==void 0||k.indentFirstLineTwips!==void 0;if(L.length===0&&!G&&!U)return false;let I=[];for(let Z of C){let te=ja$1(l(),Z),Q=te;if(G){let $={...te.find(z=>z.localName==="ind")?.attributes??{}};k.indentLeftTwips!==void 0&&($=Ns($,"left","start",k.indentLeftTwips)),k.indentRightTwips!==void 0&&($=Ns($,"right","end",k.indentRightTwips)),k.indentFirstLineTwips!==void 0&&($=tv($,k.indentFirstLineTwips)),Q=la(Q,{localName:"ind",...Object.keys($).length>0?{attributes:$}:{}});}for(let A of L){let $=A.mergeAttributes?{...Q.find(X=>X.localName===A.localName)?.attributes??{},...A.attributes}:A.attributes??{},z=Object.fromEntries(Object.entries($).filter(([,X])=>X!=null));Q=la(Q,{localName:A.localName,...Object.keys(z).length>0?{attributes:z}:{}});}if((L.length>0||G)&&I.push({op:"setParagraphProperties",paragraphId:Z,properties:Q}),U){let A=$a(e.layout(),Z);I.push({op:"setParagraphTabStops",paragraphId:Z,stops:k.tabStops.map($=>({positionTwips:Math.round($.positionTwips),alignment:$.alignment,...$.leader&&$.leader!=="none"?{leader:$.leader}:{}})),...A?{inForcePositionsTwips:A.stops.map($=>Math.round($.positionPt*20))}:{}});}}return I.length===0?false:x(()=>d(I,a()))},sectionProperties:()=>Xc$1(t.part()),sectionPropertiesAt(k){let C=Yc$1(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),L=qa(t,k,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (C[L]??C[C.length-1]).properties},sectionAnchorParagraphAt(k){return Gb(t,k,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(k){let C=false;return n(()=>{let L=e.storyScope().kind==="body",H=t.applyTreeOps([{op:"setSectionProperties",...k}],L?a():void 0,void 0,{kind:"body"});return C=H.committed,H}),C},sectionBreakRefusal(k="nextPage"){return e.storyScope().kind!=="body"?null:ev({part:()=>t.part(),breakType:k,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:p,deleteSelectionPlan:s})},insertSectionBreak(k="nextPage"){if(e.storyScope().kind!=="body")return false;let C=s(),L=iu(t.part(),C),H=(xh$1(t.part(),L.paragraphId)?Ls:null)??Ms(t.part(),L.paragraphId,k,e.editingMode?.()==="suggest");if(H!==null)return e.publishRefusal?.(H),false;let U=new Set(t.paragraphIds()),G=false,I=false;return n(()=>{let Z=t.applyTreeOps([...C.ops,{op:"splitParagraph",paragraphId:L.paragraphId,offset:L.offset},{op:"setSectionMark",paragraphId:L.paragraphId,breakType:k}],a(),void 0,{kind:"body"});return G=Z.committed,I=Z.reason==="locked"||Z.reason==="bound",Z},()=>{let Z=t.paragraphIds().find(te=>!U.has(te));return Z?i({paragraphId:Z,offset:0}):null}),!G&&I&&e.publishRefusal?.(au),G}}}var sv="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function lv(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===sv}function wR(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===sv}function su(e){return e.kind==="textValue"?[]:e.children}function dv(e,t=0){if(e.kind==="textValue")return e.value;if(t>=la$1||e.kind==="deletedText"||IR(e.kind)||be$1(e)||e.kind==="runProperties"||e.kind==="generic"&&!na$1(e)&&!lv(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+=dv(o,n);return r}function IR(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function lu(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)){lu(su(r),ma(r,t),n);continue}if(lv(r)){for(let o of su(r))wR(o)&&lu(su(o),ma(r,t),n);continue}n(r,t);}}function rv(e,t,n){let r=kR(e,t);if(!r||r.kind!=="paragraph")return [];let o=Ne$1(r),a=[],i=0;return lu(r.children,0,(s,l)=>{let d=o.spanOf(s);if(d&&(i=Math.max(i,d.end)),s.kind!=="hyperlink")return;let u=d?d.start:i,p=d?d.end:i,m=$a$1(s,n);a.push({id:s.id,paragraphId:t,start:u,end:p,text:dv(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 kR(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 TR(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 PR(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 cv(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,u,p)=>e.session.applyTreeOps(d,u,p,t()),a=d=>{let u=n();return u?rv(u,d,r):[]},i=()=>TR(a(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,u=PR(e.layout(),d);return u===null?null:e.fieldLinkById(u)},l=d=>{let u=e.selection().head.paragraphId,p=a(u).find(m=>m.id===d);if(p)return p;for(let m of e.session.storyParts()){let g=x=>pf$1(e.session.currentPackage(),m.name,x);for(let x of wd$1(m))for(let T of zd$2(x.root)){let b=T.id,S=rv(m,b,g).find(P=>P.id===d);if(S)return S}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:s,linkById:l,applyHyperlink(d){let u=d.url!==void 0&&d.url.length>0,p=d.anchor!==void 0&&d.anchor.length>0;if(u===p)return false;let m=t();if(!n()||e.refusesWrite())return false;let g;if(u){let k=()=>e.session.ensureHyperlinkRelationship(d.url,m),C=e.withMintActor?e.withMintActor(k):k();if(!C)return false;g=C;}let x={...g!==void 0?{relationshipId:g}:{},...p?{anchor:d.anchor}:{},...d.tooltip!==void 0?{tooltip:d.tooltip}:{}},T=i(),b=e.orderedRange(),S=b.from.paragraphId===b.to.paragraphId&&b.from.offset===b.to.offset;if(T&&(S||RR(T,b))){let k=[];if(d.text!==void 0&&d.text!==T.text){if(d.text.length===0)return false;let L=e.replacementLanding?.(T.paragraphId,T.start,T.end),H=e.textOf(T.paragraphId).slice(T.start,T.start+2),U=T.start+(H.length===2&&H.charCodeAt(0)>=55296&&H.charCodeAt(0)<=56319&&H.charCodeAt(1)>=56320&&H.charCodeAt(1)<=57343?2:1);if(L!=null&&L>T.start&&U<T.end)k.push({op:"setHyperlinkTarget",linkId:T.id,...x},{op:"deleteText",paragraphId:T.paragraphId,start:T.start,end:T.end},{op:"insertText",paragraphId:T.paragraphId,offset:U,text:d.text});else if(L!=null){let G=ov(e.session);k.push({op:"setHyperlinkTarget",linkId:T.id,...x},...av(T,L,d.text),{op:"insertHyperlink",paragraphId:T.paragraphId,start:L,end:L+d.text.length,...x,...G?{styleId:G}:{}});}else {let G=iv(T.paragraphId,T.start,T.end,d.text);if(!G)return false;k.push({op:"setHyperlinkTarget",linkId:T.id,...x},...G);}}else k.push({op:"setHyperlinkTarget",linkId:T.id,...x});let C=false;return e.commit(()=>{let L=o(k,e.selectionMark());return C=L.committed,L},()=>null),C}let P=b.from.paragraphId;if(b.to.paragraphId!==P)return false;let O=[],N=b.from.offset,M=b.to.offset;if(S){let k=d.text??d.url??d.anchor??"";if(k.length===0)return false;N=e.insertionLanding?.(P,N)??N,O.push({op:"insertText",paragraphId:P,offset:N,text:k}),M=N+k.length;}else {let k=e.replacementLanding?.(P,N,M);if(k!=null){let C=d.text??e.textOf(P).slice(N,M);if(C.length===0)return false;O.push(...av({paragraphId:P,start:N,end:M},k,C)),N=k,M=k+C.length;}else if(d.text!==void 0&&d.text!==e.textOf(P).slice(N,M)){let C=iv(P,N,M,d.text);if(!C)return false;O.push(...C),M=N+d.text.length;}}if(M<=N)return false;let R=ov(e.session);O.push({op:"insertHyperlink",paragraphId:P,start:N,end:M,...x,...R?{styleId:R}:{}});let y=false,q={paragraphId:P,offset:M};return e.commit(()=>{let k=o(O,e.selectionMark(),{paragraphId:P,start:M,end:M});return y=k.committed,k},()=>({anchor:q,head:q})),y},removeHyperlink(d){if(!n())return false;let u=d?l(d):i();if(!u)return false;let p=false,m={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let g=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return p=g.committed,g},()=>({anchor:m,head:m})),p}}}function ov(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function RR(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function av(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 iv(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 CR="equation replacement and removal are not supported in suggesting mode",uv=new WeakMap;function fv(e,t){let n=Ga(e,t);if(!n||n.kind!=="paragraph")return [];let r=uv.get(n);if(r)return r;let o=[];for(let i of Le$2(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:Jt(l.expression)}));}let a=Object.freeze(o);return uv.set(n,a),a}function Jt(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(Jt);case "fraction":return Jt(e.numerator)&&Jt(e.denominator);case "radical":return Jt(e.radicand)&&(e.degree===void 0||Jt(e.degree));case "script":return Jt(e.base)&&(e.subscript===void 0||Jt(e.subscript))&&(e.superscript===void 0||Jt(e.superscript));case "nary":return Jt(e.body)&&(e.lowerLimit===void 0||Jt(e.lowerLimit))&&(e.upperLimit===void 0||Jt(e.upperLimit))}}function pv(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function mv(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 d=s.getBoundingClientRect();t={equationId:l,rect:{left:d.left,top:d.top,right:d.right,bottom:d.bottom}};},a=i=>{let s=n(i.target),l=s?.dataset.docxEquation,d=t;if(t=null,!s||!l){if(!d)return;i.preventDefault(),r(d.equationId,d.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 gv(e){let t=()=>e.session.partFor(e.storyScope()),n=l=>{let d=t();return d?fv(d,l):[]},r=()=>{let l=e.selection().head;return pv(n(l.paragraphId),l)},o=l=>{let d=n(e.selection().head.paragraphId).find(u=>u.id===l);if(d)return d;for(let u of e.session.storyParts()){let p=Ga(u,l);if(!p||p.kind!=="generic"||p.namespaceUri!==pc$1||p.localName!=="oMath")continue;let m=p;for(;m&&m.kind!=="paragraph";)m=Ha$1(u,m.id);return !m||m.kind!=="paragraph"?null:fv(u,m.id).find(g=>g.id===l)??null}return null},a=(l,d)=>{let u=false,p={paragraphId:l.paragraphId,offset:l.start};return e.commit(()=>{let m=e.session.applyTreeOps([d],e.selectionMark(),{paragraphId:p.paragraphId,start:p.offset,end:p.offset},e.storyScope());return u=m.committed,m},()=>({anchor:p,head:p})),u},i=(l,d)=>{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:CR};let p=d==="replace"?{op:"setMathEquation",equationId:l,linear:u.linear}:{op:"removeMathEquation",equationId:l},m=e.writeRefusal(p);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,d){let u=o(l);if(!u)return false;let p=i(l,"replace");return p.ok?u.supported&&u.linear===d?true:a(u,{op:"setMathEquation",equationId:l,linear:d}):s(p)},removeEquation(l){let d=o(l);if(!d)return false;let u=i(l,"remove");return u.ok?a(d,{op:"removeMathEquation",equationId:l}):s(u)}}}var ER=24;function hv(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 g=L(m);return !g.ok||!g.href||!n?false:(n.open(g.href,"_blank","noopener,noreferrer"),true)},a=m=>{if(e.enterStoryFor&&!e.enterStoryFor(m.paragraphId))return false;let g=e.layout(),x=jf(g,m);if(!x)return false;let T=g.pages[x.pageIndex];if(!T)return false;let b=T.box.y+(T.contentBox.y-T.box.y)+x.y,S=r();return S&&(S.scrollTop=Math.max(0,b*e.scale()-ER),e.onScrolled?.()),e.setSelection(m),true},i=m=>{let g=e.bookmarks().get(m);return g?a(g):false},s=null;function l(m){if(!m||m.closest("[data-docx-hf]"))return null;let g=m.closest("a.docx-hyperlink");if(g){let T=g.dataset.docxLink;return T?{linkId:T,drawing:false}:null}let x=m.closest("[data-docx-drawing-link]");if(x){let T=x.dataset.docxDrawingLink;return T?{linkId:T,drawing:true}:null}return null}let d=m=>{s=null;let g=m.target,x=l(g);if(!x)return;let b=g.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();s={linkId:x.linkId,drawing:x.drawing,rect:{left:b.left,top:b.top,bottom:b.bottom,right:b.right}};},u=m=>{let g=m.target,x=l(g);if(!x){let S=s;if(s=null,!S)return;m.preventDefault(),p(S.linkId,S.rect,m,S.drawing);return}s=null,m.preventDefault();let b=g.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();p(x.linkId,{left:b.left,top:b.top,bottom:b.bottom,right:b.right},m,x.drawing);};function p(m,g,x,T){let b=T?e.drawingLinkById?.(m)??null:e.linkById(m);if(!b)return;if(x.metaKey||x.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:g});}}return t.addEventListener("pointerdown",d,true),t.addEventListener("click",u),{goToPosition:a,goToBookmark:i,openExternal:o,destroy(){t.removeEventListener("pointerdown",d,true),t.removeEventListener("click",u);}}}function FR(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 du(e,t){return e.drawingNodeId!==t?null:FR(e)}function yv(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=du(n,t);if(r)return r}return null}function OR(e,t){for(let r of e.anchoredDrawings??[]){let o=du(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=vv(s,t);if(l)return l}continue}let o=bv(r,t);if(o)return o}let n=yv(e.header,t);return n||yv(e.footer,t)}function bv(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=du(r,t);if(o)return o}return null}function vv(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=vv(o,t);if(a)return a}return null}return bv(e,t)}function xv(e,t){for(let n of e.pages){let r=OR(n,t);if(r)return r}return null}function Sv(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 Za="the document is open for viewing",cu="image changes are not supported in suggesting mode",wv="tracked changes need a non-empty author";function Iv(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Za}}function n(){return {committed:false,rejected:true,opCount:0,reason:cu}}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:Za};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:cu};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:Za};let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return {ok:false,reason:"invalidArgs",detail:wv};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:Za});let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:wv});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:Za});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:cu});let s=e.actorId();return e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),{...i,...s?{actorId:s}:{}})}}}function kv(e){let t=null,n=null,r="",o=()=>{let d=e.session.part(),u=e.revisionDisplayMode(),p=e.revisionAuthorFilter();return {sections:Yc$1(d,u,p),sourceIndexes:Zc$2(d,u,p)}},a=d=>{let{sourceIndexes:u}=o(),p=u.indexOf(d);if(p!==-1)return p;let m=u.findIndex(g=>g>d);return m===-1?Math.max(0,u.length-1):m},i=()=>{if(!t)return;let d=Ih(e.layout(),t,e.materializedPages?.());d!==t.pageIndex&&(t={...t,pageIndex:d,sectionIndex:e.sectionAtPage(d).sectionIndex});},s=d=>{if(e.entryRefused?.()===true&&t?.scope.rId!==d.rId||!d.rId||e.session.partFor({kind:"headerFooter",rId:d.rId})===null)return false;t?.scope.rId!==d.rId&&e.leaveOtherStories?.();let u=e.layout(),p=xh(u,d.rId),m=t,g=m?.scope.rId===d.rId,x=p?null:AR(e.session,d.rId);if(!p&&!x)return false;let T=d.pageIndex??(g&&m?m.pageIndex:p?.pageIndex??0),b=d.kind??(g&&m?m.kind:p?.kind??x.kind),S=d.variant??(g&&m?m.variant:p?.story.variant??x.variant),P=g&&m?m.partName:p?.story.partName??x.partName,O=u.pages[T]??u.pages[p?.pageIndex??0],N=(O?no(O,{scope:{kind:"headerFooter",rId:d.rId},kind:b,partName:P}):null)??p?.story??{scope:{rId:d.rId},variant:S,partName:P},M=e.selection(),R=m?m.savedBodySelection:{anchor:{...M.anchor},head:{...M.head}},y=g&&m?.sectionIndex!==void 0&&T===m.pageIndex,q=d.sectionIndex??(y?m.sectionIndex:p?e.sectionAtPage(T).sectionIndex:x?a(x.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:d.rId},pageIndex:T,...q!==void 0?{sectionIndex:q}:{},kind:b,variant:N.variant,partName:N.partName,savedBodySelection:R};let C=e.session.paragraphIdsIn(Xi(t))[0];if(!C)return t=null,false;let L=d.position?Yi(u,{anchor:d.position,head:d.position},t):g?Yi(u,M,t):{anchor:{paragraphId:C,offset:0},head:{paragraphId:C,offset:0}};return e.setScopeSelection(L),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;let d=t.savedBodySelection;t=null,e.setScopeSelection(Yi(e.layout(),d,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>vh(t),setActiveScope(d){return d.kind==="body"?(l(),true):d.kind==="headerFooter"?s({rId:d.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:i,headerFooterState(){if(!t)return null;let d=e.session.headerFooterResolutionBySection(),u=t.sectionIndex??0,p=o(),m,g,x,T=O=>{let N=p.sourceIndexes[O]??O,M=d[N];if(!M)return false;let y=(t.kind==="header"?M.headers:M.footers).get(t.variant);return !y||y.rId!==t.scope.rId?false:(u=O,m=y.inherited,g=M.titlePage,x=M.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&T(t.sectionIndex))){let O;d.forEach((N,M)=>{let y=(t.kind==="header"?N.headers:N.footers).get(t.variant);!y||y.rId!==t.scope.rId||!(O===void 0||O&&!y.inherited||O===y.inherited&&a(M)<u)||(u=a(M),m=y.inherited,g=N.titlePage,x=N.evenAndOddHeaders,O=y.inherited);});}let b=p.sections[u]?.properties??p.sections.at(-1)?.properties,S=b?.margins.headerTwips,P=b?.margins.footerTwips;return {editing:t.kind,sectionIndex:u,variant:t.variant,rId:t.scope.rId,partName:t.partName,...m!==void 0?{inherited:m}:{},...g!==void 0?{titlePage:g}:{},...x!==void 0?{evenAndOddHeaders:x}:{},...S!==void 0?{headerDistanceTwips:S}:{},...P!==void 0?{footerDistanceTwips:P}:{}}},headerFooterStateStable(d){if(!t)return n=null,r="",null;let u=this.headerFooterState();if(!u)return null;let p=[d,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===p||(n=Object.freeze({...u}),r=p),n}}}function AR(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 Pv(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 d=Zc$1(i);if(!d)return e.setLastRejection("invalid note scope id"),false;let u=e.session.currentPackage(),p=Jf(u,d.noteKind),m=p?td(p.root,d.noteId):null;if(!p||!m)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let g=e.selection();r={anchor:{paragraphId:g.anchor.paragraphId,offset:g.anchor.offset},head:{paragraphId:g.head.paragraphId,offset:g.head.offset}};}if(t={kind:"note",id:Yc$2(d.noteKind,d.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let g=MR(m),x=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:d.noteKind})),T=g.find(b=>x.has(b.id));if(T){let b=LR(T);e.setSelection({anchor:{paragraphId:T.id,offset:b},head:{paragraphId:T.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=Tv(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset},()=>{let x={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:x,head:x}}))return s.ops.length>0&&e.undo(),false;let g=[...Tv(e.session.currentPackage(),i)].find(x=>!u.has(x));return g===void 0?true:a(Yc$2(i,g))},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 MR(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 LR(e){let t=Le$2(e)[0];return t&&cd$1(t.node)?t.end:0}function Tv(e,t){let n=Jf(e,t),r=new Set;if(!n)return r;for(let o of rd(n.root)){if(!id$1(o))continue;let a=gd$1(o);a!==null&&r.add(a);}return r}var NR=500;function DR(e,t,n,r){let o=e.part(),a=Fb$1(o,n,r),i=Vc$1(o);return t.map((s,l)=>{let d=s.blockStart<s.blockEndExclusive?a[s.blockEndExclusive-1]:void 0,u=d?.kind==="paragraph"?Wc$1(d):void 0;return u||(l===t.length-1&&i?.kind!=="textValue"?i:void 0)})}function Rv(e,t){if(!e)return null;let n=e.session,r=e.revisionDisplayMode(),o=e.state().selection.head.paragraphId,a=qa(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:ht(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),i=n.currentPackage(),s=yf(i),l=zf(s),d=Af(s),u=Yc$1(n.part(),r,t),p=DR(n,u,r,t),m=wf$1(p[a]),g=xf$1(p[a]),x=Bf(m,l),T=Cf(g,d);return {sectionIndex:a,footnote:{resolved:x,...l?{documentAuthored:l}:{},...m?{sectionAuthored:m}:{}},endnote:{resolved:T,...d?{documentAuthored:d}:{},...g?{sectionAuthored:g}:{}}}}function Cv(e,t){let n=Zc$1(t);if(!n)return null;let r=Jf(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=td(o.root,n.noteId);if(!a)return null;let i=[],s=NR,l=(u,p)=>{if(!(p>32||s<=0)){if(u.kind==="paragraph"&&typeof u.id=="string"){let m=(Qh$1(o,u.id)??"").replace(/\uFFFC/g,"").trim();if(m){let g=m.slice(0,s);i.push(g),s-=g.length;}return}if(u.kind!=="textValue")for(let m of u.children)l(m,p+1);}};l(a,0);let d=i.filter(Boolean).join(" ").trim();return d.length>0?d:null}function Ev(e){return [()=>{Hb$1(e().root);},()=>{Ha$2(e());},()=>{mh$1(e());}]}var HR=50,_R=16;function Fv(e){let t=e.schedule??((s,l)=>{let d=setTimeout(s,l);return ()=>clearTimeout(d)}),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>HR)return;i(_R);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 BR=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve"]);function Ov(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function uu(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,d={resolve:n$1.tableInteractionLabel??(c=>vc(c))},u="the document is open for viewing",p="the document is read-only",m="the table of contents is generated and read-only",g="\0range\0",x=()=>`${new Date().toISOString().slice(0,19)}Z`,T=n$1.measurer?null:Ke(l$2,{context:co(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),b=n$1.measurer??T.measurer,S=Ib$1(),P=Ee();function O(){return n$1.measurer?n$1.producer??"host-measurer":`${n$1.producer??T?.producer??"fixed-measurer"}@scale:${l$2}`}let N=O(),M=e$1.ownerDocument,R=M.createElement("div");R.className="docx-pages",R.style.position="relative",R.contentEditable="true",R.spellcheck=false,R.setAttribute("role","textbox"),R.setAttribute("aria-multiline","true"),R.style.outline="none";let y=M.createElement("div");y.className="docx-selection-overlay",y.contentEditable="false",y.setAttribute("aria-hidden","true"),y.style.position="absolute",y.style.left="0",y.style.top="0",y.style.pointerEvents="none";let q=M.createElement("div");q.className="docx-comment-overlay",q.contentEditable="false",q.setAttribute("aria-hidden","true"),q.style.position="absolute",q.style.left="0",q.style.top="0",q.style.pointerEvents="none";let k=M.createElement("div");k.className="docx-remote-selection-overlay",k.contentEditable="false",k.setAttribute("aria-hidden","true"),k.style.position="absolute",k.style.left="0",k.style.top="0",k.style.pointerEvents="none";let C=M.createElement("div");C.className="docx-table-furniture",C.contentEditable="false",C.style.position="absolute",C.style.left="0",C.style.top="0",C.style.pointerEvents="none",e$1.style.position="relative",e$1.replaceChildren(R,C,q,k,y);let L=gb(R,()=>l$2,()=>{let c=oe?.getActive()??null,f=ge?.activeNoteScope()??null,h=ge?.activeNotePageIndex()??null,w=c?Sh(R,c.pageIndex):f?wh(R,f.id,h):null;return {layout:ae$1,selection:I,measurer:b,...c?{preferredPageIndex:c.pageIndex}:h!==null?{preferredPageIndex:h}:We.selectionPageIndex()!==void 0?{preferredPageIndex:We.selectionPageIndex()}:{},scopedHost:w,...c?{scopedHostKind:"headerFooter"}:f?{scopedHostKind:"note"}:{}}}),H=new Set(ye$1(a.part()).flatMap(c=>[c.beginParagraphId,...c.resultParagraphIds,c.endParagraphId])),U=a.paragraphIds(),G=U.find(c=>!H.has(c))??U[0]??"",I=r.initialSelection??{anchor:{paragraphId:G,offset:0},head:{paragraphId:G,offset:0}},Z=r.initialDrawingSelectionIntent??{kind:"none"};function te(c,f){c.kind===Z.kind&&(c.kind!=="pointer"||Z.kind==="pointer"&&c.drawingNodeId===Z.drawingNodeId)||(Z=c,f&&n$1.onChange?.(Ke$1()));}let Q=null,A=null,$="suggesting needs an author before it can propose a change",z=false,X=false,Y=null,D=new Map;function ee$1(){Y=null;for(let c of D.values())Y=c;}function ne(c,f){if(c.paragraphId===f.paragraphId)return c.offset-f.offset;let h=he$1();return h.indexOf(c.paragraphId)-h.indexOf(f.paragraphId)}function fe(c){if(!Y)return;let{from:f,to:h}=ys(ae$1,Y),w=c.head;ne(w,f)>=0&&ne(w,h)<=0||(D.clear(),Y=null);}let F=null;function K(){return j$1()?.properties??null}function j$1(){if(!F)return null;let c=F.position,f=h=>h.paragraphId===c.paragraphId&&h.offset===c.offset;return f(I.anchor)&&f(I.head)?F:null}function le(c){if(!F)return;let f=F.position;c.anchor.paragraphId===f.paragraphId&&c.anchor.offset===f.offset&&c.head.paragraphId===f.paragraphId&&c.head.offset===f.offset||(F=null);}function Se(c,f,h,w){let E=Ye([...c],h,w);return c.length===f.length||!E.rejected?E:Ye([...f],h,w)}function de(c,f,h,w){let E=j$1();if(!E||h===0)return [];let _=F.position,B=w&&_.paragraphId===c&&_.offset>=w.start&&_.offset<=w.end?{paragraphId:c,offset:ll({paragraphId:c,offset:w.start},{paragraphId:c,offset:w.end})}:ff(ae$1,_);return B.paragraphId!==c||B.offset!==f?[]:[{op:"setRunProperties",paragraphId:c,start:f,end:f+h,properties:E.properties.reduce((W,J)=>la(W,pa(W,J)),[...E.base])}]}let oe=null,ge=null,Ee$1=null,we=()=>Xi(oe?.getActive()??null,ge?.activeNoteScope()??null),qe=()=>ge?.activeNoteScope()?.id??null,Pe=c=>{let f=P.multi?.spans,h=0,w=0;if(f&&f.length>0)for(let E=0;E<f.length;E+=1){let _=f[E];if(h=E,w=_.startIndex,c<_.startIndex+_.pageCount)break}return {sectionIndex:h,sectionStart:w}},he$1=()=>ro(ae$1,oe?.getActive()??null,qe()),Ge=()=>globalThis.performance?.now()??Date.now(),kt=0,Ae=0,Te=0,{styleCascade:bt,numberingIndex:at,defaultTabStopPt:Yn,compatibilityMode:en}=ab(a),xo=ob({styleCascade:bt,partOf:c=>lt(a,c)??a.part()}),bn=null,So=n$1.imageDecodePort??fb(M)??pb(),Ot=md$1({session:a,decodePort:So,onResourcesChanged:()=>bn?.()}),Lr=n$1.drawingStrings??h,vn=n$1.tocLabels,Ua=()=>I.anchor.paragraphId!==I.head.paragraphId||I.anchor.offset!==I.head.offset?null:{paragraphId:I.head.paragraphId,offset:I.head.offset},cn=-1,wo=true,Wa=()=>{let c=a.packageRevision();return cn!==c&&(cn=c,wo=!vg$1(a.settingsRoot()).doNotShadeFormData),wo},Io=mb({mintValidatedBytes:(c,f)=>Ot.mintValidatedBytes(c,f)}),ko=n$1.revisionDisplayMode??qb$1,Tt=()=>ko,un=r.revisionAuthorVisibility??gs(n$1.hiddenRevisionAuthors),Pt=()=>un.filterForSession(a),Nr=c=>{let f=lt(a,c)??a.part(),h=Ga(f,c);if(h?.kind!=="paragraph")return false;let w=Tt(),E=Pt();if(!Cb$1(h,w,E))return true;let _=Ha$1(f,c);return _?Eb$2(_.children,w,E).some(B=>B.kind==="paragraph"&&B.id===c):false},xn,To=ae(a),Dr=be(),Qn=c=>ib({session:a,measurer:b,producer:N,cache:S,styleCascade:bt,numberingIndex:at,defaultTabStopPt:Yn,compatibilityMode:en,displayMode:Tt(),revisionAuthorFilter:c,inlineDrawingLayoutForPart:f=>Ot.contextForPart(f),drawingLayoutTokenForPart:f=>Ot.cacheTokenForPart(f),drawingTokenForParagraphForPart:(f,h)=>Ot.drawingTokenForParagraph(h,f),linkProjectors:To,projectFieldLink:f=>Dr.project(f)});xn=Qn(Pt());let Dn={...a,applyTreeOps:(c,f,h,w)=>Ye(c,f,h,w),ensureListDefinition:c=>Mb$1(i?.identity.actorId,()=>a.ensureListDefinition(c)),applyPmDoc:c=>Ve==="view"?{committed:false,rejected:true,opCount:0,reason:u}:i?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:rl()?{committed:false,rejected:true,opCount:0,reason:m}:a.applyPmDoc(c)},ae$1=re(),Hn=n$1.revisionStyles,Ga$1=Cy(n$1.showParagraphMarks??false,Ze$1,()=>xt(false)),Po=r.reviewAuthorSlots??e(),fn=Qy({layout:()=>ae$1,items:()=>a.reviewItems(),styles:()=>Hn,slots:Po});function Sn(c){if(c===null||c.length===0){if(!F)return;F=null;}else {let{anchor:f,head:h}=I;if(f.paragraphId!==h.paragraphId||f.offset!==h.offset)return;let w=j$1()?.base??Fb(a.partFor(we())??a.part(),h.paragraphId,h.offset,Tt(),Pt());F={position:h,properties:c,base:w};}n$1.onChange?.(Ke$1());}let Ro=Nb({session:Dn,storyScope:we,paragraphOrder:he$1,layout:()=>ae$1,selection:()=>I,displayMode:()=>Tt(),authorFilter:Pt,paragraphMarkVisible:Nr,commit:(c,f,h)=>Ne(c,f,h),orderedRange:()=>$n(),selectionMark:()=>ze(),textOf:c=>Et(c),selectedCells:()=>Q?.cellIds,defaultParagraphStyleId:()=>bt()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n$1.defaultFontFamily??null,pendingFormats:()=>K(),setPendingFormats:Sn}),Jn=Hb({session:Dn,storyScope:we,layout:()=>ae$1,selection:()=>I,displayMode:()=>Tt(),authorFilter:Pt,paragraphMarkVisible:Nr,commit:(c,f,h)=>Ne(c,f,h),orderedRange:()=>$n(),selectionMark:()=>ze(),textOf:c=>Et(c),paragraphOrder:he$1,selectedCells:()=>Q?.cellIds,armPendingFormats:c=>Sn(c),now:Ge,publish:()=>{Jn.state().mode!=="off"?R.dataset.formatPainter="":delete R.dataset.formatPainter,n$1.onChange?.(Ke$1());}}),er=nv({session:Dn,storyScope:we,headerFooterSectionIndex:()=>oe?.getActive()?.sectionIndex,revisionDisplayMode:Tt,revisionAuthorFilter:Pt,paragraphOrder:he$1,selectedCells:()=>Q?.cellIds,editingMode:()=>Ve,publishRefusal:c=>{A=c,n$1.onChange?.(Ke$1());},caretParagraphId:()=>I.anchor.paragraphId===I.head.paragraphId&&I.anchor.offset===I.head.offset?I.head.paragraphId:null,layout:()=>ae$1,commit:(c,f,h)=>Ne(c,f,{rearmPending:j$1()??void 0,...h?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>sl(),orderedRange:()=>$n(),selectionMark:()=>ze(),collapsedAt:c=>He(c),deleteSelectionPlan:()=>Tn(),paragraphTextOf:c=>Et(c),numberingLevelExists:(c,f)=>jd$1(Ic$1(at(),bt()),c,f)!==null});function tr(c,f,h){return Ve!=="suggest"?null:ll({paragraphId:c,offset:f},{paragraphId:c,offset:h})}let Xa=cv({session:Dn,layout:()=>ae$1,fieldLinkById:c=>Dr.linkById(c),refusesWrite:()=>ir(true)!==null,withMintActor:c=>Mb$1(i?.identity.actorId,c),storyScope:we,replacementLanding:tr,insertionLanding:(c,f)=>ff(ae$1,{paragraphId:c,offset:f}).offset,selection:()=>I,orderedRange:()=>$n(),selectionMark:()=>ze(),textOf:c=>Et(c),commit:(c,f)=>Ne(c,f)}),Hr=gv({session:Dn,storyScope:we,editingMode:()=>Ve,writeRefusal:c=>ir(true,[c]),selection:()=>I,selectionMark:()=>ze(),commit:(c,f)=>Ne(c,f)}),Co=c=>{let f=ht(a,c,{kind:"body"});if(f.kind==="body")return ge?.exitNote(),oe?.exitHeaderFooter(),true;if(f.kind==="headerFooter"){let w=oe?.activeScope();return w?.kind==="headerFooter"&&w.rId===f.rId?true:(ge?.exitNote(),oe?.enterHeaderFooter({rId:f.rId})??false)}let h=Ya(c);return h?ge?.activeNoteScope()?.id===h?true:(oe?.exitHeaderFooter(),ge?.enterNote(h)??false):false},Ya=c=>{for(let f of ae$1.pages)for(let h of [f.footnotes,f.endnotes])if(h){for(let w of h.notes)for(let E of za$1(w.fragments))if(E.paragraphId===c)return w.scopeId}return null},nr=hv({pagesLayer:R,container:e$1,scale:()=>l$2,layout:()=>ae$1,bookmarks:()=>a.bookmarks(),linkById:c=>Dr.linkById(c)??Xa.linkById(c),drawingLinkById:c=>xv(ae$1,c),setSelection:c=>pt(He(c)),enterStoryFor:c=>Co(c),isCollapsedSelection:()=>I.anchor.paragraphId===I.head.paragraphId&&I.anchor.offset===I.head.offset,onScrolled:()=>ti(),...n$1.onHyperlinkPopover?{onPopover:n$1.onHyperlinkPopover}:{}}),Eo=mv({pagesLayer:R,equationById:c=>Hr.equationById(c),setSelection:pt,...n$1.onEquationPopover?{onPopover:n$1.onEquationPopover}:{}});R.addEventListener("contextmenu",qu),R.addEventListener("click",Zu),R.addEventListener("pointermove",Lu),R.addEventListener("pointerleave",Du);let vt=null;function v(c,f,h){let w=h?h.authorFilter:Pt(),E=h?.layoutSession??P,_=h?.furnitureSource??xn;return f&&Gc$1(E,f),Ot.sync(a),l({view:a,revision:c,measurer:b,cache:S,session:E,producer:N,styleCascade:bt,defaultTabStopPt:Yn,numberingIndex:at,furniture:_,compatibilityMode:en,linkProjectors:To,projectFieldLink:B=>Dr.project(B),inlineDrawingLayout:Ot.bodyContext,inlineDrawingLayoutForPart:B=>Ot.contextForPart(B),drawingTokenForParagraph:B=>Ot.drawingTokenForParagraph(B,a.part().name),drawingTokenForParagraphForPart:(B,W)=>Ot.drawingTokenForParagraph(W,B),drawingLayoutEpoch:Ot.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:B=>Ot.cacheTokenForPart(B),displayMode:Tt(),revisionAuthorFilter:w})}function V(){return v(a.packageRevision(),void 0,{layoutSession:Ee(),furnitureSource:Qn(void 0)})}function re(){let c=Ge(),f=v(a.packageRevision());return kt=Ge()-c,f}let be$1=null,ce=null,Ie=false;function ke(){if(Ie)return;Ie=true;let c=a.packageRevision();ce=Fv({steps:Ev(()=>a.part()),shouldRun:()=>Ve!=="view"&&a.editable&&a.packageRevision()===c,hasPendingInput:Oe});}function Oe(c=true){return e$1.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:c})??false}function pe(){if(!Oe()){xt(),ke();return}be$1===null&&(be$1=setTimeout(()=>{be$1=null,it.pending()===null&&(xt(),ke());},0));}let Ce="",Me=null,$e$1=false;function _e$1(){if($e$1||(Me!==null&&(clearTimeout(Me),Me=null),Ce.length===0))return;let c=Ce;Ce="",$e$1=true;try{je.type(c);}catch(f){throw Ce=c+Ce,f}finally{$e$1=false;}}function _n(c){Ce+=c,Me===null&&(Me=setTimeout(()=>{Me=null,_e$1();},0));}function _r(c,f,h){_e$1();let w=h?.trim()||s?.trim();if(!w)return A="tracked changes need a non-empty author",n$1.onChange?.(Ke$1()),false;if(c!=="deletion"&&f.length===0)return A=`${c} requires non-empty text`,n$1.onChange?.(Ke$1()),false;if(c!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(f))return A=`${c} requires text without a paragraph mark`,n$1.onChange?.(Ke$1()),false;let E={author:w,date:x()},_=$n(),B=_.from.paragraphId===_.to.paragraphId&&_.from.offset===_.to.offset;if(c!=="insertion"&&B&&!(c==="replacement"&&Q))return A=`${c} needs a non-collapsed selection`,n$1.onChange?.(Ke$1()),false;let W=c==="insertion"?{ops:[],collapseTo:ff(ae$1,_.from)}:Tn(w),J=Gu(W.ops,E,Wu()),me=W.collapseTo;if(c==="insertion"||c==="replacement"){let se=c==="replacement"?W.replaceAt??W.collapseTo:W.collapseTo;J.push({op:"insertText",paragraphId:se.paragraphId,offset:se.offset,text:f,revision:E}),me={paragraphId:se.paragraphId,offset:se.offset+f.length};}let ie=false;return Ne(()=>{let se=Ye(J,ze(),Bn(me));return ie=se.committed,se},()=>He(me)),ie}let it=Xe({run:c=>{let f=Ge(),h=v(c.revision,c);return kt=Ge()-f,h},currentRevision:()=>a.packageRevision(),schedule:c=>{let f=setTimeout(c,0);return ()=>clearTimeout(f)},publish:c=>{fn.releaseLayout(),ae$1=c,pe();}}),rr=false;bn=()=>{it.invalidateAll(a.packageRevision(),"drawing-resources"),!rr&&(rr=true,setTimeout(()=>{rr=false,Xe$1();},0));};let Qa=a.subscribe(c=>{PS(c),F=null,it.notify(c);}),Br=i?a.collaborationPort(i.documentId):null,Fo=()=>{},or=()=>{},Be=false,tt=null,At=null,Rt=i?i.subscribeRemoteSelections(()=>{Be&&ri();}):()=>{};function Ct(){let c=db(e$1,ae$1,I,l$2),f=oe?.getActive()?.pageIndex??We.selectionPageIndex();return f===void 0||c===void 0||c.has(f)?c:new Set([...c,f])}function Xe$1(){return it.pending()?it.flush():false}let Us=8;function Ja(c){!c&&it.pending()!==null&&kt>Us&&Oe(false)||Xe$1()||xt();}function Ze$1(){_e$1(),Xe$1();}function Ws(){_e$1();let c=Xe$1();return be$1!==null?(xt(),ke(),true):c}let Oo=null;function eS(c){return c.contentControlId??`toc:${c.id}`}function Au(c){return ye$1(a.part()).find(f=>f.beginParagraphId===c||f.endParagraphId===c||f.resultParagraphIds.includes(c))}function tS(){for(let c of R.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(c.getAttribute("data-docx-content-control")===Oo){c.dataset.hover="",c.dataset.boundaryVisible="";continue}delete c.dataset.hover,z||delete c.dataset.boundaryVisible;}}function Mu(c){Oo!==c&&(Oo=c,tS());}function Lu(c){let h=c.target?.closest("[data-paragraph-id]")?.dataset.paragraphId,w=h?Au(h):null;Mu(w?eS(w):null);}function Nu(c){let f=c.target,h=f?.isConnected?f.closest("[data-paragraph-id]"):void 0;if(h)return h.dataset.paragraphId;let w=R.ownerDocument;return typeof w.elementFromPoint!="function"?void 0:w.elementFromPoint(c.clientX,c.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function Du(){Mu(null);}function nS(){let c=ar(),f=ee(a.part()),w=ye$1(a.part()).map(se=>{let dt=rS(se);return dt?{...dt,empty:f.has(se.beginParagraphId)}:null}).filter(se=>se!==null),E=new Set(w.map(se=>se.boundary.id)),_=new Set(w.filter(se=>se.empty).map(se=>se.boundary.id)),B=c&&!E.has(c.id)?new Set([c.id]):void 0,W=Oo?new Set([Oo]):void 0,J=new Set(mf(ae$1).filter(se=>se.controlType==="checkbox"&&$u(se.id)).map(se=>se.id)),me=w.filter(se=>se.additional&&!se.empty).map(se=>se.boundary),ie=Uu()!==null;if(!(!z&&!B&&!W&&!ie&&J.size===0&&me.length===0&&E.size===0))return {...ie?{readOnly:true}:{},...z?{showAll:true}:{},...B?{activeIds:B}:{},...W?{hoverIds:W}:{},...J.size>0?{checkedIds:J}:{},...me.length>0?{additionalBoundaries:me}:{},...E.size>0?{tocControlIds:E}:{},..._.size>0?{suppressedIds:_}:{}}}function rS(c){let f=c.contentControlId?mf(ae$1).find(E=>E.id===c.contentControlId):void 0;if(f)return {tocId:c.id,boundary:f,additional:false};let h=new Set([c.beginParagraphId,...c.resultParagraphIds,c.endParagraphId]),w=ae$1.pages.flatMap(E=>{let _=ya(E).filter(ie=>h.has(ie.paragraphId)).map(ie=>ie.box);if(_.length===0)return [];let B=Math.min(..._.map(ie=>ie.x)),W=Math.min(..._.map(ie=>ie.y)),J=Math.max(..._.map(ie=>ie.x+ie.width)),me=Math.max(..._.map(ie=>ie.y+ie.height));return [{pageIndex:E.index,box:{x:B,y:W,width:J-B,height:me-W}}]});return w.length===0?null:{tocId:c.id,additional:true,boundary:{id:`toc:${c.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:w}}}let Ao=null;function ar(){let c=we();if(c.kind!=="body")return iS(c);if(Ao&&Ao.layout===ae$1&&Ao.selection===I)return Ao.result;let f=oS();return Ao={layout:ae$1,selection:I,result:f},f}function oS(){let c=jf(ae$1,I.head,b);if(!c)return null;let f=lf(ae$1,{x:c.x,y:c.y+c.height/2,pageIndex:c.pageIndex});return f&&aS(f.id)===a.part().name?f:null}function aS(c){let f=c.indexOf("#");return f===-1?"":c.slice(0,f)}function iS(c){let f=a.partFor(c);return f?ie(f,I.head.paragraphId):null}function Hu(c){return c.bound?"bound":c.effectiveLock==="contentLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function sS(c){return c.effectiveLock==="sdtLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function lS(c){return Cd$1(c)}function $r(c){let f=lt(a,c),h=Ga(f??a.part(),c);return !h||!lS(h)?null:h}function _u(c){let f=$r(c);if(!f)return null;for(let h of f.children)if(h.kind!=="textValue"&&(h.kind==="contentControlProperties"||h.localName==="sdtPr"))for(let w of h.children){if(w.kind==="textValue"||w.localName!=="tabIndex")continue;let E=w.attributes.find(B=>B.localName==="val")?.value;if(E===void 0)return null;let _=Number(E);return Number.isFinite(_)?_:null}return null}function dS(){let c=we(),f=c.kind==="body"?null:a.partFor(c),h=c.kind==="notesPart"?new Set(he$1()):void 0;return (f?[...he(f,h)]:[...mf(ae$1)]).filter(E=>Hu(E)===null).sort((E,_)=>{let B=_u(E.id),W=_u(_.id);return B!==null&&W!==null&&B!==W?B-W:B!==null&&W===null?-1:B===null&&W!==null?1:0})}function Bu(c){for(let f of c.children)if(f.kind!=="textValue"&&(f.kind==="contentControlContent"||f.localName==="sdtContent"))return f.children;return []}function cS(c){let f=$r(c);if(!f)return false;let h=Bu(f),w=[],E=me=>{for(let ie of me){if(ie.kind==="paragraph"){w.push({id:ie.id,length:Ne$1(ie).length});continue}if(ie.kind==="textValue")continue;if(ie.kind==="contentControl"){E(Bu(ie));continue}E(ie.children);}};if(E(h),w.length>0){let me=w[0],ie=w[w.length-1];return pt({anchor:{paragraphId:me.id,offset:0},head:{paragraphId:ie.id,offset:ie.length}}),true}let _=null,B=0,W=0,J=me=>{for(let ie of me){if(ie.kind==="paragraph"){let se=Ne$1(ie).spanOf(f);if(!se)continue;return _=ie.id,B=se.start,W=se.end,true}if(ie.kind!=="textValue"&&J(ie.children))return true}return false};return J((a.partFor(ht(a,c,we()))??a.part()).root.children),_?(pt({anchor:{paragraphId:_,offset:B},head:{paragraphId:_,offset:W}}),true):false}function uS(c){let f=$r(c);if(!f)return [];for(let h of f.children)if(h.kind!=="textValue"&&!(h.kind!=="contentControlProperties"&&h.localName!=="sdtPr"))for(let w of h.children){if(w.kind==="textValue"||w.localName!=="dropDownList"&&w.localName!=="comboBox")continue;let E=[];for(let _ of w.children){if(_.kind==="textValue"||_.localName!=="listItem")continue;let B=_.attributes.find(J=>J.localName==="value")?.value??"",W=_.attributes.find(J=>J.localName==="displayText")?.value??B;E.push({displayText:W,value:B});}return E}return []}function $u(c){let f=$r(c);if(!f)return false;for(let h of f.children)if(h.kind!=="textValue"&&!(h.kind!=="contentControlProperties"&&h.localName!=="sdtPr")){for(let w of h.children)if(w.kind==="contentControlCheckbox")for(let E of w.children){if(E.kind!=="contentControlChecked")continue;let _=E.attributes.find(B=>B.localName==="val")?.value;return !(_==="0"||_==="false"||_==="off")}}return false}function fS(c){let f=$r(c);if(f){for(let h of f.children)if(h.kind==="contentControlProperties"){for(let w of h.children)if(w.kind==="contentControlDate")return w.attributes.find(E=>E.localName==="fullDate")?.value}}}function Gs(c,f){for(let h of R.querySelectorAll("[data-docx-content-control]"))h.getAttribute("data-docx-content-control")===c&&(f?h.dataset.open="":delete h.dataset.open);}function wn(c){let f=c.dataset.docxCcId;c.remove(),f&&Gs(f,false);}function Xs(){let c=R.querySelector(".docx-content-control-menu");c&&wn(c);}function qu(c){let f=Nu(c),h=f?Au(f):void 0;pS(h&&il(h.id)?h.id:null);}let Mo=null;function pS(c){Mo!==c&&(Mo=c,n$1.onChange?.(Ke$1()));}function Zu(c){if(c.button!==0||c.target?.closest("a.docx-hyperlink")||I.anchor.paragraphId!==I.head.paragraphId||I.anchor.offset!==I.head.offset)return;let f=Nu(c);if(!f)return;let h=ye$1(a.part()).find(_=>_.resultParagraphIds.includes(f));if(!h)return;let E=ef(a.part(),h,a.documentOutline(),ol(h))[h.resultParagraphIds.indexOf(f)];E&&(c.preventDefault(),nr.goToPosition({paragraphId:E,offset:0}));}function mS(c,f){let h=In.disabledReason(c,"edit");if(h){A=h,n$1.onChange?.(Ke$1());return}if(f==="checkbox"){In.setValue(c,$u(c)?"false":"true");return}if(f==="dropdown"||f==="comboBox"){let w=uS(c);if(w.length===0&&f==="dropdown")return;Xs();let E=M.createElement("div");E.className="docx-content-control-menu",E.dataset.docxMarker="",E.dataset.docxCcId=c,E.setAttribute("contenteditable","false"),E.setAttribute("role","listbox"),E.style.position="absolute",E.style.zIndex="20",E.style.pointerEvents="auto",E.addEventListener("pointerdown",J=>J.stopPropagation());let B=mf(ae$1).find(J=>J.id===c)?.fragments[0];if(B){let J=ae$1.pages[B.pageIndex],me=nt?.pageOffsetX.get(B.pageIndex)??0;if(J){let ie=J.contentBox.x-J.box.x,se=J.contentBox.y-J.box.y;E.style.left=`${(J.box.x+me+ie+B.box.x+B.box.width)*l$2}px`,E.style.top=`${(J.box.y+se+B.box.y+B.box.height)*l$2}px`,E.style.transform="translateX(-100%)";}}for(let J of w){let me=M.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=J.displayText,me.addEventListener("mousedown",ie=>{ie.preventDefault(),ie.stopPropagation(),wn(E),In.setValue(c,J.value);}),E.append(me);}if(f==="comboBox"){let J=M.createElement("input");J.type="text",J.className="docx-content-control-menu-input",J.dataset.docxMarker="",J.setAttribute("contenteditable","false"),J.addEventListener("mousedown",me=>me.stopPropagation()),J.addEventListener("keydown",me=>{me.key==="Enter"&&(me.preventDefault(),wn(E),In.setValue(c,J.value));}),E.append(J);}R.append(E),Gs(c,true);let W=J=>{E.contains(J.target)||(wn(E),M.removeEventListener("mousedown",W,true));};M.addEventListener("mousedown",W,true);return}if(f==="date"){Xs();let w=M.createElement("div");w.className="docx-content-control-menu",w.dataset.docxMarker="",w.dataset.docxCcId=c,w.setAttribute("contenteditable","false"),w.style.position="absolute",w.style.zIndex="20",w.style.pointerEvents="auto",w.addEventListener("pointerdown",De=>De.stopPropagation());let E=mf(ae$1).find(De=>De.id===c),_=E?.fragments[0];if(_){let De=ae$1.pages[_.pageIndex],dr=nt?.pageOffsetX.get(_.pageIndex)??0;if(De){let Uo=De.contentBox.x-De.box.x,Wo=De.contentBox.y-De.box.y;w.style.left=`${(De.box.x+dr+Uo+_.box.x+_.box.width)*l$2}px`,w.style.top=`${(De.box.y+Wo+_.box.y+_.box.height)*l$2}px`,w.style.transform="translateX(-100%)";}}w.classList.add("docx-content-control-calendar");let B=fS(c),W=B?new Date(B):new Date,J=Number.isNaN(W.getTime())?null:W,me=J??new Date,ie=me.getFullYear(),se=me.getMonth(),dt=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),qn=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),Kr=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),zo=De=>`${De.getFullYear().toString().padStart(4,"0")}-${(De.getMonth()+1).toString().padStart(2,"0")}-${De.getDate().toString().padStart(2,"0")}`,jo=(De,dr)=>De.getFullYear()===dr.getFullYear()&&De.getMonth()===dr.getMonth()&&De.getDate()===dr.getDate(),Rf=null,ml=()=>{let De=M.createElement("input");De.type="date",De.className="docx-content-control-calendar-input",De.value=J?zo(J):"";let dr=De.value;E?.alias&&De.setAttribute("aria-label",E.alias);let Uo=()=>{if(!De.value||De.value===dr)return false;let St=De.value;return wn(w),In.setValue(c,St),true};Rf=Uo,De.addEventListener("keydown",St=>{St.key==="Enter"&&(St.preventDefault(),Uo()||wn(w));}),De.addEventListener("blur",()=>{queueMicrotask(()=>{!w.isConnected||w.contains(M.activeElement)||Uo()||wn(w);});});let Wo=M.createElement("div");Wo.className="docx-content-control-calendar-header";let cr=M.createElement("button");cr.type="button",cr.className="docx-content-control-calendar-nav",cr.textContent="\u2039";let KS=new Date(ie,se-1,1);cr.setAttribute("aria-label",dt.format(KS));let gl=M.createElement("div");gl.className="docx-content-control-calendar-title",gl.textContent=dt.format(new Date(ie,se,1));let ur=M.createElement("button");ur.type="button",ur.className="docx-content-control-calendar-nav",ur.textContent="\u203A";let VS=new Date(ie,se+1,1);ur.setAttribute("aria-label",dt.format(VS)),cr.addEventListener("mousedown",St=>St.stopPropagation()),ur.addEventListener("mousedown",St=>St.stopPropagation()),cr.addEventListener("click",()=>{se-=1,se<0&&(se=11,ie-=1),ml();}),ur.addEventListener("click",()=>{se+=1,se>11&&(se=0,ie+=1),ml();}),Wo.append(cr,gl,ur);let hl=M.createElement("div");hl.className="docx-content-control-calendar-weekdays";for(let St=0;St<7;St+=1){let Pn=M.createElement("span");Pn.textContent=Kr.format(new Date(2024,0,1+St)),hl.append(Pn);}let di=M.createElement("div");di.className="docx-content-control-calendar-grid",di.setAttribute("role","grid");let zS=(new Date(ie,se,1).getDay()+6)%7,jS=new Date;for(let St=0;St<42;St+=1){let Pn=new Date(ie,se,St-zS+1),zt=M.createElement("button");zt.type="button",zt.className="docx-content-control-calendar-day",zt.textContent=String(Pn.getDate()),zt.setAttribute("role","gridcell"),zt.setAttribute("aria-label",qn.format(Pn)),Pn.getMonth()!==se&&(zt.dataset.otherMonth=""),J&&jo(Pn,J)&&(zt.dataset.selected="",zt.setAttribute("aria-selected","true")),jo(Pn,jS)&&(zt.dataset.today=""),zt.addEventListener("mousedown",US=>US.stopPropagation()),zt.addEventListener("click",()=>{wn(w),In.setValue(c,zo(Pn));}),di.append(zt);}w.replaceChildren(De,Wo,hl,di);};ml(),R.append(w),Gs(c,true);let Cf=De=>{w.contains(De.target)||(Rf?.()||wn(w),M.removeEventListener("mousedown",Cf,true));};M.addEventListener("mousedown",Cf,true),w.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}let In={setShowAll(c){z!==c&&(z=c,xt());},setFormFill(c){X!==c&&(X=c,n$1.onChange?.(Ke$1()));},showAll:()=>z,formFill:()=>X,atCaret:()=>ar(),navigate(c){let f=dS();if(f.length===0)return false;let h=ar(),w=h?f.findIndex(_=>_.id===h.id):-1;c==="next"?w=w<0?0:(w+1)%f.length:w=w<0?f.length-1:(w-1+f.length)%f.length;let E=f[w];return cS(E.id)},setValue(c,f){let h=In.disabledReason(c,"edit");if(h)return A=h,n$1.onChange?.(Ke$1()),false;let w=false;return Ne(()=>{let E=Ye([{op:"setContentControlValue",controlId:c,value:f}],ze(),void 0,ht(a,c,we()),false);return w=E.committed,E}),w},remove(c){let f=c??ar()?.id;if(!f)return A="notFound",n$1.onChange?.(Ke$1()),false;let h=In.disabledReason(f,"remove");if(h)return A=h,n$1.onChange?.(Ke$1()),false;let w=false;return Ne(()=>{let E=Ye([{op:"removeContentControl",controlId:f}],ze(),void 0,ht(a,f,we()),false);return w=E.committed,E}),w},disabledReason(c,f){let h=Uu();if(h!==null)return h;let w=mf(ae$1).find(_=>_.id===c);if(w)return f==="remove"?sS(w):Hu(w);let E=$r(c);if(!E)return "notFound";for(let _ of E.children)if(_.kind!=="textValue"&&!(_.kind!=="contentControlProperties"&&_.localName!=="sdtPr")){if(_.children.some(B=>B.kind!=="textValue"&&B.localName==="dataBinding")&&f==="edit")return "bound";for(let B of _.children){if(B.kind==="textValue"||B.localName!=="lock")continue;let W=B.attributes.find(J=>J.localName==="val")?.value;if(f==="remove"){if(W==="sdtLocked"||W==="sdtContentLocked")return "locked"}else if(W==="contentLocked"||W==="sdtContentLocked")return "locked"}}return null}};function Ys(){let c=Vu&&Ve!=="view";R.contentEditable=c?"true":"false",R.setAttribute("aria-readonly",c?"false":"true");}function Ke$1(){return {revision:a.packageRevision(),pageCount:ae$1.pages.length,selection:I,cellSelection:Q,canUndo:i?.canUndo()??a.canUndo(),canRedo:i?.canRedo()??a.canRedo(),collaborationStatus:i?.status()??"inactive",lastRejection:A,pendingFormat:K(),contentControls:{showAll:z,formFill:X,activeControlId:ar()?.id??null},contextTocId:Mo,formatPainter:Jn.state(),perf:{layoutMs:kt,paintMs:Ae,selectionMs:Te,placed:P.stats.placed,total:P.stats.total,reusedPages:P.stats.reusedPages,fullPasses:P.stats.fullPasses,staleDiscards:it.staleDiscards,cancelledRuns:it.cancelledRuns}}}let Vt,nt,Qs=null,ei=false,Lo=null,Js=null;function gS(c){for(let f of ae$1.pages){let h=R.children.item(f.index);if(h?.dataset.pageIndex!==String(f.index))continue;let w=c.pageOffsetX.get(f.index)??0;h.style.left=`${(f.box.x+w)*l$2}px`;}}function xt(c=true){be$1!==null&&(clearTimeout(be$1),be$1=null,c=true);let f=We.adoptBeforePaint(),h=Ge();Vt=Ct(),oe?.reconcileOccurrence();let w=oe?.getActive()??null,E=nS(),_=ee(a.part());n(R,ae$1,{scale:l$2,readOnlyParagraphIds:ai(),..._.size>0?{emptyTocPlaceholderIds:_}:{},...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},...n$1.defaultFontFamily?{defaultFontFamily:n$1.defaultFontFamily}:{},materialize:Vt,ariaHidden:false,drawingStrings:Lr,...n$1.fieldShading?{fieldShading:n$1.fieldShading}:{},...Hn!==void 0?{revisionStyles:Hn}:{},shadeFormFields:Wa(),showParagraphMarks:Ga$1.get(),...Io?{imageUrlPort:Io}:{},...w?{activeHeaderFooterRId:w.scope.rId,activeHeaderFooterPageIndex:w.pageIndex}:{},...E?{contentControlChrome:E}:{}},fn.get().value),Rc(R,Ua(),{domReplaced:true}),Th(e$1,R,w!=null),Dd(e$1,Ve),nt=Ps(ae$1,Vt),gS(nt),R.style.width=`${nt.width*l$2}px`,R.style.height=`${nt.height*l$2}px`,e$1.style.width=`${nt.width*l$2}px`,e$1.style.height=`${nt.height*l$2}px`,y.style.width=`${nt.width*l$2}px`,y.style.height=`${nt.height*l$2}px`,q.style.width=y.style.width,q.style.height=y.style.height,k.style.width=y.style.width,k.style.height=y.style.height,C.style.width=y.style.width,C.style.height=y.style.height,Vo.update(),Ae=Ge()-h,$o(),ri(),Zr(true),Pf(),We.mirrorToDom(),Ku(ei),ei=false,(c||f)&&n$1.onChange?.(Ke$1());}function ti(){Ze$1();let c=Ct(),f=Ps(ae$1,c);nt&&Vc(c,Vt)&&cb(f,nt)||xt(false);}function Ku(c=false){if(oe?.getActive()||ge?.activeNoteScope()||I.anchor.paragraphId!==I.head.paragraphId||I.anchor.offset!==I.head.offset)return;let f=M.activeElement;if(f!==R&&(!f||!R.contains(f)))return;let h=jf(ae$1,I.head,{measurer:b,...We.selectionPageIndex()!==void 0?{preferredPageIndex:We.selectionPageIndex()}:{}});if(!h)return;let w=Qs!==null&&Qs!==h.pageIndex;if(Qs=h.pageIndex,!c&&!w)return;let E=ae$1.pages[h.pageIndex],_=Kt(e$1);if(!E||!_||_.clientHeight<=0)return;let B=24,W=E.contentBox.y-E.box.y,J=(E.box.y+W+h.y)*l$2+e$1.offsetTop,me=J+h.height*l$2,ie=_.scrollTop,se=ie+_.clientHeight,dt=ie;if(J<ie+B)dt=J-B;else if(me>se-B)dt=me+B-_.clientHeight;else return;let qn=Math.max(0,_.scrollHeight-_.clientHeight),Kr=Math.max(0,Math.min(dt,qn));Math.abs(Kr-_.scrollTop)<.5||(_.scrollTop=Kr,ul());}let Ve=n$1.editingMode??"edit",Vu=true,ni=Object.freeze({kind:"body"}),zu=0,ju=Zy(n$1.locale,_e$1),el=n$1.translate,ut=null;function Ye(c,f,h,w=we(),E=true){_e$1();let _=ir(c.some(hS),c,E);if(_!==null)return {committed:false,rejected:true,opCount:0,reason:_};let B=bS(E&&ut?ut.annotate(c):c),W=No(B,f,h,w);return E&&ut?.afterApply(W.committed),W.committed&&B.some(Tc)&&r.onTrackedChange?.(),W}function No(c,f,h,w=we()){let E=i?.gateOperations(c,w);return E?{committed:false,rejected:true,opCount:0,reason:E}:(zu+=1,a.applyTreeOps(c,f,h,w,i?{origin:b$1.mutationHuman,actorId:i.identity.actorId,operationId:`${i.identity.actorId}:${i.sessionId}:browser:${zu}`,recordsHistory:false}:void 0))}function ir(c,f=[],h=true){return Ve==="view"?u:c&&(h&&rl()||f.some(w=>FS(w)))?m:Ve==="suggest"&&!s?.trim()&&c?$:Ve==="suggest"&&f.some(w=>w.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}function Uu(){let c=ir(true,[],false);return c!==null?c:a.editable?null:p}function hS(c){return c.op!=="acceptRevision"&&c.op!=="rejectRevision"&&c.op!=="acceptAllRevisions"&&c.op!=="rejectAllRevisions"}let yS=c=>jh$1.has(c),Wu=()=>!a.trackingSettings().doNotTrackFormatting;function Gu(c,f,h){return c.flatMap(w=>kc(w)?!h&&yS(w.op)?[w]:[w.revision!==void 0?w:{...w,revision:f}]:w.op==="splitParagraphMany"?[{...w,revision:f}]:w.op==="splitParagraph"?[w,{op:"setParagraphMarkRevision",paragraphId:w.paragraphId,kind:"ins",revision:f}]:w.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:w.secondId,revision:f}]:[w])}function Xu(){let c=s?.trim();return Ve==="suggest"&&c?c:void 0}function bS(c){let f=Xu();return f===void 0?[...c]:Gu(c,{author:f,date:x()},Wu())}function vS(c,f,h){let w=Et(f);if(w===h)return c;let E=0;for(;E<h.length&&E<w.length&&h[E]===w[E];)E+=1;let _=0;for(;_<h.length-E&&_<w.length-E&&h[h.length-1-_]===w[w.length-1-_];)_+=1;let B=w.length-h.length,W=J=>J.paragraphId!==f||J.offset<=E?J:J.offset>=h.length-_?{...J,offset:J.offset+B}:{...J,offset:E};return {anchor:W(c.anchor),head:W(c.head)}}function xS(c,f){let h=a.partFor(we())??a.part(),w=Ha$1(h,c),E=Ha$1(h,f);return w!==null&&E!==null&&w.id===E.id}function Bn(c){return {paragraphId:c.paragraphId,start:c.offset,end:c.offset}}function Ne(...c){let f=Hy(e$1);try{SS(...c);}finally{f();}}function SS(c,f,h={}){_e$1(),h?.keepCellSelection||(Q=null),F=null,We.noteModelMoved();let w=c(),E=typeof w=="boolean"||!w.rejected?null:w;if(E)A=String(E.reason??"rejected");else {A=null;let _=f?.();_&&(_o(),I=_,te({kind:"none"},false),vt=null,ei=true);let B=h?.rearmPending;if(B&&B.properties.length>0){let{anchor:W,head:J}=I;W.paragraphId===J.paragraphId&&W.offset===J.offset&&(F={properties:B.properties,base:B.base,position:J});}}qr(),Ja(E!==null);}function wS(){if(!Vt)return true;for(let c of [I.anchor,I.head]){let f=jf(ae$1,c);if(f&&!Vt.has(f.pageIndex))return false}return true}function qr(){let c=i;if(!c)return;let f=Br?t0(Q?.text??I,w=>{let E=lt(a,w)??a.part();return n0(E,w)},Q?"cells":void 0):null,h=f?`${f.anchor.paragraphId}:${f.anchor.offset}|${f.head.paragraphId}:${f.head.offset}|${f.kind??""}`:"";h!==At&&(At=h,c.setLocalSelection(f));}function pt(c,f=false){let h=!Zt(c,I);Ce.length>0&&h&&_e$1();let w=ut?.beforeSelect(c);if(w===null)return;c=w??c,le(c),fe(c);let E=ar()?.id??null,_=qo(I.head.paragraphId);_o(),I=c,Q=null,f||(vt=null),wS()||(We.noteModelMoved(),xt(false)),We.noteSelectionSettled(),We.mirrorToDom(true),Ku(true),$o(),lr.clear(),Zr();let B=ar()?.id??null,W=qo(I.head.paragraphId);(E!==B||_!==W)&&xt(false),qr(),n$1.onChange?.(Ke$1());}let We=Vb({session:a,storyScope:we,document:M,pagesLayer:R,selection:()=>I,setSelection:c=>pt(c),adoptSelection:c=>{let f=ut?.beforeSelect(c);f!==null&&(c=f??c,le(c),fe(c),_o(),I=c,vt=null,ei=true,qr());},commit:c=>Ne(c),applyOps:(c,f,h)=>Ye(c,f,void 0,h),hasPendingInput:()=>Ce.length>0,replacementOffset:(c,f,h)=>ll({paragraphId:c,offset:f},{paragraphId:c,offset:h}),render:()=>xt(),flushLayout:()=>Xe$1(),flushToPaint:()=>Ws(),updateCaret:()=>{L.update(),Rc(R,Ua());},textOf:c=>Et(c),pendingFormatOps:(c,f,h,w)=>de(c,f,h,w),selectionMark:()=>ze(),now:Ge,recordSelectionMs:c=>{Te=c;},isGesturing:()=>dl?.dragging()??false,domSelection:()=>Q?He(Q.text.anchor):I,holdsCellSelection:()=>Q!==null,replaceSelectionWith:c=>je.type(c),discardPaint:()=>l$1(R)});oe=kv({session:a,layout:()=>ae$1,sectionAtPage:Pe,revisionDisplayMode:Tt,revisionAuthorFilter:Pt,selection:()=>I,setScopeSelection:c=>{_e$1(),_o(),le(c),lr.clear(),I=c,Q=null,vt=null,qr();},noteModelMoved:()=>We.noteModelMoved(),render:()=>xt(),mirrorToDom:()=>We.mirrorToDom(),notify:()=>n$1.onChange?.(Ke$1()),materializedPages:()=>Vt,entryRefused:()=>Ve==="view",leaveOtherStories:()=>ge?.exitNote()}),ge=Pv({session:a,exitHeaderFooter:()=>oe?.exitHeaderFooter(),applyOps:Ye,commit:Ne,selection:()=>I,selectionMark:()=>ze(),orderedStart:()=>sl(),deleteSelectionPlan:()=>Tn(),undo:()=>je.undo(),activeScope:()=>{let c=ge?.activeNoteScope();return c||(oe?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:c=>oe.setActiveScope(c),setSelection:c=>pt(c),noteModelMoved:()=>We.noteModelMoved(),render:()=>{Xe$1()||xt();},revealNote:c=>{Xe$1();for(let f of ae$1.pages){let h=[...f.footnotes?.notes??[],...f.endnotes?.notes??[]].find(w=>w.scopeId===c);if(h)return Ko(h.box.y,h.box.height,{block:"nearest",offsetPx:48}),f.index}return null},notify:()=>n$1.onChange?.(Ke$1()),lastRejection:()=>A,setLastRejection:c=>{A=c;}});function Yu(c){c&&_e$1(),Q=c,c&&(le(c.text),_o(),I=c.text),vt=null,We.noteSelectionSettled(),We.mirrorToDom(),$o(),lr.clear(),Zr(),qr(),n$1.onChange?.(Ke$1());}let sr=null;function IS(){let f=jf(ae$1,I.head)?.pageIndex??0,h=new Set;for(let w=f-1;w<=f+1;w+=1)w>=0&&w<ae$1.pages.length&&h.add(w);return h}let Qu=new WeakMap;function kS(c){let f=Qu.get(c);if(f)return f;let h=new Map;for(let w of c.pages)for(let E of ya(w))h.has(E.paragraphId)||h.set(E.paragraphId,w.index);return Qu.set(c,h),h}function TS(){let c=a.revision(),f=Vt??IS();if(sr?.layout===ae$1&&sr.revision===c&&Vc(sr.pages,f))return sr.rects;let h=kS(ae$1),w=(W,J)=>{if(!f)return true;let me=h.get(W),ie=h.get(J);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},E=[];for(let W of Bo()){if(W.kind==="comment"){if(W.range===null||!w(W.range.start.paragraphId,W.range.end.paragraphId))continue;E.push({key:xa$1(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 J=xa$1(W),me=W.kind==="revision"?W.ranges:W.range?[W.range]:[];for(let[ie,se]of me.entries())w(se.start.paragraphId,se.end.paragraphId)&&E.push({key:me.length===1?J:`${J}${g}${ie}`,from:{paragraphId:se.start.paragraphId,offset:se.start.offset},to:{paragraphId:se.end.paragraphId,offset:se.end.offset}});}let _=$e(ae$1,E,f,b),B=[];for(let[W,J]of _)for(let me of J)B.push({...me,key:W});return sr={layout:ae$1,revision:c,pages:f,rects:B},B}let kn=null;function PS(c){kn&&(c.impact==="text-local"&&c.created.length===0&&c.deleted.length===0&&c.splitJoin.length===0?kn={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:kn.index}:kn=null);}function RS(){let c=a.packageRevision(),f=a.part().root;if(kn&&kn.packageRevision===c&&kn.bodyRoot===f)return kn.index;let h=new Map,w=_=>{let B=h.size;for(let[W,J]of _)h.has(W)||h.set(W,B+J);};w(Ha$2(a.part()));let E=new Set([a.part()]);for(let _ of a.headerFooterPartsBySection())for(let B of [_.headers,_.footers])for(let W of B.values())E.has(W)||(E.add(W),w(Ha$2(W)));for(let _ of ["footnote","endnote"]){let B=a.partFor({kind:"notesPart",noteKind:_});!B||E.has(B)||(E.add(B),w(Ha$2(B)));}return kn={packageRevision:c,bodyRoot:f,index:h},h}let lr=new Set,Do=null,Ho=null,tl=false,Ju=false;function _o(){tl||(Ho=null);}function ef$1(){let c=Ho;if(!c||!I)return null;let f=(w,E)=>w.paragraphId===E.paragraphId&&w.offset===E.offset;if(!f(I.anchor,c.anchor)||!f(I.head,c.head))return null;let h=Bo().find(w=>xa$1(w)===c.key);return !h||h.kind==="revision"&&Do!==null&&Do.has(h.revisionKind)&&!Ju?null:h}function nl(){let c=ef$1();if(c)return tf(c);let f=I?.head;if(!f)return null;let w=Ba$1(Bo(),f,RS()).filter(E=>!(E.kind==="comment"&&E.resolved)&&!lr.has(xa$1(E))&&!(E.kind==="revision"&&Do!==null&&Do.has(E.revisionKind)))[0];return w?tf(w):null}function tf(c){if(c.kind!=="comment")return c;let f=Da$1(Bo(),c);return lr.has(xa$1(f))?null:f}function Bo(){return un.filterItems(a.reviewItems())}let nf=Jy({roster:fn.get,styles:()=>Hn,slots:Po}),rf=nf.forAuthor,CS=nf.declaredFor;function ES(c,f,h){let w=c.split(g),E=w[0],_=f!==null&&E===xa$1(f);if(c.startsWith("comment-")){let ie=h.get(E),se=ie?.kind==="comment"&&ie.resolved;return se&&!_?null:_?`docx-comment-band docx-comment-band--active${se?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(c.startsWith("custom-"))return _?"docx-comment-band docx-comment-band--active":null;let B=h.get(E);if(!B||B.kind!=="revision")return null;let W=w.length>1?Number(w[1]):0;return `docx-revision-band docx-revision-band--${(ie=>ie==="delete"||ie==="moveFrom"?"delete":ie==="insert"||ie==="moveTo"?"insert":ie==="replace"&&B.replacedRangeCount!==void 0?W<B.replacedRangeCount?"delete":"insert":"other")(B.revisionKind)}${_?" docx-revision-band--active":""}`}let of$1=null,af,sf=null;function Zr(c=false){let f=nl(),h=f?xa$1(f):null,w=fn.get();if(!c&&of$1===ae$1&&af===h&&sf===w.resolved)return;let E=new Map;for(let B of Bo())E.set(xa$1(B),B);let _=[];for(let B of TS()){let W=ES(B.key,f,E);if(!W)continue;let J=E.get(B.key.split(g)[0]),me=J?Cc(J):null,ie=me===null||me===""?void 0:w.resolved.get(me);_.push({...B,className:W,...ie?{reviewAuthor:ie}:{}});}o(q,ae$1,_,{scale:l$2,...nt?{pageOffsetX:nt.pageOffsetX}:{}}),of$1=ae$1,af=h,sf=w.resolved;}function $o(){ut?.update();let c=Q?wf(ae$1,Q.cellIds):Y?Ze(ae$1,Y,he$1(),b):_e(ae$1,I,he$1(),b);o(y,ae$1,c,{scale:l$2,pageOffsetX:nt?.pageOffsetX,...Q?{}:{className:Y?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function ri(){if(!Be){k.replaceChildren();return}let c=i;if(!c){k.replaceChildren();return}r0(k,ae$1,c.remoteSelections(),{scale:l$2,pageOffsetX:nt?.pageOffsetX,...Vt?{pages:Vt}:{},colorForAuthor:rf,declaredColorFor:CS,labelHost:tt,measurer:b});}function oi(c){let f=ye$1(a.part());if(c)return f.find(E=>E.id===c)??null;let h=Mo?f.find(E=>E.id===Mo):void 0;if(h)return h;let w=I.head.paragraphId;return f.find(E=>E.beginParagraphId===w||E.endParagraphId===w||E.resultParagraphIds.includes(w))??(f.length===1?f[0]:null)}function qo(c){return ye$1(a.part()).find(h=>h.beginParagraphId===c||h.endParagraphId===c||h.resultParagraphIds.includes(c))?.id??null}function rl(){return qo(I.anchor.paragraphId)!==null||qo(I.head.paragraphId)!==null}function FS(c){let f=ai(),h=(w,E="")=>typeof w=="string"?/(?:Id|Ids)$/.test(E)&&f.has(w):Array.isArray(w)?w.some(_=>h(_,E)):!w||typeof w!="object"?false:Object.entries(w).some(([_,B])=>h(B,_));return h(c)}function ai(){return new Set(ye$1(a.part()).flatMap(c=>[c.beginParagraphId,...c.resultParagraphIds,c.endParagraphId]))}function ol(c){return new Set([c.beginParagraphId,c.endParagraphId,...c.resultParagraphIds])}function OS(c){let f=0;for(let h of ae$1.pages)for(let w of ya(h))c.has(w.paragraphId)&&(f+=w.lines.length);return f}function al(c,f){let h=new Set(f),w=new Map;for(let E of c.pages)for(let _ of ya(E)){if(!h.has(_.paragraphId)||w.has(_.paragraphId))continue;let B=E.pageFieldSource;w.set(_.paragraphId,mb$1(B?.pageNumber??E.index+1,B?.format));}return w}function il(c){if(Ve==="view"||!a.editable)return false;let f=oi(c);return f?Vh$1(a.part(),{op:"rewriteTocPageNumbers",tocId:f.id,updates:[]})===null:false}function lf$1(c,f){if(!Number.isInteger(c)||!Number.isInteger(f)||c<1||f<1)return null;let h=er.sectionPropertiesAt(I.head.paragraphId),w=h.pageSize.widthTwips-h.margins.leftTwips-h.margins.rightTwips-h.margins.gutterTwips,E=Math.max(300,Math.floor(w/f));return {op:"insertTable",beforeParagraphId:I.head.paragraphId,rows:c,cols:f,columnWidthTwips:E}}function df(c,f){if(Ve==="view"||!a.editable)return false;let h=lf$1(c,f),w=a.partFor(we())??a.part();return h!==null&&Vh$1(w,h)===null}function AS(c,f){if(!df(c,f))return false;let h=lf$1(c,f);if(!h)return false;let w=null,E=a.subscribe(B=>{B.caret&&(w=B.caret);}),_=false;try{Ne(()=>{let B=Ye([h],ze());return B.committed||(A=B.reason??"the table could not be inserted here"),_=B.committed,B},()=>{let B=w;return B?He({paragraphId:B.paragraphId,offset:B.start}):null});}finally{E();}return _}let cf$1='TOC \\o "1-3" \\h';function uf(){let c=xe$1(cf$1);if(!c)return null;let f=a.documentOutline(),h=cf(a.part(),f,c,al(je.layout(),f.map(w=>w.blockId)),ai(),i?.identity.actorId);return {op:"insertToc",beforeParagraphId:I.head.paragraphId,instruction:cf$1,alias:vn?.title??"TOC",entries:h.entries,bookmarksToCreate:h.bookmarksToCreate}}function ff$1(){if(Ve==="view"||!a.editable||rl())return false;let c=uf();return c!==null&&Vh$1(a.part(),c)===null}function MS(){if(!ff$1())return false;let c=uf();if(!c)return false;let f=new Set(ye$1(a.part()).map(E=>E.id)),h=No([c],void 0,void 0,ni);if(!h.committed)return A=h.reason??"the table of contents could not be inserted",false;let w=ye$1(a.part()).find(E=>!f.has(E.id));return w?pf(w.id,"pageNumbers"):true}function pf(c,f="entire"){let h=oi(c);if(!h||!il(h.id))return false;let w=je.layout(),E=a.documentOutline(),_=E.map(W=>W.blockId);if(f==="entire"){let W=cf(a.part(),E,h.instruction,al(w,_),ol(h),i?.identity.actorId),J=No([{op:"replaceTocResult",tocId:h.id,entries:W.entries,bookmarksToCreate:W.bookmarksToCreate}],void 0,void 0,ni);if(!J.committed)return A=J.reason??"the table of contents could not be refreshed",false;if(w=je.layout(),h=oi(h.id),!h)return true}let B="";for(let W=0;W<3;W+=1){let J=al(w,_),me=ef(a.part(),h,E,ol(h)),ie=h.resultParagraphIds.flatMap((qn,Kr)=>{let zo=me[Kr],jo=zo?J.get(zo):void 0;return jo===void 0?[]:[{paragraphId:qn,pageNumberText:jo}]});if(ie.length===0)break;let se=ie.map(qn=>`${qn.paragraphId}\0${qn.pageNumberText}`).join("");if(se===B)break;B=se;let dt=No([{op:"rewriteTocPageNumbers",tocId:h.id,updates:ie}],void 0,void 0,ni);if(!dt.committed){if(dt.rejected)return A=dt.reason??"the table of contents page numbers were refused",false;break}w=je.layout(),h=oi(h.id)??h;}return true}function LS(){return Uy({session:a,editingMode:Ve,collaborationActive:i!==void 0,reviewerFilterActive:Pt()!==void 0,layout:je.layout(),canonicalUnfilteredLayout:V,styleCascade:bt(),numberingIndex:at(),displayMode:Tt()})}let{selectionMark:ze,orderedRange:$n,orderedStart:sl,textOf:Et,inlineControlBeside:mf$1,splitEndsTheParagraph:NS,deleteSelectionPlan:Tn,deleteSelectionOps:DS,replacementOffset:ll}=rb({session:a,layout:()=>ae$1,selection:()=>I,cellSelection:()=>Q,editingMode:()=>Ve,author:()=>s,trackedDate:x,storyScope:we,paragraphOrder:he$1,flushPendingInputAndLayout:Ze$1,trackedAuthorOrNone:Xu,atParagraphEnd:(c,f)=>xo.atParagraphEnd(c,f)}),{insertPlainText:gf$1,copyFlavoursNow:HS,pasteRichNow:_S,armForcePlainPaste:BS}=nb({session:a,textFormFieldId:()=>ut?.fieldId()??null,layout:()=>ae$1,cellSelection:()=>Q,editingMode:()=>Ve,storyScope:we,paragraphOrder:he$1,actorId:()=>i?.identity.actorId,collaborationGate:(c,f)=>i?.gateOperations(c,f)??null,now:Ge,flushPendingInputAndLayout:Ze$1,orderedRange:$n,selectionMark:ze,deleteSelectionPlan:Tn,consumePendingFormatOps:de,withoutPendingOnRejection:Se,caretMark:Bn,commit:Ne});function Zo(c){c&&(Ee$1=null,Ze$1(),xn=Qn(Pt()),it.invalidateAll(a.packageRevision(),"tracked-change-filter"),it.flush(),n$1.onChange?.(Ke$1()));}let ii=false,je={session:a,applyGatedTreeOps:(c,f,h,w)=>No(c,f,h,w??we()),storyScope:we,imageDecodePort:()=>So,layout:()=>(Ze$1(),ae$1),state:Ke$1,currentPage:(c="caret")=>{if(Ze$1(),c==="viewport"){let h=lb(e$1,ae$1,l$2);if(h!==null)return h}let f=jf(ae$1,I.head);return f?f.pageIndex+1:1},setScale(c){if(!(c>0)||!Number.isFinite(c))return false;if(c===l$2)return true;let f={scale:l$2,defaults:T,measurer:b,producer:N,furnitureSource:xn};try{let h=Kt(e$1),w=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=c,n$1.measurer||(T=Ke(l$2,{context:co(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),b=T.measurer),N=O(),xn=Qn(Pt()),Vt=void 0,nt=void 0,sr=null,it.invalidateAll(a.packageRevision(),"zoom"),it.flush(),h&&w){let E=Math.max(0,w.x*l$2+e$1.offsetLeft-h.clientWidth/2),_=Math.max(0,w.y*l$2+e$1.offsetTop-h.clientHeight/2),B=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=B===null?E:Math.min(E,B),h.scrollTop=W===null?_:Math.min(_,W),ti();}return !0}catch{(({scale:l$2,defaults:T,measurer:b,producer:N,furnitureSource:xn}=f)),Vt=void 0,nt=void 0,sr=null;try{it.invalidateAll(a.packageRevision(),"zoom-rollback"),it.flush();}catch{}return false}},enqueueType:_n,flushPendingInput:Ze$1,type(c){let f=Tn(),h=f.replaceAt??f.collapseTo,w=de(h.paragraphId,h.offset,c.length),E=[...f.ops,{op:"insertText",paragraphId:h.paragraphId,offset:h.offset,text:c}],_={paragraphId:h.paragraphId,start:h.offset+c.length,end:h.offset+c.length};Ne(()=>Se([...E,...w],E,ze(),_),()=>He({paragraphId:h.paragraphId,offset:h.offset+c.length}));},proposeTextChange:(c,f,h)=>_r(c,f,h),insertPlainText:c=>gf$1(c),deleteBackward(){if(ut?.selectForDeletion("backward"))return;let c=Tn();if(c.ops.length>0){Ne(()=>Ye(c.ops,ze(),Bn(c.collapseTo)),()=>He(c.collapseTo));return}let f=j$1()??void 0,h=I.head;if(h.offset===0){for(let J of Oa$1(ae$1,h.paragraphId)){let me=Et(J);if(me.length!==0){Ne(()=>Ye([{op:"deleteText",paragraphId:J,start:me.length-1,end:me.length}],ze(),Bn({paragraphId:J,offset:me.length-1})),()=>He({paragraphId:J,offset:me.length-1}),{rearmPending:f});return}}let E=he$1(),_=E.indexOf(h.paragraphId),B=E[_-1];if(!B)return;if(!xS(B,h.paragraphId)){pt(He({paragraphId:B,offset:Et(B).length}));return}let W=Et(B).length;Ne(()=>Ye([{op:"joinParagraphs",firstId:B,secondId:h.paragraphId}],ze(),Bn({paragraphId:B,offset:W})),()=>He({paragraphId:B,offset:W}),{rearmPending:f});return}let w=mf$1(h,"before");if(w){Ne(()=>Ye([{op:"removeContentControl",controlId:w.controlId,keepContent:false}],ze(),Bn({paragraphId:h.paragraphId,offset:w.start})),()=>He({paragraphId:h.paragraphId,offset:w.start}),{rearmPending:f});return}Ne(()=>Ye([{op:"deleteText",paragraphId:h.paragraphId,start:h.offset-1,end:h.offset}],ze(),Bn({...h,offset:h.offset-1})),()=>He({...h,offset:h.offset-1}),{rearmPending:f});},splitParagraph(){let c=Tn(),f=c.replaceAt??c.collapseTo,h=new Set(a.paragraphIdsIn(we())),w=j$1()??void 0,E=NS(f)?xo.followerStyleId(f.paragraphId):void 0;Ne(()=>Ye([...c.ops,{op:"splitParagraph",paragraphId:f.paragraphId,offset:f.offset,tailStyleId:E}],ze()),()=>{let _=a.paragraphIdsIn(we()).find(B=>!h.has(B));return _?He({paragraphId:_,offset:0}):null},{rearmPending:w});},navigate(c,f=false){if(Ze$1(),!f&&(c==="left"||c==="right")&&(I.anchor.paragraphId!==I.head.paragraphId||I.anchor.offset!==I.head.offset)){let E=$n();vt=null,pt(He(c==="left"?E.from:E.to),true);return}let h=Hd(ae$1,I.head,c,vt,oe?.getActive()??null,qe(),b);if(!h)return;let w=ai();if(w.has(h.position.paragraphId)){if(f)return;let _=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(c)?"up":"down",B=OS(w)+4;for(let W=0;W<B;W+=1){let J=Hd(ae$1,h.position,_,h.desiredX,oe?.getActive()??null,qe(),b);if(!J||J.position.paragraphId===h.position.paragraphId&&J.position.offset===h.position.offset)return;if(h=J,!w.has(h.position.paragraphId))break}if(w.has(h.position.paragraphId))return}vt=h.desiredX,ge?.activeNoteScope()&&h.pageIndex!==void 0&&Number.isInteger(h.pageIndex)&&ge.setActiveNotePageIndex(h.pageIndex),pt({anchor:f?I.anchor:h.position,head:h.position},true);},deleteWordBackward(){if(je.deleteSelection())return;let c=I.head,f=gf(Et(c.paragraphId),c.offset,-1,of(ae$1,c.paragraphId));if(f===c.offset){je.deleteBackward();return}Ne(()=>Ye([{op:"deleteText",paragraphId:c.paragraphId,start:f,end:c.offset}],ze()),()=>He({...c,offset:f}),{rearmPending:j$1()??void 0});},deleteWordForward(){if(je.deleteSelection())return;let c=I.head,f=gf(Et(c.paragraphId),c.offset,1,of(ae$1,c.paragraphId));if(f===c.offset){je.deleteForward();return}Ne(()=>Ye([{op:"deleteText",paragraphId:c.paragraphId,start:c.offset,end:f}],ze()),void 0,{rearmPending:j$1()??void 0});},deleteForward(){if(ut?.selectForDeletion("forward")||je.deleteSelection())return;let c=j$1()??void 0,f=I.head,h=Et(f.paragraphId);if(f.offset<h.length){let _=mf$1(f,"after");if(_){Ne(()=>Ye([{op:"removeContentControl",controlId:_.controlId,keepContent:false}],ze()),()=>He(f),{rearmPending:c});return}Ne(()=>Ye([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset,end:f.offset+1}],ze()),void 0,{rearmPending:c});return}let w=he$1(),E=w[w.indexOf(f.paragraphId)+1];if(E){if(Oa$1(ae$1,E).includes(f.paragraphId)){if(Et(E).length===0)return;Ne(()=>Ye([{op:"deleteText",paragraphId:E,start:0,end:1}],ze()),()=>He(f),{rearmPending:c});return}Ne(()=>Ye([{op:"joinParagraphs",firstId:f.paragraphId,secondId:E}],ze()),()=>He(f),{rearmPending:c});}},...er,...Ro,setSelection:c=>{Zt(c,I)||te({kind:"programmatic"},false),pt(c);},selectDrawing(c,f){Xe$1();let h=ms(ae$1,c,f);if(!h)return false;let w=He(h);return te({kind:"pointer",drawingNodeId:c},Zt(w,I)),pt(w),Ca(je)?.drawingNodeId===c},revealPage(c,f){Xe$1();let h=ae$1.pages.find(w=>w.index===c);return h?Ko(h.box.y,h.box.height,f):false},revealParagraph(c,f){Xe$1();let h=jf(ae$1,{paragraphId:c,offset:0});if(!h)return false;let w=ae$1.pages.find(E=>E.index===h.pageIndex);return w?Ko(w.contentBox.y+h.y,h.height,f):false},revealPosition(c,f){Xe$1();let h=jf(ae$1,c);if(!h)return false;let w=ae$1.pages.find(E=>E.index===h.pageIndex);return w?Ko(w.contentBox.y+h.y,h.height,{block:"nearest",...f}):false},setEditable(c){Vu=c,Ys();},selectAll(){let c=he$1(),f=c[0],h=c[c.length-1];!f||!h||pt({anchor:{paragraphId:f,offset:0},head:{paragraphId:h,offset:Et(h).length}});},hyperlinks:Xa,equations:Hr,contentControls:In,formatPainter:Jn,canInsertTable:df,insertTable:AS,canInsertToc:ff$1,insertToc:MS,canRefreshToc:il,canEditTextFormField:()=>ut?.canEdit()??false,editTextFormField:()=>ut?.edit()??false,refreshToc:pf,refreshRefFieldResults:LS,save:()=>By(je,e$1,()=>ii),isInsideToc:c=>ye$1(a.part()).some(f=>f.beginParagraphId===c||f.endParagraphId===c||f.resultParagraphIds.includes(c)),retainSelection:()=>{let c=Symbol("selection-pin");return D.set(c,I),Y=I,$o(),c},releaseSelection:c=>{D.delete(c)&&(ee$1(),$o());},retainedSelection:()=>Y,publishedLayout:()=>ae$1,drawingSelectionIntent:()=>Z,overlayCoordinates:()=>Object.freeze({paintScale:l$2,pageOffsetX:nt?.pageOffsetX??new Map}),commitReviewOps:(c,f)=>{Ze$1();let h=I.head.paragraphId,w=Et(h);return Ne(()=>{if(Ve==="view")return {committed:false,rejected:true,opCount:0,reason:u};if(i&&(f===void 0||!BR.has(f)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(i){let _=i.gateOperations([],we());if(_)return {committed:false,rejected:true,opCount:0,reason:_}}let E=Mb$1(i?.identity.actorId,c);return {committed:E.committed,rejected:!E.committed,opCount:0,...typeof E.reason=="string"?{reason:E.reason}:{}}},()=>{Xe$1(),We.noteModelMoved();let E=he$1();if(E.length===0)return null;let _=vS(I,h,w);return Na(ae$1,E,_)})},revisionDisplayMode:Tt,replacementLanding:tr,applyAutomationOps:(c,f)=>{let h={committed:false,rejected:false,opCount:0},w=f??ni;return Ne(()=>{let E=ir(false);if(E!==null)return h={committed:false,rejected:true,opCount:0,reason:E};let _=null,B=c(W=>{let J=ir(true,[],false);return J===null?Mb$1(i?.identity.actorId,()=>a.ensureHyperlinkRelationship(W,w)):(_=J,null)});return B===null?h={committed:false,rejected:true,opCount:0,reason:_??"this engine will not author that hyperlink target"}:!n$1.reviewModel&&B.some(Tc)?h={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:h=Ye(B,void 0,void 0,w,false)},()=>{Xe$1(),We.noteModelMoved();let E=he$1();return E.length===0?null:Na(ae$1,E,I)}),h},editingMode:()=>Ve,setAuthor:c=>{s!==c&&(_e$1(),s=c,c?.trim()&&Vy(A)&&(A=null,n$1.onChange?.(Ke$1())));},setDrawingStrings:c=>{Lr!==c&&g$1(Lr)!==g$1(c)&&(Lr=c,Ze$1(),xt(false));},setLocale:ju.set,setTranslate:c=>{el!==c&&(el=c,ut?.update());},setTocLabels:c=>{vn=c;},setEditingMode:c=>{Ze$1();let f=Ve!==c;Ve=c,f&&c==="view"&&oe?.exitHeaderFooter(),f&&c==="view"&&Jn.disarm(),Xs(),Ys(),Dd(e$1,Ve),f&&xt(false),A=null,n$1.onChange?.(Ke$1());},revisionAuthors:()=>fn.get().value,setRevisionDisplayMode(c){ii||c===ko||(Ze$1(),ko=c,Zo(true));},hiddenRevisionAuthors:()=>un.hiddenAuthors,setRevisionAuthorVisible(c,f){Zo(un.setVisible(c,f));},setAllRevisionAuthorsVisible(c){Zo(un.setAllVisible(fn.get().value.keys(),c));},showAllRevisionAuthors(){Zo(un.showAll());},setTrackedChangesFilter(c,f){Zo(un.setPredicate(c,f));},collaborationSession:()=>i??null,remotePresenceColor:rf,setShowParagraphMarks:Ga$1.set,setRevisionStyles:c=>{c!==Hn&&(Hn=c,Ze$1(),xt(false));},setRemoteCaretLabelHost:c=>{c!==tt&&(tt=c,ri());},setReviewActivationExclusions(c){Do=c===null?null:new Set(c),Zr(),n$1.onChange?.(Ke$1());},activeReviewKey:()=>{let c=nl();return c?xa$1(c):null},activateReview:(c,f,h)=>{if(lr.clear(),Ju=h?.allowExcluded??false,Ho=f?{key:c,anchor:f.anchor,head:f.head}:{key:c,anchor:I.anchor,head:I.head},f){tl=true;try{pt(f);}finally{tl=false;}return}Zr(),n$1.onChange?.(Ke$1());},activatedReviewKey:()=>ef$1()===null?null:Ho?.key??null,dismissActiveReview:()=>{let c=nl();c&&(lr.add(xa$1(c)),Ho=null,Zr(),n$1.onChange?.(Ke$1()));},navigation:nr,bookmarks:()=>a.bookmarks(),selectedText(){if(Q)return xf(ae$1,Q);let{from:c,to:f}=$n();return bs(ae$1,c,f,he$1())},copyFlavours:()=>HS(),pasteRich:(c,f)=>_S(c,f),armForcePlainPaste:BS,deleteSelection(){let c=Tn();return c.ops.length===0?false:(Ne(()=>Ye(c.ops,ze(),Bn(c.collapseTo)),()=>He(c.collapseTo)),true)},setCellSelection:Yu,layoutSession:()=>P,undo:()=>{if(Ve==="view"){A=u,n$1.onChange?.(Ke$1());return}if(_e$1(),i){i.undo()&&si(null);return}let c=a.packageRevision(),f=a.undo();a.packageRevision()!==c&&si(f);},redo:()=>{if(Ve==="view"){A=u,n$1.onChange?.(Ke$1());return}if(_e$1(),i){i.redo()&&si(null);return}let c=a.packageRevision(),f=a.redo();a.packageRevision()!==c&&si(f);},sectionAtPage:Pe,activeScope:()=>{let c=ge?.activeNoteScope();return c||oe.activeScope()},setActiveScope:c=>(Ze$1(),c.kind==="note"?ge.enterNote(c.id):c.kind!=="body"&&c.kind!=="headerFooter"?false:(ge?.exitNote(),oe.setActiveScope(c))),insertNote:c=>(Ze$1(),ge.insertNote(c)),deleteNote:(c,f)=>ge.deleteNote(c,f),convertNote:(c,f)=>ge.convertNote(c,f),convertAllNotes:c=>ge.convertAllNotes(c),setNoteProperties:c=>ge.setNoteProperties(c),enterNote:(c,f)=>(Ze$1(),ge.enterNote(c,f)),exitNote:()=>(Ze$1(),ge.exitNote()),notePropertiesState:()=>{let c=je.state().selection.head.paragraphId,f=a.packageRevision(),h=a.currentPackage(),w=a.part(),E=yf(h),_=Jf(h,"footnote"),B=Jf(h,"endnote"),W=je.activeScope().kind==="headerFooter",J=je.headerFooterState(),me=J?.rId??null,ie=J?.sectionIndex??null,se=Ee$1;if(se&&se.packageRevision===f&&se.paragraphId===c&&se.bodyPart===w&&se.settingsPart===E&&se.footnotesPart===_&&se.endnotesPart===B&&se.headerFooterOpen===W&&se.headerFooterRId===me&&se.headerFooterSectionIndex===ie)return se.result;let dt=Rv(je,Pt());return Ee$1={packageRevision:f,paragraphId:c,bodyPart:w,settingsPart:E,footnotesPart:_,endnotesPart:B,headerFooterOpen:W,headerFooterRId:me,headerFooterSectionIndex:ie,result:dt},dt},notePreviewText:c=>Cv(a,c),applyTableCommandPlan(c){if(!c.ok)return {ok:false,code:c.code,reason:c.reason};let f=null,h=a.subscribe(w=>{w.caret&&(f=w.caret);});try{let w=ze(),E=c.selection.kind==="adoptCommittedCaret";Ne(()=>Ye(c.ops,w),E?()=>{let _=f;return _?He({paragraphId:_.paragraphId,offset:_.start}):null}:void 0,c.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{h();}return A?{ok:false,code:"invalidArgs",reason:A}:{ok:true,changed:true}},enterHeaderFooter:c=>{Ze$1();let f=oe.enterHeaderFooter(c);if(!f)return f;let h=oe.getActive(),w=h?ae$1.pages[h.pageIndex]:void 0;if(h&&w){let E=h.kind==="header"?w.header:w.footer,_=E?.box.y??(h.kind==="header"?w.box.y:w.box.y+w.box.height-1),B=E?.box.height??1;Ko(_,B,{block:"nearest"});}return f},exitHeaderFooter:()=>(Ze$1(),oe.exitHeaderFooter()),headerFooterState:()=>oe.headerFooterStateStable(a.packageRevision()),...Sv({applyOps:Ye,commit:Ne,deleteSelectionOps:DS,deleteSelectionPlan:()=>Tn(),orderedStart:sl,selectionMark:ze,collapsedAt:He,isHeaderFooterOpen:()=>oe?.getActive()!==null,lastRejection:()=>A}),...Iv({session:a,applyOps:Ye,commit:Ne,storyScope:we,selectionMark:ze,editingMode:()=>Ve,author:()=>s,trackedDate:x,decodePort:()=>So,actorId:()=>i?.identity.actorId}),focus:()=>R.focus({preventScroll:true}),setTableInteractionLabel(c){d.resolve=c;},refreshTableInteractionLabels(){Vo.refreshLabels();},destroy(){if(!ii){ii=true;try{Ws();}finally{M.removeEventListener("selectionchange",hf),R.removeEventListener("pointerdown",kf,{capture:true}),R.removeEventListener("keydown",li,{capture:true}),R.removeEventListener("beforeinput",li,{capture:true}),R.removeEventListener("keydown",vf),R.removeEventListener("beforeinput",If),R.removeEventListener("copy",xf$1),R.removeEventListener("cut",Sf),R.removeEventListener("paste",wf$1),R.removeEventListener("compositionstart",bf),R.removeEventListener("compositionend",yf$1),M.removeEventListener("scroll",Tf,{capture:true}),e$1.ownerDocument.defaultView?.removeEventListener("resize",fl),Lo?.disconnect(),Js=null,ut?.destroy(),dl?.destroy(),Vo.destroy(),nr.destroy(),Eo.destroy(),We.destroy(),R.removeEventListener("contextmenu",qu),R.removeEventListener("click",Zu),R.removeEventListener("pointermove",Lu),R.removeEventListener("pointerleave",Du),it.cancel(),be$1!==null&&clearTimeout(be$1),be$1=null,ce&&ce(),ce=null,Ot.dispose(),f(R),L.destroy(),Rt(),or(),Fo(),Qa(),e$1.replaceChildren();}}}};function si(c){F=null;let f=ut?.restoreAfterHistory();if(!c&&f&&(I=f),We.noteModelMoved(),Xe$1(),!c){pt(Na(ae$1,he$1(),I));return}let h={anchor:{paragraphId:c.paragraphId,offset:c.start},head:{paragraphId:c.paragraphId,offset:c.end}};pt(he$1().includes(c.paragraphId)?h:Na(ae$1,he$1(),h));}function Ko(c,f,h){let w=Kt(e$1);if(!w||w.clientHeight===0)return false;let E=c*l$2+e$1.offsetTop,_=f*l$2,B=h?.offsetPx??24,W=h?.block??"start",J=w.clientHeight;if(W==="nearest"||W==="centerIfNeeded"){let se=E<w.scrollTop,dt=E+_>w.scrollTop+J;if(!se&&!dt)return true}let me=W==="center"||W==="centerIfNeeded"?E-Math.max(0,(J-_)/2):W==="nearest"&&E>w.scrollTop?E+_+B-J:E-B,ie=Math.max(0,w.scrollHeight-J);return w.scrollTo({top:Math.max(0,Math.min(me,ie)),behavior:h?.behavior??"auto"}),ti(),true}let{onSelectionChange:hf,onCompositionEnd:yf$1}=We,bf=(...c)=>{We.adoptBeforeInput(),Ws(),We.onCompositionStart(...c);},dl=null;ut=Dy({locale:ju.get,translate:(c,f)=>el?.(c,f)??c,pagesLayer:R,container:e$1,part:()=>lt(a,I.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(c=I.head.paragraphId)=>hh$1(a.settingsRoot())&&ih$1(lt(a,c)??a.part(),c),selection:()=>I,select:c=>pt(c),editable:()=>Ve==="edit",apply:c=>$y(c,Ne,Ye),save:(c,f)=>qy(c,f,{session:a,commit:Ne,refusal:()=>ir(true,c,false),gate:(h,w)=>i?.gateOperations(h,w)??null,collaborationActive:i!==void 0})},r.initialTextFormInput);let $S=C0(je,n$1),vf=c=>{c.defaultPrevented||We.adoptBeforeInput(),ut?.keydown(c)||$S(c);},{onCopy:xf$1,onCut:Sf,onPaste:wf$1}=E0(je),qS=F0(je,{isComposing:()=>We.isComposing(),insertPlainText:gf$1,onBrowserSelectionFixup:()=>{We.mirrorToDom(),We.noteBrowserSelectionFixup();}}),If=c=>{We.adoptBeforeInput(),qS(c);};M.addEventListener("selectionchange",hf);let ZS=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),kf=c=>{if(c instanceof PointerEvent&&c.button!==0)return;let h=(c.target instanceof Element?c.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");te(h?{kind:"pointer",drawingNodeId:h}:{kind:"none"},true);},li=c=>{if(c instanceof KeyboardEvent&&ZS.has(c.key))return;if((c instanceof KeyboardEvent&&(c.key==="Delete"||c.key==="Backspace")&&!c.altKey&&!c.ctrlKey&&!c.metaKey||c instanceof InputEvent&&(c.inputType==="deleteContentBackward"||c.inputType==="deleteContentForward"))&&Z.kind==="pointer"){let h=Ca(je);if(h!==null){c.preventDefault(),c.stopImmediatePropagation(),te({kind:"none"},true),je.deleteImage(h.drawingNodeId);return}}te({kind:"none"},true);};R.addEventListener("pointerdown",kf,{capture:true}),R.addEventListener("keydown",li,{capture:true}),R.addEventListener("beforeinput",li,{capture:true}),R.addEventListener("keydown",vf),R.addEventListener("beforeinput",If),R.addEventListener("copy",xf$1),R.addEventListener("cut",Sf),R.addEventListener("paste",wf$1),R.addEventListener("compositionstart",bf),R.addEventListener("compositionend",yf$1);let cl=false;function ul(){if(cl)return;cl=true;let c=e$1.ownerDocument.defaultView?.requestAnimationFrame,f=()=>{cl=false,ti();};c?c(f):queueMicrotask(f);}let Tf=c=>{let f=Kt(e$1);!f||c.target!==f||ul();};M.addEventListener("scroll",Tf,{capture:true,passive:true});let fl=()=>{ul();},pl=e$1.ownerDocument.defaultView;pl?.addEventListener("resize",fl,{passive:true}),Lo=typeof pl?.ResizeObserver=="function"?new pl.ResizeObserver(fl):null;function Pf(){if(!Lo)return;let c=Kt(e$1);c!==Js&&(Lo.disconnect(),Js=c,c&&Lo.observe(c));}Pf(),dl=Kb({onTextFormDoubleClick:c=>ut?.doubleClick(c)??false,onTextFormPointerUp:c=>ut?.pointerUp(c),pagesLayer:R,container:e$1,scale:()=>l$2,pageOffsetX:c=>nt?.pageOffsetX.get(c)??0,layout:()=>(Xe$1(),ae$1),measurer:()=>b,selection:()=>I,setSelection:c=>pt(c),cellSelection:()=>Q,setCellSelection:c=>Yu(c),focus:()=>R.focus({preventScroll:true}),onSelectionSettled:()=>Jn.applyIfArmed(),activeHeaderFooter:()=>kh(oe?.getActive()??null),activeNote:()=>{let c=ge?.activeNoteScope();return c?{scopeId:c.id,pageIndex:ge?.activeNotePageIndex()??null}:null},enterHeaderFooter:c=>{Ze$1(),oe?.enterHeaderFooter({rId:c.rId,pageIndex:c.pageIndex,sectionIndex:Pe(c.pageIndex).sectionIndex,kind:c.kind,...c.position?{position:c.position}:{}});},enterNote:(c,f,h)=>{Ze$1(),ge?.enterNote(c,f,h);},exitNote:c=>{Ze$1(),ge?.exitNote(c);},exitHeaderFooter:()=>(Ze$1(),oe?.exitHeaderFooter()),enterEmptyHeaderFooter:(c,f)=>{if(Ve==="view")return;Ze$1();let{sectionIndex:h,sectionStart:w}=Pe(f),E=a.headerFooterResolutionBySection(),_=E[Math.min(h,Math.max(0,E.length-1))],B=ae$1.pages[f]?.pageFieldSource?.pageNumber??f+1,W=_?.evenAndOddHeaders&&B%2===0?"even":_?.titlePage&&f===w?"first":"default",J=ie=>{let se=ie[Math.min(h,Math.max(0,ie.length-1))];return c==="header"?se?.headers:se?.footers},me=J(E)?.get(W)?.rId;if(!me){if(!je.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:h,kind:c,variant:W,...W==="first"?{titlePage:true}:{},...W==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;me=J(a.headerFooterResolutionBySection())?.get(W)?.rId,Xe$1();}me&&oe?.enterHeaderFooter({rId:me,pageIndex:f,sectionIndex:h,kind:c,variant:W});},onContentControlWidget:(c,f)=>mS(c,f),isReadOnlyParagraph:c=>qo(c)!==null},n$1.pointer?{mode:n$1.pointer}:{});let Vo=xb({pagesLayer:R,furnitureLayer:C,scale:()=>l$2,pageOffsetX:c=>nt?.pageOffsetX.get(c)??0,read:()=>({layout:ae$1,storeRevision:a.packageRevision(),selection:I,cellSelection:Q,editingMode:Ve,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:c=>je.applyTableCommandPlan(c),label:c=>d.resolve(c)});if(xt(),Be=true,ri(),i&&(or=i.subscribeStatus(()=>{n$1.onChange?.(Ke$1());})),i&&Br)try{Fo=i.attach(Br);}catch{try{i.destroy();}catch{}}return qr(),Ys(),je.setTableInteractionLabel=c=>{d.resolve=c,Vo.refreshLabels();},je.refreshTableInteractionLabels=()=>{Vo.refreshLabels();},{ok:true,surface:je}}var dn="comments and tracked changes require the pro review module (@docx-editor.dev/pro)";var Xn="suggesting mode needs an author; configure author before enabling it",$R="this document asks for tracked changes, but no author is configured",Ds={mode:null,rejection:null};function fu(e,t){if(e===void 0||e==="view")return Ds;if(e==="edit")return {mode:"editing",rejection:null};let n=pu(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function pu(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:Xn}:{ok:false,code:"unsupported",reason:dn}}function Av(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==Xn||t||n!==null||(n=setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let a=`${Xn}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(qt("suggestingNeedsAuthor",a)),r(`[@docx-editor.dev/core] ${a}`);},0));},dispose(){n!==null&&clearTimeout(n),n=null;}}}function mu(e){return e.viewOnly||e.currentMode!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?Ds:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:$R}}function gu(e,t){return t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function Mv(e,t,n,r,o){let a=fu(e,t),i=e==="view"?"viewing":a.mode??o,s=mu({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:i});s.mode!==null&&(i=s.mode);let l=gu(n,i);return {mode:l===null?i:r,rejection:s.rejection??l?.reason??null,configurationRejection:a.rejection}}function Lv(e){let t=()=>e.placements().filter(s=>s.kind==="revision"&&(s.activatable||s.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(s=>s.kind==="revision")??[],r=()=>e.destroyed()?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.enabled()?e.surface()?{ok:true}:{ok:false,code:"notFound",reason:"no document is open"}:{ok:false,code:"unsupported",reason:dn},o=s=>{if(s.type!=="navigateReviewChange"&&s.type!=="resolveAllReviewChanges"&&s.type!=="setReviewDisplayMode")return null;let l=r();if(!l.ok)return l;if(s.type==="setReviewDisplayMode")return ["all-markup","proposed","original"].includes(s.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(s.type==="navigateReviewChange"&&!["next","previous"].includes(s.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(s.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(s.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(s.type==="navigateReviewChange")return t().length?{ok:true}:{ok:false,code:"notFound",reason:"no visible changes to review"};if(e.viewing())return {ok:false,code:"locked",reason:"the document is open for viewing"};let d=n();return d.length?d.some(u=>u.readOnly)?{ok:false,code:"unsupported",reason:"some changes cannot be accepted or rejected by this editor"}:{ok:true}:{ok:false,code:"notFound",reason:"no changes to review"}};return {can:o,exec:s=>{if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(s.type))return null;e.surface()?.flushPendingInput();let l=o(s);if(!l)return null;if(!l.ok)return l;let d=e.surface();if(s.type==="setReviewDisplayMode")return e.setDisplayMode(s.mode),{ok:true,changed:false};if(s.type==="navigateReviewChange"){let m=t(),g=m.findIndex(S=>S.isActive),x=s.direction==="next"?1:-1,T=g<0?qR(m,d,x):(g+x+m.length)%m.length,b=m[T];return e.activate(b.key,!b.activatable&&b.revisionKind==="format")}if(s.type!=="resolveAllReviewChanges")return null;let u=new Map;for(let m of n()){let g=e.scope(m);u.set(JSON.stringify(g),g);}let p;return d.commitReviewOps(()=>(p=d.session.applyTreeOpsAtomic([...u.values()].map(m=>({scope:m,ops:[{op:s.action==="accept"?"acceptAllRevisions":"rejectAllRevisions"}]}))),p),"revision-resolve"),p?.committed?(e.activate(null),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:typeof p?.reason=="string"?p.reason:"the revisions were refused"}},resolveReviewItem:(s,l)=>{let d=r();if(!d.ok)return d;if(e.viewing())return e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve"),{ok:false,code:"locked",reason:"the document is open for viewing"};e.surface().flushPendingInput();let u=e.placements().find(m=>m.key===s)?.item;if(!u||u.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(u.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let p;return e.surface().commitReviewOps(()=>(p=e.surface().session.applyTreeOps(ZR(u,l,e.surface().session.partFor(e.scope(u))),void 0,void 0,e.scope(u)),p),"revision-resolve"),p?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof p?.reason=="string"?p.reason:"the revision was refused"}}}}function qR(e,t,n){let r=t.state().selection.head,o=t.session.storyParts().find(s=>r.paragraphId.startsWith(`${s.name}#`)),a=o?Ha$2(o):new Map,i=a.get(r.paragraphId);if(i!==void 0)for(let s=n>0?0:e.length-1;s>=0&&s<e.length;s+=n){let l=e[s],d=l.kind==="revision"?l.item.ranges[0]?.start:void 0,u=d?a.get(d.paragraphId):void 0;if(d&&u!==void 0&&(n>0?u>i||u===i&&d.offset>=r.offset:u<i||u===i&&d.offset<=r.offset))return s}return n>0?0:e.length-1}function ZR(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return [];let o=new Set(wa$1(e)),a=new Map;for(let i of mh$1(n)){if(!o.has(i.node.id))continue;let s=m=>i.node.attributes.find(g=>g.namespaceUri===da$1&&g.localName===m)?.value,l=e.addresses.find(m=>m.id===s("id")&&m.author===s("author")&&(m.date??"")===(s("date")??""));if(!l)continue;let d=e.revisionKind==="structural"?void 0:i.node.localName,u=JSON.stringify([l,d]),p=a.get(u);p?p.siteNodeIds.push(i.node.id):a.set(u,{revision:l,localName:d,siteNodeIds:[i.node.id]});}return [...a.values()].map(({revision:i,localName:s,siteNodeIds:l})=>({op:r,revision:i,...s===void 0?{}:{localName:s},siteNodeIds:l}))}function hu(e,t,n,r){return e.type!=="toggleReviewPane"&&e.type!=="toggleParagraphMarks"&&e.type!=="setEditingMode"?null:t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.type==="toggleReviewPane"&&!n?{ok:false,code:"unsupported",reason:dn}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function Nv(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}var KR=e=>ya(e);function Hv(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=Qe(t,KR);for(let o of t.pages){for(let a of [o.header,o.footer])a&&Dv(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)Dv(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function Dv(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 Hs(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 VR(e){return e?.kind==="headerFooter"||e?.kind==="note"}function _v(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function _s(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.exitNote?.(),e.exitHeaderFooter?.());}function Bv(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(!ms(e.layout(),r,o))return a;let i=t.scope.owner;if(i){let s=Hs(e,i,{paragraphId:o,offset:0});if(!s.ok)return s}else _s(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:a}let n={paragraphId:t.blockId,offset:t.start};if(VR(t.scope)){let r=Hs(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"};_s(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 $v(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function yu(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(()=>{$v(e);});return}catch{}$v(e);}function zR(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function jR(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function qv(e){return Zv(e.children)}function Zv(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 UR(e){if(yc$1(e))return Zv(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(...qv(r));return t}function WR(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(g=>r.part==="header"||r.part==="footer"?g.kind===r.part:g.kind==="note"&&gd$1(g.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=qv(s),d;for(let g=0;g<t.path.length;g+=1){let x=t.path[g];if(!Number.isInteger(x)||x<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(d=l[x],!d)return {ok:false,code:"notFound",reason:`block index ${x} is out of range`};g<t.path.length-1&&(l=UR(d));}if(!d||d.kind!=="paragraph"||!Ga(a,d.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let u=(Qh$1(a,d.id)??"").length,p=t.offset??(n==="start"?0:u);if(!Number.isInteger(p)||p<0||p>u)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let m={paragraphId:d.id,offset:p};return {ok:true,selection:{anchor:m,head:m}}}function Bs(e,t,n){if(zR(t))return WR(e,t,n);if(!wt(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=ht(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=sn(i,r,t);if(!s.ok)return s;let l=n==="start"?s.span.start:s.span.end,d={paragraphId:s.span.nodeId,offset:l};return {ok:true,selection:{anchor:d,head:d}}}function $s(e,t){if(!jR(t)){let o=Bs(e,t,"start");if(!o.ok)return o;let a=Bs(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=Bs(e,t.from,"start");if(!n.ok)return n;let r=Bs(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function GR(e){return e.evenPage?"even":e.firstPage?"first":"default"}function Kv(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'"}:GR(e)}function bu(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?Kv(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 XR(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 Ka(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}:XR(n.reason)}function qs(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 Vv(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=Kv(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,s=qs(e,n,r,a)?.rId,l=false;if(!s){let u=Ka(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=qs(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 zv(e,t){let n=bu(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=Ka(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 jv(e,t){let n=bu(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=Ka(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=qs(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function Uv(e,t){let n=bu(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=Ka(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let s=qs(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 Wv(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Ka(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 Gv(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 Xv(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 Yv(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 Qv(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 Jv(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 ex(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 nx(e,t,n){switch(t.type){case "toggleMark":{let r=Jd.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=ec(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:Ji};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:qd};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??qd};break}case "setLineSpacing":e.setParagraphProperty("spacing",As({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...yo("before",t.beforePt),...yo("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,d=a??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,d):Math.min(l,d),a=t.orientation==="landscape"?Math.min(l,d):Math.max(l,d);}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=$s(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 Vv(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return zv(e,t);case "linkHeaderFooterToPrevious":return jv(e,t);case "unlinkHeaderFooterFromPrevious":return Uv(e,t);case "setHeaderFooterOptions":return Wv(e,t);case "insertPageField":return Gv(e,t);case "insertNote":return Xv(e,t);case "deleteNote":return Yv(e,t);case "convertNote":return Qv(e,t);case "convertAllNotes":return Jv(e,t);case "setNoteProperties":return ex(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(!oo(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Ln({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 yu(r.text,r.html),{ok:true,changed:false}}case "cut":{let r=e.copyFlavours();yu(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&&tc(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&wt(t.anchor)?{anchor:t.anchor}:"range"in t&&kr(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Ah(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=JR(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return Ea(t)?ly(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function tx(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 YR(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 QR(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 JR(e,t){let n=ht(e.session,t.head.paragraphId,{kind:"body"}),r=ht(e.session,t.anchor.paragraphId,{kind:"body"});if(!QR(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=YR(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=tx(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:tx(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 rx={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none"};function ox(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:Qh(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`}}function ax(){let e={...rx};return {moved(t,n){let r=ox(t,n),o=os(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=ox(t.state(),t);},reset(){e={...rx};}}}function eC(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 d=n-22;d>=o;d-=1)if(r.getUint32(d,true)===101010256){a=d;break}if(a<0)return false;let i=r.getUint16(a+10,true),s=r.getUint32(a+16,true),l=0;for(let d=0;d<i;d+=1){if(s+46>n||r.getUint32(s,true)!==33639248)return false;if(l+=r.getUint32(s+24,true),l>=t)return true;s+=46+r.getUint16(s+28,true)+r.getUint16(s+30,true)+r.getUint16(s+32,true);}return false}function ix(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||eC(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 sx(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function lx(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function dx(e){return e.kind==="comment"}function cx(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 d=e.openStoryOrder();i=d.get(r.paragraphId)??-1,s=d.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 tC(e){let t=new Map;for(let n of e){let r=n.item;if(!dx(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 nC(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(dx);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 ux(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=nC(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=tC(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,d=false;return e.surface.commitReviewOps(()=>{let u=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(i.id,n),d=l&&e.surface.session.packageRevision()!==u,{committed:d}},"comment-resolve"),l?(d&&e.bump(),{ok:true,changed:d}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function fx(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 px=new WeakMap;function iC(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 sC(e,t){iC(t)||(e.summaries=null);}function lC(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>sC(t,n)));}function gx(e){}function hx(e,t){let n=px.get(e);return n||(n={summaries:null,subscribed:false},px.set(e,n)),lC(e,n),n.summaries||(n.summaries=t()),n.summaries}var dC=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function cC(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function uC(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(wt(t)){let o=sn(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(cC(t)){if(!wt(t.from)||!wt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=sn(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=sn(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 vu(e,t){let n=dC.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=Pr(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=uC(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 fC="http://schemas.microsoft.com/office/word/2010/wordml",pC="http://schemas.microsoft.com/office/word/2012/wordml";function Ar(e){return Cd$1(e)}function Va(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function mC(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===da$1)return t.value}}function xu(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return mC(n)}}function gC(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=hC(t);if(n!==void 0)return n}return "richText"}function hC(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===fC||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===pC)return "repeatingSection"}function Zs(e){let t=xu(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function yC(e,t){if(Zs(Va(t)))return true;let n=Ha$1(e,t.id);for(;n;){if(Ar(n)&&Zs(Va(n)))return true;n=Ha$1(e,n.id);}return false}function wu(e,t){let n=Va(e),r=xu(n,"tag"),o=xu(n,"alias"),a=t?yC(t,e):Zs(n);return {id:e.id,controlType:gC(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var yx=new WeakMap;function bC(e,t){let n=[],r=Ha$1(e,t.id);for(;r;)Ar(r)&&n.push(`${r.id}:${Zs(Va(r))?1:0}`),r=Ha$1(e,r.id);return n.join("|")}function vx(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function vC(e){return Object.freeze(e.map(t=>vx(t)))}function xC(e,t){let n=e.node,r=Va(n),o=bC(t,n),a=yx.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=vx(wu(n,t));return yx.set(n,{properties:r,lockAncestors:o,summary:i}),i}function SC(e){let t=Jc$1(e.root);return gx(t.length),t.map(n=>xC(n,e))}function wC(e){return vC(e.storyParts().flatMap(t=>SC(t)))}function IC(e){return hx(e,()=>wC(e))}function Su(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 kC(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+=Oe(e,l);continue}if(na$1(l)){s=n(l.children,s,a,i+1);continue}if(Ar(l)){let d=s,u=a+1;s=n(Bc$2(l),s,u,i+1),t.push({control:l,start:d,end:s,depth:u});continue}s+=Oe(e,l);}return s};return n(e.children,0,-1,0),t}function Iu(e,t,n){return kC(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>wu(r.control,n))}function ku(e,t){let n=[],r=Ha$1(e,t);for(;r;)Ar(r)&&n.push(wu(r,e)),r=Ha$1(e,r.id);return n.reverse()}function xx(e,t){if(!e)return [];let n=IC(e.session);return t?n.filter(r=>Su(r,t)):n}function Tu(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=lt(e.session,n)??e.session.part(),a=Ga(o,n);if(a&&a.kind==="paragraph"){for(let s of Iu(a,r,o))if(Su(s,t))return s}let i=ku(o,n);for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(Su(l,t))return l}return null}function Pu(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function TC(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function PC(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function RC(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 Ks(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||Ar(n))&&t.push(n);return t}function CC(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...Ks(r.children));return t}function EC(e){return e.kind==="table"?CC(e):Ar(e)?Ks(Bc$2(e)):e.kind==="body"?Ks(e.children):[]}function FC(e,t,n){if(Ar(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of Iu(t,r,e))return {ok:true,controlId:i.id};let a=ku(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 OC(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=RC(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=Ks(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=EC(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=FC(e,o,t.offset);return a.ok?a:{...a,target:t}}function AC(e,t,n){let r=sn(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 d of Iu(a,i,o))return {ok:true,controlId:d.id};let l=ku(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 Sx(e,t){if(t===void 0){let r=Tu(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(PC(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return TC(t)?OC(n,t):wt(t)?AC(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function wx(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 Ix(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 kx(e,t){return {ok:false,code:wx(e),reason:Ix(e),...t!==void 0?{target:t}:{}}}function MC(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 Ru(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function Cu(e,t,n,r){let o=MC(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=vu(t,e);return s.ok?bx(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let a=Sx(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 bx(t,i,a.controlId)}function bx(e,t,n){let r=Vh$1(lt(e.session,n)??e.session.part(),t);return r?{ok:false,code:wx(r),reason:Ix(r)}:{ok:true}}function Tx(e,t,n,r){t?.flushPendingInput();let o=Cu(e,t,n,r);return o.ok?LC(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 LC(e,t){if(t.type==="insertContentControl")return NC(e,t);let n=Sx(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=Pr(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,ht(e.session,n.controlId,{kind:"body"}));return a.rejected?kx(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function NC(e,t){e.flushPendingInput();let n=vu(e,t);if(!n.ok){let d=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...d!==void 0?{target:d}:{}}}let{paragraphId:r,start:o,end:a}=n.span,i=Pr(e.state().selection),s={paragraphId:r,start:o,end:a},l=Px(e,[n.op],i,s,ht(e.session,r,{kind:"body"}));return l.rejected?kx(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}var DC=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Rx(e,t){let n=new Map,r=s=>{if(s===void 0||!DC.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 Cx=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),Ex=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 Fx(e,t){return m(e,t)}function Eu(e,t,n){return n$1(e,t,n)}var HC="The quick brown fox 0123 \u2014 {}#@",_C=["monospace","serif"],BC=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Ax(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(HC).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!BC.test(r))return t.set(r,true),true;let a=false;for(let i of _C){let s=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==s){a=true;break}}return t.set(r,a),a}}var Ox=4;function Mx(e,t,n){let r=new Set,o=[];for(let u of t){let p=u.toLowerCase();r.has(p)||(r.add(p),o.push(u));}let a=u=>new Set(e.slice(0,Math.max(u,0)).map(p=>p.toLowerCase())),i=0;for(let u=0;u<=Ox;u+=1){let p=a(n-i),m=o.filter(x=>!p.has(x.toLowerCase())).length,g=Math.min(m,Ox,Math.floor(n/2));if(g===i)break;i=g;}let s=e.slice(0,Math.max(n-i,0)),l=a(n-i),d=o.filter(u=>!l.has(u.toLowerCase()));return [...s,...d].slice(0,n)}function Lx(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=He$1.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}function Nx(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 Dx(e){let t=e.storyParts().map(n=>n.root);return [...e.symbolFontFamilies(),...p(t),...r(t,e.numberingRoot(),e.stylesRoot(),e.documentThemeFonts())]}var Hx=Object.freeze({installed:0,alias:()=>{},dispose(){}});function $C(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1)t=t*31+n.charCodeAt(r)>>>0;return `docx-embedded-${t.toString(36)}`}function qC(){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 _x(e,t=qC(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return Hx;let a=new Map;for(let d of e){let u=d.request.family,p=a.get(u);p?p.push(d):a.set(u,[d]);}let i=new Map,s=[];if(await Promise.all([...a].map(async([d,u])=>{let p=$C(u.map(g=>g.hash)),m=false;await Promise.all(u.map(async g=>{try{let x=o(p,g.bytes,{weight:String(g.request.weight),style:g.request.style});await x.load(),r.add(x),s.push(x),m=!0;}catch{}})),m&&i.set(d,p);})),s.length===0)return Hx;for(let d of n){if(i.has(d.from.family))continue;let u=i.get(d.to.family);u!==void 0&&i.set(d.from.family,u);}let l=false;return {installed:s.length,alias:d=>l?void 0:i.get(d),dispose(){if(!l){l=true;for(let d of s)try{r.delete(d);}catch{}}}}}var za=.1,ja=5;var bo={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},ZC={type:"fit",fit:"pageWidth"},Vs={type:"fixed"};function zs(e){return e==="auto"?bo:!e||typeof e!="object"?null:e.type==="fixed"?Vs:e.type==="fit"&&e.fit==="pageWidth"?js(e,bo)?bo:e:null}function js(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 vo(e){return e.type==="fit"}function $x({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)?Bx(r):.1,l=Number.isFinite(o)?Bx(o):5,d=Math.floor(i/t*100)/100;return Math.min(Math.max(d,s),Math.max(l,s))}function Bx(e){return Math.min(Math.max(e,.1),5)}function KC(e){let t=Kt(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 qx(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(!vo(l))return;let d=e.container();if(!d)return;let u=KC(d);if(u===null)return;let p=e.pageWidthPx();if(p===null)return;o=e.pageWidthTwips();let m=$x({availableWidthPx:u,pageWidthPx:p,...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 d=Kt(l);d&&(n=d,typeof ResizeObserver<"u"&&(t=new ResizeObserver(s),t.observe(d)),i());},refit:i,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function Kx(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=zs(e.zoomMode??(n!==null?Vs:"auto"))??bo;function a(l,d){if(l===r)return d?.(),true;let u=t.surface();return u&&!Ov(u,l*(96/72))?false:(r=l,d?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=Vs,s.detach();}let s=qx({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:()=>{vo(o)&&s.attach();},detach:()=>s.detach(),refit:()=>s.refit(),refitIfPageResized:()=>s.refitIfPageResized(),setZoom(l){if(!Number.isFinite(l)||l<.1||l>5)return {ok:false,code:"invalidArgs",reason:`zoom must be between ${.1} and ${5}, got ${l}`};let d=vo(o);return l===r?d?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(l,d?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let d=zs(l);return d?js(d,o)?{ok:true,changed:false}:(o=d,vo(d)?s.attach():s.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(l)}`}}}}function Zx(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function Vx(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:Zx(r.box),contentBox:Zx(r.contentBox)})):[]}}}var zx=new Map;function jx(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 Fu(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 Ux(e){let t=Wg$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,a==="en"?void 0:locales[a]),a);return {locale:t,labels:{title:i("toolbar.tableOfContents")}}}function Wx(e){let t=e.mode,n=e.translate,r=n?i$1(n):h,o=Ux(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:a=>fu(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=Ux(a);return o.locale===i.locale?null:(o=i,o.labels)}}}function Gx(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 UC=Object.freeze({kind:"body"}),WC=Object.freeze([]);function GC(e$2){let t$1=Wx(e$2),n=Pc(e$2.author),r=e$2.container??null,o=a$3(e$2.modules),a$2=sx(o),i=o.review!==null,s=null,l=new WeakMap,d$1=ix({mount:v=>en(v),scheduled:()=>{he(),Te();}}),u=t$1.mode()==="view"?"viewing":"editing",p=null,m=false,g=gs(),x=jx(e$2.revisionStyles),T=e(),b=false,S=null,P=()=>({reviewEnabled:i,hasAuthor:!!n}),O=false,N=null,M=Av({stillMissing:()=>!I&&n===void 0&&tr(null)===Xn,emit:v=>kt(v)}),R=t$1.openingModeDecision(P());R.mode!==null&&(u=R.mode),R.rejection!==null&&(S=R.rejection),M.report(R.rejection);let y=null,q=null,k=null,C=null,L=ax(),H={kind:"none"},U=Fu({}),G=Fu({}),I=false,Z,te,Q=null;function A(){Q?.dispose(),Q=null;}let $=0,z,X=()=>typeof e$2.fonts=="function"?z:e$2.fonts,Y=-1,D=false,ee=null,ne=v=>(ee||(ee=Ax(r?co(r.ownerDocument):null)),ee(v)),fe=new Set,F=v=>fe.has(v.toLowerCase())||Q?.alias(v)!==void 0,K=()=>!y||D?WC:Lx(y.session.renderedFontFamilies(),F,ne),j=0,le=null,Se,de=null,oe=-1,ge=0,Ee=-1,we=false,qe="all-markup",Pe$1=Nv(v=>{y?.setShowParagraphMarks(v),he(),Te();});function he(){j+=1;}let Ge={change:new Set,selectionChange:new Set,error:new Set};function kt(v){for(let V of [...Ge.error])V(v);}function Ae(v){for(let V of [...Ge.change])V(v);}function Te(){if(Ge.selectionChange.size===0)return;let v=vn();for(let V of [...Ge.selectionChange])V(v);}function bt(){C?.(),C=null,y?.destroy(),y=null,L.reset(),ge+=1;}let at=Kx(e$2,{container:()=>r,surface:()=>y,bump:he,emitSelectionChange:Te}),Yn=()=>at.scale();function en(v,V,re){if(re??=l.get(v),l.delete(v),!r){s=v,re&&l.set(v,re),k=null,he();return}bt();let be=g.stateKey,ce=uu(r,v,{scale:Yn(),showParagraphMarks:Pe$1.get(),onToggleParagraphMarks:Pe$1.toggle,defaultFontFamily:e$1(X()),translate:t$1.translate(),drawingStrings:t$1.drawingStrings(),locale:t$1.locale(),...n?{author:n}:{},...x.current()!==void 0?{revisionStyles:x.current()}:{},reviewAuthorSlots:T,revisionAuthorVisibility:g,initialDrawingSelectionIntent:H,initialSelection:V,initialTextFormInput:re,editingMode:u==="suggesting"?"suggest":u==="viewing"?"view":"edit",revisionDisplayMode:i?qe:"proposed",...o.review?{reviewModel:{...o.review,collectReviewItems:Ie=>o.review.collectReviewItems(o.customNodes.length>0?{...Ie,customNodes:o.customNodes,...o.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:a$2}:{}}:Ie)}}:{},...Z?{measurer:Z,...te?{producer:te}:{}}:{},...Q?{fontAlias:Q.alias}:{},...e$2.tableInteractionLabel?{tableInteractionLabel:e$2.tableInteractionLabel}:{},...e$2.imageDecodePort?{imageDecodePort:e$2.imageDecodePort}:{},...o.collaboration?{collaborationModel:o.collaboration}:{},onHyperlinkPopover:Ie=>U.current().onPopover?.(Ie),onRequestHyperlink:()=>U.current().onRequest?.(),onEquationPopover:Ie=>G.current().onPopover?.(Ie),onTrackedChange:()=>{we||(we=true,he(),Te());},tocLabels:t$1.tocLabels(),onChange:Ie=>{if(!y)return;he();let ke=i&&qe!==y.revisionDisplayMode();ke&&(qe=y.revisionDisplayMode());let Oe=be!==g.stateKey||ke;be=g.stateKey,!(!Oe&&!L.moved(Ie,y))&&Te();}});if(!ce.ok){k=ce.detail?`${ce.reason}: ${ce.detail}`:ce.reason,he(),kt(qt(ce.reason,`failed to open document: ${k}`));return}k=null,y=ce.surface,we=i&&y.session.reviewItems().length>0,L.adopt(y),N!==null?Hr(N,false):Xa(),lx(y,o),ge+=1,y.setEditable(u!=="viewing"),q!==null&&y.setRemoteCaretLabelHost(q),p!==null&&y.setReviewActivationExclusions(p),C=ce.surface.session.subscribe(Ie=>{let ke={revision:ce.surface.session.packageRevision(),created:Ie.created,deleted:Ie.deleted,dirty:Ie.dirty};at.refitIfPageResized(),he(),Ae(ke);}),at.attach(),he(),Ae({revision:y.session.packageRevision()}),Te(),Y!==$&&(Y=$,So($,y));}function xo(v){if(d$1.cancel(),l=new WeakMap,we=false,$+=1,T=e(),g.showAll(),Z=void 0,te=void 0,z=void 0,fe=new Set,A(),D=false,r){let V=Kt(r);V&&(V.scrollTop=0,V.scrollLeft=0);}r&&d$1.shouldYield(v)?d$1.schedule(v):en(v);}function bn(v){(v.code==="wasmUnavailable"||v.cause instanceof t&&v.cause.code==="unsupportedRuntime")&&!e$2.onFontError&&Ge.error.size===0&&Vm(v);try{e$2.onFontError?.(v);}catch{}kt(v);}async function So(v,V){let re=e$2.fonts,be=V.session.embeddedFonts();if(!(!re&&be.length===0)){D=true,he();try{let ce=typeof re=="function"?a$6(await re({families:Mx(V.session.documentFonts(),Dx(V.session),b$2),defaultFamily:e$1(X())})):re;if(I||v!==$){v===$&&(D=!1);return}if(z=ce,!ce&&be.length===0){D=!1,he();return}let Ie=(ce&&"maxFontBytes"in ce?ce.maxFontBytes:void 0)??a$1,ke=Fx(ce?.sources??[],Ie),Oe=ke.sources;for(let Be of ke.dropped)bn(Cx(Be));let pe=Eu(be,Oe,Ie),Ce=!1,Me=()=>{if(!Ce){Ce=!0;for(let Be of pe.dropped)bn(Ex(Be));}},$e=d$3({epoch:v,...ce,sources:Oe},pe);if($e.sources.length===0){Me(),D=!1,he(),ce&&bn(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let _e=await xa($e),_n=()=>!I&&v===$?!1:(J(_e),v===$&&(D=!1),!0);if(_n())return;let _r=Be=>{Me(),Be&&J(Be),D=!1,he();},it=(Be,tt)=>{let At=new Set;for(let Rt of tt.sources??[]){let Ct=Be.fonts.resolve(Rt.request);Ct instanceof d&&(bn(Qr(Ct)),At.add(g$2(Rt.request)));}return At},rr=it(_e,$e);try{if(rr.size>0){let Be=Oe.filter(Xe=>!rr.has(g$2(Xe.request))),tt=Be.length!==Oe.length;tt&&(pe=Eu(be,Be,Ie));let At=pe.sources.filter(Xe=>tt||!rr.has(g$2(Xe.request))),Rt=_e;if($e=d$3({epoch:v,...ce,sources:Be},{sources:At}),$e.sources.length===0)return _r(Rt);if(_e=await xa($e),J(Rt),_n())return;let Ct=it(_e,$e);if(Ct.size>0){let Xe=Be.filter(Ze=>!Ct.has(g$2(Ze.request))),Us=pe.sources.filter(Ze=>!Ct.has(g$2(Ze.request))),Ja=_e;if($e=d$3({epoch:v,...ce,sources:Xe},{sources:Us}),$e.sources.length===0)return _r(Ja);if(_e=await xa($e),J(Ja),_n())return}}}finally{Me();}let Qa=$e.sources.map(Be=>{let tt=_e.fonts.resolve(Be.request);return tt instanceof d||tt.id!==Be.id?null:{request:Be.request,id:tt.id,bytes:tt.bytes,hash:tt.hash,faceIndex:tt.faceIndex}}).filter(Be=>Be!==null),Br=await _x(Qa,void 0,$e.substitutions??[]);if(I||v!==$){Br.dispose(),_n();return}A(),Q=Br,fe=Nx(Qa,$e.substitutions??[]);let Fo=Ke(Yn(),{context:r?co(r.ownerDocument):null,...Q?{fontAlias:Q.alias}:{}}),or=new Map;if(Z=Ve(_e,{resolveFont:Be=>{let tt=Be.fontFamily??$e.defaultFont.family;if(tt.trim().length===0)return null;let At={family:tt,weight:Be.bold?700:400,style:Be.italic?"italic":"normal"},Rt=g$2(At);if(or.has(Rt))return or.get(Rt)??null;let Ct;try{Ct=_e.fonts.resolve(At);}catch{return or.set(Rt,null),null}let Xe=Ct instanceof d?null:Ct;return or.set(Rt,Xe),Xe},fallback:Fo.measurer}),te=`shaped:${_e.operation.extensionFingerprint}+algorithm:${_e.operation.shapingHash}+producer:${_e.operation.producerVersion}+fallback:${Fo.producer}@scale:${Yn()}`,D=!1,y){y.flushPendingInput();let Be=y.session.save(),tt=r?fs(r):void 0,At=y.state().selection;H=y.drawingSelectionIntent();let Rt=r?.ownerDocument.activeElement,Ct=!!Rt&&!!r?.contains(Rt);try{en(Be,At,tt);}catch(Xe){Z=void 0,te=void 0,y||(s=Be,en(Be,At,tt)),bn(Qr(Xe));}Ct&&(y?.focus(),y?.setSelection(At)),H={kind:"none"};}else he();}catch(ce){if(I||v!==$)return;D=false,he(),bn(Qr(ce));}}}let Ot=Yd();function Lr(){let v=y?.state()??null;return {scope:y?.activeScope?.()??UC,isLoading:k===null&&y===null&&s===null&&!d$1.isScheduled(),isOpening:d$1.isScheduled(),parseError:k,editable:y!==null&&y.session.editable&&t$1.mode()!=="view"&&u!=="viewing",zoom:at.zoom(),zoomMode:at.mode(),selection:gc(y),selectionCollapsed:v===null||v.selection.anchor.paragraphId===v.selection.head.paragraphId&&v.selection.anchor.offset===v.selection.head.offset,formatting:dy(y),table:bc(y),tocContext:Ot(v?.contextTocId??null),image:gn(y),page:{current:yc(y),total:hc(y)},canUndo:v?.canUndo??false,canRedo:v?.canRedo??false,pageSetup:mc(y),reviewPaneOpen:we,showParagraphMarks:Pe$1.get(),reviewDisplayMode:y&&i?y.revisionDisplayMode():qe,hasReviewContent:y?.session.hasReviewContent()??false,hiddenReviewAuthors:g.hiddenAuthorList,collaborationStatus:v?.collaborationStatus??"inactive",editingMode:u,lastRejection:S??v?.lastRejection??null,fontSubstitutions:K(),formatPainter:v?.formatPainter??es}}function vn(){if(le&&Ee===j)return le;let v=le,V=n===Se;Se=n;let re=y?.state().selection??null,be=os(re,de);de=re;let ce=y?.session.packageRevision()??-1,Ie=ce===oe;oe=ce;let ke=Lr(),Oe=ke;if(v){let pe=Ud(ke.formatting,v.formatting)?v.formatting:ke.formatting,Ce=Wd(ke.page,v.page)?v.page:ke.page,Me=Gd(ke.pageSetup??null,v.pageSetup??null)?v.pageSetup:ke.pageSetup,$e=Xd(ke.selection,v.selection)?v.selection:ke.selection,_e=ny(ke.image,v.image)?v.image:ke.image,_n=v.fontSubstitutions!==void 0&&ke.fontSubstitutions!==void 0&&v.fontSubstitutions.length===ke.fontSubstitutions.length&&ke.fontSubstitutions.every((_r,it)=>v.fontSubstitutions[it]===_r)?v.fontSubstitutions:ke.fontSubstitutions;Oe={...ke,formatting:pe,page:Ce,pageSetup:Me,selection:$e,image:_e,fontSubstitutions:_n},Qd(Oe,v)&&be&&Ie&&V&&(Oe=v);}return le=rs(Oe),Ee=j,le}if(e$2.document){let v=nc(e$2.document);v?xo(v):(k=rc(e$2.document),kt(qt("unsupported",k)));}let Ua=Gy({surface:()=>y,activeKey:fn,paneOpen:()=>we,selectionAnchor:()=>Po()?.anchorY??null,authorFilterKey:()=>g.stateKey});function cn(v){return v.kind==="revision"?v.ranges[0]??null:v.range}function wo(v){return cn(v)===null?false:!(v.kind==="revision"&&p!==null&&p.includes(v.revisionKind))}let Wa=Hv(),Io=new WeakMap;function ko(v){let V=Io.get(v);if(V)return V;let re=new Map;for(let be of v.pages)for(let ce of [be.footnotes,be.endnotes])if(ce)for(let Ie of ce.notes)for(let ke of za$1(Ie.fragments))for(let Oe of Pa$1(ke))re.has(Oe)||re.set(Oe,Ie.scopeId);return Io.set(v,re),re}function Tt(v){let V=cn(v)?.partName;if(!V||!y||V===y.session.part().name)return null;for(let re of y.session.headerFooterResolutionBySection())for(let be of ["header","footer"]){let ce=be==="header"?re.headers:re.footers;for(let Ie of ce.values())if(Ie.partName===V)return {kind:be,rId:Ie.rId}}return null}function un(v){let V=cn(v),re=y?.publishedLayout();return !V||!re?null:ko(re).get(V.start.paragraphId)??null}function Pt(v){let V=cn(v)?.partName;if(!V||!y)return null;for(let re of ["footnote","endnote"])if(Jf(y.session.currentPackage(),re)?.name===V)return {kind:"notesPart",noteKind:re};return null}function Nr(v){let V=Tt(v);return V!==null?{kind:"headerFooter",rId:V.rId}:Pt(v)??{kind:"body"}}let xn=()=>`${new Date().toISOString().slice(0,19)}Z`,To=new WeakMap;function Dr(v){let V=To.get(v);if(V)return V;let re=new Map;for(let[be,ce]of Ra$1(v).entries())re.set(ce,be);return To.set(v,re),re}function Qn(){return cx({surface:y,bodyOrder:()=>{let v=y?.publishedLayout();return v?Dr(v):new Map},openStoryOrder:Hn})}function Dn(){let v=y?.activeScope();if(v?.kind==="headerFooter")return {kind:"headerFooter",rId:v.rId};if(v?.kind==="note"){let V=Zc$1(v.id);if(V)return {kind:"notesPart",noteKind:V.noteKind}}return {kind:"body"}}function ae(v){if(!y)return {kind:"body"};let V=v.slice(0,v.indexOf("#"));if(V.length===0||V===y.session.part().name)return {kind:"body"};for(let re of y.session.headerFooterResolutionBySection())for(let be of [re.headers,re.footers])for(let ce of be.values())if(ce.partName===V)return {kind:"headerFooter",rId:ce.rId};for(let re of ["footnote","endnote"])if(Jf(y.session.currentPackage(),re)?.name===V)return {kind:"notesPart",noteKind:re};return Dn()}function Hn(){if(!y)return new Map;let v=Dn();if(v.kind==="body")return new Map;let V=new Map;for(let[re,be]of y.session.paragraphIdsIn(v).entries())V.set(be,re);return V}function Ga(v){if(v.kind==="revision"){let re=v.ranges;if(re.length===0)return null;let ce=v.revisionKind==="replace"||v.revisionKind==="insert"||v.revisionKind==="delete"?re[re.length-1]:re[0];return {start:re[0].start,end:ce.end}}let V=cn(v);return V?{start:V.start,end:V.end}:null}function Po(){if(y&&y.activatedReviewKey()!==null)return null;let v=Qn(),V=y?.publishedLayout();if(!v||!V)return null;let re=Wa(V).get(v.from.paragraphId);return re?{pageIndex:re.pageIndex,anchorY:re.contentY+Pe(re,v.from.paragraphId,v.from.offset)}:null}function fn(){return y?.activeReviewKey()??null}function Sn(v){if(!i)return [];let V=Xy(y?.session.reviewItems()??[],g),re=v?.excludeRevisionKinds;if(re&&re.length>0){let pe=new Set(re);V=V.filter(Me=>Me.kind!=="revision"||!pe.has(Me.revisionKind));let Ce=new Set(V.filter(Me=>Me.kind==="revision").map(Me=>Me.id));V=V.map(Me=>{if(Me.kind!=="comment"||Me.parentRevisionId===void 0||Ce.has(Me.parentRevisionId))return Me;let{parentRevisionId:$e,..._e}=Me;return _e});}let be=v?.placement!==false,ce=null;if(be&&V.length>0){let pe=y?.publishedLayout()??null;pe&&(ce=Wa(pe));}let Ie=fn(),ke=pe=>{let Ce=Tt(pe);return Ce===null?1:Ce.kind==="header"?0:2},Oe=V.map((pe,Ce)=>({item:pe,position:Ce,pageIndex:ce?Re(pe,ce)?.pageIndex??null:null,group:ke(pe)}));return Oe.sort((pe,Ce)=>{let Me=pe.pageIndex??Number.MAX_SAFE_INTEGER,$e=Ce.pageIndex??Number.MAX_SAFE_INTEGER;return Me!==$e?Me-$e:pe.group!==Ce.group?pe.group-Ce.group:pe.position-Ce.position}),Oe.map(({item:pe})=>{let Ce=xa$1(pe),Me=ce?Re(pe,ce):null,$e={key:Ce,id:pe.id,...Ya(pe)!==void 0?{date:Ya(pe)}:{},activatable:wo(pe),anchorY:Me?.y??null,pageIndex:Me?.pageIndex??null,isActive:Ce===Ie};return pe.kind==="comment"?{...$e,kind:"comment",author:pe.comment.author,initials:va(pe.comment),text:ua(pe.comment),resolved:pe.resolved,...pe.parentId!==void 0?{parentId:pe.parentId}:{},...pe.parentRevisionId!==void 0?{parentRevisionId:pe.parentRevisionId}:{},replyIds:pe.replyIds,readOnly:false,item:pe}:pe.kind==="revision"?{...$e,kind:"revision",revisionKind:pe.revisionKind,author:pe.author,initials:Ky(pe.author),text:pe.text,...pe.replacedText?{replacedText:pe.replacedText}:{},replyIds:pe.replyIds,readOnly:pe.readOnly,item:pe}:{...$e,kind:"custom",author:"",initials:"",text:pe.detail??pe.text,replyIds:[],readOnly:true,item:pe}})}function Ro(){return y?.session.trackingSettings()??sg$1}function Jn(v=u,V=b){let re=Ro();return mu({...P(),viewOnly:t$1.mode()==="view",hostChoseMode:t$1.mode()!==void 0,readerChoseMode:V,currentMode:v,trackRevisions:re.trackRevisions,restrictedToTrackedChanges:re.restrictedToTrackedChanges})}function er(v){N=null,u=v,y?.setEditingMode(v==="suggesting"?"suggest":v==="viewing"?"view":"edit"),y?.setEditable(v!=="viewing");}function tr(v){return v!==null?v:u==="suggesting"&&n===void 0?Xn:O?Xn:b?null:t$1.openingModeDecision(P()).rejection}function Xa(){let v=Jn();S=tr(v.rejection),v.mode==="suggesting"&&er("suggesting");}function Hr(v="editing",V=true){if(d$1.isScheduled()){N=v;return}N=null;let re=Mv(t$1.mode(),P(),Ro(),u,v);re.mode!==u&&er(re.mode),S=tr(re.rejection),M.report(re.configurationRejection),V&&(he(),Te());}function Co(v){return t$1.mode()==="view"&&v!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(v==="suggesting"?pu(P()):null)??gu(Ro(),v)}function Ya(v){return v.kind==="comment"?v.comment.date:v.kind==="revision"?v.date:void 0}let nr=Lv({surface:()=>y,enabled:()=>i,destroyed:()=>I,viewing:()=>u==="viewing",placements:()=>Sn(),scope:Nr,activate:(v,V)=>{m=V??false;try{return vt.setActiveReviewItem(v)}finally{m=false;}},setDisplayMode:v=>{qe=v,y?.setRevisionDisplayMode(v),he(),Te();}}),{resolveReviewItem:Eo}=nr,vt={get mountGeneration(){return ge},get surface(){return y},setHyperlinkChrome:U.push,setEquationChrome:G.push,stateVersion:()=>j,fontMeasurement:()=>({measurer:Z?"shaped":"fixed",resolving:D,...Z&&te?{producer:te}:{}}),attach(v){if(I){kt(qt("destroyed","this editor was destroyed; create a new instance to remount"));return}if(y&&r===v)return;if(y){y.flushPendingInput(),s=y.session.save();let be=r?fs(r):void 0;be&&l.set(s,be),bt();}let V=d$1.cancel();V&&(s=V),at.detach(),r=v,ee=null;let re=s;s=null,re&&d$1.shouldYield(re)?d$1.schedule(re):re?en(re):he();},detach(){if(I)return;at.detach();let v=d$1.cancel();if(y){y.flushPendingInput(),s=y.session.save();let V=r?fs(r):void 0;V&&l.set(s,V),bt();}v&&(s=v),r=null,ee=null,he();},load(v){let V=nc(v);if(!V){kt(qt("unsupported",rc(v)));return}xo(V);},save(){return d$1.flush(),_y(y,r,()=>y)},getDocumentHandle(){return Object.freeze({revision:y?.session.packageRevision()??0})},exec(v,V){d$1.flush();let re=hu(v,I,i,Co);if(I&&re&&!re.ok)return re;if(v.type==="setEditingMode"){let Ce=Co(v.mode);return Ce!==null?(Ce.reason===Xn&&(O=true,S=Ce.reason,M.report(Ce.reason),he(),Te()),Ce):(b=true,O=false,S=null,er(v.mode),he(),Te(),{ok:true,changed:false})}if(v.type==="toggleParagraphMarks")return Pe$1.toggle(),{ok:true,changed:false};if(v.type==="toggleReviewPane")return i?(we=!we,he(),Te(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:dn};let be=nr.exec(v);if(be)return be;if(Pu(v))return Tx(v,y,Ru(u),V);let ce=Ta(v);if(u==="viewing"&&ce.supported&&ce.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Ie=Ma(v,y,t$1.modeForGate(),V);if(!Ie.ok)return Ie.refusal;let ke=y,Oe=ke.session.packageRevision(),pe=nx(ke,v,{...Ie.tablePlan?{admittedTablePlan:Ie.tablePlan}:{},editor:vt});return pe||{ok:true,changed:ke.session.packageRevision()!==Oe}},can(v,V){if(v.type==="insertImage"||v.type==="replaceImage"){if(I)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(V?.scope){let ke=Ma(v,y,t$1.modeForGate(),V);if(!ke.ok)return ke.refusal}return sy(v,y)}let re=hu(v,I,i,Co);if(re)return re;let be=nr.can(v);if(be)return be;if(Pu(v))return Cu(v,y,Ru(u),V);let ce=Ta(v);if(u==="viewing"&&ce.supported&&ce.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Ie=Ma(v,y,t$1.modeForGate(),V);if(!Ie.ok)return Ie.refusal;if(v.type==="proposeInsertion"||v.type==="proposeDeletion"||v.type==="proposeReplacement"){if(!(v.author??n??"").trim())return {ok:false,code:"invalidArgs",reason:`${v.type} requires a non-empty author`};let Oe=v.target===void 0?{ok:true,selection:y.state().selection}:$s(y,v.target);if(!Oe.ok)return Oe;let{anchor:pe,head:Ce}=Oe.selection,Me=pe.paragraphId===Ce.paragraphId&&pe.offset===Ce.offset,$e=v.type==="proposeReplacement"&&v.target===void 0&&y.state().cellSelection!==null;if(v.type!=="proposeInsertion"&&Me&&!$e)return {ok:false,code:"invalidArgs",reason:`${v.type} needs a non-collapsed selection`}}if(Ea(v)&&dc(v)){let ke=Fa(vt);if(ke){let Oe=cc(vt,v,ke);if(Oe)return Oe}}return {ok:true}},isActive(v){if(v.type==="toggleParagraphMarks")return Pe$1.get();if(v.type==="setReviewDisplayMode")return qe===v.mode;if(v.type==="toggleReviewPane")return we;if(v.type==="setEditingMode")return u===v.mode;let V=y?vn().formatting:null;if(!V)return false;switch(v.type){case "toggleMark":switch(v.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===(v.align==="justify"?"both":v.align);case "toggleList":return y?.isListActive(v.kind)??false;default:return false}},getDocumentStyles:()=>y?.session.documentStyles()??[],getDocumentFonts:()=>y?.session.documentFonts()??[],getAvailableFonts:()=>Rx(X(),y?.session.documentFonts()??[]),getDocumentThemeColors:()=>y?.session.documentThemeColors()??[],getOutline:()=>y?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>my(y?vn().formatting:null),findMatches:(v,V)=>y?.session.findText(v,{...V?.matchCase!==void 0?{matchCase:V.matchCase}:{},...V?.wholeWord!==void 0?{wholeWord:V.wholeWord}:{},stories:_v(y,u)}).matches??[],selectMatch(v){return d$1.flush(),y?Bv(y,v):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>vn().image,getSelectedTable:()=>py(y),getTableCellSelection:()=>{let v=y?.state().cellSelection;return v?{tableId:v.tableId,rows:v.rows,columns:v.columns,cellIds:v.cellIds}:null},setTableInteractionLabel(v){y?.setTableInteractionLabel(v);},canExecuteImageCommand(v,V){if(I)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(V?.scope){let re=Ma(v,y,t$1.modeForGate(),V);if(!re.ok)return re.refusal}return uc(v,y)},executeImageCommand(v){return I?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):fc(vt,v)},getPageSetup:()=>mc(y),getWatermark:()=>null,getTrackedChanges:()=>(y?.session.reviewItems()??[]).filter(v=>v.kind==="revision").map(v=>{let V=Tt(v);return {id:v.id,kind:v.kind==="revision"?v.revisionKind:"revision",...v.kind==="revision"&&v.author?{author:v.author}:{},story:V!==null?V.kind:Pt(v)?.noteKind??"body"}}),getReviewItems:v=>Sn(v),getCustomNodeDefinitions:()=>o.customNodes,reportCustomNodeDiagnostic:a$2,addComment(v,V){if(!i)return {ok:false,code:"unsupported",reason:dn};y?.flushPendingInput();let re=Qn();if(!re||!y)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let be=(V??n??"").trim();if(be.length===0||v.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let ce=null;return y.commitReviewOps(()=>(ce=y.session.replyToComment(null,{paragraphId:re.from.paragraphId,start:re.from.offset,end:re.to.offset,...re.to.paragraphId===re.from.paragraphId?{}:{endParagraphId:re.to.paragraphId}},v,be,xn(),ae(re.from.paragraphId)),{committed:ce!==null}),"comment-add"),ce===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>Po(),isReviewPaneOpen:()=>we,getEditingMode:()=>u,getReviewAuthors:()=>x.authorsFor(y?.revisionAuthors()??zx),...Yy(g,{enabled:i,surface:()=>y,notify:()=>{he(),Te();}}),setTrackedChangesFilter(v,V){if(y)return y.setTrackedChangesFilter(v,V);g.setPredicate(v,V)&&(he(),Te());},getConfiguredAuthor:()=>n??null,setAuthor(v){let V=Pc(v);if(n!==V){if(n=V,y?.setAuthor(n),n!==void 0&&O)O=false,b=true,er("suggesting");else if(!b){let re=N??u;Hr(t$1.mode()===void 0?re:"editing");return}S=tr(null),M.report(S),he(),Te();}},setMode(v){t$1.setMode(v)&&(b=false,O=false,Hr());},...Gx(t$1,{surface:()=>y,bump:he,emitSelectionChange:Te}),presenceColorFor:v=>y?.remotePresenceColor(v)??"var(--doc-accent)",collaborationSession:()=>y?.collaborationSession()??null,getReviewAuthorStyle:v=>x.styleFor(v),setRemoteCaretLabelHost(v){q=v,y?.setRemoteCaretLabelHost(v);},setRevisionStyles(v){x.set(v),y?.setRevisionStyles(v),he(),Te();},setEditingMode:v=>vt.exec({type:"setEditingMode",mode:v}),getReviewRevision:()=>Ua(),setActiveReviewItem(v,V){if(v===null)return y?.dismissActiveReview(),he(),Te(),{ok:true,changed:false};if(!y)return {ok:false,code:"notFound",reason:"no document is open"};y.flushPendingInput();let be=Sn().find(Oe=>Oe.key===v)?.item;if(!be)return {ok:false,code:"notFound",reason:"no review item with that key"};let ce=cn(be);if(!ce)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!wo(be)&&!(m&&be.kind==="revision"&&be.revisionKind==="format"))return {ok:false,code:"unsupported",reason:`review items of kind '${be.revisionKind}' are excluded from activation`};let Ie=be?Tt(be):null,ke=Ie===null&&be?un(be):null;if(Ie!==null||ke!==null){let Oe=Ie!==null?{kind:"headerFooter",rId:Ie.rId,furnitureKind:Ie.kind}:{kind:"note",id:ke},pe=Hs(y,Oe,ce.start);if(!pe.ok)return pe}else {y.exitNote?.(),y.exitHeaderFooter?.();let Oe=Ga(be)??ce,pe={paragraphId:Oe.start.paragraphId,offset:Oe.start.offset};y.activateReview(v,{anchor:pe,head:pe},{allowExcluded:m});let Ce=V?.reveal??"centerIfNeeded";Ce!==false&&y.revealPosition?.(Oe.start,{block:Ce});}return (Ie!==null||ke!==null)&&y.activateReview(v,void 0,{allowExcluded:m}),he(),Te(),{ok:true,changed:false}},setReviewActivationExclusions(v){p=v===null?null:[...v],y?.setReviewActivationExclusions(p);},acceptReviewItem:v=>Eo(v,"accept"),rejectReviewItem:v=>Eo(v,"reject"),setCommentResolved(v,V){return ux({reviewEnabled:i,editingMode:u,placements:Sn,surface:y,proReviewReason:dn,bump:he},v,V)},deleteReviewItem(v){if(!i)return {ok:false,code:"unsupported",reason:dn};let re=Sn().find(ce=>ce.key===v)?.item;if(!re||!y)return {ok:false,code:"notFound",reason:"no review item with that key"};if(re.kind==="revision")return Eo(v,"reject");if(re.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};fn()===v&&y.dismissActiveReview();let be=false;return y.commitReviewOps(()=>{let ce=un(re),Ie=ce===null?null:Zc$1(ce);return be=y.session.deleteComment(re.id,Nr(re),Ie?.noteId),{committed:be}},"comment-delete"),be?(he(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(v,V,re){if(!i)return {ok:false,code:"unsupported",reason:dn};y?.flushPendingInput();let ce=Sn().find(Me=>Me.key===v)?.item;if(!ce||!y)return {ok:false,code:"notFound",reason:"no review item with that key"};let Ie=cn(ce);if(!Ie)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let ke=(re??n??"").trim(),Oe=fx(ce,V,ke);if(Oe)return Oe;let pe=ce.kind==="comment"?ce.id:null,Ce=null;return y.commitReviewOps(()=>(Ce=y.session.replyToComment(pe,{paragraphId:Ie.start.paragraphId,start:Ie.start.offset,end:Ie.end.offset},V,ke,xn(),Nr(ce)),{committed:Ce!==null}),"comment-reply"),Ce===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>y?.headerFooterState()??null,getNotePropertiesState:()=>y?.notePropertiesState?.()??null,getNotePreviewText:v=>y?.notePreviewText?.(v)??null,setActiveScope(v){y?.setActiveScope(v)&&he();},getActiveScope:()=>y?.activeScope()??{kind:"body"},query(v){switch(v.type){case "selectedText":return y?.selectedText()??"";case "selectionFormatting":return y?vn().formatting:null;case "selection":return gc(y);case "paragraphs":return uy(y,v.container);case "isInsideToc":return y?y.isInsideToc(y.state().selection.head.paragraphId):false;case "hyperlinkAt":return cy(y);case "contentControls":return xx(y,v.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 Tu(y,v.filter);case "tableContext":return bc(y);default:return null}},snapshot:()=>vn(),getTotalPages:()=>hc(y),getCurrentPage:v=>yc(y,v),scrollToPage:v=>!Number.isInteger(v)||v<1?false:(d$1.flush(),y?.revealPage(v-1)??false),scrollToBlock:v=>typeof v!="string"||v.length===0?false:(d$1.flush(),y&&_s(y,v),y?.revealParagraph(v)??false),...Vx(at,()=>y),relayout(v){v?.sync,y?.layout();},retainSelection:()=>y?.retainSelection()??null,releaseSelection:v=>y?.releaseSelection(v),focus(v){return d$1.flush(),y?v&&v.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:v&&!y.setActiveScope(v)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(y.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){I=true,M.dispose(),d$1.cancel(),at.detach(),A(),bt(),r=null,s=null,l=new WeakMap,ge+=1,he();for(let v of Object.values(Ge))v.clear();},on(v,V){return Ge[v].add(V),()=>{Ge[v].delete(V);}}};return vt}var Xx=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function XC(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 YC(e){let t=g({port:QC(e),capabilities:Xx}),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 QC(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,replacementLanding:(s,l,d)=>e.surface?.replacementLanding(s,l,d)??null,apply(s,l){i();let d=e.surface;if(!d)return {ok:false,reason:"no-document"};let u=d.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 d=l.applyAutomationOps(()=>[s]);return d.rejected?{ok:false,reason:String(d.reason??"refused")}:{ok:true,changed:d.committed}},applyCommentWrites(s,l){let d=e.surface,u=i();if(!d||!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 p=e.can({type:"toggleReviewPane"});if(!p.ok)return {ok:false,reason:p.reason??"review-module-required"};let m={ok:false,reason:"refused"};return d.commitReviewOps(()=>{if(s.every(T=>T.kind==="delete")){let T=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,T?.kind==="delete"?T.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 g=s[0];if(g.kind==="resolve"){let T=u.setCommentResolved(g.commentId,g.resolved);return m=T?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:T}}if(g.kind!=="create"&&g.kind!=="reply")return m={ok:false,reason:"unsupported-comment-write"},{committed:false};let x=u.replyToComment(g.kind==="reply"?g.parentCommentId:null,g.anchor,g.text,g.author,g.date);return m=x===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:x},{committed:x!==null}},XC(s)),m},applyCustomNodeWrite(s,l){let d=e.surface,u=i();if(!d||!u)return {ok:false,reason:"no-document"};if(l.kind!=="body")return {ok:false,reason:"unsupported-story"};let p={ok:false,reason:"refused"};return d.commitReviewOps(()=>{let m=u.insertCustomNode(s);return p=m.ok?{ok:true,changed:m.change!==null}:{ok:false,reason:m.detail?`${m.reason}: ${m.detail}`:m.reason},{committed:m.ok}},"package-scoped"),p},save:()=>i()?e.surface?.save()??null:null,select(s,l){if(!e.surface)return;let u=l==="end"?s.end:s.start,p=l==="start"?s.start:s.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:u.paragraphId,offset:u.offset},head:{paragraphId:p.paragraphId,offset:p.offset}}});},subscribe:s=>e.on("change",()=>s()),dispose(){a=true,r=null;}}}function JC(e){return e*(96/72)}function eE(e,t){return e*t}function tE(e,t){return e/t}function nE(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 rE(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 Yx=["e","se","s","sw","w","nw","n","ne"];function oE(e,t){let n=Yx.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return Yx[(n-r+8)%8]}function aE(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,d=r*s+o*i;return r=l,o=d,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function Mr(e){return e/Aa}function Jx(e){let t=aE(e.deltaXPt,e.deltaYPt,e.transform),n=Mr(e.startWidthEmu),r=Mr(e.startHeightEmu),o=n/r,a=oE(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/Mr(e.startWidthEmu),r/Mr(e.startHeightEmu));n=Math.max(1,Mr(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=Mr(e.startWidthEmu),d=Mr(e.startHeightEmu),u=n/l,p=r/d,m=Math.max(1,e.startBounds.width*u),g=Math.max(1,e.startBounds.height*p),x=e.startBounds.x,T=e.startBounds.y,b=e.handle;b.includes("w")&&(x=e.startBounds.x+e.startBounds.width-m),b.includes("n")&&(T=e.startBounds.y+e.startBounds.height-g);let S=null;if(e.kind==="anchored"&&e.startPosition&&(b.includes("w")||b.includes("n")))if(e.startPosition.mode==="simple"){let P=b.includes("w")?It(x-e.startBounds.x):0,O=b.includes("n")?It(T-e.startBounds.y):0;S=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+P,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(x-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...b.includes("n")?{verticalEmu:It(T-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let P=b.includes("w")?It(x-e.startBounds.x):0,O=b.includes("n")?It(T-e.startBounds.y):0;S=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+P}:{},...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,y:T,width:m,height:g}),position:S})}function iE(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 sE(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&&pc(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?Jx({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{yy as $,ek as A,kT as Aa,oc as B,TT as Ba,Fk as C,Ps as Ca,Pa as D,pv as Da,Ra as E,uu as Ea,ac as F,za as Fa,Ok as G,ja as Ga,ic as H,bo as Ha,gn as I,ZC as Ia,Fa as J,zs as Ja,uc as K,js as Ka,fc as L,GC as La,zk as M,Xx as Ma,jk as N,YC as Na,Aa as O,JC as Oa,Wk as P,eE as Pa,It as Q,tE as Qa,ao as R,nE as Ra,Gk as S,rE as Sa,pc as T,Qx as Ta,Xk as U,Jx as Ua,is as V,iE as Va,so as W,sE as Wa,hy as X,vc as Y,ss as Z,tT as _,Qr as a,by as aa,xa as b,nT as ba,GS as c,Tr as ca,od as d,xc as da,FI as e,iT as ea,OI as f,sT as fa,lt as g,dT as ga,$I as h,La as ha,qI as i,Sy as ia,ZI as j,ls as ja,Ch as k,wy as ka,KI as l,Iy as la,VI as m,pT as ma,zI as n,mT as na,jI as o,gT as oa,UI as p,hT as pa,WI as q,yT as qa,GI as r,bT as ra,Eh as s,vT as sa,XI as t,xT as ta,Zd as u,wc as ua,Dh as v,ST as va,Hh as w,Py as wa,ns as x,wT as xa,Vd as y,Ry as ya,zd as z,IT as za};
|