@docx-editor.dev/core 2.21.1 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +11 -5
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +10 -10
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +8 -8
  7. package/dist/binding.js +1 -1
  8. package/dist/{chunk-BF2TOG2V.js → chunk-5RKCJ5DF.js} +1 -1
  9. package/dist/chunk-65GJRSZ5.cjs +18 -0
  10. package/dist/chunk-6TBRG6SA.cjs +20 -0
  11. package/dist/chunk-A72MJGY7.cjs +4 -0
  12. package/dist/chunk-AZ7QSAXH.js +4 -0
  13. package/dist/chunk-BL57VQ7E.js +1 -0
  14. package/dist/chunk-CB6RQ3GD.cjs +11 -0
  15. package/dist/chunk-GG4IAKFI.js +5 -0
  16. package/dist/chunk-HJYLFMLX.js +2 -0
  17. package/dist/chunk-HL6NO7IH.cjs +2 -0
  18. package/dist/chunk-HZQFGB2X.cjs +5 -0
  19. package/dist/{chunk-FPDIJ4RF.js → chunk-IWAUA732.js} +1 -1
  20. package/dist/chunk-OZXBAEWW.js +2 -0
  21. package/dist/{chunk-4TYA4RLP.cjs → chunk-P5PWSRNW.cjs} +1 -1
  22. package/dist/{chunk-DZYKU2HG.js → chunk-PD5XKBJA.js} +1 -1
  23. package/dist/{chunk-7N77EN2Z.cjs → chunk-REMFTPDL.cjs} +1 -1
  24. package/dist/{chunk-T5B4NMKF.cjs → chunk-RLKX7BIP.cjs} +1 -1
  25. package/dist/chunk-UGLO2GA5.cjs +1 -0
  26. package/dist/chunk-UOQONZVQ.js +11 -0
  27. package/dist/chunk-VD2MWTR6.js +20 -0
  28. package/dist/chunk-VIXH2OVP.js +1 -0
  29. package/dist/chunk-W2JIZ5JH.js +18 -0
  30. package/dist/chunk-W5H62AWM.cjs +1 -0
  31. package/dist/{chunk-E5OUYRNM.cjs → chunk-X2LJDR53.cjs} +5 -5
  32. package/dist/chunk-YQXY6TQ3.js +5 -0
  33. package/dist/{chunk-RA2TDTEQ.cjs → chunk-YYFBYVW4.cjs} +1 -1
  34. package/dist/collaboration/replication.cjs +1 -1
  35. package/dist/collaboration/replication.d.ts +4 -4
  36. package/dist/collaboration/replication.js +1 -1
  37. package/dist/collaboration.d.ts +3 -3
  38. package/dist/contracts/document.d.ts +2 -2
  39. package/dist/contracts/editor.d.ts +8 -8
  40. package/dist/contracts/modules.d.ts +6 -6
  41. package/dist/contracts/types.d.ts +1 -1
  42. package/dist/{custom-node-writes-CncR6KfC.d.ts → custom-node-writes-Ck6eOiJ3.d.ts} +2 -2
  43. package/dist/{document-protection-DM6mA8Rf.d.ts → document-protection-CMPEonQc.d.ts} +1 -1
  44. package/dist/{editor-BRh7GuZF.d.ts → editor-BKDVqXyk.d.ts} +70 -49
  45. package/dist/editor.cjs +1 -1
  46. package/dist/editor.css +1 -1
  47. package/dist/editor.d.ts +188 -26
  48. package/dist/editor.js +1 -1
  49. package/dist/export.cjs +2 -2
  50. package/dist/export.d.ts +31 -14
  51. package/dist/export.js +2 -2
  52. package/dist/{font-resolver-DwuQYj3P.d.ts → font-resolver-PBc8Vuxs.d.ts} +1 -1
  53. package/dist/{headless-document-view-C3fc_jV0.d.ts → headless-document-view-9wjJT20Y.d.ts} +2 -2
  54. package/dist/{image-resources-DxF-SN_8.d.ts → image-resources-B0v-XaTM.d.ts} +2 -2
  55. package/dist/{index-3pNnG4z4.d.ts → index-DQA53aR1.d.ts} +134 -16
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.d.ts +17 -17
  58. package/dist/index.js +1 -1
  59. package/dist/{layout-shaping-_GGjhhVc.d.ts → layout-shaping-Dyr0ZSOI.d.ts} +5 -2
  60. package/dist/layout.cjs +1 -1
  61. package/dist/layout.d.ts +376 -33
  62. package/dist/layout.js +1 -1
  63. package/dist/{note-properties-CjT31AuP.d.ts → note-properties-D_lmG9xx.d.ts} +1 -1
  64. package/dist/{omml-equation-Bk3OP1fv.d.ts → omml-equation-CfTm3jOK.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +7 -7
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-CrbTIW2Z.d.ts → protocol-CkVDxyQ3.d.ts} +2 -2
  69. package/dist/{review-paragraph-order-D3KZohIL.d.ts → review-paragraph-order-BjUs-tDd.d.ts} +1 -1
  70. package/dist/{revision-projection-kVd7p6Wd.d.ts → revision-projection-DDVBYTIG.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection-CkSsZHDL.d.ts → semantic-cell-selection-DW6qsmoC.d.ts} +4 -4
  72. package/dist/{semantic-interaction-Z2Xa68U5.d.ts → semantic-interaction-BNiYSBcB.d.ts} +1 -1
  73. package/dist/{semantic-paint-BHKprI9P.d.ts → semantic-paint-DE236npp.d.ts} +2 -2
  74. package/dist/{semantic-records-StH-AnHK.d.ts → semantic-records-C5OeXnaL.d.ts} +545 -569
  75. package/dist/store.cjs +1 -1
  76. package/dist/store.d.ts +13 -13
  77. package/dist/store.js +1 -1
  78. package/dist/{tree-package-fragment-CpEV1gl3.d.ts → tree-package-fragment-DBb97w3F.d.ts} +2 -2
  79. package/dist/{tree-session-contract-CTT9nM7Z.d.ts → tree-session-contract-BYat3RKx.d.ts} +5 -5
  80. package/dist/{types-barrel-PwcfEkaX.d.ts → types-barrel-ChGvWjkO.d.ts} +3 -1
  81. package/package.json +2 -2
  82. package/dist/chunk-25OQBAKA.js +0 -2
  83. package/dist/chunk-3B3DQMSL.js +0 -11
  84. package/dist/chunk-3P3DNJYM.js +0 -5
  85. package/dist/chunk-3PA64KPK.js +0 -5
  86. package/dist/chunk-AGWWNVIJ.cjs +0 -1
  87. package/dist/chunk-DFTVN25X.cjs +0 -5
  88. package/dist/chunk-DGONGMAV.js +0 -2
  89. package/dist/chunk-F4H3LC6M.cjs +0 -2
  90. package/dist/chunk-IUTTOBQW.cjs +0 -20
  91. package/dist/chunk-IYCXQAFT.cjs +0 -4
  92. package/dist/chunk-JL3SI5SZ.js +0 -18
  93. package/dist/chunk-OFWUHH52.js +0 -20
  94. package/dist/chunk-OKY6JRJL.js +0 -4
  95. package/dist/chunk-P24FHMQW.cjs +0 -1
  96. package/dist/chunk-QBKAOSVF.cjs +0 -18
  97. package/dist/chunk-U5GUJKTS.js +0 -1
  98. package/dist/chunk-XRYSPKKC.js +0 -1
  99. package/dist/chunk-ZZRCVDQU.cjs +0 -11
@@ -0,0 +1,20 @@
1
+ import {a as a$3}from'./chunk-AJCCS53D.js';import {k,h,e,n,o,f,g,l,i as i$2,b as b$1,c,a as a$7,d as d$2}from'./chunk-OZXBAEWW.js';import {p,q,i as i$1,f as f$1,a as a$8,k as k$2,b as b$3,e as e$2,r,v,t as t$1,m as m$1,n as n$1,c as c$1}from'./chunk-VIXH2OVP.js';import {d,y,t,F,a as a$1,i,ea,ra,wa as wa$1,xa,ua as ua$1,fa,ga,ha,la as la$1,ja,ya as ya$2,za as za$1,qa as qa$1,Aa as Aa$2,sa as sa$1,va as va$1,ta as ta$2,ka as ka$1,ba as ba$1,H,g as g$2,pa as pa$2}from'./chunk-AZ7QSAXH.js';import {k as k$1,e as e$1,b,a as a$4}from'./chunk-HJYLFMLX.js';import {a as a$5}from'./chunk-BL57VQ7E.js';import {ld,Ka,de,Gc as Gc$1,zd,Ad,wa,Qb as Qb$1,Id,xe,Cd,me,ue,ra as ra$1,ie,ze,ge as ge$1,lc,Fc as Fc$1,xa as xa$1,ya as ya$1,Aa,za,md,wd,ic,hc,Hd,le,ne,re,va,qe,aa,rc,ye,ua as ua$2,je as je$1,fe,Ae,ta as ta$1,Rb as Rb$1,Lb as Lb$1,he,Gb as Gb$1,Uc as Uc$1,F as F$1,ad,K,fd,cd,qd,nd,od,pd,Gd,jc as jc$2,jb as jb$2,we,qa as qa$2,fc,gc,te,ba,sa as sa$2,hd,Ce,l as l$1,w,s,qb as qb$1,Hc as Hc$1,ja as ja$1,Wc as Wc$1,ed as ed$2,Kb as Kb$2,ib as ib$2,hb as hb$1,Cc as Cc$1,Jb as Jb$2,Ib as Ib$1,Dc as Dc$1,Sb as Sb$2,pa as pa$1,fb as fb$2}from'./chunk-W2JIZ5JH.js';import {j,d as d$1,i as i$3}from'./chunk-YQXY6TQ3.js';import {ka,Ea,ua,ya,Ta,Ba,ta,sa,Ia,wa as wa$2,la,ra as ra$2,qa,oa,La as La$1,Ma,ma,Aa as Aa$1,za as za$2,pa,Ka as Ka$1,Da,J,$a}from'./chunk-GG4IAKFI.js';import {a as a$6}from'./chunk-6JIJOZDW.js';import {a as a$2,Qf as Qf$1,vi as vi$1,ib as ib$1,mh,nh,oh,Ge,qf as qf$1,Ie,_i,of as of$1,$f as $f$1,Sb as Sb$1,ed as ed$1,Ha,rb as rb$1,jb as jb$1,kb as kb$1,mb as mb$1,L,Ei as Ei$1,Gi,Bi,Fi as Fi$1,th,rh,qh,jc as jc$1,fi as fi$1,Cf as Cf$1,If as If$1,dd,Ee,b as b$2,Ad as Ad$1,Rf as Rf$1,Sf as Sf$1,Of as Of$1,Pf as Pf$1,Tf as Tf$1,Uf as Uf$1,Eh,hg,sf as sf$1,xa as xa$2,Fa,La,da,lc as lc$1,uc,sc,tc,zi,aj,Ui,qi,Ih,Ai as Ai$1,Fe,Ze as Ze$1,ki as ki$1,vh,Bh,mi as mi$1,gi as gi$1,hi as hi$1,Dd,Gd as Gd$1,wc,Ia as Ia$1,Jd,Ng,Kb as Kb$1,Jb as Jb$1,yd,pd as pd$1,nd as nd$1,mg,jg,bf as bf$1,cf as cf$1,Pe,Oc as Oc$1,m,Kd,Nd,Kg,Fh,Gh,Re,Oe,ei as ei$1,di as di$1,ag,Xe,yc,Ac as Ac$1,jd,oi as oi$1,pi as pi$1,zb as zb$1,ti as ti$1,Qh,Hf as Hf$1,Mh,Yh,Fd,ph,la as la$2,ma as ma$1,na,kg,bi as bi$1,nc,sh,Ic as Ic$1,Fc as Fc$2,N,w as w$1,Ne,_e,M,Eb as Eb$1,ke,Sa,Ra,g as g$1,Ld,ja as ja$2,Q,ia,ha as ha$1,B,fb as fb$1,ie as ie$1,ae,Ff as Ff$1,Nb as Nb$1,we as we$1,Qc as Qc$1}from'./chunk-UOQONZVQ.js';import {a}from'./chunk-S6J4O5XP.js';import {zipSync,strToU8}from'fflate';import {createT,en,isApplePlatform,locales,deepMerge}from'@docx-editor.dev/i18n';function NT(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var ry=false;function oy(e){if(ry)return;ry=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 Oo(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:NT(e.request),diagnostic:e.diagnostic});if(e instanceof y)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 Qa(e,t){try{return await F(e,t)}catch(n){throw Oo(n)}}var DT=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 ay="http://schemas.openxmlformats.org/wordprocessingml/2006/main",_T="http://schemas.openxmlformats.org/package/2006/content-types",iy="http://schemas.openxmlformats.org/package/2006/relationships",BT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",$T="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",qT=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${_T}"><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>`,KT=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iy}"><Relationship Id="rId1" Type="${BT}" Target="word/document.xml"/></Relationships>`,ZT=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iy}"><Relationship Id="rId1" Type="${$T}" Target="styles.xml"/></Relationships>`,VT=[{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}],jT=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>",zT=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${ay}"><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>`+VT.map(jT).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>',WT=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${ay}"><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 Ic(){return zipSync({"[Content_Types].xml":strToU8(qT),"_rels/.rels":strToU8(KT),"word/_rels/document.xml.rels":strToU8(ZT),"word/document.xml":strToU8(WT),"word/styles.xml":strToU8(zT)})}var Mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UT=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<Mo.length;t+=1)e[Mo.charCodeAt(t)]=t;return e})();function Fs(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 f=0;f<4;f+=1){let p=r.charCodeAt(l+f);if(p===61){if(l+f<r.length-o)return null;continue}let m=p<128?UT[p]:-1;if(m<0)return null;d=d<<6|m,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 As(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+=Mo[o>>2]+Mo[(o&3)<<4|a>>4],n+=r+1<e.length?Mo[(a&15)<<2|i>>6]:"=",n+=r+2<e.length?Mo[i&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var GT=16*1024*1024,ly=64*1024*1024,dy="data-docx-fragment",cy="data-docx-fragment-end",XT=As;function uy(e,t){if(!t)return `<div>${e}</div>`;let n=t.lastMarkCovered?"covered":"open";return `<div ${dy}="${XT(t.bytes)}" ${cy}="${n}">${e}</div>`}function sy(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>ly)return null;let o=r+n.length,a=e.indexOf('"',o);return a===-1?null:e.slice(o,a)}function Ls(e,t=GT){if(e.length>ly)return null;let n=sy(e,dy);if(n===null||n.length===0)return null;let r=Fs(n,t);if(r===null||r.byteLength===0)return null;let o=sy(e,cy);return {bytes:r,lastMarkCovered:o==="covered"}}function Ur(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 Tc=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],kc={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText"},Pc=new Map([...Object.entries(kc).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function fy(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(kc,e)?kc[e]:null}var Cc=Object.fromEntries(k),Rc={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function py(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 YT=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 Gr(e){if(e===null)return null;let t=Ne(e,"val",da);if(t===void 0||t==="nil"||t==="none")return null;let n=YT.get(t)??"solid",r=Ne(e,"sz",da),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=Ne(e,"color",da),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${i} ${n} ${l.toLowerCase()}`}function my(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 QT=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"]]),JT=new Set(Tc);function gy(e){if(e===null)return [];let t=Ne(e,"val",da),n=[],r=t===void 0?void 0:QT.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&JT.has(t)&&n.push(`text-underline:${t}`);let o=Ne(e,"color",da);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 hy(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function yy(e,t,n,r){if(e.namespaceUri!==da)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=Ne(e,"id",da),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,f=d?"MsoFootnoteReference":"MsoEndnoteReference",p=d?"ftn":"edn",m=u?`#_${p}ref${l}`:`#_${p}${l}`,g=u?`_${p}${l}`:`_${p}ref${l}`;return `<a style="mso-${d?"footnote":"endnote"}-id:${p}${l}" href="${m}" name="${g}"><span class="${f}"><span style="mso-special-character:footnote">[${n(i,l)}]</span></span></a>`}function by(e){if(e.namespaceUri!==da||e.localName!=="ptab")return "";let t=Ne(e,"alignment",da),n=Ne(e,"relativeTo",da),r=Ne(e,"leader",da)??"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 ut(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 wy(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 Sy(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=Pc.get(r);if(i!==void 0)return i}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(at(e)):null;return n?`Heading${n[1]}`:void 0}var Iy=262144,eP=4096,tP=256,nP=2048,rP=8,oP=new Set(["MsoNormal",...Pc.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),aP=new Map([["left","left"],["start","left"],["center","center"],["right","right"],["end","right"],["justify","both"]]),iP=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function sP(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 lP(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 dP(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return lP(e,n)}return null}function cP(e){let t=e.split(",");if(t.length===0||t.length>rP)return null;let n=[];for(let r of t){let o=iP.exec(r);if(!o)return null;let a=o[2];if(!oP.has(a))return null;n.includes(a)||n.push(a);}return n}function uP(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=aP.get(a.slice(0,i));s!==void 0&&(t=s);}return t}function fP(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>Iy)return n();let r=sP(e),o=0,a=0;for(;o<r.length&&a<eP;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let p=dP(r,o);if(p===null)return n();o=p;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>tP||d.length>nP||d.includes("{"))return n();let u=cP(s),f=uP(d);if(!(!u||f===void 0))for(let p of u)t.set(p,f);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function ky(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>Iy)return new Map;let a=fP(o);if(!a.ok)return new Map;for(let[i,s]of a.alignments)t.set(i,s);}return t}var pP=262144;function Ty(e,t=pP){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 Py(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 Ec(e,t,n,r){let o=ut(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 Fo(e){return e.nodeType===1}function at(e){return e.tagName.toLowerCase()}var mP=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(":"))),gP=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"]]),hP=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,yP=new Map(Tc.map(e=>[e.toLowerCase(),e])),vy=new WeakMap;function rt(e){let t=vy.get(e);if(t!==void 0)return t;let n=new Map;vy.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 wr(e){let t=e.trim().toLowerCase(),n=mP.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 bP(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return gP.get(t)}function xy(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||hP.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:wr(t)}function Qt(e,t,n){return Math.min(n,Math.max(t,e))}function Ds(e){let t=null;for(let[n,r]of e)if(n==="background")t=xy(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let a=xy(r);a!==null&&(t=a);}return t}var vP=new Set(["left","center","right","decimal","bar"]),xP=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function wP(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(vP.has(o)){t=o;continue}if(o==="list"){t="left";continue}let a=xP.get(o);if(a!==void 0){n=a;continue}let i=ut(o);if(!(i===null||i<0)){if(r.push({val:t,posTwips:Qt(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 SP=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function Oc(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var IP=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Ns(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let a of Oc(e)){let i=a.toLowerCase();if(i==="none"||i==="hidden"){n=true;continue}let s=SP.get(i);if(s!==void 0){t=s;continue}let l=IP.get(a.toLowerCase())??ut(a);if(l!==null){r=l;continue}let d=wr(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:Qt(Math.round(r*8),2,96),color:o??"000000"}}function Hs(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function Mc(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 Fc(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let T=Number.parseInt(r,10);r==="bold"||T>=600?n.bold=true:(r==="normal"||T<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 T of l.trim().split(/\s+/)){let O=T.toLowerCase(),P=yP.get(O);if(P!==void 0)n.underline=true,n.underlineVal=P;else {let B=wr(T);B!==null&&(n.underlineColor=B);}}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 T=wr(t.get("text-decoration-color")??"");T!==null&&(n.underlineColor=T);}let u=wr(t.get("color")??"");u&&(n.color=u);let f=bP(t.get("mso-highlight"));if(f)n.highlight=f,delete n.shdFill;else {let T=Ds(t);T&&(n.shdFill=T);}let p=ut(t.get("font-size")??"");p!==null&&p>0&&(n.szHalfPoints=Qt(Math.round(p*2),2,3276));let m=t.get("font-family");if(m!==void 0){let T=m.split(",")[0].trim().replace(/^['"]|['"]$/g,"");T.length>0&&T.length<=64&&(n.font=T);}let g=ut(t.get("letter-spacing")??"");g!==null&&(n.charSpacingTwentieths=Qt(Math.round(g*20),-31680,31680));let v=t.get("vertical-align")?.trim().toLowerCase();v==="sub"?n.vertAlign="subscript":v==="super"&&(n.vertAlign="superscript");let b=Ur(t.get("mso-ansi-language")),y=Ur(t.get("mso-fareast-language")),I=Ur(t.get("mso-bidi-language"));return b!==null&&(n.langVal=b),y!==null&&(n.langEastAsia=y),I!==null&&(n.langBidi=I),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function ei(e,t){let n=Fc(e,rt(t)),r=Ur(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function Cy(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 y=o.trim().split(/\s+/).map(I=>ut(I));if(y.length>=1&&y.length<=4&&!y.some(I=>I===null)){let[I,T=I,O=I,P=T]=y.length===2?[y[0],y[1],y[0],y[1]]:y.length===3?[y[0],y[1],y[2],y[1]]:y;r.top=I??null,r.right=T??null,r.bottom=O??null,r.left=P??null;}}let a=ut(t.get("margin-left")??"")??r.left;a!==null&&(a>0||a===0&&!e.numPr)&&(e.indLeftTwips=Qt(Math.round(a*20),0,31680));let i=ut(t.get("margin-right")??"")??r.right;i!==null&&i>=0&&(e.indRightTwips=Qt(Math.round(i*20),0,31680));let s=ut(t.get("text-indent")??"");if(s!==null&&s!==0){let y=Qt(Math.round(s*20),-31680,31680);y!==0&&(e.firstLineTwips=y);}let l=ut(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=Qt(Math.round(l*20),0,31680));let d=ut(t.get("margin-bottom")??"")??r.bottom;d!==null&&d>=0&&(e.spacingAfterTwips=Qt(Math.round(d*20),0,31680));let u=t.get("line-height")?.trim()??"",f=t.get("mso-line-height-rule")?.trim().toLowerCase(),p=ut(u);if(p!==null&&p>0)e.lineTwentieths=Qt(Math.round(p*20),24,31680),e.lineRule=f==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(u)&&Number.parseFloat(u)>0)e.lineTwentieths=Qt(Math.round(240*Number.parseFloat(u)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(u)){let y=Number.parseFloat(u);y>0&&(e.lineTwentieths=Qt(Math.round(2.4*y),24,9600),e.lineRule="auto");}(t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page")&&(e.pageBreakBefore=true),t.get("page-break-after")?.trim().toLowerCase()==="avoid"&&(e.keepNext=true),t.get("page-break-inside")?.trim().toLowerCase()==="avoid"&&(e.keepLines=true),(/^[2-9]\d?$/.test(t.get("widows")?.trim()??"")||/^[2-9]\d?$/.test(t.get("orphans")?.trim()??""))&&(e.widowControl=true);let m=Ds(t);m&&(e.shdFill=m);let g=wP(t.get("tab-stops"));g!==void 0&&(e.tabs=g);let v=Ns(t.get("mso-border-alt"))??Ns(t.get("border")),b={};for(let y of ["top","left","bottom","right"]){let I=Ns(t.get(`mso-border-${y}-alt`))??Ns(t.get(`border-${y}`))??v;I!==void 0&&I!=="suppressed"&&(b[y]=I);}Object.keys(b).length>0&&(e.borders=b);}var kP="http://schemas.openxmlformats.org/drawingml/2006/picture",TP=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,PP=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 Ry(e,t,n){return Math.min(n,Math.max(t,e))}function Ey(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let a=TP.exec(o);if(!a)return;let i=n.mediaBySrc.get(o),s=i===void 0?void 0:n.media.get(i),l=s??Fs(a[1],n.maxImageBytes);if(l==null)return;let d=zb$1(l),u=PP.get(d);if(u===void 0)return;let f=d==="image/png"||d==="image/jpeg"||d==="image/gif"||d==="image/bmp"||d==="image/webp"?Eb$1(l,d):null,p=rt(e),m=Ec(e,p,"width",n.wordHtml),g=Ec(e,p,"height",n.wordHtml);f!==null?m===null&&g===null?(m=f.pixelWidth*96/(f.dpiX??96),g=f.pixelHeight*96/(f.dpiY??96)):m!==null&&g===null?g=m*f.pixelHeight/f.pixelWidth:m===null&&g!==null&&(m=g*f.pixelWidth/f.pixelHeight):m!==null&&g===null?g=m*2/3:m===null&&g!==null&&(m=g*3/2);let v=m===null?381e4:Ry(Math.round(m*9525),9525,3e7),b=g===null?254e4:Ry(Math.round(g*9525),9525,3e7),y=s===void 0?void 0:i;y===void 0&&(n.imageCount+=1,y=`word/media/image${n.imageCount}.${u}`,n.media.set(y,l),n.mediaBySrc.set(o,y),n.mediaExtensions.has(u)||n.mediaExtensions.set(u,d));let I=r(y.replace("word/",""));n.docPrId+=1,t.push(`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${v}" cy="${b}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${kP}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${I}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${v}" 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 CP="http://schemas.openxmlformats.org/wordprocessingml/2006/main",RP='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',Oy=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function My(e,t,n){let r=720*(n+1);if(e==="bullet"){let a=Oy[n%Oy.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 EP=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),OP=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),Fy=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function Ay(e){let t=new Map;if(e.length===0||e.length>262200)return t;Fy.lastIndex=0;let n,r=0;for(;(n=Fy.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=OP.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 Ly(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?Ny(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 MP=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function Ny(e){let t=e.toLowerCase();if(!MP.test(t))return null;let n=0,r=0;for(let o of t){let a=EP.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 Dy(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=Ny(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 FP=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 Hy(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=rt(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:FP.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 Ac(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 _y(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?My(d.kind,d.start,l):My(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 `${RP}<w:numbering xmlns:w="${CP}">${t}${n}</w:numbering>`}function gn(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 By(e){if(e===null)return false;if(e.startsWith("#"))return gn(e.slice(1))!==null;let t=L(e);return t?.ok===true&&t.href.length>0}function $y(e,t){if(e!==void 0&&e.startsWith("#")){let o=gn(e.slice(1)),a=gn(t)??o;return a===null?null:`#${a}`}let n=e===void 0?null:L(e),r=gn(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function qy(){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 AP=/^(ftn|edn)([1-9]\d{0,9})$/i,LP={footnote:"ftn",endnote:"edn"};function Ky(e,t){let n=e===null?null:AP.exec(e);if(!n||n[1].toLowerCase()!==LP[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function Lc(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=Ky(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function NP(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=Ky(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function Zy(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],a=NP(o,rt(o));a!==null&&t.push({...a,element:o});}return t}function Vy(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=Lc(rt(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 jy(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var DP=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function Ao(e,t,n){return e.replace(DP,(r,o,a)=>{let i=`${o}:${a}`;return t.has(i)?n?.get(i)??"":r})}function Nc(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 zy(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=>Ao(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 f of d){let p=Ao(f.replace(/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(?:footnote|endnote)Ref\/><\/w:r>/g,""),o,e.noteMarkFallbacks).replace(/ r:(id|embed)="([^"]{1,32})"/g,(m,g,v)=>{let b=u.get(v);if(b===void 0){let y=e.noteRels[s].find(I=>I.id===v);if(y===void 0)return m;b=r(e,y.type,y.target,y.external),u.set(v,b);}return ` r:${g}="${b}"`});n.push(p),e.lastMarkCovered=false;}}}function Dc(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 Wy(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=HP(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,f;d!==void 0?(u=d.kind,f=Ly(s,u)??d.start??1):{kind:u,start:f}=Dy(s);let m=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${a[1]}${l?`:lfo${l[1]}`:""}`;return {numId:Dc(n,m,u,f,i),ilvl:i}}function HP(e,t){let n="",r=(o,a)=>{if(!(n.length>0||a>8||t.nodesLeft<=0)&&Fo(o)){if(Hs(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 _P="http://schemas.openxmlformats.org/package/2006/relationships",BP="http://schemas.openxmlformats.org/package/2006/content-types",$P="application/vnd.openxmlformats-package.relationships+xml",Bc='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',qP="http://schemas.openxmlformats.org/wordprocessingml/2006/main",_c="http://schemas.openxmlformats.org/officeDocument/2006/relationships",KP="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",ZP="http://schemas.openxmlformats.org/drawingml/2006/main",VP="http://schemas.openxmlformats.org/drawingml/2006/picture",Uy={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 Hc(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 `${Bc}<Relationships xmlns="${_P}">${t}</Relationships>`}function jP(e){let t=new Map;t.set("word/document.xml",Sa(e.documentXml)),t.set("word/_rels/document.xml.rels",Sa(Hc(e.rels))),t.set("_rels/.rels",Sa(Hc([{id:"rId1",type:`${_c}/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="${Uy.document}"/>`;for(let[a,i]of n)i!==void 0&&(t.set(`word/${a}.xml`,Sa(i)),r+=`<Override PartName="/word/${a}.xml" ContentType="${Uy[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`,Sa(Hc(i)));for(let[a,i]of e.media)t.set(a,i);let o=`<Default Extension="rels" ContentType="${$P}"/><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",Sa(`${Bc}<Types xmlns="${BP}">${o}${r}</Types>`)),Ra(t)}function Gy(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${_c}/${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=`${Bc}<w:document xmlns:w="${qP}" xmlns:r="${_c}" xmlns:wp="${KP}" xmlns:a="${ZP}" xmlns:pic="${VP}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return jP({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:_y(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:Nc("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:Nc("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}function $c(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 Sr(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${N(e.rStyle)}"/>`),e.font!==void 0){let i=N($c(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 _s(e,t){return `<w:r>${Sr(t)}<w:t xml:space="preserve">${M($c(e))}</w:t></w:r>`}function zP(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 Xr(e,t){return `<w:p>${zP(e)}${t.join("")}</w:p>`}var Yy={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function Bs(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 WP=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,Xy=new WeakMap;function qc(e){let t=Xy.get(e);for(t||(t={checked:0,furniture:true},Xy.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=WP.test(e[t.checked]),t.checked+=1;return t.furniture}function hn(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var Ir=31680;function tr(e,t,n){return Math.min(n,Math.max(t,e))}function Qy(e){let t=ut(rt(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 UP(e){return Yr(e,"colspan",63)}function Jy(e){return Array.from(e.children).flatMap(t=>{let n=at(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>at(r)==="tr")})}function Yr(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:tr(Number.parseInt(r,10),1,n)}function eb(e,t){let n=(rt(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${tr(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=Qy(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let a=tr(Math.round(o*20),1,Ir);return {xml:`<w:tblW w:w="${a}" w:type="dxa"/>`,twips:a}}function tb(e){let n=rt(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 nb(e){let t=rt(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=ut(i??"");l!==null&&(a+=` w:tblpX="${tr(Math.round(l*20),-Ir,Ir)}"`);}let s=ut(t.get("mso-table-top")??"");return s!==null&&(a+=` w:tblpY="${tr(Math.round(s*20),-Ir,Ir)}"`),`<w:tblpPr${a}/>`}function rb(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 f=Array.from({length:t},()=>r),p=0,m=0,g=i.map(y=>y?y.span:null);for(let y=0;y<t;y+=1){let I=i[y];I&&(I.remaining-=1,I.remaining<=0&&(i[y]=null));}let v=Array.from(u.children).filter(y=>/^t[dh]$/.test(at(y))),b=0;for(;m<t;){let y=g[m];if(y!==null){m+=y;continue}let I=v[b];if(I===void 0)break;b+=1;let T=Math.min(UP(I),t-m);for(let B=m+1;B<m+T;B+=1)if(g[B]!==null){T=B-m;break}let O=Yr(I,"rowspan",1e3);O>1&&(i[m]={remaining:O-1,span:T});let P=Qy(I);if(P!==null){let B=tr(Math.round(P*20/T),1,Ir);for(let C=0;C<T;C+=1)f[m+C]=B;p+=T;}m+=T;}p>o&&(o=p,a=f);}let s=a.reduce((u,f)=>u+f,0);if(s<=0)return a;let l=a.map(u=>Math.max(1,Math.round(u*n/s))),d=n-l.reduce((u,f)=>u+f,0);return l[l.length-1]=Math.max(1,l[l.length-1]+d),l}function Kc(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 ob=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),ab=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function ib(e){return tr(Math.round(e*8),2,96)}function Pn(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of Oc(e)){let a=ob.get(o.toLowerCase());if(a!==void 0){t=a;continue}let i=ab.get(o.toLowerCase())??ut(o);if(i!==null){n=i;continue}let s=wr(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:ib(n),color:r??"000000"}}}function $s(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=ob.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:ab.get(o.toLowerCase())??ut(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:wr(i);return {val:r,size:a===null?4:ib(a),color:s??"000000"}}function sb(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function lb(e,t=false){let n=rt(e),o=Pn(n.get("mso-border-alt"))??Pn(n.get("border"))??$s(n,"border")??(e.getAttribute("border")?.trim()&&e.getAttribute("border")?.trim()!=="0"?{val:"single",size:4,color:"auto"}:void 0),a=[["top","top"],["left","left"],["bottom","bottom"],["right","right"],["insideH","insideh"],["insideV","insidev"]],i="";for(let[s,l]of a){let d=hn(l,t),u=Pn(n.get(`mso-border-${d}-alt`))??Pn(n.get(`mso-border-${d}`))??Pn(n.get(`border-${d}`))??$s(n,`border-${d}`)??o;u!==void 0&&(i+=sb(s,u));}return i.length>0?`<w:tblBorders>${i}</w:tblBorders>`:""}function db(e){let t=rt(e),n=ut(t.get("height")??"");if(n===null||n<=0)return "";let r=tr(Math.round(n*20),1,Ir),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 GP(e,t){let n={top:null,right:null,bottom:null,left:null},r=e.get("padding");if(r!==void 0&&r.length<=128){let a=r.trim().split(/\s+/).map(i=>ut(i));if(a.length>=1&&a.length<=4&&!a.some(i=>i===null||i<0)){let[i,s=i,l=i,d=s]=a.length===2?[a[0],a[1],a[0],a[1]]:a.length===3?[a[0],a[1],a[2],a[1]]:a;n.top=i??null,n.right=s??null,n.bottom=l??null,n.left=d??null;}}for(let a of ["top","right","bottom","left"]){let i=ut(e.get(`padding-${a}`)??"");i!==null&&i>=0&&(n[a]=i);}let o="";for(let a of ["top","left","bottom","right"]){let i=hn(a,t),s=n[i];s!==null&&(o+=`<w:${a} w:w="${tr(Math.round(s*20),0,Ir)}" w:type="dxa"/>`);}return o.length>0?`<w:tcMar>${o}</w:tcMar>`:""}function cb(e,t=false){let n=rt(e),r=Pn(n.get("mso-border-alt"))??Pn(n.get("border"))??$s(n,"border"),o="";for(let l of ["top","left","bottom","right"]){let d=hn(l,t),u=Pn(n.get(`mso-border-${d}-alt`))??Pn(n.get(`mso-border-${d}`))??Pn(n.get(`border-${d}`))??$s(n,`border-${d}`)??r;u!==void 0&&(o+=sb(l,u));}let a=o.length>0?`<w:tcBorders>${o}</w:tcBorders>`:"",i=Ds(n);i&&(a+=`<w:shd w:val="clear" w:color="auto" w:fill="${i}"/>`),a+=GP(n,t);let s=n.get("vertical-align")?.toLowerCase()??e.getAttribute("valign")?.toLowerCase();return s==="top"?a+='<w:vAlign w:val="top"/>':s==="middle"||s==="center"?a+='<w:vAlign w:val="center"/>':s==="bottom"&&(a+='<w:vAlign w:val="bottom"/>'),a}var XP=9360;function ub(e,t,n,r,o,a){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let C of Array.from(e.children))at(C)==="caption"&&a(Array.from(C.childNodes),t+1,n,r,o,true);let i=Jy(e);if(i.length===0)return;let s=1,l=r.nodesLeft,d=[];for(let C of i){if(l<=0||s>=63)break;let _=d.map(N=>N?N.span:null);for(let N=0;N<d.length;N+=1){let V=d[N];V&&(V.remaining-=1,V.remaining<=0&&(d[N]=null));}let k=Array.from(C.children).filter(N=>/^t[dh]$/.test(at(N))),R=0,x=0;for(;x<63&&(l-=1,!(l<=0));){let N=x<_.length?_[x]:null;if(N!=null){x+=N;continue}let V=k[R];if(V===void 0)break;R+=1;let M=Math.min(Yr(V,"colspan",63),63-x);for(let K=x+1;K<x+M;K+=1)if(K<_.length&&_[K]!=null){M=K-x;break}let D=Yr(V,"rowspan",1e3);if(D>1){for(;d.length<=x;)d.push(null);d[x]={remaining:D-1,span:M};}x+=M;}for(let N=x;N<_.length&&N<63;N+=1){let V=_[N];V!=null&&(x=Math.max(x,N+V));}s=Math.max(s,x);}s=Math.min(Math.max(s,1),63);let u=eb(e,XP),f=u.twips,p=i.length>r.nodesLeft?i.slice(0,Math.max(1,r.nodesLeft)):i,m=rb(p,s,f),v=(rt(e).get("direction")??e.getAttribute("dir"))?.trim().toLowerCase()==="rtl",b=lb(e,v),y=nb(e),I=tb(e)??(v?"left":void 0),T=I===void 0?"":`<w:jc w:val="${hn(I,v)}"/>`,O=m.map(C=>`<w:gridCol w:w="${C}"/>`).join(""),P=new Array(s).fill(null),B=[];for(let C of i){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let _=P.map(M=>M?M.span:null);for(let M=0;M<s;M+=1){let D=P[M];D&&(D.remaining-=1,D.remaining<=0&&(P[M]=null));}let k=Array.from(C.children).filter(M=>/^t[dh]$/.test(at(M))),R=0,x=[],N=0,V=true;for(;N<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,V=false;break}let M=_[N];if(M!==null){let Q=M>1?`<w:gridSpan w:val="${M}"/>`:"";x.push(`<w:tc><w:tcPr><w:tcW w:w="${Kc(m,N,M)}" w:type="dxa"/>${Q}<w:vMerge/></w:tcPr><w:p/></w:tc>`),N+=M;continue}let D=k[R];if(D===void 0){x.push(`<w:tc><w:tcPr><w:tcW w:w="${m[N]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),N+=1;continue}R+=1;let K=Math.min(Yr(D,"colspan",63),s-N);for(let Q=N+1;Q<N+K;Q+=1)if(_[Q]!==null){K=Q-N;break}let j=Yr(D,"rowspan",1e3);j>1&&(P[N]={remaining:j-1,span:K}),x.push(YP(D,K,Kc(m,N,K),j>1,t,n,r,a,v)),N+=K;}if(!V)break;B.push(`<w:tr>${db(C)}${x.join("")}</w:tr>`);}B.length!==0&&(o.push(`<w:tbl><w:tblPr>${v?"<w:bidiVisual/>":""}${y}${u.xml}${T}${b}</w:tblPr><w:tblGrid>${O}</w:tblGrid>${B.join("")}</w:tbl>`),r.lastMarkCovered=false);}function YP(e,t,n,r,o,a,i,s,l){let d=at(e)==="th",u=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(u+=`<w:gridSpan w:val="${t}"/>`),r&&(u+='<w:vMerge w:val="restart"/>'),u+=cb(e,l);let f={run:d?{...a.run,bold:true}:a.run,para:d?{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,f,i,p,true),(p.length===0||p[p.length-1].endsWith("</w:tbl>"))&&p.push("<w:p/>"),`<w:tc><w:tcPr>${u}</w:tcPr>${p.join("")}</w:tc>`}function fb(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 pb(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 mb(e){if(at(e)!=="br")return false;let t=rt(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function gb(e){if(mb(e))return true;if(at(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||!mb(r))return false;t=true;}}return t}function hb(e){if(at(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=rt(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(at(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 Zc(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var Vc=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),jc=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),zc=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),QP=new Set([...jc,...zc,"table","ol","ul","w:sdt"]);function Wc(e){for(let t=0;t<e.children.length;t+=1)if(QP.has(at(e.children[t])))return true;return false}var JP=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function yb(e){if(at(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=at(i);if(JP.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(i);}}return null}var eC=4*1024*1024,tC=1e5,nC=64,rC=2*1024*1024,bb="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Uc(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 qs(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 g=e.nodeValue??"";if(n.pre){let b=g.replace(/\r\n?/g,`
4
+ `).split(`
5
+ `);for(let y=0;y<b.length;y+=1){if(y>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${Sr(n.run)}<w:br/></w:r>`);}let I=b[y];I.length>0&&r.push(_s(I,n.run));}return}let v=g.replace(/[ \t\r\n\f\v]+/g," ");if(v.length===0||v===" "&&qc(r))return;r.push(_s(v,n.run));return}if(!Fo(e))return;let a=at(e);if(Vc.has(a))return;let i=rt(e);if(Hs(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 g=pb(e);g.length>0&&r.push(`<w:r>${Sr(n.run)}${g}</w:r>`);return}let l=fb(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 g=Fc(Mc(n.run,a),i);if(r.push(`<w:r>${Sr(g)}${l}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let g=i.get("page-break-before")?.trim().toLowerCase()==="always"||i.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${Sr(n.run)}${g?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){Ey(e,r,o,g=>Uc(o,`${bb}/image`,g,false,n.rels??o.rels));return}let d=Mc(n.run,a),u=a==="a"?e.getAttribute("href"):null,f=a==="a"?Lc(i):null;f===null&&By(u)&&(d={...d,rStyle:"Hyperlink"});let p=ei(d,e),m={...n,run:p,pre:n.pre||a==="pre"};if(f!==null){let g={...m.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===f.kind&&n.noteBody.id===f.id){let v=f.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${Sr(g)}<w:${v}/></w:r>`);return}if(o.definedNotes[f.kind].has(f.id)){let v=f.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${Sr(g)}<w:${v} w:id="${f.id}"/></w:r>`);let b=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),y=`${f.kind}:${f.id}`;if(b.length>0&&!o.noteMarkFallbacks.has(y)&&o.noteMarkFallbacks.set(y,_s(b,g)),n.noteBody===void 0)o.bodyNoteRefs[f.kind].add(f.id);else {let I=`${n.noteBody.kind}:${n.noteBody.id}`,T=o.noteNoteRefs.get(I)??[];T.push({kind:f.kind,id:f.id}),o.noteNoteRefs.set(I,T);}return}for(let v of Array.from(e.childNodes))qs(v,t+1,m,r,o);return}if(a==="a"){let g=e.getAttribute("href"),v=gn(e.getAttribute("name")||e.getAttribute("id")),b=[];for(let T of Array.from(e.childNodes))qs(T,t+1,m,b,o);let y=g?.startsWith("#")?gn(g.slice(1)):null,I=b.join("");if(y!==null)I=`<w:hyperlink w:anchor="${N(y)}">${I}</w:hyperlink>`;else if(g!==null&&!g.startsWith("#")){let T=L(g);T.ok&&T.href.length>0&&(I=`<w:hyperlink r:id="${Uc(o,`${bb}/hyperlink`,T.href,true,n.rels??o.rels)}">${I}</w:hyperlink>`);}if(v!==null){let T=String(o.nextBookmarkId++);I=`<w:bookmarkStart w:id="${T}" w:name="${N(v)}"/>${I}<w:bookmarkEnd w:id="${T}"/>`;}I.length>0&&r.push(I);return}for(let g of Array.from(e.childNodes))qs(g,t+1,m,r,o);}function vb(e,t,n,r){let o=at(e),a=rt(e),i={};r&&(i.pageBreakBefore=true);let s=Sy(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=Yy[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 f=Wy(e,a,n,t.noteBody);return f&&(i.numPr=f),Py(i,e,n.classAlignments),Cy(i,a),l=ei(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 xb(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;let i=vb(e,n,r,a);kr(Array.from(e.childNodes),t+1,i,r,o,true,void 0,false);}function wb(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=Hy(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:Dc(r,`sem:${r.semanticListCount}`,i,Ac(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:Ac(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(!Fo(u))continue;let f=at(u);if(f==="li")r.nodesLeft-=1,xb(u,t+1,l,r,o,d),d=false;else if(f==="ol"||f==="ul"){let p=o.length;wb(u,t+1,{...n,list:s},r,o,d),o.length>p&&(d=false);}}}function kr(e,t,n,r,o,a=false,i,s=true){if(t>r.maxDepth)return;let l=o.length,d=i===void 0,u=[],f=[],p=n.para,m=i??{pending:false,skipSpacer:false},g=()=>({...p,pageBreakBefore:void 0,numPr:void 0}),v=()=>{if(u.length===0)return;if(!u.some(y=>y.includes("<w:r"))){if(o.length===l){f=f.concat(u),u=[];return}let y=o[o.length-1];y?.endsWith("</w:p>")?(o[o.length-1]=`${y.slice(0,-6)}${u.join("")}</w:p>`,u=[]):y!==void 0&&u.length>0&&(o.push(Xr(g(),u)),u=[],r.lastMarkCovered=false);return}let b=m.pending?{...p,pageBreakBefore:true}:p;o.push(Xr(b,u)),p.pageBreakBefore&&(p={...p,pageBreakBefore:void 0}),m.pending=false,m.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered,u=[];};for(let b of e){if(r.nodesLeft<=0){r.truncated=true;break}if(Fo(b)){let y=at(b),I=y==="w:sdt"?yb(b):null;if(s&&gb(b)){v(),r.nodesLeft-=1,m.pending&&Bs(o),m.pending=true,m.skipSpacer=true;continue}if(Vc.has(y)){r.nodesLeft-=1;continue}let T=rt(b);if(T.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(jy(T)){v(),r.nodesLeft-=1,kr(Array.from(b.childNodes),t+1,n,r,o,false,m,s);continue}if(r.definedNoteElements.has(b)){r.nodesLeft-=1;continue}if(jc.has(y)){if(v(),r.nodesLeft-=1,m.pending&&m.skipSpacer&&hb(b)){m.skipSpacer=false;continue}if(y==="div"&&Wc(b)){let P=vb(b,n,r,false);P.para.pageBreakBefore&&(m.pending=true),kr(Array.from(b.childNodes),t+1,P,r,o,false,m,s);continue}let O=o.length;xb(b,t,n,r,o,m.pending),o.length>O&&(m.pending=false,m.skipSpacer=false);continue}if(y==="ol"||y==="ul"){v();let O=o.length;wb(b,t,n,r,o,m.pending),o.length>O&&(m.pending=false,m.skipSpacer=false);continue}if(y==="table"){v(),m.pending&&Bs(o),oC(b,t,n,r,o),m.pending=false,m.skipSpacer=false;continue}if(zc.has(y)||I!==null||y==="span"&&Wc(b)){v(),r.nodesLeft-=1,kr(I??Array.from(b.childNodes),t+1,n,r,o,false,m,s);continue}}if(b.nodeType===3&&/^[\s\u00a0]+$/.test(b.nodeValue??"")&&qc(u)){r.nodesLeft-=1;continue}qs(b,t,n,u,r);}if(a&&o.length===l&&u.length>0&&!u.some(b=>b.includes("<w:r"))&&(o.push(Xr(p,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered),v(),f.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${f.join("")}`):b!==void 0?o.splice(l,0,Xr(g(),f)):u=f.concat(u),f=[];}u.length>0&&(o.push(Xr(g(),u)),u=[],r.lastMarkCovered=false),d&&m.pending&&(Bs(o),m.pending=false,m.skipSpacer=false,r.lastMarkCovered=false),a&&o.length===l&&(o.push(Xr(p,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered);}function oC(e,t,n,r,o){ub(e,t,n,r,o,kr);}function aC(e,t){return Gy({blocks:t,rels:e.rels,lists:[...e.lists.values()],notes:e.notes,noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function iC(e,t){let n=t.maxHtmlBytes??eC;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=Zy(r),i={footnote:new Set,endnote:new Set},s=new Set,l={footnote:new Set,endnote:new Set};Vy(r,a,l);let d={nodesLeft:t.maxNodes??tC,maxDepth:t.maxDepth??nC,maxImageBytes:t.maxImageBytes??rC,wordHtml:wy(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:ky(r),listDefinitions:Ay(Ty(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=ei(u,r.documentElement),u=ei(u,o);let f={run:u,para:u.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},p=[];for(let y of a)l[y.kind].has(y.id)&&(i[y.kind].has(y.id)||(i[y.kind].add(y.id),s.add(y.element),p.push(y)));p.sort((y,I)=>Zc(I.element)-Zc(y.element)),d.lastMarkCovered=false;let m=[];kr(Array.from(o.childNodes),0,f,d,m);let g=d.lastMarkCovered,v=d.truncated,b=false;for(let y=0;y<p.length;y+=1){let I=p[y];d.truncated=false;let T=d.nodesLeft,O=[];if(kr(Array.from(I.element.childNodes),0,{...f,noteBody:{kind:I.kind,id:I.id},rels:d.noteRels[I.kind]},d,O,true),d.truncated||O.length===0){b=true;let P=new Set;for(let B=y;B<p.length;B+=1){let C=p[B];i[C.kind].delete(C.id),s.delete(C.element),d.notes[C.kind].delete(C.id),d.bodyNoteRefs[C.kind].delete(C.id),P.add(`${C.kind}:${C.id}`);}if(P.size>0){for(let B=0;B<m.length;B+=1)m[B]=Ao(m[B],P,d.noteMarkFallbacks);for(let B of ["footnote","endnote"])for(let[C,_]of d.notes[B])d.notes[B].set(C,_.map(k=>Ao(k,P,d.noteMarkFallbacks)));}d.nodesLeft=T;for(let B=y;B<p.length&&d.nodesLeft>0;B+=1)kr(Array.from(p[B].element.childNodes),0,f,d,m);break}d.notes[I.kind].set(I.id,O);}return d.truncated=v||b,d.lastMarkCovered=g,zy(d,i,m,Uc),m.length===0?{ok:false,reason:"no-content"}:{ok:true,projection:d,blocks:m}}var sC=qy();function Sb(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return sC(e,n,()=>iC(e,t))}function Ib(e,t={}){let n=Sb(e,t);return n.ok?{ok:true,fragmentBytes:aC(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function kb(e,t={}){let n=Sb(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var lC={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function Tb(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 lC[n.toLowerCase()]??t})}var dC=new Set(["script","style","title","template"]),cC=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),uC=new Set(["td","th"]),Pb=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),fC=e=>Pb(e)||e!==void 0&&e>="0"&&e<="9",Cb=e=>e===" "||e===" "||e===`
6
+ `||e==="\r"||e==="\f";function pC(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!Pb(e[n]))return null;let o=n;for(;n<e.length&&fC(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};Cb(l)||(s=false);}n+=1;}return {name:a,closing:r,end:e.length}}function mC(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 gC(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&&Cb(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function*Rb(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=pC(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&dC.has(r.name)?t=gC(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
7
+ `:r.closing&&uC.has(r.name)?yield " ":r.closing&&cC.has(r.name)&&(yield `
8
+ `);}}function hC(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of Rb(t))n+=r;return Tb(n).replace(/\r\n?/g,`
9
+ `).split(`
10
+ `).map(mC).join(`
11
+ `).replace(/\n{3,}/g,`
12
+
13
+ `).trim()}function Eb(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 Ob=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function Mb(e){return Ob.test(e)}function Gc(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of Rb(t)){let r=n.includes("&")?Tb(n):n;if(Ob.test(r))return true}return false}function Xc(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?hC(n):""}function Yc(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function yC(e){if(!e)return false;if(Mb(Yc(e,"text/plain")))return true;let t=Yc(e,"text/html");if(t.length===0)return false;if(Gc(t))return true;let n=Ls(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:kb(t).imageCount>0}function bC(e){return e?Gc(Yc(e,"text/html")):false}var vC=Object.freeze({kind:"body"});function je(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 Ks(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=ed$1(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function Ab(e,t){return e?e.scope:t||vC}function xC(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(...Fb(i.fragments));return o}if(!t)return aa(e);let r=Lo(e,t);return r?Fb(r.fragments):[]}function Lo(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 Lb(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 Qc(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Jc(e,t,n){let r=cd(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 eu(e,t,n,r,o={}){return fd(e,t,n.fragments,r,o)}function wC(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=Lo(r,t);return o?te(e,t.pageIndex,o.fragments,n):null}function SC(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(...te(e,o.index,i.fragments,n));}return r.length>0?r:null}function Nb(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function Db(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 Hb(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!Lo(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(Lo(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function _b(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function Bb(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function tu(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function nu(e,t,n,r,o,a,i){let s=o?wC(e,o,i):a?SC(e,a,i):null,l=Ae(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 ru(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 $b(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let d=o.y,u=r.y,f=n?Math.max(u,n.box.y+n.box.height):u,p=n?Math.min(d,n.box.y):d;return f<=p?null:{x:r.x,y:p,width:r.width,height:f-p}}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 ou(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=$b(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 au(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=$b(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 No(e,t,n){if(!t&&!n)return ua$2(e);let r=new Set,o=[];for(let a of e.pages)for(let i of xC(a,t,n)){for(let s of i.lines)for(let l of qa$2(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 Zs(e,t,n,r){let o=No(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 Fb(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 qb(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 IC(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function kC(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 TC(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function PC(e,t){if(e)try{await e.delete(t);}catch{}}async function iu(e){let t=()=>{if(e.signal?.aborted)throw e.signal.reason};t();let n=e.fetcher??fetch,r=e.maxFontBytes??a$1,o=await IC(e.cacheName??"docx-editor-fonts");t();async function a(d){t();let u=Object.freeze({family:d.family,weight:d.weight,style:d.style}),f=qb(u);if(f)return {failure:{url:d.url,request:u,reason:"invalidRequest",diagnostic:f}};let p=(y,I)=>{if(y.byteLength===0)return {url:d.url,request:u,reason:"emptyResponse"};if(y.byteLength>r)return {url:d.url,request:u,reason:"overLimit"};let T=i(y,d.faceIndex??0);if(!T.valid)return {url:d.url,request:u,reason:"malformed",diagnostic:T.diagnostic};let O=a$2(y);return d.hash!==void 0&&d.hash!==O?{url:d.url,request:u,reason:"hashMismatch",expectedHash:d.hash,actualHash:O,...I?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:u,id:`url:${d.url}`,bytes:y,hash:O,faceIndex:d.faceIndex??0}},m=await kC(o,d.url);if(t(),m){let y=p(m,true);if(!("reason"in y))return {source:y};await PC(o,d.url),t();}let g;try{g=e.signal?await n(d.url,{signal:e.signal}):await n(d.url),t();}catch(y){return t(),{failure:{url:d.url,request:u,reason:"networkError",diagnostic:y instanceof Error?y.message:String(y)}}}if(!g.ok)return {failure:{url:d.url,request:u,reason:"httpError",status:g.status}};let v;try{v=new Uint8Array(await g.arrayBuffer()),t();}catch(y){return t(),{failure:{url:d.url,request:u,reason:"networkError",diagnostic:y instanceof Error?y.message:String(y)}}}let b=p(v,false);return "reason"in b?{failure:b}:(await TC(o,d.url,v),t(),{source:b})}let i$1=await Promise.all(e.sources.map(d=>a(d)));t();let s=[],l=[];for(let d of i$1)"source"in d?s.push(d.source):l.push(d.failure);return {sources:s,failures:l}}function CC(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=qb(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 RC=e=>e.trim().toLowerCase(),Kb=e=>JSON.stringify([RC(e.family),e.weight,e.style]);function EC(e){return i$1(async t=>{if(t.signal?.aborted)throw t.signal.reason;let n=new Set((t.resolvedFaces??[]).map(Kb)),r=e.sources.filter(s=>!n.has(Kb(s)));if(r.length===0)return {sources:[],failures:[]};let{onFailure:o,...a}=e,i=await iu({...a,sources:r,signal:t.signal});if(t.signal?.aborted)throw t.signal.reason;for(let s of i.failures)o?o(s):console.warn(`[fonts] ${s.request.family} (${s.url}): ${s.reason}`);return i})}var OC=96,Zb=37.79527559055118;function MC(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=Zb/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 FC(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var AC=1440,LC=567,NC=180,DC=56.7,Vs=(e,t,n)=>n<t||e<t?t:e>n?n:e;function HC(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 Vb(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 _C(e,t,n,r,o={}){let a=Vb(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=Vs(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:Vs(a-r.leftMargin,l,d)}}case "hanging":{let l=Vs(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=Vs(a,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}function jb(e,t){let n=e.snapshot().formatting;if(n)switch(t){case "text.color":return n.color?.kind==="hex"?n.color.value.replace(/^#/,""):void 0;case "text.highlight":return n.highlight;case "styles.style":return n.styleId;case "font.family":return n.fontFamily;case "font.size":return n.fontSizePt===void 0?void 0:String(n.fontSizePt*2);case "list.lineSpacing":return n.lineSpacing?.rule==="multiple"?String(n.lineSpacing.value):void 0;default:return}}function BC(e){if(!(!e||typeof e!="object"||"preventDefault"in e))return e}var zb="no formatting has been copied",js="there is nothing at the selection to copy",su="the selection has nothing to paint",zs=Object.freeze({mode:"off",level:"none"});var lu=new WeakMap;function nr(e){let t=lu.get(e);if(t)return t;let n=Ge(e);if(n.length===0)return lu.set(e,[]),[];let r=[];for(let o of n){let a=Fe(o);for(let i of new Set([o.beginParagraphId,...o.resultParagraphIds,o.endParagraphId])){let s=Ha(e,i);if(s?.kind!=="paragraph")continue;let l=Ze$1(s),d=i===o.beginParagraphId,u=i===o.endParagraphId;r.push({toc:o,paragraphId:i,length:l.length,startsHere:d,endsHere:u,start:d?l.spanOf(o.beginNodeId)?.start??0:0,end:u&&a?l.spanOf(a.endNodeId)?.end??l.length:l.length});}}return lu.set(e,r),r}function Ws(e){return new Set(nr(e).filter(t=>t.start===0&&t.end===t.length&&!(t.endsHere&&!t.startsHere&&t.end===0)).map(t=>t.paragraphId))}function du(e,t){return e.endsHere&&!e.startsHere&&e.end===0||e.startsHere&&e.start>0&&t<=e.start||e.endsHere&&e.end<e.length&&t>=e.end?false:t>=e.start&&t<=e.end}function Jt(e,t){return nr(e).find(n=>n.paragraphId===t.paragraphId&&du(n,t.offset))?.toc}function Wb(e,t){let{anchor:n,head:r}=t;if(n.paragraphId===r.paragraphId){let o=Math.min(n.offset,r.offset),a=Math.max(n.offset,r.offset);return nr(e).some(i=>i.paragraphId===n.paragraphId&&(o===a?du(i,o):o<i.end&&a>i.start))}return Jt(e,n)!==void 0||Jt(e,r)!==void 0}function Ub(e,t){let n=nr(e);if(n.length===0)return false;let r=ti$1(t);if(r.kind==="nodes")return r.targets.some(i=>n.some(s=>{if(i.nodeId!==s.paragraphId)return false;if(i.range){let{start:l,end:d}=i.range;return l===d?du(s,l):l<s.end&&d>s.start}return t.op==="joinParagraphs"&&t.firstId===s.paragraphId&&s.endsHere&&s.end===0?false:i.removes||i.structural?true:s.end>s.start||s.length===0&&!s.endsHere}));let o=new Set(n.map(i=>i.paragraphId)),a=(i,s="")=>typeof i=="string"?/(?:Id|Ids)$/.test(s)&&o.has(i):Array.isArray(i)?i.some(l=>a(l,s)):!!i&&typeof i=="object"&&Object.entries(i).some(([l,d])=>a(d,l));return a(t)}function Gb(e,t,n){let r=Jt(e,t);if(!r)return null;let o=nr(e).find(a=>a.toc.id===r.id&&(n?a.startsHere&&a.start>0:a.endsHere&&a.end<a.length));return o?{paragraphId:o.paragraphId,offset:n?o.start:o.end}:null}function Xb(e,t){return !nr(t).some(r=>r.toc.id===e.id&&(r.start>0||r.end<r.length))&&e.contentControlId?e.contentControlId:`toc:${e.id}`}function Yb(e,t,n){if(!t)return;let r=n?.closest("[data-start]");return nr(e).find(o=>o.paragraphId===t&&(r?Number(r.dataset.start)<o.end&&Number(r.dataset.end)>o.start:Ws(e).has(t)))?.toc}var ti=/^[0-9A-Fa-f]{6}$/,Qb={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"},$C={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 cu(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function Us(e){return Math.max(0,Math.min(1,e))}function Jb(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 e0(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 t0(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-Us(t))*255)))/255,o=Jb(e);return e0(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function n0(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(Us(t)*255)))/255,o=Jb(e);return e0(r*o.r,r*o.g,r*o.b)}function uu(e){return Qb[e]??Qb[e.toLowerCase()]??null}function qC(e,t){let n=uu(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&ti.test(r))return r.toUpperCase();let o=$C[n];return o&&ti.test(o)?o.toUpperCase():null}function Gs(e,t){let n=qC(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!cu(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!cu(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=t0(r,Us(e.tint)):e.shade!==void 0&&(r=n0(r,Us(e.shade))),{ok:true,hex:r}}var KC="000000";function fu(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return ti.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:KC}};let n=Gs(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:uu(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function pu(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 ti.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=Gs(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:uu(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function ZC(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return ti.test(o)?`#${o}`:`#${n}`}let r=Gs(e,t);return `#${r.ok?r.hex:n}`}function mu(e,t){return md(e).occurrences.some(n=>n.table.tableId===t&&n.row.cells.some(r=>r.logicalGridColumn!==void 0))}function r0(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var WC=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function Tr(e){return WC.has(e.type)}function ve(e,t){return {ok:false,code:e,reason:t}}function gu(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 Pt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zt(e,t){return !Pt(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function s0(e){if(!Pt(e))return false;let t=e.kind;if(t==="hex")return zt(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return zt(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 zt(e,n)}return false}function l0(e){return Pt(e)&&zt(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 d0(e){return Pt(e)&&zt(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 UC(e){return Pt(e)&&zt(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 GC(e){return Pt(e)&&zt(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 XC(e){return !Pt(e)||!zt(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&s0(e.color)}function o0(e){return !("target"in e)||e.target===void 0||l0(e.target)}function a0(e){return !("target"in e)||e.target===void 0||d0(e.target)}function YC(e){switch(e.type){case "insertRow":return !Pt(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"):o0(e)?null:ve("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !Pt(e)||e.type!=="deleteRow"?ve("invalidArgs","deleteRow command shape is invalid"):o0(e)?null:ve("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !Pt(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"):a0(e)?null:ve("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !Pt(e)||e.type!=="deleteColumn"?ve("invalidArgs","deleteColumn command shape is invalid"):a0(e)?null:ve("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !Pt(e)||!zt(e,["type"])?ve("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !Pt(e)||!zt(e,["type","color"])?ve("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!s0(e.color)?ve("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !Pt(e)||!zt(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?ve("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !Pt(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)||!XC(e.spec)?ve("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !Pt(e)||!zt(e,["type","target","leftWidthTwips","rightWidthTwips"])||!UC(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?ve("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !Pt(e)||!zt(e,["type","target","columnWidthTwips","tableWidthTwips"])||!GC(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?ve("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function QC(e){return !("target"in e)||e.target===void 0?null:l0(e.target)?e.target:null}function JC(e){return !("target"in e)||e.target===void 0?null:d0(e.target)?e.target:null}function eR(e,t){let n=Ih(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 tR(e,t){let n=Ih(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=c0(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 i0(e,t,n){let r=Ih(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function nR(e){let t=za$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 c0(e){let t=Fh(e,"tcPr"),n=t&&Fh(t,"gridSpan"),r=n&&Gh(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 rR(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=c0(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 oR(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Ih(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 aR(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Ih(e.part.root,t.tableId);return n.ok?rR(n.topology,t.tableId,t.gridColumnId):null}function iR(e,t){for(let n of t){let r=_i(e,n);if(r)return gu(r)}return null}function jt(e,t,n){let r=iR(e,t);return r||{ok:true,ops:t,selection:n}}function sR(e,t){if(!Ai$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=fu(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function ni(e,t,n){return n!==e.storeRevision?ve("invalidArgs","the table target is stale"):Ih(e.part.root,t).ok?null:ve("invalidArgs","the table target is no longer valid")}function lR(e){return e?.isHeaderRepeat?ve("unsupported","repeated header rows cannot be edited"):null}function dR(e,t,n,r){let o=ni(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=Ih(e.part.root,t.tableId);if(!a.ok){let f=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return gu(f)}if(a.topology.hasMerge)return ve("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(f=>f.id===t.leftGridColumnId),s=a.topology.gridColumns.find(f=>f.id===t.rightGridColumnId);if(!i||!s)return ve("invalidArgs","the table target is no longer valid");let l=a.topology.gridColumns.indexOf(i),d=a.topology.gridColumns.indexOf(s);if(Math.abs(d-l)!==1)return ve("invalidArgs","the column divider target is not adjacent");let u={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:l<d?t.leftGridColumnId:t.rightGridColumnId,rightGridColumnId:l<d?t.rightGridColumnId:t.leftGridColumnId,leftWidthTwips:l<d?n:r,rightWidthTwips:l<d?r:n};return jt(e.part,[u],{kind:"preserveSelection"})}function cR(e,t,n,r){let o=ni(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=Ih(e.part.root,t.tableId);if(!a.ok){let l=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return gu(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 jt(e.part,[s],{kind:"preserveSelection"})}function u0(e,t,n){if(e.viewing||!e.editable)return ve("locked","the document is open for viewing");let r=ni(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 jt(e.part,[o],{kind:"preserveSelection"})}function rr(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=YC(t);if(a)return a;let i=QC(t),s=JC(t),l=lR(i??s);if(l)return l;if(i){let u=ni(e,i.tableId,i.sourceRevision);if(u)return u}if(s){let u=ni(e,s.tableId,s.sourceRevision);if(u)return u}let d=i!==null?oR(e,i):s!==null?aR(e,s):nR(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 jt(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!d)return ve("unsupported","the selection is not inside a table");let u=eR(n,d),f=u.wholeTable?[{op:"deleteBlock",blockId:d.tableId}]:u.rowIds.map(p=>({op:"deleteTableRow",tableId:d.tableId,rowId:p,...p===d.rowId?{referenceCellId:d.cellId}:{}}));return jt(n,f,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!d)return ve("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,f=s?.gridColumnId??i0(n,u,d.gridColumnIndex),p=mu(e.layout,u)?t.where==="left"?"right":"left":t.where,m=f?{op:"insertTableColumn",tableId:u,where:p,gridColumnId:f}:{op:"insertTableColumn",tableId:u,where:p,referenceCellId:d.cellId};return jt(n,[m],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!d)return ve("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,f=s?.gridColumnId??i0(n,u,d.gridColumnIndex);if(!f)return ve("invalidArgs","the table has no grid column to delete");let p=s?.gridColumnId===void 0?tR(n,d):{gridColumnIds:[f],wholeTable:false};if(p.wholeTable)return jt(n,[{op:"deleteBlock",blockId:u}],{kind:"adoptCommittedCaret"});let g=(p.gridColumnIds.length>0?p.gridColumnIds:[f]).map(v=>({op:"deleteTableColumn",tableId:u,gridColumnId:v}));return jt(n,g,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!d)return ve("unsupported","the selection is not inside a table");let u={op:"deleteBlock",blockId:d.tableId};return jt(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 p=pu(t.color,e.themeColors);if(!p.ok)return ve("invalidArgs",p.reason);u=p.color;}let f={op:"setTableCellFill",tableId:d.tableId,cellIds:d.cellIds,color:u};return jt(n,[f],{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 jt(n,[u],{kind:"preserveSelection"})}case "setTableBorders":{if(!d)return ve("unsupported","the selection is not inside a table");if(t.scope==="none"){let p={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:"none",target:r0(t.target,mu(e.layout,d.tableId))};return jt(n,[p],{kind:"preserveSelection"})}let u=sR(t.spec,e.themeColors);if(!u.ok)return ve("invalidArgs",u.reason);let f={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:r0(t.scope,mu(e.layout,d.tableId)),spec:u.spec};return jt(n,[f],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return dR(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return cR(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return ve("unsupported",`command '${t.type}' is not a table command`)}}function f0(e){if(!Tr(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}function Tt(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 Qr(e){if(typeof e!="object"||e===null)return false;let t=e;return Tt(t.from)&&Tt(t.to)}function p0(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 Wt(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=Ui(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=p0(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=p0(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 m0(e,t,n){if("anchor"in n){let s=Wt(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(!Tt(r)||!Tt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=Wt(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=Wt(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 uR=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function fR(e,t){return e===t?true:!e||!t?false:uR.every(n=>e[n]===t[n])}function hu(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||!fR(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 yu(e,t){return e.current===t.current&&e.total===t.total}function bu(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 g0(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 vu(e,t){return e===t?true:!e||!t||!Qr(e)||!Qr(t)?false:g0(e.from,t.from)&&g0(e.to,t.to)}function xu(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var pR={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",documentProtection:"compared",reviewDisplayMode:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},mR=Object.keys(pR);function wu(e,t){return mR.every(n=>e[n]===t[n])}function Xs(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Xs(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Xs(t[n]);return Object.freeze(e)}var Su=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"}}]]),gR=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),hR=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,yR=/^[0-9A-Fa-f]{6}$/;function Iu(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!hR.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"&&!yR.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"||!gR.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 v0(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function ku(e){return typeof e=="object"&&e!==null&&v0(e.anchor)&&v0(e.head)}function Ut(e,t){let n=new Error(t);return n.code=e,n}function Ys(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 Tu(e){return e==="blank"?Ic():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Pu(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 ri(e){switch(e.type){case "toggleMark":return Su.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=Iu(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)>Gb$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${Gb$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)>Gb$1)return {supported:false,reason:`indent values must be within \xB1${Gb$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=f0(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(ku(e.range)||Qr(e.range))||"anchor"in e&&Tt(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`}}}var yn="comments and tracked changes require the pro review module (@docx-editor.dev/pro)";var Pr="suggesting mode needs an author; configure author before enabling it",bR="this document asks for tracked changes, but no author is configured",x0="this document is protected for filling in forms, which does not track changes",oi="this document is protected against editing; open it in Word to change that",ai="this document is protected for comments only",Cu={mode:null,rejection:null};function Ru(e,t){if(e===void 0||e==="view")return Cu;if(e==="edit")return {mode:"editing",rejection:null};let n=Eu(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function Eu(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:Pr}:{ok:false,code:"unsupported",reason:yn}}function w0(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==Pr||t||n!==null||(n=setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let a=`${Pr}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(Ut("suggestingNeedsAuthor",a)),r(`[@docx-editor.dev/core] ${a}`);},0));},dispose(){n!==null&&clearTimeout(n),n=null;}}}function Ou(e){if(e.restrictedToReadOnly)return e.currentMode==="viewing"?Cu:{mode:"viewing",rejection:oi};let t=e.currentMode,n=null;e.engineAdoptedViewing&&t==="viewing"&&!e.viewOnly&&(n="editing",t="editing");let r=n===null?Cu:{mode:n,rejection:null};return e.restrictedToComments?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:ai}:r:e.restrictedToForms?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:x0}:r:e.viewOnly||t!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?r:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:n,rejection:bR}}function S0(e){return e===null?{enter:true,rejection:null}:{enter:false,rejection:e.reason}}function Mu(e,t){return t!=="viewing"&&e.restrictedToReadOnly?{ok:false,code:"locked",reason:oi}:t==="suggesting"&&e.restrictedToComments?{ok:false,code:"locked",reason:ai}:t==="suggesting"&&e.restrictedToForms?{ok:false,code:"locked",reason:x0}:t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function I0(e,t,n,r,o,a=false){let i=Ru(e,t),s=e==="view"?"viewing":i.mode??o,l=Ou({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:s,engineAdoptedViewing:a});l.mode!==null&&(s=l.mode);let d=Mu(n,s),u=n.restrictedToReadOnly?"viewing":r;return {mode:d===null?s:u,rejection:l.rejection??d?.reason??null,configurationRejection:i.rejection}}var k0=new WeakMap;function T0(e,t){k0.set(e,t);}var ii="this document is protected; only form fields can be filled";function Cn(e,t){if(e.type==="undo"||e.type==="redo"||e.type==="toggleDocumentProtection")return null;let n=Qf$1(t.session.currentPackage()),r=If$1(n?.root);if(!r.enforced)return null;if(r.edit==="readOnly"||r.edit==="comments")return {ok:false,code:"locked",reason:r.edit==="comments"?ai:oi};if(r.edit!=="forms"||Tr(e))return null;let o="structure",a,i=false;switch(e.type){case "insertText":o="text",a=e.text;break;case "paste":case "pasteWithoutFormatting":o="text",a=e.text,i=true;break;case "deleteText":case "cut":o="text";break;case "toggleMark":case "setMarkAttr":case "pasteFormatting":o="runFormat";break;case "clearFormatting":case "setAlignment":case "setLineSpacing":case "setParagraphSpacing":case "setIndent":case "adjustIndent":case "toggleList":case "setParagraphStyle":case "setParagraphFormat":case "removeTabMark":o="paragraph";break;case "setPageSetup":case "setHeaderFooterOptions":case "convertAllNotes":case "insertToc":case "refreshToc":case "replaceAllMatches":case "resolveAllReviewChanges":case "acceptRevision":case "rejectRevision":case "acceptAllRevisions":case "rejectAllRevisions":o="document";break}let s=t.state().selection,l=t.session.storyParts().find(p=>s.head.paragraphId.startsWith(`${p.name}#`));if(!l)return {ok:false,code:"locked",reason:ii};let d=t.state().cellSelection;return (d&&(o==="runFormat"||o==="paragraph")?[...ua$1(t.layout(),d.cellIds)].map(p=>({anchor:{paragraphId:p,offset:0},head:{paragraphId:p,offset:(Ui(l,p)??"").length}})):[s]).some(p=>qi(l,n,{selection:p,intent:o,text:a,paste:i,fieldId:k0.get(t)?.()??void 0}))?{ok:false,code:"locked",reason:ii}:null}function P0(e,t){if(e!=="locked")return e;let n=If$1(t);return n.enforced?n.edit==="comments"?ai:n.edit==="forms"?ii:oi:"this content is locked"}function C0(e){return e!==null&&Cn({type:"resolveAllReviewChanges"},e)!==null}function R0(e,t){return ()=>e()??(t()?null:"the document is read-only")}function vR(e){return [e.left,e.top,e.right,e.bottom]}function Fu(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function xR(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function si(e){return Math.round(e*1e3)}function li(e){return e/1e3}function Au(e){return Object.freeze({left:si(e.left),top:si(e.top),right:si(e.right),bottom:si(e.bottom)})}function wR(e){return Object.freeze({left:li(e.left),top:li(e.top),right:li(e.right),bottom:li(e.bottom)})}function Lu(e){return vR(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var SR=new Set(["insertImage","replaceImage"]),IR=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function Nu(e,t,n){return n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function kR(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&Nu(o,n,r))return o;return null}function TR(e,t,n,r){let o=e.layout();for(let a of o.pages){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&Nu(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&&Nu(s,n,r))return s}}return null}function E0(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function di(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=ge$1(e.layout(),n.paragraphId,n.offset),a=t.kind==="pointer"?t.drawingNodeId:null;return kR(o,n.paragraphId,n.offset,a)??TR(e,n.paragraphId,n.offset,a)}function O0(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=Ha(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:rb$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:kb$1,limits:jb$1,resolveRelationship:mb$1(e.session.currentPackage(),t.ownerPartName)})}function M0(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 PR(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 F0(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 CR(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function Rn(e){let t=di(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?O0(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:Fu(t.crop),rotationDegrees:r.rotationDegrees,wrap:CR(t),position:M0(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:PR(t),...F0(n)})}function A0(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 Du(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function L0(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function Hu(e){return Du(e)!==void 0||L0(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function _u(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=L0(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=Du(t),i=Rn(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 Ho(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function Cr(e,t){let n=Rn(e),r=Du(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 RR(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 Qs(e,t){return RR(e.applyDrawingOps(t))}function ER(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 OR(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function MR(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function FR(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||Ei$1(e)}function N0(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 ci(e){return IR.has(e.type)}function AR(e){return SR.has(e.type)}function D0(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function H0(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 ui(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Rn(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function Ho(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=Rn(r),s=n.drawingNodeId??t.drawingNodeId;if(!i||!s||i.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function fi(e,t){if(!ci(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=Cn(e,t);if(n)return n;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 a=Cr(t,e);return "ok"in a?a:null}let r=Cr(t,e);if("ok"in r)return r;let o=Rn(t);if(!o)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 o.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return o.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return o.locks.changeAspect||o.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!o.canMove||o.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!MR(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let a=o.position?.mode??"frame";return Gi(e,a)?Bi(N0(e,o))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(OR(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!FR(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!o.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&&!o.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!o.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!Lu(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!o.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&&!o.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(Ei$1(e)){if(!o.canMove||o.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let i=o.position?.mode??"frame";if(!Gi(e,i))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!Bi(Fi$1(e,o)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function Bu(e,t){let n=H0(t,e.type);if(n)return n;let r=fi(e,t);return r||{ok:true}}function _0(e,t){let n=fi(e,t);return n||D0(e)}function B0(e,t,n){if(AR(t))return D0(t);let r=n&&Hu(t)?ui(n):null;if(r&&n){let o=_u(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=Cr(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=Cr(e,t);return "ok"in o?o:Qs(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=Cr(e,t);return "ok"in o?o:Qs(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=Cr(e,t);if("ok"in o)return o;let a=Rn(e),i=N0(t,a);return Qs(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=Cr(e,t);if("ok"in o)return o;let a=Rn(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let d=ER(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:Au(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}),Ei$1(t)){let d=Fi$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"}:Qs(e,i)}default:return null}}function LR(e,t,n,r,o){let a=lc(e.sectionPropertiesAt(t)),i=a.width-a.margin.left-a.margin.right,s=a.height-a.margin.top-a.margin.bottom,l=ge$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 $u(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=H0(n,t.type);if(r)return r;let o=fi(t,n);if(o)return o;let a=ui(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:f}=n.state().selection,p=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let m=LR(n,f.paragraphId,f.offset,t.widthPoints,t.heightPoints),g=await n.insertImage({paragraphId:f.paragraphId,offset:f.offset,bytes:t.data,mime:t.mime,widthPoints:m.widthPoints,heightPoints:m.heightPoints,expectedPackageRevision:p,commitGuard:()=>Ho(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),v=Ho(e,a);return v||(g.ok?{ok:true,changed:g.change!==null}:{ok:false,code:"invalidArgs",reason:g.detail==="stale-package-epoch"?"stale package revision":g.detail??g.reason??"insertImage was refused"})}let i=Cr(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:()=>Ho(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),u=Ho(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 NR=1,DR=10,pi=12700;function HR(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=F0(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function _R(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=di(e);if(!r||r.accessibility.hidden)return null;let o=e.layout(),a=ld(o,r.drawingNodeId);if(!a)return null;let i=O0(e,r);if(!i||i.locks.select)return null;let s=HR(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:M0(i),anchorFrameOrigin:u,transform:r.transform,...d})}function Et(e){return Math.round(e*pi)}function Do(e){return e/pi}function BR(e,t,n,r,o,a){let i=Do(e),s=Do(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 p=Math.max(i/Do(e),s/Do(t));i=Math.max(1,Do(e)*p),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:Et(i),cy:Et(s)})}function qu(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+Et(t),verticalEmu:(e.verticalEmu??0)+Et(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+Et(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+Et(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function $R(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"}:Ho(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function $0(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 Ku(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 Js(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 q0(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 K0(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$3(o);return {...a!==void 0?{paraId:a}:{},text:Ui(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function Zu(e){return e?e.state().pageCount:0}function Vu(e,t="caret"){return e?e.currentPage(t):1}function qR(e,t){if(!Tr(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=el(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 KR(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 el(e,t){let n=KR(e,t),r=rr(n),o=Qf$1(t.session.currentPackage());return r.ok&&r.ops.some(a=>vi$1(n.part,o,a))&&(r={ok:false,code:"locked",reason:ii}),r.ok?{can:{ok:true},plan:r}:{can:{ok:false,code:r.code,reason:r.reason},plan:r}}function mi(e,t,n,r){if(r?.scope){if(r.scope.kind==="all")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"the all scope is read-only"}};if(r.scope.kind==="note"||r.scope.kind==="frame")return {ok:false,refusal:{ok:false,code:"unsupported",reason:`scope kind '${r.scope.kind}' is not supported`}};if(r.scope.kind==="headerFooter"){let s=t?.activeScope?.()??{kind:"body"};if(s.kind!=="headerFooter"||s.rId!==r.scope.rId)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"open that header or footer before dispatching against its scope"}}}}let o=ri(e);if(!o.supported)return {ok:false,refusal:{ok:false,code:o.code??"unsupported",reason:o.reason}};if(!t)return {ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}};if(o.mutating&&(n==="view"||!t.session.editable))return {ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}};let a=o.mutating?Cn(e,t):null;if(a)return {ok:false,refusal:a};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:s,head:l}=t.state().selection;if(s.paragraphId===l.paragraphId&&s.offset===l.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(s=>s.type==="paragraph"))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"this document defines no paragraph styles"}};if(e.type==="pasteFormatting"&&t.formatPainter.state().level==="none")return {ok:false,refusal:{ok:false,code:"notFound",reason:zb}};if(e.type==="undo"&&!t.state().canUndo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.state().canRedo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to redo"}};if(e.type==="insertTable"&&!t.canInsertTable(e.rows,e.cols))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table can only be inserted at a caret in editable body, cell, or note text"}};if(e.type==="insertToc"&&!t.canInsertToc())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table of contents can only be inserted in the editable document body"}};if(e.type==="editTextFormField"&&!t.canEditTextFormField())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"field options are unavailable"}};if(e.type==="refreshToc"&&!t.canRefreshToc(e.tocId))return {ok:false,refusal:{ok:false,code:"notFound",reason:"there is no refreshable table of contents at the selection"}};if(e.type==="insertPageField"&&(t.activeScope?.()??{kind:"body"}).kind!=="headerFooter")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}};if(e.type==="insertNote"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertNote requires body scope"}};if(e.type==="insertBreak"&&(e.kind==="section"||e.kind==="sectionContinuous")){if((t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a section break can only be inserted in the editable document body"}};let l=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(l)return {ok:false,refusal:{ok:false,code:"unsupported",reason:l}}}if(e.type==="insertBreak"&&e.kind==="page"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a page break can only be inserted in the editable document body"}};if(e.type==="linkHeaderFooterToPrevious"){let s=t.headerFooterState?.();if((e.sectionIndex??s?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(Tr(e)){let s=qR(e,t);return s.ok?{ok:true,tablePlan:s.tablePlan}:s}let i=fi(e,t);return i&&!i.ok?{ok:false,refusal:i}:{ok:true}}function Z0(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!Ha(n,t))return true;let r=Ia$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=Ia$1(n,r.id);}return false}function V0(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!Z0(e,t.selection.head.paragraphId))return null;let r=ya$2(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 tl(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!Z0(e,t.selection.head.paragraphId))return null;let r=ya$2(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 j0(e){return e?{...e.bold!==void 0?{bold:e.bold}:{},...e.italic!==void 0?{italic:e.italic}:{},...e.underline!==void 0?{underline:e.underline}:{},...e.fontFamily?{fontFamily:e.fontFamily}:{},...e.fontSizePt!==void 0?{fontSizeHalfPoints:Math.round(e.fontSizePt*2)}:{},...e.styleId?{styleId:e.styleId}:{},...e.alignment?{alignment:e.alignment}:{}}:null}function z0(e){return !!e&&Jt(e.session.part(),e.state().selection.head)!==void 0}var pe={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"],lock:["M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"],format_align_left:["M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"],format_align_center:["M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"],format_align_right:["M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"],format_align_justify:["M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"],format_line_spacing:["M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"],format_list_bulleted:["M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"],format_list_numbered:["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],format_indent_increase:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"],format_indent_decrease:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"],format_color_text:["M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"],ink_highlighter:["M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"],format_color_reset:["M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"],arrow_drop_down:["M480-360 280-560h400L480-360Z"],table:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"],table_chart:["M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"],grid_on:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],table_rows:["M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"],view_column:["M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"],border_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],select_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],border_outer:["M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"],border_inner:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"],border_clear:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],add:["M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"],remove:["M200-440v-80h560v80H200Z"],delete:["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],delete_sweep:["M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"],call_merge:["m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"],call_split:["M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"],drag_indicator:["M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"],image:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"],format_image_left:["M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"],format_image_right:["M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"],horizontal_rule:["M160-440v-80h640v80H160Z"],flip_to_back:["M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],flip_to_front:["M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],open_with:["M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"],tune:["M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"],rotate_right:["M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"],rotate_left:["M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"],swap_horiz:["M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"],swap_vert:["M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"],shapes:["M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"],format_paint:["M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"],expand_more:["M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"],expand_less:["m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"],border_top:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_bottom:["M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_left:["M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_right:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"],border_horizontal:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],border_vertical:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],padding:["M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],text_rotation_none:["M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"],wrap_text:["M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"],height:["M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"],fit_width:["M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],settings:["m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],border_color:["M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"],format_color_fill:["m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"],vertical_align_top:["M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"],vertical_align_center:["M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"],vertical_align_bottom:["M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"],line_weight:["M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"],keyboard_arrow_up:["M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"],keyboard_arrow_down:["M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"],keyboard_arrow_left:["M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"],keyboard_arrow_right:["M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"],more_vert:["M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"],page_break:["M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"],branding_watermark:["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"],arrow_back:["M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"],search:["M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"],toc:["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],done_all:["M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"],check_circle:["m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"],chat_bubble_outline:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],chat_bubble_check:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],check:["M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"],close:["m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"],add_comment:["M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],comment:["M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],edit_note:["M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"],rate_review:["M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],visibility:["M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"],format_textdirection_l_to_r:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"],format_textdirection_r_to_l:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"],"agent-sparkle":["m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"]};var _o={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},U0=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function ju(e){return createT(en)(e)}function gi(e){return U0.includes(e)}function jR(e){return e!=null}var G0=[{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"}],X0=[{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"}],zR=[{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 WR(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function UR(e){return e==="none"||WR(e)}function W0(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function GR(e){return X0.some(t=>t.value===e)}function Jr(e,t,n){switch(t){case "table.borderTarget":return UR(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(!W0(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(!GR(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&&!W0(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function zu(e,t=_o){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return Jr(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return Jr(t,e,"single")?.command??null;case "table.borderWidth":return Jr(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function XR(e){return G0.find(n=>n.value===e)?.labelKey??"table.borders.all"}function YR(e){return pe[e]}function Rr(e){return e.surface??null}var QR={"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.protectDocument":{type:"toggleDocumentProtection"},"review.simpleMarkup":{type:"setReviewDisplayMode",mode:"simple-markup"},"review.allMarkup":{type:"setReviewDisplayMode",mode:"all-markup"},"review.noMarkup":{type:"setReviewDisplayMode",mode:"proposed"},"review.original":{type:"setReviewDisplayMode",mode:"original"},"review.previousChange":{type:"navigateReviewChange",direction:"previous"},"review.nextChange":{type:"navigateReviewChange",direction:"next"},"review.acceptAllChanges":{type:"resolveAllReviewChanges",action:"accept"},"review.rejectAllChanges":{type:"resolveAllReviewChanges",action:"reject"},"history.undo":{type:"undo"},"history.redo":{type:"redo"},"text.bold":{type:"toggleMark",mark:"bold"},"text.italic":{type:"toggleMark",mark:"italic"},"text.underline":{type:"toggleMark",mark:"underline"},"text.strike":{type:"toggleMark",mark:"strike"},"script.super":{type:"toggleMark",mark:"superscript"},"script.sub":{type:"toggleMark",mark:"subscript"},"format.clear":{type:"clearFormatting"},"alignment.left":{type:"setAlignment",align:"left"},"alignment.center":{type:"setAlignment",align:"center"},"alignment.right":{type:"setAlignment",align:"right"},"alignment.justify":{type:"setAlignment",align:"justify"},"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 JR(e){return Q0[e]??null}var Y0=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),Q0={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:Y0,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 rl(e){return QR[e]??null}var eE={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},J0={"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 ev(e,t,n){return Jr(n,e,t)?.command??null}function nl(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(gi(e))return ev(e,t,_o);if(e==="image.wrap")return typeof t!="string"||!ib$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=eE[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function tv(e,t,n=_o){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=zu(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 tE=["editing","suggesting","viewing"];function nv(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(gi(t))return tv(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=tE.filter(d=>d!==a).map(d=>e.can(nl(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=Rr(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=Rr(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=Rr(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=rl(t);if(!n){let a=J0[t];if(a!==void 0){let s=nl(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:jb(e,t);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=Q0[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let l=e.canExecuteImageCommand?.({type:"insertImage",data:Y0,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.exportMarkdown"||t==="file.exportPdf"?{id:t,enabled:false,active:false,disabledReason:"export is not a command; run it with runChromeExport(editor, format, handlers)"}:t==="file.print"?{id:t,enabled:false,active:false,disabledReason:"print is not a command; run it with runChromePrint(editor, handlers)"}:t==="file.save"?{id:t,enabled:false,disabledReason:"save is not a command; run it with runSave(editor)",active:false}:t==="file.open"?{id:t,enabled:false,disabledReason:"open is not a command; run it with editor.load(bytes)",active:false}:{id:t,enabled:false,disabledReason:"not wired to an editor command",active:false}}let r=e.can(n),o=e.isActive?.(n)??false;return r.ok?{id:t,enabled:true,disabledReason:null,active:o}:{id:t,enabled:false,disabledReason:r.reason,active:o}}function nE(e){if(e==="format.painter")return true;let t=rl(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="toggleDocumentProtection"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"}function rE(e,t){return t.map(n=>nv(e,n))}function oE(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=Jr(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}}var aE=new Set(["format.painter","contentControl.showAll","contentControl.formFill","contentControl.inspector","contentControl.remove"]);function iE(e,t,n,r){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(n&&typeof n=="object"&&("historyGroup"in n||"scope"in n||Object.keys(n).length===0)){if(r||J0[t]!==void 0||gi(t))return {ok:false,code:"invalidArgs",reason:"pass a toolbar value before command options"};r=n,n=void 0;}if(r?.historyGroup!==void 0&&aE.has(t))return {ok:false,code:"unsupported",reason:`${t} does not take a history group`};if(t==="format.painter"){let i=Rr(e);if(!i)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(i.formatPainter.state().mode==="off"){let s=e.can({type:"clearFormatting"});if(!s.ok)return {ok:false,code:s.code,reason:s.reason}}return i.formatPainter.press()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:js}}if(t==="contentControl.showAll"){let i=Rr(e);return i?(i.contentControls.setShowAll(!i.contentControls.showAll()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.formFill"){let i=Rr(e);return i?(i.contentControls.setFormFill(!i.contentControls.formFill()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.inspector"){let i=Rr(e);return i?i.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 i=Rr(e);if(!i)return {ok:false,code:"unsupported",reason:"editor is not ready"};let s=i.state().contentControls.activeControlId;if(!s)return {ok:false,code:"notFound",reason:"no content control at the selection"};let l=i.contentControls.disabledReason(s,"remove");return l?{ok:false,code:l==="bound"?"bound":"locked",reason:l}:i.contentControls.remove(s)?{ok:true,changed:true}:{ok:false,code:i.state().lastRejection??"unsupported",reason:i.state().lastRejection??"removeContentControl was refused"}}let o=n===void 0?rl(t):nl(t,n);if(!o)return n!==void 0?{ok:false,code:"unsupported",reason:"invalid value for toolbar command"}:t==="file.exportMarkdown"||t==="file.exportPdf"?{ok:false,code:"unsupported",reason:"export is not a command; run it with runChromeExport(editor, format, handlers)"}:t==="file.print"?{ok:false,code:"unsupported",reason:"print is not a command; run it with runChromePrint(editor, handlers)"}:t==="file.save"?{ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"}:t==="file.open"?{ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"}:{ok:false,code:"unsupported",reason:"not wired to an editor command"};let a=e.can(o,r);return a.ok?e.exec(o,r):{ok:false,code:a.code,reason:a.reason}}function sE(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function lE(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=el(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function dE(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let r=e.can(t,n);return r.ok?e.exec(t,n):{ok:false,code:r.code,reason:r.reason}}function Wu(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Wu):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Wu(e[t])]))}function cE(e){return JSON.stringify(Wu(e))}var rv={id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:pe.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:pe.file_download,state:{kind:"save"}},{id:"exportMarkdown",labelKey:"toolbar.exportMarkdown",paths:pe.file_download,state:{kind:"export"}},{id:"exportPdf",labelKey:"toolbar.exportPdf",paths:pe.file_download,state:{kind:"export"}},{id:"print",labelKey:"toolbar.print",paths:pe.print,state:{kind:"export"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:pe.settings,state:{kind:"command"}}]};var ov={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"simpleMarkup",shape:"icon",labelKey:"review.simpleMarkup",defaultToolbar:false,paths:pe.visibility,state:{kind:"command"}},{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:pe.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:pe.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:pe.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:pe.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:pe.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:pe.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:pe.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:pe.format_paragraph,state:{kind:"command"}},{id:"protectDocument",shape:"icon",labelKey:"review.protectDocument",defaultToolbar:false,paths:pe.lock,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:pe.comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:pe.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:pe.edit_note,state:{kind:"command"}}]};var Uu=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:pe.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:pe.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:pe.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:pe.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:pe.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:pe.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:pe.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:pe.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:pe.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:pe.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:pe.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:pe.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:pe.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:pe.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:pe.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:pe.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:pe.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:pe.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:pe.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:pe.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:pe.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:pe.format_clear,state:{kind:"command"}}]},ov,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:pe.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:pe.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:pe.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:pe.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:pe.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:pe.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:pe.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:pe.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:pe.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:pe.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:pe.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:pe.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:pe.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:pe.format_line_spacing,state:{kind:"command"}}]},rv,{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:pe.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:pe.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:pe.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:pe.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:pe.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:pe.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:pe.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:pe.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:pe.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:pe.toc,state:{kind:"command"}}]}],av=Uu;function uE(e,t){return `${e.id}.${t.id}`}function iv(){return av.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function fE(e){let t=iv();if(!e)return t;let n=av.find(r=>r.id==="image");return n?[...t,n]:t}var sv=[{id:"file",labelKey:"toolbar.file",entries:[{kind:"item",slot:"file.open",shortcutKey:"toolbar.openShortcut"},{kind:"item",slot:"file.save",labelKey:"toolbar.save",shortcutKey:"toolbar.saveShortcut"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.export",paths:pe.file_download,items:[{kind:"item",slot:"file.exportMarkdown"},{kind:"item",slot:"file.exportPdf"}]},{kind:"item",slot:"file.print",shortcutKey:"toolbar.printShortcut"},{kind:"item",slot:"file.pageSetup"}]},{id:"format",labelKey:"toolbar.format",entries:[{kind:"item",slot:"text.bold",labelKey:"formattingBar.bold"},{kind:"item",slot:"text.italic",labelKey:"formattingBar.italic"},{kind:"item",slot:"text.underline",labelKey:"formattingBar.underline"},{kind:"item",slot:"text.strike"},{kind:"separator"},{kind:"item",slot:"alignment.left"},{kind:"item",slot:"alignment.center"},{kind:"item",slot:"alignment.right"},{kind:"item",slot:"alignment.justify"},{kind:"separator"},{kind:"item",slot:"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:pe.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:pe.visibility,items:[{kind:"item",slot:"review.simpleMarkup"},{kind:"item",slot:"review.allMarkup"},{kind:"item",slot:"review.noMarkup"},{kind:"item",slot:"review.original"}]},{kind:"separator"},{kind:"item",slot:"review.previousChange"},{kind:"item",slot:"review.nextChange"},{kind:"separator"},{kind:"item",slot:"review.acceptAllChanges"},{kind:"item",slot:"review.rejectAllChanges"},{kind:"separator"},{kind:"item",slot:"review.paragraphMarks"},{kind:"separator"},{kind:"item",slot:"review.protectDocument"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function pE(){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 sv)t(n.entries);return e}function mE(){return Uu.reduce((e,t)=>e+t.controls.length,0)}var gE="formattingBar.unavailableInPreview";function Gu(e,t){e.setAttribute("aria-label",t?.("editor.documentContent")??en.editor.documentContent);}var Xu=new WeakSet,lv=new WeakMap,bn=e=>Xu.has(e);function Er(e,t){t?Xu.add(e):Xu.delete(e);}function dv(e,t){lv.set(e,t);}var cv=e=>lv.get(e)?.()??false;function uv(e){let t="select[data-docx-form-dropdown]",n=d=>d instanceof Element?d.closest(t):null,r=d=>{let u=d.closest("[data-start][data-paragraph-id]"),f=u?.dataset.paragraphId;if(!u||!f)return null;let p=e.part(f),m=Ha(p,f);if(m?.kind!=="paragraph")return null;let g=Number(u.dataset.start),v=Bh(m).find(y=>y.start<=g&&g<y.end);if(!v)return null;let b={op:"setLegacyDropdown",paragraphId:f,fieldNodeId:v.fieldNodeId,selectedIndex:d.selectedIndex};return {field:v,paragraphId:f,op:b,enabled:e.editable()&&e.canApply(b)&&mi$1(e.settings(),b)===null&&_i(p,b)===null}},o=()=>{for(let d of e.pagesLayer.querySelectorAll(t))d.disabled=!r(d)?.enabled;},a=d=>{let u=n(d.target);u&&(d.stopPropagation(),r(u)?.enabled||d.preventDefault());},i=d=>{let u=n(d.target);u&&(u.disabled=!r(u)?.enabled);},s=d=>{let u=n(d.target);if(!u)return;d.stopPropagation();let f=r(u);if(!f)return;if(!f.enabled||!e.apply(f.op)){u.selectedIndex=f.field.selectedIndex;return}e.select({anchor:{paragraphId:f.paragraphId,offset:f.field.start},head:{paragraphId:f.paragraphId,offset:f.field.end}}),[...e.pagesLayer.querySelectorAll(t)].find(m=>{let g=m.closest("[data-start][data-paragraph-id]");return g?.dataset.paragraphId===f.paragraphId&&Number(g.dataset.start)===f.field.start})?.focus({preventScroll:true});},l=new MutationObserver(d=>{for(let u of d)for(let f of u.addedNodes){if(!(f instanceof Element))continue;let p=f.matches(t)?[f]:f.querySelectorAll(t);for(let m of p)m.disabled=!r(m)?.enabled;}});return l.observe(e.pagesLayer,{childList:true,subtree:true}),e.pagesLayer.addEventListener("pointerdown",a,true),e.pagesLayer.addEventListener("focusin",i),e.pagesLayer.addEventListener("change",s),o(),{sync:o,keydown(d){let u=n(d.target);if(!u)return false;d.stopPropagation();let f=d.key.toLowerCase();return (d.ctrlKey||d.metaKey)&&!d.altKey&&(f==="z"||f==="y")?(d.preventDefault(),e.pagesLayer.focus({preventScroll:true}),e.history(f==="y"||d.shiftKey?"redo":"undo"),true):(!r(u)?.enabled&&d.key!=="Tab"&&d.preventDefault(),true)},destroy(){l.disconnect(),e.pagesLayer.removeEventListener("pointerdown",a,true),e.pagesLayer.removeEventListener("focusin",i),e.pagesLayer.removeEventListener("change",s);}}}function fv(e,t){let n=Ia$1(e,t.id);for(let a=0;n&&a<64&&(n.namespaceUri===da&&n.localName==="customXml"||Jd(n)||Kd(n));a+=1)n=Ia$1(e,n.id);if(!n)return [];let r=Nd(n.children),o=r.findIndex(a=>a.id===t.id);return o>=2?r.slice(o-2,o):[]}function pv(e){let t=n=>n.kind==="textValue"?/^[ \t\u00a0]*$/.test(n.value):n.namespaceUri!==da?false:n.localName==="pPr"?!n.children.some(r=>r.kind!=="textValue"&&r.localName==="sectPr"):n.localName==="rPr"||n.localName==="tab"||["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","proofErr"].includes(n.localName)?true:["p","r","t","hyperlink"].includes(n.localName)?n.children.every(t):false;return t(e)}function mv(e,t,n,r,o,a,i,s){let l=Ha(e,n.paragraphId);if(l?.kind!=="paragraph")return null;let[d,u]=fv(e,l);if(u?.kind!=="paragraph"||d?.kind!=="paragraph"||!pv(u))return null;let f=ta$1(t,l.id)?.marker,p=ta$1(t,d.id)?.marker;if(!f||f.numId!==p?.numId||f.level!==p.level||ta$1(t,u.id)?.marker)return null;let m=(B,C,_,k)=>({id:B,kind:C,localName:_,namespaceUri:da,prefix:"w",namespaceBindings:[],attributes:[],children:k}),g=l.children.find(B=>B.kind==="paragraphProperties"),v=g&&{...g,children:g.children.filter(B=>B.localName!=="sectPr")},b=Eh({localName:"pStyle",attributes:{val:o}},"separator-style"),y=r.map((B,C)=>Eh(B,`separator-format-${C}`));i&&y.push(Eh({localName:"ins",attributes:{id:hg(e,s)(),author:i.author,...i.date?{date:i.date}:{}}},"separator-insertion"));let I=m("separator-mark","runProperties","rPr",y),T=m("separator-properties","paragraphProperties","pPr",[...b?[b]:[],...y.length?[I]:[]]),O=[...T.children],P=a?.styles.has(o)?T:m("separator-defaults","paragraphProperties","pPr",[]);return a&&Rb$1(Lb$1(a,P).paragraphPropertyNodes)&&O.splice(b?1:0,0,m("separator-numbering","generic","numPr",[Eh({localName:"numId",attributes:{val:"0"}},"separator-number-id")])),{op:"insertFragment",paragraphId:l.id,offset:n.offset,blocks:[m("separator-head","paragraph","p",v?[v]:[]),m("separator-blank","paragraph","p",[m("separator-properties-final","paragraphProperties","pPr",O)])],lastMarkCovered:true}}function gv(e,t=true){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:t})??false}function Yu(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}var hv=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve"]);function ol(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 al(e,t,n){e.has(t.paragraphId)||e.set(t.paragraphId,n);for(let r of t.lines)for(let o of pa$1(r))e.has(o.paragraphId)||e.set(o.paragraphId,n);}var yv=new WeakMap,bv=new WeakMap;function yE(e,t){let n=bv.get(e);if(!n){let r=new Map;for(let o of e.pages)ol(o,a=>{a.emptyParagraphStyle&&al(r,a,a.emptyParagraphStyle);});n=r,bv.set(e,n);}return n.get(t)}var vv=new WeakMap;function bE(e){let t=vv.get(e);if(t)return t;let n=new Map;return ol(e,r=>al(n,r,r.props)),vv.set(e,n),n}function $o(e,t){let n=yv.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of bE(r))n.has(o)||n.set(o,a);yv.set(e,n);}return n.get(t)??[]}var xv=new WeakMap;function vE(e){let t=xv.get(e);if(t)return t;let n=new Map;return ol(e,r=>al(n,r,r.tabStops)),xv.set(e,n),n}function hi(e,t){let n=wv.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of vE(o))r.has(a)||r.set(a,i);n=r,wv.set(e,r);}return n.get(t)??null}var wv=new WeakMap,Sv=new WeakMap,Iv=new WeakMap;function xE(e){let t=Iv.get(e);if(t)return t;let n=new Map;return ol(e,(r,o)=>al(n,r,{indent:r.indent,inTable:o})),Iv.set(e,n),n}function wE(e,t){let n=Sv.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of xE(o))r.has(a)||r.set(a,i);n=r,Sv.set(e,r);}return n.get(t)??null}function Tv(e,t,n,r,o=ka,a){let i=Ha(e,t);if(!i||i.kind!=="paragraph")return false;for(let s of ma(i,wa$2(i),n,r,o,a))if(ra$2(qa(s.run,"runProperties","rPr"),oa).length>0)return true;return false}function il(e,t,n,r=ka,o){let a=Ha(e,t);if(!a||a.kind!=="paragraph")return [];let i=wa$2(a),s=null,l=null;for(let u of la(a,r,o)){let f=i.get(u.id);!f||f.end<=f.start||(f.start<n&&n<=f.end&&(s=u),l===null&&f.start<=n&&n<f.end&&(l=u));}let d=s??l;return d?ra$2(qa(d,"runProperties","rPr"),oa):ta(e,t)}function Bo(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 Pv(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:Bo(t,"b")===true};break;case "i":n={...n,italic:Bo(t,"i")===true};break;case "u":n={...n,underline:Bo(t,"u")===true};break;case "strike":n={...n,strikethrough:Bo(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 Qu(e,t,n,r){return n&&n.length>0?va$1(e,n):Ce(e,t,r??va(e))}function sl(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 ll(e,t,n,r){return Qu(e,t,n,r)[0]?.style??null}function Ju(e,t,n,r,o,a){let i=Qu(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 Cv(e,t,n,r,o,a,i){let s$1=Qu(e,t,r,a),l=s$1.length===0?kv(e,t,r,a).map(D=>yE(e,D)).filter(D=>D!==void 0):[],d=l.length>0?l:s$1.map(D=>D.style),u=D=>{if(d.length===0)return null;let K=D(d[0]);return d.every(j=>D(j)===K)?K:null},f=(D,K=(j,Q)=>j===Q)=>D.length>0&&D.every(j=>K(j,D[0]))?D[0]:null,p=(D,K)=>D.props.some(j=>j.localName===K),m=D=>D.style.fontFamily??n?.(D.range.paragraphId,D.props).fontFamily??null,g=D=>p(D,"sz")?Math.round(D.style.fontSizePt*2):n?.(D.range.paragraphId,D.props).fontSizeHalfPoints??Math.round(D.style.fontSizePt*2),v=l.length>0?{fontFamily:u(D=>D.fontFamily??i??null),fontSizeHalfPoints:u(D=>Math.round(D.fontSizePt*2))}:s$1.length===0?n?.(t.head.paragraphId,[]):void 0,b=kv(e,t,r,a),y=D=>f(b.map(K=>D($o(e,K)))),I=(D,K=(j,Q)=>j===Q)=>{if(b.length<2)return false;let j=D($o(e,b[0]));return b.some((Q,ae)=>ae>0&&!K(D($o(e,Q)),j))},T=y(D=>qb$1(D)),O=y(D=>s(D,"pStyle")?.val??o??void 0)??null,P=D=>s(D,"spacing")??void 0,B=D=>{let K=P(D),j=Number(K?.line);if(!Number.isFinite(j))return "";let Q=K?.lineRule??"auto";return Q==="auto"?`multiple:${Math.round(j/240*100)/100}`:`${Q==="exact"?"exact":"atLeast"}:${Math.round(j/20*100)/100}`},C=y(B),_=(()=>{if(!C)return null;let[D,K]=C.split(":");return {rule:D,value:Number(K)}})(),k=(D,K)=>{let j=Number(P(D)?.[K]);return Number.isFinite(j)?Math.round(j/20*100)/100:null},R=D=>y(K=>k(K,D)),x=(()=>{let D=b.map(L=>wE(e,L)),K=D[0];if(!K||D.some(L=>L===null||L.inTable))return null;let j=L=>Math.round(L*20),Q=L=>j(L.hanging>0?-L.hanging:L.firstLine),ae=D,Y=j(K.indent.left),ne=j(K.indent.right),oe=Q(K.indent);return {left:Y,right:ne,firstLine:oe,mixed:{left:ae.some(L=>j(L.indent.left)!==Y),right:ae.some(L=>j(L.indent.right)!==ne),firstLine:ae.some(L=>Q(L.indent)!==oe)}}})(),N=D=>y(K=>D(Hc$1(K))),V=y(l$1),M=y(w);return {bold:d.length>0&&d.every(D=>D.bold),italic:d.length>0&&d.every(D=>D.italic),underline:d.length>0&&d.every(D=>D.underline!==null),strikethrough:d.length>0&&d.every(D=>D.strike),superscript:d.length>0&&d.every(D=>D.verticalAlign==="superscript"),subscript:d.length>0&&d.every(D=>D.verticalAlign==="subscript"),fontFamily:s$1.length>0?f(s$1.map(m)):v?.fontFamily??null,fontSizeHalfPoints:s$1.length>0?f(s$1.map(g)):v?.fontSizeHalfPoints??null,color:u(D=>D.color),highlight:u(D=>D.highlight),alignment:T,styleId:O,lineSpacing:_,spaceBeforePt:R("before"),spaceAfterPt:R("after"),disagrees:{alignment:I(D=>qb$1(D)),spaceBeforePt:I(D=>k(D,"before")),spaceAfterPt:I(D=>k(D,"after")),lineSpacing:I(B),tabStops:(()=>{if(b.length<2)return false;let D=JSON.stringify(hi(e,b[0])?.stops??null);return b.some((K,j)=>j>0&&JSON.stringify(hi(e,K)?.stops??null)!==D)})()},indent:x,tabStops:f(b.map(D=>hi(e,D)?.stops??null),(D,K)=>D===null||K===null?D===K:D.length===K.length&&D.every((j,Q)=>Math.round(j.positionPt*20)===Math.round(K[Q].positionPt*20)&&j.alignment===K[Q].alignment&&(j.leader??"none")===(K[Q].leader??"none")))?.map(D=>({positionTwips:Math.round(D.positionPt*20),alignment:D.alignment,...D.leader?{leader:D.leader}:{}}))??null,paragraphFlags:{contextualSpacing:M,keepNext:N(D=>D.keepNext),keepLines:N(D=>D.keepLines),widowControl:N(D=>D.widowControl),pageBreakBefore:V}}}function kv(e,t,n,r){if(n&&n.length>0)return [...ua$1(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??va(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 Rv(e,t,n,r){return t.paragraphId!==n.paragraphId?[]:t.offset!==0||n.offset!==e.length?[]:e.length===0?[]:[{op:"setParagraphMarkProperties",paragraphId:t.paragraphId,properties:r}]}var SE="list paragraph",IE="ListParagraph";function Ev(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function dl(e){let t=null;for(let n of e)if(n.type==="paragraph"){if(n.name.trim().toLowerCase()===SE)return n.styleId;t===null&&n.styleId===IE&&(t=n.styleId);}return t}function Ov(e){let{session:t}=e,n;function r(){let o=t.stylesRoot();return (n===void 0||n.root!==o)&&(n={root:o,styleId:Kb$2(o,t.documentThemeFonts()).defaultParagraphStyleId}),n.styleId}return {applyOps(o){let a=dl(t.documentStyles());if(a===null)return [];let i=r(),s=e.storyPart(),l=[];for(let d of o){let u=sa(s,d),f=Ev(u);f!==void 0&&f!==i||l.push({op:"setParagraphProperties",paragraphId:d,properties:ua(u,{localName:"pStyle",attributes:{val:a}})});}return l},clearOp(o){let a=dl(t.documentStyles());if(a===null)return null;let i=sa(e.storyPart(),o);return Ev(i)!==a?null:{op:"setParagraphProperties",paragraphId:o,properties:i.filter(s=>s.localName!=="pStyle")}}}}function Mv(e,t){return n=>{let r=sf$1(n),o=r?.name??"/word/styles.xml",a="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",i=r?null:xa$2('<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"/>',{name:o,contentType:a}),s=r??(i?.ok?i.part:null);if(!s)throw new Error("Cannot create list paragraph style");if(s.root.children.some(g=>g.kind!=="textValue"&&g.attributes.some(v=>v.localName==="styleId"&&v.value===t)))return n;let l=Fa(s),d=(g,v={},b=[])=>({...Eh({localName:g,attributes:v},l()),children:b,...g==="pPr"?{kind:"paragraphProperties"}:{}}),f={...d("style",{type:"paragraph",styleId:t},[d("name",{val:"List Paragraph"}),...e?[d("basedOn",{val:e})]:[],d("uiPriority",{val:"34"}),d("qFormat"),d("pPr",{},[d("ind",{left:"720"}),d("contextualSpacing")])]),namespaceBindings:[{prefix:"w",namespaceUri:da}]};if(r){let g=La(s,s.root.id,s.root.children.length,[f]);if(!g.ok)throw new Error("Cannot insert list paragraph style");return lc$1(n,g.part)}let p=uc(n,o,{...s.root,children:[f]},a);p=sc(p,n.mainDocumentPart);let m=tc(p,n.mainDocumentPart,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",o);if(!m.ok)throw new Error("Cannot link list paragraph style");return m.pkg}}function cl(e,t){let n=e.ownerDocument,r=e.dataset.docxCcId,o=()=>{n.removeEventListener("pointerdown",a,true),n.removeEventListener("keydown",i,true);},a=s=>{if(e.parentNode===null){o();return}let l=s.target,d=l instanceof Element?l.closest("[data-docx-cc-widget]"):null;l&&(e.contains(l)||d?.getAttribute("data-docx-cc-id")===r)||(o(),t());},i=s=>{s.key!=="Escape"||s.isComposing||(s.preventDefault(),o(),e.parentNode!==null&&(s.stopPropagation(),t()));};return n.addEventListener("pointerdown",a,true),n.addEventListener("keydown",i,true),o}function Fv(e,t,n,r,o){let i=xe(e).find(f=>f.id===n)?.fragments[0],s=i?e.pages[i.pageIndex]:void 0;if(!i||!s)return null;let l=o?.get(i.pageIndex)??0,d=s.contentBox.x-s.box.x,u=s.contentBox.y-s.box.y;return {left:(s.box.x+l+d+i.box.x)*t,top:(s.box.y+u+i.box.y+i.box.height)*t,element:[...r.querySelectorAll("[data-docx-content-control]")].find(f=>f.dataset.docxContentControl===n)?.querySelector(".docx-content-control-boundary")??void 0,sheetLeft:(s.box.x+l)*t,sheetRight:(s.box.x+l+s.box.width)*t}}function Av(e){return e.kind==="textValue"?e.value:e.localName==="sdtPr"?"":e.children.map(Av).join("")}function ef(e,t){let n=e?Av(e):"";return t.find(r=>r.displayText===n)?.value??n}function Lv(e){let t=e?.children.find(n=>n.kind!=="textValue"&&n.localName==="sdtPr");if(!(!t||t.kind==="textValue")){for(let n of t.children)if(n.kind!=="textValue"){if(n.localName==="dropDownList")return "dropdown";if(n.localName==="comboBox"||n.localName==="date")return n.localName;if(n.localName==="checkbox")return "checkbox";if(n.localName==="picture")return "picture";if(n.localName==="docPartList")return "buildingBlockGallery"}}}var kE=["dropdown","comboBox","date","checkbox","picture","buildingBlockGallery"];function Nv(e){let t=null,n=false,r=()=>{let o=t;t=null,o&&(e.setOpen(o.id,false),o.controller.abort());};return {cancel:r,destroy(){n=true,r();},open(o,a){if(r(),n||!e.request||!kE.includes(a))return false;let i=new AbortController;t={controller:i,id:o};let s=()=>!n&&t?.controller===i&&!i.signal.aborted,l=()=>s()&&Lv(e.find(o))===a&&e.allowed(o),d=e.find(o),u=e.items(o).map(v=>({...v})),f=ef(d,u),p=a==="picture"?e.picture(o):void 0;if(a==="picture"&&!p)return r(),false;let m=false,g={controlId:o,kind:a,items:u,value:a==="date"?e.date(o)??"":a==="checkbox"?String(e.checked(o)):a==="picture"?p:a==="buildingBlockGallery"?"":f,locale:e.locale(),anchor:[...e.layer.querySelectorAll("[data-docx-content-control]")].find(v=>v.getAttribute("data-docx-content-control")===o)?.querySelector(".docx-content-control-boundary")??null,signal:i.signal,canApply:l,apply(v){return a==="picture"||!l()||!e.apply(o,v)?false:(s()&&r(),true)},cancel(){s()&&r();},...a==="picture"?{async replaceImage(v){if(m||!l())return false;m=true;try{return await e.replaceImage(o,v,()=>l()&&e.picture(o)===p)?(s()&&r(),!0):!1}finally{m=false;}}}:{}};return e.setOpen(o,true),e.request(g)?true:(g.cancel(),false)}}}function Dv(e,t){if(!e)return [];if(t&&_v(e))return Cf$1(t(),e).map(n=>({displayText:n.name,value:n.name}));for(let n of e.children)if(n.kind!=="textValue"&&!(n.kind!=="contentControlProperties"&&n.localName!=="sdtPr"))for(let r of n.children){if(r.kind==="textValue"||r.localName!=="dropDownList"&&r.localName!=="comboBox")continue;let o=[];for(let a of r.children){if(a.kind==="textValue"||a.localName!=="listItem")continue;let i=a.attributes.find(l=>l.localName==="value")?.value??"",s=a.attributes.find(l=>l.localName==="displayText")?.value??i;o.push({displayText:s,value:i});}return o}return []}function Hv(e){if(e){for(let t of e.children)if(t.kind==="contentControlProperties"){for(let n of t.children)if(n.kind==="contentControlDate")return n.attributes.find(r=>r.localName==="fullDate")?.value}}}function _v(e){return Lv(e&&e.kind!=="textValue"?e:null)==="buildingBlockGallery"}function Bv(e,t,n,r){if(!e||!_v(e))return [{op:"setContentControlValue",controlId:n,value:r}];let o=Cf$1(t(),e).filter(i=>i.name===r),a=o.length===1?o[0]:void 0;return a?[{op:"insertBuildingBlock",controlId:n,name:a.name,blocks:a.blocks}]:null}function $v(e){let t=-1,n=true;return ()=>{let r=e.packageRevision();return t!==r&&(t=r,n=!Ng(e.settingsRoot()).doNotShadeFormData),n}}var ul="switch to field results before editing a form value";function qv(e,t){let{anchor:n,head:r}=t,o=n.paragraphId===r.paragraphId;for(let a of [n,r]){let i=e(a.paragraphId),s=i&&Ha(i,a.paragraphId);if(s?.kind!=="paragraph")continue;let l=o?Math.min(n.offset,r.offset):a.offset,d=o?Math.max(n.offset,r.offset):a.offset,u=Ze$1(s);if(we$1(s).filter(p=>p.addressing==="editable-result").map(p=>{let m=u.spanOf(p.node)?.start??0,g=m;for(let v of p.removeNodeIds)g=Math.max(g,u.spanOf(v)?.end??g);return {start:m,end:g}}).some(p=>l===d?l>=p.start&&(l<p.end||p.start===p.end):l<p.end&&d>p.start))return true}return false}function Kv(e,t,n,r){let o=e.contentControlId?xe(t).find(u=>u.id===e.contentControlId):void 0,a=nr(n).filter(u=>u.toc.id===e.id),i=a.some(u=>u.start>0||u.end<u.length);if(o&&!i)return {tocId:e.id,boundary:o,additional:false};let s=new Map(a.map(u=>[u.paragraphId,u])),l=a.filter(u=>u.start>0||u.end<u.length).flatMap(u=>le(t,{anchor:{paragraphId:u.paragraphId,offset:u.start},head:{paragraphId:u.paragraphId,offset:u.end}},[u.paragraphId],r)),d=t.pages.flatMap(u=>{let f=aa(u).filter(b=>{let y=s.get(b.paragraphId);return y&&y.start===0&&y.end===y.length}).map(Gd);if(f.push(...l.filter(b=>b.pageIndex===u.index)),f.length===0)return [];let p=Math.min(...f.map(b=>b.x)),m=Math.min(...f.map(b=>b.y)),g=Math.max(...f.map(b=>b.x+b.width)),v=Math.max(...f.map(b=>b.y+b.height));return [{pageIndex:u.index,box:{x:p,y:m,width:g-p,height:v-m}}]});return d.length===0?null:{tocId:e.id,additional:true,boundary:{id:`toc:${e.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:d}}}var Zv=new WeakMap;function Vv(e,t,n,r){Zv.set(e,o=>{let a=t();e.flushPendingInput();try{n(o),r();}catch(i){throw n(a),r(),i}});}function jv(e,t){let n=Zv.get(e);if(!n)throw new Error("Surface does not support measurement updates");n(t);}var CE=createT(en);function tn(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return CE(t)}}var zv=new WeakMap;function fl(e,t){let n=new Map;return zv.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 Wv(e,t){let n=zv.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 Uv(e,t){let n=e.ownerDocument.defaultView;if(!n)return;let r=e.offsetParent;if(!r)return;let o=t.getBoundingClientRect(),a=t.closest(".docx-page")?.getBoundingClientRect(),i=t.closest(".docx-editor__scroll-container")?.getBoundingClientRect(),s=Math.max(0,a?.left??0,i?.left??0),l=Math.min(n.innerWidth,a?.right??n.innerWidth,i?.right??n.innerWidth),d=Math.max(0,i?.top??0),u=Math.min(n.innerHeight,i?.bottom??n.innerHeight);e.style.maxWidth=`${Math.max(0,l-s)}px`,e.style.maxHeight=`${Math.max(0,u-d)}px`;let f=e.getBoundingClientRect(),p=u-o.bottom,m=o.top-d,g=f.height>p&&m>p,v=Math.max(0,g?m:p);e.style.maxHeight=`${Math.max(0,Math.min(u-d,v))}px`;let b=Math.min(f.height,v),y=Math.max(s,Math.min(o.left,l-f.width)),I=Math.max(d,g?o.top-b:o.bottom),T=r.getBoundingClientRect(),O=r.offsetWidth?T.width/r.offsetWidth:1,P=r.offsetHeight?T.height/r.offsetHeight:1;e.style.left=`${(y-T.left)/O-r.clientLeft+r.scrollLeft}px`,e.style.top=`${(I-T.top)/P-r.clientTop+r.scrollTop}px`,e.dataset.placement=g?"top":"bottom";}function yi(e,t){let n=e.ownerDocument.defaultView,r=t.closest(".docx-pages")??e.closest(".docx-editor")?.querySelector(".docx-pages"),o=t.closest("[data-docx-content-control]")?.dataset.docxContentControl,a=t,i=()=>{if(!a.isConnected&&r&&o){let d=[...r.querySelectorAll("[data-docx-content-control]")].find(u=>u.dataset.docxContentControl===o)?.querySelector(".docx-content-control-boundary");d&&(s?.unobserve(a),a=d,s?.observe(a));}a.isConnected&&Uv(e,a);},s=typeof ResizeObserver>"u"?null:new ResizeObserver(i);s?.observe(e),s?.observe(a);let l=typeof MutationObserver>"u"?null:new MutationObserver(i);return r&&l?.observe(r,{childList:true,subtree:true}),i(),n?.addEventListener("resize",i),e.ownerDocument.addEventListener("scroll",i,true),()=>{s?.disconnect(),l?.disconnect(),n?.removeEventListener("resize",i),e.ownerDocument.removeEventListener("scroll",i,true);}}function bi(e,t,n){if(t.stopPropagation(),t.isComposing||(t.key==="Escape"&&(t.preventDefault(),n()),t.key!=="Tab"))return;let r=[...e.querySelectorAll("button,input,select,textarea,[href],[tabindex]")].filter(i=>i.tabIndex>=0&&!i.hasAttribute("disabled")&&!i.closest("[hidden]")&&e.ownerDocument.defaultView?.getComputedStyle(i).display!=="none");if(!r.length){t.preventDefault(),e.focus();return}let o=e.ownerDocument.activeElement,a=t.shiftKey&&(o===r[0]||o===e)?r.at(-1):!t.shiftKey&&(o===r.at(-1)||o===e)?r[0]:null;a&&(t.preventDefault(),a.focus());}function RE(e){let t=e?.ownerDocument??(typeof document>"u"?null:document),n=t?.activeElement;return n&&n!==t?.body?n:e?.closest(".docx-pages")??null}var tf="image/png,image/jpeg,image/gif,image/bmp,image/webp",EE=new Set(tf.split(",")),OE=8;function ME(e){if(!e||e.kind==="textValue")return;let t=(n,r)=>{if(!(n.kind==="textValue"||r>OE)){if(n.kind==="drawing")return n.id;if(n.localName!=="sdtPr")for(let o of n.children){let a=t(o,r+1);if(a)return a}}};return t(e,0)}function Gv(e){let t=null,n=null,r=null,o,a,i=0,s=false,l=()=>{i++,o?.(),a?.(),r?.remove(),r=null;let f=n;t?.remove(),t=null,n=null,f&&(e.setOpen(f,false),s||e.layer.focus({preventScroll:true}));},d=f=>ME(e.find(f)),u=async(f,p,m$1=()=>true)=>{if(s||!m$1()||!e.allowed(f))return false;if(p.byteLength>m.maxEncodedBytes)return e.reject("image-resource-limit"),false;let g=d(f);if(!g)return e.reject("no-picture"),false;let v=zb$1(p);if(!EE.has(v))return e.reject("unsupported-image"),false;let b=await e.replaceImage(g,p,v,()=>!s&&m$1()&&e.allowed(f)&&d(f)===g);return b.ok?true:(e.reject(b.detail??b.reason),false)};return {drawingOf:d,replace:u,cancel:l,select(f){let p=d(f),m=p?ld(e.layout(),p):null;return m?e.selectDrawing(p,m.record.paragraphId):false},pick(f){if(l(),s||!e.allowed(f))return;let p=i,m$1=()=>!s&&i===p;if(!d(f)){e.reject("no-picture");return}let g=e.document.createElement("input");g.type="file",g.accept=tf,g.className="docx-content-control-picture-picker",g.dataset.docxMarker="",g.dataset.docxCcId=f,g.setAttribute("contenteditable","false"),g.setAttribute("aria-hidden","true"),g.tabIndex=-1;let v=tn(e.translate),b=e.document.createElement("div");b.className="docx-content-control-menu",b.style.position="absolute",b.style.zIndex="20",b.style.pointerEvents="auto",b.dataset.docxCcId=f,b.dataset.docxMarker="",b.setAttribute("role","dialog"),b.setAttribute("aria-label",v("contentControl.types.picture")),b.setAttribute("contenteditable","false"),b.hidden=true;let y=e.document.createElement("div");y.className="docx-content-control-widget-error",y.setAttribute("role","alert"),y.textContent=v("disabledReason.invalidValue");let I=e.document.createElement("button");I.type="button",I.textContent=v("common.cancel"),I.addEventListener("click",l),b.addEventListener("pointerdown",T=>T.stopPropagation()),b.addEventListener("keydown",T=>{bi(b,T,l),T.stopPropagation();}),b.append(y,I),g.addEventListener("change",()=>{let T=g.files?.[0];!T||!m$1()||(g.value="",g.disabled=true,(async()=>{let O=false;try{T.size>m.maxEncodedBytes?e.reject("image-resource-limit"):O=await u(f,new Uint8Array(await T.arrayBuffer()),m$1);}catch{m$1()&&e.reject("image-read-failed");}if(!m$1())return;if(O){l();return}g.disabled=false,g.className="docx-content-control-picture-input",g.removeAttribute("aria-hidden"),g.tabIndex=0,g.setAttribute("aria-label",v("contentControl.types.picture")),g.setAttribute("aria-invalid","true"),b.prepend(g),b.hidden=false;let P=[...e.layer.querySelectorAll("[data-docx-content-control]")].find(B=>B.getAttribute("data-docx-content-control")===f)?.querySelector(".docx-content-control-boundary");a?.(),o?.(),P&&(a=yi(b,P)),o=cl(b,l),g.focus();})());}),g.addEventListener("cancel",l),e.layer.append(g),(e.layer.closest(".docx-editor__scroll-container")??e.layer).append(b),r=b,t=g,n=f,e.setOpen(f,true),g.click();},destroy(){s=true,l();}}}function Xv(e,t,n,r){return (zi(e,t,n)?.offset??n)+r}function Yv(e){if(e&&!(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")&&!(e.controlType==="checkbox"||e.controlType==="picture"))return e.id}function Qv(e,t,n){return {op:"insertText",paragraphId:e.paragraphId,offset:e.offset,text:t,...n===void 0?{}:{inside:n}}}function FE(e,t,n){let r=e.ownerDocument;if(typeof r.elementFromPoint!="function")return null;let o=r.elementFromPoint(t,n)?.closest(".docx-page");if(!o)return null;for(let a of o.querySelectorAll("[data-docx-content-control]:not([data-docx-toc])"))for(let i of a.querySelectorAll(".docx-content-control-boundary")){let s=i.getBoundingClientRect();if(t>=s.left-3&&t<=s.right+22&&n>=s.top-3&&n<=s.bottom+3)return a}return null}function Jv(e){let t=null,n=0,r=null,o=l=>{l!==t&&(t?.isConnected&&delete t.dataset.hover,t=l,l&&(l.dataset.hover=""));},a=()=>{n=0,r&&o(FE(e,r.x,r.y));},i=l=>{r={x:l.clientX,y:l.clientY},n===0&&(n=e.ownerDocument.defaultView?.requestAnimationFrame(a)??0),n===0&&a();},s=()=>{r=null,o(null);};return e.addEventListener("pointermove",i),e.addEventListener("pointerleave",s),{destroy(){e.removeEventListener("pointermove",i),e.removeEventListener("pointerleave",s),n&&e.ownerDocument.defaultView?.cancelAnimationFrame(n),o(null);}}}var vi=.25;function ex(e,t,n){let r=(s,l)=>{let d=ue(e,s,n);return d?we(e,{x:d.x+l,y:d.y+d.height/2,pageIndex:d.pageIndex}):null},o=r(t.head,0);if(o)return o;if(t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset)return r(t.head,-vi);let i=t.head.paragraphId===t.anchor.paragraphId&&t.head.offset<t.anchor.offset;return r(t.head,i?vi:-vi)??r(t.anchor,i?-vi:vi)}function tx(e,t,n,r,o){let a=r==="left"?-1:1,i=ue(e,t.from,o),s=ue(e,t.to,o),l=i?je$1(e,i)??1:1,d=a*l===-1?t.from:t.to;if(!i||!s||i.lineId!==s.lineId||i.pageIndex!==s.pageIndex)return d;let u=fe(e).get(t.from.paragraphId)?.find(({line:g})=>g.id===i.lineId)?.line;if(!u?.spans.some(g=>g.style.shaping))return d;let f=n.indexOf(t.from.paragraphId),p=n.indexOf(t.to.paragraphId),m;for(let g of u.spans){let v=g.range.paragraphId,b=n.indexOf(v);if(b<f||b>p)continue;let y=Math.max(g.range.start,v===t.from.paragraphId?t.from.offset:0),I=Math.min(g.range.end,v===t.to.paragraphId?t.to.offset:1/0);if(!(y>=I))for(let T of [y,I]){let O={paragraphId:v,offset:T},P=ue(e,O,o);if(!P||P.lineId!==i.lineId||P.pageIndex!==i.pageIndex)continue;let B=P.x;(!m||(B-m.x)*a>0)&&(m={position:O,x:B});}}return m?.position??d}function nx(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}function rx(e,t,n,r){let o=tn(r),a=e.ownerDocument,i=a.createElement("dialog"),s=fl(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 f=a.createElement("button");f.type="button",f.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(f,"textFormField.apply");let p=false,m=()=>{p||(p=true,n());};return f.addEventListener("click",m),i.addEventListener("keydown",g=>{g.key!=="Enter"||g.isComposing||(g.preventDefault(),g.stopPropagation(),m());}),i.addEventListener("cancel",g=>{g.preventDefault(),m();}),u.append(f),i.append(l,d,u),e.append(i),i.showModal(),f.focus(),i}function ox(e,t,n,r,o){let a=tn(o),i=e.ownerDocument,s=i.createElement("dialog"),l=fl(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 f=i.createElement("div");f.className="docx-text-form-dialog__footer",s.append(d,u,f);let p=(R,x)=>{let N=i.createElement("label");N.className="docx-text-form-dialog__row";let V=i.createElement("span");V.className="docx-text-form-dialog__label",l(V,R),x.className="docx-text-form-dialog__input",N.append(V,x),u.append(N);},m=i.createElement("input");m.type="text",m.value=t.defaultText,p("textFormField.defaultText",m);let g=i.createElement("select"),v=["regular","number","date"];for(let R of v){let x=i.createElement("option");x.value=R,l(x,`textFormField.${R}`),g.append(x);}if(!v.includes(t.type)){let R=i.createElement("option");R.value=t.type,l(R,"textFormField.preservedType"),R.disabled=true,g.append(R);}g.value=t.type,p("textFormField.type",g);let b=i.createElement("input");b.type="number",b.min="0",b.max="32767",b.step="1",b.value=String(t.maxLength),p("textFormField.maxLength",b);let y=i.createElement("select"),I=R=>{y.replaceChildren();let x=ph[g.value]??[];for(let N of x){let V=i.createElement("option");V.value=N;let D={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[N];D||!N?l(V,D??"textFormField.noFormat"):V.textContent=N,y.append(V);}if(!x.includes(R)){let N=i.createElement("option");N.value=R,R?N.textContent=R:l(N,"textFormField.noFormat"),N.disabled=true,y.append(N);}y.value=R;};I(t.format),g.addEventListener("change",()=>I("")),p("textFormField.format",y);let T=i.createElement("input");T.type="checkbox",T.checked=t.enabled;let O=i.createElement("label");O.className="docx-text-form-dialog__checkbox-row";let P=i.createElement("span");l(P,"textFormField.enabled"),O.append(T,P),u.append(O);let B=i.createElement("p");B.className="docx-text-form-dialog__error",B.setAttribute("role","alert"),u.append(B);let C=i.createElement("button");C.type="button",C.className="docx-text-form-dialog__button",l(C,"textFormField.cancel"),C.addEventListener("click",r);let _=i.createElement("button");_.type="button",_.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(_,"textFormField.apply");let k=()=>{if(!b.value||!b.checkValidity()||!n(m.value,{type:g.value,maxLength:Number(b.value),format:y.value,enabled:T.checked})){l(B,"textFormField.invalidOptions");return}r();};return _.addEventListener("click",k),s.addEventListener("keydown",R=>{R.key==="Enter"&&!R.isComposing&&R.target instanceof HTMLInputElement&&(R.preventDefault(),k());}),s.addEventListener("cancel",R=>{R.preventDefault(),r();}),f.append(C,_),e.append(s),s.showModal(),m.focus(),m.select(),s}function ax(e,t,n){let r=[],o=[];for(let i of e)for(let s of ki$1(i).keys()){let l=Ha(i,s);if(l?.kind==="paragraph")for(let d of th(l)){let u=t.get(d.fieldNodeId);if(!u)continue;let f=(Ui(i,s)??"").slice(d.start,d.end),p=qh(f,d,"fill",u.locale);if(p===null)return {reason:"invalidArgs"};if(p===f)continue;let m={op:"commitTextFormField",paragraphId:s,fieldNodeId:d.fieldNodeId,locale:u.locale},g=_i(i,m);if(g)return {reason:g};r.push(m),o.push({paragraphId:s,start:d.start,end:d.end,length:p.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 pl=new WeakMap,ml=new WeakMap;function sx(e){return ml.get(e)?.()??null}function ix(e){return [...ki$1(e).keys()].flatMap(t=>{let n=Ha(e,t);return n?.kind==="paragraph"?th(n):[]})}function nf(e){return pl.get(e)?.()}function lx(e,t){let n=tn(e.translate),r=e.container.ownerDocument,o,a=false,i=new Map,s=()=>e.parts?.()??[e.part()];if(t?.length)for(let L of s()){let A=t.filter($=>$.partName===L.name);if(!A.length)continue;let Z=ix(L);for(let $ of A){let W=Z[$.fieldIndex];W&&i.set(W.fieldNodeId,{text:$.text,locale:$.locale});}}let l=new WeakMap,d=new WeakMap,u=(L=e.part())=>{l.set(L,new Map([...i].filter(([A])=>A.startsWith(`${L.name}#`))));},f=()=>(i=new Map(s().flatMap(L=>[...l.get(L)??[]])),d.get(e.part())??null),p=L=>{i.delete(L),u();};s().forEach(u);let m=()=>{if(!i.size)return null;if(a)return "invalidState";let L=ax(s(),i,e.selection());if("reason"in L)return L.reason;if(L.ops.length&&!e.editable())return "locked";let A=s();s().forEach(u);let Z=i;L.ops.length&&d.set(e.part(),e.selection()),i=new Map,a=true;try{let $=L.ops.length?e.save?e.save(L.ops,L.selection):"unsupported":null;return $?i=Z:(delete oe.dataset.fieldError,L.ops.length&&d.set(e.part(),L.selection)),s().forEach(u),$}catch($){throw s().every(W=>A.includes(W))&&(i=Z),s().forEach(u),$}finally{a=false;}};ml.set(e.container,m);let g=()=>i.size?s().flatMap(L=>ix(L).flatMap((A,Z)=>{let $=i.get(A.fieldNodeId);return $?[{partName:L.name,fieldIndex:Z,...$}]:[]})):[];pl.set(e.container,g);let v,b=(L,A)=>(Ui(e.part(),L)??"").slice(A.start,A.end),y=null,I=null,T=null,O=false,P=false,B=()=>{let L=T;T=null,P=false,y?.remove(),y=null,L?.abort();},C=()=>{if(!y&&!T)return;let L=e.selection();B(),!O&&(e.pagesLayer.focus({preventScroll:true}),e.select(L));};function _(L,A,Z="plain"){v={paragraphId:L,fieldNodeId:A.fieldNodeId},e.select({anchor:{paragraphId:L,offset:A.start},head:{paragraphId:L,offset:A.end}},Z==="press"?"pressed":void 0);let $=e.selection().head.paragraphId===L&&e.selection().head.offset>=A.start&&e.selection().head.offset<=A.end;$&&(I=v??I),v=void 0,$&&Z==="travel"&&e.reveal?.({paragraphId:L,offset:A.start});}function k(L,A){if(O)return;C();let Z=e.locale?.()??"en-US",$=new AbortController;T=$;let W=()=>{if(O||$.signal.aborted||T!==$)return false;let q=Ha(e.part(L),L);return q?.kind==="paragraph"&&th(q).some(z=>z.fieldNodeId===A.fieldNodeId)&&e.editable()&&!e.protected(L)},E={field:{...A},signal:$.signal,canApply:W,apply(q,z){if(!W()||!e.apply({op:"setTextFormFieldDefault",locale:Z,paragraphId:L,fieldNodeId:A.fieldNodeId,text:q,options:z}))return false;if(O||T!==$||$.signal.aborted)return true;let J=Ha(e.part(L),L),ie=J?.kind==="paragraph"?th(J).find(ee=>ee.fieldNodeId===A.fieldNodeId):null;return ie&&_(L,ie),C(),true},cancel(){T===$&&!$.signal.aborted&&C();}};e.onRequest?.(E)||$.signal.aborted||(y=ox(e.container,A,E.apply,E.cancel,n));}let R=L=>{let Z=L.target?.closest('[data-field-atom="form"][data-start]'),$=Z?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!Z||!$||!e.editable())return null;let W=Ha(e.part(),$);if(W?.kind!=="paragraph")return null;let E=Number(Z.dataset.start),q=th(W).find(z=>z.start<=E&&E<z.end);return q?{paragraphId:$,field:q}:null},x=null,N=L=>L.shiftKey||L.altKey||L.ctrlKey||L.metaKey,V=L=>{if(o=void 0,x=null,L.button!==0)return;let A=R(L);A&&!N(L)&&!e.protected(A.paragraphId)&&(x={x:L.clientX,y:L.clientY,paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId,moved:false}),v=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",V,{capture:true});let M=L=>{x&&Math.hypot(L.clientX-x.x,L.clientY-x.y)>4&&(x.moved=true);},D=()=>{x=null;},K=(L,A=false)=>{let Z=x;if(x=null,!Z||Z.moved||y||L.button!==0||L.detail>1||Math.hypot(L.clientX-Z.x,L.clientY-Z.y)>4||!e.editable()||N(L)||e.protected(Z.paragraphId))return;let $=Ha(e.part(),Z.paragraphId),W=$?.kind==="paragraph"?th($).find(q=>q.fieldNodeId===Z.fieldNodeId):null;if(!W)return;let E=e.selection();A&&(E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)&&!(E.anchor.paragraphId===Z.paragraphId&&E.head.paragraphId===Z.paragraphId&&Math.min(E.anchor.offset,E.head.offset)===W.start&&Math.max(E.anchor.offset,E.head.offset)===W.end)||_(Z.paragraphId,W,"press");};r.addEventListener("pointermove",M),r.addEventListener("pointercancel",D),e.pagesLayer.addEventListener("click",K);let j=L=>{if(L.shiftKey||L.altKey||L.ctrlKey||L.metaKey)return false;let A=R(L);if(!A)return false;let{paragraphId:Z,field:$}=A;return L.preventDefault(),_(Z,$,"press"),e.protected(Z)||k(Z,$),true};e.pagesLayer.addEventListener("dblclick",j);function Q(){let L=e.selection();if(L.anchor.paragraphId!==L.head.paragraphId)return null;let A=L.head.paragraphId,Z=Ha(e.part(),A);if(Z?.kind!=="paragraph")return null;let $=Math.min(L.anchor.offset,L.head.offset),W=Math.max(L.anchor.offset,L.head.offset),E=th(Z).filter(z=>z.start<=$&&z.end>=W&&(z.start===z.end||$!==W||$<z.end||e.protected(A))),q=E.find(z=>I?.paragraphId===A&&z.fieldNodeId===I.fieldNodeId)??E.find(z=>z.start===$&&z.end===W)??E[0];return q?{paragraphId:A,field:q}:null}function ae(){if(o===void 0)return Q();if(!o)return null;let L=Ha(e.part(),o.paragraphId),A=L?.kind==="paragraph"?th(L).find(Z=>Z.fieldNodeId===o.fieldNodeId):null;return A?{paragraphId:o.paragraphId,field:A}:null}let Y=L=>{let A=L.button===-1||L.clientX===0&&L.clientY===0?Q():R(L);o=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",Y);let ne=()=>{let L=ae();return !!L&&e.editable()&&!e.protected(L.paragraphId)&&!_i(e.part(),{op:"setTextFormFieldDefault",paragraphId:L.paragraphId,fieldNodeId:L.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},oe=r.createElement("span");return oe.className="docx-text-form-status",e.container.append(oe),{doubleClick:j,pointerUp:L=>K(L,true),canEdit:ne,edit(){if(!ne())return false;let L=ae();return _(L.paragraphId,L.field,"travel"),k(L.paragraphId,L.field),true},selectForDeletion(L){let A=e.selection(),{paragraphId:Z,offset:$}=A.head;if(!e.editable()||e.protected(Z)||A.anchor.paragraphId!==Z||A.anchor.offset!==$)return false;let W=Ha(e.part(),Z);if(W?.kind!=="paragraph")return false;let E=th(W).find(q=>q.start<q.end&&(L==="backward"?q.end===$:q.start===$));return E?(_(Z,E),true):false},wordDeletionBoundary(L,A,Z,$){let W=ie(L,A,Z,$),E=e.selection().head.paragraphId;if(e.protected(E))return W;let q=Ha(e.part(E),E);if(q?.kind!=="paragraph")return W;let z=th(q),J=z.find(ee=>ee.start<ee.end&&(Z===-1?ee.end===A:ee.start===A));if(J)return Z===-1?J.start:J.end;let ie$1=W;for(let ee of z)for(let de of [ee.start,ee.end])Z===-1&&de<A&&de>ie$1&&(ie$1=de),Z===1&&de>A&&de<ie$1&&(ie$1=de);return ie$1},beforeSelect(L){let A=Ae=>{if(v!==void 0)I=v;else if(L.anchor.paragraphId!==L.head.paragraphId||I?.paragraphId!==L.head.paragraphId)I=null;else {let Fe=Ha(e.part(),L.head.paragraphId),De=Fe?.kind==="paragraph"?th(Fe).find(ke=>ke.fieldNodeId===I?.fieldNodeId):null;(!De||Math.min(L.anchor.offset,L.head.offset)<De.start||Math.max(L.anchor.offset,L.head.offset)>De.end)&&(I=null);}return v=void 0,delete oe.dataset.fieldError,Ae};if(a||P)return null;if(!e.editable())return L;let Z=Q();if(!Z||!e.protected(Z.paragraphId)||!Z.field.enabled||!rh(Z.field))return A(L);let{field:$,paragraphId:W}=Z;if((!v||v.fieldNodeId===$.fieldNodeId)&&L.anchor.paragraphId===W&&L.head.paragraphId===W&&Math.min(L.anchor.offset,L.head.offset)>=$.start&&Math.max(L.anchor.offset,L.head.offset)<=$.end)return A(L);let E=i.get($.fieldNodeId),q=E?.text,z=E?.locale??e.locale?.()??"en-US",J=b(W,$);if($.type==="date"&&q===void 0)return p($.fieldNodeId),A(L);let ie=qh(J,$,"fill",z);if(ie===J||ie===null&&(q===void 0||q===J))return p($.fieldNodeId),A(L);a=true;let ee=e.part();u(ee);let de=i;i=new Map(de),i.delete($.fieldNodeId);let ce;try{ce=e.apply({op:"commitTextFormField",locale:z,paragraphId:W,fieldNodeId:$.fieldNodeId}),ce||(i=de);}catch(Ae){throw e.part()===ee&&(i=de),Ae}finally{u(),a=false;}if(!ce){if(v=void 0,oe.setAttribute("role","alert"),oe.dataset.fieldError="true",oe.textContent=n("textFormField.invalidValue"),ie===null&&($.type==="number"||$.type==="date")){B();let Ae=new AbortController;T=Ae,P=true;let Fe=()=>{if(O||Ae.signal.aborted||T!==Ae||(B(),O))return;let ke=e.selection(),Be=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(ke);},tt=Ha(e.part(),W),He=tt?.kind==="paragraph"?th(tt).find(Te=>Te.fieldNodeId===$.fieldNodeId):null;if(!He||!e.editable()||!e.protected(W)||b(W,He)!==J||!He.enabled||!rh(He)||He.type!==$.type||He.format!==$.format||qh(J,He,"fill",z)!==null){Be();return}a=true;try{if(e.apply({op:"deleteText",paragraphId:W,start:He.start,end:He.end,textFormFieldId:He.fieldNodeId})){p(He.fieldNodeId),delete oe.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let Te={paragraphId:W,offset:He.start};a=!1,e.select({anchor:Te,head:Te}),I={paragraphId:W,fieldNodeId:He.fieldNodeId};}else a=!1,Be();}finally{a=false;}},De={type:$.type,signal:Ae.signal,acknowledge:Fe,cancel(){T===Ae&&!Ae.signal.aborted&&C();}};!e.onInvalidRequest?.(De)&&!Ae.signal.aborted&&(y=rx(e.container,$.type,Fe,n));}return null}p($.fieldNodeId);let ye=Ha(e.part(),W),Je=ye?.kind==="paragraph"?th(ye).find(Ae=>Ae.fieldNodeId===$.fieldNodeId):null,Oe=Je?Je.end-$.end:0,Re=Ae=>Ae.paragraphId===W&&Ae.offset>=$.end?{...Ae,offset:Ae.offset+Oe}:Ae;return A({anchor:Re(L.anchor),head:Re(L.head)})},update(){y&&Wv(y,n);let L=Q(),A=e.selection(),Z=!!L&&A.anchor.offset!==A.head.offset&&Math.min(A.anchor.offset,A.head.offset)===L.field.start&&Math.max(A.anchor.offset,A.head.offset)===L.field.end;for(let $ of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let W=$.closest("[data-paragraph-id]")?.dataset.paragraphId,E=Number($.dataset.start);!!L&&W===L.paragraphId&&E>=L.field.start&&E<L.field.end?$.dataset.textFormSelection=Z?"whole":"caret":delete $.dataset.textFormSelection;}if(oe.dataset.fieldError){oe.textContent=n("textFormField.invalidValue");return}L?oe.setAttribute("role","status"):oe.removeAttribute("role"),oe.textContent=L?n(Z?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>Q()?.field.fieldNodeId??null,afterApply(L){L?u():f();},restoreAfterHistory:f,annotate(L){(!a||L.some(Z=>Z.op!=="commitTextFormField"))&&u(),L.some(Z=>Z.op==="insertText"||Z.op==="deleteText")&&delete oe.dataset.fieldError;let A=Q();return I=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null,L.map(Z=>{if(!I||Z.op!=="insertText"&&Z.op!=="deleteText"||Z.revision||Z.paragraphId!==I.paragraphId||!e.protected(Z.paragraphId))return Z;let $=Ha(e.part(),Z.paragraphId),W=$?.kind==="paragraph"?th($).find(z=>z.fieldNodeId===I.fieldNodeId):null,E=Z.op==="insertText"?Z.offset:Z.start,q=Z.op==="insertText"?Z.offset:Z.end;return !W||E<W.start||q>W.end?Z:(i.has(W.fieldNodeId)||i.set(W.fieldNodeId,{text:b(Z.paragraphId,W),locale:e.locale?.()??"en-US"}),{...Z,textFormFieldId:W.fieldNodeId})})},keydown(L){if(L.key==="F10"&&L.shiftKey&&!L.altKey&&!L.ctrlKey&&!L.metaKey)return o=void 0,L.preventDefault(),e.pagesLayer.dispatchEvent(new MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(L.key!=="Tab"||L.altKey||L.ctrlKey||L.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let A=[],Z=[e.part().root];for(;Z.length;){let ie=Z.pop();if(ie.kind==="paragraph")for(let ee of th(ie))e.protected(ie.id)&&ee.enabled&&rh(ee)&&!_i(e.part(),{op:"insertText",paragraphId:ie.id,offset:ee.start,text:"x"})&&A.push({paragraphId:ie.id,field:ee});else for(let ee=ie.children.length-1;ee>=0;ee--){let de=ie.children[ee];de.kind!=="textValue"&&Z.push(de);}}if(!A.length)return false;let $=e.selection(),W=$.head,E=I?A.findIndex(ie=>ie.paragraphId===I.paragraphId&&ie.field.fieldNodeId===I.fieldNodeId&&ie.field.start<=Math.min($.anchor.offset,W.offset)&&ie.field.end>=Math.max($.anchor.offset,W.offset)):-1,q=E>=0?E:A.findIndex(ie=>ie.paragraphId===W.paragraphId&&ie.field.start<=Math.min($.anchor.offset,W.offset)&&ie.field.end>=Math.max($.anchor.offset,W.offset)),z=q<0?L.shiftKey?A.length-1:0:(q+(L.shiftKey?-1:1)+A.length)%A.length,J=A[z];return L.preventDefault(),_(J.paragraphId,J.field,"travel"),true},destroy(){O=true,B(),ml.get(e.container)===m&&ml.delete(e.container),pl.get(e.container)===g&&pl.delete(e.container),r.removeEventListener("pointermove",M),r.removeEventListener("pointercancel",D),e.pagesLayer.removeEventListener("click",K),e.pagesLayer.removeEventListener("contextmenu",Y),oe.remove(),e.pagesLayer.removeEventListener("dblclick",j),e.pagesLayer.removeEventListener("pointerdown",V,{capture:true}),y?.remove(),y=null;}}}var gl=new WeakMap;function xi(e){let t=gl.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function dx(e){let t=gl.get(e)??{depth:0};return t.depth++,gl.set(e,t),()=>{--t.depth===0&&(gl.delete(e),t.resolve?.());}}async function cx(e,t,n){if(!e)throw Ut("notFound","no document is loaded");let r=t?xi(t):void 0;if(r&&(await r,n()!==e))throw Ut("invalidState","The document changed before the pending save could finish.");return e.save().slice().buffer}function ux(e,t,n){let r=()=>{if(n())throw Ut("destroyed","Cannot save a destroyed surface.")};if(r(),xi(t))throw Ut("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),r();let o=sx(t);if(o)throw Ut(o,"Cannot save pending text form input. Enter a valid value in each field.");r(),e.refreshRefFieldResults(),r();let a=bn(t);Er(t,true);try{return e.session.save()}finally{Er(t,a);}}function hl(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function fx(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 px(e,t){let n=mh(e);return {get:()=>n,set(r){let o=mh(r);n!==o&&(t(),n=o);}}}var AE=42,LE=/^(\d{4})-(\d{2})-(\d{2})/,NE=new Set(["AG","AS","BD","BR","BS","BT","BW","BZ","CA","CO","DM","DO","ET","GT","GU","HK","HN","ID","IL","IN","JM","JP","KE","KH","KR","LA","MH","MM","MO","MT","MX","MZ","NI","NP","PA","PE","PH","PK","PR","PT","PY","SA","SG","SV","TH","TT","TW","UM","US","VE","VI","WS","YE","ZA","ZW"]),DE=new Set(["AE","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]);function eo(e){return `${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function or(e){let t=LE.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),o=Number(t[3]);if(r<1||r>12||o<1||o>31)return null;let a=new Date(n,r-1,o);return a.getFullYear()!==n||a.getMonth()!==r-1||a.getDate()!==o?null:a}function yl(e){let t=mh(e);try{let n=new Intl.Locale(t),r=n,o=r.getWeekInfo?.().firstDay??r.weekInfo?.firstDay;if(typeof o=="number"&&o>=1&&o<=7)return o%7;let a=n.maximize().region;if(a&&NE.has(a))return 0;if(a&&DE.has(a))return 6}catch{}return 1}function mx(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function gx(e,t,n){return new Intl.DateTimeFormat(mh(n),{calendar:"gregory",month:"long",year:"numeric"}).format(new Date(e,t,1))}function hx(e){let t=mh(e),n=new Intl.DateTimeFormat(t,{calendar:"gregory",weekday:"narrow"}),r=yl(t);return Array.from({length:7},(o,a)=>n.format(new Date(2024,0,7+(r+a)%7)))}function rf(e,t,n={}){let r=mh(n.locale),o=n.selected?or(n.selected):null,a=n.today??new Date,i=new Intl.DateTimeFormat(r,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric"}),s=yl(r),l=(new Date(e,t,1).getDay()-s+7)%7,d=[];for(let u=0;u<AE;u+=1){let f=new Date(e,t,u-l+1);d.push({iso:eo(f),day:f.getDate(),label:i.format(f),otherMonth:f.getMonth()!==t,selected:o!==null&&mx(f,o),today:mx(f,a)});}return {year:e,month:t,title:gx(e,t,r),weekdays:hx(r),days:d}}function bl(e,t,n){let r=new Date(e,t+n,1);return {year:r.getFullYear(),month:r.getMonth()}}function of(e,t,n,r=false){let o=or(e);if(!o)return null;let a={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},i=(o.getDay()-yl(n)+7)%7;if(t==="PageUp"||t==="PageDown"){let s=o.getDate();o.setDate(1),o.setMonth(o.getMonth()+(t==="PageUp"?-1:1)*(r?12:1));let l=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();o.setDate(Math.min(s,l));}else {let s=t==="Home"?-i:t==="End"?6-i:a[t];if(s===void 0)return null;o.setDate(o.getDate()+s);}return o.getFullYear()>=100&&o.getFullYear()<=9999?eo(o):null}function vl(e,t){let n=or(e);if(!n)return "";let r=mh(t),o=new Intl.NumberFormat(r,{useGrouping:false}).format(0);return new Intl.DateTimeFormat(r,{calendar:"gregory",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(n).map(a=>a.type==="year"?a.value.padStart(4,o):a.value).join("")}function af(e,t){if(e.length>100)return null;let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n)){let s=or(n);return s?eo(s):null}let r=nh(mh(t)),o=r.pattern.exec(oh(n,r));if(!o)return null;let a={year:"",month:"",day:""};if(r.order.forEach((s,l)=>{a[s]=o[l+1];}),a.year.length!==4)return null;let i=`${a.year}-${a.month.padStart(2,"0")}-${a.day.padStart(2,"0")}`;return or(i)?i:null}function sf(e){let t=new Intl.DateTimeFormat(mh(e),{calendar:"gregory",month:"long"});return Array.from({length:12},(n,r)=>t.format(new Date(2e3,r,1)))}function lf(e){let t="",n=0,r=new Intl.Collator(mh(e),{usage:"search",sensitivity:"base"});return {reset(){t="",n=0;},keyDown(o,a){if(o.defaultPrevented||o.isComposing||o.altKey||o.ctrlKey||o.metaKey)return;let i=o.target.tagName==="INPUT",s=[...a.querySelectorAll('[role="option"]')].filter(u=>!u.hasAttribute("disabled"));if(!s.length)return;let l=s.indexOf(a.ownerDocument.activeElement),d;if(o.key==="ArrowDown")d=Math.min(s.length-1,l+1);else if(o.key==="ArrowUp")d=l<0?s.length-1:Math.max(0,l-1);else if(!i&&o.key==="Home")d=0;else if(!i&&o.key==="End")d=s.length-1;else if(!i&&o.key.length===1&&o.key!==" "){let u=Date.now();t=u-n>700?o.key:(t+o.key).slice(-100),n=u;let f=[...t].every(p=>r.compare(p,o.key)===0)?o.key:t;for(let p=1;p<=s.length;p++){let m=(Math.max(-1,l)+p)%s.length;if(r.compare((s[m].textContent??"").slice(0,f.length),f)===0){d=m;break}}}d!==void 0&&(o.preventDefault(),s.forEach((u,f)=>{u.tabIndex=f===d?0:-1;}),s[d]?.focus({preventScroll:true}),s[d]?.scrollIntoView?.({block:"nearest"}));}}}var HE=0;function yx(e,t){let n=e.document.createElement("div");n.className="docx-content-control-menu",n.dataset.docxMarker="",n.dataset.docxPart="popup",n.addEventListener("keydown",r=>bi(n,r,()=>e.close(n))),n.dataset.docxCcId=t,n.setAttribute("contenteditable","false"),n.style.position="absolute",n.style.zIndex="20",n.style.pointerEvents="auto",n.addEventListener("pointerdown",r=>r.stopPropagation());for(let r of ["keydown","beforeinput","input","compositionstart","compositionupdate","compositionend","copy","cut","paste"])n.addEventListener(r,o=>o.stopPropagation());return n}function bx(e,t,n){if(!n){t.append(e);return}e.style.left=`${n.left}px`,e.style.top=`${n.top}px`;let r=n.element?t.closest(".docx-editor__scroll-container")??t.parentElement??t:t;if(r.append(e),n.element){let i=yi(e,n.element),s=new MutationObserver(()=>{e.isConnected||(i(),s.disconnect());});s.observe(r,{childList:true});return}let o=e.offsetWidth;if(o<=0)return;let a=n.left+o-n.sheetRight;a>0&&(e.style.left=`${Math.max(n.sheetLeft,n.left-a)}px`);}function xl(e,t,n,r){if(e.setValue(n,r))return e.close(t),true;let o=t.querySelector("[data-docx-part=error]");return o||(o=e.document.createElement("div"),o.dataset.docxPart="error",o.className="docx-content-control-widget-error",o.setAttribute("role","alert"),t.append(o)),o.hidden=false,o.textContent=tn(e.translate)("disabledReason.invalidValue"),false}function vx(e,t,n,r,o,a){let i=yx(e,t),s=tn(e.translate);i.setAttribute("role","dialog"),i.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let l=e.document.createElement("div");l.className="docx-content-control-menu-list",l.dataset.docxPart="list",l.id=`docx-engine-cc-list-${++HE}`,l.setAttribute("role","listbox"),l.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let d=lf(e.locale());i.addEventListener("keydown",f=>d.keyDown(f,i));let u=r.findIndex(f=>f.value===a);for(let[f,p]of r.entries()){let m=e.document.createElement("button");m.type="button",m.className="docx-content-control-menu-item",m.dataset.docxPart="item",m.dataset.value=p.value,m.setAttribute("role","option"),m.setAttribute("aria-selected",String(p.value===a)),m.tabIndex=f===Math.max(0,u)?0:-1,m.textContent=p.displayText,m.addEventListener("click",()=>{xl(e,i,t,p.value);}),l.append(m);}if(n==="buildingBlockGallery"&&r.length===0){let f=e.document.createElement("div");f.className="docx-content-control-menu-empty",f.dataset.docxPart="empty",f.setAttribute("role","note"),f.tabIndex=0,f.textContent=s("contentControl.gallery.empty"),l.append(f);}if(n==="comboBox"){let f=e.document.createElement("input");f.type="text",f.className="docx-content-control-menu-input",f.dataset.docxPart="input",f.value=a??"",f.setAttribute("aria-label",o||s("contentControl.types.comboBox")),f.setAttribute("aria-autocomplete","list"),f.setAttribute("role","combobox"),f.setAttribute("aria-expanded","true"),f.setAttribute("aria-controls",l.id),f.addEventListener("keydown",m=>{m.key!=="Enter"||m.isComposing||(m.preventDefault(),xl(e,i,t,f.value));}),i.append(f);let p=e.document.createElement("div");p.className="docx-dialog__footer",p.dataset.docxPart="footer";for(let m of ["cancel","apply"]){let g=e.document.createElement("button");g.type="button",g.className=`docx-dialog__button${m==="apply"?" docx-dialog__button--primary":""}`,g.dataset.docxPart=m,g.textContent=s(`common.${m}`),g.addEventListener("click",()=>{m==="apply"?xl(e,i,t,f.value):e.close(i);}),p.append(g);}i.append(l,p);}else i.append(l);return i}function wl(e,t){let n=(t?e.querySelector(`[data-iso="${t}"]`):null)??e.querySelector("[data-selected]")??e.querySelector("[data-today]:not([data-other-month])")??e.querySelector(".docx-content-control-calendar-day:not([data-other-month])");for(let r of e.querySelectorAll("[data-iso]"))r.tabIndex=r===n?0:-1;n?.focus({preventScroll:true});}function xx(e,t,n,r){let o=tn(e.translate),a=yx(e,t);a.classList.add("docx-content-control-calendar"),a.setAttribute("role","dialog"),a.setAttribute("aria-label",r||o("contentControl.types.date"));let i=n?or(n):null,s=i?eo(i):null,l=new Date,d={year:(i??l).getFullYear(),month:(i??l).getMonth()},u=null,f=vl(s??"",e.locale()),p=y=>{xl(e,a,t,y);},m=y=>{y.addEventListener("mousedown",I=>I.stopPropagation());},g=e.document.createElement("div");g.className="docx-content-control-calendar-title docx-content-control-calendar-announcement",g.dataset.docxPart="title",g.setAttribute("aria-live","polite");let v=()=>{let y=e.document.activeElement?.dataset.docxCalendarNav,I=rf(d.year,d.month,{locale:e.locale(),selected:s,today:l}),T=e.document.createElement("div");T.className="docx-content-control-calendar-header",T.dataset.docxPart="header";let O=e.document.createElement("button");O.type="button",O.className="docx-content-control-calendar-nav",O.dataset.docxPart="previousMonth",O.dataset.docxCalendarNav="previous",O.textContent="\u2039",O.setAttribute("aria-label",o("contentControl.calendar.previousMonth")),g.textContent=I.title;let P=e.document.createElement("button");P.type="button",P.className="docx-content-control-calendar-nav",P.dataset.docxPart="nextMonth",P.dataset.docxCalendarNav="next",P.textContent="\u203A",P.setAttribute("aria-label",o("contentControl.calendar.nextMonth")),m(O),m(P),O.addEventListener("click",()=>{d=bl(d.year,d.month,-1),u=null,v();}),P.addEventListener("click",()=>{d=bl(d.year,d.month,1),u=null,v();});let B=e.document.createElement("div");B.className="docx-content-control-calendar-navigation",B.dataset.docxPart="navigation";let C=e.document.createElement("select");C.className="docx-content-control-calendar-month",C.dataset.docxPart="month",C.dataset.docxCalendarNav="month",C.setAttribute("aria-label",o("contentControl.calendar.month"));for(let[j,Q]of sf(e.locale()).entries()){let ae=e.document.createElement("option");ae.value=String(j),ae.textContent=Q,C.append(ae);}C.value=String(d.month);let _=e.document.createElement("input");_.type="number",_.min="100",_.max="9999",_.value=String(d.year),_.className="docx-content-control-calendar-year",_.dataset.docxPart="year",_.dataset.docxCalendarNav="year",_.addEventListener("keydown",j=>{j.key==="Enter"&&!j.isComposing&&(j.preventDefault(),_.blur());}),_.setAttribute("aria-label",o("contentControl.calendar.year")),C.addEventListener("change",()=>{d.month=Number(C.value),u=null,v();}),_.addEventListener("change",()=>{let j=Number(_.value);if(!Number.isInteger(j)||j<100||j>9999){_.value=String(d.year);return}d.year=j,u=null,v();}),B.append(C,_);let k=e.document.createElement("div");k.className="docx-content-control-calendar-weekdays",k.dataset.docxPart="weekdays";for(let j of I.weekdays){let Q=e.document.createElement("span");Q.textContent=j,k.append(Q);}let R=e.document.createElement("div");R.className="docx-content-control-calendar-grid",R.dataset.docxPart="grid",R.setAttribute("role","grid"),R.setAttribute("aria-label",I.title);for(let j=0;j<I.days.length;j+=7){let Q=e.document.createElement("div");Q.className="docx-content-control-calendar-week",Q.setAttribute("role","row");for(let ae of I.days.slice(j,j+7))Q.append(b(ae));R.append(Q);}let x=e.document.createElement("div");x.className="docx-content-control-calendar-entry",x.dataset.docxPart="dateEntry";let N=e.document.createElement("button");N.type="button",N.className="docx-content-control-calendar-today",N.dataset.docxPart="today",N.textContent=o("contentControl.calendar.today"),m(N),N.addEventListener("click",()=>p(eo(l)));let V=e.document.createElement("input");V.type="text",V.className="docx-content-control-menu-input",V.dataset.docxPart="input",V.setAttribute("aria-label",o("contentControl.types.date")),V.placeholder=vl("2006-11-22",e.locale()),V.value=f,V.addEventListener("input",()=>{f=V.value,V.removeAttribute("aria-invalid"),M.hidden=true;});let M=e.document.createElement("div");M.className="docx-content-control-widget-error",M.dataset.docxPart="error",M.setAttribute("role","alert"),M.hidden=true,M.textContent=o("disabledReason.invalidValue");let D=()=>{let j=af(f,e.locale());j?p(j):(M.hidden=false,V.setAttribute("aria-invalid","true"),V.focus());};V.addEventListener("keydown",j=>{j.key==="Enter"&&!j.isComposing&&(j.preventDefault(),D());});let K=e.document.createElement("div");K.className="docx-dialog__footer",K.dataset.docxPart="footer";for(let j of ["cancel","apply"]){let Q=e.document.createElement("button");Q.type="button",Q.dataset.docxPart=j,Q.className=`docx-dialog__button${j==="apply"?" docx-dialog__button--primary":""}`,Q.textContent=o(`common.${j}`),Q.addEventListener("click",j==="apply"?D:()=>e.close(a)),K.append(Q);}T.append(O,B,P,g),x.append(N,V),a.replaceChildren(T,k,R,x,M,K),wl(a,u),y==="previous"&&O.focus({preventScroll:true}),y==="next"&&P.focus({preventScroll:true}),y==="month"&&C.focus({preventScroll:true}),y==="year"&&_.focus({preventScroll:true});},b=y=>{let I=e.document.createElement("button");return I.type="button",I.className="docx-content-control-calendar-day",I.dataset.docxPart="day",I.textContent=String(y.day),I.dataset.iso=y.iso,I.setAttribute("role","gridcell"),I.setAttribute("aria-label",y.label),y.otherMonth&&(I.dataset.otherMonth=""),y.selected&&(I.dataset.selected="",I.setAttribute("aria-selected","true")),I.setAttribute("aria-selected",String(y.selected)),y.today&&(I.dataset.today="",I.setAttribute("aria-current","date")),m(I),I.addEventListener("click",()=>p(y.iso)),I.addEventListener("keydown",T=>{if(T.isComposing||T.altKey||T.ctrlKey||T.metaKey)return;let O=of(y.iso,T.key,e.locale(),T.shiftKey);if(!O)return;T.preventDefault();let P=or(O);if(u=O,P.getFullYear()!==d.year||P.getMonth()!==d.month){d={year:P.getFullYear(),month:P.getMonth()},v();return}wl(a,u);}),I};return v(),a}function df(e,t){let r=(t instanceof Element?t:null)?.closest("[data-docx-form-checkbox][data-start]"),o=r?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!r||!o)return null;let a=Ha(e.part(o),o);if(a?.kind!=="paragraph")return null;let i=Number(r.dataset.start),s=vh(a).find(l=>l.start<=i&&i<l.end);return s?{paragraphId:o,field:s}:null}function wx(e){return e.shiftKey||e.altKey||e.ctrlKey||e.metaKey}function Sx(e){let t=(a,i)=>{if(!e.editable()||!i.enabled)return false;let s=e.apply({op:"setLegacyCheckbox",paragraphId:a,fieldNodeId:i.fieldNodeId,checked:!i.checked});return s&&(e.pagesLayer.focus({preventScroll:true}),e.select({anchor:{paragraphId:a,offset:i.start},head:{paragraphId:a,offset:i.end}})),s},n=a=>{if(a.button!==0||wx(a))return;let i=df(e,a.target);!i||!e.editable()||!i.field.enabled||(a.preventDefault(),a.stopPropagation(),t(i.paragraphId,i.field));};e.pagesLayer.addEventListener("pointerdown",n,{capture:true});let r=a=>{let i=df(e,a.target);i&&a.target instanceof HTMLElement&&a.target.setAttribute("aria-disabled",String(!e.editable()||!i.field.enabled));};e.pagesLayer.addEventListener("focusin",r);let o=()=>{let a=e.selection();if(a.anchor.paragraphId!==a.head.paragraphId)return null;let i=a.head.paragraphId,s=Ha(e.part(i),i);if(s?.kind!=="paragraph")return null;let l=Math.min(a.anchor.offset,a.head.offset),d=Math.max(a.anchor.offset,a.head.offset),u=vh(s).find(f=>f.start===l&&f.end===d||l===d&&l===f.start&&e.protected(i));return u?{paragraphId:i,field:u}:null};return {keydown(a){let i=df(e,a.target);if(i&&a.key==="Tab")return true;if(i&&a.key.length===1&&a.key!==" "&&!a.ctrlKey&&!a.metaKey&&!a.altKey)return a.preventDefault(),true;if(a.key!==" "||wx(a)||a.isComposing)return false;let s=i??o();if(!s)return false;if(!e.editable()||!s.field.enabled)return i?(a.preventDefault(),true):false;a.preventDefault();let l=t(s.paragraphId,s.field);return i&&l&&[...e.pagesLayer.querySelectorAll("[data-docx-form-checkbox][data-start]")].find(d=>d.dataset.paragraphId===s.paragraphId&&Number(d.dataset.start)===s.field.start)?.focus({preventScroll:true}),true},destroy(){e.pagesLayer.removeEventListener("pointerdown",n,{capture:true}),e.pagesLayer.removeEventListener("focusin",r);}}}var _E=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTableRow","deleteTableRow","setRunProperties","setParagraphProperties","setParagraphMarkProperties"]);function cf(e){return _E.has(e.op)}function uf(e){if(cf(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 ff(e){return e?.trim()||void 0}function Ix(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function kx(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}var BE=new Set;function wi(e,t){let n=ib$2(e,t.displayMode,t.authorFilter),r=hb$1(n);if(r===n)return BE;let o=new Set(n.map(a=>a.id));return new Set(r.flatMap(a=>o.has(a.id)?[]:[a.id]))}function $E(e,t,n){let r=ib$2(e,n.displayMode,n.authorFilter),o=hb$1(r);if(o===r)return null;let a=new Set(r.map(l=>l.id));if(a.has(t))return null;let i=o.findIndex(l=>l.id===t);if(i===-1)return null;let s=o.slice(i+1).find(l=>a.has(l.id));return s?.kind==="paragraph"?s.id:null}function qE(e,t,n,r){let o=d=>e.findIndex(u=>u.kind!=="textValue"&&u.id===d),a=o(t),i=o(n);if(a===-1||i<=a)return null;let s=[];for(let d=a+1;d<i;d+=1){let u=e[d];if(u.kind==="textValue")return null;s.push(u.id);}if(s.length===0)return s;let l=r();return s.every(d=>l.has(d))?s:null}function Tx(e,t,n,r){let o=Ia$1(e,t);if(o===null||Ia$1(e,n)?.id!==o.id)return null;let a=qE(o.children,t,n,()=>wi(o.children,r));return a===null?null:[...a,n].map(i=>({op:"joinParagraphs",firstId:t,secondId:i}))}function Px(e,t,n,r){if(fe(e).has(n.paragraphId))return n;let o=Ia$1(t,n.paragraphId);if(o===null)return n;let a=$E(o.children,n.paragraphId,r);return a===null?n:{paragraphId:a,offset:0}}function KE(e,t,n,r,o){if(fe(e).has(n.paragraphId))return null;let a=Ia$1(t,n.paragraphId);if(a===null||!wi(a.children,r).has(n.paragraphId))return null;let i=a.children,s=i.findIndex(u=>u.kind!=="textValue"&&u.id===n.paragraphId),l;for(let u=s-1;u>=0&&l===void 0;u-=1)i[u].kind!=="textValue"&&(l=i[u]);if(l===void 0||l.kind!=="paragraph")return null;let d=o==="backward"?{paragraphId:l.id,offset:(Ui(t,l.id)??"").length}:Px(e,t,n,r);return {ops:[{op:"joinParagraphs",firstId:l.id,secondId:n.paragraphId}],caret:d}}function ZE(e,t,n){let r=Ia$1(e,t);if(r===null)return null;let o=r.children,a=o.findIndex(l=>l.kind!=="textValue"&&l.id===t);if(a===-1)return null;let i=null,s=[];for(let l=a+1;l<o.length;l+=1){let d=o[l];if(d.kind!=="textValue"){if(i??=wi(o,n),!i.has(d.id))break;s.push({op:"joinParagraphs",firstId:t,secondId:d.id});}}return s.length>0?s:null}function Cx(e){let t=n=>Px(e.layout(),e.part(),n,e.view());return {joinOps:(n,r)=>Tx(e.part(),n,r,e.view()),forwardJoinOps:(n,r)=>Tx(e.part(),n,r,e.view())??ZE(e.part(),n,e.view()),shown:t,removedCaretEdit:(n,r)=>KE(e.layout(),e.part(),n,e.view(),r),shownRange:n=>{let{from:r,to:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let a=t(r);return a===r?n:{from:a,to:a}},shownSelection:n=>{let{anchor:r,head:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let a=t(o);return a===o?n:{...n,anchor:a,head:a}}}}function Sl(e,t,n){if(!e)return null;let r=ld(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var Rx="docx-field-atom--active",VE="docx-field-atom",Ex=new WeakMap;function pf(e,t,n){let r=Ex.get(e);r||(r={caretKey:null,marked:[]},Ex.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(Rx);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${VE}`);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(Rx),r.marked.push(i));}}var jE={kind:"body"};function Ox(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??=fa(e.canonicalUnfilteredLayout()),n(l)):fa(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},a=ga(t.part(),o),i=ha(t.part(),o);if(!a&&i.length===0)return true;let s=[];a&&s.push({scope:jE,ops:[a]});for(let l of i)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function Fx(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(),f=e.paneOpen(),p=e.selectionAnchor(),m=e.authorFilterKey();return (l!==n||d!==r||u!==o||f!==a||p!==i||m!==s)&&(n=l,r=d,o=u,a=f,i=p,s=m,t+=1),t}}function Il(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=Aa(t),o=null,a="accept",i=null,s="accept",l=new WeakMap,d=null,u=false,f=0,p=null,m=[],g=null,v=[],b=r,y=t,I=new Set,T="accept",O=new WeakSet,P=new WeakMap,B=new Map,C=()=>{f+=1,p=null,m=[],g=null;},_=x=>JSON.stringify([x.id,Da(x)]),k=(x,N,V)=>{let M=zE(V),D=t,K=r?.hiddenAuthors??za,j=a,Q;D===y&&WE(M,I)&&(M.size===0||j===T)?Q=b:M.size===0&&D.size===0?Q=void 0:Q=Object.freeze({hiddenAuthors:K,includes:Y=>!D.has(Y.author)&&!M.has(Y.nodeId),includesNode:(Y,ne)=>!D.has(ne)&&!M.has(Y),excludedNodeMode:(Y,ne)=>D.has(ne)?"proposed":M.has(Y)&&j==="reject"?"original":"proposed",cacheKey:UE(D,M,j)});let ae=[];for(let Y of x){let ne=Mx(Y);ne!==null&&D.has(ne)||Y.kind==="revision"&&N.has(Y)||ae.push(Y);}v=ae.length===x.length?x:Ta(ae),g=x,O=N,b=Q,y=D,I=M,T=j,u=false,i=null,s="accept",l=new WeakMap,d=null;},R=x=>{if(x===g)return;let N=new WeakSet,V=[],M=[];try{for(let K of x){if(K.kind!=="revision")continue;let j=!t.has(K.author),Q=P.get(K);Q===void 0&&(Q=o?.(K)??!0,M.push([K,Q])),!(j&&Q)&&(N.add(K),Q||V.push(K));}}catch(K){if(u)o=i,a=s,P=l,g=d,i=null,s="accept",l=new WeakMap,d=null,f+=1;else {let j=new WeakSet,Q=[];for(let ae of x){if(ae.kind!=="revision")continue;let Y=B.get(_(ae))??true;(t.has(ae.author)||!Y)&&j.add(ae),Y||Q.push(ae);}k(x,j,Q);}throw u=false,K}for(let[K,j]of M)P.set(K,j);let D=new Map;for(let K of x)K.kind==="revision"&&D.set(_(K),P.get(K)??true);B=D,k(x,N,V);};return {get hiddenAuthors(){return r?.hiddenAuthors??za},get hiddenAuthorList(){return n},get stateKey(){return String(f)},get hasFilter(){return t.size>0||o!==null},filterFor(x){return o?(R(x),b):r},filterForSession(x){return o?(R(x.reviewItems()),b):r},filterItems(x){if(!o){if(t.size===0)return x;if(x===p)return m;let N=x.filter(V=>{let M=Mx(V);return M===null||!t.has(M)});return p=x,m=N.length===x.length?x:Ta(N),m}return R(x),v},includesRevisionItem(x){return !O.has(x)},setPredicate(x,N="accept"){return o===null&&x===null?false:x===null?(o=null,a="accept",i=null,s="accept",u=false,P=new WeakMap,l=new WeakMap,B=new Map,d=null,v=[],O=new WeakSet,b=r,y=t,I=new Set,T="accept",C(),true):(i=o,s=a,l=P,d=g,u=true,o=x,a=N,P=new WeakMap,C(),true)},isVisible:x=>!t.has(x),setVisible(x,N){if(N===!t.has(x))return false;let V=new Set(t);return N?V.delete(x):V.add(x),t=V,n=Object.freeze([...V]),r=Aa(V),C(),true},setAllVisible(x,N){let V=N?new Set:new Set(x);return V.size===t.size&&[...V].every(M=>t.has(M))?false:(t=V,n=Object.freeze([...V]),r=Aa(V),C(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,C(),true)}}}function mf(e,t){return t.filterItems(e)}function zE(e){let t=new Set;for(let n of e)for(let r of Da(n))t.add(r);return t}function WE(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function UE(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function Mx(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function Ax(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 gf(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function Lx(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 p of r){let m=gf(p);m!==null&&(yield m);}})()),s=a?.value,l=s!==void 0&&s.size===i.size&&[...i].every(([f,p])=>s.get(f)===p),d=l?s:i,u=a!==null&&l&&a.styles===o?a.resolved:new Map(c(d,o).map(f=>[f.author,f]));return t={layout:n,items:r,styles:o,value:d,resolved:u},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function Nx(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$6(o.color)??a$7(o.slot);let a=e.slots.resolve(r.value,[n]).get(n);return a===void 0?void 0:a$7(a)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:b$1(r)}),a$6(t.resolved.get(n)?.color)}}}function qo(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function Hx(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 _x(e,t){let n=Ha(e,t);if(!n||n.kind==="textValue")return null;let r=Kb$1(n);return !r||!Jb$1(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var hf=new WeakMap;function GE(e,t,n){return e.map(r=>a$6(n?.(r.name))??a$6(r.color)??a$6(t?.(r.name)))}function XE(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 YE(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function QE(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 JE(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 Dx(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function eO(e,t){let n=Aa$2(e,t.anchor.nodeId),r=Aa$2(e,t.head.nodeId);if(!n||!r)return [];let o=sa$1(e,n,r);return o?wa$1(e,o.cellIds).map(a=>({...a,className:"docx-remote-selection-rect"})):[]}function Bx(e,t,n,r){let{scale:o$1,pageOffsetX:a,pages:i,colorForAuthor:s,declaredColorFor:l}=r,d=r.labelHost??null,u=GE(n,s,l),f={layout:t,fingerprint:XE(n,u),pagesKey:YE(i),scale:o$1,offsetKey:QE(a),labelHost:d},p=hf.get(e);if(p&&JE(p,e,f))return;hf.delete(e);let m=[],g=[],v=[],b=[];for(let[O,P]of n.entries())P.kind==="cells"||Dx(P)||b.push({key:String(O),from:{paragraphId:P.anchor.nodeId,offset:P.anchor.offset},to:{paragraphId:P.head.nodeId,offset:P.head.offset}});let y=b.length>0?re(t,b,va(t),i,r.measurer):null;for(let[O,P]of n.entries()){let B=u[O],C=ue(t,{paragraphId:P.head.nodeId,offset:P.head.offset},r.measurer);if(C){let k=qe(t,P.head.nodeId,C.pageIndex);v.push({selection:P,...B?{color:B}:{},pageIndex:C.pageIndex,x:C.x+k.x,y:C.y+k.y});}if(P.kind==="cells"){let k=eO(t,P);if(k.length>0){for(let R of k)m.push(R),g.push(B);continue}}if(Dx(P)){let k=ue(t,{paragraphId:P.anchor.nodeId,offset:P.anchor.offset},r.measurer);if(!k)continue;let R=qe(t,P.anchor.nodeId,k.pageIndex);m.push({pageIndex:k.pageIndex,x:k.x+R.x,y:k.y+R.y,width:Math.max(1/o$1,1),height:k.height,className:"docx-remote-caret"}),g.push(B);continue}let _=y?.get(String(O));if(_)for(let k of _)m.push({...k,className:"docx-remote-selection-rect"}),g.push(B);}o(e,t,m,{scale:o$1,pageOffsetX:a}),[...e.children].forEach((O,P)=>{let B=a$6(g[P]);!B||!(O instanceof HTMLElement)||O.style.setProperty("--doc-remote-color",B);});let I=e.ownerDocument,T=[];for(let O of v){let P=t.pages[O.pageIndex];if(!P)continue;let B=I.createElement("div");B.className="docx-remote-caret-label",d?(B.setAttribute("data-docx-remote-actor",O.selection.actorId),T.push({element:B,selection:O.selection})):B.textContent=O.selection.name,B.style.left=`${(P.contentBox.x+O.x+(a?.get(O.pageIndex)??0))*o$1}px`,B.style.top=`${(P.contentBox.y+O.y)*o$1}px`;let C=a$6(O.color);C&&B.style.setProperty("--doc-remote-color",C),e.append(B);}hf.set(e,{...f,childCount:e.childElementCount}),d&&d.publish(T);}var tO=/[\p{L}\p{N}_'’]/u,$x=e=>e!==void 0&&tO.test(e);function kl(e,t,n){let r=ye(e,t.paragraphId),o=t.paragraphId,a=Math.max(0,Math.min(t.offset,r.length)),i=-1;if($x(r[a])?i=a:a>0&&$x(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:ie(r,i+1,-1,n)},to:{paragraphId:o,offset:ie(r,i,1,n)}}}function Ze(e){return {anchor:e,head:e}}function to(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 Tl(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??ua$2(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function Si(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=ye(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,d))}};return {anchor:o(n.anchor),head:o(n.head)}}function Pl(e,t,n,r){if(t.paragraphId===n.paragraphId)return ye(e,t.paragraphId).slice(t.offset,n.offset);let o=r??ua$2(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=ye(e,t.paragraphId).slice(t.offset);for(let d=1;d<s.length;d+=1){let u=s[d],f=ye(e,u),p=ra$1(e,u).includes(s[d-1])?"":`
17
+ `;l+=p+(d===s.length-1?f.slice(0,n.offset):f);}return l}function yf(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 Kx(e){return e.kind}function Zx(e){return e.kind!=="textValue"&&Kx(e)==="contentControl"}function qx(e){return e.kind!=="textValue"&&Kx(e)==="contentControlContent"}function nO(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=yf(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 rO(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(Zx(a)){let s=yf(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 Vx(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 oO(e,t,n){let r=[],o=a=>{if(a.kind!=="textValue"){if(a.kind==="table"||Zx(a)){let s=yf(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 jx(e,t,n,r,o){let a=p=>ye(e,p);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let i=o??ua$2(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=Vx(a,i,s,l,n,r),f=i[l];return {partName:t.name,paragraphIds:d,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...u],fullyCoveredBlockIds:oO(t,u,new Set(i)),lastMarkCovered:r.offset===a(f).length}}function zx(e,t,n,r,o,a={displayMode:e.displayMode??"all-markup",authorFilter:void 0}){let i=k=>ye(e,k);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let s=o??ua$2(e),l=s.indexOf(n.paragraphId),d=s.indexOf(r.paragraphId);if(l===-1||d===-1)return {ops:[],collapseTo:n};let u=Vx(i,s,l,d,n,r),f=nO(t,u),p=new Map;for(let[k,R]of f)for(let x of R)p.set(x,k);let m=rO(t,u,f),g=l;if(p.has(n.paragraphId)){g=-1;for(let k=l+1;k<=d;k+=1)if(!p.has(s[k])){g=k;break}if(g===-1){let k=p.get(n.paragraphId);for(let R of f.get(k)??[])p.delete(R);f.delete(k),g=l;}}let v=s[g],b=g===l?n:{paragraphId:v,offset:0},y=[];for(let k=l;k<=d;k+=1){let R=s[k];if(p.has(R))continue;let x=i(R).length,N=k===l?n.offset:0,V=k===d?r.offset:x;N<V&&y.push({op:"deleteText",paragraphId:R,start:N,end:V});}for(let k of f.keys())y.push({op:"deleteBlock",blockId:k});for(let k of m)y.push({op:"removeContentControl",controlId:k});let I=k=>{let R=Ia$1(t,k);for(;R&&qx(R);){let x=Ia$1(t,R.id);if(!x||!m.has(x.id))break;R=Ia$1(t,x.id);}return R},T=new Map,O=k=>{let R=T.get(k.id);return R||T.set(k.id,R=wi(k.children,a)),R},P=k=>{let R=[],x=N=>{for(let V of N)if(V.kind!=="textValue"&&!f.has(V.id)){if(m.has(V.id)){let M=V.children.find(qx);M&&M.kind!=="textValue"&&x(M.children);continue}if(V.kind==="paragraph"){R.push(V.id);continue}R.push(`\0barrier:${V.id}`);}};return x(k.children),R},B=(k,R)=>{let x=I(k);if(!x||I(R)!==x)return null;let N=P(x),V=N.indexOf(k),M=N.indexOf(R);if(V===-1||M<=V)return null;let D=N.slice(V+1,M);if(D.length===0)return D;let K=O(x);return D.every(j=>K.has(j))?D:null},C=v,_=v;for(let k=g+1;k<=d;k+=1){let R=s[k];if(p.has(R))continue;let x=B(_,R);if(x)for(let N of [...x,R])y.push({op:"joinParagraphs",firstId:C,secondId:N});else C=R;_=R;}return {ops:y,collapseTo:b}}function aO(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var Xx=/^[^\s]{1,512}$/,iO=/["\\\u0000-\u001f\u007f]/;function Cl(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!Xx.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 Ii(e,t,n){return iO.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function Yx(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=Cl(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function Qx(e){return e.querySelector("[data-docx-hf-active]")}function no(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 sO(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function bf(e,t){let n=Qx(e);if(n)return [n,e];let r=sO(e,t);return r&&r!==e?[r,e]:[e]}function Wx(e,t){let n=Yx(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=Cl(a);if(i)return {element:a,identity:i}}return null}function lO(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=Wx(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=Wx(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function Ux(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")||Qx(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?Jx(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let s=e,l=Cl(s);if(l)return {paragraphId:l.paragraphId,offset:t>0?l.end:l.start};let d=lO(s,t);return d||fO(s)}let i=Yx(e);return i?{paragraphId:i.identity.paragraphId,offset:aO(i.identity,t)}:null}function Ko(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=Ux(n,r,e),s=Ux(o,a,e);if(!i||!s){let l=i??s;return l?{anchor:l,head:l}:null}return {anchor:i,head:s}}function vf(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 Gx(e,t,n){for(let r of bf(e,n)){let o=dO(r,t);if(o)return o}return null}function dO(e,t){let n=Ii(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let i of n){let s=Cl(i);if(!s||s.paragraphId!==t.paragraphId)continue;let l=cO(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 f={node:l,offset:Math.min(t.offset-s.start,d)};if(t.offset<u)return f;r=f;}}if(r)return r;if(o)return null;let a=uO(e,t.paragraphId);return a?{node:a,offset:0}:null}function cO(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 uO(e,t){let n=null;for(let r of Ii(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 Jx(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!Xx.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function fO(e){let t=Jx(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function ew(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??no(n.anchorNode,e),a=Gx(e,t.anchor,o),i=Gx(e,t.head,o);if(!a||!i)return false;let s=Ko(e,n);if(s&&Ot(s,t)){let l=no(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 Ot(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}var pO='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function tw(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 nw(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 mO(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function gO(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function rw(e,t,n,r){if(e.dataset.docxField!==void 0){let a=tw(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:tw(e,t,t+o.length),text:o,seq:r}}function ow(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=nw(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(pO))continue;ow(r,t);continue}let a=rw(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 hO(e,t,n,r){let o=[];for(let i of Ii(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=gO(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 yO(e,t,n){for(let r of Ii(e,n.paragraphId,"[data-start]")){let o=r,a=nw(o,n.paragraphId);if(a===null||t.some(l=>l.contains(o)))continue;let i=rw(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 bO(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 aw(e,t,n,r){let o=hO(e,t,r,mO(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)ow(i,a);return yO(e,o,a),a.pieces.length===0?null:bO(a.pieces,n)}var vO={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},iw={l:"left",e:"center",r:"right",j:"both"},sw={1:"240",5:"360",2:"480"},lw={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function xO(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}var wO=/^[a-z]$/;function SO(e){let t=e.key.toLowerCase();if(wO.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function cw(e,t={}){return n=>{if(n.defaultPrevented)return;if(n.key==="F9"&&n.altKey&&!n.ctrlKey&&!n.metaKey&&!n.shiftKey&&!n.isComposing&&t.onToggleFieldCodes){n.preventDefault(),t.onToggleFieldCodes();return}if(!n.altKey&&!n.isComposing&&(n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.key==="8"||n.ctrlKey&&!n.metaKey&&n.shiftKey&&(n.code==="Digit8"||n.key==="*"))&&t.onToggleParagraphMarks){n.preventDefault(),t.onToggleParagraphMarks();return}if(n.key==="Escape"&&e.formatPainter.state().mode!=="off"){e.formatPainter.disarm(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="headerFooter"){e.exitHeaderFooter(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="note"){e.exitNote(),n.preventDefault();return}let r=SO(n);if(xO(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=vO[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&&lw[n.key.toLowerCase()]){let i=lw[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&&iw[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:iw[n.key.toLowerCase()]}),n.preventDefault();return}if(o&&!n.shiftKey&&sw[n.key]){e.setParagraphProperty("spacing",{line:sw[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 uw(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=Xc(a.clipboardData),s=a.clipboardData?.getData("text/html")??"";a.preventDefault(),!(!i&&!s)&&e.pasteRich(i,s.length>0?s:null);}}}function dw(e){let t=Xc(e.dataTransfer);return t.length>0?t:null}function fw(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??dw(n);if(!r)return;PO(e,kO(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=dw(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function IO(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 kO(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=IO(n);return r?{text:r,paragraphId:TO(n)}:null}function TO(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 PO(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(Ot(r.selection,Ze(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let i=je(e.session,o.paragraphId)??e.session.part(),s=Ui(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 pw(e,t,n,r=null){for(let o of bf(e)){let a=aw(o,t,n,r);if(a!==null)return a}return null}function mw(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 $e(e){return e.kind!=="textValue"}function ge(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if($e(n)&&n.localName===t&&n.namespaceUri===da)return n;return null}function Qe(e,t="val"){return e?Ne(e,t,da):void 0}function nn(e,t,n){return e?Ne(e,t,n):void 0}function xf(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=xf(n);return t}function Zo(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=Zo(r,t,n);if(o)return o}return null}function xt(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function wf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var En=wf;function Rl(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function On(e){return `${Math.round(e/20*100)/100}pt`}var CO="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",RO=Ib$1;function ki(e,t,n){for(let o of nc(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let a=w$1(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i&&$e(i.root))return i.root}}let r=e.parts.get(n);return r&&$e(r.root)?r.root:null}function gw(e){let t=ki(e,CO,"/word/styles.xml"),n=new Map,r=null,o=null,a=null,i=null,s=null;if(!t)return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i,defaultTableStyleId:s};let l=0;for(let d of t.children){if(!$e(d)||d.namespaceUri!==da)continue;if(d.localName==="docDefaults"){r=ge(ge(d,"rPrDefault"),"rPr"),o=ge(ge(d,"pPrDefault"),"pPr");continue}if(d.localName!=="style")continue;if(l>=Jb$2)break;l+=1;let u=Ne(d,"styleId",da);if(!u)continue;n.set(u,d);let f=Ne(d,"default",da),p=Ne(d,"type",da);f==="1"||f==="true"||f==="on"?p==="paragraph"?a=u:p==="character"?i=u:p==="table"&&(s=u):(a===u&&(a=null),i===u&&(i=null),s===u&&(s=null));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i,defaultTableStyleId:s}}function ar(e,t,n){let r=[],o=new Set,a=t;for(;a&&!o.has(a)&&r.length<RO;){o.add(a);let i=e.byId.get(a);if(!i)break;if(r.length===0&&n!==void 0){let s=Ne(i,"type",da);if(s!==void 0&&s!==n)return []}r.unshift(i),a=Qe(ge(i,"basedOn"));}return r}function Sf(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let a of n)r.push(a);let o=Qe(ge(t,"pStyle"));for(let a of ar(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let i=ge(a,"pPr");i&&r.push(i);}return t&&r.push(t),r}function El(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let a=[];if(r)for(let f of r)a.push(f);let i=[],s=Qe(ge(t,"pStyle"));for(let f of ar(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let p=ge(f,"rPr");p&&i.push(p);}let l=[],d=Qe(ge(n,"rStyle"))??e.defaultCharacterStyleId??void 0;for(let f of ar(e,d,"character")){let p=ge(f,"rPr");p&&l.push(p);}let u=[...o,...a,...i,...l];return n&&u.push(n),{all:u,defaults:o,tableLevel:a,paragraphLevel:i,characterLevel:l,direct:n}}function rn(e,t){let n=null;for(let r of e){let o=ge(r,t);o&&(n=o);}return n}function ft(e,t,n){let r;for(let o of e){let a=ge(o,t);if(!a)continue;let i=Ne(a,n,da);i!==void 0&&(r=i);}return r}function Ol(e){return !(e==="0"||e==="false"||e==="off")}function ir(e,t){let n=false;for(let r of e){let o=ge(r,t);o&&(n=Ol(Qe(o)));}return n}function Or(e,t){let n;for(let r of e){let o=ge(r,t);o&&(n=Ol(Qe(o)));}return n}function vn(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return Ol(Qe(n));let r=Or(e.tableLevel,t),o=Or(e.paragraphLevel,t),a=Or(e.characterLevel,t);return a===false||a===void 0&&o===false||a===void 0&&o===void 0&&r===false?false:Or(e.defaults,t)===true?true:r===true!=(o===true)!=(a===true)}function If(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return Ol(Qe(n));let r=Or(e.characterLevel,t);if(r!==void 0)return r;let o=Or(e.paragraphLevel,t);if(o!==void 0)return o;let a=Or(e.tableLevel,t);return a!==void 0?a:Or(e.defaults,t)===true}function hw(e){return e.isLgl?"decimal":e.numFmt}function yw(e){let t=Cc$1(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,f=new Map;for(let[p,m]of d.levels)u.set(String(p),hw(m)),f.set(String(p),m.start);r.set(l,u),o.set(l,f);}for(let[l,d]of t.nums){n.set(l,d.abstractNumId);for(let[u,f]of d.overrides){let p=`${l}:${u}`,m=f.startOverride??f.level?.start;m!==void 0&&a.set(p,m),f.level!==void 0&&i.set(p,hw(f.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:a,formatOverrides:i,styleLinks:s}}function bw(e,t){if(e===null)return null;let n=Ne(e,t,da);if(n===void 0||!/^-?\d{1,9}$/.test(n))return null;let r=Number.parseInt(n,10);return Number.isSafeInteger(r)?r:null}function xw(e,t){if(e===null)return null;let n=Ne(e,t,da);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function vw(e){return `${Math.round(e/20*100)/100}pt`}var EO=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function Vo(e,t,n){if(e===null)return null;let r=Ne(e,t,da);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Ne(e,"val",da);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function kf(e,t){let n=new Map,r=new Set(EO);for(let o of e)for(let a of o.children){if(a.kind==="textValue"||a.localName!=="tblStylePr"||a.namespaceUri!==da)continue;let i=Ne(a,"type",da);i===void 0||!r.has(i)||n.set(i,{fill:xw(ge(ge(a,"tcPr"),"shd"),"fill"),rPr:ge(a,"rPr"),pPr:ge(a,"pPr")});}return {byType:n,firstRowEnabled:Vo(t,"firstRow",32)??false,lastRowEnabled:Vo(t,"lastRow",64)??false,firstColumnEnabled:Vo(t,"firstColumn",128)??false,lastColumnEnabled:Vo(t,"lastColumn",256)??false,hBandingEnabled:!(Vo(t,"noHBand",512)??false),vBandingEnabled:!(Vo(t,"noVBand",1024)??false)}}function Tf(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=f=>e.byType.get(f)??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 f=t-(e.firstRowEnabled?1:0);if(f>=0){let p=u(f%2===0?"band1Horz":"band2Horz");if(p)return p}}if(e.vBandingEnabled){let f=a-(e.firstColumnEnabled?1:0);if(f>=0){let p=u(f%2===0?"band1Vert":"band2Vert");if(p)return p}}return null}function ww(e,t,n,r,o,a,i,s,l=false,d=[]){let u=[],f=ge(e,"tcBorders"),p={top:n===0?"top":"insideH",bottom:n+o>=r?"bottom":"insideH",left:a?"left":"insideV",right:i?"right":"insideV"};for(let O of ["top","left","bottom","right"]){let P=O==="left"?"start":O==="right"?"end":O,B=ge(f,O)??ge(f,P),C=p[O],_=C==="left"?"start":C==="right"?"end":C,k=B!==null?Gr(B):Gr(ge(t,C)??ge(t,_));k&&u.push(`border-${hn(O,l)}:${k}`);}let m=xw(ge(e,"shd"),"fill")??s;m&&u.push(`background-color:${m}`);let g=ge(e,"vAlign"),v=g===null?void 0:Ne(g,"val",da);v==="center"?u.push("vertical-align:middle"):(v==="bottom"||v==="top")&&u.push(`vertical-align:${v}`);let b=ge(e,"tcW"),y=bw(b,"w"),I=b===null?void 0:Ne(b,"type",da);y!==null&&y>0&&(I===void 0||I==="dxa")&&u.push(`width:${vw(y)}`);let T=ge(e,"tcMar");for(let O of ["top","right","bottom","left"]){let P=O==="left"?"start":O==="right"?"end":O,B=ge(T,O)??ge(T,P)??d.map(k=>ge(k,O)??ge(k,P)).find(k=>k!==null)??null,C=bw(B,"w"),_=B===null?void 0:Ne(B,"type",da);C!==null&&C>=0&&(_===void 0||_==="dxa")&&u.push(`padding-${hn(O,l)}:${vw(C)}`);}return u.join(";")}function OO(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===da}function Sw(e){return e.localName==="customXml"&&e.namespaceUri===da}function Iw(e){let t=[],n=[],r=o=>{for(let a of o)if($e(a)){if(a.kind==="tableRow"||a.localName==="tr"&&a.namespaceUri===da){n.push({row:t.length}),t.push(a);continue}if(a.kind==="contentControl"){let i=a.children.find(s=>s.kind==="contentControlContent");i&&$e(i)&&r(i.children);continue}if(Sw(a)){r(a.children);continue}n.push({skip:a});}};return r(e.children),{rows:t,tableItems:n}}function kw(e){let t=[],n=[];for(let r of e){let o=[],a=[],i=0,s=l=>{for(let d of l)if($e(d)){if(OO(d)){let u=ge(d,"tcPr"),f=Math.min(Math.max(xt(Qe(ge(u,"gridSpan")))??1,1),63),p=ge(u,"vMerge"),m=p===null?null:Qe(p)==="restart"?"restart":"continue",g={cell:d,startColumn:i,span:f,vMerge:m};o.push(g),a.push({placement:g}),i+=f;continue}if(d.kind==="contentControl"){let u=d.children.find(f=>f.kind==="contentControlContent");u&&$e(u)&&s(u.children);continue}if(Sw(d)){s(d.children);continue}a.push({skip:d});}};s(r.children),t.push(o),n.push(a);}return {placements:t,items:n}}function Tw(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 Pw(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=Tf(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 Cw(e,t){let n=ar(e.styles,Qe(ge(t,"tblStyle")),"table");return n.length>0?n:ar(e.styles,e.styles.defaultTableStyleId??void 0,"table")}function Rw(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&$e(n)?n:null,o=Cw(e,r),a=kf(o,ge(r,"tblLook")),{rows:i}=Iw(t),{placements:s}=kw(i);return Pw(e,a,s,Tw(s))}function Ew(e,t,n,r){let o=t.children.find(k=>k.kind==="tableProperties"),a=o&&$e(o)?o:null,i=null,s=Cw(e,a);for(let k of s){let R=ge(ge(k,"tblPr"),"tblBorders");R&&(i=R);}let l=s.map(k=>ge(k,"tblPr")).filter(k=>k!==null);a&&l.push(a);let d=ir(l,"bidiVisual"),u=[],f;for(let k of l){let R=ge(k,"tblCellMar");R&&u.unshift(R),f=Qe(ge(k,"jc"))??f;}let p=ge(a,"tblBorders");p&&(i=p);let m=kf(s,ge(a,"tblLook")),{rows:g,tableItems:v}=Iw(t),{placements:b,items:y}=kw(g),I=Tw(b),T=Pw(e,m,b,I),O=["border-collapse:collapse"],P=ge(a,"tblW"),B=xt(nn(P,"w",da));B!==null&&B>0&&nn(P,"type",da)==="dxa"&&O.push(`width:${On(B)}`);let C=hn(f==="right"||f==="end"?"right":f==="center"?"center":"left",d);C==="center"?O.push("margin-left:auto","margin-right:auto"):C==="right"?O.push("margin-left:auto","margin-right:0"):O.push("margin-left:0","margin-right:auto");for(let[k,R]of [["insideH","insideh"],["insideV","insidev"]]){let x=Gr(ge(i,k));x&&O.push(`mso-border-${R}-alt:${x}`);}let _=`<table dir="${d?"rtl":"ltr"}" align="${C}" style="${O.join(";")}">`;for(let k of v){if("skip"in k){r.advanceFieldState(k.skip,n);continue}let R=k.row,x=ge(ge(g[R]??null,"trPr"),"trHeight"),N=xt(nn(x,"val",da)),V=hy(N,nn(x,"hRule",da)),M=V===""?"":` style="${V}"`;_+=`<tr${M}>`;for(let D of y[R]??[]){if("skip"in D){r.advanceFieldState(D.skip,n);continue}let K=D.placement;if(K.vMerge==="continue"){r.advanceFieldState(K.cell,n);continue}let j=1;if(K.vMerge==="restart")for(let Z=R+1;Z<b.length&&b[Z].find(W=>W.startColumn===K.startColumn&&W.vMerge==="continue");Z+=1)j+=1;let Q=ge(K.cell,"tcPr"),ae=K.startColumn+K.span>=I,Y=Tf(m,R,b.length,K.startColumn===0,ae,K.startColumn),ne=m.byType.get("wholeTable")??null,oe=ww(Q,i,R,b.length,j,K.startColumn===0,ae,Y?.fill??ne?.fill??null,d,u),L=(K.span>1?` colspan="${K.span}"`:"")+(j>1?` rowspan="${j}"`:"")+(oe===""?"":` style="${En(oe)}"`),A=T.get(K.cell)??e;_+=`<td dir="ltr"${L}>${r.renderBlocks(A,K.cell.children,n)}</td>`;}_+="</tr>";}return `${_}</table>`}function Ml(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 Pf(e){let t=Ne(e,"type",da);return t==="separator"||t==="continuationSeparator"}function Cf(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!$e(r)||r.namespaceUri!==da||r.localName!==t||Pf(r))continue;let o=Ml(Ne(r,"id",da));o!==null&&n.add(o);}return n}function Ti(e,t,n,r,o,a,i){for(let s of t.children)if($e(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){Ti(e,s,n,r,o,a,Rw(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===da&&s.localName==="tc"){let l=i?.get(s);if(l===void 0){r.inert||o(s,r);continue}Ti(l,s,n,r,o,a,i);continue}if(s.kind==="paragraph"){let l=s.children.find(d=>d.kind==="paragraphProperties");Ti(e,s,n,r,o,l&&$e(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=El(e.styles,a,l&&$e(l)?l:null,e.tableRPr);if(vn(d,"vanish"))continue}if(s.namespaceUri===da&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=Ml(Ne(s,"id",da));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}Ti(e,s,n,r,o,a,i);}}function MO(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!$e(r)||r.namespaceUri!==da)&&!(r.localName!==t||Pf(r))&&Ml(Ne(r,"id",da))===n)return r;return null}function Ow(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=MO(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=[];Ti(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 Rf(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=nc(e.pkg,a),s="";for(let l of n.children){if(!$e(l)||l.namespaceUri!==da||l.localName!==t||Pf(l))continue;let d=Ne(l,"id",da),u=Ml(d);if(d===void 0||u===null||!r.has(u))continue;let f=o({...e,noteBody:{kind:t,id:u},docRels:i},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${u}">${f===""?"<p></p>":f}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}var Ef="http://schemas.openxmlformats.org/officeDocument/2006/relationships",FO=`${Ef}/numbering`,AO=`${Ef}/footnotes`,LO=`${Ef}/endnotes`,NO=2*1024*1024,DO=8*1024*1024,Mw=9525,HO=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 Fl(e,t,n,r){let o=e.direct!==null&&ge(e.direct,r)!==null||rn(e.defaults,r)!==null||rn(e.tableLevel,r)!==null||rn(e.paragraphLevel,r)!==null||rn(e.characterLevel,r)!==null;return vn(e,t&&o?r:n)}function _O(e){let t=e.all;if(vn(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=ir(t,"rtl"),o=(r?ft(t,"rFonts","cs"):void 0)??ft(t,"rFonts","ascii")??ft(t,"rFonts","hAnsi")??ft(t,"rFonts","eastAsia")??(r?void 0:ft(t,"rFonts","cs"));if(o!==void 0){let O=py(o);O&&n.push(`font-family:${O}`);}let a=xt((r?ft(t,"szCs","val"):void 0)??ft(t,"sz","val")??(r?void 0:ft(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;Fl(e,r,"b","bCs")?n.push("font-weight:bold"):Fl(i,r,"b","bCs")&&n.push("font-weight:normal"),Fl(e,r,"i","iCs")?n.push("font-style:italic"):Fl(i,r,"i","iCs")&&n.push("font-style:normal");let l=[],d=rn(t,"u"),u=d!==null&&Qe(d)!=="none";u&&l.push("underline");let f=If(e,"dstrike");if((vn(e,"strike")||f)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let O=rn(s,"u");(O!==null&&Qe(O)!=="none"||vn(i,"strike")||If(i,"dstrike"))&&n.push("text-decoration:none");}u&&n.push(...gy(d)),f&&!u&&n.push("text-decoration-style:double");let p=Rl(ft(t,"color","val"));p&&n.push(`color:${p}`);let m=xt(ft(t,"spacing","val"));m!==null&&n.push(`letter-spacing:${Math.round(m/20*100)/100}pt`);let g=Qe(rn(t,"highlight")),v=g!==void 0&&Object.hasOwn(Cc,g)?Cc[g]:void 0,b=Rl(ft(t,"shd","fill"));v?n.push(`background-color:${v}`,`mso-highlight:${g}`):b&&n.push(`background-color:${b}`),vn(e,"caps")?n.push("text-transform:uppercase"):vn(i,"caps")&&n.push("text-transform:none"),vn(e,"smallCaps")?n.push("font-variant:small-caps"):vn(i,"smallCaps")&&n.push("font-variant:normal");let y=Qe(rn(t,"vertAlign")),I=y==="superscript"||y==="subscript"?y:null,T=Ur((r?ft(t,"lang","bidi"):void 0)??ft(t,"lang","val")??ft(t,"lang","bidi")??ft(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:I,lang:T,rtl:r}}function BO(e,t){let n=[],r=Qe(rn(e,"jc")),o=r!==void 0&&Object.hasOwn(Rc,r)?Rc[r]:void 0;o&&n.push(`text-align:${o}`);let a=xt(ft(e,"spacing","before"));a!==null&&a>=0&&n.push(`margin-top:${On(a)}`);let i=xt(ft(e,"spacing","after"));i!==null&&i>=0&&n.push(`margin-bottom:${On(i)}`);let s=xt(ft(e,"spacing","line")),l=ft(e,"spacing","lineRule");n.push(...my(s,l));let d=null,u=null,f=null,p=null;for(let b of e){let y=ge(b,"ind");if(!y)continue;let I=xt(nn(y,"left",da)??nn(y,"start",da));I!==null&&(d=I);let T=xt(nn(y,"right",da)??nn(y,"end",da));T!==null&&(u=T);let O=xt(nn(y,"hanging",da)),P=xt(nn(y,"firstLine",da));O!==null?(f=O,p=null):P!==null&&(p=P,f=null);}!t&&d!==null&&n.push(`margin-left:${On(d)}`),u!==null&&n.push(`margin-right:${On(u)}`),f!==null&&f!==0?n.push(`text-indent:${On(-f)}`):p!==null&&p!==0&&n.push(`text-indent:${On(p)}`);let m=rn(e,"tabs");if(m){let b=[];for(let y of m.children){if(!$e(y)||y.localName!=="tab")continue;let I=Qe(y),T=xt(Ne(y,"pos",da));if(T===null||T<0||I!=="left"&&I!=="center"&&I!=="right"&&I!=="decimal"&&I!=="bar")continue;let O=Qe(y,"leader"),P=O==="dot"?"dotted":O==="hyphen"?"dashed":O==="underscore"?"lined":O==="middleDot"?"middledot":O==="heavy"?"heavy":"";b.push(`${I}${P?` ${P}`:""} ${On(T)}`);}b.length>0&&n.push(`tab-stops:${b.join(" ")}`);}ir(e,"pageBreakBefore")&&n.push("page-break-before:always"),ir(e,"keepNext")&&n.push("page-break-after:avoid"),ir(e,"keepLines")&&n.push("page-break-inside:avoid"),ir(e,"widowControl")&&n.push("widows:2","orphans:2");let g=Rl(ft(e,"shd","fill"));g&&n.push(`background-color:${g}`);let v=rn(e,"pBdr");if(v)for(let b of ["top","left","bottom","right"]){let y=Gr(ge(v,b));y&&n.push(`border-${b}:${y}`,`mso-border-${b}-alt:${y}`);}return n.join(";")}function $O(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 Fw={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function Lw(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 qO(e,t){let n,r;for(let s of t){let l=ge(s,"numPr");if(!l)continue;let d=Qe(ge(l,"numId"));d!==void 0&&(n=d);let u=Qe(ge(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=Qe(ge(ge(ge(d??null,"pPr"),"numPr"),"numId")),f=u===void 0?void 0:e.numbering.numToAbstract.get(u);if(f===void 0||f===o)break;o=f;}let a=Math.min(Math.max(xt(r)??0,0),8),i=Lw(e,n,o,a);return {numId:n,abstractId:o,level:a,fmt:i.fmt,start:i.start}}function KO(e,t){let n=B(e.pkg.contentTypes,t);if(n.ok){let a=HO.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 ZO(e,t){let n=Zo(t,"inline",ia)??Zo(t,"anchor",ia);if(!n)return "";let r=Zo(n,"blip",ha$1);if(!r)return "";let o=Ne(r,"embed",ja$2);if(!o)return "";let a=e.docRels.find(v=>v.id===o&&v.targetMode!=="External");if(!a)return "";let i=w$1(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=KO(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,${As(s)}`,e.imageDataUris.set(i.partName,d));let u=Zo(n,"extent",ia),f=u?xt(Ne(u,"cx","")):null,p=u?xt(Ne(u,"cy","")):null,m=v=>Math.round(v/12700*100)/100,g=f!==null&&p!==null&&f>0&&p>0?` width="${Math.round(f/Mw)}" height="${Math.round(p/Mw)}" style="width:${m(f)}pt;height:${m(p)}pt"`:"";return `<img src="${d}"${g}>`}function oo(e,t,n=0){if(n>=la$2)return;let r=ke(e)?n+1:ma$1(e,n);for(let o of e.children)if($e(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let a=o.children.find(i=>i.kind==="contentControlContent");a&&$e(a)&&oo(a,t,r+1);continue}if(o.kind==="fldChar"){Nw(o,t);continue}oo(o,t,r);}}function Nw(e,t){let n=Ne(e,"fldCharType",da);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 VO(e,t,n,r){let o=t.children.find(d=>d.kind==="runProperties"),a=El(e.styles,n,o&&$e(o)?o:null,e.tableRPr),i=_O(a),s="";for(let d of t.children){if(!$e(d))continue;if(d.kind==="fldChar"){r.inert||Nw(d,r);continue}if(d.kind==="instrText"||!r.inert&&r.stack.some(p=>p==="instr")||i.vanish)continue;let u=by(d);if(u!==""){s+=u;continue}let f=yy(d,e.noteBody,(p,m)=>$O(e,p,m),(p,m)=>e.availableNotes[p].has(m));if(f!==""){s+=f;continue}switch(d.kind){case "text":s+=wf(xf(d));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let p=Ne(d,"type",da);s+=p==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let p=gn(Ne(d,"name",da));p!==null&&(s+=`<a id="${En(p)}"></a>`);break}case "drawing":s+=ZO(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="${En(i.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function ro(e,t,n,r,o=0){if(o>=la$2)return "";let a="";for(let i of t)if($e(i))switch(ke(i)?"fldSimple":i.kind){case "run":a+=VO(e,i,n,r);break;case "hyperlink":{let s=ro(e,i.children,n,r,o+1);if(s==="")break;let l=Ne(i,"id",ja$2),d=l?e.docRels.find(p=>p.id===l):void 0,u=d===void 0?void 0:d.targetMode==="External"||d.rawTarget.startsWith("#")?d.rawTarget:void 0,f=$y(u,Ne(i,"anchor",da));a+=f!==null?`<a href="${En(f)}">${s}</a>`:s;break}case "bookmarkStart":{let s=gn(Ne(i,"name",da));s!==null&&(a+=`<a id="${En(s)}"></a>`);break}case "fldSimple":a+=ro(e,i.children,n,r,o+1);break;case "contentControl":{let s=i.children.find(l=>l.kind==="contentControlContent");s&&$e(s)&&(a+=ro(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":a+=ro(e,i.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":oo(i,r,o);break;case "generic":if(na(i))a+=ro(e,i.children,n,r,o+1);else {let s=Ld(i);s&&(a+=ro(e,s,n,r,o+1));}break}return a}function jO(e,t){let n=Qe(ge(t,"pStyle")),r=ar(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let a=Ne(r[o],"styleId",da),i=a?/^Heading([1-6])$/.exec(a):null;if(i)return {level:Number(i[1]),fromStyle:true}}if(n===void 0){let o=xt(Qe(ge(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function zO(e,t){let n=ar(e.styles,Qe(ge(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=fy(Ne(n[r],"styleId",da));if(o!==null)return o}return null}function Aw(e,t,n,r){let o=t.children.find(b=>b.kind==="paragraphProperties"),a=o&&$e(o)?o:null,i=Sf(e.styles,a,e.tablePPr),s=BO(i,n.asListItem),l=ro(e,t.children,a,r),d=s===""?"":` style="${En(s)}"`,u=ir(i,"bidi")?' dir="rtl"':"",f=zO(e,a),p=f===null?"":` class="${f}"`,m=jO(e,a);if(n.asListItem)return `<li${m?.fromStyle===true?` class="Heading${m.level}"`:p}${u}${d}>${l}</li>`;let g=m===null?"p":`h${m.level}`,v=m===null?p:m.fromStyle?` class="Heading${m.level}"`:' class="docx-outline"';return `<${g}${v}${u}${d}>${l}</${g}>`}var WO={renderBlocks:(e,t,n)=>Al(e,t,n),advanceFieldState:oo};function Al(e,t,n){let r="",o=[],a=null,i=new Map,s=n;if(s===void 0){let p={stack:[]};for(let m of t)$e(m)&&oo(m,p);s={stack:[],inert:p.stack.length>0};}let l=()=>{let p=o.pop();p&&(r+=`</${p.tag}>`);},d=()=>{for(;o.length>0;)l();a=null;},u=(p,m)=>{for(a!==null&&m.level<a&&d();o.length>0&&o[o.length-1].abstractId!==m.abstractId;)l();o.length===0&&(a=m.level);let g=a??m.level,v=m.level-g+1;for(;o.length>v;)l();for(o.length===v&&o[v-1].numId!==m.numId&&l();o.length<v;){let I=g+o.length,T=Lw(e,m.numId,m.abstractId,I),O=i.get(`${m.abstractId}:${m.numId}:${I}`)??0,P=T.start+O,B=T.fmt==="bullet"?"ul":"ol",C=B==="ol"?Object.hasOwn(Fw,T.fmt)?Fw[T.fmt]:"decimal":null,_=B==="ol"&&P!==1?` start="${P}"`:"";r+=C?`<${B}${_} style="list-style-type:${En(C)}">`:`<${B}>`,o.push({tag:B,numId:m.numId,abstractId:m.abstractId});}let b=`${m.abstractId}:${m.numId}:${m.level}`;i.set(b,(i.get(b)??0)+1);let y=`${m.abstractId}:`;for(let I of i.keys()){if(!I.startsWith(y))continue;let T=I.slice(I.lastIndexOf(":")+1);/^\d+$/.test(T)&&Number(T)>m.level&&i.delete(I);}r+=Aw(e,p,{asListItem:true},s);},f=p=>{for(let m of p)if($e(m))switch(m.kind){case "paragraph":{let g=m.children.find(y=>y.kind==="paragraphProperties"),v=g&&$e(g)?g:null,b=qO(e,Sf(e.styles,v));b?u(m,b):(d(),r+=Aw(e,m,{asListItem:false},s));break}case "table":d(),r+=Ew(e,m,s,WO);break;case "contentControl":{let g=m.children.find(v=>v.kind==="contentControlContent");g&&$e(g)&&f(g.children);break}case "generic":f(m.children);break;case "bookmarkStart":{let g=gn(Ne(m,"name",da));g!==null&&(r+=`<a id="${En(g)}"></a>`);break}default:s.inert||oo(m,s);break}};return f(t),d(),r}function Dw(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!$e(n.root))return "";let r=n.root.children.find(d=>d.kind==="body");if(!r||!$e(r))return "";let o=ki(e,AO,"/word/footnotes.xml"),a=ki(e,LO,"/word/endnotes.xml"),i={pkg:e,styles:gw(e),numbering:yw(ki(e,FO,"/word/numbering.xml")),docRels:nc(e,e.mainDocumentPart),maxImageBytes:NO,maxTotalImageBytes:DO,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:Cf(o,"footnote"),endnote:Cf(a,"endnote")},noteBody:null},s=Al(i,r.children),l=Ow(i,{footnote:o,endnote:a},oo);return s+Rf(i,"footnote",o,l.footnote,Al)+Rf(i,"endnote",a,l.endnote,Al)}var UO=12*1024*1024;function GO(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function XO(e){return `<div><table>${e.split(`
18
+ `).map(n=>`<tr>${n.split(" ").map(r=>`<td>${GO(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function Of(e){if(e.cellRectangle)return {text:e.text,html:XO(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=J(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null};let n=e.maxFragmentBytes??UO,r=t.bytes;if(t.bytes.byteLength>n){let i=J(e.pkg,e.coverage,{omitMedia:true});r=i.ok&&i.bytes.byteLength<=n?i.bytes:null;}let o;try{o=Dw(t.package);}catch(i){console.error("docx-editor: copy HTML flavour failed to render",i),o="";}let a=uy(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:a}}function Hw(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=Ls(r);if(o&&e.pasteFragment(o.bytes,o.lastMarkCovered))return "fragment";let a=Ib(r);return a.ok&&a.truncated&&t.text.length>0?n():a.ok&&e.pasteFragment(a.fragmentBytes,a.lastMarkCovered)?"external-html":n()}function _w(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!oi$1(e.settingsRoot()))return r;let a=je(e,t.paragraphId)??e.part();if(!pi$1(a,t.paragraphId))return r;let i=Ha(a,t.paragraphId);if(i?.kind!=="paragraph")return r;let s=th(i).find(b=>b.fieldNodeId===o&&b.start<=t.offset&&b.end>=n.offset);if(!s?.enabled||!rh(s)||s.maxLength<=0)return r;let l=(Ui(a,t.paragraphId)??"").slice(s.start,s.end),d=l.slice(0,t.offset-s.start),u=l.slice(n.offset-s.start),f=d+u,p=b=>sh(d+b+u,s,f)<=s.maxLength;if(p(r))return r;let m=[...r],g=s.maxLength-[...f].length;if(s.type==="number"&&s.format)for(let b of f)(b===","&&s.format.includes(",")||b==="%"&&s.format.endsWith("%"))&&g++;let v=new Set;if(s.type==="date"){let b=0;for(let y=0;y<m.length;y++)if(/\S/.test(m[y])){if(++b>18)break;v.add(y+1);}else (y+1===m.length||/\S/.test(m[y+1]))&&v.add(y+1);}else if(s.type==="number"&&s.format)for(let b=1;b<=3;b++)v.add(g+b);for(let b of [...v].sort((y,I)=>I-y)){if(b<=Math.max(0,g)||b>m.length)continue;let y=m.slice(0,b).join("");if(p(y))return y}return m.slice(0,Math.max(0,g)).join("")}var YO=2e3;function Bw(e){let{session:t}=e,n=null;function r(s){let l=Eb(s),d=e.orderedRange(),u=_w(t,d.from,d.to,l,e.textFormFieldId?.()??null).split(`
19
+ `),f=e.deleteSelectionPlan(),p=f.replaceAt??f.collapseTo,m=u.join(""),g=[...f.ops],v=e.consumePendingFormatOps(p.paragraphId,p.offset,m.length);m.length>0&&(g.push({op:"insertText",paragraphId:p.paragraphId,offset:p.offset,text:m}),g.push(...v));let b=[],y=0;for(let B=0;B<u.length-1;B+=1)y+=u[B].length,b.push(p.offset+y);if(b.length>0&&g.push({op:"splitParagraphMany",paragraphId:p.paragraphId,offsets:b}),g.length===0)return;let I=new Set(t.paragraphIdsIn(e.storyScope())),T=u[u.length-1],O=b.length===0?e.caretMark({paragraphId:p.paragraphId,offset:p.offset+T.length}):void 0,P=g.filter(B=>!v.includes(B));e.commit(()=>e.withoutPendingOnRejection(g,P,e.selectionMark(),O),()=>{if(b.length===0)return Ze({paragraphId:p.paragraphId,offset:p.offset+T.length});let B=t.paragraphIdsIn(e.storyScope()).filter(_=>!I.has(_)),C=B[B.length-1];return C?Ze({paragraphId:C,offset:T.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection();if(s)return Of({text:xa(e.layout(),s),cellRectangle:true,coverage:null,pkg:null});let{from:l,to:d}=e.orderedRange(),u=Pl(e.layout(),l,d,e.paragraphOrder()),f=e.storyScope();if(l.paragraphId===d.paragraphId&&l.offset===d.offset||f.kind!=="body")return {text:u,html:null};let m=t.part(),g=jx(e.layout(),m,l,d,e.paragraphOrder());return Of({text:u,cellRectangle:false,coverage:g,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,f=false;return e.commit(()=>{let p=e.collaborationGate(d.ops,{kind:"body"});if(p)return {committed:false,rejected:true,opCount:0,reason:p};let m=e.actorId(),g=t.applyFragmentPaste({kind:"body"},{paragraphId:u.paragraphId,offset:u.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:d.ops,...m!==void 0?{actorId:m}:{}});return f=g.ok,{committed:g.ok,rejected:!g.ok,opCount:g.ok?1:0,...g.ok?{}:{reason:g.detail??g.reason}}},()=>Ze(u)),f}function i(s,l){let d=n!==null&&e.now()-n<YO;return n=null,Hw({richLaneOpen:e.editingMode()==="edit"&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(f,p)=>a(f,p),insertPlainText:r},{html:l,text:s,forcePlain:d})!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:i,armForcePlainPaste:()=>{n=e.now();}}}function $w(e){let{session:t}=e;function n(){return to(e.selection())}function r(){return e.flushPendingInputAndLayout(),Tl(e.layout(),e.selection(),e.paragraphOrder())}function o(){return r().from}function a(g){return ye(e.layout(),g)}function i(g,v){let b=t.partFor(e.storyScope())??t.part(),y=Ha(b,g.paragraphId);if(!y||y.kind!=="paragraph")return null;let I=v==="before"?bf$1(y,g.offset):cf$1(y,g.offset);if(!I)return null;let T=Pe(b,I.controlId),O=T?Oc$1(T):null;return O&&(O.lock==="contentLocked"||O.lock==="sdtContentLocked"||O.type==="checkbox"||O.type==="picture")?I:null}function s(g){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let v=r();return v.from.paragraphId===v.to.paragraphId&&v.from.offset===v.to.offset?e.atParagraphEnd(g.paragraphId,g.offset):e.atParagraphEnd(v.to.paragraphId,v.to.offset)}function l(g){let v=g?.trim()||void 0,b=d(),y=e.cellSelection(),I=null;return {...b,get replaceAt(){return I??=p(b,v,y),I}}}function d(){e.flushPendingInputAndLayout();let g=e.cellSelection();if(g){let I=[];for(let T of ua$1(e.layout(),g.cellIds)){let O=ye(e.layout(),T).length;O>0&&I.push({op:"deleteText",paragraphId:T,start:0,end:O});}return {ops:I,collapseTo:o()}}let v=e.selection();if(v.anchor.paragraphId===v.head.paragraphId&&v.anchor.offset===v.head.offset)return {ops:[],collapseTo:he(e.layout(),v.head)};let{from:b,to:y}=r();return zx(e.layout(),t.partFor(e.storyScope())??t.part(),b,y,e.paragraphOrder(),e.revisionView())}function u(){return l().ops}function f(g,v,b){if(!(b!==void 0||e.editingMode()==="suggest")||g.paragraphId!==v.paragraphId||v.offset<=g.offset)return g.offset;let I=(b??e.author())?.trim();if(!I)return he(e.layout(),v).offset;let T=je(t,v.paragraphId)??t.part(),O=Ha(T,v.paragraphId);if(!O||O.kind!=="paragraph")return he(e.layout(),v).offset;let P={start:g.offset,end:v.offset},{past:B,landing:C}=mg(O,P,v.offset,I,e.trackedDate()),_=jg(O,g.offset,B,I);return (B-g.offset>_?C:B)-_}function p(g,v,b){let y=g.collapseTo;if(v===void 0&&e.editingMode()!=="suggest")return y;if(b){for(let M of b.cellIds){let D=ta$2(e.layout(),[M]),K=D.length>0?D:ua$1(e.layout(),[M]);if(K.length===0)continue;let j=new Map,Q=oe=>{let L=j.get(oe);return L===void 0&&(L=f({paragraphId:oe,offset:0},{paragraphId:oe,offset:a(oe).length},v),j.set(oe,L)),L},ae=(v??e.author())?.trim(),Y=oe=>{let L=a(oe);if(!ae)return /\S/.test(L);let A=Ha(je(t,oe)??t.part(),oe);if(!A||A.kind!=="paragraph")return /\S/.test(L);let Z="",$=0;for(let W of kg(A,0,L.length,ae))Z+=L.slice($,Math.max($,W.start)),$=Math.max($,W.end);return Z+=L.slice($),/\S/.test(Z)},ne=null;for(let oe=K.length-1;oe>=0;oe-=1){let L=K[oe];if(Y(L)){ne=L;break}}if(ne===null)for(let oe=K.length-1;oe>=0;oe-=1){let L=K[oe];if(Q(L)!==0){ne=L;break}}return ne??=K[K.length-1],{paragraphId:ne,offset:Q(ne)}}return y}let{from:I,to:T}=r();if(I.paragraphId===T.paragraphId&&I.offset===T.offset)return y;if(I.paragraphId===T.paragraphId)return {paragraphId:T.paragraphId,offset:f(I,T,v)};let O=new Set(g.ops.flatMap(M=>M.op==="deleteBlock"?[M.blockId]:[])),P=je(t,T.paragraphId)??t.part();if(O.size>0)for(let M=Ia$1(P,T.paragraphId);M;M=Ia$1(P,M.id)){if(!O.has(M.id))continue;let D={paragraphId:y.paragraphId,offset:a(y.paragraphId).length};return {paragraphId:y.paragraphId,offset:f(y,D,v)}}let B=(v??e.author())?.trim();if(!B)return y;let C=new Set(g.ops.flatMap(M=>M.op==="joinParagraphs"?[M.secondId]:[])),_=e.paragraphOrder(),k=_.indexOf(I.paragraphId),R=_.indexOf(T.paragraphId);if(k===-1||R===-1)return y;let x=M=>{let D=Ha(P,M);return D?.kind==="paragraph"&&bi$1(D,B)},N=R;for(;N>k&&C.has(_[N])&&x(_[N-1]);)N-=1;let V=0;for(let M=N;M<=R;M+=1){let D=_[M],K={paragraphId:D,offset:D===I.paragraphId?I.offset:0},j=D===T.paragraphId?he(e.layout(),T):{paragraphId:D,offset:a(D).length};M===N&&(V+=K.offset),V+=j.offset-K.offset-m(K,j,B);}return {paragraphId:_[N],offset:V}}function m(g,v,b){let y=b?.trim();if(!y||g.paragraphId!==v.paragraphId)return 0;let I=je(t,v.paragraphId)??t.partFor(e.storyScope())??t.part(),T=Ha(I,v.paragraphId);return !T||T.kind!=="paragraph"?0:jg(T,g.offset,v.offset,y)}return {selectionMark:n,orderedRange:r,orderedStart:o,textOf:a,inlineControlBeside:i,splitEndsTheParagraph:s,deleteSelectionPlan:l,deleteSelectionOps:u,replacementOffset:f}}function qw(e){return {atParagraphEnd(t,n){let r=Ui(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=sa(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 Kw=Fc$1;function Zw(e){let{session:t,...n}=e;return wd({view:t,...n})}function Mt(e){return e.closest(".docx-editor__scroll-container")}function Vw(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 jw(e,t,n){let r=Mt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=Vw(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 zw(e,t,n,r){let o=Mt(e);if(!o||o.clientHeight===0)return;let a=Vw(e,o,r),i=[];for(let s of [n.anchor,n.head]){let l=ue(t,s);l&&i.push(l.pageIndex);}return qa$1({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function Mf(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 Ll(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 Ww(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 Gw(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"?eM(e,n,o):QO(n,r)}})}async function QO(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)),f=new Uint8Array(u.length);for(let p=0;p<u.length;p+=1)f[p]=u.charCodeAt(p);return Object.freeze({bytes:f,mime:"image/png"})}function Uw(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 JO(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=Uw(a,"t256"),s=Uw(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 eM(e,t,n){let r=await JO(t,n);if(r===null)return null;let o=await tM(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function tM(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 Xw(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function Yw(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 nM="docx-editor-one-surface__caret",Ff="docx-editor-one-surface__caret--steady",rM=530;function Qw(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=nM,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 I=r.activeElement;return I===e||!!I&&e.contains(I)}function u(I){return I.anchor.paragraphId===I.head.paragraphId&&I.anchor.offset===I.head.offset}function f(){s=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(Ff),o.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function p(){o.classList.add(Ff),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(Ff);},rM);}function m(){if(a||!d()||n().suppress){f();return}let{layout:I,selection:T,scopedHost:O,scopedHostKind:P,preferredPageIndex:B,measurer:C,typingStyle:_}=n(),k=t();if(!u(T)){f();return}let R=ue(I,T.head,{...C?{measurer:C}:{},...B!==void 0?{preferredPageIndex:B}:{}});if(!R||!Number.isInteger(R.pageIndex)){f();return}if(_&&C){let{pageIndex:D,lineId:K$1}=R,j=fe(I).get(T.head.paragraphId)?.find(ae=>ae.pageIndex===D&&ae.line.id===K$1),Q=j?.line;if(Q&&!Q.drawings?.length&&!Uc$1(R)){let ae=_();if(ae){let Y={...ll(I,T)??F$1,...ae},ne=C.lineMetrics(Y);if(ne.height>0){let oe=ad({...R,width:0,y:Q.spans.length>0?Q.box.y+Q.baseline-ne.baseline-K(Y):R.y,height:ne.height},j?.clipBox);if(!oe){f();return}R=oe;}}}}let x=O??e.querySelector(`[data-page-index="${R.pageIndex}"] > .docx-page-content`);if(!x){f();return}if(!(R.height>0)){f();return}o.style.left=`${R.x*k}px`,o.style.top=`${R.y*k}px`,o.style.height=`${R.height*k}px`;let N=Uc$1(R);o.style.transformOrigin=N?"0 0":"",o.style.transform=N?"rotate(-90deg)":"",o.parentNode!==x&&x.append(o),e.style.caretColor="transparent",l&&l!==O&&l.style.removeProperty("caret-color"),l=O??null,l?.style.setProperty("caret-color","transparent");let V=x===O?P??"scoped":"body",M=`${R.pageIndex}:${V}:${R.x}:${R.y}:${R.height}`;M!==s&&(s=M,p());}let g=()=>{a=true,m();},v=()=>{a=false,m();},b=()=>m(),y=I=>{let T=I.relatedTarget;T&&e.contains(T)||f();};return e.addEventListener("compositionstart",g),e.addEventListener("compositionend",v),e.addEventListener("focusin",b),e.addEventListener("focusout",y),{update:m,destroy(){e.removeEventListener("compositionstart",g),e.removeEventListener("compositionend",v),e.removeEventListener("focusin",b),e.removeEventListener("focusout",y),f();}}}function Af(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function ao(e,t){let n=Af(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function Lf(e,t){return !e||e.kind==="tableBody"?null:Af(e.tableId)===Af(t)?e:null}function Pi(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 Nf(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)Nf(o.blocks,t);}}function oM(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});};Nf(n.fragments,r);for(let o of [n.header,n.footer])o&&Nf(o.fragments,r);}}function Df(e,t,n,r){let o=null;return oM(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Hf(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function Jw(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function eS(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function tS(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var aM=120,nS=20;function Nl(e){let t=Gh(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function iM(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function _f(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Bf(e,t){return t.kind==="insertColumn"?Df(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Df(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function rS(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,f=null,p=null,m=null;function g(E){return E instanceof HTMLButtonElement&&(E.classList.contains("docx-table-insert-row")||E.classList.contains("docx-table-insert-column"))}function v(){let E=document.activeElement;return E!==null&&g(E)&&E.closest(".docx-table-furniture")===t?E:null}function b(E){for(let q of [...t.children])g(q)&&q!==E&&q.remove();}function y(){p=null,m=null;}function I(){n!==null&&(clearTimeout(n),n=null);}function T(){for(let q of [...t.children])g(q)||q.remove();let E=v();if(!E){b(null),y();return}p=E,b(E);}function O(E){let q=p??v(),z=q!==null&&document.activeElement===q;y(),t.replaceChildren(),E&&z&&e.pagesLayer.focus({preventScroll:true});}function P(){for(let E of [...t.children])g(E)||E.remove();}function B(E,q,z,J){let ee=e.read().layout.pages[E];if(!ee)return {left:0,top:0};let de=J??ee.contentBox,ce=e.scale(),ye=e.pageOffsetX(E);return {left:(de.x+q+ye)*ce,top:(de.y+z)*ce}}function C(E,q){let z=e.read(),J=Pi(z.layout,q.tableId,q.pageIndex);if(!J)return;let{table:ie,origin:ee}=J,de=document.createElement("div");de.className="docx-table-resize-preview",de.style.position="absolute",de.style.pointerEvents="none";let ce=q.kind!=="rowDivider",ye=B(q.pageIndex,ce?ie.box.x+E:ie.box.x,ce?ie.box.y:ie.box.y+E,ee);de.style.left=`${ye.left}px`,de.style.top=`${ye.top}px`,de.style.width=ce?"2px":`${ie.box.width*e.scale()}px`,de.style.height=ce?`${ie.box.height*e.scale()}px`:"2px",t.append(de);}function _(){let E=document.createElement("button");return E.type="button",E.textContent="+",E.style.position="absolute",E.style.pointerEvents="auto",E}function k(E){V(E);let q=m;if(!q)return;let z=e.read();q.kind==="insertRow"?D(q,z):q.kind==="insertColumn"&&K(q,z);}function R(){queueMicrotask(()=>{!p||document.activeElement===p||l||r?.kind==="insertRow"||r?.kind==="insertColumn"||(p.remove(),y());});}function x(){if(p&&t.contains(p))return p;let E=v();if(E)return p=E,E;let q=_();return q.addEventListener("pointerenter",()=>{l=true,I();}),q.addEventListener("pointerleave",()=>{l=false;}),q.addEventListener("pointerdown",V),q.addEventListener("mousedown",V),q.addEventListener("click",k),q.addEventListener("blur",R),p=q,q}function N(E,q){let z=Pi(q.layout,E.tableId,E.pageIndex);if(!z)return;let{table:J,origin:ie}=z,ee=x();if(b(ee),m=E,ee.dataset.tableId=E.tableId,E.kind==="insertRow"){let de=J.rows.find(Je=>Je.id===E.rowId);if(!de)return;ee.dataset.rowId=E.rowId,delete ee.dataset.gridColumnId,ee.className="docx-table-insert-row",ee.setAttribute("aria-label",e.label("table.insertRowBelow"));let ce=de.box.y+de.box.height/2,ye=B(E.pageIndex,J.box.x-14,ce,ie);ee.style.left=`${ye.left}px`,ee.style.top=`${ye.top-8}px`;}else {let de=J.rows[0]?.cells.find(Oe=>Oe.gridColumnId===E.gridColumnId);if(!de)return;ee.dataset.gridColumnId=E.gridColumnId,delete ee.dataset.rowId;let ce=J.columnEdges[de.gridColumn]??0,ye=J.columnEdges[de.gridColumn+1]??J.box.width;ee.className="docx-table-insert-column",ee.setAttribute("aria-label",e.label("table.insertColumnRight"));let Je=B(E.pageIndex,J.box.x+(ce+ye)/2-8,J.box.y-14,ie);ee.style.left=`${Je.left}px`,ee.style.top=`${Je.top}px`;}t.contains(ee)||t.append(ee);}function V(E){E.preventDefault(),E.stopPropagation();}function M(E,q){if(P(),b(p??v()),!(s||q.editingMode==="view")){if((E.kind==="columnDivider"||E.kind==="rightEdge")&&!E.isHeaderRepeat){let z=Pi(q.layout,E.tableId,E.pageIndex);if(!z)return;let{table:J,origin:ie}=z,ee=document.createElement("div");ee.className=E.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",ee.style.position="absolute",ee.style.pointerEvents="auto",ee.style.cursor="col-resize",ee.dataset.active="true";let de=B(E.pageIndex,J.box.x+E.edgeX,J.box.y,ie);ee.style.left=`${de.left-3}px`,ee.style.top=`${de.top}px`,ee.style.width="6px",ee.style.height=`${J.box.height*e.scale()}px`,ee.addEventListener("pointerdown",j),t.append(ee);}if(E.kind==="rowDivider"&&!E.isHeaderRepeat){let z=Pi(q.layout,E.tableId,E.pageIndex);if(!z)return;let{table:J,origin:ie}=z,ee=document.createElement("div");ee.className="docx-table-row-divider-handle layout-table-row-resize-handle",ee.style.position="absolute",ee.style.pointerEvents="auto",ee.style.cursor="row-resize",ee.dataset.active="true";let de=B(E.pageIndex,J.box.x,J.box.y+E.edgeY,ie);ee.style.left=`${de.left}px`,ee.style.top=`${de.top-3}px`,ee.style.width=`${J.box.width*e.scale()}px`,ee.style.height="6px",ee.addEventListener("pointerdown",j),t.append(ee);}E.kind==="insertRow"&&!E.isHeaderRepeat&&N(E,q),E.kind==="insertColumn"&&!E.isHeaderRepeat&&N(E,q);}}function D(E,q){let z=Bf(q.layout,E);if(!z)return;let J=_f(q),ie=rr({command:{type:"insertRow",where:"below",target:Hf(E.sourceRevision,z)},part:ao(e.session(),E.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...J});e.applyTableCommandPlan(ie);}function K(E,q){let z=Bf(q.layout,E);if(!z)return;let J=z.row.cells.find(ce=>ce.gridColumnId===E.gridColumnId);if(!J)return;let ie=Jw(E.sourceRevision,z,J);if(!ie)return;let ee=_f(q),de=rr({command:{type:"insertColumn",where:"right",target:ie},part:ao(e.session(),E.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...ee});e.applyTableCommandPlan(de);}function j(E){if(E.button!==0)return;let q=e.read();if(q.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;E.preventDefault(),E.stopPropagation();let z=r,J=Bf(q.layout,z);if(!J)return;let ie=Ih(ao(e.session(),z.tableId).root,z.tableId);if(!ie.ok||z.kind!=="rowDivider"&&ie.topology.hasMerge)return;let ee=0,de=0,ce=0,ye=ie.topology.gridColumns.reduce((Re,Ae)=>Re+Nl(Ae),0),Je;if(z.kind==="columnDivider"){let Re=ie.topology.gridColumns.find(Fe=>Fe.id===z.leftGridColumnId),Ae=ie.topology.gridColumns.find(Fe=>Fe.id===z.rightGridColumnId);if(!Re||!Ae)return;ee=Nl(Re),de=Nl(Ae),Je=eS(z.sourceRevision,J,z.leftGridColumnId,z.rightGridColumnId);}else if(z.kind==="rightEdge"){let Re=ie.topology.gridColumns.find(Ae=>Ae.id===z.gridColumnId);if(!Re)return;ee=Nl(Re),de=0,Je=tS(z.sourceRevision,J,z.gridColumnId);}else ce=Math.max(20,Math.round(J.row.box.height*nS)),Je=Hf(z.sourceRevision,J);let Oe=E.currentTarget;Oe.setPointerCapture(E.pointerId),d=E.clientX,u=E.clientY,s={pointerId:E.pointerId,startClientX:E.clientX,startClientY:E.clientY,startEdgePt:z.kind==="rowDivider"?z.edgeY:z.edgeX,leftTwips:ee,rightTwips:de,tableWidthTwips:ye,rowHeightTwips:ce,target:z,ref:J,resizeTarget:Je,captureElement:Oe,rightEdge:z.kind==="rightEdge",vertical:z.kind==="rowDivider",cancelled:false};for(let Re of [...t.children])Re!==Oe&&Re.remove();C(z.kind==="rowDivider"?z.edgeY:z.edgeX,z);}function Q(){if(s){try{s.captureElement.hasPointerCapture(s.pointerId)&&s.captureElement.releasePointerCapture(s.pointerId);}catch{}s.cancelled=true,s=null,T(),r=null;}}function ae(){if(!s||s.cancelled){s=null,T();return}let E=s;s=null;try{E.captureElement.hasPointerCapture(E.pointerId)&&E.captureElement.releasePointerCapture(E.pointerId);}catch{}if(E.vertical?u===E.startClientY:d===E.startClientX){T();return}let q=e.read(),z=_f(q),J=(E.vertical?u-E.startClientY:d-E.startClientX)/e.scale(),ie=Math.round(J*nS),ee;if(E.target.kind==="rowDivider")ee=u0({part:ao(e.session(),E.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...z},E.resizeTarget,Math.max(20,E.rowHeightTwips+ie));else if(E.rightEdge&&E.target.kind==="rightEdge"){let de=Math.max(300,E.leftTwips+ie),ce=Math.max(de,E.tableWidthTwips+ie);ee=rr({command:{type:"commitTableRightEdgeResize",target:E.resizeTarget,columnWidthTwips:de,tableWidthTwips:ce},part:ao(e.session(),E.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...z});}else if(E.target.kind==="columnDivider"){let de=E.leftTwips+ie,ce=E.rightTwips-ie;de=Math.max(300,de),ce=Math.max(300,ce);let ye=E.leftTwips+E.rightTwips;de+ce!==ye&&(de>ye-300?(de=ye-300,ce=300):ce=ye-de),ee=rr({command:{type:"commitTableColumnDividerResize",target:E.resizeTarget,leftWidthTwips:de,rightWidthTwips:ce},part:ao(e.session(),E.target.tableId),layout:q.layout,storeRevision:q.storeRevision,selection:q.selection,cellSelection:q.cellSelection,themeColors:q.themeColors,...z});}else {T();return}e.applyTableCommandPlan(ee),T();}function Y(E){if(!o||!f)return null;let q=e.pageOffsetX(f.pageIndex);return qd(o,f.x,f.y,E.layout,q,f.pageIndex)}function ne(E){if(!r||s||E.editingMode==="view")return;I();let q=Y(E),z=Lf(q,E.selection.head.paragraphId);if(!z){r=null,T();return}if(od(z)!==od(r)){r=null,T();return}r=z,M(z,E);}function oe(){let E=p??v(),q=E!==null&&document.activeElement===E;y(),E&&t.contains(E)&&E.remove(),q&&e.pagesLayer.focus({preventScroll:true});}function L(E){if(s||E.editingMode==="view")return;let q=p??v();if(!q||!t.contains(q)){m&&y();return}if(p=q,!m||m.kind!=="insertRow"&&m.kind!=="insertColumn")return;if(!o){oe();return}let z=od(m),J=pd(o,m);if(!J||od(J)!==z){oe();return}m=J,N(J,E);}function A(E){let q=e.read();if(s&&E.pointerId===s.pointerId){d=E.clientX,u=E.clientY;let ce=(s.vertical?E.clientY-s.startClientY:E.clientX-s.startClientX)/e.scale();for(let ye of [...t.children])ye!==s.captureElement&&ye.remove();C(s.startEdgePt+ce,s.target);return}if(q.editingMode==="view"){O(false);return}if(E.target instanceof Node&&p?.contains(E.target)){I();return}let z=iM(e,E.clientX,E.clientY),J=cd(q.layout,z.y);J>=0&&(f={x:z.x,y:z.y,pageIndex:J});let ie=J>=0?e.pageOffsetX(J):0,ee=o?qd(o,z.x,z.y,q.layout,ie,J>=0?J:void 0):null,de=Lf(ee,q.selection.head.paragraphId);if(!de){if(l)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,T();},aM));return}n&&(clearTimeout(n),n=null),!(r&&nd(de)===nd(r))&&(r=de,M(de,q));}function Z(E){if(!(!s||E.pointerId!==s.pointerId)){if(e.read().editingMode==="view"){Q();return}ae();}}function $(E){!s||E.pointerId!==s.pointerId||Q();}function W(E){E.key!=="Escape"||!s||Q();}return e.pagesLayer.addEventListener("pointermove",A),document.addEventListener("pointermove",A),document.addEventListener("pointerup",Z),document.addEventListener("pointercancel",$),e.pagesLayer.addEventListener("keydown",W),{update(){let E=e.read(),q=a,z=i;o=md(E.layout),a=E.layout.revision,i=E.storeRevision,E.editingMode==="view"?(Q(),r=null,I(),O(true)):q!==null&&(q!==E.layout.revision||z!==E.storeRevision)&&(r!==null&&ne(E),L(E)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let E=e.read();if(E.editingMode==="view")return;let q=p??v();if(q&&t.contains(q)&&m&&(m.kind==="insertRow"||m.kind==="insertColumn")){N(m,E);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&N(r,E);},destroy(){I(),Q(),y(),T(),e.pagesLayer.removeEventListener("pointermove",A),document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",Z),document.removeEventListener("pointercancel",$),e.pagesLayer.removeEventListener("keydown",W),t.remove();}}}function oS(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=(y,I,T)=>t.applyTreeOps(y,I,T,e.storyScope()),u=()=>{let y=e.runFormatRefusal?.();return y?(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:y})),true):false},f={get value(){return e.layout()}},p={get value(){return e.selection()}},m=(y,I,T)=>{let O=l();if(y.paragraphId===I.paragraphId){let k=Aa$1(O,y.paragraphId,y.offset,I.offset,T,i(),s());if(k.length===0)return;let R=za$2(O,y.paragraphId,T);n(()=>d([...k.map(x=>({op:"setRunProperties",paragraphId:y.paragraphId,start:x.start,end:x.end,properties:x.properties,...x.targetRunIds?{targetRunIds:x.targetRunIds}:{}})),...e.paragraphMarkVisible(y.paragraphId)?Rv(a(y.paragraphId),y,I,R):[]],o()));return}let P=e.paragraphOrder(),B=P.indexOf(y.paragraphId),C=P.indexOf(I.paragraphId);if(B===-1||C===-1)return;let _=[];for(let k=B;k<=C;k+=1){let R=P[k],x=a(R),N=k===B?y.offset:0,V=k===C?I.offset:x.length,M=N<V?Aa$1(O,R,N,V,T,i(),s()):[];for(let K of M)_.push({op:"setRunProperties",paragraphId:R,start:K.start,end:K.end,properties:K.properties,...K.targetRunIds?{targetRunIds:K.targetRunIds}:{}});(k<C||N===0&&V===x.length&&x.length>0)&&e.paragraphMarkVisible(R)&&_.push({op:"setParagraphMarkProperties",paragraphId:R,properties:za$2(O,R,T)});}_.length!==0&&n(()=>d(_,o()));},g=(y,I)=>{let T=l(),O=[];for(let P of ua$1(f.value,y)){let B=a(P);for(let C of Aa$1(T,P,0,B.length,I,i(),s()))O.push({op:"setRunProperties",paragraphId:P,start:C.start,end:C.end,properties:C.properties,...C.targetRunIds?{targetRunIds:C.targetRunIds}:{}});e.paragraphMarkVisible(P)&&O.push({op:"setParagraphMarkProperties",paragraphId:P,properties:za$2(T,P,I)});}return O.length===0?false:(n(()=>d(O,o()),void 0,{keepCellSelection:true}),true)},v=y=>{pa(y.localName)&&e.setPendingFormats(ua(e.pendingFormats()??[],y));},b=y=>{if(y.length===0)return;let I=e.selectedCells?.(),T=I&&I.length>0?[...ua$1(f.value,I)]:null,{from:O,to:P}=r(),B=T??e.paragraphOrder(),C=T?0:B.indexOf(O.paragraphId),_=T?B.length-1:B.indexOf(P.paragraphId);if(C===-1||_===-1)return;let k=l(),R=B.slice(C,_+1).filter(x=>e.paragraphMarkVisible(x)).map(x=>{let N=sa(k,x);for(let V of y){let M=V.mergeAttributes?{...N.find(K=>K.localName===V.localName)?.attributes??{},...V.attributes}:V.attributes??{},D=Object.fromEntries(Object.entries(M).filter(([,K])=>K!=null));N=ua(N,{localName:V.localName,...Object.keys(D).length>0?{attributes:D}:{}});}return {op:"setParagraphProperties",paragraphId:x,properties:N}});R.length!==0&&n(()=>d(R,o()),void 0,{keepCellSelection:T!==null});};return {setRunProperty(y,I){if(u())return;let T={localName:y,...I?{attributes:I}:{}},O=e.selectedCells?.();if(O&&O.length>0){g(O,T);return}let{from:P,to:B}=r();if(P.paragraphId===B.paragraphId&&P.offset===B.offset){v(T);return}m(P,B,T);},setParagraphProperty(y,I,T){b([{localName:y,...I?{attributes:I}:{},...T??{}}]);},setParagraphProperties:b,formatting:()=>Pv(Cv(f.value,p.value,(y,I)=>{let T=t.effectiveRunDefaults(y,I);if(T.fontFamily!==null)return T;let O=e.defaultFontFamily?.()??null;return O===null?T:{...T,fontFamily:O}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder(),e.defaultFontFamily?.()??null),e.pendingFormats()),toggleRunProperty(y,I){if(u())return;let T=e.selectedCells?.(),O=I?.val,P=Bo(e.pendingFormats(),y,O)??Ju(f.value,p.value,y,T,O,e.paragraphOrder()),B=P?{localName:y,attributes:{val:sM[y]??"0"}}:{localName:y,...I?{attributes:I}:{}};if(T&&T.length>0){g(T,B);return}let{from:C,to:_}=r();if(C.paragraphId===_.paragraphId&&C.offset===_.offset){let k=e.pendingFormats()??[],R=Ju(f.value,p.value,y,void 0,O,e.paragraphOrder());if(!P===R){let x=k.filter(N=>N.localName!==y);e.setPendingFormats(x.length>0?x:null);}else v(B);return}m(C,_,B);},clearFormatting(){if(u())return;e.setPendingFormats(null);let y=f.value,I=e.paragraphOrder(),T=e.selectedCells?.(),O=T&&T.length>0?[...ua$1(y,T)]:sl(I,r());if(O.length===0)return;let{from:P,to:B}=r(),C=T!==void 0&&T.length>0,_=l(),k=[];for(let R of O){let x=a(R),N=C||R!==P.paragraphId?0:P.offset,V=C||R!==B.paragraphId?x.length:B.offset;for(let M of Ba(_,R,N,V,i(),s()))Tv(_,R,M.start,M.end,i(),s())&&k.push({op:"setRunProperties",paragraphId:R,start:M.start,end:M.end,properties:[]});e.paragraphMarkVisible(R)&&ta(_,R).length>0&&k.push({op:"setParagraphMarkProperties",paragraphId:R,properties:[]}),e.paragraphMarkVisible(R)&&sa(_,R).length>0&&k.push({op:"setParagraphProperties",paragraphId:R,properties:[]});}k.length!==0&&n(()=>d(k,o()),void 0,{keepCellSelection:C});}}}var sM={u:"none",vertAlign:"baseline"};var lM=new Set,aS=500;function dM(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 iS(e){let t=e.session,n=()=>t.partFor(e.storyScope())??t.part(),r="off",o=null,a=null,i=null,s=zs,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,y,I)=>{if(I||b.paragraphId!==y.paragraphId||b.offset===y.offset)return true;let T=e.textOf(b.paragraphId);return b.offset===0&&y.offset===T.length&&T.length>0},u=()=>{let b=e.selectedCells?.(),y=b!==void 0&&b.length>0,{from:I,to:T}=e.orderedRange();if(!e.paragraphOrder().includes(I.paragraphId))return false;let O=ll(e.layout(),e.selection(),b,e.paragraphOrder()),P=d(I,T,y)?sa(n(),I.paragraphId):null;return !O&&P===null?false:(o={runProperties:O?dM(O):[],paragraphProperties:P},true)},f=()=>u()?(e.publish(),true):false,p=()=>{let b=o;if(!b)return {wrote:false,armed:false,built:false};let y=e.selectedCells?.(),I=y!==void 0&&y.length>0,{from:T,to:O}=e.orderedRange(),P=!I&&T.paragraphId===O.paragraphId&&T.offset===O.offset,B=P?kl(e.layout(),T,lM):null,C=B?.from??T,_=B?.to??O,k=P&&C.offset===_.offset,R=I?[...ua$1(e.layout(),y)]:sl(e.paragraphOrder(),{from:C,to:_});if(R.length===0)return {wrote:false,armed:false,built:false};let x=n(),N=e.displayMode(),V=[];for(let j of R){let Q=e.textOf(j),ae=I||j!==C.paragraphId?0:C.offset,Y=I||j!==_.paragraphId?Q.length:_.offset;if(ae<Y&&b.runProperties.length>0)for(let L of Aa$1(x,j,ae,Y,b.runProperties,N,e.authorFilter()))V.push({op:"setRunProperties",paragraphId:j,start:L.start,end:L.end,properties:L.properties,...L.targetRunIds?{targetRunIds:L.targetRunIds}:{}});let ne=b.paragraphProperties!==null||I||j!==_.paragraphId||ae===0&&Y===Q.length&&Q.length>0,oe=e.paragraphMarkVisible(j);ne&&oe&&b.runProperties.length>0&&V.push({op:"setParagraphMarkProperties",paragraphId:j,properties:za$2(x,j,b.runProperties)}),b.paragraphProperties&&oe&&V.push({op:"setParagraphProperties",paragraphId:j,properties:[...b.paragraphProperties]});}let M=t.packageRevision();V.length>0&&e.commit(()=>t.applyTreeOps(V,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:I});let D=t.packageRevision()!==M,K=k&&b.runProperties.length>0&&(D||V.length===0);return K&&e.armPendingFormats(b.runProperties),{wrote:D,armed:K,built:V.length>0}},m=()=>{let b=p();return b.wrote&&r==="once"&&v(),b.wrote?"painted":b.armed?"armed":b.built?"refused":"nothingToPaint"},g=()=>{r!=="off"&&(r="off",e.publish());},v=()=>{a=null,i=null,g();};return {state:l,capture:f,apply:m,disarm:v,press(){let b=e.now(),y=a!==null&&b-a<aS,I=r;a=b;let T=()=>(a=null,false);return I==="once"&&y?u()?(r="locked",e.publish(),true):(g(),T()):I!=="off"?(g(),i=I==="locked"?b:null,true):i!==null&&b-i<aS?(i=null,true):u()?(r="once",i=null,e.publish(),true):T()},applyIfArmed(){r==="off"||o===null||p().wrote&&r==="once"&&v();}}}var cM=500,sS=4,jo=40,Dl=12;function uM(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 lS(e,t){return uM(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 on(e,t,n){let r=ua$2(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function cS(e,t,n){if(!(t>Wc$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Wc$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)cS(a.blocks,t+1,n);}}}function $f(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,s)=>{(!n||on(e,i,n)<0)&&(n=i),(!r||on(e,s,r)>0)&&(r=s);},a=t.level!=="inline";for(let i of t.fragments){let s=e.pages[i.pageIndex];s&&cS(s.fragments,0,l=>{if(lS(i.box,l.box)){if(a){let d=ye(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)lS(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 fM(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function dS(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=hd(e,t.pageIndex,o);return a?.placeholder?a:null}let r=fM(e,n);return r?.placeholder?r:null}function Hl(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=on(e,t.anchor,t.head)<=0?t.anchor:t.head,o=on(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=$f(e,s);!l||!(on(e,r,o)===0?on(e,r,l.from)>=0&&on(e,r,l.to)<0:on(e,r,l.to)<0&&on(e,o,l.from)>0)||(on(e,l.from,r)<0&&(r=l.from,a=true),on(e,l.to,o)>0&&(o=l.to,a=true));}}return on(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}var pM=new Set(["dropdown","comboBox","date","buildingBlockGallery"]);function uS(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,f=0,p=null;function m(A,Z){if(!s){let W=n.getBoundingClientRect();s={left:W.left,top:W.top};}let $=e.scale()||1;return {x:(A-s.left)/$,y:(Z-s.top)/$}}function g(A){return {scope:{kind:"headerFooter",rId:A.rId},pageIndex:A.pageIndex,kind:A.kind,partName:A.partName,variant:A.variant}}function v(A,Z){let $=e.layout(),W=m(A,Z),E=cd($,W.y),q=$.pages[E];if(!q)return null;let z=e.measurer();return ed$2($,E,{x:W.x-q.contentBox.x-e.pageOffsetX(E),y:W.y-q.contentBox.y},z?{measurer:z}:{})}function b(A,Z){let $=e.activeNote?.()??null;if($){let J=e.layout(),ie=ru(J,m(A,Z),e.pageOffsetX);if(!ie||ie.scopeId!==$.scopeId)return null;let ee=e.measurer();return fd(J,ie.pageIndex,ie.fragments,ie.local,{...ee?{measurer:ee}:{}})}let W=e.activeHeaderFooter?.()??null;if(!W)return v(A,Z);let E=e.layout(),q=m(A,Z),z=au(E,q,e.pageOffsetX);if(z&&Qc(z.story,g(W))){let J=e.measurer();return eu(E,z.pageIndex,z.story,z.local,J?{measurer:J}:{})}return null}function y(A,Z){let{story:$,pageIndex:W,kind:E}=A;return {rId:$.rId,pageIndex:W,kind:E,partName:$.partName,variant:$.variant,...Z?{position:Z}:{}}}function I(A){let Z=e.measurer();return eu(e.layout(),A.pageIndex,A.story,A.local,Z?{measurer:Z}:{})?.position??void 0}let T=new WeakMap;function O(A,Z){let $=e.activeNote?.();if($){let z=No(A,null,$.scopeId).indexOf(Z);return z===-1?-1:z}let W=e.activeHeaderFooter?.();if(W){let z=No(A,g(W)).indexOf(Z);return z===-1?-1:z}let E=T.get(A);return E||(E=new Map(ua$2(A).map((q,z)=>[q,z])),T.set(A,E)),E.get(Z)??-1}function P(A,Z,$){let W=O(A,Z.paragraphId),E=O(A,$.paragraphId);return W!==E?W<E:Z.offset<$.offset}function B(A,Z,$){if($==="character")return {from:Z,to:Z};let W=Z.paragraphId;if($==="paragraph"){let E=ye(A,W);return {from:{paragraphId:W,offset:0},to:{paragraphId:W,offset:E.length}}}return kl(A,Z,ze(A,W))}function C(A,Z,$,W,E){let q=E?dS(A,E):null,z=q?$f(A,q)??B(A,$,W):B(A,$,W),J=P(A,z.from,Z.from)?{anchor:Z.to,head:z.from}:{anchor:Z.from,head:z.to};return Hl(A,J)}let _=r.closest(".docx-editor__scroll-container");function k(){return r.closest(".docx-editor__scroll-container")}function R(A,Z,$){if($<A+jo){let W=Math.max(0,A+jo-$);return -Math.min(Dl,W/jo*Dl)}if($>Z-jo){let W=Math.max(0,$-(Z-jo));return Math.min(Dl,W/jo*Dl)}return 0}function x(){p!==null&&(a?.cancelAnimationFrame(p),p=null);}function N(){p=null;let A=i,Z=k();if(!A||!Z||!a)return;let $=Z.getBoundingClientRect(),W=R($.top,$.bottom,A.clientY);W!==0&&(Z.scrollTop+=W,s=null,M(A.clientX,A.clientY),p=a.requestAnimationFrame(N));}function V(){if(p!==null||!a||!i)return;let A=k();if(!A)return;let Z=A.getBoundingClientRect();R(Z.top,Z.bottom,i.clientY)!==0&&(p=a.requestAnimationFrame(N));}function M(A,Z){let $=i;if(!$)return;let W=b(A,Z);W&&((e.isReadOnlyPosition?.(W.position)??e.isReadOnlyParagraph?.(W.position.paragraphId))||D($,W)||e.setSelection(C(e.layout(),$.anchorRange,W.position,$.granularity,W)));}function D(A,Z){let $=A.anchorCell;if(!$)return false;if(!Z.cell||Z.cell.tableId!==$.tableId)return A.cellDragging;if(!A.cellDragging&&Z.cell.cellId===$.cellId)return false;let W=sa$1(e.layout(),$,Z.cell);return W?(A.cellDragging=true,e.setCellSelection(W),true):A.cellDragging}function K(A){let Z=Date.now(),$=Z-d;return l=Math.abs(A.clientX-u)<=sS&&Math.abs(A.clientY-f)<=sS&&$>=0&&$<=cM?l+1:1,d=Z,u=A.clientX,f=A.clientY,l}let j=["character","word","paragraph"],Q=A=>{if(A.button!==0)return;if(e.onChangeBarToggle&&A.target?.closest?.("[data-docx-change-bar-toggle]")){A.preventDefault(),A.stopPropagation(),e.onChangeBarToggle();return}let Z=A.target?.closest?.("[data-docx-cc-widget]");if(Z){if(A.preventDefault(),A.stopPropagation(),Z.hasAttribute("disabled")||Z.dataset.disabledReason)return;let ke=Z.dataset.docxCcId,Be=Z.dataset.docxCcWidget;ke&&Be&&e.onContentControlWidget?.(ke,Be);return}if(A.pointerType==="touch")return;i&&oe(),s=null;let $=e.layout(),W=m(A.clientX,A.clientY),E=e.activeHeaderFooter?.()??null,q=e.activeNote?.()??null,z=au($,W,e.pageOffsetX),J=ru($,W,e.pageOffsetX),ie=A.target?.closest("[data-docx-hf]"),ee=!!(ie||z),de=A.target,ce=de?.closest("[data-docx-note-ref]"),ye=de?.closest("[data-docx-note-mark-back]"),Je=null,Oe=()=>Je??=K(A);if(ce?.dataset.docxNoteScope){A.preventDefault(),e.focus(),e.enterNote?.(ce.dataset.docxNoteScope);return}if(ye){A.preventDefault(),e.focus(),e.exitNote?.(true);return}if(J&&!ee){let ke=e.measurer?.(),Be=fd($,J.pageIndex,J.fragments,J.local,{...ke?{measurer:ke}:{}});if(!q||q.scopeId!==J.scopeId){A.preventDefault(),e.focus(),e.enterNote?.(J.scopeId,Be?{paragraphId:Be.position.paragraphId,offset:Be.position.offset}:void 0,J.pageIndex);return}if(q.pageIndex!==J.pageIndex){A.preventDefault(),e.focus(),e.enterNote?.(J.scopeId,Be?{paragraphId:Be.position.paragraphId,offset:Be.position.offset}:void 0,J.pageIndex);return}}else if(q){if(!Jc($,W,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(E)if(z&&Qc(z.story,g(E)))z.pageIndex!==E.pageIndex&&e.enterHeaderFooter?.(y(z,I(z)));else if(z&&z.story.rId){A.preventDefault(),e.focus(),e.enterHeaderFooter?.(y(z,I(z)));return}else if(Jc($,W,e.pageOffsetX)){A.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let ke=Oe()>=2?ou($,W,e.pageOffsetX):null;ke&&(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ke.kind,ke.pageIndex));return}else if(ee&&Oe()>=2){if(z?.story.rId)A.preventDefault(),e.focus(),e.enterHeaderFooter?.(y(z,I(z)));else if(ie instanceof HTMLElement){let ke=ie.dataset.docxRId,Be=ie.dataset.docxHf,tt=ie.closest("[data-page-index]")?.getAttribute("data-page-index"),He=tt!=null?Number(tt):NaN;if((Be==="header"||Be==="footer")&&Number.isInteger(He))if(ke){let Ft=$.pages[He]?.[Be];A.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:ke,pageIndex:He,kind:Be,partName:Ft?.partName??"",variant:Ft?.variant??"default"});}else $.pages[He]?.[Be]||(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Be,He));}return}else if(Oe()>=2){let ke=ou($,W,e.pageOffsetX);if(ke){A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ke.kind,ke.pageIndex);return}}let Re=b(A.clientX,A.clientY);if(!Re)return;if(e.isReadOnlyPosition?.(Re.position)??e.isReadOnlyParagraph?.(Re.position.paragraphId)){A.preventDefault();return}if(Oe()===2&&e.onTextFormDoubleClick?.(A))return;A.preventDefault(),e.focus();try{n.setPointerCapture(A.pointerId);}catch{}o.addEventListener("pointermove",Y),o.addEventListener("pointerup",ne),o.addEventListener("pointercancel",ne);let Ae=Oe(),Fe=A.shiftKey?"character":j[(Ae-1)%j.length],De=dS($,Re);if(De&&!A.shiftKey){let ke=()=>{Ae===1&&pM.has(De.controlType)&&e.onContentControlWidget?.(De.id,De.controlType);};if(e.selectContentControl?.(De.id)){let tt=e.selection(),He=P($,tt.anchor,tt.head)||tt.anchor.paragraphId===tt.head.paragraphId&&tt.anchor.offset===tt.head.offset?{from:tt.anchor,to:tt.head}:{from:tt.head,to:tt.anchor};i={pointerId:A.pointerId,granularity:"character",anchorRange:He,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ke();return}let Be=$f($,De);if(Be){i={pointerId:A.pointerId,granularity:"character",anchorRange:Be,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ae(()=>e.setSelection({anchor:Be.from,head:Be.to})),ke();return}}if(A.shiftKey){let ke=e.selection();i={pointerId:A.pointerId,granularity:Fe,anchorRange:{from:ke.anchor,to:ke.anchor},anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ae(()=>e.setSelection(C($,{from:ke.anchor,to:ke.anchor},Re.position,Fe,Re)));}else {let ke=B($,Re.position,Fe);i={pointerId:A.pointerId,granularity:Fe,anchorRange:ke,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ae(()=>e.setSelection(Hl($,{anchor:ke.from,head:ke.to})));}};function ae(A){try{A();}catch(Z){throw oe(),Z}}let Y=A=>{let Z=i;!Z||A.pointerId!==Z.pointerId||(A.preventDefault(),Z.clientX=A.clientX,Z.clientY=A.clientY,M(A.clientX,A.clientY),V());},ne=A=>{let Z=i;if(!Z||A.pointerId!==Z.pointerId)return;oe();try{n.releasePointerCapture(Z.pointerId);}catch{}let $=e.cellSelection();$?e.setCellSelection($):e.setSelection(e.selection()),A.type==="pointerup"&&(e.onTextFormPointerUp?.(A),e.onSelectionSettled?.());};function oe(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,s=null,x(),o.removeEventListener("pointermove",Y),o.removeEventListener("pointerup",ne),o.removeEventListener("pointercancel",ne);}let L=()=>{s=null;};return n.addEventListener("pointerdown",Q),_?.addEventListener("scroll",L,{passive:true}),a?.addEventListener("scroll",L,{capture:true,passive:true}),a?.addEventListener("resize",L,{passive:true}),{dragging:()=>i!==null,destroy(){oe(),n.removeEventListener("pointerdown",Q),_?.removeEventListener("scroll",L),a?.removeEventListener("scroll",L,{capture:true}),a?.removeEventListener("resize",L);}}}function fS(e,t,n){let r=e??xa$1;return {view:()=>r,projection:()=>wa(r),changeBars:()=>t?r==="all-markup"||r==="simple-markup"?r:"none":"all-markup",set:o=>{r=o;},filter:o=>t&&wa(r)!=="all-markup"?ya$1(o):o,toggleByChangeBar:()=>{t&&n(r==="simple-markup"?"all-markup":"simple-markup");}}}function pS(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i;function s(C){let _=no(C?.anchorNode,n)??no(C?.focusNode,n);_!==void 0&&(i=_);}function l(C){return i??no(C?.anchorNode,n)??no(C?.focusNode,n)}let d=false,u=false,f=false,p=null,m=false;function g(){let C=t.getSelection(),_=Ko(n,C);return !_||(s(C),Ot(_,e.selection()))?false:(e.adoptSelection(_),true)}function v(){let C=t.activeElement;if(C&&n.contains(C))return true;if(C&&C!==t.body&&C!==t.documentElement)return false;let _=t.getSelection();if(!_||_.rangeCount===0)return true;let k=_.anchorNode;return !k||!k.isConnected?true:n.contains(k)}let b=()=>{let C=t.getSelection(),_=Ko(n,C);if(!_){if(!vf(n,C))return;d=false;let k=Ze(e.selection().head);if(Ot(k,e.selection()))return;e.setSelection(k);return}d=false,s(C),!Ot(_,e.selection())&&e.setSelection(_);};function y(C){let _=e.textOf(C),k=pw(n,C,_,t.getSelection()?.anchorNode??null);if(k===null)return;let R=mw(C,_,k);if(!R)return;let x=R.ops.find(j=>j.op==="deleteText"),N=R.ops.find(j=>j.op==="insertText"),V=N&&x?e.replacementOffset?.(C,x.start,x.end):void 0,M=N&&V!==void 0&&V!==N.offset?R.ops.map(j=>j===N?{...N,offset:V}:j):R.ops,D=N?e.pendingFormatOps?.(C,V??N.offset,N.text.length,x?{start:x.start,end:x.end}:void 0)??[]:[],K=e.storyScope();e.commit(()=>{let j=e.applyOps([...M,...D],e.selectionMark(),K);return D.length===0||!j.rejected?j:e.applyOps(M,e.selectionMark(),K)}),e.setSelection(Ze({paragraphId:C,offset:N&&V!==void 0?V+N.text.length:R.caret}));}function I(){o||f||e.isGesturing?.()||e.holdsCellSelection?.()||T()||d&&b();}function T(){if(!u||d)return false;if(!a)return true;let C=Ko(n,t.getSelection());return C!==null&&Ot(C,a)}function O(C){C instanceof PointerEvent&&C.button!==0||(d=true);}let P=false;function B(C=false){if(e.updateCaret(),!C&&!v())return;o=true;let _=e.now(),k=e.domSelection?.()??e.selection();d=false;let R=t.getSelection(),x=l(R),N=ew(n,k,R,x!==void 0?{preferredPageIndex:x}:void 0);N&&s(R),a=N?k:null,N||(u=true),e.recordSelectionMs(e.now()-_),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",O,true),n.addEventListener("selectstart",O,true),{adoptBeforePaint(){let C=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,_=u||C||!d?false:g();return e.hasPendingInput?.()!==true&&(u=false),_},noteModelMoved(){u=true;},noteSelectionSettled(){u=false;},mirrorToDom:B,adoptBeforeInput:I,isComposing:()=>f,noteBrowserSelectionFixup(){P=true;},onSelectionChange:()=>{if(!o&&!f&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(P&&vf(n,t.getSelection())){let C=Ko(n,t.getSelection());if((C===null||!Ot(C,e.selection()))&&(P=false,!d)){B();return}}T()||b();}},onCompositionStart:()=>{I(),f=true;let C=e.selection();m=C.anchor.paragraphId!==C.head.paragraphId,p=C.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:C=>{f=false;let _=p??e.selection().head.paragraphId;p=null;let k=m;m=false;let R=e.storyScope(),x=r.revisionFor(R);if(k){let N=C?.data??"";N.length>0&&e.replaceSelectionWith?.(N);}else y(_);r.endComposition(),r.revisionFor(R)===x&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>i,destroy(){n.removeEventListener("pointerdown",O,true),n.removeEventListener("selectstart",O,true),d=false;}}}var mM=32;function qf(e,t,n,r){if(!(e.kind==="textValue"||r>mM)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)qf(o,t,n,r+1);}}var mS=new WeakMap;function gS(e,t,n,r){if(e.kind==="paragraph"||e.kind==="textValue"){qf(e,t,n,0);return}let o=mS.get(e);if(!o){let a=new Map;qf(e,0,a,0),o=[...a.keys()],mS.set(e,o);}for(let a of o)n.has(a)||n.set(a,t);}function yM(e,t){let n=jb$2(e),r=hb$1(n),o=0,a=ic(e),i=new Map;for(let s=0;s<a.length;s+=1){let l=a[s];for(let d=l.blockStart;d<l.blockEndExclusive;d+=1){let u=n[d];if(u){for(;o<r.length&&r[o]!==u;)gS(r[o],s,i),o+=1;o+=1,gS(u,s,i);}}}return i}var hS=new WeakMap;function bM(e){return !(!e.story||e.origin===b$2.mutationUndo||e.origin===b$2.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.includes(g$1.section))}function vM(e,t){t.story&&t.story.kind!=="body"||bM(t)||(e.map=null);}function xM(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>vM(t,n)));}function wM(e,t){let n=hS.get(e);return n||(n={map:null,subscribed:false},hS.set(e,n)),xM(e,n),n.map||(n.map=yM(t)),n.map}function yS(e,t,n){return n.startsWith(`${t.name}#`)?wM(e,t).get(n)??null:null}var bS=32;function Ci(e,t,n,r,o="all-markup",a){let i=e.part(),s=ic(i,o,a);if(s.length<=1)return 0;let l=jc$2(i,o,a),d=p=>{let m=l.indexOf(p);if(m!==-1)return m;let g=l.findIndex(v=>v>p);return g===-1?Math.max(0,l.length-1):g},u=Kf(e,t);if(u!==null)return d(u);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let p=e.headerFooterResolutionBySection().findIndex(m=>[m.headers,m.footers].some(g=>[...g.values()].some(v=>v.rId===n.rId)));return p===-1?0:d(p)}let f=IM(e,t);if(f!==null){let p=Kf(e,f);if(p!==null)return d(p)}return 0}function vS(e,t,n,r,o="all-markup",a){let i=e.part(),s=ic(i);if(s.length<=1)return {kind:"whole-document"};let l=jc$2(i,o,a),d=Kf(e,t),u=Ci(e,t,n,r,o,a),f=l[u]??u;if(d!==null&&d===f)return {kind:"anchor",paragraphId:t};let p=s[f];if(!p)return {kind:"unaddressable"};let m=jb$2(i);for(let g=p.blockStart;g<p.blockEndExclusive;g+=1){let v=SM(m[g]);if(v!==null)return {kind:"anchor",paragraphId:v}}return {kind:"unaddressable"}}function SM(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>bS)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 Kf(e,t){return yS(e,e.part(),t)}function IM(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=$f$1(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of yd(o.root)){let i=nd$1(a);if(i===null||!kM(a,t))continue;return ag(e.part()).find(l=>l.noteKind===r&&l.noteId===i)?.paragraphId??null}}return null}function kM(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>bS)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 zo(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 _l(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 xS(e){return {val:e?"1":"0"}}var Zf="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",$l="a section break cannot be inserted inside a table cell",wS="a section break cannot change a section that a locked or linked content control holds",jf="a section break cannot be inserted in locked or linked content";function TM(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)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)?.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 PM=32;function CM(e){let t=new Set(ei$1(e).map(n=>hi$1(n)));return di$1(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function zf(e,t){let n=t.replaceAt??t.collapseTo;return fi$1(e,n.paragraphId)?t.collapseTo:n}var Vf=(e,t)=>Re(e,t)||Oe(e,t).content;function Bl(e,t,n,r){if(fi$1(e,t))return $l;if(Vf(e,t))return jf;let{section:o,ownerId:a}=gi$1(e,t);return hi$1(o)===n?null:a!==null&&Vf(e,a)?wS:r?Zf:null}function SS(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return $l;if(e.caretParagraphId!==null)return Bl(e.part(),e.caretParagraphId,t,n);let r=TM(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=gi$1(i,o.paragraphId),l=gi$1(i,a.paragraphId),d=s.section===l.section,u=d?hi$1(s.section):CM(i),f=e.paragraphOrder(),p=f.indexOf(o.paragraphId),m=f.indexOf(a.paragraphId),g=p===-1||m===-1?null:f.slice(p,m+1),v=g!==null&&!g.some(y=>r.inCell.has(y))&&!g.some(y=>r.held.has(y));if(u!==null&&u!==t){if(v&&d&&s.ownerId!==null&&Vf(i,s.ownerId))return wS;if(n&&v)return Zf}if(v&&u!==null)return null;if(g===null||g.length-1>PM)return n&&u!==null&&u!==t?Zf:null;let b=zf(i,e.deleteSelectionPlan());return Bl(i,b.paragraphId,t,n)}var RM=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function EM(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 ql(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 IS(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 kS(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,R,x)=>t.applyTreeOps(k,R,x,e.storyScope()),u=Ov({session:t,storyPart:l}),f=()=>e.paragraphOrder(),p={get value(){return e.layout()}};function m(){let k=e.selectedCells?.();return k&&k.length>0?k:null}function g(k){let R=false;return n(()=>{let x=k();return R=x.committed,x},void 0,{keepCellSelection:m()!==null}),R}function v(){if(m()!==null)return [...ua$1(p.value,m())];let{from:k,to:R}=o(),x=f(),N=x.indexOf(k.paragraphId),V=x.indexOf(R.paragraphId);return N===-1||V===-1?null:x.slice(N,V+1)}let b=720,y=8;function I(k){return T(k)?.level??null}function T(k){return ta$1(p.value,k)?.marker??null}function O(k){let R=T(k);return R?R.numFmt==="bullet"?"bullet":"ordered":null}function P(k,R){let x=f(),N=x.indexOf(k[0]??""),V=x.indexOf(k[k.length-1]??"");if(N===-1||V===-1)return null;for(let M of [N-1,V+1]){let D=x[M];if(!D)continue;let K=T(D);if(K&&(K.numFmt==="bullet"?"bullet":"ordered")===R)return K.numId}return null}function B(k,R){return R<0||R>y?false:e.numberingLevelExists(k.numId,R)}function C(k,R){return R<0||R>y?false:e.numberingLevelExists(k.numId,R)?true:t.ensureNumberingLevel(k.numId,R,k.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(k.numId,R)}function _(k){let R;for(let x of k){if(x.localName!=="ind")continue;let N=x.attributes?.left??x.attributes?.start;N!==void 0&&(R=N);}return !R||!/^-?\d{1,7}$/.test(R)?0:Number(R)}return {insertTab(){let k=s(),R=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertTab",paragraphId:R.paragraphId,offset:R.offset}],a()),()=>i({...R,offset:R.offset+1}));},insertLineBreak(){let k=s(),R=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertHardBreak",paragraphId:R.paragraphId,offset:R.offset}],a()),()=>i({...R,offset:R.offset+1}));},insertPageBreak(){let k=s(),R=k.replaceAt??k.collapseTo;n(()=>d([...k.ops,{op:"insertPageBreak",paragraphId:R.paragraphId,offset:R.offset}],a()),()=>i({...R,offset:R.offset+1}));},exitListOnEmptyItem(){let{from:k,to:R}=o();if(k.paragraphId!==R.paragraphId||k.offset!==R.offset)return false;let x=T(k.paragraphId);if(!x||e.paragraphTextOf(k.paragraphId).length>0)return false;let V=x.level>0&&B(x,x.level-1),M=[];if(V)M.push({op:"setListLevel",paragraphId:k.paragraphId,level:x.level-1});else {let K=u.clearOp(k.paragraphId);K&&M.push(K),M.push({op:"setListNumbering",paragraphId:k.paragraphId,numId:null});}let D=false;return n(()=>{let K=d(M,a());return D=K.committed,K}),D},isListParagraph(){let{paragraphId:k}=r();return I(k)!==null},isListActive(k){let R=v();if(R===null)return false;let x=k==="bullet"?"bullet":"ordered";return R.length>0&&R.every(N=>O(N)===x)},toggleList(k){let R=v();if(R===null||R.length===0)return false;let x=R.every(M=>O(M)===k),N=x?null:P(R,k)??t.ensureListDefinition(k);if(!x&&N===null)return false;let V=x?[]:u.applyOps(R);for(let M of R){let D=I(M);V.push({op:"setListNumbering",paragraphId:M,numId:N,...D!==null?{level:D}:{}});}return g(()=>d(V,a()))},canAdjustIndent(k){let R=v();if(R===null)return false;let x=k==="increase"?1:-1;return R.some(N=>{let V=T(N);if(V){let D=V.level+x;return D>=0&&D<=y}let M=_($o(p.value,N));return Math.max(0,M+x*b)!==M})},adjustIndent(k){let R=v();if(R===null)return false;let x=k==="increase"?1:-1,N=[];for(let V of R){let M=$o(p.value,V),D=T(V),K=D?.level??null;if(D&&K!==null){let ne=K+x;if(ne<0||ne>y||!C(D,ne))continue;N.push({op:"setListLevel",paragraphId:V,level:ne});continue}let j=_(M),Q=Math.max(0,j+x*b);if(Q===j)continue;let ae=sa(l(),V),Y=ae.find(ne=>ne.localName==="ind");N.push({op:"setParagraphProperties",paragraphId:V,properties:ua(ae,{localName:"ind",attributes:EM(Y?.attributes,String(Q))})});}return N.length===0?false:g(()=>d(N,a()))},setIndent(k){if(k.left===void 0&&k.right===void 0&&k.firstLine===void 0)return false;let R=v();if(R===null)return false;let x=[];for(let N of R){let V=sa(l(),N),D={...V.find(K=>K.localName==="ind")?.attributes??{}};k.left!==void 0&&(D=ql(D,"left","start",k.left)),k.right!==void 0&&(D=ql(D,"right","end",k.right)),k.firstLine!==void 0&&(D=IS(D,k.firstLine)),x.push({op:"setParagraphProperties",paragraphId:N,properties:ua(V,{localName:"ind",...Object.keys(D).length>0?{attributes:D}:{}})});}return x.length===0?false:g(()=>d(x,a()))},setParagraphFormat(k){let R=v();if(R===null||R.length===0)return false;let x=[];k.alignment!==void 0&&x.push({localName:"jc",attributes:{val:k.alignment}});let N={...zo("before",k.spaceBeforePt),...zo("after",k.spaceAfterPt),..._l(k.lineSpacing)};Object.keys(N).length>0&&x.push({localName:"spacing",attributes:N,mergeAttributes:true});for(let[K,j]of RM){let Q=k[K];Q!==void 0&&x.push({localName:j,attributes:xS(Q)});}let V=k.tabStops!==void 0,M=k.indentLeftTwips!==void 0||k.indentRightTwips!==void 0||k.indentFirstLineTwips!==void 0;if(x.length===0&&!M&&!V)return false;let D=[];for(let K of R){let j=sa(l(),K),Q=j;if(M){let Y={...j.find(ne=>ne.localName==="ind")?.attributes??{}};k.indentLeftTwips!==void 0&&(Y=ql(Y,"left","start",k.indentLeftTwips)),k.indentRightTwips!==void 0&&(Y=ql(Y,"right","end",k.indentRightTwips)),k.indentFirstLineTwips!==void 0&&(Y=IS(Y,k.indentFirstLineTwips)),Q=ua(Q,{localName:"ind",...Object.keys(Y).length>0?{attributes:Y}:{}});}for(let ae of x){let Y=ae.mergeAttributes?{...Q.find(oe=>oe.localName===ae.localName)?.attributes??{},...ae.attributes}:ae.attributes??{},ne=Object.fromEntries(Object.entries(Y).filter(([,oe])=>oe!=null));Q=ua(Q,{localName:ae.localName,...Object.keys(ne).length>0?{attributes:ne}:{}});}if((x.length>0||M)&&D.push({op:"setParagraphProperties",paragraphId:K,properties:Q}),V){let ae=hi(e.layout(),K);D.push({op:"setParagraphTabStops",paragraphId:K,stops:k.tabStops.map(Y=>({positionTwips:Math.round(Y.positionTwips),alignment:Y.alignment,...Y.leader&&Y.leader!=="none"?{leader:Y.leader}:{}})),...ae?{inForcePositionsTwips:ae.stops.map(Y=>Math.round(Y.positionPt*20))}:{}});}}return D.length===0?false:g(()=>d(D,a()))},sectionProperties:()=>hc(t.part()),sectionPropertiesAt(k){let R=ic(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),x=Ci(t,k,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (R[x]??R[R.length-1]).properties},sectionAnchorParagraphAt(k){return vS(t,k,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(k){let R=false;return n(()=>{let x=e.storyScope().kind==="body",N=t.applyTreeOps([{op:"setSectionProperties",...k}],x?a():void 0,void 0,{kind:"body"});return R=N.committed,N}),R},sectionBreakRefusal(k="nextPage"){return e.storyScope().kind!=="body"?null:SS({part:()=>t.part(),breakType:k,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:f,deleteSelectionPlan:s})},insertSectionBreak(k="nextPage"){if(e.storyScope().kind!=="body")return false;let R=s(),x=zf(t.part(),R),N=(fi$1(t.part(),x.paragraphId)?$l:null)??Bl(t.part(),x.paragraphId,k,e.editingMode?.()==="suggest");if(N!==null)return e.publishRefusal?.(N),false;let V=new Set(t.paragraphIds()),M=false,D=false;return n(()=>{let K=t.applyTreeOps([...R.ops,{op:"splitParagraph",paragraphId:x.paragraphId,offset:x.offset},{op:"setSectionMark",paragraphId:x.paragraphId,breakType:k}],a(),void 0,{kind:"body"});return M=K.committed,D=K.reason==="locked"||K.reason==="bound",K},()=>{let K=t.paragraphIds().find(j=>!V.has(j));return K?i({paragraphId:K,offset:0}):null}),!M&&D&&e.publishRefusal?.(jf),M}}}var ES="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function OS(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===ES}function OM(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===ES}function Wf(e){return e.kind==="textValue"?[]:e.children}function MS(e,t=0){if(e.kind==="textValue")return e.value;if(t>=la$2||e.kind==="deletedText"||MM(e.kind)||ie$1(e)||e.kind==="runProperties"||e.kind==="generic"&&!na(e)&&!OS(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return ae(e);let n=ma$1(e,t),r="";for(let o of e.children)r+=MS(o,n);return r}function MM(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function Uf(e,t,n){if(!(t>=la$2))for(let r of e){if(r.kind==="hyperlink"){ma$1(r,t)<la$2&&n(r,t);continue}if(na(r)){Uf(Wf(r),ma$1(r,t),n);continue}if(OS(r)){for(let o of Wf(r))OM(o)&&Uf(Wf(o),ma$1(r,t),n);continue}n(r,t);}}function TS(e,t,n){let r=FM(e,t);if(!r||r.kind!=="paragraph")return [];let o=Ze$1(r),a=[],i=0;return Uf(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,f=d?d.end:i,p=fb$1(s,n);a.push({id:s.id,paragraphId:t,start:u,end:f,text:MS(s,l),kind:p.kind,href:p.href,authored:p.authored,...p.anchor!==void 0?{anchor:p.anchor}:{},...p.tooltip!==void 0?{tooltip:p.tooltip}:{}});}),a}function FM(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 AM(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 LM(e,t){for(let n of ja$1(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 FS(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,u,f)=>e.session.applyTreeOps(d,u,f,t()),a=d=>{let u=n();return u?TS(u,d,r):[]},i=()=>AM(a(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,u=LM(e.layout(),d);return u===null?null:e.fieldLinkById(u)},l=d=>{let u=e.selection().head.paragraphId,f=a(u).find(p=>p.id===d);if(f)return f;for(let p of e.session.storyParts()){let m=g=>Ff$1(e.session.currentPackage(),p.name,g);for(let g of Dd(p))for(let v of Gd$1(g.root)){let b=v.id,y=TS(p,b,m).find(I=>I.id===d);if(y)return y}}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,f=d.anchor!==void 0&&d.anchor.length>0;if(u===f)return false;let p=t();if(!n()||e.refusesWrite())return false;let m;if(u){let k=()=>e.session.ensureHyperlinkRelationship(d.url,p),R=e.withMintActor?e.withMintActor(k):k();if(!R)return false;m=R;}let g={...m!==void 0?{relationshipId:m}:{},...f?{anchor:d.anchor}:{},...d.tooltip!==void 0?{tooltip:d.tooltip}:{}},v=i(),b=e.orderedRange(),y=b.from.paragraphId===b.to.paragraphId&&b.from.offset===b.to.offset;if(v&&(y||NM(v,b))){let k=[];if(d.text!==void 0&&d.text!==v.text){if(d.text.length===0)return false;let x=e.replacementLanding?.(v.paragraphId,v.start,v.end),N=e.textOf(v.paragraphId).slice(v.start,v.start+2),V=v.start+(N.length===2&&N.charCodeAt(0)>=55296&&N.charCodeAt(0)<=56319&&N.charCodeAt(1)>=56320&&N.charCodeAt(1)<=57343?2:1);if(x!=null&&x>v.start&&V<v.end)k.push({op:"setHyperlinkTarget",linkId:v.id,...g},{op:"deleteText",paragraphId:v.paragraphId,start:v.start,end:v.end},{op:"insertText",paragraphId:v.paragraphId,offset:V,text:d.text});else if(x!=null){let M=PS(e.session);k.push({op:"setHyperlinkTarget",linkId:v.id,...g},...CS(v,x,d.text),{op:"insertHyperlink",paragraphId:v.paragraphId,start:x,end:x+d.text.length,...g,...M?{styleId:M}:{}});}else {let M=RS(v.paragraphId,v.start,v.end,d.text);if(!M)return false;k.push({op:"setHyperlinkTarget",linkId:v.id,...g},...M);}}else k.push({op:"setHyperlinkTarget",linkId:v.id,...g});let R=false;return e.commit(()=>{let x=o(k,e.selectionMark());return R=x.committed,x},()=>null),R}let I=b.from.paragraphId;if(b.to.paragraphId!==I)return false;let T=[],O=b.from.offset,P=b.to.offset;if(y){let k=d.text??d.url??d.anchor??"";if(k.length===0)return false;O=e.insertionLanding?.(I,O)??O,T.push({op:"insertText",paragraphId:I,offset:O,text:k}),P=O+k.length;}else {let k=e.replacementLanding?.(I,O,P);if(k!=null){let R=d.text??e.textOf(I).slice(O,P);if(R.length===0)return false;T.push(...CS({paragraphId:I,start:O,end:P},k,R)),O=k,P=k+R.length;}else if(d.text!==void 0&&d.text!==e.textOf(I).slice(O,P)){let R=RS(I,O,P,d.text);if(!R)return false;T.push(...R),P=O+d.text.length;}}if(P<=O)return false;let B=PS(e.session);T.push({op:"insertHyperlink",paragraphId:I,start:O,end:P,...g,...B?{styleId:B}:{}});let C=false,_={paragraphId:I,offset:P};return e.commit(()=>{let k=o(T,e.selectionMark(),{paragraphId:I,start:P,end:P});return C=k.committed,k},()=>({anchor:_,head:_})),C},removeHyperlink(d){if(!n())return false;let u=d?l(d):i();if(!u)return false;let f=false,p={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let m=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return f=m.committed,m},()=>({anchor:p,head:p})),f}}}function PS(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function NM(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function CS(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 RS(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 DM="equation replacement and removal are not supported in suggesting mode",AS=new WeakMap;function LS(e,t){let n=Ha(e,t);if(!n||n.kind!=="paragraph")return [];let r=AS.get(n);if(r)return r;let o=[];for(let i of Xe(n)){let s=i.node;if(s.kind==="textValue"||s.kind!=="generic"||s.namespaceUri!==wc||s.localName!=="oMath")continue;let l=yc(s);l&&o.push(Object.freeze({id:s.id,paragraphId:t,start:i.start,end:i.end,linear:Ac$1(l.expression),fallbackText:l.fallbackText,supported:an(l.expression)}));}let a=Object.freeze(o);return AS.set(n,a),a}function an(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(an);case "fraction":return an(e.numerator)&&an(e.denominator);case "radical":return an(e.radicand)&&(e.degree===void 0||an(e.degree));case "script":return an(e.base)&&(e.subscript===void 0||an(e.subscript))&&(e.superscript===void 0||an(e.superscript));case "nary":return an(e.body)&&(e.lowerLimit===void 0||an(e.lowerLimit))&&(e.upperLimit===void 0||an(e.upperLimit))}}function NS(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function DS(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 HS(e){let t=()=>e.session.partFor(e.storyScope()),n=l=>{let d=t();return d?LS(d,l):[]},r=()=>{let l=e.selection().head;return NS(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 f=Ha(u,l);if(!f||f.kind!=="generic"||f.namespaceUri!==wc||f.localName!=="oMath")continue;let p=f;for(;p&&p.kind!=="paragraph";)p=Ia$1(u,p.id);return !p||p.kind!=="paragraph"?null:LS(u,p.id).find(m=>m.id===l)??null}return null},a=(l,d)=>{let u=false,f={paragraphId:l.paragraphId,offset:l.start};return e.commit(()=>{let p=e.session.applyTreeOps([d],e.selectionMark(),{paragraphId:f.paragraphId,start:f.offset,end:f.offset},e.storyScope());return u=p.committed,p},()=>({anchor:f,head:f})),u},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:DM};let f=d==="replace"?{op:"setMathEquation",equationId:l,linear:u.linear}:{op:"removeMathEquation",equationId:l},p=e.writeRefusal(f);return p===null?{ok:true}:{ok:false,code:"locked",reason:p}},s=l=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:l.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:i,applyEquation(l,d){let u=o(l);if(!u)return false;let f=i(l,"replace");return f.ok?u.supported&&u.linear===d?true:a(u,{op:"setMathEquation",equationId:l,linear:d}):s(f)},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 HM=24;function _S(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=p=>{if(!p||p.length===0||p.startsWith("#"))return false;let m=L(p);return !m.ok||!m.href||!n?false:(n.open(m.href,"_blank","noopener,noreferrer"),true)},a=p=>{if(e.enterStoryFor&&!e.enterStoryFor(p.paragraphId))return false;let m=e.layout(),g=ue(m,p);if(!g)return false;let v=m.pages[g.pageIndex];if(!v)return false;let b=v.box.y+(v.contentBox.y-v.box.y)+g.y,y=r();return y&&(y.scrollTop=Math.max(0,b*e.scale()-HM),e.onScrolled?.()),e.setSelection(p),true},i=p=>{let m=e.bookmarks().get(p);return m?a(m):false},s=null;function l(p){if(!p||p.closest("[data-docx-hf]"))return null;let m=p.closest("a.docx-hyperlink");if(m){let v=m.dataset.docxLink;return v?{linkId:v,drawing:false}:null}let g=p.closest("[data-docx-drawing-link]");if(g){let v=g.dataset.docxDrawingLink;return v?{linkId:v,drawing:true}:null}return null}let d=p=>{s=null;let m=p.target,g=l(m);if(!g)return;let b=m.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();s={linkId:g.linkId,drawing:g.drawing,rect:{left:b.left,top:b.top,bottom:b.bottom,right:b.right}};},u=p=>{let m=p.target,g=l(m);if(!g){let y=s;if(s=null,!y)return;p.preventDefault(),f(y.linkId,y.rect,p,y.drawing);return}s=null,p.preventDefault();let b=m.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();f(g.linkId,{left:b.left,top:b.top,bottom:b.bottom,right:b.right},p,g.drawing);};function f(p,m,g,v){let b=v?e.drawingLinkById?.(p)??null:e.linkById(p);if(!b)return;if(g.metaKey||g.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:m});}}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 _M(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 Gf(e,t){return e.drawingNodeId!==t?null:_M(e)}function BS(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=Gf(n,t);if(r)return r}return null}function BM(e,t){for(let r of e.anchoredDrawings??[]){let o=Gf(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=qS(s,t);if(l)return l}continue}let o=$S(r,t);if(o)return o}let n=BS(e.header,t);return n||BS(e.footer,t)}function $S(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=Gf(r,t);if(o)return o}return null}function qS(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=qS(o,t);if(a)return a}return null}return $S(e,t)}function KS(e,t){for(let n of e.pages){let r=BM(n,t);if(r)return r}return null}var Kl=24;function ZS(e){let t=null,n=false;return {without(r){let o=n;n=true;try{return r()}finally{n=o;}},follow(r,o){let a=n?"none":o;if(e.storyScopeOpen())return;let i=e.selection();if(!(i.anchor.paragraphId===i.head.paragraphId&&i.anchor.offset===i.head.offset)&&a!=="head")return;let l=e.pagesLayer.ownerDocument.activeElement;if(l!==e.pagesLayer&&(!l||!e.pagesLayer.contains(l)))return;let d=e.preferredPageIndex(),u=e.layout(),f=ue(u,i.head,{measurer:e.measurer(),...d!==void 0?{preferredPageIndex:d}:{}});if(!f)return;let p=t!==null&&t!==f.pageIndex;if(t=f.pageIndex,a==="none"||!r&&!p)return;let m=u.pages[f.pageIndex],g=e.scroller();if(!m||!g||g.clientHeight<=0)return;let v=e.scale(),b=m.contentBox.y-m.box.y,y=(m.box.y+b+f.y)*v+e.container.offsetTop,I=y+f.height*v,T=g.scrollTop,O=T+g.clientHeight,P=T;if(y<T+Kl)P=y-Kl;else if(I>O-Kl)P=I+Kl-g.clientHeight;else return;let B=Math.max(0,g.scrollHeight-g.clientHeight),C=Math.max(0,Math.min(P,B));Math.abs(C-g.scrollTop)<.5||(g.scrollTop=C,e.scheduleRematerialize());}}}function VS(e,t){let n=[],r=i=>{for(let s of i){if(s.kind==="paragraph"){n.push({id:s.id,length:Ze$1(s).length});continue}if(s.kind==="textValue")continue;if(s.kind==="contentControl"){r(t.contentChildrenOf(s));continue}r(s.children);}};if(r(t.contentChildrenOf(e)),n.length>0){let i=n[0],s=n[n.length-1];return {anchor:{paragraphId:i.id,offset:0},head:{paragraphId:s.id,offset:s.length}}}let o=null,a=i=>{for(let s of i){if(s.kind==="paragraph"){let l=Ze$1(s).spanOf(e);if(!l)continue;return o={anchor:{paragraphId:s.id,offset:l.start},head:{paragraphId:s.id,offset:l.end}},true}if(s.kind!=="textValue"&&a(s.children))return true}return false};return a(t.searchRoots()),o}function jS(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 Ri="the document is open for viewing",Xf="image changes are not supported in suggesting mode",zS="tracked changes need a non-empty author";function WS(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Ri}}function n(){return {committed:false,rejected:true,opCount:0,reason:Xf}}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:Ri};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Xf};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:Ri};let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return {ok:false,reason:"invalidArgs",detail:zS};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:Ri});let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:zS});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:Ri});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Xf});let s=e.actorId();return e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),{...i,commitGuard:()=>e.editingMode()==="edit"&&i.commitGuard?.()!==false,...s?{actorId:s}:{}})}}}function US(e){let t=null,n=null,r="",o=()=>{let d=e.session.part(),u=e.revisionDisplayMode(),f=e.revisionAuthorFilter();return {sections:ic(d,u,f),sourceIndexes:jc$2(d,u,f)}},a=d=>{let{sourceIndexes:u}=o(),f=u.indexOf(d);if(f!==-1)return f;let p=u.findIndex(m=>m>d);return p===-1?Math.max(0,u.length-1):p},i=()=>{if(!t)return;let d=Hb(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(),f=Lb(u,d.rId),p=t,m=p?.scope.rId===d.rId,g=f?null:$M(e.session,d.rId);if(!f&&!g)return false;let v=d.pageIndex??(m&&p?p.pageIndex:f?.pageIndex??0),b=d.kind??(m&&p?p.kind:f?.kind??g.kind),y=d.variant??(m&&p?p.variant:f?.story.variant??g.variant),I=m&&p?p.partName:f?.story.partName??g.partName,T=u.pages[v]??u.pages[f?.pageIndex??0],O=(T?Lo(T,{scope:{kind:"headerFooter",rId:d.rId},kind:b,partName:I}):null)??f?.story??{scope:{rId:d.rId},variant:y,partName:I},P=e.selection(),B=p?p.savedBodySelection:{anchor:{...P.anchor},head:{...P.head}},C=m&&p?.sectionIndex!==void 0&&v===p.pageIndex,_=d.sectionIndex??(C?p.sectionIndex:f?e.sectionAtPage(v).sectionIndex:g?a(g.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:d.rId},pageIndex:v,..._!==void 0?{sectionIndex:_}:{},kind:b,variant:O.variant,partName:O.partName,savedBodySelection:B};let R=e.session.paragraphIdsIn(Ks(t))[0];if(!R)return t=null,false;let x=d.position?Zs(u,{anchor:d.position,head:d.position},t):m?Zs(u,P,t):{anchor:{paragraphId:R,offset:0},head:{paragraphId:R,offset:0}};return e.setScopeSelection(x),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;let d=t.savedBodySelection;t=null,e.setScopeSelection(Zs(e.layout(),d,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>Ab(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,f=o(),p,m,g,v=T=>{let O=f.sourceIndexes[T]??T,P=d[O];if(!P)return false;let C=(t.kind==="header"?P.headers:P.footers).get(t.variant);return !C||C.rId!==t.scope.rId?false:(u=T,p=C.inherited,m=P.titlePage,g=P.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&v(t.sectionIndex))){let T;d.forEach((O,P)=>{let C=(t.kind==="header"?O.headers:O.footers).get(t.variant);!C||C.rId!==t.scope.rId||!(T===void 0||T&&!C.inherited||T===C.inherited&&a(P)<u)||(u=a(P),p=C.inherited,m=O.titlePage,g=O.evenAndOddHeaders,T=C.inherited);});}let b=f.sections[u]?.properties??f.sections.at(-1)?.properties,y=b?.margins.headerTwips,I=b?.margins.footerTwips;return {editing:t.kind,sectionIndex:u,variant:t.variant,rId:t.scope.rId,partName:t.partName,...p!==void 0?{inherited:p}:{},...m!==void 0?{titlePage:m}:{},...g!==void 0?{evenAndOddHeaders:g}:{},...y!==void 0?{headerDistanceTwips:y}:{},...I!==void 0?{footerDistanceTwips:I}:{}}},headerFooterStateStable(d){if(!t)return n=null,r="",null;let u=this.headerFooterState();if(!u)return null;let f=[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===f||(n=Object.freeze({...u}),r=f),n}}}function GS(e){return e.length>0&&e.every(t=>t.op==="setDocumentProtection")}function $M(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 YS(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=ed$1(i);if(!d)return e.setLastRejection("invalid note scope id"),false;let u=e.session.currentPackage(),f=$f$1(u,d.noteKind),p=f?Ad$1(f.root,d.noteId):null;if(!f||!p)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let m=e.selection();r={anchor:{paragraphId:m.anchor.paragraphId,offset:m.anchor.offset},head:{paragraphId:m.head.paragraphId,offset:m.head.offset}};}if(t={kind:"note",id:dd(d.noteKind,d.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let m=qM(p),g=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:d.noteKind})),v=m.find(b=>g.has(b.id));if(v){let b=KM(v);e.setSelection({anchor:{paragraphId:v.id,offset:b},head:{paragraphId:v.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=XS(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset},()=>{let g={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:g,head:g}}))return s.ops.length>0&&e.undo(),false;let m=[...XS(e.session.currentPackage(),i)].find(g=>!u.has(g));return m===void 0?true:a(dd(i,m))},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 qM(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 KM(e){let t=Xe(e)[0];return t&&jd(t.node)?t.end:0}function XS(e,t){let n=$f$1(e,t),r=new Set;if(!n)return r;for(let o of yd(n.root)){if(!pd$1(o))continue;let a=nd$1(o);a!==null&&r.add(a);}return r}var ZM=500;function VM(e,t,n,r){let o=e.part(),a=jb$2(o,n,r),i=fc(o);return t.map((s,l)=>{let d=s.blockStart<s.blockEndExclusive?a[s.blockEndExclusive-1]:void 0,u=d?.kind==="paragraph"?gc(d):void 0;return u||(l===t.length-1&&i?.kind!=="textValue"?i:void 0)})}function QS(e,t){if(!e)return null;let n=e.session,r=wa(e.revisionDisplayMode()),o=e.state().selection.head.paragraphId,a=Ci(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=Qf$1(i),l=Rf$1(s),d=Sf$1(s),u=ic(n.part(),r,t),f=VM(n,u,r,t),p=Of$1(f[a]),m=Pf$1(f[a]),g=Tf$1(p,l),v=Uf$1(m,d);return {sectionIndex:a,footnote:{resolved:g,...l?{documentAuthored:l}:{},...p?{sectionAuthored:p}:{}},endnote:{resolved:v,...d?{documentAuthored:d}:{},...m?{sectionAuthored:m}:{}}}}function JS(e,t){let n=ed$1(t);if(!n)return null;let r=$f$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=Ad$1(o.root,n.noteId);if(!a)return null;let i=[],s=ZM,l=(u,f)=>{if(!(f>32||s<=0)){if(u.kind==="paragraph"&&typeof u.id=="string"){let p=(Ui(o,u.id)??"").replace(/\uFFFC/g,"").trim();if(p){let m=p.slice(0,s);i.push(m),s-=m.length;}return}if(u.kind!=="textValue")for(let p of u.children)l(p,f+1);}};l(a,0);let d=i.filter(Boolean).join(" ").trim();return d.length>0?d:null}function eI(e){return [()=>{Nb$1(e().root);},()=>{ki$1(e());},()=>{Yh(e());}]}var jM=50,zM=16;function tI(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>jM)return;i(zM);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 sr=null;function Ei(e,t,n){let r=sr;sr=t===void 0?null:{owner:e,group:t};try{return n()}finally{sr=r;}}function WM(e){if(sr===null||sr.owner!==e)return;let{group:t}=sr;return sr=null,t}function UM(e,t){sr===null&&(sr={owner:e,group:t});}var Zl=class{current;get value(){return this.current}around(t,n,r){let o=this.current,a=WM(t);this.current=a;let i;try{i=n();}finally{this.current=o;}return a!==void 0&&!r(i)&&UM(t,a),i}};function Yf(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$1=n$1.scale??96/72,d={resolve:n$1.tableInteractionLabel??(c=>ju(c))},u="the document is open for viewing",f$1="the table of contents is generated and read-only",p="\0range\0",m=()=>`${new Date().toISOString().slice(0,19)}Z`,g$1=n$1.measurer?null:ea(l$1,{context:qo(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),v=n$1.measurer??g$1.measurer,b=Ka(),y=de();function I(){return n$1.measurer?n$1.producer??"host-measurer":`${n$1.producer??g$1?.producer??"fixed-measurer"}@scale:${l$1}`}let T=I(),O=e$1.ownerDocument,P=O.createElement("div");P.className="docx-pages",P.style.position="relative",P.contentEditable="true",P.spellcheck=false,P.setAttribute("role","textbox"),P.setAttribute("aria-multiline","true"),Gu(P,n$1.translate),P.style.outline="none";let B=O.createElement("div");B.className="docx-selection-overlay",B.contentEditable="false",B.setAttribute("aria-hidden","true"),B.style.position="absolute",B.style.left="0",B.style.top="0",B.style.pointerEvents="none";let C=O.createElement("div");C.className="docx-comment-overlay",C.contentEditable="false",C.setAttribute("aria-hidden","true"),C.style.position="absolute",C.style.left="0",C.style.top="0",C.style.pointerEvents="none";let _=O.createElement("div");_.className="docx-remote-selection-overlay",_.contentEditable="false",_.setAttribute("aria-hidden","true"),_.style.position="absolute",_.style.left="0",_.style.top="0",_.style.pointerEvents="none";let k=O.createElement("div");k.className="docx-table-furniture",k.contentEditable="false",k.style.position="absolute",k.style.left="0",k.style.top="0",k.style.pointerEvents="none",e$1.style.position="relative",e$1.replaceChildren(P,k,C,_,B);let R=Qw(P,()=>l$1,()=>{let c=ce?.getActive()??null,h=ye?.activeNoteScope()??null,w=ye?.activeNotePageIndex()??null,F=c?Nb(P,c.pageIndex):h?Db(P,h.id,w):null;return {layout:se,selection:st.shownSelection(M),measurer:v,...J()?{typingStyle:()=>{let H=_i$1.formatting();return H.fontSizeHalfPoints?{fontSizePt:H.fontSizeHalfPoints/2,fontFamily:H.fontFamily,bold:H.bold,italic:H.italic,verticalAlign:H.superscript?"superscript":H.subscript?"subscript":"baseline"}:null}}:{},...c?{preferredPageIndex:c.pageIndex}:w!==null?{preferredPageIndex:w}:Xe.selectionPageIndex()!==void 0?{preferredPageIndex:Xe.selectionPageIndex()}:{},scopedHost:F,...c?{scopedHostKind:"headerFooter"}:h?{scopedHostKind:"note"}:{}}}),x=Ws(a.part()),N=a.paragraphIds(),V=N.find(c=>!x.has(c))??N[0]??"",M=r.initialSelection??{anchor:{paragraphId:V,offset:0},head:{paragraphId:V,offset:0}},D=r.initialDrawingSelectionIntent??{kind:"none"};function K(c,h){c.kind===D.kind&&(c.kind!=="pointer"||D.kind==="pointer"&&c.drawingNodeId===D.drawingNodeId)||(D=c,h&&n$1.onChange?.(lt()));}let j$1=null,Q=null;function ae(c){return Q=c,n$1.onChange?.(lt()),false}let Y=new Zl,ne$1="suggesting needs an author before it can propose a change",oe=false,L=false,A=null,Z=new Map;function $(){A=null;for(let c of Z.values())A=c;}function W(c,h){if(c.paragraphId===h.paragraphId)return c.offset-h.offset;let w=Fe();return w.indexOf(c.paragraphId)-w.indexOf(h.paragraphId)}function E(c){if(!A)return;let{from:h,to:w}=Tl(se,A),F=c.head;W(F,h)>=0&&W(F,w)<=0||(Z.clear(),A=null);}let q=null;function z(){return J()?.properties??null}function J(){if(!q)return null;let c=q.position,h=w=>w.paragraphId===c.paragraphId&&w.offset===c.offset;return h(M.anchor)&&h(M.head)?q:null}function ie$1(c){if(!q)return;let h=q.position;c.anchor.paragraphId===h.paragraphId&&c.anchor.offset===h.offset&&c.head.paragraphId===h.paragraphId&&c.head.offset===h.offset||(q=null);}function ee(c,h,w,F,H){let U=Ge$1([...c],w,F,Oe(),true,H);return c.length===h.length||!U.rejected?U:Ge$1([...h],w,F,Oe(),true,H)}function de$1(c,h,w,F){let H=J()??(Rt(M.head.paragraphId).length===0?{base:[],properties:il(je(a,M.head.paragraphId)??a.part(),M.head.paragraphId,M.head.offset,At(),pt())}:null);if(!H||w===0||H.properties.length===0&&H.base.length===0)return [];let U=q?.position??M.head,X=F&&U.paragraphId===c&&U.offset>=F.start&&U.offset<=F.end?{paragraphId:c,offset:Id$1({paragraphId:c,offset:F.start},{paragraphId:c,offset:F.end})}:he(se,U);return X.paragraphId!==c||X.offset!==h?[]:[{op:"setRunProperties",paragraphId:c,start:h,end:h+w,properties:H.properties.reduce((re,me)=>ua(re,ya(re,me)),[...H.base])}]}let ce=null,ye=null,Je=null,Oe=()=>Ks(ce?.getActive()??null,ye?.activeNoteScope()??null),Re=()=>ye?.activeNoteScope()?.id??null,Ae=c=>{let h=y.multi?.spans,w=0,F=0;if(h&&h.length>0)for(let H=0;H<h.length;H+=1){let U=h[H];if(w=H,F=U.startIndex,c<U.startIndex+U.pageCount)break}return {sectionIndex:w,sectionStart:F}},Fe=()=>No(se,ce?.getActive()??null,Re()),De=()=>globalThis.performance?.now()??Date.now(),ke=0,Be=0,tt=0,{styleCascade:He,numberingIndex:Te,defaultTabStopPt:Ft,compatibilityMode:Mn}=Kw(a),Go=qw({styleCascade:He,partOf:c=>je(a,c)??a.part()}),et=null,lr=n$1.imageDecodePort??Gw(O)??Xw(),it=Gc$1({session:a,decodePort:lr,onResourcesChanged:()=>et?.()}),dr=n$1.drawingStrings??h,co=n$1.tocLabels,Ni=()=>M.anchor.paragraphId!==M.head.paragraphId||M.anchor.offset!==M.head.offset?null:{paragraphId:M.head.paragraphId,offset:M.head.offset},uo=$v(a),Fn=Yw({mintValidatedBytes:(c,h)=>it.mintValidatedBytes(c,h)}),wn=false,An=fS(n$1.revisionDisplayMode,!!n$1.reviewModel,c=>Le.setRevisionDisplayMode(c)),nd=An.view,At=An.projection,Ln=An.changeBars,Nn=r.revisionAuthorVisibility??Il(n$1.hiddenRevisionAuthors),st=Cx({layout:()=>se,part:()=>a.partFor(Oe())??a.part(),view:Np}),pt=()=>An.filter(Nn.filterForSession(a)),Xo=c=>{let h=je(a,c)??a.part(),w=Ha(h,c);if(w?.kind!=="paragraph")return false;let F=At(),H=pt();if(!fb$2(w,F,H))return true;let U=Ia$1(h,c);return U?ib$2(U.children,F,H).some(X=>X.kind==="paragraph"&&X.id===c):false},sn,Di=zd(a),Dn=Ad(),Hn=(c,h=wn)=>Zw({session:a,measurer:v,producer:T,cache:b,styleCascade:He,numberingIndex:Te,defaultTabStopPt:Ft,compatibilityMode:Mn,displayMode:At(),showFieldCodes:h,revisionAuthorFilter:c,inlineDrawingLayoutForPart:w=>it.contextForPart(w),drawingLayoutTokenForPart:w=>it.cacheTokenForPart(w),drawingTokenForParagraphForPart:(w,F)=>it.drawingTokenForParagraph(F,w),linkProjectors:Di,projectFieldLink:w=>Dn.project(w)});sn=Hn(pt());let cr={...a,applyTreeOps:(c,h,w,F)=>Ge$1(c,h,w,F),ensureListDefinition:c=>Sb$1(i?.identity.actorId,()=>a.ensureListDefinition(c)),applyPmDoc:c=>Ke==="view"?{committed:false,rejected:true,opCount:0,reason:u}:i?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:bd()?{committed:false,rejected:true,opCount:0,reason:f$1}:a.applyPmDoc(c)},se=ta(),_n=n$1.revisionStyles,Yo=nx(n$1.showParagraphMarks??false,qe,()=>yt(false)),Hi=r.reviewAuthorSlots??e(),Bn=Lx({layout:()=>se,items:()=>a.reviewItems(),styles:()=>_n,slots:Hi});function Qo(c){if(c===null||c.length===0){if(!q)return;q=null;}else {let{anchor:h,head:w}=M;if(h.paragraphId!==w.paragraphId||h.offset!==w.offset)return;let F=J()?.base??il(a.partFor(Oe())??a.part(),w.paragraphId,w.offset,At(),pt());q={position:w,properties:c,base:F};}R.update(),n$1.onChange?.(lt());}let _i$1=oS({runFormatRefusal:()=>Cn({type:"toggleMark"},Le)?.reason??null,session:cr,storyScope:Oe,paragraphOrder:Fe,layout:()=>se,selection:()=>st.shownSelection(M),displayMode:()=>At(),authorFilter:pt,paragraphMarkVisible:Xo,commit:(c,h,w)=>_e(c,h,w),orderedRange:()=>st.shownRange(gr()),selectionMark:()=>We(),textOf:c=>Rt(c),selectedCells:()=>j$1?.cellIds,defaultParagraphStyleId:()=>He()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n$1.defaultFontFamily??null,pendingFormats:()=>z(),setPendingFormats:Qo}),Fr=iS({session:cr,storyScope:Oe,layout:()=>se,selection:()=>st.shownSelection(M),displayMode:()=>At(),authorFilter:pt,paragraphMarkVisible:Xo,commit:(c,h,w)=>_e(c,h,w),orderedRange:()=>st.shownRange(gr()),selectionMark:()=>We(),textOf:c=>Rt(c),paragraphOrder:Fe,selectedCells:()=>j$1?.cellIds,armPendingFormats:c=>Qo(c),now:De,publish:()=>{Fr.state().mode!=="off"?P.dataset.formatPainter="":delete P.dataset.formatPainter,n$1.onChange?.(lt());}}),Bi=kS({session:cr,storyScope:Oe,headerFooterSectionIndex:()=>ce?.getActive()?.sectionIndex,revisionDisplayMode:At,revisionAuthorFilter:pt,paragraphOrder:Fe,selectedCells:()=>j$1?.cellIds,editingMode:()=>Ke,publishRefusal:ae,caretParagraphId:()=>M.anchor.paragraphId===M.head.paragraphId&&M.anchor.offset===M.head.offset?M.head.paragraphId:null,layout:()=>se,commit:(c,h,w)=>_e(c,h,{rearmPending:J()??void 0,...w?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Sd(),orderedRange:()=>gr(),selectionMark:()=>We(),collapsedAt:c=>Ze(c),deleteSelectionPlan:()=>Wn(),paragraphTextOf:c=>Rt(c),numberingLevelExists:(c,h)=>Dc$1(Sb$2(Te(),He()),c,h)!==null});function Jo(c,h,w){return Ke!=="suggest"?null:Id$1({paragraphId:c,offset:h},{paragraphId:c,offset:w})}let fo=FS({session:cr,layout:()=>se,fieldLinkById:c=>Dn.linkById(c),refusesWrite:()=>pr(true)!==null,withMintActor:c=>Sb$1(i?.identity.actorId,c),storyScope:Oe,replacementLanding:Jo,insertionLanding:(c,h)=>he(se,{paragraphId:c,offset:h}).offset,selection:()=>M,orderedRange:()=>gr(),selectionMark:()=>We(),textOf:c=>Rt(c),commit:(c,h)=>_e(c,h)}),$n=HS({session:cr,storyScope:Oe,editingMode:()=>Ke,writeRefusal:c=>pr(true,[c]),selection:()=>M,selectionMark:()=>We(),commit:(c,h)=>_e(c,h)}),po=c=>{let h=ht(a,c,{kind:"body"});if(h.kind==="body")return ye?.exitNote(),ce?.exitHeaderFooter(),true;if(h.kind==="headerFooter"){let F=ce?.activeScope();return F?.kind==="headerFooter"&&F.rId===h.rId?true:(ye?.exitNote(),ce?.enterHeaderFooter({rId:h.rId})??false)}let w=$i(c);return w?ye?.activeNoteScope()?.id===w?true:(ce?.exitHeaderFooter(),ye?.enterNote(w)??false):false},$i=c=>{for(let h of se.pages)for(let w of [h.footnotes,h.endnotes])if(w){for(let F of w.notes)for(let H of ba(F.fragments))if(H.paragraphId===c)return F.scopeId}return null},qn=_S({pagesLayer:P,container:e$1,scale:()=>l$1,layout:()=>se,bookmarks:()=>a.bookmarks(),linkById:c=>Dn.linkById(c)??fo.linkById(c),drawingLinkById:c=>KS(se,c),setSelection:c=>It(Ze(c)),enterStoryFor:c=>po(c),isCollapsedSelection:()=>M.anchor.paragraphId===M.head.paragraphId&&M.anchor.offset===M.head.offset,onScrolled:()=>Zi(),...n$1.onHyperlinkPopover?{onPopover:n$1.onHyperlinkPopover}:{}}),Ar=DS({pagesLayer:P,equationById:c=>$n.equationById(c),setSelection:c=>It(c,false,"none"),...n$1.onEquationPopover?{onPopover:n$1.onEquationPopover}:{}});P.addEventListener("contextmenu",Pp),P.addEventListener("click",Cp),P.addEventListener("pointermove",vp),P.addEventListener("pointerleave",wp);let rd=Jv(P),Gt=null;function ur(c,h,w){let F=w?w.authorFilter:pt(),H=w?.layoutSession??y,U=w?.furnitureSource??sn;return h&&Qb$1(H,h),it.sync(a),a$5({view:a,revision:c,measurer:v,cache:b,session:H,producer:T,styleCascade:He,defaultTabStopPt:Ft,numberingIndex:Te,furniture:U,compatibilityMode:Mn,linkProjectors:Di,projectFieldLink:X=>Dn.project(X),inlineDrawingLayout:it.bodyContext,inlineDrawingLayoutForPart:X=>it.contextForPart(X),drawingTokenForParagraph:X=>it.drawingTokenForParagraph(X,a.part().name),drawingTokenForParagraphForPart:(X,re)=>it.drawingTokenForParagraph(re,X),drawingLayoutEpoch:it.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:X=>it.cacheTokenForPart(X),displayMode:At(),showFieldCodes:w?false:wn,revisionAuthorFilter:F})}function ea$1(){return ur(a.packageRevision(),void 0,{layoutSession:de(),furnitureSource:Hn(void 0,false)})}function ta(){let c=De(),h=ur(a.packageRevision());return ke=De()-c,h}let Ct=null,qt=0,S=false,G=null,te=false;function be(){if(te)return;te=true;let c=a.packageRevision();G=tI({steps:eI(()=>a.part()),shouldRun:()=>Ke!=="view"&&a.editable&&a.packageRevision()===c,hasPendingInput:he$1});}function he$1(c=true){return gv(e$1,c)}function Ee$1(){if(qt>0){S=true,be();return}if(!he$1()){yt(),be();return}Ct===null&&(Ct=setTimeout(()=>{Ct=null,Ye.pending()===null&&(yt(),be());},0));}let Ne="",xe$1=null,ue$1=false;function Ie$1(){if(ue$1||(xe$1!==null&&(clearTimeout(xe$1),xe$1=null),Ne.length===0))return;let c=Ne;Ne="",ue$1=true;try{Ei(Le,void 0,()=>Le.type(c));}catch(h){throw Ne=c+Ne,h}finally{ue$1=false;}}function Me(c){Ne+=c,xe$1===null&&(xe$1=setTimeout(()=>{xe$1=null,Ie$1();},0));}function mt(c,h,w){Ie$1();let F=w?.trim()||s?.trim();if(!F)return ae("tracked changes need a non-empty author");if(c!=="deletion"&&h.length===0)return ae(`${c} requires non-empty text`);if(c!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(h))return ae(`${c} requires text without a paragraph mark`);let H={author:F,date:m()},U=gr(),X=U.from.paragraphId===U.to.paragraphId&&U.from.offset===U.to.offset;if(c!=="insertion"&&X&&!(c==="replacement"&&j$1))return ae(`${c} needs a non-collapsed selection`);let re=c==="insertion"?{ops:[],collapseTo:he(se,U.from)}:Wn(F),me=Lp(re.ops,H,Ap()),Se=re.collapseTo;if(c==="insertion"||c==="replacement"){let fe=c==="replacement"?re.replaceAt??re.collapseTo:re.collapseTo;me.push({op:"insertText",paragraphId:fe.paragraphId,offset:fe.offset,text:h,revision:H}),Se={paragraphId:fe.paragraphId,offset:fe.offset+h.length};}let Pe=false;return _e(()=>{let fe=Ge$1(me,We(),jn(Se));return Pe=fe.committed,fe},()=>Ze(Se)),Pe}let Ye=ra({run:c=>{let h=De(),w=ur(c.revision,c);return ke=De()-h,w},currentRevision:()=>a.packageRevision(),schedule:c=>{let h=setTimeout(c,0);return ()=>clearTimeout(h)},publish:c=>{Bn.releaseLayout(),se=c,Ee$1();}}),ln=false;et=()=>{Ye.invalidateAll(a.packageRevision(),"drawing-resources"),!ln&&(ln=true,setTimeout(()=>{ln=false,Ve();},0));};let wt=a.subscribe(c=>{yT(c),q=null,Ye.notify(c);}),St=i?a.collaborationPort(i.documentId):null,Kn=()=>{},na=()=>{},mo=false,Lr=null,ra$2=null,go=i?i.subscribeRemoteSelections(()=>{mo&&Wi();}):()=>{};function ho(){let c=zw(e$1,se,M,l$1),h=ce?.getActive()?.pageIndex??Xe.selectionPageIndex();return h===void 0||c===void 0||c.has(h)?c:new Set([...c,h])}function ze$1(){S&&yt();}function Ve(){return Ye.pending()?Ye.flush():false}let yo=8;function Nr(c){!c&&Ye.pending()!==null&&ke>yo&&he$1(false)||(!Ve()||c&&S)&&yt();}function qe(){Ie$1(),Ve();}function Zn(){Ie$1();let c=Ve();return Ct!==null||S?(yt(),be(),true):c}let Dr=null;function oa(c){return Xb(c,a.part())}function aa$1(){for(let c of P.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(c.getAttribute("data-docx-content-control")===Dr){c.dataset.hover="",c.dataset.boundaryVisible="";continue}delete c.dataset.hover,oe||delete c.dataset.boundaryVisible;}}function bp(c){Dr!==c&&(Dr=c,aa$1());}function od(c){return Yb(a.part(),xp(c),c.target)}function vp(c){let h=od(c);bp(h?oa(h):null);}function xp(c){let h=c.target,w=h?.isConnected?h.closest("[data-paragraph-id]"):void 0;if(w)return w.dataset.paragraphId;let F=P.ownerDocument;return typeof F.elementFromPoint!="function"?void 0:F.elementFromPoint(c.clientX,c.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function wp(){bp(null);}function Xk(){let c=fr(),h=Cd(a.part()),w=Ge(a.part()),F=w.map(fe=>{let bt=Kv(fe,se,a.part(),v);return bt?{...bt,empty:h.has(fe.beginParagraphId)}:null}).filter(fe=>fe!==null),H=new Set(F.map(fe=>fe.boundary.id)),U=new Set(F.filter(fe=>fe.empty).map(fe=>fe.boundary.id));for(let fe of w)fe.contentControlId&&oa(fe)!==fe.contentControlId&&U.add(fe.contentControlId);let X=c&&!H.has(c.id)?new Set([c.id]):void 0,re=Dr?new Set([Dr]):void 0,me=new Set(xe(se).filter(fe=>fe.controlType==="checkbox"&&id(fe.id)).map(fe=>fe.id)),Se=F.filter(fe=>fe.additional&&!fe.empty).map(fe=>fe.boundary),Pe=Fp()!==null;if(!(!oe&&!X&&!re&&!Pe&&me.size===0&&Se.length===0&&H.size===0))return {...Pe?{readOnly:true}:{},...oe?{showAll:true}:{},...X?{activeIds:X}:{},...re?{hoverIds:re}:{},...me.size>0?{checkedIds:me}:{},...Se.length>0?{additionalBoundaries:Se}:{},...H.size>0?{tocControlIds:H}:{},...U.size>0?{suppressedIds:U}:{}}}let ia=null;function fr(){let c=Oe();if(c.kind!=="body")return Jk(c);if(ia&&ia.layout===se&&ia.selection===M)return ia.result;let h=Yk();return ia={layout:se,selection:M,result:h},h}function Yk(){let c=ex(se,M,v);return c&&Qk(c.id)===a.part().name?c:null}function Qk(c){let h=c.indexOf("#");return h===-1?"":c.slice(0,h)}function Jk(c){let h=a.partFor(c);return h?Id(h,M.head.paragraphId):null}function Sp(c){return c.bound?"bound":c.effectiveLock==="contentLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function eT(c){return c.effectiveLock==="sdtLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function tT(c){return Jd(c)}function Sn(c){let h=je(a,c),w=Ha(h??a.part(),c);return !w||!tT(w)?null:w}function Ip(c){let h=Sn(c);if(!h)return null;for(let w of h.children)if(w.kind!=="textValue"&&(w.kind==="contentControlProperties"||w.localName==="sdtPr"))for(let F of w.children){if(F.kind==="textValue"||F.localName!=="tabIndex")continue;let H=F.attributes.find(X=>X.localName==="val")?.value;if(H===void 0)return null;let U=Number(H);return Number.isFinite(U)?U:null}return null}function nT(){let c=Oe(),h=c.kind==="body"?null:a.partFor(c),w=c.kind==="notesPart"?new Set(Fe()):void 0;return (h?[...Hd(h,w)]:[...xe(se)]).filter(H=>Sp(H)===null).sort((H,U)=>{let X=Ip(H.id),re=Ip(U.id);return X!==null&&re!==null&&X!==re?X-re:X!==null&&re===null?-1:X===null&&re!==null?1:0})}function rT(c){for(let h of c.children)if(h.kind!=="textValue"&&(h.kind==="contentControlContent"||h.localName==="sdtContent"))return h.children;return []}function ad(c){ce?.getActive()||ye?.activeNoteScope()||ht(a,c.paragraphId,{kind:"body"}).kind==="body"&&Le.revealPosition(c);}function oT(c){let h=Sn(c);if(!h)return false;let w=VS(h,{contentChildrenOf:rT,searchRoots:()=>(a.partFor(ht(a,c,Oe()))??a.part()).root.children});if(!w)return false;let F=M;return It(w,false,"none"),(M!==F||Ot(M,w))&&ad(M.anchor),true}let kp=c=>Dv(Sn(c),()=>a.currentPackage());function id(c){let h=Sn(c);if(!h)return false;for(let w of h.children)if(w.kind!=="textValue"&&!(w.kind!=="contentControlProperties"&&w.localName!=="sdtPr")){for(let F of w.children)if(F.kind==="contentControlCheckbox")for(let H of F.children){if(H.kind!=="contentControlChecked")continue;let U=H.attributes.find(X=>X.localName==="val")?.value;return !(U==="0"||U==="false"||U==="off")}}return false}let Tp=c=>Hv(Sn(c));function qi(c,h){for(let w of P.querySelectorAll("[data-docx-content-control]"))w.getAttribute("data-docx-content-control")===c&&(h?w.dataset.open="":delete w.dataset.open);}let bo=Gv({document:O,layer:P,find:Sn,layout:()=>se,selectDrawing:(c,h)=>Le.selectDrawing(c,h),allowed:c=>!Vn.disabledReason(c,"edit"),translate:c=>ca?.(c)??c,replaceImage:(c,h,w,F)=>Le.replaceImage(c,h,w,{expectedPackageRevision:a.packageRevision(),commitGuard:F}),setOpen:qi,reject:ae}),sd=Nv({find:Sn,allowed:c=>!Vn.disabledReason(c,"edit"),apply:(c,h)=>Vn.setValue(c,h),items:kp,date:Tp,checked:id,picture:bo.drawingOf,replaceImage:bo.replace,locale:()=>ji.get(),layer:P,setOpen:qi,request:n$1.onRequestContentControlWidget}),Ki=null,ld;function dd(c){Ki===c&&(Ki=null,ld?.(),ld=void 0);let h=c.dataset.docxCcId,w=c.contains(O.activeElement);c.remove(),h&&qi(h,false),w&&P.focus({preventScroll:true});}function cd(){sd.cancel();let c=Ki;return c&&dd(c),c}function Pp(c){let h=od(c);aT(h&&wd(h.id)?h.id:null);}let sa=null;function aT(c){sa!==c&&(sa=c,n$1.onChange?.(lt()));}function Cp(c){if(c.button!==0||c.target?.closest("a.docx-hyperlink")||M.anchor.paragraphId!==M.head.paragraphId||M.anchor.offset!==M.head.offset)return;let h=xp(c);if(!h)return;let w=Ge(a.part()).find(U=>U.resultParagraphIds.includes(h));if(!w||od(c)?.id!==w.id)return;let H=qf$1(a.part(),w,a.documentOutline(),vd(w))[w.resultParagraphIds.indexOf(h)];H&&(c.preventDefault(),qn.goToPosition({paragraphId:H,offset:0}));}let Rp={document:O,locale:()=>ji.get(),translate:c=>ca?.(c)??c,setValue:(c,h)=>Vn.setValue(c,h),close:c=>dd(c)};function iT(c,h){let w=Vn.disabledReason(c,"edit");if(w){Q=w,n$1.onChange?.(lt());return}if(bo.cancel(),cd()?.dataset.docxCcId===c||(h==="picture"&&bo.select(c),sd.open(c,h)))return;if(h==="picture")return bo.pick(c);if(h==="checkbox"){Vn.setValue(c,id(c)?"false":"true");return}let F=xe(se).find(U=>U.id===c)?.alias,H;if(h==="dropdown"||h==="comboBox"||h==="buildingBlockGallery"){let U=kp(c);if(U.length===0&&h==="dropdown")return;H=vx(Rp,c,h,U,F,ef(Sn(c),U));}else if(h==="date")H=xx(Rp,c,Tp(c),F);else return;Ki=H,bx(H,P,Fv(se,l$1,c,P,dt?.pageOffsetX)),qi(c,true),ld=cl(H,()=>dd(H)),h==="date"?wl(H):(H.querySelector("input")??H.querySelector('[role=option][tabindex="0"]')??H.querySelector("button,[data-docx-part=empty]"))?.focus({preventScroll:true});}let Vn={setShowAll(c){oe!==c&&(oe=c,yt());},setFormFill(c){L!==c&&(L=c,n$1.onChange?.(lt()));},showAll:()=>oe,formFill:()=>L,atCaret:()=>fr(),navigate(c){let h=nT();if(h.length===0)return false;let w=fr(),F=w?h.findIndex(U=>U.id===w.id):-1;c==="next"?F=F<0?0:(F+1)%h.length:F=F<0?h.length-1:(F-1+h.length)%h.length;let H=h[F];return oT(H.id)},setValue(c,h){let w=Vn.disabledReason(c,"edit");if(w)return ae(w);let F=Bv(Sn(c),()=>a.currentPackage(),c,h);if(!F)return ae("unknown-building-block");let H=false;return _e(()=>{let U=Ge$1(F,We(),void 0,ht(a,c,Oe()),false);return H=U.committed,U}),H},remove(c){let h=c??fr()?.id;if(!h)return ae("notFound");let w=Vn.disabledReason(h,"remove");if(w)return ae(w);let F=false;return _e(()=>{let H=Ge$1([{op:"removeContentControl",controlId:h}],We(),void 0,ht(a,h,Oe()),false);return F=H.committed,H}),F},disabledReason(c,h){let w=Fp();if(w!==null)return w;let F=xe(se).find(U=>U.id===c);if(F)return h==="remove"?eT(F):Sp(F);let H=Sn(c);if(!H)return "notFound";for(let U of H.children)if(U.kind!=="textValue"&&!(U.kind!=="contentControlProperties"&&U.localName!=="sdtPr")){if(U.children.some(X=>X.kind!=="textValue"&&X.localName==="dataBinding")&&h==="edit")return "bound";for(let X of U.children){if(X.kind==="textValue"||X.localName!=="lock")continue;let re=X.attributes.find(me=>me.localName==="val")?.value;if(h==="remove"){if(re==="sdtLocked"||re==="sdtContentLocked")return "locked"}else if(re==="contentLocked"||re==="sdtContentLocked")return "locked"}}return null}};function ud(){let c=Op&&Ke!=="view";P.contentEditable=c?"true":"false",P.setAttribute("aria-readonly",c?"false":"true");}function lt(){return {revision:a.packageRevision(),pageCount:se.pages.length,selection:M,cellSelection:j$1,canUndo:i?.canUndo()??a.canUndo(),canRedo:i?.canRedo()??a.canRedo(),collaborationStatus:i?.status()??"inactive",lastRejection:Q,pendingFormat:z(),contentControls:{showAll:oe,formFill:L,activeControlId:fr()?.id??null},contextTocId:sa,formatPainter:Fr.state(),perf:{layoutMs:ke,paintMs:Be,selectionMs:tt,placed:y.stats.placed,total:y.stats.total,reusedPages:y.stats.reusedPages,fullPasses:y.stats.fullPasses,staleDiscards:Ye.staleDiscards,cancelledRuns:Ye.cancelledRuns}}}let Kt,dt,la=false,da=null,fd=null;function sT(c){for(let h of se.pages){let w=P.children.item(h.index);if(w?.dataset.pageIndex!==String(h.index))continue;let F=c.pageOffsetX.get(h.index)??0;w.style.left=`${(h.box.x+F)*l$1}px`;}}function yt(c=true){Ct!==null&&(clearTimeout(Ct),Ct=null,c=true),S=false;let h=Xe.adoptBeforePaint(),w=De();Kt=ho(),ce?.reconcileOccurrence();let F=ce?.getActive()??null,H=Xk(),U=Cd(a.part());n(P,se,{scale:l$1,readOnlyParagraphIds:Ws(a.part()),...U.size>0?{emptyTocPlaceholderIds:U}:{},...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},...n$1.defaultFontFamily?{defaultFontFamily:n$1.defaultFontFamily}:{},materialize:Kt,ariaHidden:false,drawingStrings:dr,...n$1.fieldShading?{fieldShading:n$1.fieldShading}:{},..._n!==void 0?{revisionStyles:_n}:{},shadeFormFields:uo(),showParagraphMarks:Yo.get(),changeBars:Ln(),changeBarsToggle:!!n$1.reviewModel,...Fn?{imageUrlPort:Fn}:{},...F?{activeHeaderFooterRId:F.scope.rId,activeHeaderFooterPageIndex:F.pageIndex}:{},...H?{contentControlChrome:H}:{}},Bn.get().value),pf(P,Ni(),{domReplaced:true}),Bb(e$1,P,F!=null),tu(e$1,Ke),dt=Ll(se,Kt),sT(dt),P.style.width=`${dt.width*l$1}px`,P.style.height=`${dt.height*l$1}px`,e$1.style.width=`${dt.width*l$1}px`,e$1.style.height=`${dt.height*l$1}px`,B.style.width=`${dt.width*l$1}px`,B.style.height=`${dt.height*l$1}px`,C.style.width=B.style.width,C.style.height=B.style.height,_.style.width=B.style.width,_.style.height=B.style.height,k.style.width=B.style.width,k.style.height=B.style.height,wa.update(),Be=De()-w,ya$1(),Wi(),xo(true),fm(),Xe.mirrorToDom(),Ep(la),la=false,(c||h)&&n$1.onChange?.(lt());}function Zi(){qe();let c=ho(),h=Ll(se,c);dt&&Mf(c,Kt)&&Ww(h,dt)||yt(false);}let pd=ZS({storyScopeOpen:()=>!!(ce?.getActive()||ye?.activeNoteScope()),selection:()=>st.shownSelection(M),layout:()=>se,measurer:()=>v,preferredPageIndex:()=>Xe.selectionPageIndex(),pagesLayer:P,container:e$1,scroller:()=>Mt(e$1),scale:()=>l$1,scheduleRematerialize:()=>Pd()});function Ep(c=false,h="caret"){pd.follow(c,h);}let Ke=n$1.editingMode??"edit",Op=true,Vi=Object.freeze({kind:"body"}),Mp=0,ji=px(n$1.locale,Ie$1),ca=n$1.translate,ct=null,zi=null,md=null;function Ge$1(c,h,w,F=Oe(),H=true,U){Ie$1();let X=pr(c.some(lT)||!!U?.length,c,H);if(X!==null)return {committed:false,rejected:true,opCount:0,reason:X};let re=cT(H&&ct?ct.annotate(c):c),me=ua$1(re,h,w,F,U);return H&&ct?.afterApply(me.committed),me.committed&&re.some(uf)&&r.onTrackedChange?.(),me}function ua$1(c,h,w,F=Oe(),H){let U=i?.gateOperations(c,F);if(U)return {committed:false,rejected:true,opCount:0,reason:U};Mp+=1;let X=Y.value;return a.applyTreeOps(c,h,w,F,i?{packageEdits:H,origin:b$2.mutationHuman,actorId:i.identity.actorId,operationId:`${i.identity.actorId}:${i.sessionId}:browser:${Mp}`,recordsHistory:false,historyGroup:X}:{packageEdits:H,historyGroup:X})}function pr(c,h=[],w=true){if(bn(e$1))return "An external document refresh is in progress.";let F=GS(h);return Ke==="view"&&!F?u:wn&&c&&w&&!F&&qv(H=>je(a,H),M)?ul:c&&!F&&(w&&bd()||h.some(H=>wT(H)))?f$1:Ke==="suggest"&&!s?.trim()&&c?ne$1:Ke==="suggest"&&h.some(H=>H.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}let Fp=R0(()=>pr(true,[],false),()=>a.editable);function lT(c){return c.op!=="acceptRevision"&&c.op!=="rejectRevision"&&c.op!=="acceptAllRevisions"&&c.op!=="rejectAllRevisions"}let dT=c=>Qh.has(c),Ap=()=>!a.trackingSettings().doNotTrackFormatting;function Lp(c,h,w){return c.flatMap(F=>cf(F)?!w&&dT(F.op)?[F]:[F.revision!==void 0?F:{...F,revision:h}]:F.op==="splitParagraphMany"?[{...F,revision:h}]:F.op==="splitParagraph"?[F,{op:"setParagraphMarkRevision",paragraphId:F.paragraphId,kind:"ins",revision:h}]:F.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:F.secondId,revision:h}]:[F])}function gd(){let c=s?.trim();return Ke==="suggest"&&c?c:void 0}function cT(c){let h=gd();return h===void 0?[...c]:Lp(c,{author:h,date:m()},Ap())}function uT(c,h,w){let F=Rt(h);if(F===w)return c;let H=0;for(;H<w.length&&H<F.length&&w[H]===F[H];)H+=1;let U=0;for(;U<w.length-H&&U<F.length-H&&w[w.length-1-U]===F[F.length-1-U];)U+=1;let X=F.length-w.length,re=me=>me.paragraphId!==h||me.offset<=H?me:me.offset>=w.length-U?{...me,offset:me.offset+X}:{...me,offset:H};return {anchor:re(c.anchor),head:re(c.head)}}function Np(){return {displayMode:At(),authorFilter:pt()}}function Dp(c){let h=st.removedCaretEdit(M.head,c);return h===null?false:(_e(()=>Ge$1(h.ops,We(),jn(h.caret)),()=>Ze(h.caret)),true)}function jn(c){return {paragraphId:c.paragraphId,start:c.offset,end:c.offset}}function _e(...c){if(bn(e$1))return;let h=dx(e$1);try{fT(...c);}finally{h();}}function fT(c,h,w={}){Ie$1(),w?.keepCellSelection||(j$1=null),q=null,Xe.noteModelMoved(),qt+=1;let F=false;try{let H=Y.around(Le,c,X=>typeof X=="boolean"?X:X.committed),U=typeof H=="boolean"||!H.rejected?null:H;if(F=U!==null,U)Q=P0(String(U.reason??"rejected"),a.settingsRoot());else {Q=null;let X=h?.();X&&(ga(),M=X,K({kind:"none"},!1),Gt=null,la=!0);let re=w?.rearmPending;if(re&&re.properties.length>0){let{anchor:me,head:Se}=M;me.paragraphId===Se.paragraphId&&me.offset===Se.offset&&(q={properties:re.properties,base:re.base,position:Se});}}vo();}catch(H){if((qt-=1)===0&&S)try{yt();}catch{}throw H}qt-=1,Nr(F);}function pT(){if(!Kt)return true;for(let c of [M.anchor,M.head]){let h=ue(se,c);if(h&&!Kt.has(h.pageIndex))return false}return true}function vo(){let c=i;if(!c)return;let h=St?Hx(j$1?.text??M,F=>{let H=je(a,F)??a.part();return _x(H,F)},j$1?"cells":void 0):null,w=h?`${h.anchor.paragraphId}:${h.anchor.offset}|${h.head.paragraphId}:${h.head.offset}|${h.kind??""}`:"";w!==ra$2&&(ra$2=w,c.setLocalSelection(h));}function It(c,h=false,w="caret"){let F=!Ot(c,M);Ne.length>0&&F&&Ie$1();let H=ct?.beforeSelect(c);if(H===null)return;c=H??c,ie$1(c),E(c);let U=fr()?.id??null,X=Jt(a.part(),M.head)?.id;ga(),M=c,j$1=null,h||(Gt=null),pT()||(Xe.noteModelMoved(),w==="none"?pd.without(()=>yt(false)):yt(false)),Xe.noteSelectionSettled(),Xe.mirrorToDom(true),Ep(true,w),ya$1(),Hr.clear(),xo();let re=fr()?.id??null,me=Jt(a.part(),M.head)?.id;(U!==re||X!==me)&&yt(false),vo(),n$1.onChange?.(lt());}let Xe=pS({session:a,storyScope:Oe,document:O,pagesLayer:P,selection:()=>M,setSelection:c=>It(c),adoptSelection:c=>{let h=ct?.beforeSelect(c);h!==null&&(c=h??c,ie$1(c),E(c),ga(),M=c,Gt=null,la=true,vo());},commit:c=>_e(c),applyOps:(c,h,w)=>Ge$1(c,h,void 0,w),hasPendingInput:()=>Ne.length>0,replacementOffset:(c,h,w)=>Id$1({paragraphId:c,offset:h},{paragraphId:c,offset:w}),render:()=>yt(),flushLayout:()=>Ve(),flushToPaint:()=>Zn(),updateCaret:()=>{R.update(),pf(P,Ni());},textOf:c=>Rt(c),pendingFormatOps:(c,h,w,F)=>de$1(c,h,w,F),selectionMark:()=>We(),now:De,recordSelectionMs:c=>{tt=c;},isGesturing:()=>kd?.dragging()??false,domSelection:()=>j$1?Ze(j$1.text.anchor):M,holdsCellSelection:()=>j$1!==null,replaceSelectionWith:c=>Le.type(c),discardPaint:()=>l(P)});ce=US({session:a,layout:()=>se,sectionAtPage:Ae,revisionDisplayMode:At,revisionAuthorFilter:pt,selection:()=>M,setScopeSelection:c=>{Ie$1(),ga(),ie$1(c),Hr.clear(),M=c,j$1=null,Gt=null,vo();},noteModelMoved:()=>Xe.noteModelMoved(),render:()=>yt(),mirrorToDom:()=>Xe.mirrorToDom(),notify:()=>n$1.onChange?.(lt()),materializedPages:()=>Kt,entryRefused:()=>Ke==="view",leaveOtherStories:()=>ye?.exitNote()}),ye=YS({session:a,exitHeaderFooter:()=>ce?.exitHeaderFooter(),applyOps:Ge$1,commit:_e,selection:()=>M,selectionMark:()=>We(),orderedStart:()=>Sd(),deleteSelectionPlan:()=>Wn(),undo:()=>Le.undo(),activeScope:()=>{let c=ye?.activeNoteScope();return c||(ce?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:c=>ce.setActiveScope(c),setSelection:c=>It(c),noteModelMoved:()=>Xe.noteModelMoved(),render:()=>{Ve()||yt();},revealNote:c=>{Ve();for(let h of se.pages){let w=[...h.footnotes?.notes??[],...h.endnotes?.notes??[]].find(F=>F.scopeId===c);if(w)return xa$1(w.box.y,w.box.height,{block:"nearest",offsetPx:48}),h.index}return null},notify:()=>n$1.onChange?.(lt()),lastRejection:()=>Q,setLastRejection:c=>{Q=c;}});function Hp(c){c&&Ie$1(),j$1=c,c&&(ie$1(c.text),ga(),M=c.text),Gt=null,Xe.noteSelectionSettled(),Xe.mirrorToDom(),ya$1(),Hr.clear(),xo(),vo(),n$1.onChange?.(lt());}let mr=null;function mT(){let h=ue(se,M.head)?.pageIndex??0,w=new Set;for(let F=h-1;F<=h+1;F+=1)F>=0&&F<se.pages.length&&w.add(F);return w}let _p=new WeakMap;function gT(c){let h=_p.get(c);if(h)return h;let w=new Map;for(let F of c.pages)for(let H of aa(F))w.has(H.paragraphId)||w.set(H.paragraphId,F.index);return _p.set(c,w),w}function hT(){let c=a.revision(),h=Kt??mT();if(mr?.layout===se&&mr.revision===c&&Mf(mr.pages,h))return mr.rects;let w=gT(se),F=(re,me)=>{if(!h)return true;let Se=w.get(re),Pe=w.get(me);if(Se===void 0||Pe===void 0)return true;for(let fe=Math.min(Se,Pe);fe<=Math.max(Se,Pe);fe+=1)if(h.has(fe))return true;return false},H=[];for(let re of ha()){if(re.kind==="comment"){if(re.range===null||!F(re.range.start.paragraphId,re.range.end.paragraphId))continue;H.push({key:Ea(re),from:{paragraphId:re.range.start.paragraphId,offset:re.range.start.offset},to:{paragraphId:re.range.end.paragraphId,offset:re.range.end.offset}});continue}let me=Ea(re),Se=re.kind==="revision"?re.ranges:re.range?[re.range]:[];for(let[Pe,fe]of Se.entries())F(fe.start.paragraphId,fe.end.paragraphId)&&H.push({key:Se.length===1?me:`${me}${p}${Pe}`,from:{paragraphId:fe.start.paragraphId,offset:fe.start.offset},to:{paragraphId:fe.end.paragraphId,offset:fe.end.offset}});}let U=ne(se,H,h,v),X=[];for(let[re,me]of U)for(let Se of me)X.push({...Se,key:re});return mr={layout:se,revision:c,pages:h,rects:X},X}let zn=null;function yT(c){zn&&(c.impact==="text-local"&&c.created.length===0&&c.deleted.length===0&&c.splitJoin.length===0?zn={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:zn.index}:zn=null);}function bT(){let c=a.packageRevision(),h=a.part().root;if(zn&&zn.packageRevision===c&&zn.bodyRoot===h)return zn.index;let w=new Map,F=U=>{let X=w.size;for(let[re,me]of U)w.has(re)||w.set(re,X+me);};F(ki$1(a.part()));let H=new Set([a.part()]);for(let U of a.headerFooterPartsBySection())for(let X of [U.headers,U.footers])for(let re of X.values())H.has(re)||(H.add(re),F(ki$1(re)));for(let U of ["footnote","endnote"]){let X=a.partFor({kind:"notesPart",noteKind:U});!X||H.has(X)||(H.add(X),F(ki$1(X)));}return zn={packageRevision:c,bodyRoot:h,index:w},w}let Hr=new Set,fa=null,pa,ma=null,hd=false,Bp=false;function ga(){hd||(ma=null);}function $p(){let c=ma;if(!c||!M)return null;let h=(F,H)=>F.paragraphId===H.paragraphId&&F.offset===H.offset;if(!h(M.anchor,c.anchor)||!h(M.head,c.head))return null;let w=ha().find(F=>Ea(F)===c.key);return !w||w.kind==="revision"&&fa!==null&&fa.has(w.revisionKind)&&(w.revisionKind!=="format"||pa===void 0||pa.has(w.formattingKind??""))&&!Bp?null:w}function yd(){let c=$p();if(c)return qp(c);let h=M?.head;if(!h)return null;let F=Ia(ha(),h,bT()).filter(H=>!(H.kind==="comment"&&H.resolved)&&!Hr.has(Ea(H))&&!(H.kind==="revision"&&fa!==null&&fa.has(H.revisionKind)&&(H.revisionKind!=="format"||pa===void 0||pa.has(H.formattingKind??""))))[0];return F?qp(F):null}function qp(c){if(c.kind!=="comment")return c;let h=Ka$1(ha(),c);return Hr.has(Ea(h))?null:h}function ha(){return Nn.filterItems(a.reviewItems())}let Kp=Nx({roster:Bn.get,styles:()=>_n,slots:Hi}),Zp=Kp.forAuthor,vT=Kp.declaredFor;function xT(c,h,w){let F=c.split(p),H=F[0],U=h!==null&&H===Ea(h);if(c.startsWith("comment-")){let Pe=w.get(H),fe=Pe?.kind==="comment"&&Pe.resolved;return fe&&!U?null:U?`docx-comment-band docx-comment-band--active${fe?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(c.startsWith("custom-"))return U?"docx-comment-band docx-comment-band--active":null;let X=w.get(H);if(!X||X.kind!=="revision")return null;let re=F.length>1?Number(F[1]):0;return `docx-revision-band docx-revision-band--${(Pe=>Pe==="delete"||Pe==="moveFrom"?"delete":Pe==="insert"||Pe==="moveTo"?"insert":Pe==="replace"&&X.replacedRangeCount!==void 0?re<X.replacedRangeCount?"delete":"insert":"other")(X.revisionKind)}${U?" docx-revision-band--active":""}`}let Vp=null,jp,zp=null;function xo(c=false){let h=yd(),w=h?Ea(h):null,F=Bn.get();if(!c&&Vp===se&&jp===w&&zp===F.resolved)return;let H=new Map;for(let X of ha())H.set(Ea(X),X);let U=[];for(let X of hT()){let re=xT(X.key,h,H);if(!re)continue;let me=X.key.split(p)[0],Se=H.get(me),Pe=Se?gf(Se):null,fe=Pe===null||Pe===""?void 0:F.resolved.get(Pe),bt=Se?.kind==="revision"&&h!==null&&me===Ea(h)?fe?.style?.activeBackground:void 0;U.push({...X,className:re,...fe?{reviewAuthor:fe}:{},...bt!==void 0?{activeBackground:bt}:{}});}o(C,se,U,{scale:l$1,...dt?{pageOffsetX:dt.pageOffsetX}:{}}),Vp=se,jp=w,zp=F.resolved;}function ya$1(){ct?.update();let c=j$1?wa$1(se,j$1.cellIds):A?le(se,A,Fe(),v):me(se,M,Fe(),v);o(B,se,c,{scale:l$1,pageOffsetX:dt?.pageOffsetX,...j$1?{}:{className:A?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function Wi(){if(!mo){_.replaceChildren();return}let c=i;if(!c){_.replaceChildren();return}Bx(_,se,c.remoteSelections(),{scale:l$1,pageOffsetX:dt?.pageOffsetX,...Kt?{pages:Kt}:{},colorForAuthor:Zp,declaredColorFor:vT,labelHost:Lr,measurer:v});}function Ui(c){let h=Ge(a.part());if(c)return h.find(H=>H.id===c)??null;let w=sa?h.find(H=>H.id===sa):void 0;if(w)return w;let F=M.head.paragraphId;return h.find(H=>H.beginParagraphId===F||H.endParagraphId===F||H.resultParagraphIds.includes(F))??(h.length===1?h[0]:null)}function bd(){return Wb(a.part(),M)}function wT(c){return Ub(a.part(),c)}function Wp(){return new Set(Ge(a.part()).flatMap(c=>[c.beginParagraphId,...c.resultParagraphIds,c.endParagraphId]))}function vd(c){return new Set([c.beginParagraphId,c.endParagraphId,...c.resultParagraphIds])}function ST(c){let h=0;for(let w of se.pages)for(let F of aa(w))c.has(F.paragraphId)&&(h+=F.lines.length);return h}function xd(c,h){let w=new Set(h),F=new Map;for(let H of c.pages)for(let U of aa(H)){if(!w.has(U.paragraphId)||F.has(U.paragraphId))continue;let X=H.pageFieldSource;F.set(U.paragraphId,rc(X?.pageNumber??H.index+1,X?.format));}return F}function wd(c){if(Ke==="view"||!a.editable)return false;let h=Ui(c);return !h||!Ie(a.part(),a.documentOutline(),h.instruction)?false:_i(a.part(),{op:"rewriteTocPageNumbers",tocId:h.id,updates:[]})===null}function Up(c,h){if(!Number.isInteger(c)||!Number.isInteger(h)||c<1||h<1)return null;let w=Bi.sectionPropertiesAt(M.head.paragraphId),F=w.pageSize.widthTwips-w.margins.leftTwips-w.margins.rightTwips-w.margins.gutterTwips,H=Math.max(300,Math.floor(F/h));return {op:"insertTable",beforeParagraphId:M.head.paragraphId,rows:c,cols:h,columnWidthTwips:H}}function Gp(c,h){if(Ke==="view"||!a.editable)return false;let w=Up(c,h),F=a.partFor(Oe())??a.part();return w!==null&&_i(F,w)===null}function IT(c,h){if(!Gp(c,h))return false;let w=Up(c,h);if(!w)return false;let F=null,H=a.subscribe(X=>{X.caret&&(F=X.caret);}),U=false;try{_e(()=>{let X=Ge$1([w],We());return X.committed||(Q=X.reason??"the table could not be inserted here"),U=X.committed,X},()=>{let X=F;return X?Ze({paragraphId:X.paragraphId,offset:X.start}):null});}finally{H();}return U}let Xp='TOC \\o "1-3" \\h';function Yp(){let c=Ee(Xp);if(!c)return null;let h=a.documentOutline(),w=of$1(a.part(),h,c,xd(Le.layout(),h.map(F=>F.blockId)),Wp(),i?.identity.actorId);return {op:"insertToc",beforeParagraphId:M.head.paragraphId,instruction:Xp,alias:co?.title??"TOC",entries:w.entries,bookmarksToCreate:w.bookmarksToCreate}}function Qp(){if(Ke==="view"||!a.editable||bd())return false;let c=Yp();return c!==null&&_i(a.part(),c)===null}function kT(){if(!Qp())return false;let c=Yp();if(!c)return false;let h=new Set(Ge(a.part()).map(H=>H.id)),w=ua$1([c],void 0,void 0,Vi);if(!w.committed)return Q=w.reason??"the table of contents could not be inserted",false;let F=Ge(a.part()).find(H=>!h.has(H.id));return F?Jp(F.id,"pageNumbers"):true}function Jp(c,h="entire"){let w=Ui(c);if(!w||!wd(w.id))return false;let F=Le.layout(),H=a.documentOutline(),U=Ie(a.part(),H,w.instruction);if(!U)return false;let X=U.map(me=>me.blockId);if(h==="entire"){let me=of$1(a.part(),H,w.instruction,xd(F,X),vd(w),i?.identity.actorId),Se=ua$1([{op:"replaceTocResult",tocId:w.id,entries:me.entries,bookmarksToCreate:me.bookmarksToCreate}],void 0,void 0,Vi);if(!Se.committed)return Q=Se.reason??"the table of contents could not be refreshed",false;if(F=Le.layout(),w=Ui(w.id),!w)return true}let re="";for(let me=0;me<3;me+=1){let Se=xd(F,X),Pe=qf$1(a.part(),w,H,vd(w)),fe=w.resultParagraphIds.flatMap((cn,hr)=>{let Sa=Pe[hr],Yi=Sa?Se.get(Sa):void 0;return Yi===void 0?[]:[{paragraphId:cn,pageNumberText:Yi}]});if(fe.length===0)break;let bt=fe.map(cn=>`${cn.paragraphId}\0${cn.pageNumberText}`).join("");if(bt===re)break;re=bt;let dn=ua$1([{op:"rewriteTocPageNumbers",tocId:w.id,updates:fe}],void 0,void 0,Vi);if(!dn.committed){if(dn.rejected)return Q=dn.reason??"the table of contents page numbers were refused",false;break}F=Le.layout(),w=Ui(w.id)??w;}return true}function TT(){return Ox({session:a,editingMode:Ke,collaborationActive:i!==void 0,reviewerFilterActive:pt()!==void 0,layout:Le.layout(),canonicalUnfilteredLayout:ea$1,styleCascade:He(),numberingIndex:Te(),displayMode:At()})}let{selectionMark:We,orderedRange:gr,orderedStart:Sd,textOf:Rt,inlineControlBeside:em,splitEndsTheParagraph:PT,deleteSelectionPlan:Wn,deleteSelectionOps:CT,replacementOffset:Id$1}=$w({session:a,layout:()=>se,selection:()=>M,cellSelection:()=>j$1,editingMode:()=>Ke,author:()=>s,trackedDate:m,storyScope:Oe,paragraphOrder:Fe,flushPendingInputAndLayout:qe,trackedAuthorOrNone:gd,atParagraphEnd:(c,h)=>Go.atParagraphEnd(c,h),revisionView:Np}),{insertPlainText:tm,copyFlavoursNow:RT,pasteRichNow:ET,armForcePlainPaste:OT}=Bw({session:a,textFormFieldId:()=>ct?.fieldId()??null,layout:()=>se,cellSelection:()=>j$1,editingMode:()=>Ke,storyScope:Oe,paragraphOrder:Fe,actorId:()=>i?.identity.actorId,collaborationGate:(c,h)=>i?.gateOperations(c,h)??null,now:De,flushPendingInputAndLayout:qe,orderedRange:gr,selectionMark:We,deleteSelectionPlan:Wn,consumePendingFormatOps:de$1,withoutPendingOnRejection:ee,caretMark:jn,commit:_e});function ba$1(c){c&&(Je=null,qe(),sn=Hn(pt()),Ye.invalidateAll(a.packageRevision(),"tracked-change-filter"),Ye.flush(),n$1.onChange?.(lt()));}let va=false,Le={session:a,applyGatedTreeOps:(c,h,w,F)=>ua$1(c,h,w,F??Oe()),storyScope:Oe,imageDecodePort:()=>lr,layout:()=>(qe(),se),state:lt,currentPage:(c="caret")=>{if(qe(),c==="viewport"){let w=jw(e$1,se,l$1);if(w!==null)return w}let h=ue(se,M.head);return h?h.pageIndex+1:1},setScale(c){if(!(c>0)||!Number.isFinite(c))return false;if(c===l$1)return true;let h={scale:l$1,defaults:g$1,measurer:v,producer:T,furnitureSource:sn};try{let w=Mt(e$1),F=w?{x:(w.scrollLeft-e$1.offsetLeft+w.clientWidth/2)/l$1,y:(w.scrollTop-e$1.offsetTop+w.clientHeight/2)/l$1}:null;if(l$1=c,n$1.measurer||(g$1=ea(l$1,{context:qo(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),v=g$1.measurer),T=I(),sn=Hn(pt()),Kt=void 0,dt=void 0,mr=null,Ye.invalidateAll(a.packageRevision(),"zoom"),Ye.flush(),ze$1(),w&&F){let H=Math.max(0,F.x*l$1+e$1.offsetLeft-w.clientWidth/2),U=Math.max(0,F.y*l$1+e$1.offsetTop-w.clientHeight/2),X=Number.isFinite(w.scrollWidth)?Math.max(0,w.scrollWidth-w.clientWidth):null,re=Number.isFinite(w.scrollHeight)?Math.max(0,w.scrollHeight-w.clientHeight):null;w.scrollLeft=X===null?H:Math.min(H,X),w.scrollTop=re===null?U:Math.min(U,re),Zi();}return !0}catch{(({scale:l$1,defaults:g$1,measurer:v,producer:T,furnitureSource:sn}=h)),Kt=void 0,dt=void 0,mr=null;try{Ye.invalidateAll(a.packageRevision(),"zoom-rollback"),Ye.flush();}catch{}return false}},enqueueType:Me,flushPendingInput:qe,type(c){let h=Wn(),w=h.replaceAt??h.collapseTo,F=de$1(w.paragraphId,w.offset,c.length),H=h.ops.length===0?Yv(fr()):void 0,U=[...h.ops,Qv(w,c,H)],X=Xv(je(a,w.paragraphId)??a.part(),w.paragraphId,w.offset,c.length),re={paragraphId:w.paragraphId,start:X,end:X};_e(()=>ee([...U,...F],U,We(),re),()=>Ze({paragraphId:w.paragraphId,offset:X}));},proposeTextChange:(c,h,w)=>mt(c,h,w),insertPlainText:c=>tm(c),deleteBackward(){if(ct?.selectForDeletion("backward"))return;let c=Wn();if(c.ops.length>0){_e(()=>Ge$1(c.ops,We(),jn(c.collapseTo)),()=>Ze(c.collapseTo));return}if(Dp("backward"))return;let h=J()??void 0,w=st.shown(M.head);if(w.offset===0){for(let Se of ra$1(se,w.paragraphId)){let Pe=Rt(Se);if(Pe.length!==0){_e(()=>Ge$1([{op:"deleteText",paragraphId:Se,start:Pe.length-1,end:Pe.length}],We(),jn({paragraphId:Se,offset:Pe.length-1})),()=>Ze({paragraphId:Se,offset:Pe.length-1}),{rearmPending:h});return}}let H=Fe(),U=H.indexOf(w.paragraphId),X=H[U-1];if(!X)return;let re=st.joinOps(X,w.paragraphId);if(!re){It(Ze({paragraphId:X,offset:Rt(X).length}));return}let me=Rt(X).length;_e(()=>Ge$1(re,We(),jn({paragraphId:X,offset:me})),()=>Ze({paragraphId:X,offset:me}),{rearmPending:h});return}let F=em(w,"before");if(F){_e(()=>Ge$1([{op:"removeContentControl",controlId:F.controlId,keepContent:false}],We(),jn({paragraphId:w.paragraphId,offset:F.start})),()=>Ze({paragraphId:w.paragraphId,offset:F.start}),{rearmPending:h});return}_e(()=>Ge$1([{op:"deleteText",paragraphId:w.paragraphId,start:w.offset-1,end:w.offset}],We(),jn({...w,offset:w.offset-1})),()=>Ze({...w,offset:w.offset-1}),{rearmPending:h});},splitParagraph(){let c=Wn(),h=c.replaceAt??c.collapseTo,w=new Set(a.paragraphIdsIn(Oe())),F=J()??{properties:il(je(a,h.paragraphId)??a.part(),h.paragraphId,h.offset,At(),pt()),base:[]},H=PT(h),U=H?Go.followerStyleId(h.paragraphId):void 0,X=F.properties.reduce((Zt,Qi)=>ua(Zt,ya(Zt,Qi)),[...F.base]),re=H&&Ke==="edit"&&X.length>0?[{op:"setParagraphMarkProperties",paragraphId:h.paragraphId,properties:X}]:[],me={op:"splitParagraph",paragraphId:h.paragraphId,offset:h.offset,tailStyleId:U},Se=gd(),Pe=Se?{author:Se,date:m()}:void 0,fe=a.documentStyles(),bt=dl(fe),dn=bt??"ListParagraph",cn=new Set(fe.map(Zt=>Zt.styleId));for(let Zt=1;!bt&&cn.has(dn);Zt++)dn=`ListParagraph${Zt}`;let hr=Ke!=="view"&&c.ops.every(Zt=>Zt.op==="deleteText"&&Zt.paragraphId===h.paragraphId)&&U===void 0?mv(je(a,h.paragraphId)??a.part(),se,h,X,dn,He(),Pe,i?.identity.actorId):null,Sa=Pe?[{op:"setParagraphMarkRevision",paragraphId:h.paragraphId,kind:"ins",revision:Pe}]:[],Yi=hr?[hr,...re,...Sa]:[me];_e(()=>ee([...c.ops,...re,...Yi],[...c.ops,...hr?[hr,...Sa]:[me]],We(),void 0,hr&&!bt?[Mv(He()?.defaultParagraphStyleId??null,dn)]:void 0),()=>{let Zt=a.paragraphIdsIn(Oe()).filter(LT=>!w.has(LT)),Qi=hr?Zt.at(-1):Zt[0];return Qi?Ze({paragraphId:Qi,offset:0}):null},{rearmPending:F});},navigate(c,h=false){if(qe(),!h&&(c==="left"||c==="right")&&(M.anchor.paragraphId!==M.head.paragraphId||M.anchor.offset!==M.head.offset)){let Pe=gr();Gt=null;let fe=tx(se,Pe,Fe(),c,v);It(Ze(fe),true);return}let w=nu(se,st.shown(M.head),c,Gt,ce?.getActive()??null,Re(),v);if(!w)return;let F=Wp(),H=Gb(a.part(),w.position,["left","wordLeft","lineStart","up","pageUp"].includes(c));if(H&&(w={...w,position:H}),Jt(a.part(),w.position)){if(h)return;let fe=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(c)?"up":"down",bt=ST(F)+4;for(let dn=0;dn<bt;dn+=1){let cn=nu(se,w.position,fe,w.desiredX,ce?.getActive()??null,Re(),v);if(!cn||cn.position.paragraphId===w.position.paragraphId&&cn.position.offset===w.position.offset)return;if(w=cn,!Jt(a.part(),w.position))break}if(Jt(a.part(),w.position))return}Gt=w.desiredX,ye?.activeNoteScope()&&w.pageIndex!==void 0&&Number.isInteger(w.pageIndex)&&ye.setActiveNotePageIndex(w.pageIndex);let X={anchor:h?st.shown(M.anchor):w.position,head:w.position},re=h?X:Hl(se,X),me=!h&&!Ot(re,X),Se=M;It(re,true,me?"none":"head"),me&&(M!==Se||Ot(M,re))&&ad(M.anchor);},deleteWordBackward(){if(Le.deleteSelection())return;let c=M.head,h=(ct?.wordDeletionBoundary??ie)(Rt(c.paragraphId),c.offset,-1,ze(se,c.paragraphId));if(h===c.offset){Le.deleteBackward();return}_e(()=>Ge$1([{op:"deleteText",paragraphId:c.paragraphId,start:h,end:c.offset}],We()),()=>Ze({...c,offset:h}),{rearmPending:J()??void 0});},deleteWordForward(){if(Le.deleteSelection())return;let c=M.head,h=(ct?.wordDeletionBoundary??ie)(Rt(c.paragraphId),c.offset,1,ze(se,c.paragraphId));if(h===c.offset){Le.deleteForward();return}_e(()=>Ge$1([{op:"deleteText",paragraphId:c.paragraphId,start:c.offset,end:h}],We()),void 0,{rearmPending:J()??void 0});},deleteForward(){if(ct?.selectForDeletion("forward")||Le.deleteSelection()||Dp("forward"))return;let c=J()??void 0,h=st.shown(M.head),w=Rt(h.paragraphId);if(h.offset<w.length){let U=em(h,"after");if(U){_e(()=>Ge$1([{op:"removeContentControl",controlId:U.controlId,keepContent:false}],We()),()=>Ze(h),{rearmPending:c});return}_e(()=>Ge$1([{op:"deleteText",paragraphId:h.paragraphId,start:h.offset,end:h.offset+1}],We()),void 0,{rearmPending:c});return}let F=Fe(),H=F[F.indexOf(h.paragraphId)+1];if(H){if(ra$1(se,H).includes(h.paragraphId)){if(Rt(H).length===0)return;_e(()=>Ge$1([{op:"deleteText",paragraphId:H,start:0,end:1}],We()),()=>Ze(h),{rearmPending:c});return}_e(()=>Ge$1(st.forwardJoinOps(h.paragraphId,H)??[{op:"joinParagraphs",firstId:h.paragraphId,secondId:H}],We()),()=>Ze(h),{rearmPending:c});}},...Bi,..._i$1,setSelection:c=>{Ot(c,M)||K({kind:"programmatic"},false),It(c);},selectDrawing(c,h){Ve();let w=Sl(se,c,h);if(!w)return false;let F=Ze(w);return K({kind:"pointer",drawingNodeId:c},Ot(F,M)),It(F),di(Le)?.drawingNodeId===c},revealPage(c,h){Ve();let w=se.pages.find(F=>F.index===c);return w?xa$1(w.box.y,w.box.height,h):false},revealParagraph(c,h){Ve();let w=ue(se,{paragraphId:c,offset:0});if(!w)return false;let F=se.pages.find(H=>H.index===w.pageIndex);return F?xa$1(F.contentBox.y+w.y,w.height,h):false},revealPosition(c,h){Ve();let w=ue(se,c);if(!w)return false;let F=se.pages.find(H=>H.index===w.pageIndex);return F?xa$1(F.contentBox.y+w.y,w.height,{block:"nearest",...h}):false},setEditable(c){Op=c,ud();},selectAll(){let c=Fe(),h=c[0],w=c[c.length-1];!h||!w||It({anchor:{paragraphId:h,offset:0},head:{paragraphId:w,offset:Rt(w).length}});},hyperlinks:fo,equations:$n,contentControls:Vn,formatPainter:Fr,canInsertTable:Gp,insertTable:IT,canInsertToc:Qp,insertToc:kT,canRefreshToc:wd,canEditTextFormField:()=>ct?.canEdit()??false,editTextFormField:()=>ct?.edit()??false,refreshToc:Jp,refreshRefFieldResults:TT,save:()=>ux(Le,e$1,()=>va),isInsideToc:c=>Ge(a.part()).some(h=>h.beginParagraphId===c||h.endParagraphId===c||h.resultParagraphIds.includes(c)),retainSelection:()=>{let c=Symbol("selection-pin");return Z.set(c,M),A=M,ya$1(),c},releaseSelection:c=>{Z.delete(c)&&($(),ya$1());},retainedSelection:()=>A,publishedLayout:()=>se,drawingSelectionIntent:()=>D,overlayCoordinates:()=>Object.freeze({paintScale:l$1,pageOffsetX:dt?.pageOffsetX??new Map}),commitReviewOps:(c,h)=>{qe();let w=M.head.paragraphId,F=Rt(w);return _e(()=>{if(Ke==="view")return {committed:false,rejected:true,opCount:0,reason:u};if(i&&(h===void 0||!hv.has(h)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(i){let U=i.gateOperations([],Oe());if(U)return {committed:false,rejected:true,opCount:0,reason:U}}let H=Sb$1(i?.identity.actorId,c);return {committed:H.committed,rejected:!H.committed,opCount:0,...typeof H.reason=="string"?{reason:H.reason}:{}}},()=>{Ve(),Xe.noteModelMoved();let H=Fe();if(H.length===0)return null;let U=uT(M,w,F);return Si(se,H,U)})},revisionDisplayMode:nd,replacementLanding:Jo,applyAutomationOps:(c,h,w)=>{let F={committed:false,rejected:false,opCount:0},H=h??Vi;return _e(()=>{let U=pr(false);if(U!==null)return F={committed:false,rejected:true,opCount:0,reason:U};let X=null,re=c(me=>{let Se=pr(true,[],false);return Se===null?Sb$1(i?.identity.actorId,()=>a.ensureHyperlinkRelationship(me,H)):(X=Se,null)});return re===null?F={committed:false,rejected:true,opCount:0,reason:X??"this engine will not author that hyperlink target"}:!n$1.reviewModel&&re.some(uf)?F={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:F=Ge$1(re,void 0,void 0,H,false,w)},()=>{Ve(),Xe.noteModelMoved();let U=Fe();return U.length===0?null:Si(se,U,M)}),F},editingMode:()=>Ke,setAuthor:c=>{s!==c&&(Ie$1(),s=c,c?.trim()&&kx(Q)&&(Q=null,n$1.onChange?.(lt())));},setDrawingStrings:c=>{dr!==c&&g(dr)!==g(c)&&(dr=c,qe(),yt(false));},setLocale:ji.set,setTranslate:c=>{ca!==c&&(ca=c,Gu(P,c),ct?.update());},setTocLabels:c=>{co=c;},setEditingMode:c=>{qe();let h=Ke!==c;Ke=c,h&&c==="view"&&ce?.exitHeaderFooter(),h&&c==="view"&&Fr.disarm(),cd(),ud(),tu(e$1,Ke),h&&yt(false),Q=null,n$1.onChange?.(lt());},revisionAuthors:()=>Bn.get().value,setRevisionDisplayMode(c){va||c===An.view()||(qe(),An.set(c),ba$1(true));},hiddenRevisionAuthors:()=>Nn.hiddenAuthors,setRevisionAuthorVisible(c,h){ba$1(Nn.setVisible(c,h));},setAllRevisionAuthorsVisible(c){ba$1(Nn.setAllVisible(Bn.get().value.keys(),c));},showAllRevisionAuthors(){ba$1(Nn.showAll());},setTrackedChangesFilter(c,h){ba$1(Nn.setPredicate(c,h));},collaborationSession:()=>i??null,remotePresenceColor:Zp,setShowParagraphMarks:Yo.set,setRevisionStyles:c=>{c!==_n&&(_n=c,qe(),yt(false));},setRemoteCaretLabelHost:c=>{c!==Lr&&(Lr=c,Wi());},setReviewActivationExclusions(c,h){pa=h?.formattingKinds?new Set(h.formattingKinds):void 0,fa=c===null?null:new Set(c),xo(),n$1.onChange?.(lt());},activeReviewKey:()=>{let c=yd();return c?Ea(c):null},activateReview:(c,h,w)=>{if(Hr.clear(),Bp=w?.allowExcluded??false,ma=h?{key:c,anchor:h.anchor,head:h.head}:{key:c,anchor:M.anchor,head:M.head},h){hd=true;try{It(h);}finally{hd=false;}return}xo(),n$1.onChange?.(lt());},activatedReviewKey:()=>$p()===null?null:ma?.key??null,dismissActiveReview:()=>{let c=yd();c&&(Hr.add(Ea(c)),ma=null,xo(),n$1.onChange?.(lt()));},navigation:qn,bookmarks:()=>a.bookmarks(),selectedText(){if(j$1)return xa(se,j$1);let{from:c,to:h}=gr();return Pl(se,c,h,Fe())},copyFlavours:()=>RT(),pasteRich:(c,h)=>ET(c,h),armForcePlainPaste:OT,deleteSelection(){let c=Wn();return c.ops.length===0?false:(_e(()=>Ge$1(c.ops,We(),jn(c.collapseTo)),()=>Ze(c.collapseTo)),true)},setCellSelection:Hp,layoutSession:()=>y,undo:()=>{if(Ke==="view"||bn(e$1)){Q=u,n$1.onChange?.(lt());return}if(Ie$1(),i){i.undo()&&Gi(null);return}let c=a.packageRevision(),h=a.undo();a.packageRevision()!==c&&Gi(h);},redo:()=>{if(Ke==="view"||bn(e$1)){Q=u,n$1.onChange?.(lt());return}if(Ie$1(),i){i.redo()&&Gi(null);return}let c=a.packageRevision(),h=a.redo();a.packageRevision()!==c&&Gi(h);},sectionAtPage:Ae,activeScope:()=>{let c=ye?.activeNoteScope();return c||ce.activeScope()},setActiveScope:c=>(qe(),c.kind==="note"?ye.enterNote(c.id):c.kind!=="body"&&c.kind!=="headerFooter"?false:(ye?.exitNote(),ce.setActiveScope(c))),insertNote:c=>(qe(),ye.insertNote(c)),deleteNote:(c,h)=>ye.deleteNote(c,h),convertNote:(c,h)=>ye.convertNote(c,h),convertAllNotes:c=>ye.convertAllNotes(c),setNoteProperties:c=>ye.setNoteProperties(c),enterNote:(c,h)=>(qe(),ye.enterNote(c,h)),exitNote:()=>(qe(),ye.exitNote()),notePropertiesState:()=>{let c=Le.state().selection.head.paragraphId,h=a.packageRevision(),w=a.currentPackage(),F=a.part(),H=Qf$1(w),U=$f$1(w,"footnote"),X=$f$1(w,"endnote"),re=Le.activeScope().kind==="headerFooter",me=Le.headerFooterState(),Se=me?.rId??null,Pe=me?.sectionIndex??null,fe=Je;if(fe&&fe.packageRevision===h&&fe.paragraphId===c&&fe.bodyPart===F&&fe.settingsPart===H&&fe.footnotesPart===U&&fe.endnotesPart===X&&fe.headerFooterOpen===re&&fe.headerFooterRId===Se&&fe.headerFooterSectionIndex===Pe)return fe.result;let bt=QS(Le,pt());return Je={packageRevision:h,paragraphId:c,bodyPart:F,settingsPart:H,footnotesPart:U,endnotesPart:X,headerFooterOpen:re,headerFooterRId:Se,headerFooterSectionIndex:Pe,result:bt},bt},notePreviewText:c=>JS(a,c),applyTableCommandPlan(c){if(!c.ok)return {ok:false,code:c.code,reason:c.reason};let h=null,w=a.subscribe(F=>{F.caret&&(h=F.caret);});try{let F=We(),H=c.selection.kind==="adoptCommittedCaret";_e(()=>Ge$1(c.ops,F),H?()=>{let U=h;return U?Ze({paragraphId:U.paragraphId,offset:U.start}):null}:void 0,c.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{w();}return Q?{ok:false,code:"invalidArgs",reason:Q}:{ok:true,changed:true}},enterHeaderFooter:c=>{qe();let h=ce.enterHeaderFooter(c);if(!h)return h;let w=ce.getActive(),F=w?se.pages[w.pageIndex]:void 0;if(w&&F){let H=w.kind==="header"?F.header:F.footer,U=H?.box.y??(w.kind==="header"?F.box.y:F.box.y+F.box.height-1),X=H?.box.height??1;xa$1(U,X,{block:"nearest"});}return h},exitHeaderFooter:()=>(qe(),ce.exitHeaderFooter()),headerFooterState:()=>ce.headerFooterStateStable(a.packageRevision()),...jS({applyOps:Ge$1,commit:_e,deleteSelectionOps:CT,deleteSelectionPlan:()=>Wn(),orderedStart:Sd,selectionMark:We,collapsedAt:Ze,isHeaderFooterOpen:()=>ce?.getActive()!==null,lastRejection:()=>Q}),...WS({session:a,applyOps:Ge$1,commit:_e,storyScope:Oe,selectionMark:We,editingMode:()=>Ke,author:()=>s,trackedDate:m,decodePort:()=>lr,actorId:()=>i?.identity.actorId}),focus:()=>{O.activeElement!==P&&(P.focus({preventScroll:true}),Xe.mirrorToDom(true));},setTableInteractionLabel(c){d.resolve=c;},refreshTableInteractionLabels(){wa.refreshLabels();},destroy(){if(!va){va=true;try{Zn();}finally{O.removeEventListener("selectionchange",nm),P.removeEventListener("pointerdown",cm,{capture:true}),P.removeEventListener("keydown",Xi,{capture:true}),P.removeEventListener("beforeinput",Xi,{capture:true}),P.removeEventListener("keydown",am),P.removeEventListener("beforeinput",dm),P.removeEventListener("copy",im),P.removeEventListener("cut",sm),P.removeEventListener("paste",lm),P.removeEventListener("compositionstart",om),P.removeEventListener("compositionend",rm),O.removeEventListener("scroll",um,{capture:true}),e$1.ownerDocument.defaultView?.removeEventListener("resize",Cd$1),da?.disconnect(),fd=null,cd(),sd.destroy(),bo.destroy(),ct?.destroy(),zi?.destroy(),md?.destroy(),kd?.destroy(),wa.destroy(),qn.destroy(),Ar.destroy(),Xe.destroy(),P.removeEventListener("contextmenu",Pp),P.removeEventListener("click",Cp),P.removeEventListener("pointermove",vp),P.removeEventListener("pointerleave",wp),rd.destroy(),Ye.cancel(),Ct!==null&&clearTimeout(Ct),Ct=null,G&&G(),G=null,it.dispose(),f(P),R.destroy(),go(),na(),Kn(),wt(),e$1.replaceChildren();}}}};function Gi(c){q=null;let h=ct?.restoreAfterHistory();if(!c&&h&&(M=h),Xe.noteModelMoved(),Ve(),!c){It(Si(se,Fe(),M));return}let w={anchor:{paragraphId:c.paragraphId,offset:c.start},head:{paragraphId:c.paragraphId,offset:c.end}};It(Fe().includes(c.paragraphId)?w:Si(se,Fe(),w));}function xa$1(c,h,w){let F=Mt(e$1);if(!F||F.clientHeight===0)return false;ze$1();let H=c*l$1+e$1.offsetTop,U=h*l$1,X=w?.offsetPx??24,re=w?.block??"start",me=F.clientHeight;if(re==="nearest"||re==="centerIfNeeded"){let fe=H<F.scrollTop,bt=H+U>F.scrollTop+me;if(!fe&&!bt)return true}let Se=re==="center"||re==="centerIfNeeded"?H-Math.max(0,(me-U)/2):re==="nearest"&&H>F.scrollTop?H+U+X-me:H-X,Pe=Math.max(0,F.scrollHeight-me);return F.scrollTo({top:Math.max(0,Math.min(Se,Pe)),behavior:w?.behavior??"auto"}),Zi(),true}let{onSelectionChange:nm,onCompositionEnd:rm}=Xe,om=(...c)=>{Xe.adoptBeforeInput(),Zn(),Xe.onCompositionStart(...c);},kd=null;ct=lx({onRequest:n$1.onRequestTextFormField,onInvalidRequest:n$1.onRequestInvalidTextFormField,locale:ji.get,translate:(c,h)=>ca?.(c,h)??c,pagesLayer:P,container:e$1,part:c=>je(a,c??M.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(c=M.head.paragraphId)=>oi$1(a.settingsRoot())&&pi$1(je(a,c)??a.part(),c),selection:()=>M,select:(c,h)=>It(c,false,h?"none":"caret"),reveal:ad,editable:()=>Ke==="edit"&&!wn,apply:c=>hl(c,_e,Ge$1),save:(c,h)=>fx(c,h,{session:a,commit:_e,refusal:()=>pr(true,c,false),gate:(w,F)=>i?.gateOperations(w,F)??null,collaborationActive:i!==void 0})},r.initialTextFormInput),T0(Le,ct.fieldId),md=Sx({pagesLayer:P,part:c=>je(a,c??M.head.paragraphId)??a.part(),editable:()=>Ke==="edit"&&!wn,protected:c=>oi$1(a.settingsRoot())&&pi$1(je(a,c)??a.part(),c),selection:()=>M,select:c=>It(c,false,"none"),apply:c=>hl(c,_e,Ge$1)}),zi=uv({pagesLayer:P,settings:()=>Qf$1(a.currentPackage()),part:c=>je(a,c??M.head.paragraphId)??a.part(),editable:()=>Ke==="edit"&&!wn,select:c=>It(c,false,"none"),canApply:c=>a.editable&&pr(true,[c],false)===null,history:c=>Le[c](),apply:c=>hl(c,_e,Ge$1)});let MT=cw(Le,{...n$1,onToggleFieldCodes:()=>{qe(),wn=!wn,sn=Hn(pt()),Ye.invalidateAll(a.packageRevision(),"field-code-view"),Ye.flush();}}),am=c=>{zi?.keydown(c)||(c.defaultPrevented||Xe.adoptBeforeInput(),!(md?.keydown(c)||ct?.keydown(c))&&MT(c));},{onCopy:im,onCut:sm,onPaste:lm}=uw(Le),FT=fw(Le,{isComposing:()=>Xe.isComposing(),insertPlainText:tm,onBrowserSelectionFixup:()=>{Xe.mirrorToDom(),Xe.noteBrowserSelectionFixup();}}),dm=c=>{Xe.adoptBeforeInput(),FT(c);};O.addEventListener("selectionchange",nm);let AT=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),cm=c=>{if(c instanceof PointerEvent&&c.button!==0)return;let w=(c.target instanceof Element?c.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");K(w?{kind:"pointer",drawingNodeId:w}:{kind:"none"},true);},Xi=c=>{if(c instanceof KeyboardEvent&&AT.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"))&&D.kind==="pointer"){let w=di(Le);if(w!==null){c.preventDefault(),c.stopImmediatePropagation(),K({kind:"none"},true),Le.deleteImage(w.drawingNodeId);return}}K({kind:"none"},true);};P.addEventListener("pointerdown",cm,{capture:true}),P.addEventListener("keydown",Xi,{capture:true}),P.addEventListener("beforeinput",Xi,{capture:true}),P.addEventListener("keydown",am),P.addEventListener("beforeinput",dm),P.addEventListener("copy",im),P.addEventListener("cut",sm),P.addEventListener("paste",lm),P.addEventListener("compositionstart",om),P.addEventListener("compositionend",rm);let Td=false;function Pd(){if(Td)return;Td=true;let c=e$1.ownerDocument.defaultView?.requestAnimationFrame,h=()=>{Td=false,Zi();};c?c(h):queueMicrotask(h);}let um=c=>{let h=Mt(e$1);!h||c.target!==h||Pd();};O.addEventListener("scroll",um,{capture:true,passive:true});let Cd$1=()=>{Pd();},Rd=e$1.ownerDocument.defaultView;Rd?.addEventListener("resize",Cd$1,{passive:true}),da=typeof Rd?.ResizeObserver=="function"?new Rd.ResizeObserver(Cd$1):null;function fm(){if(!da)return;let c=Mt(e$1);c!==fd&&(da.disconnect(),fd=c,c&&da.observe(c));}fm(),kd=uS({onTextFormDoubleClick:c=>ct?.doubleClick(c)??false,onTextFormPointerUp:c=>ct?.pointerUp(c),pagesLayer:P,container:e$1,scale:()=>l$1,pageOffsetX:c=>dt?.pageOffsetX.get(c)??0,layout:()=>(la=false,pd.without(Ve),se),measurer:()=>v,selection:()=>st.shownSelection(M),setSelection:c=>It(c,false,"none"),cellSelection:()=>j$1,setCellSelection:c=>Hp(c),focus:()=>P.focus({preventScroll:true}),onSelectionSettled:()=>Fr.applyIfArmed(),activeHeaderFooter:()=>_b(ce?.getActive()??null),activeNote:()=>{let c=ye?.activeNoteScope();return c?{scopeId:c.id,pageIndex:ye?.activeNotePageIndex()??null}:null},enterHeaderFooter:c=>{qe(),ce?.enterHeaderFooter({rId:c.rId,pageIndex:c.pageIndex,sectionIndex:Ae(c.pageIndex).sectionIndex,kind:c.kind,...c.position?{position:c.position}:{}});},enterNote:(c,h,w)=>{qe(),ye?.enterNote(c,h,w);},exitNote:c=>{qe(),ye?.exitNote(c);},exitHeaderFooter:()=>(qe(),ce?.exitHeaderFooter()),enterEmptyHeaderFooter:(c,h)=>{if(Ke==="view")return;qe();let{sectionIndex:w,sectionStart:F}=Ae(h),H=a.headerFooterResolutionBySection(),U=H[Math.min(w,Math.max(0,H.length-1))],X=se.pages[h]?.pageFieldSource?.pageNumber??h+1,re=U?.evenAndOddHeaders&&X%2===0?"even":U?.titlePage&&h===F?"first":"default",me=Pe=>{let fe=Pe[Math.min(w,Math.max(0,Pe.length-1))];return c==="header"?fe?.headers:fe?.footers},Se=me(H)?.get(re)?.rId;if(!Se){if(!Le.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:w,kind:c,variant:re,...re==="first"?{titlePage:true}:{},...re==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;Se=me(a.headerFooterResolutionBySection())?.get(re)?.rId,Ve();}Se&&ce?.enterHeaderFooter({rId:Se,pageIndex:h,sectionIndex:w,kind:c,variant:re});},onContentControlWidget:(c,h)=>iT(c,h),...n$1.reviewModel?{onChangeBarToggle:An.toggleByChangeBar}:{},isReadOnlyPosition:c=>Jt(a.part(),c)!==void 0},n$1.pointer?{mode:n$1.pointer}:{});let wa=rS({pagesLayer:P,furnitureLayer:k,scale:()=>l$1,pageOffsetX:c=>dt?.pageOffsetX.get(c)??0,read:()=>({layout:se,storeRevision:a.packageRevision(),selection:M,cellSelection:j$1,editingMode:Ke,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:c=>Le.applyTableCommandPlan(c),label:c=>d.resolve(c)});if(yt(),zi?.sync(),mo=true,Wi(),i&&(na=i.subscribeStatus(()=>{n$1.onChange?.(lt());})),i&&St)try{Kn=i.attach(St);}catch{try{i.destroy();}catch{}}return vo(),ud(),Le.setTableInteractionLabel=c=>{d.resolve=c,wa.refreshLabels();},Le.refreshTableInteractionLabels=()=>{wa.refreshLabels();},Vv(Le,()=>({measurer:n$1.measurer,producer:n$1.producer,fontAlias:n$1.fontAlias,defaultFontFamily:n$1.defaultFontFamily}),c=>{n$1={...n$1,...c},v=n$1.measurer??g$1.measurer,T=I();},()=>{va||(sn=Hn(pt()),Kt=void 0,dt=void 0,mr=null,Ye.invalidateAll(a.packageRevision(),"fonts"),Ye.flush());}),dv(Le,()=>Xe.isComposing()),{ok:true,surface:Le}}var nI=new WeakMap;function QM(e){return !(!e.story||e.origin===b$2.mutationUndo||e.origin===b$2.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.some(t=>t!==g$1.story))}function JM(e,t){QM(t)||(e.summaries=null);}function e1(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>JM(t,n)));}function oI(e){}function aI(e,t){let n=nI.get(e);return n||(n={summaries:null,subscribed:false},nI.set(e,n)),e1(e,n),n.summaries||(n.summaries=t()),n.summaries}var t1=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function n1(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function r1(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Tt(t)){let o=Wt(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(n1(t)){if(!Tt(t.from)||!Tt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=Wt(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=Wt(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 Qf(e,t){let n=t1.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=to(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=r1(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 o1="http://schemas.microsoft.com/office/word/2010/wordml",a1="http://schemas.microsoft.com/office/word/2012/wordml";function io(e){return Jd(e)}function Oi(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function i1(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===da)return t.value}}function Jf(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return i1(n)}}function s1(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=l1(t);if(n!==void 0)return n}return "richText"}function l1(e){if(e.kind==="textValue")return;let t=e.kind,n=e.localName,r=e.namespaceUri;if(t==="contentControlDropDownList"||n==="dropDownList")return "dropdown";if(t==="contentControlComboBox"||n==="comboBox")return "comboBox";if(t==="contentControlDate"||n==="date")return "date";if(n==="picture")return "picture";if(n==="docPartList")return "buildingBlockGallery";if(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===o1||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===a1)return "repeatingSection"}function Vl(e){let t=Jf(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function d1(e,t){if(Vl(Oi(t)))return true;let n=Ia$1(e,t.id);for(;n;){if(io(n)&&Vl(Oi(n)))return true;n=Ia$1(e,n.id);}return false}function tp(e,t){let n=Oi(e),r=Jf(n,"tag"),o=Jf(n,"alias"),a=t?d1(t,e):Vl(n);return {id:e.id,controlType:s1(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var iI=new WeakMap;function c1(e,t){let n=[],r=Ia$1(e,t.id);for(;r;)io(r)&&n.push(`${r.id}:${Vl(Oi(r))?1:0}`),r=Ia$1(e,r.id);return n.join("|")}function lI(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function u1(e){return Object.freeze(e.map(t=>lI(t)))}function f1(e,t){let n=e.node,r=Oi(n),o=c1(t,n),a=iI.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=lI(tp(n,t));return iI.set(n,{properties:r,lockAncestors:o,summary:i}),i}function p1(e){let t=Qc$1(e.root);return oI(t.length),t.map(n=>f1(n,e))}function m1(e){return u1(e.storyParts().flatMap(t=>p1(t)))}function g1(e){return aI(e,()=>m1(e))}function ep(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 h1(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,a,i)=>{if(i>=la$2)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=_e(e,l);continue}if(na(l)){s=n(l.children,s,a,i+1);continue}if(io(l)){let d=s,u=a+1;s=n(Ic$1(l),s,u,i+1),t.push({control:l,start:d,end:s,depth:u});continue}s+=_e(e,l);}return s};return n(e.children,0,-1,0),t}function np(e,t,n){return h1(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>tp(r.control,n))}function rp(e,t){let n=[],r=Ia$1(e,t);for(;r;)io(r)&&n.push(tp(r,e)),r=Ia$1(e,r.id);return n.reverse()}function dI(e,t){if(!e)return [];let n=g1(e.session);return t?n.filter(r=>ep(r,t)):n}function op(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=je(e.session,n)??e.session.part(),a=Ha(o,n);if(a&&a.kind==="paragraph"){for(let s of np(a,r,o))if(ep(s,t))return s}let i=rp(o,n);for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(ep(l,t))return l}return null}function ap(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function y1(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function b1(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function v1(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 jl(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||io(n))&&t.push(n);return t}function x1(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...jl(r.children));return t}function w1(e){return e.kind==="table"?x1(e):io(e)?jl(Ic$1(e)):e.kind==="body"?jl(e.children):[]}function S1(e,t,n){if(io(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of np(t,r,e))return {ok:true,controlId:i.id};let a=rp(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 I1(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=v1(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=jl(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=w1(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=S1(e,o,t.offset);return a.ok?a:{...a,target:t}}function k1(e,t,n){let r=Wt(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=Ha(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 np(a,i,o))return {ok:true,controlId:d.id};let l=rp(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 cI(e,t){if(t===void 0){let r=op(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(b1(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return y1(t)?I1(n,t):Tt(t)?k1(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function uI(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 fI(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 pI(e,t){return {ok:false,code:uI(e),reason:fI(e),...t!==void 0?{target:t}:{}}}function T1(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 ip(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function sp(e,t,n,r){let o=T1(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=Qf(t,e);return s.ok?sI(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let a=cI(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 sI(t,i,a.controlId)}function sI(e,t,n){let r=je(e.session,n)??e.session.part(),o=Qf$1(e.session.currentPackage()),a=mi$1(o,t)??vi$1(r,o,t)??_i(r,t);return a?{ok:false,code:uI(a),reason:fI(a)}:{ok:true}}function mI(e,t,n,r){t?.flushPendingInput();let o=sp(e,t,n,r);return o.ok?P1(t,e):o}function gI(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 P1(e,t){if(t.type==="insertContentControl")return C1(e,t);let n=cI(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=to(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=gI(e,[o],r,r,ht(e.session,n.controlId,{kind:"body"}));return a.rejected?pI(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function C1(e,t){e.flushPendingInput();let n=Qf(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=to(e.state().selection),s={paragraphId:r,start:o,end:a},l=gI(e,[n.op],i,s,ht(e.session,r,{kind:"body"}));return l.rejected?pI(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}function hI(e,t,n){switch(n.type){case "selectedText":return e?.selectedText()??"";case "selectionFormatting":return e?t():null;case "selection":return Js(e);case "paragraphs":return K0(e,n.container);case "isInsideToc":return z0(e);case "hyperlinkAt":return q0(e);case "contentControls":return dI(e,n.filter);case "trackedChanges":case "revisions":case "findText":case "comments":return [];case "styles":return {paragraph:new Map,character:new Map,table:new Map};case "variables":return {};case "contentControlAt":return op(e,n.filter);case "tableContext":return tl(e);default:return null}}var yI=new WeakMap;function bI(e){let t=yI.get(e);if(!t)throw new Error("External refresh requires a mounted createDocxEditor instance.");return t}function vI(e,t){let n=null,r=null,o={...t,epoch:0,revision:0,mountedRevision:0,source:void 0,invalidated:new Set,cancel(){if(!r||r.mountedRevision!==null)return;t.cancelLoad();let a=r;r=null,Er(a.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,a.resolve(false);try{t.changed();}catch{}},invalidate(){o.cancel(),o.epoch++,n=null,r&&(Er(r.container,false),r.resolve(false),r=null),o.source=void 0;for(let a of o.invalidated)a();},contentMounted(a){r?.bytes===a&&(r.mountedRevision=o.revision);},mounted(a,i){if(!r||r.bytes!==a)return;let s=r,l=!i&&!!t.surface();o.mountedRevision=s.mountedRevision??o.revision,l?n=null:n={top:s.top,left:s.left};let d=Mt(s.container);if(l&&d&&(d.scrollTop=Math.max(0,Math.min(s.top,d.scrollHeight-d.clientHeight)),d.scrollLeft=Math.max(0,Math.min(s.left,d.scrollWidth-d.clientWidth)),d.dispatchEvent(new Event("scroll"))),r===s){r=null,Er(s.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,s.resolve(l);try{t.changed();}catch{}}},replace(a,i){let s=t.container();if(!s||r)return Promise.resolve(false);let l=Mt(s);return new Promise(d=>{r={bytes:a,resolve:d,container:s,top:i==="recovery"&&n?n.top:l?.scrollTop??0,left:i==="recovery"&&n?n.left:l?.scrollLeft??0,mountedRevision:null},o.source=i,Er(s,true),t.surface()?.setEditable(false);try{t.load(a);}catch(u){o.mounted(a,u);}})}};return e.on("change",a=>{a.source||o.revision++;}),yI.set(e,o),o}function xI(e,t,n,r,o){let a=new Map,i=pa$2(e,{resolveFont:l=>{let d$1=l.fontFamily??t.defaultFont.family;if(d$1.trim().length===0)return null;let u={family:d$1,weight:l.bold?700:400,style:l.italic?"italic":"normal"},f=g$2(u);if(a.has(f))return a.get(f)??null;let p;try{p=e.fonts.resolve(u);}catch{return a.set(f,null),null}let m=p instanceof d?null:p;return a.set(f,m),m},fallback:n.measurer}),s=`shaped:${e.operation.extensionFingerprint}+algorithm:${e.operation.shapingHash}+producer:${e.operation.producerVersion}+fallback:${n.producer}@scale:${r}+fonts:${o}`;return {measurer:i,producer:s}}function wI(e,t){let n,r=false,o=()=>{r=false;let i=e();if(!i)return;let s=n?.generation!==i.generation;s&&(n={generation:i.generation,requested:new Set,running:false});let l=n;if(l.running||!s&&!i.dynamic)return;let d=i.dynamic?i.families().filter(u=>!l.requested.has(u.toLowerCase())):[];if(!(!s&&d.length===0)){for(let u of d)l.requested.add(u.toLowerCase());l.running=true,t(d).finally(()=>{l.running=false,n===l&&a();});}},a=(i=false)=>{if(i){o();return}r||(r=true,queueMicrotask(o));};return {schedule:a}}function lp(e){let t=[],n=(r,o)=>{let a=o.kind,i=r.handlers.kinds??e;return typeof a!="string"||!i||i.includes(a)};return {request(r){let o=t.filter(l=>n(l,r)),a=[...o].reverse().find(l=>!l.fallback)??o.at(-1);if(!a?.handlers.onRequest)return false;let{sessions:i,handlers:s}=a;return i.add(r),r.signal.addEventListener("abort",()=>i.delete(r),{once:true}),s.onRequest(r),true},register(r,o){let a={handlers:r,fallback:o?.fallback===true,sessions:new Set};return t.push(a),()=>{let i=t.indexOf(a);if(!(i<0)){t.splice(i,1);for(let s of a.sessions)s.cancel();}}}}}var R1=()=>lp();function SI(){let e=R1(),t=lp(["dropdown","comboBox","date","buildingBlockGallery"]),n=lp();return {surfaceOptions:{onRequestTextFormField:e.request,onRequestContentControlWidget:t.request,onRequestInvalidTextFormField:n.request},setters:{setTextFormFieldChrome:e.register,setContentControlWidgetChrome:t.register,setInvalidTextFormFieldChrome:n.register}}}function kI(e,t){let n=e.review;return n?{reviewModel:{...n,collectReviewItems:r=>n.collectReviewItems(e.customNodes.length>0?{...r,customNodes:e.customNodes,...e.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:t}:{}}:r)}}:{}}var E1=["all-markup","simple-markup","proposed","original"];function TI(e){let t=()=>e.placements().filter(l=>l.kind==="revision"&&(l.activatable||l.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(l=>l.kind==="revision")??[],r=l=>{let d=sf$1(e.surface().session.currentPackage()),u=n(),f=new Set(l.keys??(l.scope==="document"?u:e.visible()).filter(T=>T.kind==="revision").map(Ea)),p=new Map,m=l.scope==="document"&&l.keys===void 0;if(m){let T=e.surface().session;for(let O of T.storyParts())p.set(O.name,{scope:ht(T,O.root.id,{kind:"body"}),part:O,keys:[]});}for(let T of u){let O=e.scope(T),P=je(e.surface().session,Da(T)[0]);if(!P)continue;let B=p.get(P.name);B||(B={scope:O,part:P,keys:[]},p.set(P.name,B));let C=Ea(T);f.delete(C)&&B.keys.push(C);}let g=[],v=[...f].map(T=>({key:T,reason:"unknown-revision"})),b=[],y=[],I=0;for(let{scope:T,part:O,keys:P}of p.values()){let B=$a(O,l.action,m?void 0:P);g.push(...B.result.resolved),v.push(...B.result.skipped),I+=B.result.remaining,B.ops.length&&(O.name===d?.name?y.push({partName:O.name,ops:B.ops}):b.push({scope:T,ops:B.ops}));}return {groups:b,partOps:y,result:{resolved:g,skipped:v,remaining:I}}},o=()=>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:yn},a=l=>{if(l.type!=="navigateReviewChange"&&l.type!=="resolveAllReviewChanges"&&l.type!=="setReviewDisplayMode")return null;let d=o();if(!d.ok)return d;if(l.type==="setReviewDisplayMode")return E1.includes(l.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(l.type==="navigateReviewChange"&&!["next","previous"].includes(l.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(l.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(l.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(l.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 u=Cn(l,e.surface());if(u)return u;if(l.scope!==void 0&&!["visible","document"].includes(l.scope)||l.unsupported!==void 0&&!["skip","fail"].includes(l.unsupported)||l.keys!==void 0&&(!Array.isArray(l.keys)||l.keys.some(g=>typeof g!="string")))return {ok:false,code:"invalidArgs",reason:"invalid bulk revision selection"};let{result:f,groups:p,partOps:m}=r(l);return l.unsupported==="fail"&&f.skipped.length?{ok:false,code:"unsupported",reason:"some selected changes cannot be resolved"}:!f.resolved.length&&!p.length&&!m.length?{ok:false,code:f.skipped.length?"unsupported":"notFound",reason:"no eligible selected changes to review"}:{ok:true}};return {can:a,exec:l=>{if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(l.type))return null;e.surface()?.flushPendingInput();let d=a(l);if(!d)return null;if(!d.ok){if(l.type==="resolveAllReviewChanges"&&(d.code==="notFound"||d.code==="unsupported")&&o().ok&&!e.viewing()){let{result:v}=r(l);return {...d,revisions:{...v,resolved:[],remaining:v.remaining+v.resolved.length}}}return d}let u=e.surface();if(l.type==="setReviewDisplayMode")return e.setDisplayMode(l.mode),{ok:true,changed:false};if(l.type==="navigateReviewChange"){let v=t(),b=v.findIndex(O=>O.isActive),y=l.direction==="next"?1:-1,I=b<0?O1(v,u,y):(b+y+v.length)%v.length,T=v[I];return e.activate(T.key,!T.activatable&&T.revisionKind==="format")}if(l.type!=="resolveAllReviewChanges")return null;let{groups:f,partOps:p,result:m}=r(l),g;return u.commitReviewOps(()=>(g=u.session.applyTreeOpsAtomic(f,{partOps:p}),g),"revision-resolve"),g?.committed?(e.activate(null),{ok:true,changed:true,revisions:{...m,remaining:n().length}}):{ok:false,code:"unsupported",reason:typeof g?.reason=="string"?g.reason:"the revisions were refused"}},resolveReviewItem:(l,d)=>{let u=o();if(!u.ok)return u;if(e.viewing())return e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve"),{ok:false,code:"locked",reason:"the document is open for viewing"};let f=Cn({type:"resolveAllReviewChanges"},e.surface());if(f)return f;e.surface().flushPendingInput();let p=e.placements().find(g=>g.key===l)?.item;if(!p||p.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(p.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let m;return e.surface().commitReviewOps(()=>{let g=e.surface().session,v=je(g,Da(p)[0]);return v&&v.name===sf$1(g.currentPackage())?.name?(m=g.applyTreeOpsAtomic([],{partOps:[{partName:v.name,ops:II(p,d,v)}]}),m):(m=e.surface().session.applyTreeOps(II(p,d,e.surface().session.partFor(e.scope(p))),void 0,void 0,e.scope(p)),m)},"revision-resolve"),m?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof m?.reason=="string"?m.reason:"the revision was refused"}}}}function O1(e,t,n){let r=t.state().selection.head,o=t.session.storyParts().find(s=>r.paragraphId.startsWith(`${s.name}#`)),a=o?ki$1(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 II(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return [];if(e.revisionKind==="structural"||Mh(n.root).length>0||e.revisionKind==="format"&&Da(e).length>1)return [...$a(n,t,[Ea(e)]).ops];let o=new Set(Da(e)),a=new Map;for(let i of Yh(n)){if(!o.has(i.node.id))continue;let s=p=>i.node.attributes.find(m=>m.namespaceUri===da&&m.localName===p)?.value,l=e.addresses.find(p=>p.id===s("id")&&p.author===(s("author")??"")&&(p.date??"")===(s("date")??""));if(!l)continue;let d=i.node.localName,u=JSON.stringify([l,d]),f=a.get(u);f?f.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 dp(e){return e.kind==="comment"?e.comment.date:e.kind==="revision"?e.date:void 0}function cp(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:yn}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function PI(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}function CI(e,t,n){if(!t)return false;switch(e.type){case "toggleMark":switch(e.mark){case "bold":return t.bold===true;case "italic":return t.italic===true;case "underline":return t.underline===true;case "strike":return t.strike===true;case "superscript":return t.superscript===true;case "subscript":return t.subscript===true;default:return false}case "setAlignment":return t.alignment===(e.align==="justify"?"both":e.align);case "toggleList":return n(e.kind);default:return false}}function zl(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 M1(e){return e?.kind==="headerFooter"||e?.kind==="note"}function RI(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function Wl(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.exitNote?.(),e.exitHeaderFooter?.());}function EI(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(!Sl(e.layout(),r,o))return a;let i=t.scope.owner;if(i){let s=zl(e,i,{paragraphId:o,offset:0});if(!s.ok)return s}else Wl(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:a}let n={paragraphId:t.blockId,offset:t.start};if(M1(t.scope)){let r=zl(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"};Wl(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 OI(e,t){return {scrollToPage(n){return !Number.isInteger(n)||n<1?false:(t(),e()?.revealPage(n-1)??false)},scrollToBlock(n){if(typeof n!="string"||n.length===0)return false;t();let r=e();return r&&Wl(r,n),r?.revealParagraph(n)??false},scrollToAnchor(n){if(!Tt(n))return false;t();let r=e();if(!r)return false;r.flushPendingInput();let o=Wt(r.session.part(),r.session.paragraphAnchors(),n);return o.ok?r.revealPosition({paragraphId:o.span.nodeId,offset:o.span.start},{block:"centerIfNeeded"}):false}}}function F1(e){return e==="password"?{ok:false,code:"locked",reason:MI}:e==="other-restriction"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:e==="no-change"?{ok:false,code:"invalidArgs",reason:"the document protection is already set"}:{ok:false,code:"unsupported",reason:"document protection could not be written"}}var MI="this document is protected with a password; open it in Word to change that";function FI(e){let t=null,n=null,r=()=>{let l=e.tracking();return [l.restrictedToReadOnly,l.restrictedToComments,l.restrictedToForms,l.restrictedToTrackedChanges].join("|")},o,a=null,i=()=>{let l=e.surface();if(!l)return null;let d=l.session.settingsRoot();return (d!==o||a===null)&&(o=d,a=d?If$1(d):Hf$1),a},s=()=>{if(e.destroyed())return {ok:false,code:"notFound",reason:"the editor was destroyed"};let l=i();return l===null?{ok:false,code:"notFound",reason:"no document is loaded"}:e.hostViewOnly()?{ok:false,code:"locked",reason:"this document was opened for viewing"}:l.enforced&&l.password?{ok:false,code:"locked",reason:MI}:!l.enforced&&l.edit!=="none"&&l.edit!=="forms"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:null};return {sync(){let l=e.surface()?.session.settingsRoot()??null;if(l===n&&t!==null)return;n=l;let d=r();d!==t&&(t=d,e.adopt(e.decision()));},prime:()=>{n=e.surface()?.session.settingsRoot()??null,t=r();},state:i,isActive:()=>i()?.enforced===true,can(l){return l.type!=="toggleDocumentProtection"?null:s()??{ok:true}},exec(l){if(l.type!=="toggleDocumentProtection")return null;let d=s();if(d&&!d.ok)return d;let u=e.surface(),f=!i().enforced,p=u.applyHeaderFooterLifecycle?.({op:"setDocumentProtection",enforce:f});return p?p.ok?(e.publish(),{ok:true,changed:true}):F1(p.reason):{ok:false,code:"unsupported",reason:"document protection is not available"}}}}var A1=e=>aa(e);function LI(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=ka$1(t,A1);for(let o of t.pages){for(let a of [o.header,o.footer])a&&AI(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)AI(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function AI(e,t,n,r){for(let o of ba(t))for(let a of sa$2(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function NI(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function up(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(()=>{NI(e);});return}catch{}NI(e);}function L1(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function N1(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function DI(e){return HI(e.children)}function HI(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||Fc$2(n))&&t.push(n);return t}function D1(e){if(Fc$2(e))return HI(Ic$1(e));if(e.kind!=="table")return [];let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...DI(r));return t}function H1(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"?Fd(a):Dd(a).find(m=>r.part==="header"||r.part==="footer"?m.kind===r.part:m.kind==="note"&&nd$1(m.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=DI(s),d;for(let m=0;m<t.path.length;m+=1){let g=t.path[m];if(!Number.isInteger(g)||g<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(d=l[g],!d)return {ok:false,code:"notFound",reason:`block index ${g} is out of range`};m<t.path.length-1&&(l=D1(d));}if(!d||d.kind!=="paragraph"||!Ha(a,d.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let u=(Ui(a,d.id)??"").length,f=t.offset??(n==="start"?0:u);if(!Number.isInteger(f)||f<0||f>u)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let p={paragraphId:d.id,offset:f};return {ok:true,selection:{anchor:p,head:p}}}function Ul(e,t,n){if(L1(t))return H1(e,t,n);if(!Tt(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=Wt(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 Gl(e,t){if(!N1(t)){let o=Ul(e,t,"start");if(!o.ok)return o;let a=Ul(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=Ul(e,t.from,"start");if(!n.ok)return n;let r=Ul(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function _1(e){return e.evenPage?"even":e.firstPage?"first":"default"}function _I(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'"}:_1(e)}function fp(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?_I(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 B1(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 Mi(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}:B1(n.reason)}function Xl(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 BI(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=_I(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,s=Xl(e,n,r,a)?.rId,l=false;if(!s){let u=Mi(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=Xl(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 $I(e,t){let n=fp(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=Mi(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 qI(e,t){let n=fp(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=Mi(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=Xl(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function KI(e,t){let n=fp(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=Mi(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let s=Xl(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 ZI(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Mi(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 VI(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 jI(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 zI(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 WI(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 UI(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 GI(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 YI(e,t,n){switch(t.type){case "toggleMark":{let r=Su.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=Iu(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:js};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:su};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??su};break}case "setLineSpacing":e.setParagraphProperty("spacing",_l({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...zo("before",t.beforePt),...zo("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":if(e.type(t.text),e.state().lastRejection==="the table of contents is generated and read-only"||e.state().lastRejection===ul)return {ok:false,code:"invalidArgs",reason:e.state().lastRejection};break;case "deleteText":e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=Gl(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 BI(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return $I(e,t);case "linkHeaderFooterToPrevious":return qI(e,t);case "unlinkHeaderFooterFromPrevious":return KI(e,t);case "setHeaderFooterOptions":return ZI(e,t);case "insertPageField":return VI(e,t);case "insertNote":return jI(e,t);case "deleteNote":return zI(e,t);case "convertNote":return WI(e,t);case "convertAllNotes":return UI(e,t);case "setNoteProperties":return GI(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(!Tr(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??rr({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 up(r.text,r.html),{ok:true,changed:false}}case "cut":{let r=e.copyFlavours();up(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&&ku(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&Tt(t.anchor)?{anchor:t.anchor}:"range"in t&&Qr(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=m0(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=K1(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return ci(t)?B0(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function XI(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 ba(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function $1(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 ba(a.fragments))if(i.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function q1(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 K1(e,t){let n=ht(e.session,t.head.paragraphId,{kind:"body"}),r=ht(e.session,t.anchor.paragraphId,{kind:"body"});if(!q1(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=$1(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=XI(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:XI(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 Z1=new Set(["toggleMark","setMarkAttr","setAlignment","clearFormatting","setLineSpacing","setParagraphSpacing","setParagraphStyle","setParagraphFormat"]),Yl=class{constructor(t,n,r){this.owner=t;this.diagnose=n;this.target=r;}owner;diagnose;target;records=new WeakMap;undoEpoch=0;burst;diagnoseWrites(t,n,r=false){if(t.type!=="setMarkAttr"||!n.ok||!n.changed)return;let o=`${r}:${t.mark}:${t.attr}:${this.target()}`,a=Date.now(),i=this.burst,s=i?.key===o&&a-i.time<=250?i.count+1:1;this.burst={key:o,time:a,count:s},s===3&&this.diagnose({kind:r?"possible-fragmented-gesture":"possible-ungrouped-gesture",reason:"Three rapid formatting writes started separate groups at the same selection. For a continuous control, retain one handle with bindHistoryGroup; separate clicks may be intentional."});}begin(){let t=this.owner(),n={token:Symbol("gesture"),owner:t?new WeakRef(t):void 0,closed:false,committed:false,undoEpoch:this.undoEpoch},r=V1(n,new WeakRef(this));return this.records.set(r,n),r}owns(t){return t!==void 0&&t===this.owner()}gate(t,n){let r=n?.historyGroup;return r===void 0?null:!this.records.get(r)||r.state!=="open"?{ok:false,code:"unsupported",reason:"historyGroup must be an open handle from this editor and document"}:Z1.has(t.type)?null:{ok:false,code:"unsupported",reason:`${t.type} does not support history grouping`}}note(t){(t.type==="undo"||t.type==="redo")&&this.undoEpoch++;}run(t,n,r,o){let a=r?.historyGroup,i=a&&this.records.get(a);if(!i){let m=Ei(t,void 0,o);return this.diagnoseWrites(n,m),m}let s=i.committed,l,d,u=aj(i.token,(m,g)=>{l=m,d=g;},()=>Ei(t,i.token,o));if(!u.ok)return u;let p=l===void 0?{kind:"none",reason:"no-history"}:l==="split"||l==="started"&&s?{kind:"split",reason:d??(i.undoEpoch!==this.undoEpoch?"undo-redo":"history-boundary")}:{kind:l};return l&&(i.committed=true,i.undoEpoch=this.undoEpoch),p.kind==="started"?this.diagnoseWrites(n,u,true):this.burst=void 0,p.kind==="split"&&this.diagnose({kind:"split",reason:p.reason??"history-boundary"}),{...u,history:p}}};function V1(e,t){return Object.freeze({get state(){return !e.closed&&t.deref()?.owns(e.owner?.deref())?"open":"closed"},end(){e.closed=true,e.owner=void 0;}})}var QI={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none"};function JI(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:E0(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`}}function ek(){let e={...QI};return {moved(t,n){let r=JI(t,n),o=Ys(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=JI(t.state(),t);},reset(){e={...QI};}}}function j1(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 tk(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||j1(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 nk(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function rk(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function ok(e){return e.kind==="comment"}function ak(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 z1(e){let t=new Map;for(let n of e){let r=n.item;if(!ok(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 W1(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(ok);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 ik(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=W1(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=z1(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 sk(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 U1=Object.freeze(["Arial","Calibri","Cambria","Consolas","Courier New","Garamond","Georgia","Helvetica","Open Sans","Roboto","Times New Roman","Verdana"]),G1=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function lk(e,t){let n=new Map,r=s=>{if(s===void 0||!G1.test(s))return;let l=s.toLowerCase();n.has(l)||n.set(l,s);};r(f$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 a$8([e?.supportedFamilies]))r(s);for(let s of U1)r(s);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 dk=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),ck=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 uk(e,t){return m$1(e,t)}function pp(e,t,n){return n$1(e,t,n)}var X1="The quick brown fox 0123 \u2014 {}#@",Y1=["monospace","serif"],Q1=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function pk(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(X1).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!Q1.test(r))return t.set(r,true),true;let a=false;for(let i of Y1){let s=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==s){a=true;break}}return t.set(r,a),a}}var fk=4;function mk(e,t,n){let r=new Set,o=[];for(let u of t){let f=u.toLowerCase();r.has(f)||(r.add(f),o.push(u));}let a=u=>new Set(e.slice(0,Math.max(u,0)).map(f=>f.toLowerCase())),i=0;for(let u=0;u<=fk;u+=1){let f=a(n-i),p=o.filter(g=>!f.has(g.toLowerCase())).length,m=Math.min(p,fk,Math.floor(n/2));if(m===i)break;i=m;}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 gk(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=ba$1.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}function hk(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}var yk=new WeakMap,J1=0,eF=p((e,t)=>{if(e.kind==="paragraphProperties"){let n=yk.get(e);return n||(n=String(++J1),yk.set(e,n)),{families:[n],children:[]}}return {families:e.kind==="paragraph"&&!e.children.some(n=>n.kind==="paragraphProperties")?["default-paragraph"]:[],children:q(e,t)}});function bk(e){return eF(e,{key:""})}var vk=new WeakMap;function xk(e){let t=e.packageRevision(),n=vk.get(e);if(n?.revision===t)return n.families;let r$1=n?.eastAsianFonts??r(),o=e.storyParts().map(p=>p.root),a=e.stylesRoot(),i=e.numberingRoot(),s=e.documentThemeFonts(),l=bk(o),u=n&&n.stylesRoot===a&&n.numberingRoot===i&&n.theme===s&&n.numberingInputs.length===l.length&&n.numberingInputs.every((p,m)=>p===l[m])?n.numberingFamilies:v(o,i,a,s),f=[...e.symbolFontFamilies(),...r$1(o,a,s),...t$1(o),...u];return vk.set(e,{eastAsianFonts:r$1,revision:t,families:f,numberingInputs:l,numberingFamilies:u,numberingRoot:i,stylesRoot:a,theme:s}),f}var wk=Object.freeze({installed:0,alias:()=>{},dispose(){}});function tF(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1)t=t*31+n.charCodeAt(r)>>>0;return `docx-embedded-${t.toString(36)}`}var Ql=e=>e.trim().toLowerCase();function nF(){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 Sk(e,t=nF(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return wk;let a=new Map;for(let d of e){let u=Ql(d.request.family),f=a.get(u);f?f.push(d):a.set(u,[d]);}let i=new Map,s=[];if(await Promise.all([...a].map(async([d,u])=>{let f=tF(u.map(m=>m.hash)),p=false;await Promise.all(u.map(async m=>{try{let g=o(f,m.bytes,{weight:String(m.request.weight),style:m.request.style});await g.load(),r.add(g),s.push(g),p=!0;}catch{}})),p&&i.set(d,f);})),s.length===0)return wk;for(let d of n){let u=Ql(d.from.family);if(i.has(u))continue;let f=i.get(Ql(d.to.family));f!==void 0&&i.set(u,f);}let l=false;return {installed:s.length,alias:d=>l?void 0:i.get(Ql(d)),dispose(){if(!l){l=true;for(let d of s)try{r.delete(d);}catch{}}}}}var Fi=.1,Ai=5;var Wo={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},rF={type:"fit",fit:"pageWidth"},Jl={type:"fixed"};function ed(e){return e==="auto"?Wo:!e||typeof e!="object"?null:e.type==="fixed"?Jl:e.type==="fit"&&e.fit==="pageWidth"?td(e,Wo)?Wo:e:null}function td(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 Uo(e){return e.type==="fit"}function kk({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)?Ik(r):.1,l=Number.isFinite(o)?Ik(o):5,d=Math.floor(i/t*100)/100;return Math.min(Math.max(d,s),Math.max(l,s))}function Ik(e){return Math.min(Math.max(e,.1),5)}function oF(e){let t=Mt(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 Tk(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(!Uo(l))return;let d=e.container();if(!d)return;let u=oF(d);if(u===null)return;let f=e.pageWidthPx();if(f===null)return;o=e.pageWidthTwips();let p=kk({availableWidthPx:u,pageWidthPx:f,...l.minZoom!==void 0?{minZoom:l.minZoom}:{},...l.maxZoom!==void 0?{maxZoom:l.maxZoom}:{}});p===null||p===e.zoom()||e.applyZoom(p);}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=Mt(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 Ck(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=ed(e.zoomMode??(n!==null?Jl:"auto"))??Wo;function a(l,d){if(l===r)return d?.(),true;let u=t.surface();return u&&!Yu(u,l*(96/72))?false:(r=l,d?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=Jl,s.detach();}let s=Tk({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:()=>{Uo(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=Uo(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=ed(l);return d?td(d,o)?{ok:true,changed:false}:(o=d,Uo(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 Pk(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function Rk(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:Pk(r.box),contentBox:Pk(r.contentBox)})):[]}}}var Ek=new Map;function Ok(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$1(t)}),r.value.get(o))}}function mp(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 Mk(e){let t=mh(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 Fk(e){let t=e.mode,n=e.translate,r=n?i$2(n):h,o=Mk(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:a=>Ru(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$2(a):h;return g(r)===g(i)?(r=i,null):(r=i,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(a){let i=Mk(a);return o.locale===i.locale?null:(o=i,o.labels)}}}function Ak(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 lF=Object.freeze({kind:"body"}),dF=Object.freeze([]);function cF(e$1){let t$1,n=null,r=Fk(e$1),o=ff(e$1.author),a$2=e$1.container??null,i=a$3(e$1.modules),s=nk(i),l=i.review!==null,d$1=null,u=new WeakMap,f=tk({mount:S=>co(S),scheduled:()=>{Te(),et();}}),p=r.mode()==="view"?"viewing":"editing",m=null,g,v=false,b=Il(),y=Ok(e$1.revisionStyles),I=e(),T=false,O=false,P=null,B=()=>({reviewEnabled:l,hasAuthor:!!o}),C=false,_=null,k=w0({stillMissing:()=>!ae&&o===void 0&&Ar(null)===Pr,emit:S=>Mn(S)}),R=r.openingModeDecision(B());R.mode!==null&&(p=R.mode),R.rejection!==null&&(P=R.rejection),k.report(R.rejection);let x=null,N=null,V=null,M=null,D=ek(),K=SI(),j=mp({}),Q=mp({}),ae=false,Y,ne,oe=null,L=()=>{},A=0;function Z(){oe?.dispose(),oe=null;}let $=0,W,E=()=>typeof e$1.fonts=="function"?W:e$1.fonts,q=wI(()=>{if(ae||!x)return null;let{session:S}=x,[G]=a$8([[Ln().formatting?.fontFamily]]);return {generation:$,dynamic:typeof e$1.fonts=="function",families:()=>mk([...new Set([...G&&G!==f$1(E())?[G]:[],...S.documentFonts()])],xk(S),c$1)}},async S=>{x&&await wn($,x,S);}),z=false,J=null,ie=S=>(J||(J=pk(a$2?qo(a$2.ownerDocument):null)),J(S)),ee=new Set,de=S=>ee.has(S.toLowerCase())||oe?.alias(S)!==void 0,ce=()=>!x||z?dF:gk(x.session.renderedFontFamilies(),de,ie),ye=0,Je=null,Oe,Re=null,Ae=-1,Fe=0,De=-1,ke=false,Be="all-markup",tt=PI(S=>{x?.setShowParagraphMarks(S),Te(),et();}),He=FI({surface:()=>x,destroyed:()=>ae,editingMode:()=>p,hostViewOnly:()=>r.mode()==="view",publish:()=>{Te(),et();},decision:()=>$i(),tracking:po,adopt:S=>{P=S.rejection??Ar(null),S.mode!==null&&(O=S.mode==="viewing",qn(S.mode)),Te(),et();}});function Te(){ye+=1;}let Ft={change:new Set,selectionChange:new Set,error:new Set,historyDiagnostic:new Set};function Mn(S){for(let G of [...Ft.error])G(S);}function Go(S){for(let G of [...Ft.change])G(S);}function et(){if(Ft.selectionChange.size===0)return;let S=Ln();for(let G of [...Ft.selectionChange])G(S);}function lr(){M?.(),M=null,x?.destroy(),x=null,D.reset(),Fe+=1;}let it=Ck(e$1,{container:()=>a$2,surface:()=>x,bump:Te,emitSelectionChange:et}),dr=()=>it.scale();function co(...S){let G=t$1?.source!==void 0;try{if(n===S[0]){n=null,uo(S[0],!0);return}Ni(...S),t$1?.mounted(S[0]);}catch(te){if(t$1?.mounted(S[0],te),!G)throw te}}function Ni(S,G,te){if(te??=u.get(S),u.delete(S),!a$2){d$1=S,te&&u.set(S,te),V=null,Te();return}lr();let be=b.stateKey,he=Yf(a$2,S,{scale:dr(),showParagraphMarks:tt.get(),onToggleParagraphMarks:tt.toggle,defaultFontFamily:f$1(E()),translate:r.translate(),drawingStrings:r.drawingStrings(),locale:r.locale(),...o?{author:o}:{},...y.current()!==void 0?{revisionStyles:y.current()}:{},reviewAuthorSlots:I,revisionAuthorVisibility:b,initialSelection:G,initialTextFormInput:te,editingMode:p==="suggesting"?"suggest":p==="viewing"?"view":"edit",revisionDisplayMode:l?Be:"proposed",...kI(i,s),...Y?{measurer:Y,...ne?{producer:ne}:{}}:{},...oe?{fontAlias:oe.alias}:{},...e$1.tableInteractionLabel?{tableInteractionLabel:e$1.tableInteractionLabel}:{},...e$1.imageDecodePort?{imageDecodePort:e$1.imageDecodePort}:{},...i.collaboration?{collaborationModel:i.collaboration}:{},onHyperlinkPopover:Ee=>j.current().onPopover?.(Ee),...K.surfaceOptions,onRequestHyperlink:()=>j.current().onRequest?.(),onEquationPopover:Ee=>Q.current().onPopover?.(Ee),onTrackedChange:()=>{ke||(ke=true,Te(),et());},tocLabels:r.tocLabels(),onChange:Ee=>{if(!x)return;Te(),He.sync(),q.schedule();let Ne=l&&Be!==x.revisionDisplayMode();Ne&&(Be=x.revisionDisplayMode());let xe=be!==b.stateKey||Ne;be=b.stateKey,!(!xe&&!D.moved(Ee,x))&&et();}});if(!he.ok){V=he.detail?`${he.reason}: ${he.detail}`:he.reason,Te(),Mn(Ut(he.reason,`failed to open document: ${V}`));return}V=null,x=he.surface,He.prime(),ke=l&&x.session.reviewItems().length>0,D.adopt(x),_!==null?Gt(_,false):rd(),rk(x,i),Fe+=1,x.setEditable(p!=="viewing"),N!==null&&x.setRemoteCaretLabelHost(N),m!==null&&x.setReviewActivationExclusions(m,{formattingKinds:g}),M=he.surface.session.subscribe(Ee=>{let Ne={revision:he.surface.session.packageRevision(),created:Ee.created,deleted:Ee.deleted,dirty:Ee.dirty};it.refitIfPageResized(),Te(),Go(Ne);}),t$1?.contentMounted(S),it.attach(),Te(),Go({revision:x.session.packageRevision(),source:t$1?.source??"load"}),et(),q.schedule(true);}function uo(S,G=false){if(f.cancel(),n=null,t$1?.source&&!G&&a$2&&f.shouldYield(S)){n=S,f.schedule(S);return}if(u=new WeakMap,ke=false,$+=1,I=e(),b.showAll(),Y=void 0,ne=void 0,W=void 0,ee=new Set,Z(),L(),L=()=>{},z=false,a$2&&!t$1?.source){let te=Mt(a$2);te&&(te.scrollTop=0,te.scrollLeft=0);}!G&&a$2&&f.shouldYield(S)?f.schedule(S):co(S);}function Fn(S){(S.code==="wasmUnavailable"||S.cause instanceof t&&S.cause.code==="unsupportedRuntime")&&!e$1.onFontError&&Ft.error.size===0&&oy(S);try{e$1.onFontError?.(S);}catch{}Mn(S);}async function wn(S,G,te){let be=e$1.fonts,he=G.session.embeddedFonts();if(!(!be&&he.length===0)){z=true,Te();try{let Ee={families:te,defaultFamily:f$1(E())},Ne=typeof be!="function"?be:W?await k$2([W,i$1(ze=>be(ze))],Ee,{onOriginFailure:({cause:ze})=>Fn(Oo(ze))}):await be(Ee),xe=typeof be=="function"?b$3(Ne):Ne;if(ae||S!==$){S===$&&(z=!1);return}if(W=Ne,he.length===0&&(!xe||Ne?.supportedFamilies?.length&&!b$3(Ne))){z=!1,Te(),et();return}let ue=(xe&&"maxFontBytes"in xe?xe.maxFontBytes:void 0)??a$1,Ie=uk(xe?.sources??[],ue),Me=Ie.sources;for(let ze of Ie.dropped)Fn(dk(ze));let mt=pp(he,Me,ue),Ye=!1,ln=()=>{if(!Ye){Ye=!0;for(let ze of mt.dropped)Fn(ck(ze));}},wt=e$2({epoch:S,...xe,sources:Me},mt);if(wt.sources.length===0){ln(),z=!1,Te(),xe&&Fn(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let St=await Qa(wt),Kn=()=>!ae&&S===$?!1:(H(St),S===$&&(z=!1),!0);if(Kn())return;let na=ze=>{ln(),ze&&H(ze),z=!1,Te();},mo=(ze,Ve)=>{let yo=new Set;for(let Nr of Ve.sources??[]){let qe=ze.fonts.resolve(Nr.request);qe instanceof d&&(Fn(Oo(qe)),yo.add(g$2(Nr.request)));}return yo},Lr=mo(St,wt);try{if(Lr.size>0){let ze=Me.filter(Zn=>!Lr.has(g$2(Zn.request))),Ve=ze.length!==Me.length;Ve&&(mt=pp(he,ze,ue));let yo=mt.sources.filter(Zn=>Ve||!Lr.has(g$2(Zn.request))),Nr=St;if(wt=e$2({epoch:S,...xe,sources:ze},{sources:yo}),wt.sources.length===0)return na(Nr);if(St=await Qa(wt),H(Nr),Kn())return;let qe=mo(St,wt);if(qe.size>0){let Zn=ze.filter(aa=>!qe.has(g$2(aa.request))),Dr=mt.sources.filter(aa=>!qe.has(g$2(aa.request))),oa=St;if(wt=e$2({epoch:S,...xe,sources:Zn},{sources:Dr}),wt.sources.length===0)return na(oa);if(St=await Qa(wt),H(oa),Kn())return}}}finally{ln();}let ra=wt.sources.map(ze=>{let Ve=St.fonts.resolve(ze.request);return Ve instanceof d||Ve.id!==ze.id?null:{request:ze.request,id:Ve.id,bytes:Ve.bytes,hash:Ve.hash,faceIndex:Ve.faceIndex}}).filter(ze=>ze!==null),go=await Sk(ra,void 0,wt.substitutions??[]);if(ae||S!==$){go.dispose(),Kn();return}let ho={embeddedFaces:oe,coveredFontFamilies:ee,shapedMeasurer:Y,shapedProducer:ne,disposeShapedFonts:L};try{oe=go,ee=hk(ra,wt.substitutions??[]);let ze=ea(dr(),{context:a$2?qo(a$2.ownerDocument):null,...oe?{fontAlias:oe.alias}:{}}),Ve=xI(St,wt,ze,dr(),++A);if(Y=Ve.measurer,ne=Ve.producer,z=!1,x&&jv(x,{measurer:Y,producer:ne,fontAlias:oe?.alias,defaultFontFamily:f$1(E())}),ae||S!==$){go.dispose(),H(St);return}}catch(ze){throw !ae&&S===$&&({embeddedFaces:oe,coveredFontFamilies:ee,shapedMeasurer:Y,shapedProducer:ne,disposeShapedFonts:L}=ho),go.dispose(),H(St),ze}L=()=>H(St),ho.disposeShapedFonts(),ho.embeddedFaces?.dispose(),Te(),et();}catch(Ee){if(ae||S!==$)return;z=false,Te(),Fn(Oo(Ee));}}}let An=xu();function nd(){let S=x?.state()??null;return {scope:x?.activeScope?.()??lF,isLoading:V===null&&x===null&&d$1===null&&!f.isScheduled(),isOpening:f.isScheduled()&&!t$1?.source,parseError:V,editable:x!==null&&x.session.editable&&r.mode()!=="view"&&p!=="viewing"&&!(a$2&&bn(a$2)),zoom:it.zoom(),zoomMode:it.mode(),selection:Js(x),selectionCollapsed:S===null||S.selection.anchor.paragraphId===S.selection.head.paragraphId&&S.selection.anchor.offset===S.selection.head.offset,formatting:$0(x),table:tl(x),tocContext:An(S?.contextTocId??null),image:Rn(x),page:{current:Vu(x),total:Zu(x)},canUndo:S?.canUndo??false,canRedo:S?.canRedo??false,pageSetup:Ku(x),reviewPaneOpen:ke,showParagraphMarks:tt.get(),documentProtection:He.state(),reviewDisplayMode:x&&l?x.revisionDisplayMode():Be,hasReviewContent:x?.session.hasReviewContent()??false,hiddenReviewAuthors:b.hiddenAuthorList,collaborationStatus:S?.collaborationStatus??"inactive",editingMode:p,lastRejection:P??S?.lastRejection??null,fontSubstitutions:ce(),formatPainter:S?.formatPainter??zs}}let At;function Ln(){if(Je&&De===ye)return Je;let S=Je,G=E()===At;At=E();let te=o===Oe;Oe=o;let be=x?.state().selection??null,he=Ys(be,Re);Re=be;let Ee=x?.session.packageRevision()??-1,Ne=Ee===Ae;Ae=Ee;let xe=nd(),ue=xe;if(S){let Ie=hu(xe.formatting,S.formatting)?S.formatting:xe.formatting,Me=yu(xe.page,S.page)?S.page:xe.page,mt=bu(xe.pageSetup??null,S.pageSetup??null)?S.pageSetup:xe.pageSetup,Ye=vu(xe.selection,S.selection)?S.selection:xe.selection,ln=A0(xe.image,S.image)?S.image:xe.image,wt=S.fontSubstitutions!==void 0&&xe.fontSubstitutions!==void 0&&S.fontSubstitutions.length===xe.fontSubstitutions.length&&xe.fontSubstitutions.every((St,Kn)=>S.fontSubstitutions[Kn]===St)?S.fontSubstitutions:xe.fontSubstitutions;ue={...xe,formatting:Ie,page:Me,pageSetup:mt,selection:Ye,image:ln,fontSubstitutions:wt},wu(ue,S)&&he&&Ne&&te&&G&&(ue=S);}return Je=Xs(ue),De=ye,Je}if(e$1.document){let S=Tu(e$1.document);S?uo(S):(V=Pu(e$1.document),Mn(Ut("unsupported",V)));}let Nn=Fx({surface:()=>x,activeKey:fo,paneOpen:()=>ke,selectionAnchor:()=>Jo()?.anchorY??null,authorFilterKey:()=>b.stateKey});function st(S){return S.kind==="revision"?S.ranges[0]??null:S.range}function pt(S){return st(S)===null?false:!(S.kind==="revision"&&m!==null&&m.includes(S.revisionKind)&&(S.revisionKind!=="format"||g===void 0||g.includes(S.formattingKind??"")))}let Xo=LI(),sn=new WeakMap;function Di(S){let G=sn.get(S);if(G)return G;let te=new Map;for(let be of S.pages)for(let he of [be.footnotes,be.endnotes])if(he)for(let Ee of he.notes)for(let Ne of ba(Ee.fragments))for(let xe of sa$2(Ne))te.has(xe)||te.set(xe,Ee.scopeId);return sn.set(S,te),te}function Dn(S){let G=st(S)?.partName;if(!G||!x||G===x.session.part().name)return null;for(let te of x.session.headerFooterResolutionBySection())for(let be of ["header","footer"]){let he=be==="header"?te.headers:te.footers;for(let Ee of he.values())if(Ee.partName===G)return {kind:be,rId:Ee.rId}}return null}function Hn(S){let G=st(S),te=x?.publishedLayout();return !G||!te?null:Di(te).get(G.start.paragraphId)??null}function cr(S){let G=st(S)?.partName;if(!G||!x)return null;for(let te of ["footnote","endnote"])if($f$1(x.session.currentPackage(),te)?.name===G)return {kind:"notesPart",noteKind:te};return null}function se(S){let G=Dn(S);return G!==null?{kind:"headerFooter",rId:G.rId}:cr(S)??{kind:"body"}}let _n=()=>`${new Date().toISOString().slice(0,19)}Z`,Yo=new WeakMap;function Hi(S){let G=Yo.get(S);if(G)return G;let te=new Map;for(let[be,he]of ua$2(S).entries())te.set(he,be);return Yo.set(S,te),te}function Bn(){return ak({surface:x,bodyOrder:()=>{let S=x?.publishedLayout();return S?Hi(S):new Map},openStoryOrder:Fr})}function Qo(){let S=x?.activeScope();if(S?.kind==="headerFooter")return {kind:"headerFooter",rId:S.rId};if(S?.kind==="note"){let G=ed$1(S.id);if(G)return {kind:"notesPart",noteKind:G.noteKind}}return {kind:"body"}}function _i(S){if(!x)return {kind:"body"};let G=S.slice(0,S.indexOf("#"));if(G.length===0||G===x.session.part().name)return {kind:"body"};for(let te of x.session.headerFooterResolutionBySection())for(let be of [te.headers,te.footers])for(let he of be.values())if(he.partName===G)return {kind:"headerFooter",rId:he.rId};for(let te of ["footnote","endnote"])if($f$1(x.session.currentPackage(),te)?.name===G)return {kind:"notesPart",noteKind:te};return Qo()}function Fr(){if(!x)return new Map;let S=Qo();if(S.kind==="body")return new Map;let G=new Map;for(let[te,be]of x.session.paragraphIdsIn(S).entries())G.set(be,te);return G}function Bi(S){if(S.kind==="revision"){let te=S.ranges;if(te.length===0)return null;let he=S.revisionKind==="replace"||S.revisionKind==="insert"||S.revisionKind==="delete"?te[te.length-1]:te[0];return {start:te[0].start,end:he.end}}let G=st(S);return G?{start:G.start,end:G.end}:null}function Jo(){if(x&&x.activatedReviewKey()!==null)return null;let S=Bn(),G=x?.publishedLayout();if(!S||!G)return null;let te=Xo(G).get(S.from.paragraphId);return te?{pageIndex:te.pageIndex,anchorY:te.contentY+ja(te,S.from.paragraphId,S.from.offset)}:null}function fo(){return x?.activeReviewKey()??null}function $n(S){if(!l)return [];let G=mf(x?.session.reviewItems()??[],b),te=S?.excludeRevisionKinds;if(te&&te.length>0){let ue=new Set(te);G=G.filter(Me=>Me.kind!=="revision"||!ue.has(Me.revisionKind));let Ie=new Set(G.filter(Me=>Me.kind==="revision").map(Me=>Me.id));G=G.map(Me=>{if(Me.kind!=="comment"||Me.parentRevisionId===void 0||Ie.has(Me.parentRevisionId))return Me;let{parentRevisionId:mt,...Ye}=Me;return Ye});}let be=S?.placement!==false,he=null;if(be&&G.length>0){let ue=x?.publishedLayout()??null;ue&&(he=Xo(ue));}let Ee=fo(),Ne=ue=>{let Ie=Dn(ue);return Ie===null?1:Ie.kind==="header"?0:2},xe=G.map((ue,Ie)=>({item:ue,position:Ie,pageIndex:he?la$1(ue,he)?.pageIndex??null:null,group:Ne(ue)}));return xe.sort((ue,Ie)=>{let Me=ue.pageIndex??Number.MAX_SAFE_INTEGER,mt=Ie.pageIndex??Number.MAX_SAFE_INTEGER;return Me!==mt?Me-mt:ue.group!==Ie.group?ue.group-Ie.group:ue.position-Ie.position}),xe.map(({item:ue})=>{let Ie=Ea(ue),Me=he?la$1(ue,he):null,mt={key:Ie,id:ue.id,...dp(ue)!==void 0?{date:dp(ue)}:{},activatable:pt(ue),anchorY:Me?.y??null,pageIndex:Me?.pageIndex??null,isActive:Ie===Ee};return ue.kind==="comment"?{...mt,kind:"comment",author:ue.comment.author,initials:Ma(ue.comment),text:La$1(ue.comment),resolved:ue.resolved,...ue.parentId!==void 0?{parentId:ue.parentId}:{},...ue.parentRevisionId!==void 0?{parentRevisionId:ue.parentRevisionId}:{},replyIds:ue.replyIds,readOnly:false,item:ue}:ue.kind==="revision"?{...mt,kind:"revision",revisionKind:ue.revisionKind,author:ue.author,initials:Ix(ue.author),text:ue.text,...ue.replacedText?{replacedText:ue.replacedText}:{},replyIds:ue.replyIds,readOnly:ue.readOnly||C0(x),item:ue}:{...mt,kind:"custom",author:"",initials:"",text:ue.detail??ue.text,replyIds:[],readOnly:true,item:ue}})}function po(){return x?.session.trackingSettings()??Kg}function $i(S=p,G=T){let te=po();return Ou({...B(),viewOnly:r.mode()==="view",hostChoseMode:r.mode()!==void 0,readerChoseMode:G,currentMode:S,trackRevisions:te.trackRevisions,restrictedToTrackedChanges:te.restrictedToTrackedChanges,restrictedToForms:te.restrictedToForms,restrictedToReadOnly:te.restrictedToReadOnly,restrictedToComments:te.restrictedToComments,engineAdoptedViewing:O})}function qn(S){_=null,p=S,x?.setEditingMode(S==="suggesting"?"suggest":S==="viewing"?"view":"edit"),x?.setEditable(S!=="viewing");}function Ar(S){return S!==null?S:p==="suggesting"&&o===void 0?Pr:C?Pr:T?null:r.openingModeDecision(B()).rejection}function rd(){let S=$i();P=Ar(S.rejection),S.mode!==null&&(O=S.mode==="viewing",qn(S.mode));}function Gt(S="editing",G=true){if(f.isScheduled()){_=S;return}_=null;let te=I0(r.mode(),B(),po(),p,S,O);O=te.mode==="viewing"&&r.mode()!=="view",te.mode!==p&&qn(te.mode),P=Ar(te.rejection),k.report(te.configurationRejection),G&&(Te(),et());}function ur(S){return r.mode()==="view"&&S!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(S==="suggesting"?Eu(B()):null)??Mu(po(),S)}let ea$1=TI({surface:()=>x,enabled:()=>l,destroyed:()=>ae,viewing:()=>p==="viewing",placements:()=>$n(),visible:()=>mf(x?.session.reviewItems()??[],b),scope:se,activate:(S,G)=>{v=G??false;try{return qt.setActiveReviewItem(S)}finally{v=false;}},setDisplayMode:S=>{Be=S,x?.setRevisionDisplayMode(S),Te(),et();}}),{resolveReviewItem:ta}=ea$1,Ct=new Yl(()=>x,S=>{for(let G of [...Ft.historyDiagnostic])G(S);},()=>JSON.stringify(x?.state().selection)),qt={beginHistoryGroup(){return f.flush(),Ct.begin()},get mountGeneration(){return Fe},get surface(){return x},...K.setters,setHyperlinkChrome:j.push,setEquationChrome:Q.push,stateVersion:()=>ye,fontMeasurement:()=>({measurer:Y?"shaped":"fixed",resolving:z,...Y&&ne?{producer:ne}:{}}),attach(S){if(a$2!==S&&t$1?.invalidate(),ae){Mn(Ut("destroyed","this editor was destroyed; create a new instance to remount"));return}if(x&&a$2===S)return;if(x){x.flushPendingInput(),d$1=x.session.save();let be=a$2?nf(a$2):void 0;be&&u.set(d$1,be),lr();}let G=f.cancel();G&&(d$1=G),it.detach(),a$2=S,J=null;let te=d$1;d$1=null,te&&f.shouldYield(te)?f.schedule(te):te?co(te):Te();},detach(){if(t$1?.invalidate(),ae)return;it.detach();let S=f.cancel();if(x){x.flushPendingInput(),d$1=x.session.save();let G=a$2?nf(a$2):void 0;G&&u.set(d$1,G),lr();}S&&(d$1=S),a$2=null,J=null,Te();},load(S){let G=Tu(S);if(!G){Mn(Ut("unsupported",Pu(S)));return}t$1?.invalidate(),uo(G);},save(){return f.flush(),cx(x,a$2,()=>x)},getDocumentHandle(){return Object.freeze({revision:x?.session.packageRevision()??0})},exec(S,G){if(a$2&&bn(a$2))return {ok:false,code:"unsupported",reason:"An external document refresh is in progress."};f.flush();let te=Ct.gate(S,G);if(te)return te;Ct.note(S);let be=cp(S,ae,l,ur);if(ae&&be&&!be.ok)return be;if(S.type==="setEditingMode"){let Me=ur(S.mode);return Me!==null?(Me.reason===Pr&&(C=true,P=Me.reason,k.report(Me.reason),Te(),et()),Me):(T=true,C=false,P=null,qn(S.mode),Te(),et(),{ok:true,changed:false})}if(S.type==="toggleParagraphMarks")return tt.toggle(),{ok:true,changed:false};if(S.type==="toggleReviewPane")return l?(ke=!ke,Te(),et(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:yn};let he=He.exec(S);if(he)return he;let Ee=ea$1.exec(S);if(Ee)return Ee;if(ap(S))return mI(S,x,ip(p),G);let Ne=ri(S);if(p==="viewing"&&Ne.supported&&Ne.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let xe=mi(S,x,r.modeForGate(),G);if(!xe.ok)return xe.refusal;let ue=x,Ie=ue.session.packageRevision();return Ct.run(ue,S,G,()=>{let Me=YI(ue,S,{...xe.tablePlan?{admittedTablePlan:xe.tablePlan}:{},editor:qt});return Me||{ok:true,changed:ue.session.packageRevision()!==Ie}})},can(S,G){if(a$2&&bn(a$2))return {ok:false,code:"unsupported",reason:"An external document refresh is in progress."};let te=Ct.gate(S,G);if(te)return te;if(S.type==="insertImage"||S.type==="replaceImage"){if(ae)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(G?.scope){let ue=mi(S,x,r.modeForGate(),G);if(!ue.ok)return ue.refusal}return _0(S,x)}let be=cp(S,ae,l,ur);if(be)return be;let he=He.can(S);if(he)return he;let Ee=ea$1.can(S);if(Ee)return Ee;if(ap(S))return sp(S,x,ip(p),G);let Ne=ri(S);if(p==="viewing"&&Ne.supported&&Ne.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let xe=mi(S,x,r.modeForGate(),G);if(!xe.ok)return xe.refusal;if(S.type==="proposeInsertion"||S.type==="proposeDeletion"||S.type==="proposeReplacement"){if(!(S.author??o??"").trim())return {ok:false,code:"invalidArgs",reason:`${S.type} requires a non-empty author`};let Ie=S.target===void 0?{ok:true,selection:x.state().selection}:Gl(x,S.target);if(!Ie.ok)return Ie;let{anchor:Me,head:mt}=Ie.selection,Ye=Me.paragraphId===mt.paragraphId&&Me.offset===mt.offset,ln=S.type==="proposeReplacement"&&S.target===void 0&&x.state().cellSelection!==null;if(S.type!=="proposeInsertion"&&Ye&&!ln)return {ok:false,code:"invalidArgs",reason:`${S.type} needs a non-collapsed selection`}}if(ci(S)&&Hu(S)){let ue=ui(qt);if(ue){let Ie=_u(qt,S,ue);if(Ie)return Ie}}return {ok:true}},isActive(S){return S.type==="toggleParagraphMarks"?tt.get():S.type==="toggleDocumentProtection"?He.isActive():S.type==="setReviewDisplayMode"?Be===S.mode:S.type==="toggleReviewPane"?ke:S.type==="setEditingMode"?p===S.mode:CI(S,x?Ln().formatting:null,G=>x?.isListActive(G)??false)},getDocumentStyles:()=>x?.session.documentStyles()??[],getDocumentFonts:()=>x?.session.documentFonts()??[],getAvailableFonts:()=>lk(E(),x?.session.documentFonts()??[]),getDocumentThemeColors:()=>x?.session.documentThemeColors()??[],getOutline:()=>x?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>j0(x?Ln().formatting:null),findMatches:(S,G)=>x?.session.findText(S,{...G?.matchCase!==void 0?{matchCase:G.matchCase}:{},...G?.wholeWord!==void 0?{wholeWord:G.wholeWord}:{},stories:RI(x,p)}).matches??[],selectMatch(S){return f.flush(),x?EI(x,S):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>Ln().image,getSelectedTable:()=>V0(x),getTableCellSelection:()=>{let S=x?.state().cellSelection;return S?{tableId:S.tableId,rows:S.rows,columns:S.columns,cellIds:S.cellIds}:null},setTableInteractionLabel(S){x?.setTableInteractionLabel(S);},canExecuteImageCommand(S,G){if(ae)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(G?.scope){let te=mi(S,x,r.modeForGate(),G);if(!te.ok)return te.refusal}return Bu(S,x)},executeImageCommand(S){return ae?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):$u(qt,S)},getPageSetup:()=>Ku(x),getWatermark:()=>null,getTrackedChanges:()=>(x?.session.reviewItems()??[]).filter(S=>S.kind==="revision").map(S=>{let G=Dn(S);return {id:S.id,kind:S.kind==="revision"?S.revisionKind:"revision",...S.kind==="revision"&&S.author?{author:S.author}:{},story:G!==null?G.kind:cr(S)?.noteKind??"body"}}),getReviewItems:S=>$n(S),getCustomNodeDefinitions:()=>i.customNodes,reportCustomNodeDiagnostic:s,addComment(S,G){if(!l)return {ok:false,code:"unsupported",reason:yn};x?.flushPendingInput();let te=Bn();if(!te||!x)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let be=(G??o??"").trim();if(be.length===0||S.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let he=null;return x.commitReviewOps(()=>(he=x.session.replyToComment(null,{paragraphId:te.from.paragraphId,start:te.from.offset,end:te.to.offset,...te.to.paragraphId===te.from.paragraphId?{}:{endParagraphId:te.to.paragraphId}},S,be,_n(),_i(te.from.paragraphId)),{committed:he!==null}),"comment-add"),he===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>Jo(),isReviewPaneOpen:()=>ke,getEditingMode:()=>p,getReviewAuthors:()=>y.authorsFor(x?.revisionAuthors()??Ek),...Ax(b,{enabled:l,surface:()=>x,notify:()=>{Te(),et();}}),setTrackedChangesFilter(S,G){if(x)return x.setTrackedChangesFilter(S,G);b.setPredicate(S,G)&&(Te(),et());},getConfiguredAuthor:()=>o??null,setAuthor(S){let G=ff(S);if(o!==G){if(o=G,x?.setAuthor(o),o!==void 0&&C){C=false;let te=S0(ur("suggesting"));if(te.enter)T=true,qn("suggesting");else {P=te.rejection,Te(),et();return}}else if(!T){let te=_??p;Gt(r.mode()===void 0?te:"editing");return}P=Ar(null),k.report(P),Te(),et();}},setMode(S){r.setMode(S)&&(T=false,C=false,Gt());},...Ak(r,{surface:()=>x,bump:Te,emitSelectionChange:et}),presenceColorFor:S=>x?.remotePresenceColor(S)??"var(--doc-accent)",collaborationSession:()=>x?.collaborationSession()??null,getReviewAuthorStyle:S=>y.styleFor(S),setRemoteCaretLabelHost(S){N=S,x?.setRemoteCaretLabelHost(S);},setRevisionStyles(S){y.set(S),x?.setRevisionStyles(S),Te(),et();},setEditingMode:S=>qt.exec({type:"setEditingMode",mode:S}),getReviewRevision:()=>Nn(),setActiveReviewItem(S,G){if(S===null)return x?.dismissActiveReview(),Te(),et(),{ok:true,changed:false};if(!x)return {ok:false,code:"notFound",reason:"no document is open"};x.flushPendingInput();let be=$n().find(xe=>xe.key===S)?.item;if(!be)return {ok:false,code:"notFound",reason:"no review item with that key"};let he=st(be);if(!he)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!pt(be)&&!(v&&be.kind==="revision"&&be.revisionKind==="format"))return {ok:false,code:"unsupported",reason:`review items of kind '${be.revisionKind}' are excluded from activation`};let Ee=be?Dn(be):null,Ne=Ee===null&&be?Hn(be):null;if(Ee!==null||Ne!==null){let xe=Ee!==null?{kind:"headerFooter",rId:Ee.rId,furnitureKind:Ee.kind}:{kind:"note",id:Ne},ue=zl(x,xe,he.start);if(!ue.ok)return ue}else {x.exitNote?.(),x.exitHeaderFooter?.();let xe=Bi(be)??he,ue={paragraphId:xe.start.paragraphId,offset:xe.start.offset};x.activateReview(S,{anchor:ue,head:ue},{allowExcluded:v});let Ie=G?.reveal??"centerIfNeeded";Ie!==false&&x.revealPosition?.(xe.start,{block:Ie});}return (Ee!==null||Ne!==null)&&x.activateReview(S,void 0,{allowExcluded:v}),Te(),et(),{ok:true,changed:false}},setReviewActivationExclusions(S,G){m=S===null?null:[...S],g=G?.formattingKinds?[...G.formattingKinds]:void 0,x?.setReviewActivationExclusions(m,{formattingKinds:g});},acceptReviewItem:S=>ta(S,"accept"),rejectReviewItem:S=>ta(S,"reject"),setCommentResolved(S,G){return ik({reviewEnabled:l,editingMode:p,placements:$n,surface:x,proReviewReason:yn,bump:Te},S,G)},deleteReviewItem(S){if(!l)return {ok:false,code:"unsupported",reason:yn};let te=$n().find(he=>he.key===S)?.item;if(!te||!x)return {ok:false,code:"notFound",reason:"no review item with that key"};if(te.kind==="revision")return ta(S,"reject");if(te.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};fo()===S&&x.dismissActiveReview();let be=false;return x.commitReviewOps(()=>{let he=Hn(te),Ee=he===null?null:ed$1(he);return be=x.session.deleteComment(te.id,se(te),Ee?.noteId),{committed:be}},"comment-delete"),be?(Te(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(S,G,te){if(!l)return {ok:false,code:"unsupported",reason:yn};x?.flushPendingInput();let he=$n().find(Me=>Me.key===S)?.item;if(!he||!x)return {ok:false,code:"notFound",reason:"no review item with that key"};let Ee=st(he);if(!Ee)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let Ne=(te??o??"").trim(),xe=sk(he,G,Ne);if(xe)return xe;let ue=he.kind==="comment"?he.id:null,Ie=null;return x.commitReviewOps(()=>(Ie=x.session.replyToComment(ue,{paragraphId:Ee.start.paragraphId,start:Ee.start.offset,end:Ee.end.offset},G,Ne,_n(),se(he)),{committed:Ie!==null}),"comment-reply"),Ie===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>x?.headerFooterState()??null,getNotePropertiesState:()=>x?.notePropertiesState?.()??null,getNotePreviewText:S=>x?.notePreviewText?.(S)??null,setActiveScope(S){x?.setActiveScope(S)&&Te();},getActiveScope:()=>x?.activeScope()??{kind:"body"},query:S=>hI(x,()=>Ln().formatting,S),snapshot:()=>Ln(),getTotalPages:()=>Zu(x),getCurrentPage:S=>Vu(x,S),...OI(()=>x,()=>f.flush()),...Rk(it,()=>x),relayout(S){S?.sync,x?.layout();},retainSelection:()=>x?.retainSelection()??null,releaseSelection:S=>x?.releaseSelection(S),focus(S){return f.flush(),x?S&&S.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:S&&!x.setActiveScope(S)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(x.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){t$1?.invalidate(),ae=true,k.dispose(),f.cancel(),it.detach(),Z(),L(),L=()=>{},lr(),a$2=null,d$1=null,u=new WeakMap,Fe+=1,Te();for(let S of Object.values(Ft))S.clear();},on(S,G){return Ft[S].add(G),()=>{Ft[S].delete(G);}}};return t$1=vI(qt,{surface:()=>x,container:()=>a$2,collaboration:()=>i.collaboration!==null,load:uo,changed:()=>{Te(),et();},cancelLoad:()=>{n=null,f.cancel();}}),qt}var Lk=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function uF(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 fF(e){let t=k$1({port:pF(e),capabilities:Lk}),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 pF(e){let t=0,n=0,r=null,o=false,a=false,i=()=>{if(a)return null;let d=e.surface?.session??null;return d!==r&&(o&&(t+=n+1),o=true,r=d,n=0),d&&(n=d.packageRevision()),d},s,l=null;return {localChangeTracking:true,suggesting:()=>e.surface?.editingMode()==="suggest",async prepare(d){if(!d.operations.some(p=>p.op==="updateFieldResult"))return;s=void 0,l=null;let u=e.surface;if(!u)return;let f=u.layout();s=a$4(f),l=i()?.currentPackage()??null;},fieldPageContext(d,u,f){let p=i()?.currentPackage()??null;if(!p||p!==l)return null;let m=e$1(p).story(d);return m?b(s,m.part,u,f):null},revision(){return i(),t+n},currentPackage:()=>i()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?wa(e.surface.revisionDisplayMode()):ka,replacementLanding:(d,u,f)=>e.surface?.replacementLanding(d,u,f)??null,apply(d,u,f=[]){i();let p=e.surface;if(!p)return {ok:false,reason:"no-document"};let m=p.applyAutomationOps(d,u,f);return m.rejected?{ok:false,reason:String(m.reason??"refused")}:{ok:true,changed:m.committed}},applyLifecycle(d){i();let u=e.surface;if(!u)return {ok:false,reason:"no-document"};let f=u.applyAutomationOps(()=>[d]);return f.rejected?{ok:false,reason:String(f.reason??"refused")}:{ok:true,changed:f.committed}},applyCommentWrites(d,u){let f=e.surface,p=i();if(!f||!p)return {ok:false,reason:"no-document"};if(d.length===0)return {ok:true,changed:false};if(u.kind!=="body")return {ok:false,reason:"unsupported-story"};let m=e.can({type:"toggleReviewPane"});if(!m.ok)return {ok:false,reason:m.reason??"review-module-required"};let g={ok:false,reason:"refused"};return f.commitReviewOps(()=>{if(d.every(y=>y.kind==="delete")){let y=d.find(T=>T.kind==="delete"),I=p.deleteComments(d.map(T=>{if(T.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:T.commentId,...T.parentCommentId===void 0?{}:{parentCommentId:T.parentCommentId}}}),u,y?.kind==="delete"?y.noteId:void 0);return g=I?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:I}}if(d.length!==1)return g={ok:false,reason:"mixed-comment-writes"},{committed:false};let v=d[0];if(v.kind==="resolve"){let y=p.setCommentResolved(v.commentId,v.resolved);return g=y?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:y}}if(v.kind!=="create"&&v.kind!=="reply")return g={ok:false,reason:"unsupported-comment-write"},{committed:false};let b=p.replyToComment(v.kind==="reply"?v.parentCommentId:null,v.anchor,v.text,v.author,v.date);return g=b===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:b},{committed:b!==null}},uF(d)),g},applyCustomNodeWrite(d,u){let f=e.surface,p=i();if(!f||!p)return {ok:false,reason:"no-document"};if(u.kind!=="body")return {ok:false,reason:"unsupported-story"};let m={ok:false,reason:"refused"};return f.commitReviewOps(()=>{let g=p.insertCustomNode(d);return m=g.ok?{ok:true,changed:g.change!==null}:{ok:false,reason:g.detail?`${g.reason}: ${g.detail}`:g.reason},{committed:g.ok}},"package-scoped"),m},save:()=>i()?e.surface?.save()??null:null,select(d,u){if(!e.surface)return;let p=u==="end"?d.end:d.start,m=u==="start"?d.start:d.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:p.paragraphId,offset:p.offset},head:{paragraphId:m.paragraphId,offset:m.offset}}});},subscribe:d=>e.on("change",()=>d()),dispose(){a=true,r=null;}}}function mF(e){return e*(96/72)}function gF(e,t){return e*t}function hF(e,t){return e/t}function yF(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 bF(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function Dk(e,t,n){return t?true:e.length===1?false:!n}var Nk=["e","se","s","sw","w","nw","n","ne"];function vF(e,t){let n=Nk.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return Nk[(n-r+8)%8]}function xF(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 so(e){return e/pi}function Hk(e){let t=xF(e.deltaXPt,e.deltaYPt,e.transform),n=so(e.startWidthEmu),r=so(e.startHeightEmu),o=n/r,a=vF(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 T=Math.max(n/so(e.startWidthEmu),r/so(e.startHeightEmu));n=Math.max(1,so(e.startWidthEmu)*T),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=so(e.startWidthEmu),d=so(e.startHeightEmu),u=n/l,f=r/d,p=Math.max(1,e.startBounds.width*u),m=Math.max(1,e.startBounds.height*f),g=e.startBounds.x,v=e.startBounds.y,b=e.handle;b.includes("w")&&(g=e.startBounds.x+e.startBounds.width-p),b.includes("n")&&(v=e.startBounds.y+e.startBounds.height-m);let y=null;if(e.kind==="anchored"&&e.startPosition&&(b.includes("w")||b.includes("n")))if(e.startPosition.mode==="simple"){let I=b.includes("w")?Et(g-e.startBounds.x):0,T=b.includes("n")?Et(v-e.startBounds.y):0;y=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+I,verticalEmu:(e.startPosition.verticalEmu??0)+T});}else if(e.anchorFrameOrigin)y=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:Et(g-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...b.includes("n")?{verticalEmu:Et(v-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let I=b.includes("w")?Et(g-e.startBounds.x):0,T=b.includes("n")?Et(v-e.startBounds.y):0;y=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+I}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+T}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:Et(n),heightEmu:Et(r),previewBounds:Object.freeze({x:g,y:v,width:p,height:m}),position:y})}function wF(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 SF(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&&qu(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?Hk({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:Dk(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})}var _k=e=>Math.round(e/1440*100)/100,IF=e=>_k(e).toLocaleString(void 0,{maximumFractionDigits:2}),kF=e=>Math.round(e*1440),TF={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},Bk=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",$k=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function PF(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:Bk(t),specialBy:Math.abs(t??0),spaceBefore:e.spaceBeforePt??0,spaceAfter:e.spaceAfterPt??0,lineRule:e.lineSpacing?.rule??"multiple",lineValue:e.lineSpacing?.value??1.08,contextualSpacing:e.contextualSpacing===true,keepNext:e.keepNext===true,keepLines:e.keepLines===true,widowControl:e.widowControl!==false,pageBreakBefore:e.pageBreakBefore===true,tabStops:e.tabStops??[],clearedAllTabStops:false}}var qk={contextualSpacing:false,keepNext:false,keepLines:false,widowControl:false,pageBreakBefore:false,tabStops:false,alignment:false,indentLeft:false,indentRight:false,special:false,spaceBefore:false,spaceAfter:false,lineSpacing:false};function CF(e){return {contextualSpacing:e.contextualSpacing===null,keepNext:e.keepNext===null,keepLines:e.keepLines===null,widowControl:e.widowControl===null,pageBreakBefore:e.pageBreakBefore===null,tabStops:e.disagrees.tabStops,alignment:e.disagrees.alignment,indentLeft:e.disagrees.indentLeft||e.indentUnknown,indentRight:e.disagrees.indentRight||e.indentUnknown,special:e.disagrees.indentFirstLine||e.indentUnknown,spaceBefore:e.disagrees.spaceBeforePt,spaceAfter:e.disagrees.spaceAfterPt,lineSpacing:e.disagrees.lineSpacing}}function Kk(e,t){return e===t?true:e.length!==t.length?false:e.every((n,r)=>{let o=t[r];return o!==void 0&&n.positionTwips===o.positionTwips&&n.alignment===o.alignment&&(n.leader??"none")===(o.leader??"none")})}function RF(e,t,n=qk,r=n){let o={},a=false,i=(l,d)=>{o[l]=d,a=true;},s=l=>n[l]&&!r[l];return (e.alignment!==t.alignment||s("alignment"))&&i("alignment",t.alignment),(e.indentLeft!==t.indentLeft||s("indentLeft"))&&i("indentLeftTwips",t.indentLeft),(e.indentRight!==t.indentRight||s("indentRight"))&&i("indentRightTwips",t.indentRight),(e.special!==t.special||e.specialBy!==t.specialBy||s("special"))&&i("indentFirstLineTwips",$k(t.special,t.specialBy)),(e.spaceBefore!==t.spaceBefore||s("spaceBefore"))&&i("spaceBeforePt",t.spaceBefore),(e.spaceAfter!==t.spaceAfter||s("spaceAfter"))&&i("spaceAfterPt",t.spaceAfter),!r.lineSpacing&&(e.lineRule!==t.lineRule||e.lineValue!==t.lineValue||s("lineSpacing"))&&i("lineSpacing",{rule:t.lineRule,value:t.lineValue}),(e.contextualSpacing!==t.contextualSpacing||s("contextualSpacing"))&&i("contextualSpacing",t.contextualSpacing),(e.keepNext!==t.keepNext||s("keepNext"))&&i("keepNext",t.keepNext),(e.keepLines!==t.keepLines||s("keepLines"))&&i("keepLines",t.keepLines),(e.widowControl!==t.widowControl||s("widowControl"))&&i("widowControl",t.widowControl),(e.pageBreakBefore!==t.pageBreakBefore||s("pageBreakBefore"))&&i("pageBreakBefore",t.pageBreakBefore),(!Kk(e.tabStops,t.tabStops)||s("tabStops")&&t.clearedAllTabStops)&&i("tabStops",t.tabStops),a?o:null}function EF(e,t){return [...e.filter(r=>r.positionTwips!==t.positionTwips),t].sort((r,o)=>r.positionTwips-o.positionTwips)}function OF(e,t){if(t.key!=="Tab")return false;let n=[...e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(i=>!i.hasAttribute("disabled")&&i.tabIndex!==-1);if(n.length===0)return false;let r=n[0],o=n[n.length-1],a=e.ownerDocument.activeElement;return t.shiftKey&&(a===r||a===e)?(o.focus(),true):!t.shiftKey&&a===o?(r.focus(),true):false}function MF(e,t,n){let r,o=false,a,i,s=new Set,l=[],d=()=>{clearTimeout(i),i=void 0,r?.end(),r=void 0,a=void 0,s.clear();},u=()=>{if(o)throw new Error("history group binding was disposed");return (!r||r.state==="closed")&&(r=e.beginHistoryGroup()),r},f=()=>{d(),u();},p=()=>{let v=r;a=void 0,s.clear(),clearTimeout(i),i=setTimeout(()=>{r===v&&d();},0);},m=(v,b,y,I=false)=>{v.addEventListener(b,y,I),l.push(()=>v.removeEventListener(b,y,I));},g=v=>n.kind==="native-color"?v==="Enter"||v===" ":["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"," ","Enter"].includes(v);if(m(t,"pointerdown",v=>{let b=v;if(!(b.button!==0||n.kind==="keyboard")&&(f(),a=b.pointerId,n.kind!=="native-color"))try{t.setPointerCapture?.(b.pointerId);}catch{}},true),m(t,"keydown",v=>{let b=v;if(b.key==="Escape"){p();return}!g(b.key)||b.altKey||b.ctrlKey||b.metaKey||(!b.repeat&&s.size===0&&f(),s.add(b.key),u());},true),m(t.ownerDocument,"keyup",v=>{let b=v.key;s.delete(b)&&n.kind!=="native-color"&&s.size===0&&p();},true),n.kind!=="native-color")for(let v of ["pointerup","pointercancel","lostpointercapture"])m(v==="lostpointercapture"?t:t.ownerDocument,v,b=>{a!==void 0&&b.pointerId===a&&p();},true);return m(t,"input",()=>{i!==void 0?f():u();},true),m(t,"change",()=>{(n.kind==="native-color"||a===void 0&&s.size===0)&&p();}),m(t,"blur",p,true),t.ownerDocument.defaultView&&m(t.ownerDocument.defaultView,"blur",p),{options:()=>({historyGroup:u()}),dispose(){if(!o){o=true,d();for(let v of l)v();}}}}var Mr=class extends Error{code;constructor(t,n){super(`Document capture failed: ${t}.`,{cause:n}),this.name="DocumentRefreshError",this.code=t;}};var hp="var(--doc-refresh-highlight-color)",Zk="cubic-bezier(0.23, 1, 0.32, 1)";function lo(e,t,n,r=1/0){let o=e??t;if(!Number.isFinite(o)||o<0||o>r)throw new RangeError(r===1/0?`${n} must be a finite, nonnegative number.`:`${n} must be finite and between 0 and ${r}.`);return o}function Vk(e,t=180){if(e!==void 0&&typeof e!="boolean"&&(typeof e!="object"||e===null||Array.isArray(e)))throw new TypeError("animation must be a boolean or a durationMs settings object.");return e===false?0:lo(typeof e=="object"?e.durationMs:void 0,e===true||typeof e=="object"?180:t,"animation.durationMs",1e4)}function jk(e,t,n){let r=[],o=new Map,a=new Set,i=null,s=null,l=hp,d=.14,u=4,f=6,p=0,m=hp,g="solid",v="",b=180,y=180,I,T=Zk,O,P=0,B=()=>{P++,O!==void 0&&clearTimeout(O),O=void 0;},C=Y=>{let ne=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(Y!==void 0&&(typeof Y!="string"||!Y.trim()||/var\(|^(inherit|initial|unset|revert|revert-layer)$/i.test(Y.trim())||ne?.supports&&!ne.supports("animation-timing-function",Y)))throw new TypeError("animation.easing must be a CSS timing function without variables.");let oe=t.container()?.ownerDocument.defaultView?.KeyframeEffect??globalThis.KeyframeEffect;if(Y!==void 0&&oe)try{new oe(null,[],{easing:Y});}catch{throw new TypeError("animation.easing must be one valid animation timing function.")}return Y},_=(Y,ne)=>lo(typeof Y=="object"?Y.exitDurationMs:void 0,ne,"animation.exitDurationMs",1e4),k=(Y={})=>{if(Y.includePrevious!==void 0&&typeof Y.includePrevious!="boolean")throw new TypeError("includePrevious must be a boolean.");let ne=lo(Y.opacity,.14,"opacity",1),oe=lo(Y.padding,4,"padding"),L=lo(Y.borderRadius,6,"borderRadius"),A=Vk(Y.animation),Z=_(Y.animation,A),$=C(typeof Y.animation=="object"?Y.animation.easing:void 0),W=Y.timeoutMs===null?null:lo(Y.timeoutMs,3e3,"timeoutMs",2147483647),E=Y.color??hp,q=lo(Y.borderWidth,0,"borderWidth"),z=Y.borderColor??E,J=Y.borderStyle??"solid",ie=Y.className??"";if(!["solid","dashed","dotted"].includes(J))throw new TypeError("borderStyle must be solid, dashed, or dotted.");if(typeof ie!="string")throw new TypeError("className must be a string.");let ee=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(typeof E!="string"||!E.trim()||ee?.supports&&!ee.supports("color",E))throw new TypeError("color must be a CSS color or var() expression.");if(ee?.supports&&!ee.supports("color",`color-mix(in srgb, ${E} ${ne*100}%, transparent)`))throw new TypeError("color must be valid inside color-mix(), including var() expressions.");if(typeof z!="string"||!z.trim()||ee?.supports&&!ee.supports("color",z))throw new TypeError("borderColor must be a CSS color or var() expression.");if(Y.changeIds!==void 0&&(!Array.isArray(Y.changeIds)||Y.changeIds.length>1e4||Y.changeIds.some(de=>typeof de!="string"||!de)))throw new TypeError("changeIds must contain at most 10000 nonempty string IDs.");return {nextOpacity:ne,nextPadding:oe,nextRadius:L,nextDuration:A,nextExitDuration:Z,nextEasing:$,nextTimeout:W,nextColor:E,nextBorderWidth:q,nextBorderColor:z,nextBorderStyle:J,nextClassName:ie}},R=()=>I||t.container()?.ownerDocument.defaultView?.getComputedStyle(t.container()).getPropertyValue("--doc-motion-ease-out").trim()||Zk,x=Y=>{Y.animation&&(Y.animation.onfinish=null,Y.animation.cancel(),Y.animation=void 0);},N=(Y,ne)=>{x(ne),ne.element.remove(),o.get(Y)===ne&&o.delete(Y);},V=()=>(s||(s=t.container()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null,s?.addEventListener("change",D)),s?.matches??false),M=()=>{s?.removeEventListener("change",D),s=null;};function D(){if(s?.matches){for(let[Y,ne]of o)x(ne),ne.exiting&&N(Y,ne);o.size||M();}}let K=(Y,ne,oe,L,A=false)=>{if(!A&&ne.target===oe&&!ne.exiting)return;let Z=ne.element.ownerDocument.defaultView,$=A?0:Number.parseFloat(Z?.getComputedStyle(ne.element).opacity??String(ne.target));x(ne),ne.target=oe,ne.element.style.opacity=String(oe);let W=V()?Math.min(L,125):L;if(W===0||typeof ne.element.animate!="function"){ne.exiting&&N(Y,ne);return}try{let E=ne.element.animate([{opacity:Number.isFinite($)?$:oe},{opacity:oe}],{duration:W,easing:T});ne.animation=E,E.onfinish=()=>{ne.animation===E&&(ne.animation=void 0,ne.exiting&&N(Y,ne),o.size||M());};}catch{ne.exiting&&N(Y,ne);}},j=()=>{i?.disconnect();let Y=t.surface(),ne=t.container();if(!Y||!ne||r.length===0)return;T=R();let oe=new Set(r.map(W=>W.paragraphId)),L=e.getRenderScale(),A=e.snapshot().zoom,Z=new Set,$=new Set;for(let W of Y.layout().pages){let E=ne.querySelector(`[data-page-index="${W.index}"] > .docx-page-content`);if(E)for(let q of aa(W)){if(!oe.has(q.paragraphId))continue;let z=`${W.index}:${q.id}`;Z.add(z);let J=Gd(q),ie=q.lines.length&&!q.clipToBox?1/0:J.y,ee=q.lines.length&&!q.clipToBox?-1/0:J.y+J.height;for(let De of q.clipToBox?[]:q.lines)ie=Math.min(ie,De.box.y),ee=Math.max(ee,De.box.y+De.box.height);let de=q.clipToBox?0:u*A,ce=W.contentBox.x-W.box.x,ye=W.contentBox.y-W.box.y,Je=Math.max(-ce*L,J.x*L-de),Oe=Math.min((W.box.width-ce)*L,(J.x+J.width)*L+de);ie=Math.max(-ye*L,ie*L-de),ee=Math.min((W.box.height-ye)*L,ee*L+de);let Re=o.get(z);Re&&Re.element.parentElement!==E&&(N(z,Re),Re=void 0);let Ae=!Re;if(!Re){let De=ne.ownerDocument.createElement("div");De.setAttribute("data-docx-marker",""),De.setAttribute("data-docx-refresh-highlight",""),De.setAttribute("contenteditable","false"),De.setAttribute("aria-hidden","true"),De.style.cssText="position:absolute;pointer-events:none;box-sizing:border-box;",Re={element:De,paragraphId:q.paragraphId,target:-1,exiting:false},o.set(z,Re),E.append(De);}let Fe=Re.exiting;Re.exiting=false,Fe&&(Re.target=-1),Re.element.className=v,Object.assign(Re.element.style,{border:p?`${p*A}px ${g} ${m}`:"0",backgroundColor:`color-mix(in srgb, ${l} ${d*100}%, transparent)`,borderRadius:`${f*A}px`,left:`${Je}px`,top:`${ie}px`,width:`${Math.max(0,Oe-Je)}px`,height:`${Math.max(0,ee-ie)}px`}),K(z,Re,1,Ae&&a.has(q.paragraphId)?0:b,Ae),$.add(q.paragraphId);}}for(let W of $)a.add(W);for(let[W,E]of o)Z.has(W)||(!E.element.isConnected||oe.has(E.paragraphId)||y===0?N(W,E):E.exiting||(E.exiting=true,K(W,E,0,y)));i??=new MutationObserver(j),i.observe(ne,{childList:true,subtree:true});},Q=()=>{B(),r=[],a.clear(),i?.disconnect();for(let[Y,ne]of o)N(Y,ne);M();},ae=(Y={})=>{let ne=_(Y.animation,Vk(Y.animation,y));T=C(typeof Y.animation=="object"?Y.animation.easing:void 0)??R(),B(),r=[],a.clear(),i?.disconnect();for(let[L,A]of o)A.exiting&&ne>0||(A.exiting=true,K(L,A,0,ne));o.size||M();};return e.on("selectionChange",()=>{r.length&&j();}),{show(Y,ne={}){let{nextOpacity:oe,nextPadding:L,nextRadius:A,nextDuration:Z,nextExitDuration:$,nextEasing:W,nextTimeout:E,nextColor:q,nextBorderWidth:z,nextBorderColor:J,nextBorderStyle:ie,nextClassName:ee}=k(ne),de=new Set(r.map(ce=>ce.paragraphId));if(a=new Set([...a].filter(ce=>de.has(ce))),l=q,p=z,m=J,g=ie,v=ee,d=oe,u=L,f=A,b=Z,y=$,I=W,r=Y,b===0)for(let ce of o.values())ce.exiting||x(ce);if(!r.length){ae();return}if(j(),B(),E!==null){let ce=P;O=setTimeout(()=>{ce===P&&(O=void 0,ae(),n());},E);}},validate:k,hide:ae,clear:Q,repaint:j}}function zk(e){return JSON.stringify([e.revisionKind,e.author,e.date,e.text,e.replacedText])}function Wk(e){return new Map(e.surface()?.session.reviewItems().filter(t=>t.kind==="revision").map(t=>[t.id,zk(t)]))}function Uk(e,t,n,r){let o=e.surface();if(!o)return {located:[],available:false};let a=o.session.part(),i=d$1(a),s=o.session.paragraphAnchors().paraIdByNode,l=new Map,d=new Map;i.forEach((g,v)=>{d.set(g.id,v);let b=s.get(g.id);b&&l.set(b,l.has(b)?null:g);});let u=new Set(o.layout().pages.flatMap(g=>aa(g).map(v=>v.paragraphId))),f=(g,v=JSON.stringify([typeof g.location?.text=="string"?g.location.text:null,g.unavailableReason]))=>{let b={id:g.id,resultId:t,isNew:r.get(g.id)!==v};if(!g.location)return {fingerprint:v,change:{...b,status:g.unavailableReason??"unavailable"}};let y=g.location,I=y.paragraphId!==void 0?l.get(y.paragraphId):Number.isSafeInteger(y.paragraphIndex)&&y.paragraphIndex>=0?i[y.paragraphIndex]:void 0,T=I?Ui(a,I.id)??"":"";if(!I||y.paragraphId!==void 0&&y.paragraphIndex!==void 0||!Number.isSafeInteger(y.start)||!Number.isSafeInteger(y.end)||y.start<0||y.end<=y.start||y.end>T.length||T.slice(y.start,y.end)!==y.text)return {fingerprint:v,change:{...b,status:"invalid"}};let O=u.has(I.id);return {fingerprint:v,change:{...b,status:O?"available":"unavailable",location:Object.freeze({...y})},...O?{paragraphId:I.id,offset:y.start}:{}}};if(n)return {located:n.map(g=>f(g)),available:true};let p=o.session.reviewItems().filter(g=>g.kind==="revision");return {located:p.map(g=>{let v=zk(g),b=g.ranges[0];if(!b||b.partName!==a.name)return {fingerprint:v,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==v,status:b?"unsupported-story":"unavailable"}};let y=d.get(b.start.paragraphId)??-1;if(g.revisionKind==="delete"||g.revisionKind==="moveFrom")return {fingerprint:v,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==v,status:"deleted"}};if(b.start.paragraphId!==b.end.paragraphId)return {fingerprint:v,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==v,status:"unavailable"}};let I=Ui(a,b.start.paragraphId)??"",T={paragraphIndex:y,start:b.start.offset,end:b.end.offset,text:I.slice(b.start.offset,b.end.offset)};return f({id:g.id,location:T},v)}),available:p.length>0}}var Gk=new WeakMap,FF=0;function AF(e){let t=Gk.get(e);if(t)return t;let n=bI(e),r=`refresh-${++FF}`,o=0,a=null,i=new AbortController,s=false,l=Promise.resolve(),d=null,u=[],f=null,p=new Set,m=new Set,g=Object.freeze({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false}),v=C=>{g=Object.freeze({...g,...C});for(let _ of p)try{_();}catch{}},b=jk(e,n,()=>{g.highlightsVisible&&v({highlightsVisible:false});}),y=(C,_)=>{_&&v({phase:_,result:C,recoveryAvailable:d!==null});for(let k of m)try{k(C);}catch{}return C},I=(C,_,k)=>({ok:false,resultId:C,code:_,...k===void 0?{}:{recovered:k}}),T=()=>n.collaboration()?"collaboration":!n.surface()||!n.container()||e.snapshot().isOpening?"unavailable":null,O=()=>{o++,a=null,i.abort(),i=new AbortController,u=[],f=null,b.clear();};n.invalidated.add(()=>{O(),d=null,v({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});}),e.on("change",C=>{C.source||f===null||n.revision===f||(u=[],b.clear(),f=null,v({changes:[],highlightsVisible:false}));});let P=async C=>{let _=n.surface(),k=n.container();if(!_||!k)throw new Error("unavailable");cv(_)&&await new Promise((N,V)=>{let M=()=>{k.removeEventListener("compositionend",D),C.removeEventListener("abort",K);},D=()=>{M(),N();},K=()=>{M(),V(new Error("cancelled"));};k.addEventListener("compositionend",D),C.addEventListener("abort",K,{once:true}),C.aborted&&K();});let R=xi(k);if(R&&await R,C.aborted||n.surface()!==_)throw new Error("document-changed");let x=_.save();if(n.surface()!==_)throw new Error("document-changed");return {bytes:x,revision:n.revision}},B={async capture(){let C=T();if(d)throw new Mr("recovery-failed");if(C||s)throw new Mr(C??"busy");O(),d=null;let _=o,k=n.epoch,R=i.signal;v({phase:"capturing",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});try{let x=await P(R);if(_!==o||k!==n.epoch)throw new Error("superseded");let N=Object.freeze({id:`${r}-${_}`,bytes:x.bytes.slice().buffer});return a={token:N,epoch:k,revision:x.revision,sequence:-1,seen:Wk(n)},v({phase:"processing"}),N}catch(x){throw _===o&&v({phase:"failed"}),new Mr(_===o?"input-failed":"superseded",x)}},applyUpdate(C){let _=`${C.submission?.id??"unknown"}:${C.sequence}`,k;try{if(!Number.isSafeInteger(C.sequence)||C.sequence<0||!(C.bytes instanceof Uint8Array||C.bytes instanceof ArrayBuffer)||C.failures!==void 0&&(!Array.isArray(C.failures)||C.failures.length>1e4||C.failures.some(N=>typeof N!="string"))||C.changes&&(C.changes.length>1e4||new Set(C.changes.map(N=>N.id)).size!==C.changes.length||C.changes.some(N=>typeof N.id!="string"||!N.id||N.unavailableReason!==void 0&&!["deleted","unavailable"].includes(N.unavailableReason))))throw new Error("invalid-result");k={...C,bytes:new Uint8Array((C.bytes instanceof Uint8Array,C.bytes)).slice(),changes:C.changes?.map(N=>({...N,location:N.location?{...N.location}:void 0})),failures:C.failures?.slice()};}catch{return Promise.resolve(y(I(_,"invalid-result")))}let R=async()=>{let N=a,V=T();if(V)return y(I(_,V));if(!N||N.token!==k.submission)return y(I(_,"superseded"));if(k.sequence<=N.sequence)return y(I(_,"out-of-order"));if(N.epoch!==n.epoch)return y(I(_,"document-changed"));s=true;let M=i.signal,D=()=>a===N&&N.epoch===n.epoch&&!M.aborted;try{let K=await P(M);if(!D())return y(I(_,"cancelled"));if(K.revision!==N.revision)return y(I(_,"local-edits"),"failed");let j=k.bytes;if(!jc$1(j).ok)return y(I(_,"invalid-document"),"failed");if(b.clear(),u=[],f=null,v({phase:"refreshing",changes:[],highlightsVisible:!1}),!D())return y(I(_,"cancelled"));let Q=n.surface().save();if(!D())return y(I(_,"cancelled"));if(n.revision!==N.revision)return y(I(_,"local-edits"),"failed");d={bytes:Q.slice(),epoch:n.epoch};let ae=await n.replace(j,"refresh");if(N.epoch!==n.epoch)return y(I(_,"document-changed"));if(!ae&&!D())return d=null,y(I(_,"cancelled"));if(!ae){if(v({phase:"recovering"}),N.epoch!==n.epoch)return y(I(_,"document-changed"));let L=d&&await n.replace(d.bytes,"recovery");return N.epoch!==n.epoch?y(I(_,"document-changed")):(L&&(d=null),a=null,y(I(_,L?"load-failed":"recovery-failed",!!L),"failed"))}d=null,b.clear(),N.revision=n.mountedRevision,N.sequence=k.sequence;let Y=Uk(n,_,k.changes,N.seen);u=n.revision===N.revision?Y.located:[];for(let L of u)N.seen.set(L.change.id,L.fingerprint);f=N.revision;let ne=Object.freeze(u.map(L=>Object.freeze(L.change))),oe=Object.freeze({ok:!0,resultId:_,changes:ne,changeInformation:n.revision===N.revision&&Y.available?"available":"unavailable",failures:Object.freeze(k.failures??[])});return v({changes:ne,result:oe,phase:"complete",recoveryAvailable:!1}),y(oe)}catch{return y(I(_,D()?"input-failed":"cancelled"),D()?"failed":void 0)}finally{s=false;}},x=l.then(R);return l=x.then(()=>{},()=>{}),x},cancel(){let C=g.phase==="recovering"||!n.surface()&&d!==null;n.cancel(),o++,a=null,i.abort(),i=new AbortController,C||(d=null),v({phase:C?"failed":g.result?.ok?"complete":"idle",result:C||g.result?.ok?g.result:null,recoveryAvailable:d!==null});},finish(C){a?.token===C&&!s&&(a=null,v({phase:g.phase==="processing"?"idle":g.phase}));},snapshot:()=>g,subscribe(C){return p.add(C),()=>{p.delete(C);}},onResult(C){return m.add(C),()=>{m.delete(C);}},highlightChanges(C){if(b.validate(C),f!==n.revision)return 0;let _=C?.changeIds===void 0?null:new Set(C.changeIds),k=u.filter(R=>R.change.status==="available"&&(_?_.has(R.change.id):C?.includePrevious||R.change.isNew));return b.show(k,C),v({highlightsVisible:k.length>0}),k.length},clearHighlights(C){b.hide(C),v({highlightsVisible:false});},navigateToChange(C,_={}){let k=_.block??"center",R=_.behavior??"instant",x=_.offsetPx??24;if(!["start","center","centerIfNeeded","nearest"].includes(k))throw new TypeError("block must be start, center, centerIfNeeded, or nearest.");if(!["instant","smooth"].includes(R))throw new TypeError("behavior must be instant or smooth.");if(_.focus!==void 0&&typeof _.focus!="boolean")throw new TypeError("focus must be a boolean.");if(!Number.isFinite(x)||x<0)throw new RangeError("offsetPx must be finite and nonnegative.");if(f!==n.revision)return false;let N=n.container()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??false,V=u.find(D=>D.change.id===C);if(!V?.paragraphId||V.offset===void 0)return false;let M=n.surface();if(!M?.revealPosition({paragraphId:V.paragraphId,offset:V.offset},{block:k,offsetPx:x,behavior:N?"instant":R}))return false;if(_?.focus){M.setActiveScope({kind:"body"});let D={paragraphId:V.paragraphId,offset:V.offset};M.setSelection({anchor:D,head:D}),M.focus();}return true},recoveryBytes:()=>d?d.bytes.slice().buffer:null,async recover(){if(!d||d.epoch!==n.epoch||s)return false;s=true;let C=d;v({phase:"recovering"});try{if(C.epoch!==n.epoch)return !1;let _=await n.replace(C.bytes,"recovery");return C.epoch!==n.epoch?!1:(_&&(d=null),v({phase:_?"idle":"failed",recoveryAvailable:!_}),_)}finally{s=false;}}};return Gk.set(e,B),B}var LF=[37,80,68,70,45],Li=class extends Error{constructor(n){super(`Install @docx-editor.dev/docx-to-${n} and configure menu.exporters.${n}.`+(n==="pdf"?" PDF conversion requires a Node.js server.":""));this.format=n;this.name="ChromeExportError";}format;code="missing-exporter"};async function yp(e,t,n={}){if(t==="markdown"){if(!n.markdown)throw new Li(t);let o=await n.markdown(new Uint8Array(await e.save()));if(typeof o?.markdown!="string")throw new TypeError("The Markdown converter returned no Markdown.");return {bytes:new TextEncoder().encode(o.markdown),extension:"md",mimeType:"text/markdown;charset=utf-8"}}if(t!=="pdf")throw new TypeError("Unsupported export format.");if(!n.pdf)throw new Li(t);let r=await n.pdf(new Uint8Array(await e.save()));if(!(r?.bytes instanceof Uint8Array)||r.bytes.length===0)throw new TypeError("The PDF converter returned no PDF bytes.");if(!LF.every((o,a)=>r.bytes[a]===o))throw new TypeError("The PDF converter returned a file without a PDF header.");return {bytes:r.bytes,extension:"pdf",mimeType:"application/pdf"}}var DF=15e3,xn=class extends Error{code;constructor(t){super(t==="pdf-viewer-unavailable"?"This browser cannot display PDF files in the page.":t==="pdf-load-failed"?"The PDF did not load for printing.":t==="print-refused"?"The browser refused to print the PDF from the page.":"The print job has ended."),this.code=t,this.name="ChromePrintError";}};function HF(e){if(e.altKey||e.shiftKey||typeof e.key!="string")return false;let t=e.key.toLowerCase();return t!=="p"&&(e.code!=="KeyP"||/^[a-z]$/.test(t))?false:isApplePlatform()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}async function _F(e,t={},n=document){let{bytes:r,mimeType:o}=await yp(e,"pdf",t);return BF(r,o,n)}function BF(e,t,n){let r=n.nodeType===9?n.body:n;if(!r)throw new TypeError("Printing requires a document body.");let o=r.ownerDocument,a=o.defaultView;if(!a)throw new TypeError("Printing requires a document with a window.");let i=e.buffer instanceof ArrayBuffer?e:e.slice(),s=a.URL.createObjectURL(new a.Blob([i],{type:t})),l=null,d=null,u,f=null,p=false,m=b=>{a.clearTimeout(u),f?.(b),f=null,l?.remove(),l=null,d=null;},g=()=>{if(d)return d;let b=o.createElement("iframe");return l=b,b.setAttribute("aria-hidden","true"),b.setAttribute("tabindex","-1"),b.setAttribute("data-docx-print-frame",""),b.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;",d=new Promise((y,I)=>{f=I,u=a.setTimeout(()=>m(new xn("pdf-load-failed")),DF),b.addEventListener("load",()=>{if(a.clearTimeout(u),!b.contentWindow){m(new xn("pdf-load-failed"));return}f=null,y(b.contentWindow);},{once:true});}),d.catch(()=>{}),b.src=s,r.append(b),d};return {url:s,async print(b={}){if(p)throw new xn("print-ended");if(a.navigator.pdfViewerEnabled===false)throw new xn("pdf-viewer-unavailable");let y=await g();if(p)throw new xn("print-ended");if(await b.beforePrint?.(),p)throw new xn("print-ended");let I=o.activeElement;try{y.focus(),y.print();}catch{throw new xn("print-refused")}finally{I?.isConnected&&I.focus({preventScroll:true});}},dispose(){p||(p=true,m(new xn("print-ended")),a.URL.revokeObjectURL(s));}}}
20
+ export{gi as $,rF as $a,fu as A,sv as Aa,OF as Ab,pu as B,pE as Ba,MF as Bb,ZC as C,mE as Ca,Mr as Cb,Fu as D,gE as Da,AF as Db,xR as E,Uv as Ea,Li as Eb,si as F,yi as Fa,yp as Fb,li as G,bi as Ga,xn as Gb,Au as H,RE as Ha,HF as Hb,wR as I,tf as Ia,_F as Ib,Lu as J,eo as Ja,Rn as K,or as Ka,ui as L,yl as La,Bu as M,gx as Ma,$u as N,hx as Na,NR as O,rf as Oa,DR as P,bl as Pa,pi as Q,of as Qa,_R as R,vl as Ra,Et as S,af as Sa,Do as T,sf as Ta,BR as U,lf as Ua,qu as V,Ll as Va,$R as W,NS as Wa,el as X,Yf as Xa,_o as Y,Fi as Ya,U0 as Z,Ai as Za,ju as _,Wo as _a,Oo as a,jR as aa,ed as ab,Qa as b,G0 as ba,td as bb,DT as c,X0 as ca,cF as cb,Ic as d,zR as da,Lk as db,yC as e,Jr as ea,fF as eb,bC as f,zu as fa,mF as fb,je as g,XR as ga,gF as gb,iu as h,YR as ha,hF as hb,CC as i,JR as ia,yF as ib,EC as j,rl as ja,bF as jb,OC as k,ev as ka,Dk as kb,Zb as l,nl as la,Hk as lb,MC as m,tv as ma,wF as mb,FC as n,nv as na,SF as nb,AC as o,nE as oa,_k as ob,LC as p,rE as pa,IF as pb,NC as q,oE as qa,kF as qb,DC as r,iE as ra,TF as rb,HC as s,sE as sa,Bk as sb,Vb as t,lE as ta,$k as tb,_C as u,dE as ua,PF as ub,BC as v,cE as va,qk as vb,cu as w,Uu as wa,CF as wb,t0 as x,uE as xa,Kk as xb,n0 as y,iv as ya,RF as yb,Gs as z,fE as za,EF as zb};