@docx-editor.dev/core 2.9.1 → 2.10.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 (94) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.js +1 -1
  3. package/dist/binding.cjs +1 -1
  4. package/dist/binding.d.cts +74 -10
  5. package/dist/binding.d.ts +74 -10
  6. package/dist/binding.js +1 -1
  7. package/dist/chunk-27APDXY2.js +2 -0
  8. package/dist/chunk-35MI6K7M.cjs +10 -0
  9. package/dist/chunk-4XL7SOWQ.cjs +2 -0
  10. package/dist/chunk-6K6QQVAZ.cjs +18 -0
  11. package/dist/chunk-7ZJL5AEY.cjs +1 -0
  12. package/dist/chunk-C6LK2BYA.cjs +2 -0
  13. package/dist/chunk-HBEBUCRM.cjs +5 -0
  14. package/dist/chunk-LG5K46OM.js +2 -0
  15. package/dist/chunk-LWADHMVV.js +5 -0
  16. package/dist/chunk-N725IUO7.js +18 -0
  17. package/dist/chunk-N7DBENH4.js +10 -0
  18. package/dist/chunk-NVGFWMCO.js +1 -0
  19. package/dist/chunk-SYTWKJPJ.cjs +18 -0
  20. package/dist/chunk-YI6JXF7U.js +18 -0
  21. package/dist/contracts/document.d.cts +6 -1
  22. package/dist/contracts/document.d.ts +6 -1
  23. package/dist/contracts/editor.d.cts +6 -6
  24. package/dist/contracts/editor.d.ts +6 -6
  25. package/dist/contracts/interaction.d.cts +6 -6
  26. package/dist/contracts/interaction.d.ts +6 -6
  27. package/dist/contracts/modules.d.cts +3 -4
  28. package/dist/contracts/modules.d.ts +3 -4
  29. package/dist/{custom-node-writes-QyVZdTUA.d.ts → custom-node-writes-BvpWCnW8.d.ts} +52 -5
  30. package/dist/{custom-node-writes-7ERv0f_X.d.cts → custom-node-writes-Db8H6Z3n.d.cts} +52 -5
  31. package/dist/{editor-PUlv5Pp7.d.ts → editor-C0my6Uta.d.ts} +35 -14
  32. package/dist/{editor-CojjwMmF.d.cts → editor-CwzY2Hcg.d.cts} +35 -14
  33. package/dist/editor.cjs +1 -1
  34. package/dist/editor.css +66 -461
  35. package/dist/editor.d.cts +20 -20
  36. package/dist/editor.d.ts +20 -20
  37. package/dist/editor.js +1 -1
  38. package/dist/{index-oN-v8DQ5.d.ts → index-kID8Ymkp.d.ts} +126 -20
  39. package/dist/{index-DGPSeLI0.d.cts → index-nLFwo_17.d.cts} +126 -20
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +13 -13
  42. package/dist/index.d.ts +13 -13
  43. package/dist/index.js +1 -1
  44. package/dist/layout.cjs +1 -1
  45. package/dist/layout.d.cts +357 -310
  46. package/dist/layout.d.ts +357 -310
  47. package/dist/layout.js +1 -1
  48. package/dist/output.cjs +1 -1
  49. package/dist/output.d.cts +6 -6
  50. package/dist/output.d.ts +6 -6
  51. package/dist/output.js +1 -1
  52. package/dist/{review-items-DpsqTHio.d.cts → review-items-CwixiHNe.d.cts} +1 -1
  53. package/dist/{review-items-D5SPFtsO.d.ts → review-items-Dw-8a6Ie.d.ts} +1 -1
  54. package/dist/{review-reads-CP106AHp.d.cts → review-reads-BqkiJTeR.d.cts} +1 -1
  55. package/dist/{review-reads-B2Ji3fVU.d.ts → review-reads-C0u-IKEA.d.ts} +1 -1
  56. package/dist/{semantic-cell-selection-DJPjBWzf.d.cts → semantic-cell-selection-DT9x9WLf.d.cts} +2 -2
  57. package/dist/{semantic-cell-selection-BWhVAk5B.d.ts → semantic-cell-selection-Utrf0lz7.d.ts} +2 -2
  58. package/dist/{semantic-interaction-BjOcDB06.d.cts → semantic-interaction-B6hFRQLy.d.ts} +21 -2
  59. package/dist/{semantic-interaction-Cca1-X_a.d.ts → semantic-interaction-Z0xKQcB4.d.cts} +21 -2
  60. package/dist/{semantic-paint-CufpIQFw.d.ts → semantic-paint-CQEOC0Od.d.cts} +2 -2
  61. package/dist/{semantic-paint-Ur7pAINj.d.cts → semantic-paint-quke354p.d.ts} +2 -2
  62. package/dist/{semantic-records-C3Z76KeN.d.cts → semantic-records-CMakzQ1X.d.cts} +36 -4
  63. package/dist/{semantic-records-Cc1MJrhM.d.ts → semantic-records-Do3-i5oB.d.ts} +36 -4
  64. package/dist/{shaped-measurer-CwlTPDJO.d.ts → shaped-measurer-BxwTUluj.d.ts} +1 -1
  65. package/dist/{shaped-measurer-CYSK20E2.d.cts → shaped-measurer-DzRwWrL5.d.cts} +1 -1
  66. package/dist/store.cjs +1 -1
  67. package/dist/store.d.cts +250 -134
  68. package/dist/store.d.ts +250 -134
  69. package/dist/store.js +1 -1
  70. package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +24 -0
  71. package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +24 -0
  72. package/dist/{tree-op-types-XMVsJSpe.d.ts → tree-op-types-BuOfCrkp.d.ts} +280 -32
  73. package/dist/{tree-op-types-B0-sCtw-.d.cts → tree-op-types-DSJYmf5b.d.cts} +280 -32
  74. package/dist/{tree-session-D945D43B.d.cts → tree-session-contract-ByWx8eew.d.cts} +44 -104
  75. package/dist/{tree-session-DBJgmdmc.d.ts → tree-session-contract-C1dfE9hy.d.ts} +44 -104
  76. package/dist/{tree-store-ClA-qng4.d.ts → tree-store-ASBtz7UB.d.ts} +1 -1
  77. package/dist/{tree-store-C6vc8E_2.d.cts → tree-store-CWOUMGN8.d.cts} +1 -1
  78. package/package.json +2 -2
  79. package/dist/chunk-5VC5HGJA.js +0 -2
  80. package/dist/chunk-A2JIBG75.js +0 -1
  81. package/dist/chunk-DKMKH77K.cjs +0 -5
  82. package/dist/chunk-FWUI7EXG.cjs +0 -15
  83. package/dist/chunk-GZWMLQJO.js +0 -18
  84. package/dist/chunk-IEXDXWTA.cjs +0 -1
  85. package/dist/chunk-IMMAG4QP.cjs +0 -10
  86. package/dist/chunk-JTSNJQFO.js +0 -15
  87. package/dist/chunk-KBCC66CI.js +0 -5
  88. package/dist/chunk-LJ6BY6IU.cjs +0 -18
  89. package/dist/chunk-QDBAXFIK.js +0 -2
  90. package/dist/chunk-RD266XSK.cjs +0 -2
  91. package/dist/chunk-VUJGPCPU.js +0 -10
  92. package/dist/chunk-XMHWBL3K.cjs +0 -2
  93. package/dist/image-resources-DQOiwOuE.d.cts +0 -203
  94. package/dist/image-resources-eZqD_-vC.d.ts +0 -203
@@ -1,15 +0,0 @@
1
- import {f as f$1,d as d$1,k,c as c$1,b as b$1,l,e as e$1,i,a as a$4,g as g$2}from'./chunk-QDBAXFIK.js';import {d,q,a as a$1,b,c,g,r,o,n,t,e,f,Hc as Hc$1,Jd,xb as xb$1,Cd,Pc as Pc$1,kb as kb$1,Qd,jc as jc$1,Ed,Zd,$d,Vc as Vc$1,ae,Rc as Rc$1,ie,Sd,je,uc,Wd,be,ge,Vd as Vd$1,Ud,fc,Qa,Fb as Fb$1,Ic,bd,ad,cd,Uc as Uc$1,Rd,Td,X,db,rc,ce,ke,Nd,Ld as Ld$1,Ab as Ab$1,le as le$1,dd,Bc as Bc$1,yc,Mc as Mc$1,Jc as Jc$1,Kc as Kc$2,Lc as Lc$1,Nb as Nb$1,wc as wc$2,$c as $c$1,Pd,tc,_c as _c$1,Yd,Od,Y,vc,Dc as Dc$1,he,ee,sc,ia as ia$1,ta,pa as pa$1,Bb as Bb$1,Kb as Kb$1,$,Md as Md$1,Ac as Ac$1,Zb as Zb$1,Gd as Gd$1,Tc as Tc$1,fe,gc,lc}from'./chunk-GZWMLQJO.js';import {g as g$1}from'./chunk-A2JIBG75.js';import {j,d as d$2,i as i$1}from'./chunk-KBCC66CI.js';import {H,Q,N}from'./chunk-5VC5HGJA.js';import {a as a$2,Na as Na$1,xc,Jf as Jf$1,tg as tg$1,Kc as Kc$1,Id,_d,va as va$1,Vd,Wd as Wd$1,tf as tf$1,hd,Ua,Oa as Oa$1,Pa as Pa$1,Ra as Ra$1,L,zf as zf$1,Bf as Bf$1,wf as wf$1,Af as Af$1,jg,ig as ig$1,kg as kg$1,$d as $d$1,Jd as Jd$1,Kd,Ld,Md,Gd,Hd,Ka,gd,xg as xg$1,wc as wc$1,Cd as Cd$1,wa as wa$1,og as og$1,Lf as Lf$1,Ag,Bg,sf as sf$1,uf as uf$1,mg as mg$1,Ob as Ob$1,pg as pg$1,fg as fg$1,Fe,Ie,Ab as Ab$2,Hb as Hb$1,Bd,sd,qd,zg,Hg as Hg$1,qf as qf$1,rf as rf$1,hg as hg$1,gg as gg$1,eg as eg$1,ng as ng$1,Zc as Zc$1,Td as Td$1,Cb as Cb$1,Eb as Eb$1,q as q$1,x,md,He,ne,ke as ke$1,ca as ca$1,b as b$2,g as g$3,E,ve}from'./chunk-VUJGPCPU.js';import {a}from'./chunk-PSZH2VXP.js';import {a as a$3}from'./chunk-GQQOL4PV.js';import {zipSync,strToU8}from'fflate';import {createT,en as en$1,locales,deepMerge}from'@docx-editor.dev/i18n';var hm=Object.freeze({kern:1,liga:1});function na(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var Tc=false;function wc(e){if(Tc)return;Tc=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 Un(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:na(e.request),diagnostic:e.diagnostic});if(e instanceof q){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 ra(e,t$1){try{if(!Number.isSafeInteger(e.maxFontBytes)||e.maxFontBytes<=0||e.maxFontBytes>a$1)throw new a("overLimit",`Font byte ceiling must not exceed the engine hard maximum of ${a$1}`);if(!Number.isSafeInteger(e.sources.length)||e.sources.length===0||e.sources.length>b)throw new a("overLimit",`Font source count must be between 1 and ${b}`);let n$1=0;for(let a$2 of e.sources){if(!Number.isSafeInteger(a$2.bytes.byteLength)||a$2.bytes.byteLength>e.maxFontBytes||a$2.bytes.byteLength>a$1)throw new a("overLimit",`Font source ${a$2.id} exceeds the per-font byte ceiling`);if(a$2.bytes.byteLength>c-n$1)throw new a("overLimit",`Font sources exceed the aggregate byte ceiling of ${c}`);n$1+=a$2.bytes.byteLength;}let r$1={epoch:e.epoch,maxFontBytes:e.maxFontBytes,sources:e.sources.map(a=>({request:na(a.request),id:a.id,bytes:a.bytes,hash:a.hash,faceIndex:a.faceIndex,availability:a.availability})),substitutions:e.substitutions?.map(a=>({from:na(a.from),to:na(a.to)})),defaultFont:Object.freeze({family:e.defaultFont.family,sizeHalfPoints:e.defaultFont.sizeHalfPoints}),language:e.language},o$1=g({epoch:r$1.epoch,maxFontBytes:r$1.maxFontBytes,resources:r$1.sources,substitutions:r$1.substitutions,validateFont:r,instrumentation:{onOwnedByteCopy:t$1?.onFontByteCopy,onHash:t$1?.onFontHash,onAdmission:t$1?.onFontAdmission}});return await o(),Object.freeze({fonts:o$1,shaper:t(),defaultFont:Object.freeze({family:r$1.defaultFont.family,sizeHalfPoints:r$1.defaultFont.sizeHalfPoints}),environment:Object.freeze({variationAxes:Object.freeze({}),shapingLibrary:n,unicodeDataVersion:"16.0.0",normalization:"none",language:r$1.language??"en",features:hm,fixedPointScale:20,roundingMode:"halfAwayFromZero"}),ligatureCaretPolicy:"cluster-edges-only",operation:Object.freeze({resourceEpoch:o$1.epoch,configEpoch:r$1.epoch,extensionFingerprint:`fonts:${r$1.sources.map(a=>`${a.hash}#${a.faceIndex}`).join(",")}`,shapingHash:`hb:${n.version}:kern+liga`,producerVersion:1})})}catch(n){throw Un(n)}}function Wn(e){e.shaper.dispose?.();}var ym=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});var Li=64,oa=Object.freeze({family:"Calibri",sizeHalfPoints:22});function aa(e$1,...t){let n=[e$1,...t],r=[],o=new Set;for(let l of n)for(let d of l.sources??[]){let c=e(d.request);o.has(c)||(o.add(c),r.push(d));}let a=[],i=new Set;for(let l of n)for(let d of l.substitutions??[]){let c=e(d.from);o.has(c)||i.has(c)||(i.add(c),a.push(d));}return Object.freeze({epoch:e$1.epoch??0,maxFontBytes:e$1.maxFontBytes??a$1,sources:Object.freeze(r),...a.length>0?{substitutions:Object.freeze(a)}:{},defaultFont:e$1.defaultFont??oa,...e$1.language!==void 0?{language:e$1.language}:{}})}var Pc="http://schemas.openxmlformats.org/wordprocessingml/2006/main",vm="http://schemas.openxmlformats.org/package/2006/content-types",Cc="http://schemas.openxmlformats.org/package/2006/relationships",xm="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Im="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Sm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${vm}"><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>`,km=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Cc}"><Relationship Id="rId1" Type="${xm}" Target="word/document.xml"/></Relationships>`,Tm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Cc}"><Relationship Id="rId1" Type="${Im}" Target="styles.xml"/></Relationships>`,wm=[{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}],Pm=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>",Cm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${Pc}"><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>`+wm.map(Pm).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="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>',Rm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${Pc}"><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 Ni(){return zipSync({"[Content_Types].xml":strToU8(Sm),"_rels/.rels":strToU8(km),"word/_rels/document.xml.rels":strToU8(Tm),"word/document.xml":strToU8(Rm),"word/styles.xml":strToU8(Cm)})}var Em=Object.freeze({kind:"body"});function $n(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 ot(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 l of i.values())if(l.partName===o)return {kind:"headerFooter",rId:l.rId};for(let a of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:a})?.name===o)return {kind:"notesPart",noteKind:a};return n}function ia(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=hd(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function Ec(e,t){return e?e.scope:t||Em}function Fm(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(...Rc(i.fragments));return o}if(!t)return X(e);let r=Gn(e,t);return r?Rc(r.fragments):[]}function Gn(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 Fc(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 Di(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Hi(e,t,n){let r=yc(e,t.y),o=e.pages[r];if(!o)return false;let a=t.x-n(r),i=t.y,l=o.contentBox;return a>=l.x&&a<l.x+l.width&&i>=l.y&&i<l.y+l.height}function _i(e,t,n,r,o={}){return Bc$1(e,t,n.fragments,r,o)}function Om(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=Gn(r,t);return o?Yd(e,t.pageIndex,o.fragments,n):null}function Am(e,t,n){let r=[];for(let o of e.pages)for(let a of [o.footnotes,o.endnotes]){let i=a?.notes.find(l=>l.scopeId===t);i&&r.push(...Yd(e,o.index,i.fragments,n));}return r.length>0?r:null}function Oc(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function Ac(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 Mc(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!Gn(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(Gn(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function Lc(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function Nc(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Bi(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function qi(e,t,n,r,o,a,i){let l=o?Om(e,o,i):a?Am(e,a,i):null,d=ce(e,t,n,r,{...i?{measurer:i}:{},...l?{stops:l}:{}});if(!d)return null;if(!l)return d;let c=l.find(m=>m.position.paragraphId===d.position.paragraphId&&m.position.offset===d.position.offset);return c?{...d,pageIndex:c.pageIndex}:d}function Zi(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 l=i.box,d=l.x+o,c=l.y;if(t.x>=d&&t.x<d+l.width&&t.y>=c&&t.y<c+l.height)return {pageIndex:r.index,scopeId:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-d,y:t.y-c},fragments:i.fragments}}}return null}function Dc(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let c=o.y,m=r.y,x=n?Math.max(m,n.box.y+n.box.height):m,v=n?Math.min(c,n.box.y):c;return x<=v?null:{x:r.x,y:v,width:r.width,height:x-v}}let a=r.y+r.height,i=o.y+o.height,l=n?Math.min(a,n.box.y):a,d=n?Math.max(i,n.box.y+n.box.height):i;return d<=l?null:{x:r.x,y:l,width:r.width,height:d-l}}function zi(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=Dc(r,a);if(!i)continue;let l=i.x+o;if(t.x>=l&&t.x<l+i.width&&t.y>=i.y&&t.y<i.y+i.height)return {pageIndex:r.index,kind:a}}}return null}function Vi(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 l=i.box,d=Dc(r,a)??l,c=d.x+o,m=d.y;if(t.x>=c&&t.x<c+d.width&&t.y>=m&&t.y<m+d.height)return {pageIndex:r.index,kind:a,story:i,local:{x:t.x-(l.x+o),y:t.y-l.y}}}}return null}function Xn(e,t,n){if(!t&&!n)return rc(e);let r=new Set,o=[];for(let a of e.pages)for(let i of Fm(a,t,n)){for(let l of i.lines)for(let d of tc(l))r.has(d.paragraphId)||(r.add(d.paragraphId),o.push(d.paragraphId));i.lines.length===0&&!r.has(i.paragraphId)&&(r.add(i.paragraphId),o.push(i.paragraphId));}return o}function sa(e,t,n,r){let o=Xn(e,n,r);if(o.length===0)return t;let a=new Set(o),i=l=>a.has(l.paragraphId)?l:{paragraphId:o[0],offset:0};return {anchor:i(t.anchor),head:i(t.head)}}function Rc(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 Hc(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 Mm(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function Lm(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 Nm(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function Dm(e,t){if(e)try{await e.delete(t);}catch{}}async function Hm(e){let t=e.fetcher??fetch,n=e.maxFontBytes??a$1,r=await Mm(e.cacheName??"docx-editor-fonts");async function o(d){let c=Object.freeze({family:d.family,weight:d.weight,style:d.style}),m=Hc(c);if(m)return {failure:{url:d.url,request:c,reason:"invalidRequest",diagnostic:m}};let x=(C,K)=>{if(C.byteLength===0)return {url:d.url,request:c,reason:"emptyResponse"};if(C.byteLength>n)return {url:d.url,request:c,reason:"overLimit"};let h=f(C,d.faceIndex??0);if(!h.valid)return {url:d.url,request:c,reason:"malformed",diagnostic:h.diagnostic};let H=a$2(C);return d.hash!==void 0&&d.hash!==H?{url:d.url,request:c,reason:"hashMismatch",expectedHash:d.hash,actualHash:H,...K?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:c,id:`url:${d.url}`,bytes:C,hash:H,faceIndex:d.faceIndex??0}},v=await Lm(r,d.url);if(v){let C=x(v,true);if(!("reason"in C))return {source:C};await Dm(r,d.url);}let w;try{w=await t(d.url);}catch(C){return {failure:{url:d.url,request:c,reason:"networkError",diagnostic:C instanceof Error?C.message:String(C)}}}if(!w.ok)return {failure:{url:d.url,request:c,reason:"httpError",status:w.status}};let R;try{R=new Uint8Array(await w.arrayBuffer());}catch(C){return {failure:{url:d.url,request:c,reason:"networkError",diagnostic:C instanceof Error?C.message:String(C)}}}let L=x(R,false);return "reason"in L?{failure:L}:(await Nm(r,d.url,R),{source:L})}let a=await Promise.all(e.sources.map(d=>o(d))),i=[],l=[];for(let d of a)"source"in d?i.push(d.source):l.push(d.failure);return {sources:i,failures:l}}function _m(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=Hc(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=t.faceIndex??0,l=f(e,i);return l.valid?{source:{request:r,id:o,bytes:e,hash:a$2(e),faceIndex:i}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:l.diagnostic}}}var Bm=96,_c=37.79527559055118;function qm(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let i=Math.floor(e/12);for(let l=0;l<=i;l+=1){let d=l*12;if(l%8===0){let c=l/8;n.push({position:d,height:10,...c>0?{label:String(c)}:{}});}else l%4===0?n.push({position:d,height:6}):l%2===0?n.push({position:d,height:4}):n.push({position:d,height:2});}return n}let r=_c/10,o=Math.floor(e/r);for(let a=0;a<=o;a+=1){let i=a*r;if(a%10===0){let l=a/10;n.push({position:i,height:10,...l>0?{label:String(l)}:{}});}else a%5===0?n.push({position:i,height:6}):n.push({position:i,height:3});}return n}function Zm(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var zm=1440,Vm=567,Km=180,jm=56.7,la=(e,t,n)=>n<t||e<t?t:e>n?n:e;function Um(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 Bc(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 Wm(e,t,n,r,o={}){let a=Bc(t,o.unit??"inch",o.precise??false),i=r.pageWidth-r.rightMargin-n.right,l=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let d=la(a,0,i);return {...n,firstLine:d-r.leftMargin-n.left}}case "left":{let d=-r.leftMargin-Math.min(0,n.firstLine),c=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:la(a-r.leftMargin,d,c)}}case "hanging":{let d=la(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:d,firstLine:n.firstLine+(n.left-d)}}case "right":{let d=la(a,l,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-d}}}}function Je(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 Tn(e){if(typeof e!="object"||e===null)return false;let t=e;return Je(t.from)&&Je(t.to)}function qc(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 Lt(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=Lf$1(t.partByNode.get(o)??e,o)??"";if(n.search===void 0)return {ok:true,span:{nodeId:o,start:0,end:a.length}};if(n.search.length===0)return {ok:false,code:"invalidArgs",reason:"search must be a non-empty phrase"};if(n.occurrence!==void 0){if(!Number.isInteger(n.occurrence)||n.occurrence<1)return {ok:false,code:"invalidArgs",reason:"occurrence must be a positive integer (1-based)"};let l=qc(a,n.search,n.occurrence),d=l[n.occurrence-1];return d===void 0?{ok:false,code:"notFound",reason:`'${n.search}' matches ${l.length} time(s) in paragraph '${n.paraId}'; occurrence ${n.occurrence} does not exist`}:{ok:true,span:{nodeId:o,start:d,end:d+n.search.length}}}let i=qc(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 Zc(e,t,n){if("anchor"in n){let l=Lt(e,t,n.anchor);if(!l.ok)return {ok:false,code:l.code,reason:l.reason,target:n.anchor};let d={paragraphId:l.span.nodeId,offset:l.span.start};return {ok:true,selection:{anchor:d,head:d}}}let{from:r,to:o}=n.range;if(!Je(r)||!Je(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=Lt(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=Lt(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 Xr=/^[0-9A-Fa-f]{6}$/,zc={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"},Gm={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 Ki(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function da(e){return Math.max(0,Math.min(1,e))}function Vc(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 Kc(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 jc(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-da(t))*255)))/255,o=Vc(e);return Kc(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Uc(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(da(t)*255)))/255,o=Vc(e);return Kc(r*o.r,r*o.g,r*o.b)}function ji(e){return zc[e]??zc[e.toLowerCase()]??null}function $m(e,t){let n=ji(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&Xr.test(r))return r.toUpperCase();let o=Gm[n];return o&&Xr.test(o)?o.toUpperCase():null}function ca(e,t){let n=$m(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Ki(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Ki(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=jc(r,da(e.tint)):e.shade!==void 0&&(r=Uc(r,da(e.shade))),{ok:true,hex:r}}var Xm="000000";function Ui(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return Xr.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:Xm}};let n=ca(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:ji(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Wi(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 Xr.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=ca(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:ji(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Ym(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return Xr.test(o)?`#${o}`:`#${n}`}let r=ca(e,t);return `#${r.ok?r.hex:n}`}var th=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function Yn(e){return th.has(e.type)}function le(e,t){return {ok:false,code:e,reason:t}}function Gi(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return le("invalidArgs","the table target is no longer valid");case "table-has-merge":return le("unsupported","this table has merged cells");case "vertical-merge-crossing":return le("unsupported","the row cannot be inserted across a vertical merge");case "block-required":return le("unsupported","the table must keep at least one row or column");case "resource-limit":return le("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return le("invalidArgs","the table command arguments are invalid");default:return le("unsupported",`the table operation was refused (${e})`)}}function We(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ht(e,t){return !We(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function Xc(e){if(!We(e))return false;let t=e.kind;if(t==="hex")return ht(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return ht(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 ht(e,n)}return false}function Yc(e){return We(e)&&ht(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 Qc(e){return We(e)&&ht(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 nh(e){return We(e)&&ht(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 rh(e){return We(e)&&ht(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 oh(e){return !We(e)||!ht(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&Xc(e.color)}function Wc(e){return !("target"in e)||e.target===void 0||Yc(e.target)}function Gc(e){return !("target"in e)||e.target===void 0||Qc(e.target)}function ah(e){switch(e.type){case "insertRow":return !We(e)||e.type!=="insertRow"?le("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?le("invalidArgs","insertRow where must be above or below"):Wc(e)?null:le("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !We(e)||e.type!=="deleteRow"?le("invalidArgs","deleteRow command shape is invalid"):Wc(e)?null:le("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !We(e)||e.type!=="insertColumn"?le("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?le("invalidArgs","insertColumn where must be left or right"):Gc(e)?null:le("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !We(e)||e.type!=="deleteColumn"?le("invalidArgs","deleteColumn command shape is invalid"):Gc(e)?null:le("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !We(e)||!ht(e,["type"])?le("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !We(e)||!ht(e,["type","color"])?le("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!Xc(e.color)?le("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !We(e)||!ht(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?le("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !We(e)||e.type!=="setTableBorders"?le("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?le("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!oh(e.spec)?le("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !We(e)||!ht(e,["type","target","leftWidthTwips","rightWidthTwips"])||!nh(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?le("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !We(e)||!ht(e,["type","target","columnWidthTwips","tableWidthTwips"])||!rh(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?le("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function ih(e){return !("target"in e)||e.target===void 0?null:Yc(e.target)?e.target:null}function sh(e){return !("target"in e)||e.target===void 0?null:Qc(e.target)?e.target:null}function lh(e,t){let n=sf$1(e.root,t.tableId);if(!n.ok)return {rowIds:[t.rowId],wholeTable:false};let r=new Set(t.cellIds),o=n.topology.rows.filter(a=>a.cells.some(i=>r.has(i.id))).map(a=>a.row.id);return o.length===0?{rowIds:[t.rowId],wholeTable:false}:{rowIds:o,wholeTable:o.length===n.topology.rows.length}}function dh(e,t){let n=sf$1(e.root,t.tableId);if(!n.ok||!n.topology.grid)return {gridColumnIds:[],wholeTable:false};let r=new Set(t.cellIds),o=new Set;for(let a of n.topology.rows){let i=0;for(let l of a.cells){let d=Jc(l);if(r.has(l.id))for(let c=0;c<d;c+=1){let m=n.topology.gridColumns[i+c];m&&o.add(m.id);}i+=d;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function $c(e,t,n){let r=sf$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function ch(e){let t=le$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 Jc(e){let t=qf$1(e,"tcPr"),n=t&&qf$1(t,"gridSpan"),r=n&&rf$1(n,"val");if(!r||!/^\d{1,7}$/.test(r))return 1;let o=Number(r);return Number.isInteger(o)&&o>1?Math.min(o,1024):1}function uh(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 l of a){let d=Jc(l);if(r>=i&&r<i+d)return {tableId:t,rowId:o.id,cellId:l.id,cellIds:[l.id],gridColumnIndex:r,isHeaderRepeat:false};i+=d;}}return null}function fh(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=sf$1(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(i=>i.row.id===t.rowId);if(r===-1)return null;let a=n.topology.rows[r].cells[0];return a?{tableId:t.tableId,rowId:t.rowId,cellId:a.id,cellIds:[a.id],gridColumnIndex:0,isHeaderRepeat:false}:null}function ph(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=sf$1(e.part.root,t.tableId);return n.ok?uh(n.topology,t.tableId,t.gridColumnId):null}function gh(e,t){for(let n of t){let r=Jf$1(e,n);if(r)return Gi(r)}return null}function mt(e,t,n){let r=gh(e,t);return r||{ok:true,ops:t,selection:n}}function mh(e,t){if(!uf$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=Ui(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function Yr(e,t,n){return n!==e.storeRevision?le("invalidArgs","the table target is stale"):sf$1(e.part.root,t).ok?null:le("invalidArgs","the table target is no longer valid")}function hh(e){return e?.isHeaderRepeat?le("unsupported","repeated header rows cannot be edited"):null}function yh(e,t,n,r){let o=Yr(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return le("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return le("invalidArgs","column widths must be whole twips");if(n<300||r<300)return le("invalidArgs","column widths are below the minimum");let a=sf$1(e.part.root,t.tableId);if(!a.ok){let x=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return Gi(x)}if(a.topology.hasMerge)return le("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(x=>x.id===t.leftGridColumnId),l=a.topology.gridColumns.find(x=>x.id===t.rightGridColumnId);if(!i||!l)return le("invalidArgs","the table target is no longer valid");let d=a.topology.gridColumns.indexOf(i);if(a.topology.gridColumns.indexOf(l)!==d+1)return le("invalidArgs","the column divider target is not adjacent");let m={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:t.leftGridColumnId,rightGridColumnId:t.rightGridColumnId,leftWidthTwips:n,rightWidthTwips:r};return mt(e.part,[m],{kind:"preserveSelection"})}function bh(e,t,n,r){let o=Yr(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return le("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return le("invalidArgs","column widths must be whole twips");if(n<300)return le("invalidArgs","column widths are below the minimum");let a=sf$1(e.part.root,t.tableId);if(!a.ok){let d=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return Gi(d)}if(a.topology.hasMerge)return le("unsupported","this table has merged cells");let i=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!i||i.id!==t.gridColumnId)return le("invalidArgs","the resize target is not the table right edge");let l={op:"setTableRightEdgeWidth",tableId:t.tableId,gridColumnId:t.gridColumnId,columnWidthTwips:n,tableWidthTwips:r};return mt(e.part,[l],{kind:"preserveSelection"})}function eu(e,t,n){if(e.viewing||!e.editable)return le("locked","the document is open for viewing");let r=Yr(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return le("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return le("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return mt(e.part,[o],{kind:"preserveSelection"})}function en(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return le("locked","the document is open for viewing");switch(t.type){case "mergeCells":return le("unsupported","cell merge is not supported yet");case "splitCell":return le("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return le("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=ah(t);if(a)return a;let i=ih(t),l=sh(t),d=hh(i??l);if(d)return d;if(i){let m=Yr(e,i.tableId,i.sourceRevision);if(m)return m}if(l){let m=Yr(e,l.tableId,l.sourceRevision);if(m)return m}let c=i!==null?fh(e,i):l!==null?ph(e,l):ch(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!c)return i||l?le("invalidArgs","the table target is no longer valid"):le("unsupported","the selection is not inside a table");if(c?.isHeaderRepeat)return le("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!c)return le("unsupported","the selection is not inside a table");let m={op:"insertTableRow",tableId:c.tableId,rowId:c.rowId,where:t.where};return mt(n,[m],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!c)return le("unsupported","the selection is not inside a table");let m=lh(n,c),x=m.wholeTable?[{op:"deleteBlock",blockId:c.tableId}]:m.rowIds.map(v=>({op:"deleteTableRow",tableId:c.tableId,rowId:v,...v===c.rowId?{referenceCellId:c.cellId}:{}}));return mt(n,x,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!c)return le("unsupported","the selection is not inside a table");let m=l?.tableId??c.tableId,x=l?.gridColumnId??$c(n,m,c.gridColumnIndex),v=x?{op:"insertTableColumn",tableId:m,where:t.where,gridColumnId:x}:{op:"insertTableColumn",tableId:m,where:t.where,referenceCellId:c.cellId};return mt(n,[v],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!c)return le("unsupported","the selection is not inside a table");let m=l?.tableId??c.tableId,x=l?.gridColumnId??$c(n,m,c.gridColumnIndex);if(!x)return le("invalidArgs","the table has no grid column to delete");let v=l?.gridColumnId===void 0?dh(n,c):{gridColumnIds:[x],wholeTable:false};if(v.wholeTable)return mt(n,[{op:"deleteBlock",blockId:m}],{kind:"adoptCommittedCaret"});let R=(v.gridColumnIds.length>0?v.gridColumnIds:[x]).map(L=>({op:"deleteTableColumn",tableId:m,gridColumnId:L}));return mt(n,R,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!c)return le("unsupported","the selection is not inside a table");let m={op:"deleteBlock",blockId:c.tableId};return mt(n,[m],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!c)return le("unsupported","the selection is not inside a table");let m;if(t.color===null)m=null;else {let v=Wi(t.color,e.themeColors);if(!v.ok)return le("invalidArgs",v.reason);m=v.color;}let x={op:"setTableCellFill",tableId:c.tableId,cellIds:c.cellIds,color:m};return mt(n,[x],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!c)return le("unsupported","the selection is not inside a table");let m={op:"setTableCellVerticalAlignment",tableId:c.tableId,cellIds:c.cellIds,alignment:t.alignment};return mt(n,[m],{kind:"preserveSelection"})}case "setTableBorders":{if(!c)return le("unsupported","the selection is not inside a table");if(t.scope==="none"){let v={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:"none",target:t.target};return mt(n,[v],{kind:"preserveSelection"})}let m=mh(t.spec,e.themeColors);if(!m.ok)return le("invalidArgs",m.reason);let x={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:t.scope,spec:m.spec};return mt(n,[x],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return yh(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return bh(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return le("unsupported",`command '${t.type}' is not a table command`)}}function tu(e){if(!Yn(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}var vh=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function xh(e,t){return e===t?true:!e||!t?false:vh.every(n=>e[n]===t[n])}function $i(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||!xh(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 Xi(e,t){return e.current===t.current&&e.total===t.total}function Yi(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 nu(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 Qi(e,t){return e===t?true:!e||!t||!Tn(e)||!Tn(t)?false:nu(e.from,t.from)&&nu(e.to,t.to)}function Ji(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var Ih={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",editable:"compared",zoom:"compared",zoomMode:"compared",selection:"compared",selectionCollapsed:"compared",formatting:"compared",table:"compared",tocContext:"compared",image:"compared",page:"compared",canUndo:"compared",canRedo:"compared",pageSetup:"compared",reviewPaneOpen:"compared",hasReviewContent:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared"},Sh=Object.keys(Ih);function es(e,t){return Sh.every(n=>e[n]===t[n])}function ua(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)ua(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))ua(t[n]);return Object.freeze(e)}var ts=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"}}]]),kh=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),Th=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,wh=/^[0-9A-Fa-f]{6}$/;function ns(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!Th.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"&&!wh.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"||!kh.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 iu(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function rs(e){return typeof e=="object"&&e!==null&&iu(e.anchor)&&iu(e.head)}function Qn(e,t){let n=new Error(t);return n.code=e,n}function os(e,t){return e===t?true:!e||!t?false:e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function as(e){return e==="blank"?Ni():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function is(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 Qr(e){switch(e.type){case "toggleMark":return ts.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=ns(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 "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)>Ab$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${Ab$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)>Ab$1)return {supported:false,reason:`indent values must be within \xB1${Ab$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"?{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"||/[\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 "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":return typeof e.text!="string"?{supported:false,code:"invalidArgs",reason:"paste requires text"}:e.text===""?{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=tu(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(rs(e.range)||Tn(e.range))||"anchor"in e&&Je(e.anchor)?{supported:true,mutating:false}:{supported:false,reason:"setSelection accepts { anchor: { paraId } }, a { range } whose from/to are paraId anchors, or a { range } carrying a semantic { anchor: { paragraphId, offset }, head } selection"};case "insertImage":return e.data instanceof Uint8Array&&(e.mime==="image/png"||e.mime==="image/jpeg"||e.mime==="image/gif")&&Number.isFinite(e.widthPoints)&&Number.isFinite(e.heightPoints)&&e.widthPoints>0&&e.heightPoints>0?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"insertImage requires png/jpeg/gif bytes and finite dimensions"};case "replaceImage":return e.data instanceof Uint8Array?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};case "deleteImage":return {supported:true,mutating:true};case "setImageWrapType":return ["inline","square","squareLeft","squareRight","tight","through","topAndBottom","behind","inFront"].includes(e.target)?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported wrap target"};case "transformImage":return e.action==="rotateCW"||e.action==="rotateCCW"||e.action==="flipH"||e.action==="flipV"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported transform action"};case "setImagePosition":return {supported:true,mutating:true};case "setImageProperties":return {supported:true,mutating:true};default:return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`}}}function Ph(e){return [e.left,e.top,e.right,e.bottom]}function ss(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function Ch(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function Jr(e){return Math.round(e*1e3)}function eo(e){return e/1e3}function ls(e){return Object.freeze({left:Jr(e.left),top:Jr(e.top),right:Jr(e.right),bottom:Jr(e.bottom)})}function Rh(e){return Object.freeze({left:eo(e.left),top:eo(e.top),right:eo(e.right),bottom:eo(e.bottom)})}function ds(e){return Ph(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Eh=new Set(["insertImage","replaceImage"]),Fh=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function Oh(e,t,n){if(!e)return null;for(let r of e.drawings??[])if(r.paragraphId===t&&(r.start===n||r.start+1===n))return r;return null}function Ah(e,t,n){let r=e.layout();for(let o of r.pages){for(let a of o.anchoredDrawings??[])if(a.anchorParagraphId===t&&(a.start===n||a.start+1===n))return a;for(let a of [o.header,o.footer])if(a){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&(i.start===n||i.start+1===n))return i}}return null}function su(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=Ud(e.layout(),t.paragraphId,t.offset),o=Oh(r,t.paragraphId,t.offset);return o||Ah(e,t.paragraphId,t.offset)}function lu(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=va$1(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:Ua(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Pa$1,limits:Oa$1,resolveRelationship:Ra$1(e.session.currentPackage(),t.ownerPartName)})}function du(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 Mh(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 cu(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 Lh(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function Kt(e){let t=su(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?lu(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:ss(t.crop),rotationDegrees:r.rotationDegrees,wrap:Lh(t),position:du(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:Mh(t),...cu(n)})}function uu(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 cs(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function fu(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function us(e){return cs(e)!==void 0||fu(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function fs(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=fu(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=cs(t),i=Kt(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:l,head:d}=r.state().selection;if(l.paragraphId!==t.selectionParagraphId||l.offset!==t.selectionOffset||d.paragraphId!==t.selectionParagraphId||d.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return er(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function fn(e,t){let n=Kt(e),r=cs(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 Nh(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 fa(e,t){return Nh(e.applyDrawingOps(t))}function Dh(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 Hh(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function _h(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function Bh(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||zf$1(e)}function pu(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 to(e){return Fh.has(e.type)}function qh(e){return Eh.has(e.type)}function gu(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function mu(e){if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};let t=e.editingMode();return t==="view"?{ok:false,code:"locked",reason:"the document is open for viewing"}:t==="suggest"?{ok:false,code:"invalidArgs",reason:"image property edits are not supported in suggesting mode"}:null}function no(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Kt(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function er(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=Kt(r),l=n.drawingNodeId??t.drawingNodeId;if(!i||!l||i.id!==l)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function ro(e,t){if(!to(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};if(e.type==="insertImage")return !(e.data instanceof Uint8Array)||e.data.byteLength===0?{ok:false,code:"invalidArgs",reason:"insertImage requires image bytes"}:!Number.isFinite(e.widthPoints)||!Number.isFinite(e.heightPoints)?{ok:false,code:"invalidArgs",reason:"insertImage requires finite dimensions"}:e.widthPoints<=0||e.heightPoints<=0?{ok:false,code:"invalidArgs",reason:"insertImage dimensions must be positive"}:null;if(e.type==="replaceImage"){if(!(e.data instanceof Uint8Array)||e.data.byteLength===0)return {ok:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};let o=fn(t,e);return "ok"in o?o:null}let n=fn(t,e);if("ok"in n)return n;let r=Kt(t);if(!r)return {ok:false,code:"notFound",reason:"no drawing is selected"};if(t.editingMode()==="suggest")return e.type==="deleteImage"?{ok:false,code:"invalidArgs",reason:"trackedDrawingDeletionUnsupported"}:{ok:false,code:"invalidArgs",reason:"image property edits are not supported in suggesting mode"};switch(e.type){case "deleteImage":return r.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return r.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return r.locks.changeAspect||r.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!_h(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let o=r.position?.mode??"frame";return Bf$1(e,o)?wf$1(pu(e,r))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(Hh(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!Bh(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!r.intrinsic)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};if(e.widthEmu!==void 0&&(!Number.isFinite(e.widthEmu)||e.widthEmu<=0))return {ok:false,code:"invalidArgs",reason:"widthEmu must be a positive finite number"};if(e.heightEmu!==void 0&&(!Number.isFinite(e.heightEmu)||e.heightEmu<=0))return {ok:false,code:"invalidArgs",reason:"heightEmu must be a positive finite number"};if(e.widthEmu!==void 0&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!ds(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!r.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!L(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!r.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(zf$1(e)){if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let a=r.position?.mode??"frame";if(!Bf$1(e,a))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!wf$1(Af$1(e,r)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function ps(e,t){let n=mu(t);if(n)return n;let r=ro(e,t);return r||{ok:true}}function hu(e,t){let n=ro(e,t);return n||gu(e)}function yu(e,t,n){if(qh(t))return gu(t);let r=n&&us(t)?no(n):null;if(r&&n){let o=fs(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=fn(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=fn(e,t);return "ok"in o?o:fa(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=fn(e,t);return "ok"in o?o:fa(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=fn(e,t);if("ok"in o)return o;let a=Kt(e),i=pu(t,a);return fa(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=fn(e,t);if("ok"in o)return o;let a=Kt(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let c=Dh(a);if(!c)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:c});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??a.widthEmu,cy:t.heightEmu??a.heightEmu}});t.crop!==void 0&&i.push({op:"cropDrawing",drawingNodeId:o.id,crop:ls(t.crop)});let l=t.title??t.alt,d=t.description??t.alt;if((l!==void 0||d!==void 0)&&i.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:l??a.title,description:d??a.description}),t.wrap!==void 0&&i.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),zf$1(t)){let c=Af$1(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:c});}if(t.hyperlink!==void 0){let c=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return c.ok?null:{ok:false,code:"invalidArgs",reason:c.detail??c.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:fa(e,i)}default:return null}}async function gs(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=mu(n);if(r)return r;let o=ro(t,n);if(o)return o;let a=no(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:x}=n.state().selection,v=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let w=await n.insertImage({paragraphId:x.paragraphId,offset:x.offset,bytes:t.data,mime:t.mime,widthPoints:t.widthPoints,heightPoints:t.heightPoints,expectedPackageRevision:v,commitGuard:()=>er(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),R=er(e,a);return R||(w.ok?{ok:true,changed:w.change!==null}:{ok:false,code:"invalidArgs",reason:w.detail==="stale-package-epoch"?"stale package revision":w.detail??w.reason??"insertImage was refused"})}let i=fn(n,t);if("ok"in i)return i;let l=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let d=t.mime??"image/png",c=await n.replaceImage(i.id,t.data,d,{expectedPackageRevision:l,commitGuard:()=>er(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),m=er(e,a,{requireDrawing:true,drawingNodeId:i.id});return m||(c.ok?{ok:true,changed:c.change!==null}:{ok:false,code:"invalidArgs",reason:c.detail==="stale-package-epoch"?"stale package revision":c.detail??c.reason??"replaceImage was refused"})}var Zh=1,zh=10,oo=12700;function Vh(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=cu(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function Kh(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=su(e);if(!r||r.accessibility.hidden)return null;let o=e.publishedLayout(),a=Hc$1(o,r.drawingNodeId);if(!a)return null;let i=lu(e,r);if(!i||i.locks.select)return null;let l=Vh(r,i),c=e.editingMode()==="edit"&&e.session.editable?l:{...l,canResize:false,canMove:false},m=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:du(i),anchorFrameOrigin:m,transform:r.transform,...c})}function et(e){return Math.round(e*oo)}function Jn(e){return e/oo}function jh(e,t,n,r,o,a){let i=Jn(e),l=Jn(t),d=i/l,c=n.includes("e")?r:n.includes("w")?-r:0,m=n.includes("s")?o:n.includes("n")?-o:0;if(i=Math.max(1,i+c),l=Math.max(1,l+m),a)if(n.length===2){let v=Math.max(i/Jn(e),l/Jn(t));i=Math.max(1,Jn(e)*v),l=Math.max(1,i/d);}else n==="e"||n==="w"?l=Math.max(1,i/d):i=Math.max(1,l*d);return Object.freeze({cx:et(i),cy:et(l)})}function ms(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 Uh(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"}:er(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function bu(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 hs(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 ys(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let c=e.session.paraIdOf(t.paragraphId);return c===null?null:{from:{paraId:c},to:{paraId:c}}}let r=e.session.paragraphAnchors(),o=r.paraIdByNode.get(t.paragraphId),a=r.paraIdByNode.get(n.paragraphId);if(o===void 0||a===void 0)return null;let i=r.ordinalByNode.get(t.paragraphId)??0,l=r.ordinalByNode.get(n.paragraphId)??0;return l<i||l===i&&n.offset<t.offset?{from:{paraId:a},to:{paraId:o}}:{from:{paraId:o},to:{paraId:a}}}function vu(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 xu(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$2(n).map(o=>{let a=r.paraIdByNode.get(o.id),i=o.kind==="textValue"?void 0:i$1(o);return {...a!==void 0?{paraId:a}:{},text:Lf$1(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function bs(e){return e?e.state().pageCount:0}function vs(e,t="caret"){return e?e.currentPage(t):1}function Wh(e,t){if(!Yn(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=pa(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 Gh(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 pa(e,t){let n=en(Gh(e,t));return n.ok?{can:{ok:true},plan:n}:{can:{ok:false,code:n.code,reason:n.reason},plan:n}}function ao(e,t,n,r){if(r?.scope){if(r.scope.kind==="all")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"the all scope is read-only"}};if(r.scope.kind==="note"||r.scope.kind==="frame")return {ok:false,refusal:{ok:false,code:"unsupported",reason:`scope kind '${r.scope.kind}' is not supported`}};if(r.scope.kind==="headerFooter"){let i=t?.activeScope?.()??{kind:"body"};if(i.kind!=="headerFooter"||i.rId!==r.scope.rId)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"open that header or footer before dispatching against its scope"}}}}let o=Qr(e);if(!o.supported)return {ok:false,refusal:{ok:false,code:o.code??"unsupported",reason:o.reason}};if(!t)return {ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}};if(o.mutating&&(n==="view"||!t.session.editable))return {ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}};if(e.type==="adjustIndent"&&!t.canAdjustIndent(e.direction))return {ok:false,refusal:{ok:false,code:"unsupported",reason:e.direction==="decrease"?"the selection is already at the outermost level":"the selection cannot indent any further"}};if(e.type==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:i,head:l}=t.state().selection;if(i.paragraphId===l.paragraphId&&i.offset===l.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(i=>i.type==="paragraph"))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"this document defines no paragraph styles"}};if(e.type==="undo"&&!t.session.canUndo())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.session.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==="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"&&(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"}};if(e.type==="insertBreak"&&e.kind==="page"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a page break can only be inserted in the editable document body"}};if(e.type==="linkHeaderFooterToPrevious"){let i=t.headerFooterState?.();if((e.sectionIndex??i?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(Yn(e)){let i=Wh(e,t);return i.ok?{ok:true,tablePlan:i.tablePlan}:i}let a=ro(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function Iu(e){if(!e)return null;let t=e.state(),n=t.cellSelection,r=ke(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 xs(e){if(!e)return null;let t=e.state(),n=t.cellSelection,r=ke(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 Su(e){return e?{...e.bold!==void 0?{bold:e.bold}:{},...e.italic!==void 0?{italic:e.italic}:{},...e.underline!==void 0?{underline:e.underline}:{},...e.fontFamily?{fontFamily:e.fontFamily}:{},...e.fontSizePt!==void 0?{fontSizeHalfPoints:Math.round(e.fontSizePt*2)}:{},...e.styleId?{styleId:e.styleId}:{},...e.alignment?{alignment:e.alignment}:{}}:null}var de={undo:["M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"],redo:["M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"],print:["M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"],file_download:["M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],file_upload:["M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],format_bold:["M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"],format_italic:["M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"],format_underlined:["M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"],strikethrough_s:["M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"],superscript:["M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"],subscript:["M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"],link:["M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"],format_clear:["m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"],format_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 tr={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},Tu=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function Is(e){return createT(en$1)(e)}function ga(e){return Tu.includes(e)}function Yh(e){return e!=null}var wu=[{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"}],Pu=[{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"}],Qh=[{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 Jh(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function e0(e){return e==="none"||Jh(e)}function ku(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function t0(e){return Pu.some(t=>t.value===e)}function wn(e,t,n){switch(t){case "table.borderTarget":return e0(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(!ku(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(!t0(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&&!ku(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function Ss(e,t=tr){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return wn(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return wn(t,e,"single")?.command??null;case "table.borderWidth":return wn(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function n0(e){return wu.find(n=>n.value===e)?.labelKey??"table.borders.all"}function r0(e){return de[e]}function nr(e){return e.surface??null}var o0={"review.comments":{type:"toggleReviewPane"},"history.undo":{type:"undo"},"history.redo":{type:"redo"},"text.bold":{type:"toggleMark",mark:"bold"},"text.italic":{type:"toggleMark",mark:"italic"},"text.underline":{type:"toggleMark",mark:"underline"},"text.strike":{type:"toggleMark",mark:"strike"},"script.super":{type:"toggleMark",mark:"superscript"},"script.sub":{type:"toggleMark",mark:"subscript"},"format.clear":{type:"clearFormatting"},"alignment.left":{type:"setAlignment",align:"left"},"alignment.center":{type:"setAlignment",align:"center"},"alignment.right":{type:"setAlignment",align:"right"},"alignment.justify":{type:"setAlignment",align:"justify"},"list.bullet":{type:"toggleList",kind:"bullet"},"list.numbered":{type:"toggleList",kind:"ordered"},"list.indent":{type:"adjustIndent",direction:"increase"},"list.outdent":{type:"adjustIndent",direction:"decrease"},"insert.footnote":{type:"insertNote",noteKind:"footnote"},"insert.endnote":{type:"insertNote",noteKind:"endnote"},"insert.pageNumber":{type:"insertPageField",field:"PAGE"},"insert.totalPages":{type:"insertPageField",field:"NUMPAGES"},"insert.sectionPages":{type:"insertPageField",field:"SECTIONPAGES"},"insert.pageXofY":{type:"insertPageField",field:"PAGE_X_OF_Y"},"insert.pageBreak":{type:"insertBreak",kind:"page"},"insert.sectionBreakNextPage":{type:"insertBreak",kind:"section"},"insert.toc":{type:"insertToc"},"contentControl.remove":{type:"removeContentControl"}};function a0(e){return Ru[e]??null}var Cu=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),Ru={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:Cu,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 ma(e){return o0[e]??null}var i0={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},s0={"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 Eu(e,t,n){return wn(n,e,t)?.command??null}function ha(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(ga(e))return Eu(e,t,tr);if(e==="image.wrap")return typeof t!="string"||!Na$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=i0[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function Fu(e,t,n=tr){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=Ss(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}}function Ou(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(ga(t))return Fu(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=e.can(ha(t,a==="editing"?"suggesting":"editing"));return {id:t,enabled:i.ok,disabledReason:i.ok?null:i.reason,active:false,value:a}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let a=nr(e),i=a?.state().contentControls,l=t==="contentControl.showAll"?i?.showAll??false:i?.formFill??false;return {id:t,enabled:a!==null,disabledReason:a?null:"editor is not ready",active:l}}if(t==="contentControl.inspector"){let a=nr(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}}let n=ma(t);if(!n){let a=s0[t];if(a!==void 0){let l=ha(t,a);if(!l)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let d=e.can(l),c=e.getSelectedImage?.()??null,m=t==="image.wrap"?c?.wrap:t==="image.altText"?c?.description:void 0;return d.ok?{id:t,enabled:true,disabledReason:null,active:false,...m!==void 0?{value:m}:{}}:{id:t,enabled:false,disabledReason:d.reason,active:false,...m!==void 0?{value:m}:{}}}let i=Ru[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let d=e.canExecuteImageCommand?.({type:"insertImage",data:Cu,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="image.properties"&&i.type==="setImageProperties"){let d=e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="table.insert"&&i.type==="insertTable"){let d=e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="paragraph.dialog"&&i.type==="setParagraphFormat"){let d=e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}let l=e.can(i);if(!l.ok)return {id:t,enabled:false,disabledReason:l.reason,active:false}}return t==="file.save"?{id:t,enabled:false,disabledReason:"save is not a command; run it with runSave(editor)",active:false}:t==="file.open"?{id:t,enabled:false,disabledReason:"open is not a command; run it with editor.load(bytes)",active:false}:{id:t,enabled:false,disabledReason:"not wired to an editor command",active:false}}let r=e.can(n),o=e.isActive?.(n)??false;return r.ok?{id:t,enabled:true,disabledReason:null,active:o}:{id:t,enabled:false,disabledReason:r.reason,active:o}}function l0(e,t){return t.map(n=>Ou(e,n))}function d0(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=wn(r,t,n);if(!o)return {result:{ok:false,code:"unsupported",reason:"invalid table chrome value"},nextDraft:null};let a=e.can(o.command);if(!a.ok)return {result:{ok:false,code:a.code,reason:a.reason},nextDraft:null};let i=e.exec(o.command);return i.ok?{result:i,nextDraft:o.nextDraft}:{result:i,nextDraft:null}}function c0(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="contentControl.showAll"){let a=nr(e);return a?(a.contentControls.setShowAll(!a.contentControls.showAll()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.formFill"){let a=nr(e);return a?(a.contentControls.setFormFill(!a.contentControls.formFill()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.inspector"){let a=nr(e);return a?a.state().contentControls.activeControlId?{ok:true,changed:false}:{ok:false,code:"notFound",reason:"no content control at the selection"}:{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.remove"){let a=nr(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let i=a.state().contentControls.activeControlId;if(!i)return {ok:false,code:"notFound",reason:"no content control at the selection"};let l=a.contentControls.disabledReason(i,"remove");return l?{ok:false,code:l==="bound"?"bound":"locked",reason:l}:a.contentControls.remove(i)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let r=n===void 0?ma(t):ha(t,n)??ma(t);if(!r)return n!==void 0?{ok:false,code:"unsupported",reason:"invalid value for toolbar command"}:t==="file.save"?{ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"}:t==="file.open"?{ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"}:{ok:false,code:"unsupported",reason:"not wired to an editor command"};let o=e.can(r);return o.ok?e.exec(r):{ok:false,code:o.code,reason:o.reason}}function u0(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function f0(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=pa(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function p0(e,t){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let n=e.can(t);return n.ok?e.exec(t):{ok:false,code:n.code,reason:n.reason}}function ks(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(ks):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,ks(e[t])]))}function g0(e){return JSON.stringify(ks(e))}var Ts=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:de.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:de.redo,state:{kind:"command"}}]},{id:"zoom",labelKey:"formattingBar.groups.zoom",controls:[{id:"level",shape:"stepper",valueText:"100%",labelKey:"formattingBar.groups.zoom",paths:null,valueKey:"zoom.zoomLevel",state:{kind:"command"}}]},{id:"styles",labelKey:"formattingBar.groups.styles",controls:[{id:"style",shape:"dropdown",labelKey:"styles.selectAriaLabel",paths:null,valueKey:"styles.normalText",state:{kind:"value"}}]},{id:"font",labelKey:"formattingBar.groups.font",controls:[{id:"family",shape:"dropdown",labelKey:"font.selectAriaLabel",paths:null,valueKey:"font.sansSerif",state:{kind:"value"}},{id:"size",shape:"stepper",valueText:"11",labelKey:"fontSize.listLabel",paths:null,valueKey:"fontSize.label",state:{kind:"value"}}]},{id:"text",labelKey:"formattingBar.groups.textFormatting",controls:[{id:"bold",labelKey:"formattingBar.boldShortcut",paths:de.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:de.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:de.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:de.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:de.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:de.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:de.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:de.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:de.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:de.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:de.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:de.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:de.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:de.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:de.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:de.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:de.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:de.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.clearFormatting",controls:[{id:"clear",labelKey:"formattingBar.clearFormatting",paths:de.format_clear,state:{kind:"command"}}]},{id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:de.comment,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:de.edit_note,state:{kind:"command"}}]},{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:de.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:de.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:de.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:de.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:de.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:de.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:de.wrap_text,valueKey:"imageWrap.inline",state:{kind:"value"}},{id:"altText",shape:"dropdown",labelKey:"formattingBar.altText",paths:null,valueKey:"imageProperties.altText",state:{kind:"value"}}]},{id:"table",labelKey:"formattingBar.groups.table",contextual:true,controls:[{id:"insert",labelKey:"toolbar.table",paths:de.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:de.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:de.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:de.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:de.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:de.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:de.format_line_spacing,state:{kind:"command"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:de.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:de.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:de.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:de.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:de.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:de.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:de.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:de.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:de.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:de.toc,state:{kind:"command"}}]}],Au=Ts;function m0(e,t){return `${e.id}.${t.id}`}function Mu(){return Au.filter(e=>!e.contextual)}function h0(e){let t=Mu();if(!e)return t;let n=Au.find(r=>r.id==="image");return n?[...t,n]:t}var Lu=[{id:"file",labelKey:"toolbar.file",entries:[{kind:"item",slot:"file.open",shortcutKey:"toolbar.openShortcut"},{kind:"item",slot:"file.save",labelKey:"toolbar.save",shortcutKey:"toolbar.saveShortcut"},{kind:"separator"},{kind:"item",slot:"file.pageSetup"}]},{id:"format",labelKey:"toolbar.format",entries:[{kind:"item",slot:"text.bold",labelKey:"formattingBar.bold"},{kind:"item",slot:"text.italic",labelKey:"formattingBar.italic"},{kind:"item",slot:"text.underline",labelKey:"formattingBar.underline"},{kind:"item",slot:"text.strike"},{kind:"separator"},{kind:"item",slot:"alignment.left"},{kind:"item",slot:"alignment.center"},{kind:"item",slot:"alignment.right"},{kind:"item",slot:"alignment.justify"},{kind:"separator"},{kind:"item",slot:"paragraph.dialog"},{kind:"separator"},{kind:"item",slot:"format.clear"}]},{id:"insert",labelKey:"toolbar.insert",entries:[{kind:"item",slot:"table.insert",picker:"tableGrid"},{kind:"separator"},{kind:"item",slot:"insert.footnote"},{kind:"item",slot:"insert.endnote"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.break",paths:de.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function y0(){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 Lu)t(n.entries);return e}function b0(){return Ts.reduce((e,t)=>e+t.controls.length,0)}var v0="formattingBar.unavailableInPreview";var Nu="docx-field-atom--active",x0="docx-field-atom",Du=new WeakMap;function ws(e,t,n){let r=Du.get(e);r||(r={caretKey:null,marked:[]},Du.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(Nu);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${x0}`);for(let i of a){if(i.dataset.paragraphId!==t.paragraphId)continue;let l=Number(i.dataset.start),d=Number(i.dataset.end);!Number.isFinite(l)||!Number.isFinite(d)||t.offset<l||t.offset>d||(i.classList.add(Nu),r.marked.push(i));}}function rr(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function Ae(e){return {anchor:e,head:e}}function Pn(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 Ps(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??rc(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function io(e,t,n){let r=t[0],o=a=>{let i=t.includes(a.paragraphId),l=i?a.paragraphId:r??a.paragraphId,d=i?a.offset:0,c=be(e,l).length;return {paragraphId:l,offset:Math.max(0,Math.min(d,c))}};return {anchor:o(n.anchor),head:o(n.head)}}function _u(e,t,n,r){if(t.paragraphId===n.paragraphId)return be(e,t.paragraphId).slice(t.offset,n.offset);let o=r??rc(e),a=o.indexOf(t.paragraphId),i=o.indexOf(n.paragraphId);if(a===-1||i===-1)return "";let l=o.slice(a,i+1),d=be(e,t.paragraphId).slice(t.offset);for(let c=1;c<l.length;c+=1){let m=l[c],x=be(e,m),v=uc(e,m).includes(l[c-1])?"":`
3
- `;d+=v+(c===l.length-1?x.slice(0,n.offset):x);}return d}function Bu(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 qu(e){return e.kind}function I0(e){return e.kind!=="textValue"&&qu(e)==="contentControl"}function Hu(e){return e.kind!=="textValue"&&qu(e)==="contentControlContent"}function S0(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=Bu(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 k0(e,t,n){let r=new Set,o=(a,i)=>{if(a.kind!=="textValue"){if(a.kind==="table"&&n.has(a.id)){for(let l of a.children)o(l,true);return}if(I0(a)){let l=Bu(a);!i&&l.length>0&&l.every(d=>t.has(d))&&r.add(a.id);for(let d of a.children)o(d,i);return}for(let l of a.children)o(l,i);}};return o(e.root,false),r}function Zu(e,t,n,r,o){let a=A=>be(e,A);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let i=o??rc(e),l=i.indexOf(n.paragraphId),d=i.indexOf(r.paragraphId);if(l===-1||d===-1)return {ops:[],collapseTo:n};let c=new Set;for(let A=l;A<=d;A+=1){let B=i[A];(A===l?n.offset===0:A!==d||r.offset===a(B).length)&&c.add(B);}let m=S0(t,c),x=new Map;for(let[A,B]of m)for(let J of B)x.set(J,A);let v=k0(t,c,m),w=l;if(x.has(n.paragraphId)){w=-1;for(let A=l+1;A<=d;A+=1)if(!x.has(i[A])){w=A;break}if(w===-1){let A=x.get(n.paragraphId);for(let B of m.get(A)??[])x.delete(B);m.delete(A),w=l;}}let R=i[w],L=w===l?n:{paragraphId:R,offset:0},C=[];for(let A=l;A<=d;A+=1){let B=i[A];if(x.has(B))continue;let J=a(B).length,k=A===l?n.offset:0,P=A===d?r.offset:J;k<P&&C.push({op:"deleteText",paragraphId:B,start:k,end:P});}for(let A of m.keys())C.push({op:"deleteBlock",blockId:A});for(let A of v)C.push({op:"removeContentControl",controlId:A});let K=A=>{let B=wa$1(t,A);for(;B&&Hu(B);){let J=wa$1(t,B.id);if(!J||!v.has(J.id))break;B=wa$1(t,J.id);}return B},h=A=>{let B=[],J=k=>{for(let P of k)if(P.kind!=="textValue"&&!m.has(P.id)){if(v.has(P.id)){let G=P.children.find(Hu);G&&G.kind!=="textValue"&&J(G.children);continue}if(P.kind==="paragraph"){B.push(P.id);continue}B.push(`\0barrier:${P.id}`);}};return J(A.children),B},H=(A,B)=>{let J=K(A);if(!J||K(B)!==J)return false;let k=h(J),P=k.indexOf(A),G=k.indexOf(B);return P!==-1&&G===P+1},N=R,M=R;for(let A=w+1;A<=d;A+=1){let B=i[A];x.has(B)||(H(M,B)?C.push({op:"joinParagraphs",firstId:N,secondId:B}):N=B,M=B);}return {ops:C,collapseTo:L}}var T0={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function w0(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 T0[n.toLowerCase()]??t})}var P0=new Set(["script","style"]),C0=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),R0=new Set(["td","th"]),zu=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),E0=e=>zu(e)||e!==void 0&&e>="0"&&e<="9",Vu=e=>e===" "||e===" "||e===`
4
- `||e==="\r"||e==="\f";function F0(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!zu(e[n]))return null;let o=n;for(;n<e.length&&E0(e[n]);)n+=1;let a=e.slice(o,n).toLowerCase(),i="",l=false;for(;n<e.length;){let d=e[n];if(i!=="")d===i&&(i="");else if(d==="=")l=true;else if(l&&(d==='"'||d==="'"))i=d,l=false;else {if(d===">")return {name:a,closing:r,end:n+1};Vu(d)||(l=false);}n+=1;}return {name:a,closing:r,end:e.length}}function O0(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 A0(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&&Vu(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function M0(e){let t=e.length>2e6?e.slice(0,2e6):e,n="",r=0;for(;r<t.length;){let o=t.indexOf("<",r);if(o===-1){n+=t.slice(r);break}if(n+=t.slice(r,o),t.startsWith("<!--",o)){if(t[o+4]===">"){r=o+5;continue}if(t[o+4]==="-"&&t[o+5]===">"){r=o+6;continue}let i=t.indexOf("-->",o+4);r=i===-1?t.length:i+3;continue}if(t[o+1]==="!"||t[o+1]==="?"){let i=t.indexOf(">",o+1);r=i===-1?t.length:i+1;continue}let a=F0(t,o);if(a===null){n+="<",r=o+1;continue}r=a.end,!a.closing&&P0.has(a.name)?r=A0(t,a.name,a.end):!a.closing&&a.name==="br"?n+=`
5
- `:a.closing&&R0.has(a.name)?n+=" ":a.closing&&C0.has(a.name)&&(n+=`
6
- `);}return w0(n).replace(/\r\n?/g,`
7
- `).split(`
8
- `).map(O0).join(`
9
- `).replace(/\n{3,}/g,`
10
-
11
- `).trim()}function Ku(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===12){t+=`
12
- `;continue}if(r===13){t+=`
13
- `,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}function Cs(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?M0(n):""}function L0(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var Gu=/^[^\s]{1,512}$/,N0=/["\\\u0000-\u001f\u007f]/;function ya(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!Gu.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 so(e,t,n){return N0.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function $u(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=ya(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function Xu(e){return e.querySelector("[data-docx-hf-active]")}function Cn(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 D0(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function Rs(e,t){let n=Xu(e);if(n)return [n,e];let r=D0(e,t);return r&&r!==e?[r,e]:[e]}function ju(e,t){let n=$u(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=ya(a);if(i)return {element:a,identity:i}}return null}function H0(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=ju(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=ju(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function Uu(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")||Xu(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?Qu(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let l=e,d=ya(l);if(d)return {paragraphId:d.paragraphId,offset:t>0?d.end:d.start};let c=H0(l,t);return c||Z0(l)}let i=$u(e);return i?{paragraphId:i.identity.paragraphId,offset:L0(i.identity,t)}:null}function lo(e,t){if(!t||t.rangeCount===0)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:a}=t;if(!n||!o)return null;let i=Uu(n,r,e),l=Uu(o,a,e);if(!i||!l){let d=i??l;return d?{anchor:d,head:d}:null}return {anchor:i,head:l}}function Yu(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 Wu(e,t,n){for(let r of Rs(e,n)){let o=_0(r,t);if(o)return o}return null}function _0(e,t){let n=so(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let i of n){let l=ya(i);if(!l||l.paragraphId!==t.paragraphId)continue;let d=B0(i),c=i.textContent?.length??0,m=l.end;if(d&&!i.closest?.("[data-docx-field]")&&(o=true,t.offset>=l.start&&t.offset<=m)){let x={node:d,offset:Math.min(t.offset-l.start,c)};if(t.offset<m)return x;r=x;}}if(r)return r;if(o)return null;let a=q0(e,t.paragraphId);return a?{node:a,offset:0}:null}function B0(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 q0(e,t){let n=null;for(let r of so(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 Qu(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!Gu.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function Z0(e){let t=Qu(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function Ju(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??Cn(n.anchorNode,e),a=Wu(e,t.anchor,o),i=Wu(e,t.head,o);if(!a||!i)return false;let l=lo(e,n);if(l&&or(l,t)){let d=Cn(n.anchorNode,e);if(o===void 0||d===o)return true}try{return n.setBaseAndExtent(a.node,a.offset,i.node,i.offset),!0}catch{return false}}function or(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 z0='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function ef(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 tf(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 V0(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function K0(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function nf(e,t,n,r){if(e.dataset.docxField!==void 0){let a=ef(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:ef(e,t,t+o.length),text:o,seq:r}}function rf(e,t){for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let l=n.textContent??"";l.length>0&&(t.pieces.push({start:t.end,end:t.end,text:l,seq:t.seq}),t.seq+=1);continue}if(n.nodeType!==Node.ELEMENT_NODE)continue;let r=n,o=tf(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(z0))continue;rf(r,t);continue}let a=nf(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 j0(e,t,n,r){let o=[];for(let i of so(e,t,"")){let l=i;l.dataset.paragraphId===t&&l.dataset.start===void 0&&(o.some(d=>d.contains(l))||o.push(l));}let a=new Map;for(let i of o){let l=i.dataset.fragmentIndex??"",d=K0(i,n,r),c=a.get(l);(!c||d>c.affinity)&&a.set(l,{element:i,affinity:d});}return [...a.values()].map(i=>i.element)}function U0(e,t,n){for(let r of so(e,n.paragraphId,"[data-start]")){let o=r,a=tf(o,n.paragraphId);if(a===null||t.some(d=>d.contains(o)))continue;let i=nf(o,a,n.modelText,n.seq);n.seq+=1;let l=`${i.start}:${i.end}`;n.ranges.has(l)||(n.ranges.add(l),n.pieces.push(i));}}function W0(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 of(e,t,n,r){let o=j0(e,t,r,V0(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)rf(i,a);return U0(e,o,a),a.pieces.length===0?null:W0(a.pieces,n)}var G0={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},af={l:"left",e:"center",r:"right",j:"both"},sf={1:"240",5:"360",2:"480"},lf={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function cf(e,t={}){return n=>{if(n.defaultPrevented)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}if((n.ctrlKey||n.metaKey)&&n.altKey&&!n.shiftKey){let a=n.key.toLowerCase();if(a==="f"){n.preventDefault(),e.insertNote("footnote");return}if(a==="d"){n.preventDefault(),e.insertNote("endnote");return}}let r=n.metaKey||n.ctrlKey,o=G0[n.key];if(o){let a=o;n.key==="Home"||n.key==="End"?r&&(a=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?a=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?a=n.key==="ArrowLeft"?"lineStart":"lineEnd":r&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(a=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(a,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(r?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){r||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){r||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"){r?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(r&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(r&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){t.onRequestHyperlink(),n.preventDefault();return}if(r&&!n.shiftKey&&lf[n.key.toLowerCase()]){let a=lf[n.key.toLowerCase()];e.toggleRunProperty(a.localName,a.attributes),n.preventDefault();return}if(r&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(r&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(r&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(r&&!n.shiftKey&&af[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:af[n.key.toLowerCase()]}),n.preventDefault();return}if(r&&!n.shiftKey&&sf[n.key]){e.setParagraphProperty("spacing",{line:sf[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}if(r&&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 uf(e,t){return {onCopy:a=>{let i=e.selectedText();i&&(a.clipboardData?.setData("text/plain",i),a.preventDefault());},onCut:a=>{let i=e.selectedText();i&&(a.clipboardData?.setData("text/plain",i),e.deleteSelection(),a.preventDefault());},onPaste:a=>{let i=Cs(a.clipboardData);a.preventDefault(),i&&t(i);}}}function df(e){let t=Cs(e.dataTransfer);return t.length>0?t:null}function ff(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??df(n);r&&e.type(r);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=df(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function pf(e,t,n,r=null){for(let o of Rs(e)){let a=of(o,t,n,r);if(a!==null)return a}return null}function gf(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 Es(e){let{session:t,measurer:n,producer:r,cache:o,styleCascade:a,numberingIndex:i,defaultTabStopPt:l,displayMode:d,inlineDrawingLayoutForPart:c,drawingLayoutTokenForPart:m,drawingTokenForParagraphForPart:x}=e,v=new WeakMap,w=null,R=-1;function L(M){let A=t.packageRevision();return (!w||R!==A)&&(w=Y0(t.currentPackage()),R=A),w.get(M)}function C(M,A,B){let J=m?.(M.name)??"",k=B?.height??0,P=B?.margin.top??0,G=B?.margin.bottom??0,E=B?.margin.left??0,T=B?.margin.right??0,j=i?.(),U=a?.(),ie=v.get(M);if(ie&&ie.width===A&&ie.pageHeight===k&&ie.marginTop===P&&ie.marginBottom===G&&ie.marginLeft===E&&ie.marginRight===T&&ie.producer===r&&ie.drawingLayoutToken===J&&ie.numberingIndex===j&&ie.styleCascade===U)return ie.story;let ge=c?.(M.name),be=Tc$1(M,A,n,r,o,U,void 0,void 0,l,d,ge,x?ue=>x(M.name,ue):void 0,void 0,B?{pageNumber:1,pageWidth:B.width,pageHeight:B.height,marginLeft:B.margin.left,marginRight:B.margin.right,marginTop:B.margin.top,marginBottom:B.margin.bottom}:void 0,t.documentProperties(),j?{numberingIndex:j}:void 0),pe=L(M.name),fe=pe?mf(be,pe):be;return v.set(M,{width:A,pageHeight:k,marginTop:P,marginBottom:G,marginLeft:E,marginRight:T,producer:r,drawingLayoutToken:J,numberingIndex:j,styleCascade:U,story:fe}),fe}function K(M,A,B){let J=new Map;for(let[k,P]of M)J.set(k,C(P,A,B));return J}function h(M,A){if(!M||M.headers.size===0&&M.footers.size===0)return;let B=A.width-A.margin.left-A.margin.right;return {titlePage:M.titlePage,evenAndOddHeaders:M.evenAndOddHeaders,headers:K(M.headers,B,A),footers:K(M.footers,B,A)}}function H(){let M=bd(t.part(),d),A=t.headerFooterPartsBySection();return M.map((B,J)=>h(A[J],dd(B.properties)))}function N(){let M=H();return M[M.length-1]}return {furniture:N,sectionFurniture:H}}var $0="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",X0="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function Y0(e){let t=new Map,n=e.relationships.get(e.mainDocumentPart)??[];for(let r of n){if(r.type!==$0&&r.type!==X0)continue;let o=E(r);if(o.mode!=="Internal"||!o.target.ok)continue;let a=o.target.partName;t.has(a)||t.set(a,r.id);}return t}function mf(e,t){return e.rId===t?e:{...e,rId:t,withPageContext:n=>mf(e.withPageContext(n),t)}}function hf(e){let t,n,r,o;return {styleCascade(){let a=e.stylesRoot();return (o===void 0||a!==r)&&(r=a,o=Fb$1(a,e.documentThemeFonts())),o},defaultTabStopPt:Qa(e.settingsRoot()),numberingIndex(){let a=e.numberingRoot();return (n===void 0||a!==t)&&(t=a,n=fc(a)),n}}}function yt(e){return e.closest(".docx-editor__scroll-container")}function yf(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 bf(e,t,n){let r=yt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=yf(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 vf(e,t,n,r){let o=yt(e);if(!o||o.clientHeight===0)return;let a=yf(e,o,r),i=[];for(let l of [n.anchor,n.head]){let d=Zd(t,l);d&&i.push(d.pageIndex);}return Pd({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function Fs(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 ba(e,t){let n=e.pages,r=n[n.length-1],o=r?r.box.y+r.box.height:0,a=t?n.filter(c=>t.has(c.index)):n,i=0;for(let c of a){let m=c.box.x+c.box.width;m>i&&(i=m);}let l=new Set(a.map(c=>c.box.width)),d=new Map;if(a.length>0&&l.size>1)for(let c of n)d.set(c.index,(i-c.box.width)/2-c.box.x);return {width:i,height:o,pageOffsetX:d}}function xf(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 If(e){let t=e.session.currentPackage(),n=_d(t,"footnote"),r=_d(t,"endnote");if(!n&&!r)return;let o=e.session.part();if($d$1(o).length===0)return;let a=Id(t),i=Jd$1(a),l=Kd(a),d=Ld(void 0,i),c=Md(void 0,l),m=cd(o),x=m.sections,v=Q0(o,x,m.truncated),w=x.map((h,H)=>Ld(Gd(v[H]),i)),R=x.map((h,H)=>Md(Hd(v[H]),l)),L=e.inlineDrawingLayoutForPart,C=e.drawingTokenForParagraphForPart,K=L?h=>{let H=L(h);if(H)return {inlineDrawingLayout:H,...C?{drawingTokenForParagraph:N=>C(h,N)}:{}}}:void 0;return {footnotesPart:n,endnotesPart:r,footnotePropsBySection:w.length>0?w:[d],endnotePropsBySection:R.length>0?R:[c],documentFootnoteProps:d,documentEndnoteProps:c,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade?.(),numberingIndex:e.numberingIndex?.(),defaultTabStopPt:e.defaultTabStopPt,...K?{drawingsForPart:K}:{},...K&&e.drawingLayoutEpochForPart?{drawingLayoutEpoch:[n,r].map(h=>h?e.drawingLayoutEpochForPart(h.name):"").join("\0")}:{}}}function Q0(e,t,n){let r=Nb$1(e);if(!n)return t.map(a=>{if(a.blockStart===a.blockEndExclusive)return;let i=r[a.blockEndExclusive-1];return i?.kind==="paragraph"?$c$1(i):void 0});let o=[];for(let a=0;a<r.length;a+=1){let i=r[a];if(i.kind!=="paragraph")continue;let l=$c$1(i);l&&o.push(l);}for(;o.length<t.length;)o.push(void 0);return o}function kf(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=await t.createImageBitmap(a);try{let l=i.width,d=i.height;if(l<=0||d<=0)throw new Error("image dimensions invalid");if(l*d>o.maxPixels)throw new Error("image dimensions exceed limits");return Object.freeze({pixelWidth:l,pixelHeight:d,dpiX:96,dpiY:96})}finally{i.close();}},convertPreserved(n,r,o){return r==="image/tiff"?ty(e,n,o):J0(n,r)}})}async function J0(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),l={maxWidth:4096,maxHeight:4096},d=t==="image/x-emf"?await r(i,l):await o(i,l);if(!d)return null;let c="data:image/png;base64,";if(!d.startsWith(c))return null;let m=atob(d.slice(c.length)),x=new Uint8Array(m.length);for(let v=0;v<m.length;v+=1)x[v]=m.charCodeAt(v);return Object.freeze({bytes:x,mime:"image/png"})}function Sf(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 ey(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=Sf(a,"t256"),l=Sf(a,"t257");if(i===null||l===null||i>t.maxDimension||l>t.maxDimension||i>t.maxPixels/l)return null;let d=i*l;if(d*4>t.maxDecodedBytes||(r.decodeImage(o,a),a.width!==i||a.height!==l))return null;let c=r.toRGBA8(a);return c.length!==d*4?null:Object.freeze({rgba:c,pixelWidth:i,pixelHeight:l})}async function ty(e,t,n){let r=await ey(t,n);if(r===null)return null;let o=await ny(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function ny(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 l=await new Promise(d=>{o.toBlob(c=>d(c),"image/png");});return l?new Uint8Array(await l.arrayBuffer()):null}function Tf(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function wf(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 ry="docx-editor-one-surface__caret",Os="docx-editor-one-surface__caret--steady",oy=530;function Pf(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=ry,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,l=null,d=null;function c(){let h=r.activeElement;return h===e||!!h&&e.contains(h)}function m(h){return h.anchor.paragraphId===h.head.paragraphId&&h.anchor.offset===h.head.offset}function x(){l=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(Os),o.remove(),e.style.removeProperty("caret-color"),d?.style.removeProperty("caret-color"),d=null;}function v(){o.classList.add(Os),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(Os);},oy);}function w(){if(a||!c()||n().suppress){x();return}let{layout:h,selection:H,scopedHost:N,scopedHostKind:M,preferredPageIndex:A,measurer:B}=n(),J=t();if(!m(H)){x();return}let k=Zd(h,H.head,{...B?{measurer:B}:{},...A!==void 0?{preferredPageIndex:A}:{}});if(!k||!Number.isInteger(k.pageIndex)){x();return}let P=N??e.querySelector(`[data-page-index="${k.pageIndex}"] > .docx-page-content`);if(!P){x();return}o.style.left=`${k.x*J}px`,o.style.top=`${k.y*J}px`,o.style.height=`${k.height*J}px`,o.parentNode!==P&&P.append(o),e.style.caretColor="transparent",d&&d!==N&&d.style.removeProperty("caret-color"),d=N??null,d?.style.setProperty("caret-color","transparent");let G=P===N?M??"scoped":"body",E=`${k.pageIndex}:${G}:${k.x}:${k.y}:${k.height}`;E!==l&&(l=E,v());}let R=()=>{a=true,w();},L=()=>{a=false,w();},C=()=>w(),K=h=>{let H=h.relatedTarget;H&&e.contains(H)||x();};return e.addEventListener("compositionstart",R),e.addEventListener("compositionend",L),e.addEventListener("focusin",C),e.addEventListener("focusout",K),{update:w,destroy(){e.removeEventListener("compositionstart",R),e.removeEventListener("compositionend",L),e.removeEventListener("focusin",C),e.removeEventListener("focusout",K),x();}}}function As(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function Rn(e,t){let n=As(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function Ms(e,t){return !e||e.kind==="tableBody"?null:As(e.tableId)===As(t)?e:null}function co(e,t,n){let r=i=>{for(let l of i)if(l.kind==="table"){if(l.tableId===t)return l;for(let d of l.rows)for(let c of d.cells){let m=r(c.blocks);if(m)return m}}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 l=r(i.fragments);if(l)return {table:l,origin:i.box}}return null}function Ls(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)Ls(o.blocks,t);}}function ay(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});};Ls(n.fragments,r);for(let o of [n.header,n.footer])o&&Ls(o.fragments,r);}}function Ns(e,t,n,r){let o=null;return ay(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Ds(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function Cf(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function Rf(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function Ef(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var iy=120,Ff=20;function va(e){let t=rf$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function sy(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Hs(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function _s(e,t){return t.kind==="insertColumn"?Ns(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Ns(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function Of(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,l=null,d=false,c=0,m=0,x=null,v=null,w=null;function R(y){return y instanceof HTMLButtonElement&&(y.classList.contains("docx-table-insert-row")||y.classList.contains("docx-table-insert-column"))}function L(){let y=document.activeElement;return y!==null&&R(y)&&y.closest(".docx-table-furniture")===t?y:null}function C(y){for(let I of [...t.children])R(I)&&I!==y&&I.remove();}function K(){v=null,w=null;}function h(){n!==null&&(clearTimeout(n),n=null);}function H(){for(let I of [...t.children])R(I)||I.remove();let y=L();if(!y){C(null),K();return}v=y,C(y);}function N(y){let I=v??L(),V=I!==null&&document.activeElement===I;K(),t.replaceChildren(),y&&V&&e.pagesLayer.focus({preventScroll:true});}function M(){for(let y of [...t.children])R(y)||y.remove();}function A(y,I,V,W){let q=e.read().layout.pages[y];if(!q)return {left:0,top:0};let $=W??q.contentBox,ce=e.scale(),Re=e.pageOffsetX(y);return {left:($.x+I+Re)*ce,top:($.y+V)*ce}}function B(y,I){let V=e.read(),W=co(V.layout,I.tableId,I.pageIndex);if(!W)return;let{table:X,origin:q}=W,$=document.createElement("div");$.className="docx-table-resize-preview",$.style.position="absolute",$.style.pointerEvents="none";let ce=I.kind!=="rowDivider",Re=A(I.pageIndex,ce?X.box.x+y:X.box.x,ce?X.box.y:X.box.y+y,q);$.style.left=`${Re.left}px`,$.style.top=`${Re.top}px`,$.style.width=ce?"2px":`${X.box.width*e.scale()}px`,$.style.height=ce?`${X.box.height*e.scale()}px`:"2px",t.append($);}function J(){let y=document.createElement("button");return y.type="button",y.textContent="+",y.style.position="absolute",y.style.pointerEvents="auto",y}function k(y){T(y);let I=w;if(!I)return;let V=e.read();I.kind==="insertRow"?U(I,V):I.kind==="insertColumn"&&ie(I,V);}function P(){queueMicrotask(()=>{!v||document.activeElement===v||d||r?.kind==="insertRow"||r?.kind==="insertColumn"||(v.remove(),K());});}function G(){if(v&&t.contains(v))return v;let y=L();if(y)return v=y,y;let I=J();return I.addEventListener("pointerenter",()=>{d=true,h();}),I.addEventListener("pointerleave",()=>{d=false;}),I.addEventListener("pointerdown",T),I.addEventListener("mousedown",T),I.addEventListener("click",k),I.addEventListener("blur",P),v=I,I}function E(y,I){let V=co(I.layout,y.tableId,y.pageIndex);if(!V)return;let{table:W,origin:X}=V,q=G();if(C(q),w=y,q.dataset.tableId=y.tableId,y.kind==="insertRow"){let $=W.rows.find(Me=>Me.id===y.rowId);if(!$)return;q.dataset.rowId=y.rowId,delete q.dataset.gridColumnId,q.className="docx-table-insert-row",q.setAttribute("aria-label",e.label("table.insertRowBelow"));let ce=$.box.y+$.box.height/2,Re=A(y.pageIndex,W.box.x-14,ce,X);q.style.left=`${Re.left}px`,q.style.top=`${Re.top-8}px`;}else {let $=W.rows[0]?.cells.find(tt=>tt.gridColumnId===y.gridColumnId);if(!$)return;q.dataset.gridColumnId=y.gridColumnId,delete q.dataset.rowId;let ce=W.columnEdges[$.gridColumn]??0,Re=W.columnEdges[$.gridColumn+1]??W.box.width;q.className="docx-table-insert-column",q.setAttribute("aria-label",e.label("table.insertColumnRight"));let Me=A(y.pageIndex,W.box.x+(ce+Re)/2-8,W.box.y-14,X);q.style.left=`${Me.left}px`,q.style.top=`${Me.top}px`;}t.contains(q)||t.append(q);}function T(y){y.preventDefault(),y.stopPropagation();}function j(y,I){if(M(),C(v??L()),!(l||I.editingMode==="view")){if((y.kind==="columnDivider"||y.kind==="rightEdge")&&!y.isHeaderRepeat){let V=co(I.layout,y.tableId,y.pageIndex);if(!V)return;let{table:W,origin:X}=V,q=document.createElement("div");q.className=y.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",q.style.position="absolute",q.style.pointerEvents="auto",q.style.cursor="col-resize",q.dataset.active="true";let $=A(y.pageIndex,W.box.x+y.edgeX,W.box.y,X);q.style.left=`${$.left-3}px`,q.style.top=`${$.top}px`,q.style.width="6px",q.style.height=`${W.box.height*e.scale()}px`,q.addEventListener("pointerdown",ge),t.append(q);}if(y.kind==="rowDivider"&&!y.isHeaderRepeat){let V=co(I.layout,y.tableId,y.pageIndex);if(!V)return;let{table:W,origin:X}=V,q=document.createElement("div");q.className="docx-table-row-divider-handle layout-table-row-resize-handle",q.style.position="absolute",q.style.pointerEvents="auto",q.style.cursor="row-resize",q.dataset.active="true";let $=A(y.pageIndex,W.box.x,W.box.y+y.edgeY,X);q.style.left=`${$.left}px`,q.style.top=`${$.top-3}px`,q.style.width=`${W.box.width*e.scale()}px`,q.style.height="6px",q.addEventListener("pointerdown",ge),t.append(q);}y.kind==="insertRow"&&!y.isHeaderRepeat&&E(y,I),y.kind==="insertColumn"&&!y.isHeaderRepeat&&E(y,I);}}function U(y,I){let V=_s(I.layout,y);if(!V)return;let W=Hs(I),X=en({command:{type:"insertRow",where:"below",target:Ds(y.sourceRevision,V)},part:Rn(e.session(),y.tableId),layout:I.layout,storeRevision:I.storeRevision,selection:I.selection,cellSelection:I.cellSelection,themeColors:I.themeColors,...W});e.applyTableCommandPlan(X);}function ie(y,I){let V=_s(I.layout,y);if(!V)return;let W=V.row.cells.find(ce=>ce.gridColumnId===y.gridColumnId);if(!W)return;let X=Cf(y.sourceRevision,V,W);if(!X)return;let q=Hs(I),$=en({command:{type:"insertColumn",where:"right",target:X},part:Rn(e.session(),y.tableId),layout:I.layout,storeRevision:I.storeRevision,selection:I.selection,cellSelection:I.cellSelection,themeColors:I.themeColors,...q});e.applyTableCommandPlan($);}function ge(y){if(y.button!==0)return;let I=e.read();if(I.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;y.preventDefault(),y.stopPropagation();let V=r,W=_s(I.layout,V);if(!W)return;let X=sf$1(Rn(e.session(),V.tableId).root,V.tableId);if(!X.ok||V.kind!=="rowDivider"&&X.topology.hasMerge)return;let q=0,$=0,ce=0,Re=X.topology.gridColumns.reduce((Ee,ze)=>Ee+va(ze),0),Me;if(V.kind==="columnDivider"){let Ee=X.topology.gridColumns.find(Ne=>Ne.id===V.leftGridColumnId),ze=X.topology.gridColumns.find(Ne=>Ne.id===V.rightGridColumnId);if(!Ee||!ze)return;q=va(Ee),$=va(ze),Me=Rf(V.sourceRevision,W,V.leftGridColumnId,V.rightGridColumnId);}else if(V.kind==="rightEdge"){let Ee=X.topology.gridColumns.find(ze=>ze.id===V.gridColumnId);if(!Ee)return;q=va(Ee),$=0,Me=Ef(V.sourceRevision,W,V.gridColumnId);}else ce=Math.max(20,Math.round(W.row.box.height*Ff)),Me=Ds(V.sourceRevision,W);let tt=y.currentTarget;tt.setPointerCapture(y.pointerId),c=y.clientX,m=y.clientY,l={pointerId:y.pointerId,startClientX:y.clientX,startClientY:y.clientY,startEdgePt:V.kind==="rowDivider"?V.edgeY:V.edgeX,leftTwips:q,rightTwips:$,tableWidthTwips:Re,rowHeightTwips:ce,target:V,ref:W,resizeTarget:Me,captureElement:tt,rightEdge:V.kind==="rightEdge",vertical:V.kind==="rowDivider",cancelled:false};for(let Ee of [...t.children])Ee!==tt&&Ee.remove();B(V.kind==="rowDivider"?V.edgeY:V.edgeX,V);}function be(){if(l){try{l.captureElement.hasPointerCapture(l.pointerId)&&l.captureElement.releasePointerCapture(l.pointerId);}catch{}l.cancelled=true,l=null,H(),r=null;}}function pe(){if(!l||l.cancelled){l=null,H();return}let y=l;l=null;try{y.captureElement.hasPointerCapture(y.pointerId)&&y.captureElement.releasePointerCapture(y.pointerId);}catch{}if(y.vertical?m===y.startClientY:c===y.startClientX){H();return}let I=e.read(),V=Hs(I),W=(y.vertical?m-y.startClientY:c-y.startClientX)/e.scale(),X=Math.round(W*Ff),q;if(y.target.kind==="rowDivider")q=eu({part:Rn(e.session(),y.target.tableId),layout:I.layout,storeRevision:I.storeRevision,selection:I.selection,cellSelection:I.cellSelection,themeColors:I.themeColors,...V},y.resizeTarget,Math.max(20,y.rowHeightTwips+X));else if(y.rightEdge&&y.target.kind==="rightEdge"){let $=Math.max(300,y.leftTwips+X),ce=Math.max($,y.tableWidthTwips+X);q=en({command:{type:"commitTableRightEdgeResize",target:y.resizeTarget,columnWidthTwips:$,tableWidthTwips:ce},part:Rn(e.session(),y.target.tableId),layout:I.layout,storeRevision:I.storeRevision,selection:I.selection,cellSelection:I.cellSelection,themeColors:I.themeColors,...V});}else if(y.target.kind==="columnDivider"){let $=y.leftTwips+X,ce=y.rightTwips-X;$=Math.max(300,$),ce=Math.max(300,ce);let Re=y.leftTwips+y.rightTwips;$+ce!==Re&&($>Re-300?($=Re-300,ce=300):ce=Re-$),q=en({command:{type:"commitTableColumnDividerResize",target:y.resizeTarget,leftWidthTwips:$,rightWidthTwips:ce},part:Rn(e.session(),y.target.tableId),layout:I.layout,storeRevision:I.storeRevision,selection:I.selection,cellSelection:I.cellSelection,themeColors:I.themeColors,...V});}else {H();return}e.applyTableCommandPlan(q),H();}function fe(y){if(!o||!x)return null;let I=e.pageOffsetX(x.pageIndex);return Mc$1(o,x.x,x.y,y.layout,I,x.pageIndex)}function ue(y){if(!r||l||y.editingMode==="view")return;h();let I=fe(y),V=Ms(I,y.selection.head.paragraphId);if(!V){r=null,H();return}if(Kc$2(V)!==Kc$2(r)){r=null,H();return}r=V,j(V,y);}function Pe(){let y=v??L(),I=y!==null&&document.activeElement===y;K(),y&&t.contains(y)&&y.remove(),I&&e.pagesLayer.focus({preventScroll:true});}function Tt(y){if(l||y.editingMode==="view")return;let I=v??L();if(!I||!t.contains(I)){w&&K();return}if(v=I,!w||w.kind!=="insertRow"&&w.kind!=="insertColumn")return;if(!o){Pe();return}let V=Kc$2(w),W=Lc$1(o,w);if(!W||Kc$2(W)!==V){Pe();return}w=W,E(W,y);}function Ze(y){let I=e.read();if(l&&y.pointerId===l.pointerId){c=y.clientX,m=y.clientY;let ce=(l.vertical?y.clientY-l.startClientY:y.clientX-l.startClientX)/e.scale();for(let Re of [...t.children])Re!==l.captureElement&&Re.remove();B(l.startEdgePt+ce,l.target);return}if(I.editingMode==="view"){N(false);return}let V=sy(e,y.clientX,y.clientY),W=yc(I.layout,V.y);W>=0&&(x={x:V.x,y:V.y,pageIndex:W});let X=W>=0?e.pageOffsetX(W):0,q=o?Mc$1(o,V.x,V.y,I.layout,X,W>=0?W:void 0):null,$=Ms(q,I.selection.head.paragraphId);if(!$){if(d)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,H();},iy));return}n&&(clearTimeout(n),n=null),!(r&&Jc$1($)===Jc$1(r))&&(r=$,j($,I));}function Ge(y){if(!(!l||y.pointerId!==l.pointerId)){if(e.read().editingMode==="view"){be();return}pe();}}function D(y){!l||y.pointerId!==l.pointerId||be();}function ne(y){y.key!=="Escape"||!l||be();}return e.pagesLayer.addEventListener("pointermove",Ze),document.addEventListener("pointermove",Ze),document.addEventListener("pointerup",Ge),document.addEventListener("pointercancel",D),e.pagesLayer.addEventListener("keydown",ne),{update(){let y=e.read(),I=a,V=i;o=Ic(y.layout),a=y.layout.revision,i=y.storeRevision,y.editingMode==="view"?(be(),r=null,h(),N(true)):I!==null&&(I!==y.layout.revision||V!==y.storeRevision)&&(r!==null&&ue(y),Tt(y)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let y=e.read();if(y.editingMode==="view")return;let I=v??L();if(I&&t.contains(I)&&w&&(w.kind==="insertRow"||w.kind==="insertColumn")){E(w,y);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&E(r,y);},destroy(){h(),be(),K(),H(),e.pagesLayer.removeEventListener("pointermove",Ze),document.removeEventListener("pointermove",Ze),document.removeEventListener("pointerup",Ge),document.removeEventListener("pointercancel",D),e.pagesLayer.removeEventListener("keydown",ne),t.remove();}}}function Bs(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 l of i.cells)n(l.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 qs(e,t,n){e.has(t.paragraphId)||e.set(t.paragraphId,n);for(let r of t.lines)for(let o of tc(r))e.has(o.paragraphId)||e.set(o.paragraphId,n);}var Af=new WeakMap,Mf=new WeakMap;function ly(e){let t=Mf.get(e);if(t)return t;let n=new Map;return Bs(e,r=>qs(n,r,r.props)),Mf.set(e,n),n}function ir(e,t){let n=Af.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of ly(r))n.has(o)||n.set(o,a);Af.set(e,n);}return n.get(t)??[]}var Lf=new WeakMap;function dy(e){let t=Lf.get(e);if(t)return t;let n=new Map;return Bs(e,r=>qs(n,r,r.tabStops)),Lf.set(e,n),n}function uo(e,t){let n=Nf.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of dy(o))r.has(a)||r.set(a,i);n=r,Nf.set(e,r);}return n.get(t)??null}var Nf=new WeakMap,Df=new WeakMap,Hf=new WeakMap;function cy(e){let t=Hf.get(e);if(t)return t;let n=new Map;return Bs(e,(r,o)=>qs(n,r,{indent:r.indent,inTable:o})),Hf.set(e,n),n}function uy(e,t){let n=Df.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of cy(o))r.has(a)||r.set(a,i);n=r,Df.set(e,r);}return n.get(t)??null}function xa(e,t,n,r,o){let a=va$1(e,t);if(!a||a.kind!=="paragraph")return [];let i=[],l=mg$1(a),d=ng$1(a);return Ob$1(a.children,0,c=>{if(c.kind!=="run")return;let m=l.get(c.id);if(!m||m.end<=m.start)return;let x=Math.max(m.start,n),v=Math.min(m.end,r);if(x>=v)return;let w=hg$1(gg$1(c,"runProperties","rPr"),eg$1);i.push({start:x,end:v,properties:kg$1(w,og$1(w,o)),...d.has(c.id)?{targetRunIds:[c.id]}:{}});}),i}function _f(e,t,n,r){let o=va$1(e,t);if(!o||o.kind!=="paragraph")return false;let a=mg$1(o),i=false,l=d=>{if(i||d.kind!=="run")return;let c=a.get(d.id);!c||c.end<=c.start||Math.max(c.start,n)>=Math.min(c.end,r)||hg$1(gg$1(d,"runProperties","rPr"),eg$1).length>0&&(i=true);};return Ob$1(o.children,0,l),i}function Bf(e,t,n){let r=va$1(e,t);if(!r||r.kind!=="paragraph")return [];let o=mg$1(r),a=null,i=null,l=c=>{if(c.kind!=="run")return;let m=o.get(c.id);!m||m.end<=m.start||(m.start<n&&n<=m.end&&(a=c),i===null&&m.start<=n&&n<m.end&&(i=c));};Ob$1(r.children,0,l);let d=a??i;return d?hg$1(gg$1(d,"runProperties","rPr"),eg$1):jg(e,t)}function ar(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 qf(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:ar(t,"b")===true};break;case "i":n={...n,italic:ar(t,"i")===true};break;case "u":n={...n,underline:ar(t,"u")===true};break;case "strike":n={...n,strikethrough:ar(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 Zf(e,t,n,r){return n&&n.length>0?he(e,n):ee(e,t,r??sc(e))}function Zs(e,t,n,r,o,a){let i=Zf(e,t,r,a);if(i.length===0)return false;let l=d=>{switch(n){case "b":return d.style.bold;case "i":return d.style.italic;case "u":return d.style.underline!==null;case "strike":return d.style.strike;case "vertAlign":return d.style.verticalAlign===o;default:return false}};return i.every(l)}function zf(e,t,n,r,o,a){let i=Zf(e,t,r,a),l=i.map(T=>T.style),d=T=>{if(l.length===0)return null;let j=T(l[0]);return l.every(U=>T(U)===j)?j:null},c=(T,j=(U,ie)=>U===ie)=>T.length>0&&T.every(U=>j(U,T[0]))?T[0]:null,m=(T,j)=>T.props.some(U=>U.localName===j),x=T=>T.style.fontFamily??n?.(T.range.paragraphId,T.props).fontFamily??null,v=T=>m(T,"sz")?Math.round(T.style.fontSizePt*2):n?.(T.range.paragraphId,T.props).fontSizeHalfPoints??Math.round(T.style.fontSizePt*2),w=i.length===0?n?.(t.head.paragraphId,[]):void 0,R=fy(e,t,r,a),L=T=>c(R.map(j=>T(ir(e,j)))),C=(T,j=(U,ie)=>U===ie)=>{if(R.length<2)return false;let U=T(ir(e,R[0]));return R.some((ie,ge)=>ge>0&&!j(T(ir(e,ie)),U))},K=L(T=>Bb$1(T)),h=L(T=>pa$1(T,"pStyle")?.val??o??void 0)??null,H=T=>pa$1(T,"spacing")??void 0,N=T=>{let j=H(T),U=Number(j?.line);if(!Number.isFinite(U))return "";let ie=j?.lineRule??"auto";return ie==="auto"?`multiple:${Math.round(U/240*100)/100}`:`${ie==="exact"?"exact":"atLeast"}:${Math.round(U/20*100)/100}`},M=L(N),A=(()=>{if(!M)return null;let[T,j]=M.split(":");return {rule:T,value:Number(j)}})(),B=(T,j)=>{let U=Number(H(T)?.[j]);return Number.isFinite(U)?Math.round(U/20*100)/100:null},J=T=>L(j=>B(j,T)),k=(()=>{let T=R.map(ue=>uy(e,ue)),j=T[0];if(!j||T.some(ue=>ue===null||ue.inTable))return null;let U=ue=>Math.round(ue*20),ie=ue=>U(ue.hanging>0?-ue.hanging:ue.firstLine),ge=T,be=U(j.indent.left),pe=U(j.indent.right),fe=ie(j.indent);return {left:be,right:pe,firstLine:fe,mixed:{left:ge.some(ue=>U(ue.indent.left)!==be),right:ge.some(ue=>U(ue.indent.right)!==pe),firstLine:ge.some(ue=>ie(ue.indent)!==fe)}}})(),P=T=>L(j=>T(Kb$1(j))),G=L(ia$1),E=L(ta);return {bold:l.length>0&&l.every(T=>T.bold),italic:l.length>0&&l.every(T=>T.italic),underline:l.length>0&&l.every(T=>T.underline!==null),strikethrough:l.length>0&&l.every(T=>T.strike),superscript:l.length>0&&l.every(T=>T.verticalAlign==="superscript"),subscript:l.length>0&&l.every(T=>T.verticalAlign==="subscript"),fontFamily:i.length>0?c(i.map(x)):w?.fontFamily??null,fontSizeHalfPoints:i.length>0?c(i.map(v)):w?.fontSizeHalfPoints??null,color:d(T=>T.color),highlight:d(T=>T.highlight),alignment:K,styleId:h,lineSpacing:A,spaceBeforePt:J("before"),spaceAfterPt:J("after"),disagrees:{alignment:C(T=>Bb$1(T)),spaceBeforePt:C(T=>B(T,"before")),spaceAfterPt:C(T=>B(T,"after")),lineSpacing:C(N),tabStops:(()=>{if(R.length<2)return false;let T=JSON.stringify(uo(e,R[0])?.stops??null);return R.some((j,U)=>U>0&&JSON.stringify(uo(e,j)?.stops??null)!==T)})()},indent:k,tabStops:c(R.map(T=>uo(e,T)?.stops??null),(T,j)=>T===null||j===null?T===j:T.length===j.length&&T.every((U,ie)=>Math.round(U.positionPt*20)===Math.round(j[ie].positionPt*20)&&U.alignment===j[ie].alignment&&(U.leader??"none")===(j[ie].leader??"none")))?.map(T=>({positionTwips:Math.round(T.positionPt*20),alignment:T.alignment,...T.leader?{leader:T.leader}:{}}))??null,paragraphFlags:{contextualSpacing:E,keepNext:P(T=>T.keepNext),keepLines:P(T=>T.keepLines),widowControl:P(T=>T.widowControl),pageBreakBefore:G}}}function fy(e,t,n,r){if(n&&n.length>0)return [...ge(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??sc(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 Vf(e,t,n,r){return t.paragraphId!==n.paragraphId?[]:t.offset!==0||n.offset!==e.length?[]:e.length===0?[]:[{op:"setParagraphMarkProperties",paragraphId:t.paragraphId,properties:r}]}function Kf(e){let{session:t,commit:n,orderedRange:r,selectionMark:o,textOf:a}=e,i=()=>t.partFor(e.storyScope())??t.part(),l=(R,L,C)=>t.applyTreeOps(R,L,C,e.storyScope()),d={get value(){return e.layout()}},c={get value(){return e.selection()}},m=(R,L,C)=>{let K=i();if(R.paragraphId===L.paragraphId){let A=xa(K,R.paragraphId,R.offset,L.offset,C);if(A.length===0)return;let B=pg$1(K,R.paragraphId,C);n(()=>l([...A.map(J=>({op:"setRunProperties",paragraphId:R.paragraphId,start:J.start,end:J.end,properties:J.properties,...J.targetRunIds?{targetRunIds:J.targetRunIds}:{}})),...Vf(a(R.paragraphId),R,L,B)],o()));return}let h=e.paragraphOrder(),H=h.indexOf(R.paragraphId),N=h.indexOf(L.paragraphId);if(H===-1||N===-1)return;let M=[];for(let A=H;A<=N;A+=1){let B=h[A],J=a(B),k=A===H?R.offset:0,P=A===N?L.offset:J.length,G=k<P?xa(K,B,k,P,C):[];for(let T of G)M.push({op:"setRunProperties",paragraphId:B,start:T.start,end:T.end,properties:T.properties,...T.targetRunIds?{targetRunIds:T.targetRunIds}:{}});(A<N||k===0&&P===J.length&&J.length>0)&&M.push({op:"setParagraphMarkProperties",paragraphId:B,properties:pg$1(K,B,C)});}M.length!==0&&n(()=>l(M,o()));},x=(R,L)=>{let C=i(),K=[];for(let h of ge(d.value,R)){let H=a(h);for(let N of xa(C,h,0,H.length,L))K.push({op:"setRunProperties",paragraphId:h,start:N.start,end:N.end,properties:N.properties,...N.targetRunIds?{targetRunIds:N.targetRunIds}:{}});K.push({op:"setParagraphMarkProperties",paragraphId:h,properties:pg$1(C,h,L)});}return K.length===0?false:(n(()=>l(K,o()),void 0,{keepCellSelection:true}),true)},v=R=>{fg$1(R.localName)&&e.setPendingFormats(kg$1(e.pendingFormats()??[],R));},w=R=>{if(R.length===0)return;let L=e.selectedCells?.(),C=L&&L.length>0?[...ge(d.value,L)]:null,{from:K,to:h}=r(),H=C??e.paragraphOrder(),N=C?0:H.indexOf(K.paragraphId),M=C?H.length-1:H.indexOf(h.paragraphId);if(N===-1||M===-1)return;let A=i(),B=H.slice(N,M+1).map(J=>{let k=ig$1(A,J);for(let P of R){let G=P.mergeAttributes?{...k.find(T=>T.localName===P.localName)?.attributes??{},...P.attributes}:P.attributes??{},E=Object.fromEntries(Object.entries(G).filter(([,T])=>T!=null));k=kg$1(k,{localName:P.localName,...Object.keys(E).length>0?{attributes:E}:{}});}return {op:"setParagraphProperties",paragraphId:J,properties:k}});B.length!==0&&n(()=>l(B,o()),void 0,{keepCellSelection:C!==null});};return {setRunProperty(R,L){let C={localName:R,...L?{attributes:L}:{}},K=e.selectedCells?.();if(K&&K.length>0){x(K,C);return}let{from:h,to:H}=r();if(h.paragraphId===H.paragraphId&&h.offset===H.offset){v(C);return}m(h,H,C);},setParagraphProperty(R,L,C){w([{localName:R,...L?{attributes:L}:{},...C??{}}]);},setParagraphProperties:w,formatting:()=>qf(zf(d.value,c.value,(R,L)=>{let C=t.effectiveRunDefaults(R,L);if(C.fontFamily!==null)return C;let K=e.defaultFontFamily?.()??null;return K===null?C:{...C,fontFamily:K}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder()),e.pendingFormats()),toggleRunProperty(R,L){let C=e.selectedCells?.(),K=L?.val,h=ar(e.pendingFormats(),R,K)??Zs(d.value,c.value,R,C,K,e.paragraphOrder()),H=h?{localName:R,attributes:{val:py[R]??"0"}}:{localName:R,...L?{attributes:L}:{}};if(C&&C.length>0){x(C,H);return}let{from:N,to:M}=r();if(N.paragraphId===M.paragraphId&&N.offset===M.offset){let A=e.pendingFormats()??[],B=Zs(d.value,c.value,R,void 0,K,e.paragraphOrder());if(!h===B){let J=A.filter(k=>k.localName!==R);e.setPendingFormats(J.length>0?J:null);}else v(H);return}m(N,M,H);},clearFormatting(){e.setPendingFormats(null);let R=d.value,L=e.paragraphOrder(),C=e.selectedCells?.(),K=C&&C.length>0?[...ge(R,C)]:gy(L,r());if(K.length===0)return;let{from:h,to:H}=r(),N=C!==void 0&&C.length>0,M=i(),A=[];for(let B of K){let J=a(B),k=N||B!==h.paragraphId?0:h.offset,P=N||B!==H.paragraphId?J.length:H.offset;k<P&&_f(M,B,k,P)&&A.push({op:"setRunProperties",paragraphId:B,start:k,end:P,properties:[]}),jg(M,B).length>0&&A.push({op:"setParagraphMarkProperties",paragraphId:B,properties:[]}),ig$1(M,B).length>0&&A.push({op:"setParagraphProperties",paragraphId:B,properties:[]});}A.length!==0&&n(()=>l(A,o()),void 0,{keepCellSelection:N});}}}var py={u:"none",vertAlign:"baseline"};function gy(e,t){let n=e.indexOf(t.from.paragraphId),r=e.indexOf(t.to.paragraphId);return n===-1||r===-1?[]:e.slice(n,r+1)}var my=500,jf=4,sr=40,Ia=12;function hy(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 Uf(e,t){return hy(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 St(e,t,n){let r=rc(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function $f(e,t,n){if(!(t>Zb$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Zb$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)$f(a.blocks,t+1,n);}}}function zs(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,l)=>{(!n||St(e,i,n)<0)&&(n=i),(!r||St(e,l,r)>0)&&(r=l);},a=t.level!=="inline";for(let i of t.fragments){let l=e.pages[i.pageIndex];l&&$f(l.fragments,0,d=>{if(Uf(i.box,d.box)){if(a){let c=be(e,d.paragraphId).length;o({paragraphId:d.paragraphId,offset:0},{paragraphId:d.paragraphId,offset:c});return}for(let c of d.lines)for(let m of c.spans)Uf(i.box,m.box)&&o({paragraphId:m.range.paragraphId,offset:m.range.start},{paragraphId:m.range.paragraphId,offset:m.range.end});}});}return !n||!r?null:{from:n,to:r}}function yy(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function Wf(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=Dc$1(e,t.pageIndex,o);return a?.placeholder?a:null}let r=yy(e,n);return r?.placeholder?r:null}function Gf(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=St(e,t.anchor,t.head)<=0?t.anchor:t.head,o=St(e,t.anchor,t.head)<=0?t.head:t.anchor,a=true;for(;a;){a=false;for(let l of n){if(!l.placeholder)continue;let d=zs(e,l);!d||!(St(e,r,o)===0?St(e,r,d.from)>=0&&St(e,r,d.to)<0:St(e,r,d.to)<0&&St(e,o,d.from)>0)||(St(e,d.from,r)<0&&(r=d.from,a=true),St(e,d.to,o)>0&&(o=d.to,a=true));}}return St(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function Xf(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=n.ownerDocument,a=o.defaultView,i=null,l=null,d=0,c=0,m=0,x=0,v=null;function w(D,ne){if(!l){let I=n.getBoundingClientRect();l={left:I.left,top:I.top};}let y=e.scale()||1;return {x:(D-l.left)/y,y:(ne-l.top)/y}}function R(D){return {scope:{kind:"headerFooter",rId:D.rId},pageIndex:D.pageIndex,kind:D.kind,partName:D.partName,variant:D.variant}}function L(D,ne){let y=e.layout(),I=w(D,ne),V=yc(y,I.y),W=y.pages[V];if(!W)return null;let X=e.measurer();return Ac$1(y,V,{x:I.x-W.contentBox.x-e.pageOffsetX(V),y:I.y-W.contentBox.y},X?{measurer:X}:{})}function C(D,ne){let y=e.activeNote?.()??null;if(y){let q=e.layout(),$=Zi(q,w(D,ne),e.pageOffsetX);if(!$||$.scopeId!==y.scopeId)return null;let ce=e.measurer();return Bc$1(q,$.pageIndex,$.fragments,$.local,{...ce?{measurer:ce}:{}})}let I=e.activeHeaderFooter?.()??null;if(!I)return L(D,ne);let V=e.layout(),W=w(D,ne),X=Vi(V,W,e.pageOffsetX);if(X&&Di(X.story,R(I))){let q=e.measurer();return _i(V,X.pageIndex,X.story,X.local,q?{measurer:q}:{})}return null}function K(D,ne){let{story:y,pageIndex:I,kind:V}=D;return {rId:y.rId,pageIndex:I,kind:V,partName:y.partName,variant:y.variant,...ne?{position:ne}:{}}}function h(D){let ne=e.measurer();return _i(e.layout(),D.pageIndex,D.story,D.local,ne?{measurer:ne}:{})?.position??void 0}let H=new WeakMap;function N(D,ne){let y=e.activeNote?.();if(y){let X=Xn(D,null,y.scopeId).indexOf(ne);return X===-1?-1:X}let I=e.activeHeaderFooter?.();if(I){let X=Xn(D,R(I)).indexOf(ne);return X===-1?-1:X}let V=H.get(D);return V||(V=new Map(rc(D).map((W,X)=>[W,X])),H.set(D,V)),V.get(ne)??-1}function M(D,ne,y){let I=N(D,ne.paragraphId),V=N(D,y.paragraphId);return I!==V?I<V:ne.offset<y.offset}let A=/[\p{L}\p{N}_'’]/u,B=D=>D!==void 0&&A.test(D);function J(D,ne,y){if(y==="character")return {from:ne,to:ne};let I=be(D,ne.paragraphId),V=ne.paragraphId;if(y==="paragraph")return {from:{paragraphId:V,offset:0},to:{paragraphId:V,offset:I.length}};let W=Math.max(0,Math.min(ne.offset,I.length)),X=-1;if(B(I[W])?X=W:W>0&&B(I[W-1])&&(X=W-1),X===-1){let q=W,$=W;for(;q>0&&/\s/.test(I[q-1]??"");)q-=1;for(;$<I.length&&/\s/.test(I[$]??"");)$+=1;return q===$&&$<I.length&&($+=1),{from:{paragraphId:V,offset:q},to:{paragraphId:V,offset:$}}}return {from:{paragraphId:V,offset:Wd(I,X+1,-1)},to:{paragraphId:V,offset:Wd(I,X,1)}}}function k(D,ne,y,I,V){let W=V?Wf(D,V):null,X=W?zs(D,W)??J(D,y,I):J(D,y,I),q=M(D,X.from,ne.from)?{anchor:ne.to,head:X.from}:{anchor:ne.from,head:X.to};return Gf(D,q)}let P=r.closest(".docx-editor__scroll-container");function G(){return r.closest(".docx-editor__scroll-container")}function E(D,ne,y){if(y<D+sr){let I=Math.max(0,D+sr-y);return -Math.min(Ia,I/sr*Ia)}if(y>ne-sr){let I=Math.max(0,y-(ne-sr));return Math.min(Ia,I/sr*Ia)}return 0}function T(){v!==null&&(a?.cancelAnimationFrame(v),v=null);}function j(){v=null;let D=i,ne=G();if(!D||!ne||!a)return;let y=ne.getBoundingClientRect(),I=E(y.top,y.bottom,D.clientY);I!==0&&(ne.scrollTop+=I,l=null,ie(D.clientX,D.clientY),v=a.requestAnimationFrame(j));}function U(){if(v!==null||!a||!i)return;let D=G();if(!D)return;let ne=D.getBoundingClientRect();E(ne.top,ne.bottom,i.clientY)!==0&&(v=a.requestAnimationFrame(j));}function ie(D,ne){let y=i;if(!y)return;let I=C(D,ne);I&&(e.isReadOnlyParagraph?.(I.position.paragraphId)||ge(y,I)||e.setSelection(k(e.layout(),y.anchorRange,I.position,y.granularity,I)));}function ge(D,ne){let y=D.anchorCell;if(!y)return false;if(!ne.cell||ne.cell.tableId!==y.tableId)return D.cellDragging;if(!D.cellDragging&&ne.cell.cellId===y.cellId)return false;let I=fe(e.layout(),y,ne.cell);return I?(D.cellDragging=true,e.setCellSelection(I),true):D.cellDragging}function be$1(D){let ne=Date.now(),y=ne-c;return d=Math.abs(D.clientX-m)<=jf&&Math.abs(D.clientY-x)<=jf&&y>=0&&y<=my?d+1:1,c=ne,m=D.clientX,x=D.clientY,d}let pe=["character","word","paragraph"],fe$1=D=>{if(D.button!==0)return;let ne=D.target?.closest?.("[data-docx-cc-widget]");if(ne){if(D.preventDefault(),D.stopPropagation(),ne.hasAttribute("disabled")||ne.dataset.disabledReason)return;let ve=ne.dataset.docxCcId,ke=ne.dataset.docxCcWidget;ve&&ke&&e.onContentControlWidget?.(ve,ke);return}if(D.pointerType==="touch")return;i&&Ze(),l=null;let y=e.layout(),I=w(D.clientX,D.clientY),V=e.activeHeaderFooter?.()??null,W=e.activeNote?.()??null,X=Vi(y,I,e.pageOffsetX),q=Zi(y,I,e.pageOffsetX),$=D.target?.closest("[data-docx-hf]"),ce=!!($||X),Re=D.target,Me=Re?.closest("[data-docx-note-ref]"),tt=Re?.closest("[data-docx-note-mark-back]"),Ee=null,ze=()=>Ee??=be$1(D);if(Me?.dataset.docxNoteScope){D.preventDefault(),e.focus(),e.enterNote?.(Me.dataset.docxNoteScope);return}if(tt){D.preventDefault(),e.focus(),e.exitNote?.(true);return}if(q&&!ce){let ve=e.measurer?.(),ke=Bc$1(y,q.pageIndex,q.fragments,q.local,{...ve?{measurer:ve}:{}});if(!W||W.scopeId!==q.scopeId){D.preventDefault(),e.focus(),e.enterNote?.(q.scopeId,ke?{paragraphId:ke.position.paragraphId,offset:ke.position.offset}:void 0,q.pageIndex);return}if(W.pageIndex!==q.pageIndex){D.preventDefault(),e.focus(),e.enterNote?.(q.scopeId,ke?{paragraphId:ke.position.paragraphId,offset:ke.position.offset}:void 0,q.pageIndex);return}}else if(W){if(!Hi(y,I,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(V)if(X&&Di(X.story,R(V)))X.pageIndex!==V.pageIndex&&e.enterHeaderFooter?.(K(X,h(X)));else if(X&&X.story.rId){D.preventDefault(),e.focus(),e.enterHeaderFooter?.(K(X,h(X)));return}else if(Hi(y,I,e.pageOffsetX)){D.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let ve=ze()>=2?zi(y,I,e.pageOffsetX):null;ve&&(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ve.kind,ve.pageIndex));return}else if(ce&&ze()>=2){if(X?.story.rId)D.preventDefault(),e.focus(),e.enterHeaderFooter?.(K(X,h(X)));else if($ instanceof HTMLElement){let ve=$.dataset.docxRId,ke=$.dataset.docxHf,it=$.closest("[data-page-index]")?.getAttribute("data-page-index"),wt=it!=null?Number(it):NaN;if((ke==="header"||ke==="footer")&&Number.isInteger(wt))if(ve){let tn=y.pages[wt]?.[ke];D.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:ve,pageIndex:wt,kind:ke,partName:tn?.partName??"",variant:tn?.variant??"default"});}else y.pages[wt]?.[ke]||(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ke,wt));}return}else if(ze()>=2){let ve=zi(y,I,e.pageOffsetX);if(ve){D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ve.kind,ve.pageIndex);return}}let Ne=C(D.clientX,D.clientY);if(!Ne)return;if(e.isReadOnlyParagraph?.(Ne.position.paragraphId)){D.preventDefault();return}D.preventDefault(),e.focus();try{n.setPointerCapture(D.pointerId);}catch{}o.addEventListener("pointermove",Pe),o.addEventListener("pointerup",Tt),o.addEventListener("pointercancel",Tt);let gn=ze(),at=D.shiftKey?"character":pe[(gn-1)%pe.length],Ve=Wf(y,Ne);if(Ve&&!D.shiftKey){if(e.selectContentControl?.(Ve.id)){let ke=e.selection(),it=M(y,ke.anchor,ke.head)||ke.anchor.paragraphId===ke.head.paragraphId&&ke.anchor.offset===ke.head.offset?{from:ke.anchor,to:ke.head}:{from:ke.head,to:ke.anchor};i={pointerId:D.pointerId,granularity:"character",anchorRange:it,anchorCell:Ne.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY};return}let ve=zs(y,Ve);if(ve){i={pointerId:D.pointerId,granularity:"character",anchorRange:ve,anchorCell:Ne.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ue(()=>e.setSelection({anchor:ve.from,head:ve.to}));return}}if(D.shiftKey){let ve=e.selection();i={pointerId:D.pointerId,granularity:at,anchorRange:{from:ve.anchor,to:ve.anchor},anchorCell:Ne.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ue(()=>e.setSelection(k(y,{from:ve.anchor,to:ve.anchor},Ne.position,at,Ne)));}else {let ve=J(y,Ne.position,at);i={pointerId:D.pointerId,granularity:at,anchorRange:ve,anchorCell:Ne.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ue(()=>e.setSelection(Gf(y,{anchor:ve.from,head:ve.to})));}};function ue(D){try{D();}catch(ne){throw Ze(),ne}}let Pe=D=>{let ne=i;!ne||D.pointerId!==ne.pointerId||(D.preventDefault(),ne.clientX=D.clientX,ne.clientY=D.clientY,ie(D.clientX,D.clientY),U());},Tt=D=>{let ne=i;if(!ne||D.pointerId!==ne.pointerId)return;Ze();try{n.releasePointerCapture(ne.pointerId);}catch{}let y=e.cellSelection();y?e.setCellSelection(y):e.setSelection(e.selection());};function Ze(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,l=null,T(),o.removeEventListener("pointermove",Pe),o.removeEventListener("pointerup",Tt),o.removeEventListener("pointercancel",Tt);}let Ge=()=>{l=null;};return n.addEventListener("pointerdown",fe$1),P?.addEventListener("scroll",Ge,{passive:true}),a?.addEventListener("scroll",Ge,{capture:true,passive:true}),a?.addEventListener("resize",Ge,{passive:true}),{dragging:()=>i!==null,destroy(){Ze(),n.removeEventListener("pointerdown",fe$1),P?.removeEventListener("scroll",Ge),a?.removeEventListener("scroll",Ge,{capture:true}),a?.removeEventListener("resize",Ge);}}}function Yf(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i;function l(M){let A=Cn(M?.anchorNode,n)??Cn(M?.focusNode,n);A!==void 0&&(i=A);}function d(M){return i??Cn(M?.anchorNode,n)??Cn(M?.focusNode,n)}let c=false,m=false,x=false,v=null,w=false;function R(){let M=t.getSelection(),A=lo(n,M);return !A||(l(M),or(A,e.selection()))?false:(e.adoptSelection(A),true)}function L(){let M=t.activeElement;if(M&&n.contains(M))return true;let A=t.getSelection();if(!A||A.rangeCount===0)return true;let B=A.anchorNode;return !B||!B.isConnected?true:n.contains(B)}let C=()=>{let M=t.getSelection(),A=lo(n,M);if(!A){if(!Yu(n,M))return;c=false;let B=Ae(e.selection().head);if(or(B,e.selection()))return;e.setSelection(B);return}c=false,l(M),!or(A,e.selection())&&e.setSelection(A);};function K(M){let A=e.textOf(M),B=pf(n,M,A,t.getSelection()?.anchorNode??null);if(B===null)return;let J=gf(M,A,B);if(!J)return;let k=J.ops.find(U=>U.op==="deleteText"),P=J.ops.find(U=>U.op==="insertText"),G=P&&k?e.replacementOffset?.(M,k.start,k.end):void 0,E=P&&G!==void 0&&G!==P.offset?J.ops.map(U=>U===P?{...P,offset:G}:U):J.ops,T=P?e.pendingFormatOps?.(M,G??P.offset,P.text.length)??[]:[],j=e.storyScope();e.commit(()=>{let U=e.applyOps([...E,...T],e.selectionMark(),j);return T.length===0||!U.rejected?U:e.applyOps(E,e.selectionMark(),j)}),e.setSelection(Ae({paragraphId:M,offset:P&&G!==void 0?G+P.text.length:J.caret}));}function h(){o||x||e.isGesturing?.()||e.holdsCellSelection?.()||H()||c&&C();}function H(){if(!m||c)return false;if(!a)return true;let M=lo(n,t.getSelection());return M!==null&&or(M,a)}function N(M){M instanceof PointerEvent&&M.button!==0||(c=true);}return n.addEventListener("pointerdown",N,true),n.addEventListener("selectstart",N,true),{adoptBeforePaint(){let M=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,A=m||M||!c?false:R();return e.hasPendingInput?.()!==true&&(m=false),A},noteModelMoved(){m=true;},noteSelectionSettled(){m=false;},mirrorToDom(M=false){if(e.updateCaret(),!M&&!L())return;o=true;let A=e.now(),B=e.domSelection?.()??e.selection();c=false;let J=t.getSelection(),k=d(J),P=Ju(n,B,J,k!==void 0?{preferredPageIndex:k}:void 0);P&&l(J),a=P?B:null,P||(m=true),e.recordSelectionMs(e.now()-A),queueMicrotask(()=>{o=false;});},adoptBeforeInput:h,isComposing:()=>x,onSelectionChange:()=>{o||x||e.isGesturing?.()||e.holdsCellSelection?.()||H()||C();},onCompositionStart:()=>{h(),x=true;let M=e.selection();w=M.anchor.paragraphId!==M.head.paragraphId,v=M.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:M=>{x=false;let A=v??e.selection().head.paragraphId;v=null;let B=w;w=false;let J=e.storyScope(),k=r.revisionFor(J);if(B){let P=M?.data??"";P.length>0&&e.replaceSelectionWith?.(P);}else K(A);r.endComposition(),r.revisionFor(J)===k&&e.discardPaint?.(),e.flushLayout(),e.render();},selectionPageIndex:()=>i,destroy(){n.removeEventListener("pointerdown",N,true),n.removeEventListener("selectstart",N,true),c=false;}}}var by=32;function Jf(e,t,n,r){if(!(e.kind==="textValue"||r>by)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)Jf(o,t,n,r+1);}}function Iy(e){let t=Nb$1(e),n=bd(e),r=new Map;for(let o=0;o<n.length;o+=1){let a=n[o];for(let i=a.blockStart;i<a.blockEndExclusive;i+=1){let l=t[i];l&&Jf(l,o,r,0);}}return r}var Qf=new WeakMap;function Sy(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$3.section))}function ky(e,t){t.story&&t.story.kind!=="body"||Sy(t)||(e.map=null);}function Ty(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>ky(t,n)));}function wy(e,t){let n=Qf.get(e);return n||(n={map:null,subscribed:false},Qf.set(e,n)),Ty(e,n),n.map||(n.map=Iy(t)),n.map}function ep(e,t,n){return n.startsWith(`${t.name}#`)?wy(e,t).get(n)??null:null}var tp=32;function fo(e,t,n,r){let o=e.part(),a=bd(o);if(a.length<=1)return 0;let i=Vs(e,t);if(i!==null)return i;if(n.kind==="headerFooter"){if(r!==void 0&&a[r]!==void 0)return r;let d=e.headerFooterResolutionBySection().findIndex(c=>[c.headers,c.footers].some(m=>[...m.values()].some(x=>x.rId===n.rId)));return d===-1?0:d}let l=Cy(e,t);if(l!==null){let d=Vs(e,l);if(d!==null)return d}return 0}function np(e,t,n,r){let o=e.part(),a=bd(o);if(a.length<=1)return {kind:"whole-document"};if(Vs(e,t)!==null)return {kind:"anchor",paragraphId:t};let l=fo(e,t,n,r),d=a[l];if(!d)return {kind:"unaddressable"};let c=Nb$1(o);for(let m=d.blockStart;m<d.blockEndExclusive;m+=1){let x=Py(c[m]);if(x!==null)return {kind:"anchor",paragraphId:x}}return {kind:"unaddressable"}}function Py(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>tp)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 Vs(e,t){return ep(e,e.part(),t)}function Cy(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=_d(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of Bd(o.root)){let i=qd(a);if(i===null||!Ry(a,t))continue;return $d$1(e.part()).find(d=>d.noteKind===r&&d.noteId===i)?.paragraphId??null}}return null}function Ry(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>tp)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 lr(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 Sa(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 rp(e){return {val:e?"1":"0"}}var Ey="list paragraph",Fy="ListParagraph";function op(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function ap(e){let{session:t}=e;function n(){let a=null;for(let i of t.documentStyles())if(i.type==="paragraph"){if(i.name.trim().toLowerCase()===Ey)return i.styleId;a===null&&i.styleId===Fy&&(a=i.styleId);}return a}let r;function o(){let a=t.stylesRoot();return (r===void 0||r.root!==a)&&(r={root:a,styleId:Fb$1(a,t.documentThemeFonts()).defaultParagraphStyleId}),r.styleId}return {applyOps(a){let i=n();if(i===null)return [];let l=o(),d=e.storyPart(),c=[];for(let m of a){let x=ig$1(d,m),v=op(x);v!==void 0&&v!==l||c.push({op:"setParagraphProperties",paragraphId:m,properties:kg$1(x,{localName:"pStyle",attributes:{val:i}})});}return c},clearOp(a){let i=n();if(i===null)return null;let l=ig$1(e.storyPart(),a);return op(l)!==i?null:{op:"setParagraphProperties",paragraphId:a,properties:l.filter(d=>d.localName!=="pStyle")}}}}var Oy=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function Ay(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 ka(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 ip(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 sp(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:a,collapsedAt:i}=e,l=e.deleteSelectionPlan,d=()=>t.partFor(e.storyScope())??t.part(),c=(k,P,G)=>t.applyTreeOps(k,P,G,e.storyScope()),m=ap({session:t,storyPart:d}),x=()=>e.paragraphOrder(),v={get value(){return e.layout()}};function w(){let k=e.selectedCells?.();return k&&k.length>0?k:null}function R(k){let P=false;return n(()=>{let G=k();return P=G.committed,G},void 0,{keepCellSelection:w()!==null}),P}function L(){if(w()!==null)return [...ge(v.value,w())];let{from:k,to:P}=o(),G=x(),E=G.indexOf(k.paragraphId),T=G.indexOf(P.paragraphId);return E===-1||T===-1?null:G.slice(E,T+1)}let C=720,K=8;function h(k){return H(k)?.level??null}function H(k){return wc$2(v.value,k)?.marker??null}function N(k){let P=H(k);return P?P.numFmt==="bullet"?"bullet":"ordered":null}function M(k,P){let G=x(),E=G.indexOf(k[0]??""),T=G.indexOf(k[k.length-1]??"");if(E===-1||T===-1)return null;for(let j of [E-1,T+1]){let U=G[j];if(!U)continue;let ie=H(U);if(ie&&(ie.numFmt==="bullet"?"bullet":"ordered")===P)return ie.numId}return null}function A(k,P){return P<0||P>K?false:e.numberingLevelExists(k.numId,P)}function B(k,P){return P<0||P>K?false:e.numberingLevelExists(k.numId,P)?true:t.ensureNumberingLevel(k.numId,P,k.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(k.numId,P)}function J(k){let P;for(let G of k){if(G.localName!=="ind")continue;let E=G.attributes?.left??G.attributes?.start;E!==void 0&&(P=E);}return !P||!/^-?\d{1,7}$/.test(P)?0:Number(P)}return {insertTab(){let k=l(),P=k.collapseTo;n(()=>c([...k.ops,{op:"insertTab",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},insertLineBreak(){let k=l(),P=k.collapseTo;n(()=>c([...k.ops,{op:"insertHardBreak",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},insertPageBreak(){let k=l(),P=k.collapseTo;n(()=>c([...k.ops,{op:"insertPageBreak",paragraphId:P.paragraphId,offset:P.offset}],a()),()=>i({...P,offset:P.offset+1}));},exitListOnEmptyItem(){let{from:k,to:P}=o();if(k.paragraphId!==P.paragraphId||k.offset!==P.offset)return false;let G=H(k.paragraphId);if(!G||e.paragraphTextOf(k.paragraphId).length>0)return false;let T=G.level>0&&A(G,G.level-1),j=[];if(T)j.push({op:"setListLevel",paragraphId:k.paragraphId,level:G.level-1});else {let ie=m.clearOp(k.paragraphId);ie&&j.push(ie),j.push({op:"setListNumbering",paragraphId:k.paragraphId,numId:null});}let U=false;return n(()=>{let ie=c(j,a());return U=ie.committed,ie}),U},isListParagraph(){let{paragraphId:k}=r();return h(k)!==null},isListActive(k){let P=L();if(P===null)return false;let G=k==="bullet"?"bullet":"ordered";return P.length>0&&P.every(E=>N(E)===G)},toggleList(k){let P=L();if(P===null||P.length===0)return false;let G=P.every(j=>N(j)===k),E=G?null:M(P,k)??t.ensureListDefinition(k);if(!G&&E===null)return false;let T=G?[]:m.applyOps(P);for(let j of P){let U=h(j);T.push({op:"setListNumbering",paragraphId:j,numId:E,...U!==null?{level:U}:{}});}return R(()=>c(T,a()))},canAdjustIndent(k){let P=L();if(P===null)return false;let G=k==="increase"?1:-1;return P.some(E=>{let T=H(E);if(T){let U=T.level+G;return U>=0&&U<=K}let j=J(ir(v.value,E));return Math.max(0,j+G*C)!==j})},adjustIndent(k){let P=L();if(P===null)return false;let G=k==="increase"?1:-1,E=[];for(let T of P){let j=ir(v.value,T),U=H(T),ie=U?.level??null;if(U&&ie!==null){let ue=ie+G;if(ue<0||ue>K||!B(U,ue))continue;E.push({op:"setListLevel",paragraphId:T,level:ue});continue}let ge=J(j),be=Math.max(0,ge+G*C);if(be===ge)continue;let pe=ig$1(d(),T),fe=pe.find(ue=>ue.localName==="ind");E.push({op:"setParagraphProperties",paragraphId:T,properties:kg$1(pe,{localName:"ind",attributes:Ay(fe?.attributes,String(be))})});}return E.length===0?false:R(()=>c(E,a()))},setIndent(k){if(k.left===void 0&&k.right===void 0&&k.firstLine===void 0)return false;let P=L();if(P===null)return false;let G=[];for(let E of P){let T=ig$1(d(),E),U={...T.find(ie=>ie.localName==="ind")?.attributes??{}};k.left!==void 0&&(U=ka(U,"left","start",k.left)),k.right!==void 0&&(U=ka(U,"right","end",k.right)),k.firstLine!==void 0&&(U=ip(U,k.firstLine)),G.push({op:"setParagraphProperties",paragraphId:E,properties:kg$1(T,{localName:"ind",...Object.keys(U).length>0?{attributes:U}:{}})});}return G.length===0?false:R(()=>c(G,a()))},setParagraphFormat(k){let P=L();if(P===null||P.length===0)return false;let G=[];k.alignment!==void 0&&G.push({localName:"jc",attributes:{val:k.alignment}});let E={...lr("before",k.spaceBeforePt),...lr("after",k.spaceAfterPt),...Sa(k.lineSpacing)};Object.keys(E).length>0&&G.push({localName:"spacing",attributes:E,mergeAttributes:true});for(let[ie,ge]of Oy){let be=k[ie];be!==void 0&&G.push({localName:ge,attributes:rp(be)});}let T=k.tabStops!==void 0,j=k.indentLeftTwips!==void 0||k.indentRightTwips!==void 0||k.indentFirstLineTwips!==void 0;if(G.length===0&&!j&&!T)return false;let U=[];for(let ie of P){let ge=ig$1(d(),ie),be=ge;if(j){let fe={...ge.find(ue=>ue.localName==="ind")?.attributes??{}};k.indentLeftTwips!==void 0&&(fe=ka(fe,"left","start",k.indentLeftTwips)),k.indentRightTwips!==void 0&&(fe=ka(fe,"right","end",k.indentRightTwips)),k.indentFirstLineTwips!==void 0&&(fe=ip(fe,k.indentFirstLineTwips)),be=kg$1(be,{localName:"ind",...Object.keys(fe).length>0?{attributes:fe}:{}});}for(let pe of G){let fe=pe.mergeAttributes?{...be.find(Pe=>Pe.localName===pe.localName)?.attributes??{},...pe.attributes}:pe.attributes??{},ue=Object.fromEntries(Object.entries(fe).filter(([,Pe])=>Pe!=null));be=kg$1(be,{localName:pe.localName,...Object.keys(ue).length>0?{attributes:ue}:{}});}if((G.length>0||j)&&U.push({op:"setParagraphProperties",paragraphId:ie,properties:be}),T){let pe=uo(e.layout(),ie);U.push({op:"setParagraphTabStops",paragraphId:ie,stops:k.tabStops.map(fe=>({positionTwips:Math.round(fe.positionTwips),alignment:fe.alignment,...fe.leader&&fe.leader!=="none"?{leader:fe.leader}:{}})),...pe?{inForcePositionsTwips:pe.stops.map(fe=>Math.round(fe.positionPt*20))}:{}});}}return U.length===0?false:R(()=>c(U,a()))},sectionProperties:()=>ad(t.part()),sectionPropertiesAt(k){let P=bd(t.part()),G=fo(t,k,e.storyScope(),e.headerFooterSectionIndex?.());return (P[G]??P[P.length-1]).properties},sectionAnchorParagraphAt(k){return np(t,k,e.storyScope(),e.headerFooterSectionIndex?.())},setSectionProperties(k){let P=false;return n(()=>{let G=e.storyScope().kind==="body",E=t.applyTreeOps([{op:"setSectionProperties",...k}],G?a():void 0,void 0,{kind:"body"});return P=E.committed,E}),P},insertSectionBreak(){if(e.storyScope().kind!=="body")return false;let k=l(),P=k.collapseTo,G=new Set(t.paragraphIds()),E=false;return n(()=>{let T=t.applyTreeOps([...k.ops,{op:"splitParagraph",paragraphId:P.paragraphId,offset:P.offset},{op:"setSectionMark",paragraphId:P.paragraphId}],a(),void 0,{kind:"body"});return E=T.committed,T},()=>{let T=t.paragraphIds().find(j=>!G.has(j));return T?i({paragraphId:T,offset:0}):null}),E}}}var My=4096;function Ly(e){let t=e.tooltip!==null?{tooltip:q$1(e.tooltip)}:{};if(e.target!==null){let n=L(e.target);if(n.ok&&n.href.length>0&&x(n.href).ok){let o=e.anchor!==null&&!n.href.includes("#")?L(q$1(e.anchor)):null;return {kind:"external",href:o&&o.ok&&o.href.length>0?`${n.href}#${o.href}`:n.href,authored:e.target,...e.anchor!==null?{anchor:q$1(e.anchor)}:{},...t}}if(e.anchor===null)return null}if(e.anchor!==null){let n=q$1(e.anchor),r=L(n);return {kind:"internal",href:r.ok&&r.href.length>0?`#${r.href}`:null,authored:e.anchor,anchor:n,...t}}return null}function lp(){let e=new Map,t=new Map,n=0;return {project(r){let o=Ly(r);if(!o)return null;let a=`${r.target??""}\0${r.anchor??""}\0${r.tooltip??""}`,i=e.get(a);if(i===void 0){if(e.size>=My)return null;n+=1,i=`field-hyperlink:${n}`,e.set(a,i),t.set(i,Object.freeze({id:i,paragraphId:"",start:0,end:0,text:"",kind:o.kind,href:o.href,authored:o.authored,...o.anchor!==void 0?{anchor:o.anchor}:{},...o.tooltip!==void 0?{tooltip:o.tooltip}:{}}));}return {id:i,kind:o.kind,href:o.href,...o.anchor!==void 0?{anchor:o.anchor}:{},...o.tooltip!==void 0?{tooltip:o.tooltip}:{}}},linkById(r){return t.get(r)??null}}}var up=32;function js(e){return e.kind!=="textValue"&&e.kind==="contentControl"}function Us(e){return e.kind!=="textValue"&&e.kind==="contentControlContent"}function En(e){return e.kind==="textValue"?[]:e.children}function Ks(e,t=0){return e.kind==="run"?[e]:e.kind==="hyperlink"?e.children.flatMap(n=>Ks(n,t)):js(e)?t>=up?[]:En(e).filter(n=>Us(n)).flatMap(n=>En(n).flatMap(r=>Ks(r,t+1))):[]}function Ta(e){if(e.kind==="textValue")return e.value.length;if(e.kind==="tab"||e.kind==="hardBreak")return 1;if(e.kind==="runProperties"||e.kind==="generic")return 0;if(js(e)){let n=0;for(let r of En(e))if(Us(r))for(let o of En(r))n+=Ta(o);return n}let t=0;for(let n of En(e))t+=Ta(n);return t}function fp(e,t,n){for(let r of e){if(r.kind==="hyperlink"){n(r);continue}if(js(r)){if(t>=up)continue;for(let o of En(r))Us(o)&&fp(En(o),t+1,n);continue}n(r);}}function dp(e,t,n,r){let o=Ny(e,t);if(!o||o.kind!=="paragraph")return [];let a=r(t),i=[],l=0;return fp(o.children,0,d=>{if(d.kind==="run"){l+=Ta(d);return}if(d.kind!=="hyperlink")return;let c=l;for(let x of Ks(d))l+=Ta(x);let m=Ka(d,n);i.push({id:d.id,paragraphId:t,start:c,end:l,text:a.slice(c,l),kind:m.kind,href:m.href,authored:m.authored,...m.anchor!==void 0?{anchor:m.anchor}:{},...m.tooltip!==void 0?{tooltip:m.tooltip}:{}});}),i}function Ny(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 Dy(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 Hy(e,t){for(let n of $(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 pp(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=c=>e.session.relationshipTarget(c,t()),o=(c,m,x)=>e.session.applyTreeOps(c,m,x,t()),a=c=>{let m=n();return m?dp(m,c,r,e.textOf):[]},i=()=>Dy(a(e.selection().head.paragraphId),e.selection().head),l=()=>{let c=e.selection().head,m=Hy(e.layout(),c);return m===null?null:e.fieldLinkById(m)},d=c=>{let m=e.selection().head.paragraphId,x=a(m).find(v=>v.id===c);if(x)return x;for(let v of e.session.storyParts()){let w=R=>Zc$1(e.session.currentPackage(),v.name,R);for(let R of Fe(v))for(let L of Ie(R.root)){let C=L.id,K=dp(v,C,w,e.textOf).find(h=>h.id===c);if(K)return K}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:l,linkById:d,applyHyperlink(c){let m=c.url!==void 0&&c.url.length>0,x=c.anchor!==void 0&&c.anchor.length>0;if(m===x)return false;let v=t();if(!n()||e.refusesWrite())return false;let w;if(m){let k=e.session.ensureHyperlinkRelationship(c.url,v);if(!k)return false;w=k;}let R={...w!==void 0?{relationshipId:w}:{},...x?{anchor:c.anchor}:{},...c.tooltip!==void 0?{tooltip:c.tooltip}:{}},L=i(),C=e.orderedRange(),K=C.from.paragraphId===C.to.paragraphId&&C.from.offset===C.to.offset;if(L&&(K||By(L,C))){let k=[{op:"setHyperlinkTarget",linkId:L.id,...R}];if(c.text!==void 0&&c.text!==L.text){let G=cp(L.paragraphId,L.start,L.end,c.text);if(!G)return false;k.push(...G);}let P=false;return e.commit(()=>{let G=o(k,e.selectionMark());return P=G.committed,G},()=>null),P}let h=C.from.paragraphId;if(C.to.paragraphId!==h)return false;let H=[],N=C.from.offset,M=C.to.offset;if(K){let k=c.text??c.url??c.anchor??"";if(k.length===0)return false;H.push({op:"insertText",paragraphId:h,offset:N,text:k}),M=N+k.length;}else if(c.text!==void 0&&c.text!==e.textOf(h).slice(N,M)){let k=cp(h,N,M,c.text);if(!k)return false;H.push(...k),M=N+c.text.length;}if(M<=N)return false;let A=_y(e.session);H.push({op:"insertHyperlink",paragraphId:h,start:N,end:M,...R,...A?{styleId:A}:{}});let B=false,J={paragraphId:h,offset:M};return e.commit(()=>{let k=o(H,e.selectionMark(),{paragraphId:h,start:M,end:M});return B=k.committed,k},()=>({anchor:J,head:J})),B},removeHyperlink(c){if(!n())return false;let m=c?d(c):i();if(!m)return false;let x=false,v={paragraphId:m.paragraphId,offset:m.end};return e.commit(()=>{let w=o([{op:"removeHyperlink",linkId:m.id}],e.selectionMark());return x=w.committed,w},()=>({anchor:v,head:v})),x}}}function _y(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function By(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function cp(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 qy="equation replacement and removal are not supported in suggesting mode",gp=new WeakMap;function mp(e,t){let n=va$1(e,t);if(!n||n.kind!=="paragraph")return [];let r=gp.get(n);if(r)return r;let o=[];for(let i of Td$1(n)){let l=i.node;if(l.kind==="textValue"||l.kind!=="generic"||l.namespaceUri!==Ab$2||l.localName!=="oMath")continue;let d=Cb$1(l);d&&o.push(Object.freeze({id:l.id,paragraphId:t,start:i.start,end:i.end,linear:Eb$1(d.expression),fallbackText:d.fallbackText,supported:kt(d.expression)}));}let a=Object.freeze(o);return gp.set(n,a),a}function kt(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(kt);case "fraction":return kt(e.numerator)&&kt(e.denominator);case "radical":return kt(e.radicand)&&(e.degree===void 0||kt(e.degree));case "script":return kt(e.base)&&(e.subscript===void 0||kt(e.subscript))&&(e.superscript===void 0||kt(e.superscript));case "nary":return kt(e.body)&&(e.lowerLimit===void 0||kt(e.lowerLimit))&&(e.upperLimit===void 0||kt(e.upperLimit))}}function hp(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function yp(e){let t=null,n=i=>{let l=e.pagesLayer.ownerDocument.defaultView;if(!l||!(i instanceof l.Element))return null;let d=i.closest("[data-docx-equation]");return d&&e.pagesLayer.contains(d)?d:null},r=(i,l)=>{let d=e.equationById(i);d&&(e.setSelection({anchor:{paragraphId:d.paragraphId,offset:d.start},head:{paragraphId:d.paragraphId,offset:d.end}}),e.onPopover?.({equation:d,rect:l}));},o=i=>{t=null;let l=n(i.target),d=l?.dataset.docxEquation;if(!l||!d)return;let c=l.getBoundingClientRect();t={equationId:d,rect:{left:c.left,top:c.top,right:c.right,bottom:c.bottom}};},a=i=>{let l=n(i.target),d=l?.dataset.docxEquation,c=t;if(t=null,!l||!d){if(!c)return;i.preventDefault(),r(c.equationId,c.rect);return}let m=l.getBoundingClientRect();i.preventDefault(),r(d,{left:m.left,top:m.top,right:m.right,bottom:m.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 bp(e){let t=()=>e.session.partFor(e.storyScope()),n=d=>{let c=t();return c?mp(c,d):[]},r=()=>{let d=e.selection().head;return hp(n(d.paragraphId),d)},o=d=>{let c=n(e.selection().head.paragraphId).find(m=>m.id===d);if(c)return c;for(let m of e.session.storyParts()){let x=va$1(m,d);if(!x||x.kind!=="generic"||x.namespaceUri!==Ab$2||x.localName!=="oMath")continue;let v=x;for(;v&&v.kind!=="paragraph";)v=wa$1(m,v.id);return !v||v.kind!=="paragraph"?null:mp(m,v.id).find(w=>w.id===d)??null}return null},a=(d,c)=>{let m=false,x={paragraphId:d.paragraphId,offset:d.start};return e.commit(()=>{let v=e.session.applyTreeOps([c],e.selectionMark(),{paragraphId:x.paragraphId,start:x.offset,end:x.offset},e.storyScope());return m=v.committed,v},()=>({anchor:x,head:x})),m},i=(d,c)=>{let m=o(d);if(!m)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest")return {ok:false,code:"unsupported",reason:qy};let x=c==="replace"?{op:"setMathEquation",equationId:d,linear:m.linear}:{op:"removeMathEquation",equationId:d},v=e.writeRefusal(x);return v===null?{ok:true}:{ok:false,code:"locked",reason:v}},l=d=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:d.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:i,applyEquation(d,c){let m=o(d);if(!m)return false;let x=i(d,"replace");return x.ok?m.supported&&m.linear===c?true:a(m,{op:"setMathEquation",equationId:d,linear:c}):l(x)},removeEquation(d){let c=o(d);if(!c)return false;let m=i(d,"remove");return m.ok?a(c,{op:"removeMathEquation",equationId:d}):l(m)}}}var Zy=24;function vp(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=v=>{if(!v||v.length===0||v.startsWith("#"))return false;let w=L(v);return !w.ok||!w.href||!n?false:(n.open(w.href,"_blank","noopener,noreferrer"),true)},a=v=>{if(e.enterStoryFor&&!e.enterStoryFor(v.paragraphId))return false;let w=e.layout(),R=Zd(w,v);if(!R)return false;let L=w.pages[R.pageIndex];if(!L)return false;let C=L.box.y+(L.contentBox.y-L.box.y)+R.y,K=r();return K&&(K.scrollTop=Math.max(0,C*e.scale()-Zy),e.onScrolled?.()),e.setSelection(v),true},i=v=>{let w=e.bookmarks().get(v);return w?a(w):false},l=null;function d(v){if(!v||v.closest("[data-docx-hf]"))return null;let w=v.closest("a.docx-hyperlink");if(w){let L=w.dataset.docxLink;return L?{linkId:L,drawing:false}:null}let R=v.closest("[data-docx-drawing-link]");if(R){let L=R.dataset.docxDrawingLink;return L?{linkId:L,drawing:true}:null}return null}let c=v=>{l=null;let w=v.target,R=d(w);if(!R)return;let C=w.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();l={linkId:R.linkId,drawing:R.drawing,rect:{left:C.left,top:C.top,bottom:C.bottom,right:C.right}};},m=v=>{let w=v.target,R=d(w);if(!R){let K=l;if(l=null,!K)return;v.preventDefault(),x(K.linkId,K.rect,v,K.drawing);return}l=null,v.preventDefault();let C=w.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();x(R.linkId,{left:C.left,top:C.top,bottom:C.bottom,right:C.right},v,R.drawing);};function x(v,w,R,L){let C=L?e.drawingLinkById?.(v)??null:e.linkById(v);if(!C)return;if(R.metaKey||R.ctrlKey){C.kind==="external"?o(C.href):C.anchor&&i(C.anchor);return}if(e.isCollapsedSelection()){if(C.kind==="internal"){C.anchor&&i(C.anchor);return}e.onPopover?.({link:C,rect:w});}}return t.addEventListener("pointerdown",c,true),t.addEventListener("click",m),{goToPosition:a,goToBookmark:i,openExternal:o,destroy(){t.removeEventListener("pointerdown",c,true),t.removeEventListener("click",m);}}}function zy(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 Ws(e,t){return e.drawingNodeId!==t?null:zy(e)}function xp(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=Ws(n,t);if(r)return r}return null}function Vy(e,t){for(let r of e.anchoredDrawings??[]){let o=Ws(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 l of i.blocks){let d=Sp(l,t);if(d)return d}continue}let o=Ip(r,t);if(o)return o}let n=xp(e.header,t);return n||xp(e.footer,t)}function Ip(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=Ws(r,t);if(o)return o}return null}function Sp(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=Sp(o,t);if(a)return a}return null}return Ip(e,t)}function kp(e,t){for(let n of e.pages){let r=Vy(n,t);if(r)return r}return null}function Tp(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.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 po="the document is open for viewing",wa="image property edits are not supported in suggesting mode",Ky="trackedDrawingDeletionUnsupported";function wp(e){function t(){return {committed:false,rejected:true,opCount:0,reason:po}}function n(){return {committed:false,rejected:true,opCount:0,reason:wa}}return {applyDrawingOps(r){if(e.editingMode()==="view")return t();if(e.editingMode()==="suggest")return n();let o=e.selectionMark();return e.applyOps(r,o,o)},applyImageProperties(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:po};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:wa};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:po};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Ky};let o={ok:false,reason:"invalidArgs"};return e.commit(()=>(o=e.session.deleteImage(e.storyScope(),r),{committed:o.ok,rejected:!o.ok,opCount:o.ok?1:0,...o.ok?{}:{reason:o.detail??o.reason}})),o},insertImage(r){return e.editingMode()==="view"?Promise.resolve({ok:false,reason:"invalidArgs",detail:po}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:wa}):e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort()})},replaceImage(r,o,a,i){return e.editingMode()==="view"?Promise.resolve({ok:false,reason:"invalidArgs",detail:po}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:wa}):e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),i)}}}function Pp(e){let t=null,n=null,r="",o=()=>{if(!t)return;let l=Mc(e.layout(),t,e.materializedPages?.());l!==t.pageIndex&&(t={...t,pageIndex:l,sectionIndex:e.sectionAtPage(l).sectionIndex});},a=l=>{if(e.entryRefused?.()===true&&t?.scope.rId!==l.rId||!l.rId||e.session.partFor({kind:"headerFooter",rId:l.rId})===null)return false;t?.scope.rId!==l.rId&&e.leaveOtherStories?.();let d=e.layout(),c=Fc(d,l.rId),m=t,x=m?.scope.rId===l.rId,v=c?null:jy(e.session,l.rId);if(!c&&!v)return false;let w=l.pageIndex??(x&&m?m.pageIndex:c?.pageIndex??0),R=l.kind??(x&&m?m.kind:c?.kind??v.kind),L=l.variant??(x&&m?m.variant:c?.story.variant??v.variant),C=x&&m?m.partName:c?.story.partName??v.partName,K=d.pages[w]??d.pages[c?.pageIndex??0],h=(K?Gn(K,{scope:{kind:"headerFooter",rId:l.rId},kind:R,partName:C}):null)??c?.story??{scope:{rId:l.rId},variant:L,partName:C},H=e.selection(),N=m?m.savedBodySelection:{anchor:{...H.anchor},head:{...H.head}},M=x&&m?.sectionIndex!==void 0&&w===m.pageIndex,A=l.sectionIndex??(M?m.sectionIndex:c?e.sectionAtPage(w).sectionIndex:v?.sectionIndex);t={scope:{kind:"headerFooter",rId:l.rId},pageIndex:w,...A!==void 0?{sectionIndex:A}:{},kind:R,variant:h.variant,partName:h.partName,savedBodySelection:N};let J=e.session.paragraphIdsIn(ia(t))[0];if(!J)return t=null,false;let k=l.position?sa(d,{anchor:l.position,head:l.position},t):x?sa(d,H,t):{anchor:{paragraphId:J,offset:0},head:{paragraphId:J,offset:0}};return e.setScopeSelection(k),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},i=()=>{if(!t)return;let l=t.savedBodySelection;t=null,e.setScopeSelection(sa(e.layout(),l,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>Ec(t),setActiveScope(l){return l.kind==="body"?(i(),true):l.kind==="headerFooter"?a({rId:l.rId}):false},enterHeaderFooter:a,exitHeaderFooter:i,reconcileOccurrence:o,headerFooterState(){if(!t)return null;let l=e.session.headerFooterResolutionBySection(),d=t.sectionIndex??0,c,m,x,v=K=>{let h=l[K];if(!h)return false;let N=(t.kind==="header"?h.headers:h.footers).get(t.variant);return !N||N.rId!==t.scope.rId?false:(d=K,c=N.inherited,m=h.titlePage,x=h.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&v(t.sectionIndex))){let K;l.forEach((h,H)=>{let M=(t.kind==="header"?h.headers:h.footers).get(t.variant);!M||M.rId!==t.scope.rId||!(K===void 0||K&&!M.inherited||K===M.inherited&&H<d)||(d=H,c=M.inherited,m=h.titlePage,x=h.evenAndOddHeaders,K=M.inherited);});}let w=bd(e.session.part()),R=w[d]?.properties??w.at(-1)?.properties,L=R?.margins.headerTwips,C=R?.margins.footerTwips;return {editing:t.kind,sectionIndex:d,variant:t.variant,rId:t.scope.rId,partName:t.partName,...c!==void 0?{inherited:c}:{},...m!==void 0?{titlePage:m}:{},...x!==void 0?{evenAndOddHeaders:x}:{},...L!==void 0?{headerDistanceTwips:L}:{},...C!==void 0?{footerDistanceTwips:C}:{}}},headerFooterStateStable(l){if(!t)return n=null,r="",null;let d=this.headerFooterState();if(!d)return null;let c=[l,d.editing,d.sectionIndex,d.variant??"",d.rId??"",d.partName??"",String(d.inherited),String(d.titlePage),String(d.evenAndOddHeaders),String(d.headerDistanceTwips??""),String(d.footerDistanceTwips??"")].join("|");return n&&r===c||(n=Object.freeze({...d}),r=c),n}}}function jy(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[l,d]of i)if(d.rId===t)return {sectionIndex:r,kind:a,variant:l,partName:d.partName}}}return null}function Rp(e){let t=null,n=null,r=null,o=(i,l)=>(e.setLastRejection(null),e.commit(()=>{let d=e.applyOps(Array.isArray(i)?i:[i],e.selectionMark());return d.rejected&&e.setLastRejection(String(d.reason??"rejected")),d},l),e.lastRejection()===null),a=(i,l,d)=>{let c=hd(i);if(!c)return e.setLastRejection("invalid note scope id"),false;let m=e.session.currentPackage(),x=_d(m,c.noteKind),v=x?Cd$1(x.root,c.noteId):null;if(!x||!v)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let w=e.selection();r={anchor:{paragraphId:w.anchor.paragraphId,offset:w.anchor.offset},head:{paragraphId:w.head.paragraphId,offset:w.head.offset}};}if(t={kind:"note",id:gd(c.noteKind,c.noteId)},n=Number.isInteger(d)?d:null,l)e.setSelection({anchor:l,head:l});else {let w=Uy(v),R=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:c.noteKind})),L=w.find(C=>R.has(C.id));if(L){let C=Wy(L);e.setSelection({anchor:{paragraphId:L.id,offset:C},head:{paragraphId:L.id,offset:C}});}}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 l=e.deleteSelectionPlan(),d=l.collapseTo;if(!(l.ops.length===0||o(l.ops,()=>({anchor:{...d},head:{...d}}))))return false;let m=Cp(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:d.paragraphId,offset:d.offset},()=>{let R={paragraphId:d.paragraphId,offset:d.offset+1};return {anchor:R,head:R}}))return l.ops.length>0&&e.undo(),false;let w=[...Cp(e.session.currentPackage(),i)].find(R=>!m.has(R));return w===void 0?true:a(gd(i,w))},deleteNote(i,l){return o({op:"deleteNote",noteKind:i,noteId:l})},convertNote(i,l){return o({op:"convertNote",fromKind:i,noteId:l})},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 l=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),i&&l&&e.setSelection(l),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(i){!t||!Number.isInteger(i)||n!==i&&(n=i);}}}function Uy(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 Wy(e){let t=Td$1(e)[0];return t&&md(t.node)?t.end:0}function Cp(e,t){let n=_d(e,t),r=new Set;if(!n)return r;for(let o of Bd(n.root)){if(!sd(o))continue;let a=qd(o);a!==null&&r.add(a);}return r}var Gy=500;function $y(e,t){let n=e.part(),r=Nb$1(n),o=[];for(let a=0;a<r.length;a+=1){let i=r[a];if(i.kind!=="paragraph")continue;let l=$c$1(i);l&&o.push(l);}if(o.length<t.length){let a=_c$1(e.part());o.push(a&&a.kind!=="textValue"?a:void 0);}for(;o.length<t.length;)o.push(void 0);return o}function Ep(e){if(!e)return null;let t=e.session,n=e.state().selection.head.paragraphId,r=fo(t,n,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:ot(t,n,{kind:"body"}),e.headerFooterState()?.sectionIndex),o=t.currentPackage(),a=Id(o),i=Jd$1(a),l=Kd(a),d=bd(t.part()),c=$y(t,d),m=Gd(c[r]),x=Hd(c[r]),v=Ld(m,i),w=Md(x,l);return {sectionIndex:r,footnote:{resolved:v,...i?{documentAuthored:i}:{},...m?{sectionAuthored:m}:{}},endnote:{resolved:w,...l?{documentAuthored:l}:{},...x?{sectionAuthored:x}:{}}}}function Fp(e,t){let n=hd(t);if(!n)return null;let r=_d(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=Cd$1(o.root,n.noteId);if(!a)return null;let i=[],l=Gy,d=(m,x)=>{if(!(x>32||l<=0)){if(m.kind==="paragraph"&&typeof m.id=="string"){let v=(Lf$1(o,m.id)??"").replace(/\uFFFC/g,"").trim();if(v){let w=v.slice(0,l);i.push(w),l-=w.length;}return}if(m.kind!=="textValue")for(let v of m.children)d(v,x+1);}};d(a,0);let c=i.filter(Boolean).join(" ").trim();return c.length>0?c:null}function Op(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function Gs(e,t,n={}){let r=n,o=j(t,n.reviewModel?{reviewModel:n.reviewModel}:{});if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=o.session,i$1=n.scale??96/72,l$1={resolve:n.tableInteractionLabel??(s=>Is(s))},d="the document is open for viewing",c="the document is read-only",m="the table of contents is generated and read-only",x="\0range\0",v=()=>`${new Date().toISOString().slice(0,19)}Z`,w=n.measurer?null:Jd(i$1,{context:rr(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),R=n.measurer??w.measurer,L=xb$1(),C=Cd();function K(){return n.measurer?n.producer??"host-measurer":`${n.producer??w?.producer??"fixed-measurer"}@scale:${i$1}`}let h=K(),H$1=e.ownerDocument,N=H$1.createElement("div");N.className="docx-pages",N.style.position="relative",N.contentEditable="true",N.spellcheck=false,N.setAttribute("role","textbox"),N.setAttribute("aria-multiline","true"),N.style.outline="none";let M=H$1.createElement("div");M.className="docx-selection-overlay",M.contentEditable="false",M.setAttribute("aria-hidden","true"),M.style.position="absolute",M.style.left="0",M.style.top="0",M.style.pointerEvents="none";let A=H$1.createElement("div");A.className="docx-comment-overlay",A.contentEditable="false",A.setAttribute("aria-hidden","true"),A.style.position="absolute",A.style.left="0",A.style.top="0",A.style.pointerEvents="none";let B=H$1.createElement("div");B.className="docx-table-furniture",B.contentEditable="false",B.style.position="absolute",B.style.left="0",B.style.top="0",B.style.pointerEvents="none",e.style.position="relative",e.replaceChildren(N,B,A,M);let J=Pf(N,()=>i$1,()=>{let s=y?.getActive()??null,u=I?.activeNoteScope()??null,f=I?.activeNotePageIndex()??null,g=s?Oc(N,s.pageIndex):u?Ac(N,u.id,f):null;return {layout:Y$1,selection:E,measurer:R,...s?{preferredPageIndex:s.pageIndex}:f!==null?{preferredPageIndex:f}:He.selectionPageIndex()!==void 0?{preferredPageIndex:He.selectionPageIndex()}:{},scopedHost:g,...s?{scopedHostKind:"headerFooter"}:u?{scopedHostKind:"note"}:{}}}),k$1=new Set(xc(a.part()).flatMap(s=>[s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId])),P=a.paragraphIds(),G=P.find(s=>!k$1.has(s))??P[0]??"",E={anchor:{paragraphId:G,offset:0},head:{paragraphId:G,offset:0}},T=null,j$1=null,U=false,ie$1=false,ge$1=null,be$1=new Map;function pe(){ge$1=null;for(let s of be$1.values())ge$1=s;}function fe(s,u){if(s.paragraphId===u.paragraphId)return s.offset-u.offset;let f=$();return f.indexOf(s.paragraphId)-f.indexOf(u.paragraphId)}function ue(s){if(!ge$1)return;let{from:u,to:f}=Ps(Y$1,ge$1),g=s.head;fe(g,u)>=0&&fe(g,f)<=0||(be$1.clear(),ge$1=null);}let Pe=null;function Tt(){return Ze()?.properties??null}function Ze(){if(!Pe)return null;let s=Pe.position,u=f=>f.paragraphId===s.paragraphId&&f.offset===s.offset;return u(E.anchor)&&u(E.head)?Pe:null}function Ge(s){if(!Pe)return;let u=Pe.position;s.anchor.paragraphId===u.paragraphId&&s.anchor.offset===u.offset&&s.head.paragraphId===u.paragraphId&&s.head.offset===u.offset||(Pe=null);}function D(s,u,f,g){let b=Le([...s],f,g);return s.length===u.length||!b.rejected?b:Le([...u],f,g)}function ne(s,u,f){let g=Ze();if(!g||f===0)return [];let b=Pe.position;return b.paragraphId!==s||b.offset!==u?[]:[{op:"setRunProperties",paragraphId:s,start:u,end:u+f,properties:g.properties.reduce((S,O)=>kg$1(S,og$1(S,O)),[...g.base])}]}let y=null,I=null,V=null,W=()=>ia(y?.getActive()??null,I?.activeNoteScope()??null),X$1=()=>I?.activeNoteScope()?.id??null,q=s=>{let u=C.multi?.spans,f=0,g=0;if(u&&u.length>0)for(let b=0;b<u.length;b+=1){let S=u[b];if(f=b,g=S.startIndex,s<S.startIndex+S.pageCount)break}return {sectionIndex:f,sectionStart:g}},$=()=>Xn(Y$1,y?.getActive()??null,X$1()),ce=()=>globalThis.performance?.now()??Date.now(),Re=0,Me=0,tt=0,{styleCascade:Ee,numberingIndex:ze,defaultTabStopPt:Ne}=hf(a),gn=null,at=n.imageDecodePort??kf(H$1)??Tf(),Ve=Pc$1({session:a,decodePort:at,onResourcesChanged:()=>gn?.()}),ve=n.drawingStrings??f$1,ke=()=>E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset?null:{paragraphId:E.head.paragraphId,offset:E.head.offset},it=-1,wt=true,ur=()=>{let s=a.packageRevision();return it!==s&&(it=s,wt=!Q(a.settingsRoot()).doNotShadeFormData),wt},tn=wf({mintValidatedBytes:(s,u)=>Ve.mintValidatedBytes(s,u)}),nn=Es({session:a,measurer:R,producer:h,cache:L,styleCascade:Ee,numberingIndex:ze,defaultTabStopPt:Ne,displayMode:n.revisionDisplayMode??kb$1,inlineDrawingLayoutForPart:s=>Ve.contextForPart(s),drawingLayoutTokenForPart:s=>Ve.cacheTokenForPart(s),drawingTokenForParagraphForPart:(s,u)=>Ve.drawingTokenForParagraph(u,s)}),bo=s=>{let u=Ka(s,f=>a.relationshipTarget(f));return s.kind==="textValue"?null:{id:s.id,kind:u.kind,href:u.href,...u.anchor!==void 0?{anchor:u.anchor}:{},...u.tooltip!==void 0?{tooltip:u.tooltip}:{}}},On=lp(),An={...a,applyTreeOps:(s,u,f,g)=>Le(s,u,f,g),applyPmDoc:s=>De==="view"?{committed:false,rejected:true,opCount:0,reason:d}:Xa()?{committed:false,rejected:true,opCount:0,reason:m}:a.applyPmDoc(s)},Y$1=So(),Pt=n.revisionStyles,vo=r.reviewAuthorSlots??d$1(),jt=null,Ha=Kf({session:An,storyScope:W,paragraphOrder:$,layout:()=>Y$1,selection:()=>E,commit:(s,u,f)=>Ce(s,u,f),orderedRange:()=>qt(),selectionMark:()=>Oe(),textOf:s=>lt(s),selectedCells:()=>T?.cellIds,defaultParagraphStyleId:()=>Ee()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n.defaultFontFamily??null,pendingFormats:()=>Tt(),setPendingFormats:s=>{if(s===null||s.length===0){if(!Pe)return;Pe=null;}else {let{anchor:u,head:f}=E;if(u.paragraphId!==f.paragraphId||u.offset!==f.offset)return;let g=Ze()?.base??Bf(a.partFor(W())??a.part(),f.paragraphId,f.offset);Pe={position:f,properties:s,base:g};}n.onChange?.(qe());}}),mn=sp({session:An,storyScope:W,headerFooterSectionIndex:()=>y?.getActive()?.sectionIndex,paragraphOrder:$,selectedCells:()=>T?.cellIds,layout:()=>Y$1,commit:(s,u,f)=>Ce(s,u,{rearmPending:Ze()??void 0,...f?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Eo(),orderedRange:()=>qt(),selectionMark:()=>Oe(),collapsedAt:s=>Ae(s),deleteSelectionPlan:()=>Zt(),paragraphTextOf:s=>lt(s),numberingLevelExists:(s,u)=>gc(lc(ze(),Ee()),s,u)!==null}),fr=pp({session:An,layout:()=>Y$1,fieldLinkById:s=>On.linkById(s),refusesWrite:()=>_n(true)!==null,storyScope:W,selection:()=>E,orderedRange:()=>qt(),selectionMark:()=>Oe(),textOf:s=>lt(s),commit:(s,u)=>Ce(s,u)}),pr=bp({session:An,storyScope:W,editingMode:()=>De,writeRefusal:s=>_n(true,[s]),selection:()=>E,selectionMark:()=>Oe(),commit:(s,u)=>Ce(s,u)}),gr=s=>{let u=ot(a,s,{kind:"body"});if(u.kind==="body")return I?.exitNote(),y?.exitHeaderFooter(),true;if(u.kind==="headerFooter"){let g=y?.activeScope();return g?.kind==="headerFooter"&&g.rId===u.rId?true:(I?.exitNote(),y?.enterHeaderFooter({rId:u.rId})??false)}let f=xo(s);return f?I?.activeNoteScope()?.id===f?true:(y?.exitHeaderFooter(),I?.enterNote(f)??false):false},xo=s=>{for(let u of Y$1.pages)for(let f of [u.footnotes,u.endnotes])if(f){for(let g of f.notes)for(let b of Y(g.fragments))if(b.paragraphId===s)return g.scopeId}return null},Mn=vp({pagesLayer:N,container:e,scale:()=>i$1,layout:()=>Y$1,bookmarks:()=>a.bookmarks(),linkById:s=>On.linkById(s)??fr.linkById(s),drawingLinkById:s=>kp(Y$1,s),setSelection:s=>nt(Ae(s)),enterStoryFor:s=>gr(s),isCollapsedSelection:()=>E.anchor.paragraphId===E.head.paragraphId&&E.anchor.offset===E.head.offset,onScrolled:()=>Po(),...n.onHyperlinkPopover?{onPopover:n.onHyperlinkPopover}:{}}),Io=yp({pagesLayer:N,equationById:s=>pr.equationById(s),setSelection:nt,...n.onEquationPopover?{onPopover:n.onEquationPopover}:{}});N.addEventListener("contextmenu",dl),N.addEventListener("click",cl),N.addEventListener("pointermove",ye),N.addEventListener("pointerleave",oe);let Dt=null;function mr(s,u){u&&jc$1(C,u),Ve.sync(a);let f=If({session:a,measurer:R,producer:h,cache:L,styleCascade:Ee,numberingIndex:ze,defaultTabStopPt:Ne,inlineDrawingLayoutForPart:g=>Ve.contextForPart(g),drawingTokenForParagraphForPart:(g,b)=>Ve.drawingTokenForParagraph(b,g),drawingLayoutEpochForPart:g=>Ve.cacheTokenForPart(g)});return Ed(a.part(),s,{measurer:R,cache:L,session:C,producer:h,styleCascade:Ee(),defaultTabStopPt:Ne,numberingIndex:ze(),sectionFurniture:nn.sectionFurniture(),furniture:nn.furniture(),projectLink:bo,projectFieldLink:g=>On.project(g),documentProperties:a.documentProperties(),inlineDrawingLayout:Ve.bodyContext,drawingTokenForParagraph:g=>Ve.drawingTokenForParagraph(g,a.part().name),drawingLayoutEpoch:Ve.cacheTokenForPart(a.part().name),...f?{notes:f}:{},...n.revisionDisplayMode?{displayMode:n.revisionDisplayMode}:{}})}function So(){let s=ce(),u=mr(a.packageRevision());return Re=ce()-s,u}let Ct=null;function _a(){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:true})??false}function Ba(){if(!_a()){Ct!==null&&clearTimeout(Ct),Ct=null,ft();return}Ct===null&&(Ct=setTimeout(()=>{Ct=null,ft();},0));}let Rt="",Ht=null,_t=false;function xe(){if(_t||(Ht!==null&&(clearTimeout(Ht),Ht=null),Rt.length===0))return;let s=Rt;Rt="",_t=true;try{_e.type(s);}catch(u){throw Rt=s+Rt,u}finally{_t=false;}}function qa(s){Rt+=s,Ht===null&&(Ht=setTimeout(()=>{Ht=null,xe();},0));}function ko(s,u,f){xe();let g=f?.trim()||n.author?.trim();if(!g)return j$1="tracked changes need a non-empty author",n.onChange?.(qe()),false;let b={author:g,date:v()},S=qt(),O=S.from.paragraphId===S.to.paragraphId&&S.from.offset===S.to.offset;if(s!=="insertion"&&O)return j$1=`${s} needs a non-collapsed selection`,n.onChange?.(qe()),false;if(s==="replacement"&&S.from.paragraphId!==S.to.paragraphId)return j$1="tracked replacement across paragraph marks is not supported",n.onChange?.(qe()),false;let _=s==="insertion"?{ops:[],collapseTo:S.from}:Zt(),Z=gl(_.ops,b),re=_.collapseTo;if(s==="insertion"||s==="replacement"){let ee=s==="replacement"?S.to.offset-Ol(S.from,S.to,g):S.from.offset;Z.push({op:"insertText",paragraphId:_.collapseTo.paragraphId,offset:ee,text:u,revision:b}),re={paragraphId:_.collapseTo.paragraphId,offset:ee+u.length};}let te=false;return Ce(()=>{let ee=Le(Z,Oe(),on(re));return te=ee.committed,ee},()=>Ae(re)),te}let st=Qd({run:s=>{let u=ce(),f=mr(s.revision,s);return Re=ce()-u,f},currentRevision:()=>a.packageRevision(),schedule:s=>{let u=setTimeout(s,0);return ()=>clearTimeout(u)},publish:s=>{jt!==null&&(jt={...jt,layout:null,items:null}),Y$1=s,Ba();}}),hr=false;gn=()=>{st.invalidateAll(a.packageRevision(),"drawing-resources"),!hr&&(hr=true,setTimeout(()=>{hr=false,p();},0));};let yr=a.subscribe(s=>{em(s),Pe=null,st.notify(s);});function Ut(){let s=vf(e,Y$1,E,i$1),u=y?.getActive()?.pageIndex??He.selectionPageIndex();return u===void 0||s===void 0||s.has(u)?s:new Set([...s,u])}function p(){return st.pending()?st.flush():false}let F=null;function z(s){return s.contentControlId??`toc:${s.id}`}function se(s){return xc(a.part()).find(u=>u.beginParagraphId===s||u.endParagraphId===s||u.resultParagraphIds.includes(s))}function Q$1(){for(let s of N.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(s.getAttribute("data-docx-content-control")===F){s.dataset.hover="",s.dataset.boundaryVisible="";continue}delete s.dataset.hover,U||delete s.dataset.boundaryVisible;}}function ae$1(s){F!==s&&(F=s,Q$1());}function ye(s){let f=s.target?.closest("[data-paragraph-id]")?.dataset.paragraphId,g=f?se(f):null;ae$1(g?z(g):null);}function we(s){let u=s.target,f=u?.isConnected?u.closest("[data-paragraph-id]"):void 0;if(f)return f.dataset.paragraphId;let g=N.ownerDocument;return typeof g.elementFromPoint!="function"?void 0:g.elementFromPoint(s.clientX,s.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function oe(){ae$1(null);}function Te(){let s=ct(),u=Rc$1(a.part()),g=xc(a.part()).map(ee=>{let Ie=me(ee);return Ie?{...Ie,empty:u.has(ee.beginParagraphId)}:null}).filter(ee=>ee!==null),b=new Set(g.map(ee=>ee.boundary.id)),S=new Set(g.filter(ee=>ee.empty).map(ee=>ee.boundary.id)),O=s&&!b.has(s.id)?new Set([s.id]):void 0,_=F?new Set([F]):void 0,Z=new Set(ae(Y$1).filter(ee=>ee.controlType==="checkbox"&&ll(ee.id)).map(ee=>ee.id)),re=g.filter(ee=>ee.additional&&!ee.empty).map(ee=>ee.boundary),te=pl()!==null;if(!(!U&&!O&&!_&&!te&&Z.size===0&&re.length===0&&b.size===0))return {...te?{readOnly:true}:{},...U?{showAll:true}:{},...O?{activeIds:O}:{},..._?{hoverIds:_}:{},...Z.size>0?{checkedIds:Z}:{},...re.length>0?{additionalBoundaries:re}:{},...b.size>0?{tocControlIds:b}:{},...S.size>0?{suppressedIds:S}:{}}}function me(s){let u=s.contentControlId?ae(Y$1).find(b=>b.id===s.contentControlId):void 0;if(u)return {tocId:s.id,boundary:u,additional:false};let f=new Set([s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId]),g=Y$1.pages.flatMap(b=>{let S=X(b).filter(te=>f.has(te.paragraphId)).map(te=>te.box);if(S.length===0)return [];let O=Math.min(...S.map(te=>te.x)),_=Math.min(...S.map(te=>te.y)),Z=Math.max(...S.map(te=>te.x+te.width)),re=Math.max(...S.map(te=>te.y+te.height));return [{pageIndex:b.index,box:{x:O,y:_,width:Z-O,height:re-_}}]});return g.length===0?null:{tocId:s.id,additional:true,boundary:{id:`toc:${s.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:g}}}let Be=null;function ct(){let s=W();if(s.kind!=="body")return Dn(s);if(Be&&Be.layout===Y$1&&Be.selection===E)return Be.result;let u=Ln();return Be={layout:Y$1,selection:E,result:u},u}function Ln(){let s=Zd(Y$1,E.head,R);if(!s)return null;let u=$d(Y$1,{x:s.x,y:s.y+s.height/2,pageIndex:s.pageIndex});return u&&Nn(u.id)===a.part().name?u:null}function Nn(s){let u=s.indexOf("#");return u===-1?"":s.slice(0,u)}function Dn(s){let u=a.partFor(s);return u?Vc$1(u,E.head.paragraphId):null}function he(s){return s.bound?"bound":s.effectiveLock==="contentLocked"||s.effectiveLock==="sdtContentLocked"?"locked":null}function Ke(s){return s.effectiveLock==="sdtLocked"||s.effectiveLock==="sdtContentLocked"?"locked":null}function rn(s){return Hb$1(s)}function ut(s){let u=$n(a,s),f=va$1(u??a.part(),s);return !f||!rn(f)?null:f}function Hn(s){let u=ut(s);if(!u)return null;for(let f of u.children)if(f.kind!=="textValue"&&(f.kind==="contentControlProperties"||f.localName==="sdtPr"))for(let g of f.children){if(g.kind==="textValue"||g.localName!=="tabIndex")continue;let b=g.attributes.find(O=>O.localName==="val")?.value;if(b===void 0)return null;let S=Number(b);return Number.isFinite(S)?S:null}return null}function To(){let s=W(),u=s.kind==="body"?null:a.partFor(s),f=s.kind==="notesPart"?new Set($()):void 0;return (u?[...Uc$1(u,f)]:[...ae(Y$1)]).filter(b=>he(b)===null).sort((b,S)=>{let O=Hn(b.id),_=Hn(S.id);return O!==null&&_!==null&&O!==_?O-_:O!==null&&_===null?-1:O===null&&_!==null?1:0})}function hn(s){if(s.kind==="textValue")return s.value.length;if(s.kind==="tab"||s.kind==="hardBreak")return 1;if(s.kind==="runProperties"||s.kind==="generic")return 0;if(s.kind==="contentControl"){let g=0;for(let b of s.children)if(b.kind!=="textValue"&&(b.kind==="contentControlContent"||b.localName==="sdtContent"))for(let S of b.children)g+=hn(S);return g}let f=0;for(let g of s.children)f+=hn(g);return f}function Za(s){for(let u of s.children)if(u.kind!=="textValue"&&(u.kind==="contentControlContent"||u.localName==="sdtContent"))return u.children;return []}function _g(s){let u=ut(s);if(!u)return false;let f=Za(u),g=[],b=re=>{for(let te of re){if(te.kind==="paragraph"){g.push({id:te.id,length:hn(te)});continue}if(te.kind==="textValue")continue;if(te.kind==="contentControl"){b(Za(te));continue}b(te.children);}};if(b(f),g.length>0){let re=g[0],te=g[g.length-1];return nt({anchor:{paragraphId:re.id,offset:0},head:{paragraphId:te.id,offset:te.length}}),true}let S=null,O=0,_=0,Z=(re,te,ee)=>{let Ie=te;for(let Fe of re){if(Fe.id===s)return S=ee,O=Ie,_=Ie+hn(Fe),true;if(Fe.kind==="textValue"){Ie+=Fe.value.length;continue}if(Fe.kind==="contentControl"){let $e=hn(Fe);if(Z(Za(Fe),Ie,ee))return true;Ie+=$e;continue}if(Fe.kind==="run"||Fe.kind==="hyperlink"){if(Z(Fe.children,Ie,ee))return true;Ie+=hn(Fe);continue}if(Fe.kind==="paragraph"){if(Z(Fe.children,0,Fe.id))return true;continue}if(Fe.kind==="tab"||Fe.kind==="hardBreak"){Ie+=1;continue}if(Z(Fe.children,Ie,ee))return true;Ie+=hn(Fe);}return false};return Z((a.partFor(ot(a,s,W()))??a.part()).root.children,0,""),S?(nt({anchor:{paragraphId:S,offset:O},head:{paragraphId:S,offset:_}}),true):false}function Bg(s){let u=ut(s);if(!u)return [];for(let f of u.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr"))for(let g of f.children){if(g.kind==="textValue"||g.localName!=="dropDownList"&&g.localName!=="comboBox")continue;let b=[];for(let S of g.children){if(S.kind==="textValue"||S.localName!=="listItem")continue;let O=S.attributes.find(Z=>Z.localName==="value")?.value??"",_=S.attributes.find(Z=>Z.localName==="displayText")?.value??O;b.push({displayText:_,value:O});}return b}return []}function ll(s){let u=ut(s);if(!u)return false;for(let f of u.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr")){for(let g of f.children)if(g.kind==="contentControlCheckbox")for(let b of g.children){if(b.kind!=="contentControlChecked")continue;let S=b.attributes.find(O=>O.localName==="val")?.value;return !(S==="0"||S==="false"||S==="off")}}return false}function qg(s){let u=ut(s);if(u){for(let f of u.children)if(f.kind==="contentControlProperties"){for(let g of f.children)if(g.kind==="contentControlDate")return g.attributes.find(b=>b.localName==="fullDate")?.value}}}function za(s,u){for(let f of N.querySelectorAll("[data-docx-content-control]"))f.getAttribute("data-docx-content-control")===s&&(u?f.dataset.open="":delete f.dataset.open);}function Wt(s){let u=s.dataset.docxCcId;s.remove(),u&&za(u,false);}function Va(){let s=N.querySelector(".docx-content-control-menu");s&&Wt(s);}function dl(s){let u=we(s),f=u?se(u):void 0;Zg(f&&Ja(f.id)?f.id:null);}let br=null;function Zg(s){br!==s&&(br=s,n.onChange?.(qe()));}function cl(s){if(s.button!==0||s.target?.closest("a.docx-hyperlink")||E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)return;let u=we(s);if(!u)return;let f=xc(a.part()).find(S=>S.resultParagraphIds.includes(u));if(!f)return;let b=H(a.part(),f,a.documentOutline(),Ya(f))[f.resultParagraphIds.indexOf(u)];b&&(s.preventDefault(),Mn.goToPosition({paragraphId:b,offset:0}));}function zg$1(s,u){let f=Gt.disabledReason(s,"edit");if(f){j$1=f,n.onChange?.(qe());return}if(u==="checkbox"){Gt.setValue(s,ll(s)?"false":"true");return}if(u==="dropdown"||u==="comboBox"){let g=Bg(s);if(g.length===0&&u==="dropdown")return;Va();let b=H$1.createElement("div");b.className="docx-content-control-menu",b.dataset.docxMarker="",b.dataset.docxCcId=s,b.setAttribute("contenteditable","false"),b.setAttribute("role","listbox"),b.style.position="absolute",b.style.zIndex="20",b.style.pointerEvents="auto",b.addEventListener("pointerdown",Z=>Z.stopPropagation());let O=ae(Y$1).find(Z=>Z.id===s)?.fragments[0];if(O){let Z=Y$1.pages[O.pageIndex],re=je$1?.pageOffsetX.get(O.pageIndex)??0;if(Z){let te=Z.contentBox.x-Z.box.x,ee=Z.contentBox.y-Z.box.y;b.style.left=`${(Z.box.x+re+te+O.box.x+O.box.width)*i$1}px`,b.style.top=`${(Z.box.y+ee+O.box.y+O.box.height)*i$1}px`,b.style.transform="translateX(-100%)";}}for(let Z of g){let re=H$1.createElement("button");re.type="button",re.className="docx-content-control-menu-item",re.dataset.docxMarker="",re.setAttribute("contenteditable","false"),re.setAttribute("role","option"),re.textContent=Z.displayText,re.addEventListener("mousedown",te=>{te.preventDefault(),te.stopPropagation(),Wt(b),Gt.setValue(s,Z.value);}),b.append(re);}if(u==="comboBox"){let Z=H$1.createElement("input");Z.type="text",Z.className="docx-content-control-menu-input",Z.dataset.docxMarker="",Z.setAttribute("contenteditable","false"),Z.addEventListener("mousedown",re=>re.stopPropagation()),Z.addEventListener("keydown",re=>{re.key==="Enter"&&(re.preventDefault(),Wt(b),Gt.setValue(s,Z.value));}),b.append(Z);}N.append(b),za(s,true);let _=Z=>{b.contains(Z.target)||(Wt(b),H$1.removeEventListener("mousedown",_,true));};H$1.addEventListener("mousedown",_,true);return}if(u==="date"){Va();let g=H$1.createElement("div");g.className="docx-content-control-menu",g.dataset.docxMarker="",g.dataset.docxCcId=s,g.setAttribute("contenteditable","false"),g.style.position="absolute",g.style.zIndex="20",g.style.pointerEvents="auto",g.addEventListener("pointerdown",Se=>Se.stopPropagation());let b=ae(Y$1).find(Se=>Se.id===s),S=b?.fragments[0];if(S){let Se=Y$1.pages[S.pageIndex],vn=je$1?.pageOffsetX.get(S.pageIndex)??0;if(Se){let Cr=Se.contentBox.x-Se.box.x,Rr=Se.contentBox.y-Se.box.y;g.style.left=`${(Se.box.x+vn+Cr+S.box.x+S.box.width)*i$1}px`,g.style.top=`${(Se.box.y+Rr+S.box.y+S.box.height)*i$1}px`,g.style.transform="translateX(-100%)";}}g.classList.add("docx-content-control-calendar");let O=qg(s),_=O?new Date(O):new Date,Z=Number.isNaN(_.getTime())?null:_,re=Z??new Date,te=re.getFullYear(),ee=re.getMonth(),Ie=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Fe=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),Xt=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),$e=Se=>`${Se.getFullYear().toString().padStart(4,"0")}-${(Se.getMonth()+1).toString().padStart(2,"0")}-${Se.getDate().toString().padStart(2,"0")}`,an=(Se,vn)=>Se.getFullYear()===vn.getFullYear()&&Se.getMonth()===vn.getMonth()&&Se.getDate()===vn.getDate(),Fo=null,si=()=>{let Se=H$1.createElement("input");Se.type="date",Se.className="docx-content-control-calendar-input",Se.value=Z?$e(Z):"";let vn=Se.value;b?.alias&&Se.setAttribute("aria-label",b.alias);let Cr=()=>{if(!Se.value||Se.value===vn)return false;let Xe=Se.value;return Wt(g),Gt.setValue(s,Xe),true};Fo=Cr,Se.addEventListener("keydown",Xe=>{Xe.key==="Enter"&&(Xe.preventDefault(),Cr()||Wt(g));}),Se.addEventListener("blur",()=>{queueMicrotask(()=>{!g.isConnected||g.contains(H$1.activeElement)||Cr()||Wt(g);});});let Rr=H$1.createElement("div");Rr.className="docx-content-control-calendar-header";let xn=H$1.createElement("button");xn.type="button",xn.className="docx-content-control-calendar-nav",xn.textContent="\u2039";let um=new Date(te,ee-1,1);xn.setAttribute("aria-label",Ie.format(um));let li=H$1.createElement("div");li.className="docx-content-control-calendar-title",li.textContent=Ie.format(new Date(te,ee,1));let In=H$1.createElement("button");In.type="button",In.className="docx-content-control-calendar-nav",In.textContent="\u203A";let fm=new Date(te,ee+1,1);In.setAttribute("aria-label",Ie.format(fm)),xn.addEventListener("mousedown",Xe=>Xe.stopPropagation()),In.addEventListener("mousedown",Xe=>Xe.stopPropagation()),xn.addEventListener("click",()=>{ee-=1,ee<0&&(ee=11,te-=1),si();}),In.addEventListener("click",()=>{ee+=1,ee>11&&(ee=0,te+=1),si();}),Rr.append(xn,li,In);let di=H$1.createElement("div");di.className="docx-content-control-calendar-weekdays";for(let Xe=0;Xe<7;Xe+=1){let Yt=H$1.createElement("span");Yt.textContent=Xt.format(new Date(2024,0,1+Xe)),di.append(Yt);}let Oo=H$1.createElement("div");Oo.className="docx-content-control-calendar-grid",Oo.setAttribute("role","grid");let pm=(new Date(te,ee,1).getDay()+6)%7,gm=new Date;for(let Xe=0;Xe<42;Xe+=1){let Yt=new Date(te,ee,Xe-pm+1),bt=H$1.createElement("button");bt.type="button",bt.className="docx-content-control-calendar-day",bt.textContent=String(Yt.getDate()),bt.setAttribute("role","gridcell"),bt.setAttribute("aria-label",Fe.format(Yt)),Yt.getMonth()!==ee&&(bt.dataset.otherMonth=""),Z&&an(Yt,Z)&&(bt.dataset.selected="",bt.setAttribute("aria-selected","true")),an(Yt,gm)&&(bt.dataset.today=""),bt.addEventListener("mousedown",mm=>mm.stopPropagation()),bt.addEventListener("click",()=>{Wt(g),Gt.setValue(s,$e(Yt));}),Oo.append(bt);}g.replaceChildren(Se,Rr,di,Oo);};si(),N.append(g),za(s,true);let zl=Se=>{g.contains(Se.target)||(Fo?.()||Wt(g),H$1.removeEventListener("mousedown",zl,true));};H$1.addEventListener("mousedown",zl,true),g.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}let Gt={setShowAll(s){U!==s&&(U=s,ft());},setFormFill(s){ie$1!==s&&(ie$1=s,n.onChange?.(qe()));},showAll:()=>U,formFill:()=>ie$1,atCaret:()=>ct(),navigate(s){let u=To();if(u.length===0)return false;let f=ct(),g=f?u.findIndex(S=>S.id===f.id):-1;s==="next"?g=g<0?0:(g+1)%u.length:g=g<0?u.length-1:(g-1+u.length)%u.length;let b=u[g];return _g(b.id)},setValue(s,u){let f=Gt.disabledReason(s,"edit");if(f)return j$1=f,n.onChange?.(qe()),false;let g=false;return Ce(()=>{let b=Le([{op:"setContentControlValue",controlId:s,value:u}],Oe(),void 0,ot(a,s,W()),false);return g=b.committed,b}),g},remove(s){let u=s??ct()?.id;if(!u)return j$1="notFound",n.onChange?.(qe()),false;let f=Gt.disabledReason(u,"remove");if(f)return j$1=f,n.onChange?.(qe()),false;let g=false;return Ce(()=>{let b=Le([{op:"removeContentControl",controlId:u}],Oe(),void 0,ot(a,u,W()),false);return g=b.committed,b}),g},disabledReason(s,u){let f=pl();if(f!==null)return f;let g=ae(Y$1).find(S=>S.id===s);if(g)return u==="remove"?Ke(g):he(g);let b=ut(s);if(!b)return "notFound";for(let S of b.children)if(S.kind!=="textValue"&&!(S.kind!=="contentControlProperties"&&S.localName!=="sdtPr")){if(S.children.some(O=>O.kind!=="textValue"&&O.localName==="dataBinding")&&u==="edit")return "bound";for(let O of S.children){if(O.kind==="textValue"||O.localName!=="lock")continue;let _=O.attributes.find(Z=>Z.localName==="val")?.value;if(u==="remove"){if(_==="sdtLocked"||_==="sdtContentLocked")return "locked"}else if(_==="contentLocked"||_==="sdtContentLocked")return "locked"}}return null}};function Ka$1(){let s=fl&&De!=="view";N.contentEditable=s?"true":"false",N.setAttribute("aria-readonly",s?"false":"true");}function qe(){return {revision:a.packageRevision(),pageCount:Y$1.pages.length,selection:E,cellSelection:T,canUndo:a.canUndo(),canRedo:a.canRedo(),lastRejection:j$1,pendingFormat:Tt(),contentControls:{showAll:U,formFill:ie$1,activeControlId:ct()?.id??null},contextTocId:br,perf:{layoutMs:Re,paintMs:Me,selectionMs:tt,placed:C.stats.placed,total:C.stats.total,reusedPages:C.stats.reusedPages,fullPasses:C.stats.fullPasses,staleDiscards:st.staleDiscards,cancelledRuns:st.cancelledRuns}}}let Bt,je$1,ja=null,wo=false,vr=null,Ua=null;function Vg(s){for(let u of Y$1.pages){let f=N.children.item(u.index);if(f?.dataset.pageIndex!==String(u.index))continue;let g=s.pageOffsetX.get(u.index)??0;f.style.left=`${(u.box.x+g)*i$1}px`;}}function ft(s=true){let u=He.adoptBeforePaint(),f=ce();Bt=Ut(),y?.reconcileOccurrence();let g=y?.getActive()??null,b=Te(),S=Rc$1(a.part());k(N,Y$1,{scale:i$1,readOnlyParagraphIds:Ro(),...S.size>0?{emptyTocPlaceholderIds:S}:{},...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},materialize:Bt,ariaHidden:false,drawingStrings:ve,...n.fieldShading?{fieldShading:n.fieldShading}:{},...Pt!==void 0?{revisionStyles:Pt}:{},shadeFormFields:ur(),...tn?{imageUrlPort:tn}:{},...g?{activeHeaderFooterRId:g.scope.rId,activeHeaderFooterPageIndex:g.pageIndex}:{},...b?{contentControlChrome:b}:{}},$a().value),ws(N,ke(),{domReplaced:true}),Nc(e,N,g!=null),Bi(e,De),je$1=ba(Y$1,Bt),Vg(je$1),N.style.width=`${je$1.width*i$1}px`,N.style.height=`${je$1.height*i$1}px`,e.style.width=`${je$1.width*i$1}px`,e.style.height=`${je$1.height*i$1}px`,M.style.width=`${je$1.width*i$1}px`,M.style.height=`${je$1.height*i$1}px`,A.style.width=M.style.width,A.style.height=M.style.height,B.style.width=M.style.width,B.style.height=M.style.height,Pr.update(),Me=ce()-f,kr(),Bn(true),Zl(),He.mirrorToDom(),ul(wo),wo=false,(s||u)&&n.onChange?.(qe());}function Po(){xe();let s=Ut(),u=ba(Y$1,s);je$1&&Fs(s,Bt)&&xf(u,je$1)||ft(false);}function ul(s=false){if(y?.getActive()||I?.activeNoteScope()||E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)return;let u=H$1.activeElement;if(u!==N&&(!u||!N.contains(u)))return;let f=Zd(Y$1,E.head,{measurer:R,...He.selectionPageIndex()!==void 0?{preferredPageIndex:He.selectionPageIndex()}:{}});if(!f)return;let g=ja!==null&&ja!==f.pageIndex;if(ja=f.pageIndex,!s&&!g)return;let b=Y$1.pages[f.pageIndex],S=yt(e);if(!b||!S||S.clientHeight<=0)return;let O=24,_=b.contentBox.y-b.box.y,Z=(b.box.y+_+f.y)*i$1+e.offsetTop,re=Z+f.height*i$1,te=S.scrollTop,ee=te+S.clientHeight,Ie=te;if(Z<te+O)Ie=Z-O;else if(re>ee-O)Ie=re+O-S.clientHeight;else return;let Fe=Math.max(0,S.scrollHeight-S.clientHeight),Xt=Math.max(0,Math.min(Ie,Fe));Math.abs(Xt-S.scrollTop)<.5||(S.scrollTop=Xt,oi());}let De=n.editingMode??"edit",fl=true,Kg=Object.freeze({kind:"body"});function Le(s,u,f,g=W(),b=true){xe();let S=_n(s.some(jg),s,b);if(S!==null)return {committed:false,rejected:true,opCount:0,reason:S};let O=Wg(s),_=a.applyTreeOps(O,u,f,g);return _.committed&&O.some(Ug)&&r.onTrackedChange?.(),_}function _n(s,u=[],f=true){return De==="view"?d:s&&(f&&Xa()||u.some(g=>rm(g)))?m:De==="suggest"&&!n.author?.trim()&&s?"suggesting needs an author before it can propose a change":null}function pl(){let s=_n(true,[],false);return s!==null?s:a.editable?null:c}function jg(s){return s.op!=="acceptRevision"&&s.op!=="rejectRevision"&&s.op!=="acceptAllRevisions"&&s.op!=="rejectAllRevisions"}function Ug(s){switch(s.op){case "insertText":case "deleteText":case "insertTableRow":case "deleteTableRow":return s.revision!==void 0;case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "splitParagraphMany":return s.revision!==void 0;default:return false}}function gl(s,u){return s.flatMap(f=>(f.op==="insertText"||f.op==="deleteText"||f.op==="insertTableRow"||f.op==="deleteTableRow")&&f.revision!==void 0?[f]:f.op==="insertText"||f.op==="deleteText"||f.op==="insertTableRow"||f.op==="deleteTableRow"?[{...f,revision:u}]:f.op==="splitParagraphMany"?[{...f,revision:u}]:f.op==="splitParagraph"?[f,{op:"setParagraphMarkRevision",paragraphId:f.paragraphId,kind:"ins",revision:u}]:f.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:f.secondId,revision:u}]:[f])}function Wg(s){let u=n.author?.trim();return De!=="suggest"||!u?[...s]:gl(s,{author:u,date:v()})}function Gg(s,u,f){let g=lt(u);if(g===f)return s;let b=0;for(;b<f.length&&b<g.length&&f[b]===g[b];)b+=1;let S=0;for(;S<f.length-b&&S<g.length-b&&f[f.length-1-S]===g[g.length-1-S];)S+=1;let O=g.length-f.length,_=Z=>Z.paragraphId!==u||Z.offset<=b?Z:Z.offset>=f.length-S?{...Z,offset:Z.offset+O}:{...Z,offset:b};return {anchor:_(s.anchor),head:_(s.head)}}function $g(s,u){let f=a.partFor(W())??a.part(),g=wa$1(f,s),b=wa$1(f,u);return g!==null&&b!==null&&g.id===b.id}function on(s){return {paragraphId:s.paragraphId,start:s.offset,end:s.offset}}function Ce(s,u,f={}){xe(),f?.keepCellSelection||(T=null),Pe=null,He.noteModelMoved();let g=s();if(typeof g!="boolean"&&g.rejected)j$1=String(g.reason??"rejected");else {j$1=null;let b=u?.();b&&(Sr(),E=b,Dt=null,wo=true);let S=f?.rearmPending;if(S&&S.properties.length>0){let{anchor:O,head:_}=E;O.paragraphId===_.paragraphId&&O.offset===_.offset&&(Pe={properties:S.properties,base:S.base,position:_});}}p()||ft();}function Xg(){if(!Bt)return true;for(let s of [E.anchor,E.head]){let u=Zd(Y$1,s);if(u&&!Bt.has(u.pageIndex))return false}return true}function nt(s,u=false){Rt.length>0&&(s.anchor.paragraphId!==E.anchor.paragraphId||s.anchor.offset!==E.anchor.offset||s.head.paragraphId!==E.head.paragraphId||s.head.offset!==E.head.offset)&&xe(),Ge(s),ue(s);let f=ct()?.id??null,g=Tr(E.head.paragraphId);Sr(),E=s,T=null,u||(Dt=null),Xg()||(He.noteModelMoved(),ft(false)),He.noteSelectionSettled(),He.mirrorToDom(true),ul(true),kr(),bn.clear(),Bn();let b=ct()?.id??null,S=Tr(E.head.paragraphId);(f!==b||g!==S)&&ft(false),n.onChange?.(qe());}let He=Yf({session:a,storyScope:W,document:H$1,pagesLayer:N,selection:()=>E,setSelection:s=>nt(s),adoptSelection:s=>{Ge(s),ue(s),Sr(),E=s,Dt=null,wo=true;},commit:s=>Ce(s),applyOps:(s,u,f)=>Le(s,u,void 0,f),hasPendingInput:()=>Rt.length>0,replacementOffset:(s,u,f)=>lm({paragraphId:s,offset:u},{paragraphId:s,offset:f}),render:()=>ft(),flushLayout:()=>p(),updateCaret:()=>{J.update(),ws(N,ke());},textOf:s=>lt(s),pendingFormatOps:(s,u,f)=>ne(s,u,f),selectionMark:()=>Oe(),now:ce,recordSelectionMs:s=>{tt=s;},isGesturing:()=>ti?.dragging()??false,domSelection:()=>T?Ae(T.text.anchor):E,holdsCellSelection:()=>T!==null,replaceSelectionWith:s=>_e.type(s),discardPaint:()=>i(N)});y=Pp({session:a,layout:()=>Y$1,sectionAtPage:q,selection:()=>E,setScopeSelection:s=>{xe(),Sr(),Ge(s),bn.clear(),E=s,T=null,Dt=null;},noteModelMoved:()=>He.noteModelMoved(),render:()=>ft(),mirrorToDom:()=>He.mirrorToDom(),notify:()=>n.onChange?.(qe()),materializedPages:()=>Bt,entryRefused:()=>De==="view",leaveOtherStories:()=>I?.exitNote()}),I=Rp({session:a,exitHeaderFooter:()=>y?.exitHeaderFooter(),applyOps:Le,commit:Ce,selection:()=>E,selectionMark:()=>Oe(),orderedStart:()=>Eo(),deleteSelectionPlan:()=>Zt(),undo:()=>_e.undo(),activeScope:()=>{let s=I?.activeNoteScope();return s||(y?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:s=>y.setActiveScope(s),setSelection:s=>nt(s),noteModelMoved:()=>He.noteModelMoved(),render:()=>ft(),revealNote:s=>{for(let u of Y$1.pages){let f=[...u.footnotes?.notes??[],...u.endnotes?.notes??[]].find(g=>g.scopeId===s);if(f)return wr(f.box.y,f.box.height,{block:"nearest",offsetPx:48}),u.index}return null},notify:()=>n.onChange?.(qe()),lastRejection:()=>j$1,setLastRejection:s=>{j$1=s;}});function ml(s){s&&xe(),T=s,s&&(Ge(s.text),Sr(),E=s.text),Dt=null,He.noteSelectionSettled(),He.mirrorToDom(),kr(),bn.clear(),Bn(),n.onChange?.(qe());}let yn=null;function Yg(){let u=Zd(Y$1,E.head)?.pageIndex??0,f=new Set;for(let g=u-1;g<=u+1;g+=1)g>=0&&g<Y$1.pages.length&&f.add(g);return f}let hl=new WeakMap;function Qg(s){let u=hl.get(s);if(u)return u;let f=new Map;for(let g of s.pages)for(let b of X(g))f.has(b.paragraphId)||f.set(b.paragraphId,g.index);return hl.set(s,f),f}function Jg(){let s=a.revision(),u=Bt??Yg();if(yn?.layout===Y$1&&yn.revision===s&&Fs(yn.pages,u))return yn.rects;let f=Qg(Y$1),g=(_,Z)=>{if(!u)return true;let re=f.get(_),te=f.get(Z);if(re===void 0||te===void 0)return true;for(let ee=Math.min(re,te);ee<=Math.max(re,te);ee+=1)if(u.has(ee))return true;return false},b=[];for(let _ of a.reviewItems()){if(_.kind==="comment"){if(_.range===null||!g(_.range.start.paragraphId,_.range.end.paragraphId))continue;b.push({key:tg$1(_),from:{paragraphId:_.range.start.paragraphId,offset:_.range.start.offset},to:{paragraphId:_.range.end.paragraphId,offset:_.range.end.offset}});continue}let Z=tg$1(_),re=_.kind==="revision"?_.ranges:_.range?[_.range]:[];for(let[te,ee]of re.entries())g(ee.start.paragraphId,ee.end.paragraphId)&&b.push({key:re.length===1?Z:`${Z}${x}${te}`,from:{paragraphId:ee.start.paragraphId,offset:ee.start.offset},to:{paragraphId:ee.end.paragraphId,offset:ee.end.offset}});}let S=Td(Y$1,b,u),O=[];for(let[_,Z]of S)for(let re of Z)O.push({...re,key:_});return yn={layout:Y$1,revision:s,pages:u,rects:O},O}let $t=null;function em(s){$t&&(s.impact==="text-local"&&s.created.length===0&&s.deleted.length===0&&s.splitJoin.length===0?$t={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:$t.index}:$t=null);}function tm(){let s=a.packageRevision(),u=a.part().root;if($t&&$t.packageRevision===s&&$t.bodyRoot===u)return $t.index;let f=new Map,g=S=>{let O=f.size;for(let[_,Z]of S)f.has(_)||f.set(_,O+Z);};g(Hg$1(a.part()));let b=new Set([a.part()]);for(let S of a.headerFooterPartsBySection())for(let O of [S.headers,S.footers])for(let _ of O.values())b.has(_)||(b.add(_),g(Hg$1(_)));for(let S of ["footnote","endnote"]){let O=a.partFor({kind:"notesPart",noteKind:S});!O||b.has(O)||(b.add(O),g(Hg$1(O)));}return $t={packageRevision:s,bodyRoot:u,index:f},f}let bn=new Set,xr=null,Ir=null,Wa=false;function Sr(){Wa||(Ir=null);}function yl(){let s=Ir;if(!s||!E)return null;let u=(g,b)=>g.paragraphId===b.paragraphId&&g.offset===b.offset;if(!u(E.anchor,s.anchor)||!u(E.head,s.head))return null;let f=a.reviewItems().find(g=>tg$1(g)===s.key);return !f||f.kind==="revision"&&xr!==null&&xr.has(f.revisionKind)?null:f}function Ga(){let s=yl();if(s)return bl(s);let u=E?.head;if(!u)return null;let g=xg$1(a.reviewItems(),u,tm()).filter(b=>!(b.kind==="comment"&&b.resolved)&&!bn.has(tg$1(b))&&!(b.kind==="revision"&&xr!==null&&xr.has(b.revisionKind)))[0];return g?bl(g):null}function bl(s){if(s.kind!=="comment")return s;let u=zg(a.reviewItems(),s);return bn.has(tg$1(u))?null:u}function vl(s){return s.kind==="comment"?s.comment.author:s.kind==="revision"?s.author:""}function $a(){let s=a.reviewItems(),u=jt;if(u!==null&&u.layout===Y$1&&u.items===s&&u.styles===Pt)return u;let f=vo.resolve(c$1(Y$1),(function*(){for(let Z of s)yield vl(Z);})()),g=u?.value,b=g!==void 0&&g.size===f.size&&[...f].every(([_,Z])=>g.get(_)===Z),S=b?g:f,O=u!==null&&b&&u.styles===Pt?u.resolved:new Map(b$1(S,Pt).map(_=>[_.author,_]));return jt={layout:Y$1,items:s,styles:Pt,value:S,resolved:O},jt}function nm(s,u,f){let g=s.split(x),b=g[0],S=u!==null&&b===tg$1(u);if(s.startsWith("comment-")){let te=f.get(b),ee=te?.kind==="comment"&&te.resolved;return ee&&!S?null:S?`docx-comment-band docx-comment-band--active${ee?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(s.startsWith("custom-"))return S?"docx-comment-band docx-comment-band--active":null;let O=f.get(b);if(!O||O.kind!=="revision")return null;let _=g.length>1?Number(g[1]):0;return `docx-revision-band docx-revision-band--${(te=>te==="delete"||te==="moveFrom"?"delete":te==="insert"||te==="moveTo"?"insert":te==="replace"&&O.replacedRangeCount!==void 0?_<O.replacedRangeCount?"delete":"insert":"other")(O.revisionKind)}${S?" docx-revision-band--active":""}`}let xl=null,Il,Sl=null;function Bn(s=false){let u=Ga(),f=u?tg$1(u):null,g=$a();if(!s&&xl===Y$1&&Il===f&&Sl===g.resolved)return;let b=new Map;for(let O of a.reviewItems())b.set(tg$1(O),O);let S=[];for(let O of Jg()){let _=nm(O.key,u,b);if(!_)continue;let Z=b.get(O.key.split(x)[0]),re=Z?vl(Z):"",te=re===""?void 0:g.resolved.get(re);S.push({...O,className:_,...te?{reviewAuthor:te}:{}});}l(A,Y$1,S,{scale:i$1,...je$1?{pageOffsetX:je$1.pageOffsetX}:{}}),xl=Y$1,Il=f,Sl=g.resolved;}function kr(){let s=T?ie(Y$1,T.cellIds):ge$1?Rd(Y$1,ge$1,$()):Sd(Y$1,E,$());l(M,Y$1,s,{scale:i$1,pageOffsetX:je$1?.pageOffsetX,...T?{}:{className:ge$1?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function Co(s){let u=xc(a.part());if(s)return u.find(b=>b.id===s)??null;let f=br?u.find(b=>b.id===br):void 0;if(f)return f;let g=E.head.paragraphId;return u.find(b=>b.beginParagraphId===g||b.endParagraphId===g||b.resultParagraphIds.includes(g))??(u.length===1?u[0]:null)}function Tr(s){return xc(a.part()).find(f=>f.beginParagraphId===s||f.endParagraphId===s||f.resultParagraphIds.includes(s))?.id??null}function Xa(){return Tr(E.anchor.paragraphId)!==null||Tr(E.head.paragraphId)!==null}function rm(s){let u=Ro(),f=(g,b="")=>typeof g=="string"?/(?:Id|Ids)$/.test(b)&&u.has(g):Array.isArray(g)?g.some(S=>f(S,b)):!g||typeof g!="object"?false:Object.entries(g).some(([S,O])=>f(O,S));return f(s)}function Ro(){return new Set(xc(a.part()).flatMap(s=>[s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId]))}function Ya(s){return new Set([s.beginParagraphId,s.endParagraphId,...s.resultParagraphIds])}function om(s){let u=0;for(let f of Y$1.pages)for(let g of X(f))s.has(g.paragraphId)&&(u+=g.lines.length);return u}function Qa(s,u){let f=new Set(u),g=new Map;for(let b of s.pages)for(let S of X(b)){if(!f.has(S.paragraphId)||g.has(S.paragraphId))continue;let O=b.pageFieldSource;g.set(S.paragraphId,db(O?.pageNumber??b.index+1,O?.format));}return g}function Ja(s){if(De==="view"||!a.editable)return false;let u=Co(s);return u?Jf$1(a.part(),{op:"rewriteTocPageNumbers",tocId:u.id,updates:[]})===null:false}function kl(s,u){if(!Number.isInteger(s)||!Number.isInteger(u)||s<1||u<1)return null;let f=mn.sectionPropertiesAt(E.head.paragraphId),g=f.pageSize.widthTwips-f.margins.leftTwips-f.margins.rightTwips-f.margins.gutterTwips,b=Math.max(300,Math.floor(g/u));return {op:"insertTable",beforeParagraphId:E.head.paragraphId,rows:s,cols:u,columnWidthTwips:b}}function Tl(s,u){if(De==="view"||!a.editable)return false;let f=kl(s,u),g=a.partFor(W())??a.part();return f!==null&&Jf$1(g,f)===null}function am(s,u){if(!Tl(s,u))return false;let f=kl(s,u);if(!f)return false;let g=null,b=a.subscribe(O=>{O.caret&&(g=O.caret);}),S=false;try{Ce(()=>{let O=Le([f],Oe());return O.committed||(j$1=O.reason??"the table could not be inserted here"),S=O.committed,O},()=>{let O=g;return O?Ae({paragraphId:O.paragraphId,offset:O.start}):null});}finally{b();}return S}let wl='TOC \\o "1-3" \\h';function Pl(){let s=wc$1(wl);if(!s)return null;let u=a.documentOutline(),f=Kc$1(a.part(),u,s,Qa(_e.layout(),u.map(g=>g.blockId)),Ro());return {op:"insertToc",beforeParagraphId:E.head.paragraphId,instruction:wl,alias:n.tocLabels?.title??"TOC",entries:f.entries,bookmarksToCreate:f.bookmarksToCreate}}function Cl(){if(De==="view"||!a.editable||Xa())return false;let s=Pl();return s!==null&&Jf$1(a.part(),s)===null}function im(){if(!Cl())return false;let s=Pl();if(!s)return false;let u=new Set(xc(a.part()).map(b=>b.id)),f=a.applyTreeOps([s]);if(!f.committed)return j$1=f.reason??"the table of contents could not be inserted",false;let g=xc(a.part()).find(b=>!u.has(b.id));return g?Rl(g.id,"pageNumbers"):true}function Rl(s,u="entire"){let f=Co(s);if(!f||!Ja(f.id))return false;let g=_e.layout(),b=a.documentOutline(),S=b.map(_=>_.blockId);if(u==="entire"){let _=Kc$1(a.part(),b,f.instruction,Qa(g,S),Ya(f)),Z=a.applyTreeOps([{op:"replaceTocResult",tocId:f.id,entries:_.entries,bookmarksToCreate:_.bookmarksToCreate}]);if(!Z.committed)return j$1=Z.reason??"the table of contents could not be refreshed",false;if(g=_e.layout(),f=Co(f.id),!f)return true}let O="";for(let _=0;_<3;_+=1){let Z=Qa(g,S),re=H(a.part(),f,b,Ya(f)),te=f.resultParagraphIds.flatMap((Fe,Xt)=>{let $e=re[Xt],an=$e?Z.get($e):void 0;return an===void 0?[]:[{paragraphId:Fe,pageNumberText:an}]});if(te.length===0)break;let ee=te.map(Fe=>`${Fe.paragraphId}\0${Fe.pageNumberText}`).join("");if(ee===O)break;O=ee;let Ie=a.applyTreeOps([{op:"rewriteTocPageNumbers",tocId:f.id,updates:te}]);if(!Ie.committed){if(Ie.rejected)return j$1=Ie.reason??"the table of contents page numbers were refused",false;break}g=_e.layout(),f=Co(f.id)??f;}return true}let _e={session:a,storyScope:W,imageDecodePort:()=>at,layout:()=>(xe(),p(),Y$1),state:qe,currentPage:(s="caret")=>{if(xe(),p(),s==="viewport"){let f=bf(e,Y$1,i$1);if(f!==null)return f}let u=Zd(Y$1,E.head);return u?u.pageIndex+1:1},setScale(s){if(!(s>0)||!Number.isFinite(s))return false;if(s===i$1)return true;let u={scale:i$1,defaults:w,measurer:R,producer:h,furnitureSource:nn};try{let f=yt(e),g=f?{x:(f.scrollLeft-e.offsetLeft+f.clientWidth/2)/i$1,y:(f.scrollTop-e.offsetTop+f.clientHeight/2)/i$1}:null;if(i$1=s,n.measurer||(w=Jd(i$1,{context:rr(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),R=w.measurer),h=K(),nn=Es({session:a,measurer:R,producer:h,cache:L,styleCascade:Ee,numberingIndex:ze,defaultTabStopPt:Ne,displayMode:n.revisionDisplayMode??kb$1,inlineDrawingLayoutForPart:b=>Ve.contextForPart(b),drawingLayoutTokenForPart:b=>Ve.cacheTokenForPart(b),drawingTokenForParagraphForPart:(b,S)=>Ve.drawingTokenForParagraph(S,b)}),Bt=void 0,je$1=void 0,yn=null,st.invalidateAll(a.packageRevision(),"zoom"),st.flush(),f&&g){let b=Math.max(0,g.x*i$1+e.offsetLeft-f.clientWidth/2),S=Math.max(0,g.y*i$1+e.offsetTop-f.clientHeight/2),O=Number.isFinite(f.scrollWidth)?Math.max(0,f.scrollWidth-f.clientWidth):null,_=Number.isFinite(f.scrollHeight)?Math.max(0,f.scrollHeight-f.clientHeight):null;f.scrollLeft=O===null?b:Math.min(b,O),f.scrollTop=_===null?S:Math.min(S,_),Po();}return !0}catch{(({scale:i$1,defaults:w,measurer:R,producer:h,furnitureSource:nn}=u)),Bt=void 0,je$1=void 0,yn=null;try{st.invalidateAll(a.packageRevision(),"zoom-rollback"),st.flush();}catch{}return false}},enqueueType:qa,flushPendingInput:xe,type(s){let u=Zt(),f=u.collapseTo,g=ne(f.paragraphId,f.offset,s.length),b=De==="suggest"?qt():null,S=b&&b.to.paragraphId===f.paragraphId?b.to.offset-ei(b.from,b.to):f.offset,O=[...u.ops,{op:"insertText",paragraphId:f.paragraphId,offset:S,text:s}],_={paragraphId:f.paragraphId,start:S+s.length,end:S+s.length};Ce(()=>D([...O,...g],O,Oe(),_),()=>Ae({paragraphId:f.paragraphId,offset:S+s.length}));},proposeTextChange:(s,u,f)=>ko(s,u,f),insertPlainText:s=>ni(s),deleteBackward(){let s=Zt();if(s.ops.length>0){Ce(()=>Le(s.ops,Oe(),on(s.collapseTo)),()=>Ae(s.collapseTo));return}let u=Ze()??void 0,f=E.head;if(f.offset===0){for(let Z of uc(Y$1,f.paragraphId)){let re=lt(Z);if(re.length!==0){Ce(()=>Le([{op:"deleteText",paragraphId:Z,start:re.length-1,end:re.length}],Oe(),on({paragraphId:Z,offset:re.length-1})),()=>Ae({paragraphId:Z,offset:re.length-1}),{rearmPending:u});return}}let b=$(),S=b.indexOf(f.paragraphId),O=b[S-1];if(!O)return;if(!$g(O,f.paragraphId)){nt(Ae({paragraphId:O,offset:lt(O).length}));return}let _=lt(O).length;Ce(()=>Le([{op:"joinParagraphs",firstId:O,secondId:f.paragraphId}],Oe(),on({paragraphId:O,offset:_})),()=>Ae({paragraphId:O,offset:_}),{rearmPending:u});return}let g=Fl(f,"before");if(g){Ce(()=>Le([{op:"removeContentControl",controlId:g.controlId,keepContent:false}],Oe(),on({paragraphId:f.paragraphId,offset:g.start})),()=>Ae({paragraphId:f.paragraphId,offset:g.start}),{rearmPending:u});return}Ce(()=>Le([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset-1,end:f.offset}],Oe(),on({...f,offset:f.offset-1})),()=>Ae({...f,offset:f.offset-1}),{rearmPending:u});},splitParagraph(){let s=Zt(),u=s.collapseTo,f=new Set(a.paragraphIdsIn(W())),g=Ze()??void 0;Ce(()=>Le([...s.ops,{op:"splitParagraph",paragraphId:u.paragraphId,offset:u.offset}],Oe()),()=>{let b=a.paragraphIdsIn(W()).find(S=>!f.has(S));return b?Ae({paragraphId:b,offset:0}):null},{rearmPending:g});},navigate(s,u=false){if(xe(),!u&&(s==="left"||s==="right")&&(E.anchor.paragraphId!==E.head.paragraphId||E.anchor.offset!==E.head.offset)){let b=qt();Dt=null,nt(Ae(s==="left"?b.from:b.to),true);return}let f=qi(Y$1,E.head,s,Dt,y?.getActive()??null,X$1(),R);if(!f)return;let g=Ro();if(g.has(f.position.paragraphId)){if(u)return;let S=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(s)?"up":"down",O=om(g)+4;for(let _=0;_<O;_+=1){let Z=qi(Y$1,f.position,S,f.desiredX,y?.getActive()??null,X$1(),R);if(!Z||Z.position.paragraphId===f.position.paragraphId&&Z.position.offset===f.position.offset)return;if(f=Z,!g.has(f.position.paragraphId))break}if(g.has(f.position.paragraphId))return}Dt=f.desiredX,I?.activeNoteScope()&&f.pageIndex!==void 0&&Number.isInteger(f.pageIndex)&&I.setActiveNotePageIndex(f.pageIndex),nt({anchor:u?E.anchor:f.position,head:f.position},true);},deleteWordBackward(){if(_e.deleteSelection())return;let s=E.head,u=Wd(lt(s.paragraphId),s.offset,-1);if(u===s.offset){_e.deleteBackward();return}Ce(()=>Le([{op:"deleteText",paragraphId:s.paragraphId,start:u,end:s.offset}],Oe()),()=>Ae({...s,offset:u}),{rearmPending:Ze()??void 0});},deleteWordForward(){if(_e.deleteSelection())return;let s=E.head,u=Wd(lt(s.paragraphId),s.offset,1);if(u===s.offset){_e.deleteForward();return}Ce(()=>Le([{op:"deleteText",paragraphId:s.paragraphId,start:s.offset,end:u}],Oe()),void 0,{rearmPending:Ze()??void 0});},deleteForward(){if(_e.deleteSelection())return;let s=Ze()??void 0,u=E.head,f=lt(u.paragraphId);if(u.offset<f.length){let S=Fl(u,"after");if(S){Ce(()=>Le([{op:"removeContentControl",controlId:S.controlId,keepContent:false}],Oe()),()=>Ae(u),{rearmPending:s});return}Ce(()=>Le([{op:"deleteText",paragraphId:u.paragraphId,start:u.offset,end:u.offset+1}],Oe()),void 0,{rearmPending:s});return}let g=$(),b=g[g.indexOf(u.paragraphId)+1];if(b){if(uc(Y$1,b).includes(u.paragraphId)){if(lt(b).length===0)return;Ce(()=>Le([{op:"deleteText",paragraphId:b,start:0,end:1}],Oe()),()=>Ae(u),{rearmPending:s});return}Ce(()=>Le([{op:"joinParagraphs",firstId:u.paragraphId,secondId:b}],Oe()),()=>Ae(u),{rearmPending:s});}},...mn,...Ha,setSelection:s=>nt(s),revealPage(s,u){let f=Y$1.pages.find(g=>g.index===s);return f?wr(f.box.y,f.box.height,u):false},revealParagraph(s,u){p();let f=Zd(Y$1,{paragraphId:s,offset:0});if(!f)return false;let g=Y$1.pages.find(b=>b.index===f.pageIndex);return g?wr(g.contentBox.y+f.y,f.height,u):false},revealPosition(s,u){p();let f=Zd(Y$1,s);if(!f)return false;let g=Y$1.pages.find(b=>b.index===f.pageIndex);return g?wr(g.contentBox.y+f.y,f.height,{block:"nearest",...u}):false},setEditable(s){fl=s,Ka$1();},selectAll(){let s=$(),u=s[0],f=s[s.length-1];!u||!f||nt({anchor:{paragraphId:u,offset:0},head:{paragraphId:f,offset:lt(f).length}});},hyperlinks:fr,equations:pr,contentControls:Gt,canInsertTable:Tl,insertTable:am,canInsertToc:Cl,insertToc:im,canRefreshToc:Ja,refreshToc:Rl,isInsideToc:s=>xc(a.part()).some(u=>u.beginParagraphId===s||u.endParagraphId===s||u.resultParagraphIds.includes(s)),retainSelection:()=>{let s=Symbol("selection-pin");return be$1.set(s,E),ge$1=E,kr(),s},releaseSelection:s=>{be$1.delete(s)&&(pe(),kr());},retainedSelection:()=>ge$1,publishedLayout:()=>Y$1,overlayCoordinates:()=>Object.freeze({paintScale:i$1,pageOffsetX:je$1?.pageOffsetX??new Map}),commitReviewOps:s=>{let u=E.head.paragraphId,f=lt(u);return Ce(()=>{if(De==="view")return {committed:false,rejected:true,opCount:0,reason:d};let g=s();return {committed:g.committed,rejected:!g.committed,opCount:0,...typeof g.reason=="string"?{reason:g.reason}:{}}},()=>{p(),He.noteModelMoved();let g=$();if(g.length===0)return null;let b=Gg(E,u,f);return io(Y$1,g,b)})},applyAutomationOps:(s,u)=>{let f={committed:false,rejected:false,opCount:0},g=u??Kg;return Ce(()=>{let b=_n(false);if(b!==null)return f={committed:false,rejected:true,opCount:0,reason:b};let S=null,O=s(_=>{let Z=_n(true,[],false);return Z===null?a.ensureHyperlinkRelationship(_,g):(S=Z,null)});return O===null?f={committed:false,rejected:true,opCount:0,reason:S??"this engine will not author that hyperlink target"}:f=Le(O,void 0,void 0,g,false)},()=>{p(),He.noteModelMoved();let b=$();return b.length===0?null:io(Y$1,b,E)}),f},editingMode:()=>De,setEditingMode:s=>{xe();let u=De!==s;De=s,u&&s==="view"&&y?.exitHeaderFooter(),Va(),Ka$1(),Bi(e,De),u&&ft(false),j$1=null,n.onChange?.(qe());},revisionAuthors:()=>$a().value,setRevisionStyles:s=>{s!==Pt&&(Pt=s,xe(),ft(false));},setReviewActivationExclusions(s){xr=s===null?null:new Set(s),Bn(),n.onChange?.(qe());},activeReviewKey:()=>{let s=Ga();return s?tg$1(s):null},activateReview:(s,u)=>{if(bn.clear(),Ir=u?{key:s,anchor:u.anchor,head:u.head}:{key:s,anchor:E.anchor,head:E.head},u){Wa=true;try{nt(u);}finally{Wa=false;}return}Bn(),n.onChange?.(qe());},activatedReviewKey:()=>yl()===null?null:Ir?.key??null,dismissActiveReview:()=>{let s=Ga();s&&(bn.add(tg$1(s)),Ir=null,Bn(),n.onChange?.(qe()));},navigation:Mn,bookmarks:()=>a.bookmarks(),selectedText(){if(T)return je(Y$1,T);let{from:s,to:u}=qt();return _u(Y$1,s,u,$())},deleteSelection(){let s=Zt();return s.ops.length===0?false:(Ce(()=>Le(s.ops,Oe(),on(s.collapseTo)),()=>Ae(s.collapseTo)),true)},setCellSelection:ml,layoutSession:()=>C,undo:()=>{if(De==="view"){j$1=d,n.onChange?.(qe());return}xe(),El(a.undo());},redo:()=>{if(De==="view"){j$1=d,n.onChange?.(qe());return}xe(),El(a.redo());},sectionAtPage:q,activeScope:()=>{let s=I?.activeNoteScope();return s||y.activeScope()},setActiveScope:s=>(xe(),s.kind==="note"?I.enterNote(s.id):s.kind!=="body"&&s.kind!=="headerFooter"?false:(I?.exitNote(),y.setActiveScope(s))),insertNote:s=>(xe(),I.insertNote(s)),deleteNote:(s,u)=>I.deleteNote(s,u),convertNote:(s,u)=>I.convertNote(s,u),convertAllNotes:s=>I.convertAllNotes(s),setNoteProperties:s=>I.setNoteProperties(s),enterNote:(s,u)=>(xe(),I.enterNote(s,u)),exitNote:()=>(xe(),I.exitNote()),notePropertiesState:()=>{let s=_e.state().selection.head.paragraphId,u=a.packageRevision(),f=a.currentPackage(),g=a.part(),b=Id(f),S=_d(f,"footnote"),O=_d(f,"endnote"),_=_e.activeScope().kind==="headerFooter",Z=_e.headerFooterState(),re=Z?.rId??null,te=Z?.sectionIndex??null,ee=V;if(ee&&ee.packageRevision===u&&ee.paragraphId===s&&ee.bodyPart===g&&ee.settingsPart===b&&ee.footnotesPart===S&&ee.endnotesPart===O&&ee.headerFooterOpen===_&&ee.headerFooterRId===re&&ee.headerFooterSectionIndex===te)return ee.result;let Ie=Ep(_e);return V={packageRevision:u,paragraphId:s,bodyPart:g,settingsPart:b,footnotesPart:S,endnotesPart:O,headerFooterOpen:_,headerFooterRId:re,headerFooterSectionIndex:te,result:Ie},Ie},notePreviewText:s=>Fp(a,s),applyTableCommandPlan(s){if(!s.ok)return {ok:false,code:s.code,reason:s.reason};let u=null,f=a.subscribe(g=>{g.caret&&(u=g.caret);});try{let g=Oe(),b=s.selection.kind==="adoptCommittedCaret";Ce(()=>Le(s.ops,g),b?()=>{let S=u;return S?Ae({paragraphId:S.paragraphId,offset:S.start}):null}:void 0,s.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{f();}return j$1?{ok:false,code:"invalidArgs",reason:j$1}:{ok:true,changed:true}},enterHeaderFooter:s=>{xe();let u=y.enterHeaderFooter(s);if(!u)return u;let f=y.getActive(),g=f?Y$1.pages[f.pageIndex]:void 0;if(f&&g){let b=f.kind==="header"?g.header:g.footer,S=b?.box.y??(f.kind==="header"?g.box.y:g.box.y+g.box.height-1),O=b?.box.height??1;wr(S,O,{block:"nearest"});}return u},exitHeaderFooter:()=>(xe(),y.exitHeaderFooter()),headerFooterState:()=>y.headerFooterStateStable(a.packageRevision()),...Tp({applyOps:Le,commit:Ce,deleteSelectionOps:sm,deleteSelectionPlan:()=>Zt(),orderedStart:Eo,selectionMark:Oe,collapsedAt:Ae,isHeaderFooterOpen:()=>y?.getActive()!==null,lastRejection:()=>j$1}),...wp({session:a,applyOps:Le,commit:Ce,storyScope:W,selectionMark:Oe,editingMode:()=>De,author:()=>n.author,trackedDate:v,decodePort:()=>at}),focus:()=>N.focus({preventScroll:true}),setTableInteractionLabel(s){l$1.resolve=s;},refreshTableInteractionLabels(){Pr.refreshLabels();},destroy(){xe(),H$1.removeEventListener("selectionchange",Al),N.removeEventListener("keydown",Nl),N.removeEventListener("beforeinput",Bl),N.removeEventListener("copy",Dl),N.removeEventListener("cut",Hl),N.removeEventListener("paste",_l),N.removeEventListener("compositionstart",Ll),N.removeEventListener("compositionend",Ml),H$1.removeEventListener("scroll",ql,{capture:true}),e.ownerDocument.defaultView?.removeEventListener("resize",ai),vr?.disconnect(),Ua=null,ti?.destroy(),Pr.destroy(),Mn.destroy(),Io.destroy(),He.destroy(),N.removeEventListener("contextmenu",dl),N.removeEventListener("click",cl),N.removeEventListener("pointermove",ye),N.removeEventListener("pointerleave",oe),st.cancel(),Ct!==null&&clearTimeout(Ct),Ct=null,Ve.dispose(),e$1(N),J.destroy(),yr(),e.replaceChildren();}};function El(s){if(Pe=null,He.noteModelMoved(),p(),!s){nt(io(Y$1,$(),E));return}let u={anchor:{paragraphId:s.paragraphId,offset:s.start},head:{paragraphId:s.paragraphId,offset:s.end}};nt($().includes(s.paragraphId)?u:io(Y$1,$(),u));}function wr(s,u,f){let g=yt(e);if(!g||g.clientHeight===0)return false;let b=s*i$1+e.offsetTop,S=u*i$1,O=f?.offsetPx??24,_=f?.block??"start",Z=g.clientHeight;if(_==="nearest"||_==="centerIfNeeded"){let ee=b<g.scrollTop,Ie=b+S>g.scrollTop+Z;if(!ee&&!Ie)return true}let re=_==="center"||_==="centerIfNeeded"?b-Math.max(0,(Z-S)/2):_==="nearest"&&b>g.scrollTop?b+S+O-Z:b-O,te=Math.max(0,g.scrollHeight-Z);return g.scrollTo({top:Math.max(0,Math.min(re,te)),behavior:f?.behavior??"auto"}),Po(),true}function Oe(){return Pn(E)}function qt(){return xe(),Ps(Y$1,E,$())}function Eo(){return qt().from}function lt(s){return be(Y$1,s)}function Fl(s,u){let f=a.partFor(W())??a.part(),g=va$1(f,s.paragraphId);return !g||g.kind!=="paragraph"?null:u==="before"?Vd(g,s.offset):Wd$1(g,s.offset)}function Zt(){if(xe(),T){let f=[];for(let g of ge(Y$1,T.cellIds)){let b=be(Y$1,g).length;b>0&&f.push({op:"deleteText",paragraphId:g,start:0,end:b});}return {ops:f,collapseTo:Eo()}}if(E.anchor.paragraphId===E.head.paragraphId&&E.anchor.offset===E.head.offset)return {ops:[],collapseTo:Vd$1(Y$1,E.head)};let{from:s,to:u}=qt();return Zu(Y$1,a.partFor(W())??a.part(),s,u,$())}function sm(){return Zt().ops}function lm(s,u){return De!=="suggest"||s.paragraphId!==u.paragraphId?s.offset:u.offset-ei(s,u)}function ei(s,u){return De!=="suggest"?0:Ol(s,u,n.author)}function Ol(s,u,f){let g=f?.trim();if(!g||s.paragraphId!==u.paragraphId)return 0;let b=a.partFor(W())??a.part(),S=va$1(b,u.paragraphId);return !S||S.kind!=="paragraph"?0:tf$1(S,s.offset,u.offset,g)}let{onSelectionChange:Al,onCompositionEnd:Ml}=He,Ll=(...s)=>{xe(),He.onCompositionStart(...s);},ti=null,dm=cf(_e,n.onRequestHyperlink?{onRequestHyperlink:n.onRequestHyperlink}:{}),Nl=s=>{s.defaultPrevented||He.adoptBeforeInput(),dm(s);},{onCopy:Dl,onCut:Hl,onPaste:_l}=uf(_e,ni),cm=ff(_e,{isComposing:()=>He.isComposing(),insertPlainText:ni}),Bl=s=>{He.adoptBeforeInput(),cm(s);};function ni(s){let u=Ku(s).split(`
14
- `),f=Zt(),g=f.collapseTo,b=u.join(""),S=[...f.ops],O=De==="suggest"?qt():null,_=O&&O.to.paragraphId===g.paragraphId?O.to.offset-ei(O.from,O.to):g.offset,Z=ne(g.paragraphId,_,b.length);b.length>0&&(S.push({op:"insertText",paragraphId:g.paragraphId,offset:_,text:b}),S.push(...Z));let re=[],te=0;for(let $e=0;$e<u.length-1;$e+=1)te+=u[$e].length,re.push(_+te);if(re.length>0&&S.push({op:"splitParagraphMany",paragraphId:g.paragraphId,offsets:re}),S.length===0)return;let ee=new Set(a.paragraphIdsIn(W())),Ie=u[u.length-1],Fe=re.length===0?on({paragraphId:g.paragraphId,offset:_+Ie.length}):void 0,Xt=S.filter($e=>!Z.includes($e));Ce(()=>D(S,Xt,Oe(),Fe),()=>{if(re.length===0)return Ae({paragraphId:g.paragraphId,offset:_+Ie.length});let $e=a.paragraphIdsIn(W()).filter(Fo=>!ee.has(Fo)),an=$e[$e.length-1];return an?Ae({paragraphId:an,offset:Ie.length}):null});}H$1.addEventListener("selectionchange",Al),N.addEventListener("keydown",Nl),N.addEventListener("beforeinput",Bl),N.addEventListener("copy",Dl),N.addEventListener("cut",Hl),N.addEventListener("paste",_l),N.addEventListener("compositionstart",Ll),N.addEventListener("compositionend",Ml);let ri=false;function oi(){if(ri)return;ri=true;let s=e.ownerDocument.defaultView?.requestAnimationFrame,u=()=>{ri=false,Po();};s?s(u):queueMicrotask(u);}let ql=s=>{let u=yt(e);!u||s.target!==u||oi();};H$1.addEventListener("scroll",ql,{capture:true,passive:true});let ai=()=>{oi();},ii=e.ownerDocument.defaultView;ii?.addEventListener("resize",ai,{passive:true}),vr=typeof ii?.ResizeObserver=="function"?new ii.ResizeObserver(ai):null;function Zl(){if(!vr)return;let s=yt(e);s!==Ua&&(vr.disconnect(),Ua=s,s&&vr.observe(s));}Zl(),ti=Xf({pagesLayer:N,container:e,scale:()=>i$1,pageOffsetX:s=>je$1?.pageOffsetX.get(s)??0,layout:()=>Y$1,measurer:()=>R,selection:()=>E,setSelection:s=>nt(s),cellSelection:()=>T,setCellSelection:s=>ml(s),focus:()=>N.focus({preventScroll:true}),activeHeaderFooter:()=>Lc(y?.getActive()??null),activeNote:()=>{let s=I?.activeNoteScope();return s?{scopeId:s.id,pageIndex:I?.activeNotePageIndex()??null}:null},enterHeaderFooter:s=>{xe(),y?.enterHeaderFooter({rId:s.rId,pageIndex:s.pageIndex,sectionIndex:q(s.pageIndex).sectionIndex,kind:s.kind,...s.position?{position:s.position}:{}});},enterNote:(s,u,f)=>{xe(),I?.enterNote(s,u,f);},exitNote:s=>{xe(),I?.exitNote(s);},exitHeaderFooter:()=>(xe(),y?.exitHeaderFooter()),enterEmptyHeaderFooter:(s,u)=>{if(De==="view")return;xe();let{sectionIndex:f,sectionStart:g}=q(u),b=a.headerFooterResolutionBySection(),S=b[Math.min(f,Math.max(0,b.length-1))],O=Y$1.pages[u]?.pageFieldSource?.pageNumber??u+1,_=S?.evenAndOddHeaders&&O%2===0?"even":S?.titlePage&&u===g?"first":"default",Z=te=>{let ee=te[Math.min(f,Math.max(0,te.length-1))];return s==="header"?ee?.headers:ee?.footers},re=Z(b)?.get(_)?.rId;if(!re){if(!_e.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:f,kind:s,variant:_,..._==="first"?{titlePage:true}:{},..._==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;re=Z(a.headerFooterResolutionBySection())?.get(_)?.rId;}re&&y?.enterHeaderFooter({rId:re,pageIndex:u,sectionIndex:f,kind:s,variant:_});},onContentControlWidget:(s,u)=>zg$1(s,u),isReadOnlyParagraph:s=>Tr(s)!==null},n.pointer?{mode:n.pointer}:{});let Pr=Of({pagesLayer:N,furnitureLayer:B,scale:()=>i$1,pageOffsetX:s=>je$1?.pageOffsetX.get(s)??0,read:()=>({layout:Y$1,storeRevision:a.packageRevision(),selection:E,cellSelection:T,editingMode:De,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:s=>_e.applyTableCommandPlan(s),label:s=>l$1.resolve(s)});return ft(),Ka$1(),_e.setTableInteractionLabel=s=>{l$1.resolve=s,Pr.refreshLabels();},_e.refreshTableInteractionLabels=()=>{Pr.refreshLabels();},{ok:true,surface:_e}}var Xy=e=>X(e);function Mp(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=Md$1(t,Xy);for(let o of t.pages){for(let a of [o.header,o.footer])a&&Ap(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)Ap(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function Ap(e,t,n,r){for(let o of Y(t))for(let a of vc(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function $s(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function Yy(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function Qy(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function Lp(e){return Np(e.children)}function Np(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||ke$1(n))&&t.push(n);return t}function Jy(e){if(ke$1(e))return Np(ne(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(...Lp(r));return t}function eb(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,l=r.part==="body"?He(a):Fe(a).find(w=>r.part==="header"||r.part==="footer"?w.kind===r.part:w.kind==="note"&&qd(w.root)===i)?.root;if(!l||l.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 d=Lp(l),c;for(let w=0;w<t.path.length;w+=1){let R=t.path[w];if(!Number.isInteger(R)||R<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(c=d[R],!c)return {ok:false,code:"notFound",reason:`block index ${R} is out of range`};w<t.path.length-1&&(d=Jy(c));}if(!c||c.kind!=="paragraph"||!va$1(a,c.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let m=(Lf$1(a,c.id)??"").length,x=t.offset??(n==="start"?0:m);if(!Number.isInteger(x)||x<0||x>m)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let v={paragraphId:c.id,offset:x};return {ok:true,selection:{anchor:v,head:v}}}function Pa(e,t,n){if(Yy(t))return eb(e,t,n);if(!Je(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=ot(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 l=Lt(i,r,t);if(!l.ok)return l;let d=n==="start"?l.span.start:l.span.end,c={paragraphId:l.span.nodeId,offset:d};return {ok:true,selection:{anchor:c,head:c}}}function Ca(e,t){if(!Qy(t)){let o=Pa(e,t,"start");if(!o.ok)return o;let a=Pa(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=Pa(e,t.from,"start");if(!n.ok)return n;let r=Pa(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function tb(e){return e.evenPage?"even":e.firstPage?"first":"default"}function Dp(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'"}:tb(e)}function Xs(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?Dp(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,l=t.sectionIndex??n?.sectionIndex??0;return !Number.isInteger(l)||l<0?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"}}:{ok:true,sectionIndex:l,kind:r,variant:i}}function nb(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 go(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}:nb(n.reason)}function Ra(e,t,n,r){let a=e.session.headerFooterResolutionBySection()[t];if(!a)return null;let l=(n==="header"?a.headers:a.footers).get(r);return l?{rId:l.rId,partName:l.partName,inherited:l.inherited,titlePage:a.titlePage,evenAndOddHeaders:a.evenAndOddHeaders}:null}function Hp(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=Dp(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,l=Ra(e,n,r,a)?.rId,d=false;if(!l){let m=go(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!m.ok)return m;d=true,l=Ra(e,n,r,a)?.rId;}return l?e.enterHeaderFooter({rId:l,kind:r,sectionIndex:n,variant:a})?{ok:true,changed:d}:{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 _p(e,t){let n=Xs(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=go(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 Bp(e,t){let n=Xs(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=go(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=Ra(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function qp(e,t){let n=Xs(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=go(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let l=Ra(e,n.sectionIndex,n.kind,n.variant);return o&&l&&l.rId!==a&&e.enterHeaderFooter({rId:l.rId,kind:n.kind,sectionIndex:n.sectionIndex}),i}function Zp(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return go(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 zp(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 Vp(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 Kp(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 jp(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 Up(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 Wp(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 $p(e,t,n){switch(t.type){case "toggleMark":{let r=ts.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=ns(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 "setLineSpacing":e.setParagraphProperty("spacing",Sa({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...lr("before",t.beforePt),...lr("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 l=e.sectionAnchorParagraphAt(e.state().selection.head.paragraphId);if(l.kind==="unaddressable")return {ok:false,code:"unsupported",reason:"this section holds no paragraph to address it by"};r=l.kind==="anchor"?l.paragraphId:void 0;}let o=t.pageWidth,a=t.pageHeight;if(t.orientation!==void 0&&(o!==void 0||a!==void 0)){let l=r?e.sectionPropertiesAt(r):e.sectionProperties(),d=o??l.pageSize.widthTwips,c=a??l.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(d,c):Math.min(d,c),a=t.orientation==="landscape"?Math.min(d,c):Math.max(d,c);}if(!e.setSectionProperties({...o!==void 0?{pageWidthTwips:o}:{},...a!==void 0?{pageHeightTwips:a}:{},...t.orientation!==void 0?{orientation:t.orientation}:{},...t.marginTop!==void 0?{marginTopTwips:t.marginTop}:{},...t.marginRight!==void 0?{marginRightTwips:t.marginRight}:{},...t.marginBottom!==void 0?{marginBottomTwips:t.marginBottom}:{},...t.marginLeft!==void 0?{marginLeftTwips:t.marginLeft}:{},...r!==void 0?{anchorParagraphId:r}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the page setup change was refused"};break}case "toggleList":if(!e.toggleList(t.kind))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the list change was refused"};break;case "adjustIndent":if(!e.adjustIndent(t.direction))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the selection is already at that indent level"};break;case "insertBreak":if(t.kind==="section"){if(!e.insertSectionBreak())return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the section break was refused"};break}if(t.kind==="page"){e.insertPageBreak();break}e.insertLineBreak();break;case "insertHyperlink":{let r=t.href.startsWith("#");if(!e.hyperlinks.applyHyperlink({...r?{anchor:t.href.slice(1)}:{url:t.href},...t.text!==void 0?{text:t.text}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the link was refused: the target is not an allowed scheme, or there is no text to link"};break}case "removeHyperlink":if(!e.hyperlinks.removeHyperlink())return {ok:false,code:"notFound",reason:"there is no hyperlink at the selection"};break;case "insertText":e.type(t.text);break;case "deleteText":e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=Ca(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 "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 Hp(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return _p(e,t);case "linkHeaderFooterToPrevious":return Bp(e,t);case "unlinkHeaderFooterFromPrevious":return qp(e,t);case "setHeaderFooterOptions":return Zp(e,t);case "insertPageField":return zp(e,t);case "insertNote":return Vp(e,t);case "deleteNote":return Kp(e,t);case "convertNote":return jp(e,t);case "convertAllNotes":return Up(e,t);case "setNoteProperties":return Wp(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(!Yn(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??en({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":return $s(e.selectedText()),{ok:true,changed:false};case "cut":$s(e.selectedText()),e.deleteSelection();break;case "paste":e.insertPlainText(t.text);break;case "setSelection":{if("range"in t&&rs(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&Je(t.anchor)?{anchor:t.anchor}:"range"in t&&Tn(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Zc(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=ab(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return to(t)?yu(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function Gp(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 Y(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function rb(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 Y(a.fragments))if(i.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function ob(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 ab(e,t){let n=ot(e.session,t.head.paragraphId,{kind:"body"}),r=ot(e.session,t.anchor.paragraphId,{kind:"body"});if(!ob(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 d=rb(e,t.head.paragraphId);return e.enterHeaderFooter?.({rId:n.rId,...d?{pageIndex:d.pageIndex,sectionIndex:d.sectionIndex}:{}})?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that header or footer could not be opened"}}let a=Gp(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:Gp(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"}}function ib(e,t){let n=e.byteLength;if(n<22)return false;let r=new DataView(e.buffer,e.byteOffset,n),o=Math.max(0,n-(64*1024+22)),a=-1;for(let c=n-22;c>=o;c-=1)if(r.getUint32(c,true)===101010256){a=c;break}if(a<0)return false;let i=r.getUint16(a+10,true),l=r.getUint32(a+16,true),d=0;for(let c=0;c<i;c+=1){if(l+46>n||r.getUint32(l,true)!==33639248)return false;if(d+=r.getUint32(l+24,true),d>=t)return true;l+=46+r.getUint16(l+28,true)+r.getUint16(l+30,true)+r.getUint16(l+32,true);}return false}function Xp(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||ib(r,524288)),schedule(r){let o=null,a=null,i=()=>{t=null,e.mount(r);},l=requestAnimationFrame(()=>{a!==null&&clearTimeout(a),a=null,o=setTimeout(i,0);});a=setTimeout(()=>{cancelAnimationFrame(l),i();},250),t={bytes:r,cancel:()=>{cancelAnimationFrame(l),o!==null&&clearTimeout(o),a!==null&&clearTimeout(a);}},e.scheduled();},cancel:n,flush(){let r=n();r&&e.mount(r);},isScheduled:()=>t!==null}}function Yp(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function Qp(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function Jp(e){return e.kind==="comment"}function sb(e){let t=new Map;for(let n of e){let r=n.item;if(!Jp(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 lb(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(Jp);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 eg(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=lb(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=sb(r);if(a==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let i=o,l=new Set;for(;i.parentId!==void 0&&!l.has(i.id);){l.add(i.id);let m=a.get(i.parentId);if(!m)break;i=m;}let d=false,c=false;return e.surface.commitReviewOps(()=>{let m=e.surface.session.packageRevision();return d=e.surface.session.setCommentResolved(i.id,n),c=d&&e.surface.session.packageRevision()!==m,{committed:c}}),d?(c&&e.bump(),{ok:true,changed:c}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function tg(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 ng=new WeakMap;function fb(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$3.story))}function pb(e,t){fb(t)||(e.summaries=null);}function gb(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>pb(t,n)));}function og(e){}function ag(e,t){let n=ng.get(e);return n||(n={summaries:null,subscribed:false},ng.set(e,n)),gb(e,n),n.summaries||(n.summaries=t()),n.summaries}var mb=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function hb(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function yb(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Je(t)){let o=Lt(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(hb(t)){if(!Je(t.from)||!Je(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=Lt(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=Lt(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),l=Math.max(o.span.end,a.span.end);return {ok:true,span:{paragraphId:o.span.nodeId,start:i,end:l}}}return {ok:false,code:"unsupported",reason:"address the span with a paraId anchor; DocLocation targeting is not supported",target:t}}function Ys(e,t){let n=mb.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=Pn(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=yb(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 bb="http://schemas.microsoft.com/office/word/2010/wordml",vb="http://schemas.microsoft.com/office/word/2012/wordml",xb=32;function pn(e){return Hb$1(e)}function Ib(e){return e.kind==="textValue"?[]:e.children}function Ea(e){if(e.kind==="textValue")return e.value.length;if(e.kind==="tab"||e.kind==="hardBreak")return 1;if(e.kind==="runProperties"||e.kind==="generic")return 0;if(pn(e)){let n=0;for(let r of ne(e))n+=Ea(r);return n}let t=0;for(let n of Ib(e))t+=Ea(n);return t}function mo(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function Sb(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===ca$1)return t.value}}function Qs(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return Sb(n)}}function kb(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=Tb(t);if(n!==void 0)return n}return "richText"}function Tb(e){if(e.kind==="textValue")return;let t=e.kind,n=e.localName,r=e.namespaceUri;if(t==="contentControlDropDownList"||n==="dropDownList")return "dropdown";if(t==="contentControlComboBox"||n==="comboBox")return "comboBox";if(t==="contentControlDate"||n==="date")return "date";if(n==="picture")return "picture";if(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===bb||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===vb)return "repeatingSection"}function Fa(e){let t=Qs(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function wb(e,t){if(Fa(mo(t)))return true;let n=wa$1(e,t.id);for(;n;){if(pn(n)&&Fa(mo(n)))return true;n=wa$1(e,n.id);}return false}function el(e,t){let n=mo(e),r=Qs(n,"tag"),o=Qs(n,"alias"),a=t?wb(t,e):Fa(n);return {id:e.id,controlType:kb(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var ig=new WeakMap;function Pb(e,t){let n=[],r=wa$1(e,t.id);for(;r;)pn(r)&&n.push(`${r.id}:${Fa(mo(r))?1:0}`),r=wa$1(e,r.id);return n.join("|")}function lg(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function Cb(e){return Object.freeze(e.map(t=>lg(t)))}function Rb(e,t){let n=e.node,r=mo(n),o=Pb(t,n),a=ig.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=lg(el(n,t));return ig.set(n,{properties:r,lockAncestors:o,summary:i}),i}function Eb(e){let t=ve(e.root);return og(t.length),t.map(n=>Rb(n,e))}function Fb(e){return Cb(e.storyParts().flatMap(t=>Eb(t)))}function Ob(e){return ag(e,()=>Fb(e))}function Js(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 Ab(e){let t=[],n=(r,o,a,i)=>{let l=o;for(let d of r)if(d.kind!=="paragraphProperties"){if(d.kind==="run"){l+=Ea(d);continue}if(d.kind==="hyperlink"){l=n(d.children,l,a,i);continue}if(pn(d)&&i<xb){let c=l,m=a+1;l=n(ne(d),l,m,i+1),t.push({control:d,start:c,end:l,depth:m});continue}l+=Ea(d);}return l};return n(e.children,0,-1,0),t}function tl(e,t,n){return Ab(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>el(r.control,n))}function nl(e,t){let n=[],r=wa$1(e,t);for(;r;)pn(r)&&n.push(el(r,e)),r=wa$1(e,r.id);return n.reverse()}function dg(e,t){if(!e)return [];let n=Ob(e.session);return t?n.filter(r=>Js(r,t)):n}function rl(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=$n(e.session,n)??e.session.part(),a=va$1(o,n);if(a&&a.kind==="paragraph"){for(let l of tl(a,r,o))if(Js(l,t))return l}let i=nl(o,n);for(let l=i.length-1;l>=0;l-=1){let d=i[l];if(Js(d,t))return d}return null}function ol(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function Mb(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function Lb(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function Nb(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 Oa(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||pn(n))&&t.push(n);return t}function Db(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...Oa(r.children));return t}function Hb(e){return e.kind==="table"?Db(e):pn(e)?Oa(ne(e)):e.kind==="body"?Oa(e.children):[]}function _b(e,t,n){if(pn(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of tl(t,r,e))return {ok:true,controlId:i.id};let a=nl(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 Bb(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=Nb(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=Oa(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=Hb(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=_b(e,o,t.offset);return a.ok?a:{...a,target:t}}function qb(e,t,n){let r=Lt(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=va$1(o,r.span.nodeId);if(!a||a.kind!=="paragraph")return {ok:false,code:"notFound",reason:`paragraph '${n.paraId}' was not found`,target:n};let i=r.span.start;for(let c of tl(a,i,o))return {ok:true,controlId:c.id};let d=nl(o,a.id).at(-1);return d?{ok:true,controlId:d.id}:{ok:false,code:"notFound",reason:`no content control encloses paragraph '${n.paraId}'`,target:n}}function cg(e,t){if(t===void 0){let r=rl(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(Lb(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return Mb(t)?Bb(n,t):Je(t)?qb(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function ug(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 fg(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 pg(e,t){return {ok:false,code:ug(e),reason:fg(e),...t!==void 0?{target:t}:{}}}function Zb(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 al(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function il(e,t,n,r){let o=Zb(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let l=Ys(t,e);return l.ok?sg(t,l.op,l.span.paragraphId):{ok:false,code:l.code,reason:l.reason}}let a=cg(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 sg(t,i,a.controlId)}function sg(e,t,n){let r=Jf$1($n(e.session,n)??e.session.part(),t);return r?{ok:false,code:ug(r),reason:fg(r)}:{ok:true}}function gg(e,t,n,r){t?.flushPendingInput();let o=il(e,t,n,r);return o.ok?zb(t,e):o}function zb(e,t){if(t.type==="insertContentControl")return Vb(e,t);let n=cg(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=Pn(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=e.session.applyTreeOps([o],r,r,ot(e.session,n.controlId,{kind:"body"}));return a.rejected?pg(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function Vb(e,t){e.flushPendingInput();let n=Ys(e,t);if(!n.ok){let c=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...c!==void 0?{target:c}:{}}}let{paragraphId:r,start:o,end:a}=n.span,i=Pn(e.state().selection),l={paragraphId:r,start:o,end:a},d=e.session.applyTreeOps([n.op],i,l,ot(e.session,r,{kind:"body"}));return d.rejected?pg(d.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:d.committed})}var mg=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Aa(e){let t=e?.defaultFont?.family;return t!==void 0&&mg.test(t)?t:oa.family}function hg(e,t){let n=new Map,r=l=>{if(l===void 0||!mg.test(l))return;let d=l.toLowerCase();n.has(d)||n.set(d,l);};r(Aa(e));let o=e?.substitutions??[],a=new Set(o.map(l=>l.to.family.toLowerCase()));for(let l of o)r(l.from.family);for(let l of e?.sources??[])a.has(l.request.family.toLowerCase())||r(l.request.family);for(let l of t)r(l);let i=[...n.values()];return i.sort((l,d)=>l<d?-1:l>d?1:0),i}var Kb={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function yg(e$1,t){let n=[],r=[],o=t.aggregateBudget,a=new Set;for(let i of e$1){let l=Kb[i.style],d=Object.freeze({family:i.family,weight:l.weight,style:l.style});if(i.family.trim().length===0){r.push({request:d,partName:i.partName,reason:"malformed"});continue}let c=e(d);if(!(t.shadowedRequests?.has(c)||a.has(c))){if(a.add(c),i.bytes.byteLength>t.maxFontBytes||i.bytes.byteLength>o){r.push({request:d,partName:i.partName,reason:"overLimit"});continue}o-=i.bytes.byteLength,n.push({request:d,id:`embedded:${i.partName}#${i.style}`,bytes:i.bytes,hash:a$2(i.bytes),faceIndex:0});}}return {sources:n,dropped:r}}var jb="The quick brown fox 0123 \u2014 {}#@",Ub=["monospace","serif"],Wb=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function bg(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(jb).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!Wb.test(r))return t.set(r,true),true;let a=false;for(let i of Ub){let l=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==l){a=true;break}}return t.set(r,a),a}}function vg(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=Gd$1.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}var xg=Object.freeze({installed:0,alias:()=>{},dispose(){}});function Gb(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1)t=t*31+n.charCodeAt(r)>>>0;return `docx-embedded-${t.toString(36)}`}function $b(){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 Ig(e,t=$b(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return xg;let a=new Map;for(let c of e){let m=c.request.family,x=a.get(m);x?x.push(c):a.set(m,[c]);}let i=new Map,l=[];if(await Promise.all([...a].map(async([c,m])=>{let x=Gb(m.map(w=>w.hash)),v=false;await Promise.all(m.map(async w=>{try{let R=o(x,w.bytes,{weight:String(w.request.weight),style:w.request.style});await R.load(),r.add(R),l.push(R),v=!0;}catch{}})),v&&i.set(c,x);})),l.length===0)return xg;for(let c of n){if(i.has(c.from.family))continue;let m=i.get(c.to.family);m!==void 0&&i.set(c.from.family,m);}let d=false;return {installed:l.length,alias:c=>d?void 0:i.get(c),dispose(){if(!d){d=true;for(let c of l)try{r.delete(c);}catch{}}}}}var ho=.1,yo=5;var dr={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},Xb={type:"fit",fit:"pageWidth"},Ma={type:"fixed"};function La(e){return e==="auto"?dr:!e||typeof e!="object"?null:e.type==="fixed"?Ma:e.type==="fit"&&e.fit==="pageWidth"?Na(e,dr)?dr:e:null}function Na(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 cr(e){return e.type==="fit"}function kg({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),l=Number.isFinite(r)?Sg(r):.1,d=Number.isFinite(o)?Sg(o):5,c=Math.floor(i/t*100)/100;return Math.min(Math.max(c,l),Math.max(d,l))}function Sg(e){return Math.min(Math.max(e,.1),5)}function Yb(e){let t=yt(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 Tg(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 d=e.mode();if(!cr(d))return;let c=e.container();if(!c)return;let m=Yb(c);if(m===null)return;let x=e.pageWidthPx();if(x===null)return;o=e.pageWidthTwips();let v=kg({availableWidthPx:m,pageWidthPx:x,...d.minZoom!==void 0?{minZoom:d.minZoom}:{},...d.maxZoom!==void 0?{maxZoom:d.maxZoom}:{}});v===null||v===e.zoom()||e.applyZoom(v);}function l(){let d=n?.ownerDocument.defaultView;if(!d?.requestAnimationFrame){i();return}r===null&&(r=d.requestAnimationFrame(()=>{r=null,i();}));}return {refitIfPageResized(){let d=e.pageWidthTwips();d===null||d===o||i();},attach(){this.detach();let d=e.container();if(!d)return;let c=yt(d);c&&(n=c,typeof ResizeObserver<"u"&&(t=new ResizeObserver(l),t.observe(c)),i());},refit:i,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function Pg(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=La(e.zoomMode??(n!==null?Ma:"auto"))??dr;function a(d,c){if(d===r)return c?.(),true;let m=t.surface();return m&&!Op(m,d*(96/72))?false:(r=d,c?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=Ma,l.detach();}let l=Tg({container:t.container,mode:()=>o,pageWidthPx:()=>{let d=t.surface()?.layout().pages[0]?.box;return d?d.width*(96/72):null},pageWidthTwips:()=>t.surface()?.sectionProperties().pageSize.widthTwips??null,zoom:()=>r,applyZoom:d=>{a(d);}});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{cr(o)&&l.attach();},detach:()=>l.detach(),refit:()=>l.refit(),refitIfPageResized:()=>l.refitIfPageResized(),setZoom(d){if(!Number.isFinite(d)||d<.1||d>5)return {ok:false,code:"invalidArgs",reason:`zoom must be between ${.1} and ${5}, got ${d}`};let c=cr(o);return d===r?c?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(d,c?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${d}`}},setZoomMode(d){let c=La(d);return c?Na(c,o)?{ok:true,changed:false}:(o=c,cr(c)?l.attach():l.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(d)}`}}}}function wg(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function Cg(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:wg(r.box),contentBox:wg(r.contentBox)})):[]}}}var Nt="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",Da={mode:null,rejection:null};function Rg(e,t){return e===void 0||e==="view"?Da:e==="edit"?{mode:"editing",rejection:null}:t.reviewEnabled?t.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:"suggesting mode was requested, but no author is configured"}:{mode:null,rejection:Nt}}function Eg(e){return e.viewOnly||e.currentMode!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?Da:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:"this document asks for tracked changes, but no author is configured"}}var Fg=new Map;function Og(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=b$1(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:a$4(t)}),r.value.get(o))}}function sl(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);})}}var tv=Object.freeze({kind:"body"}),Mg=Object.freeze([]);function nv(e$1){let t=e$1.locale&&e$1.locale in locales?e$1.locale:"en",r={title:createT(deepMerge(en$1,t==="en"?void 0:locales[t]),t)("toolbar.tableOfContents")},o=e$1.container??null,a$2=a$3(e$1.modules),i=Yp(a$2),l=a$2.review!==null,d$2=null,c$1=Xp({mount:p=>Ne(p),scheduled:()=>{q$1(),Me();}}),m=e$1.mode==="view"?"viewing":"editing",x=null,v=Og(e$1.revisionStyles),w=d$1(),R=false,L=null,C=e$1.mode??"edit",K=Rg(e$1.mode,{reviewEnabled:l,hasAuthor:!!e$1.author});K.mode!==null&&(m=K.mode),K.rejection!==null&&(L=K.rejection);let h=null,H=null,N$1=null,M=null,A=null,B=null,J=sl({}),k=sl({}),P=false,G,E,T=null;function j(){T?.dispose(),T=null;}let U=0,ie,ge=()=>typeof e$1.fonts=="function"?ie:e$1.fonts,be=-1,pe=false,fe=null,ue=p=>(fe||(fe=bg(o?rr(o.ownerDocument):null)),fe(p)),Pe=null,Tt=()=>{let p=ge();return (Pe===null||Pe.configuration!==p)&&(Pe={configuration:p,families:new Set([...(p?.sources??[]).map(F=>F.request.family),...(p?.substitutions??[]).map(F=>F.from.family)].filter(F=>typeof F=="string"&&F.trim().length>0).map(F=>F.toLowerCase()))}),Pe.families},Ze=p=>Tt().has(p.toLowerCase())||T?.alias(p)!==void 0,Ge=()=>!h||pe||!h.session.rendersText()?Mg:vg(h.session.documentFonts(),Ze,ue),D=0,ne=null,y=null,I=-1,V=0,W=-1,X=false;function q$1(){D+=1;}let $={change:new Set,selectionChange:new Set,error:new Set};function ce(p){for(let F of [...$.error])F(p);}function Re(p){for(let F of [...$.change])F(p);}function Me(){if($.selectionChange.size===0)return;let p=it();for(let F of [...$.selectionChange])F(p);}function tt(){N$1?.(),N$1=null,h?.destroy(),h=null,M=null,A=null,B=null,V+=1;}let Ee=Pg(e$1,{container:()=>o,surface:()=>h,bump:q$1,emitSelectionChange:Me}),ze=()=>Ee.scale();function Ne(p){if(!o){d$2=p,H=null,q$1();return}tt();let F=Gs(o,p,{scale:ze(),defaultFontFamily:Aa(ge()),...e$1.translate?{drawingStrings:g$2(e$1.translate)}:{},...e$1.author?{author:e$1.author}:{},...v.current()!==void 0?{revisionStyles:v.current()}:{},reviewAuthorSlots:w,editingMode:m==="suggesting"?"suggest":m==="viewing"?"view":"edit",...l?{}:{revisionDisplayMode:"proposed"},...a$2.review?{reviewModel:{...a$2.review,collectReviewItems:z=>a$2.review.collectReviewItems(a$2.customNodes.length>0?{...z,customNodes:a$2.customNodes,...a$2.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:i}:{}}:z)}}:{},...G?{measurer:G,...E?{producer:E}:{}}:{},...T?{fontAlias:T.alias}:{},...e$1.tableInteractionLabel?{tableInteractionLabel:e$1.tableInteractionLabel}:{},...e$1.imageDecodePort?{imageDecodePort:e$1.imageDecodePort}:{},onHyperlinkPopover:z=>J.current().onPopover?.(z),onRequestHyperlink:()=>J.current().onRequest?.(),onEquationPopover:z=>k.current().onPopover?.(z),onTrackedChange:()=>{X||(X=true,q$1(),Me());},tocLabels:r,onChange:z=>{if(!h)return;q$1();let se=z.pendingFormat!==A;A=z.pendingFormat;let Q=h.headerFooterState?.(),ae=Q?.editing&&Q.rId?`${Q.editing}:${Q.rId}`:null,ye=ae!==B;B=ae,!(os(z.selection,M)&&!se&&!ye)&&(M=z.selection,Me());}});if(!F.ok){H=F.detail?`${F.reason}: ${F.detail}`:F.reason,q$1(),ce(Qn(F.reason,`failed to open document: ${H}`));return}H=null,h=F.surface,X=l&&h.session.reviewItems().length>0,qa(),Qp(h,a$2),V+=1,h.setEditable(m!=="viewing"),x!==null&&h.setReviewActivationExclusions(x),M=h.state().selection,N$1=F.surface.session.subscribe(z=>{let se={revision:F.surface.session.packageRevision(),created:z.created,deleted:z.deleted,dirty:z.dirty};Ee.refitIfPageResized(),q$1(),Re(se);}),Ee.attach(),q$1(),Re({revision:h.session.packageRevision()}),Me(),be!==U&&(be=U,Ve(U,h));}function gn(p){if(c$1.cancel(),X=false,U+=1,w=d$1(),G=void 0,E=void 0,ie=void 0,j(),pe=false,o){let F=yt(o);F&&(F.scrollTop=0,F.scrollLeft=0);}o&&c$1.shouldYield(p)?c$1.schedule(p):Ne(p);}function at(p){(p.code==="wasmUnavailable"||p.cause instanceof q&&p.cause.code==="unsupportedRuntime")&&!e$1.onFontError&&$.error.size===0&&wc(p);try{e$1.onFontError?.(p);}catch{}ce(p);}async function Ve(p,F){let z=e$1.fonts,se=F.session.embeddedFonts();if(!(!z&&se.length===0)){pe=true,q$1();try{let Q=typeof z=="function"?await z({families:F.session.documentFonts().slice(0,Li),defaultFamily:Aa(ge())}):z;if(P||p!==U){p===U&&(pe=!1);return}if(ie=Q,!Q&&se.length===0){pe=!1,q$1();return}let ae=(Q&&"maxFontBytes"in Q?Q.maxFontBytes:void 0)??a$1,ye=(Q?.sources??[]).reduce((he,Ke)=>he+Ke.bytes.byteLength,0),we=new Set((Q?.sources??[]).filter(he=>he.request.family.trim().length>0).map(he=>e(he.request))),oe=yg(se,{maxFontBytes:ae,aggregateBudget:Math.max(0,c-ye),shadowedRequests:we});for(let he of oe.dropped)at(new a(he.reason,he.reason==="overLimit"?`embedded font ${he.request.family} (${he.partName}) exceeds the font byte budget`:`embedded font part ${he.partName} declares an invalid family name`,{request:he.request}));let Te=aa({epoch:p,...Q},oe);if(Te.sources.length===0){pe=!1,q$1(),Q&&at(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let me=await ra(Te);if(P||p!==U){Wn(me),p===U&&(pe=!1);return}let Be=new Set;for(let he of oe.sources){let Ke=me.fonts.resolve(he.request);Ke instanceof d&&(at(Un(Ke)),Be.add(he.id));}if(Be.size>0&&Be.size<oe.sources.length){let he=oe.sources.filter(rn=>!Be.has(rn.id)),Ke=me;if(me=await ra(aa({epoch:p,...Q},{sources:he})),Wn(Ke),P||p!==U){Wn(me),p===U&&(pe=!1);return}}else if(Be.size===oe.sources.length&&!Q){pe=!1,q$1();return}let ct=[...Q?.sources??[],...oe.sources].filter(he=>!Be.has(he.id)).map(he=>{let Ke=me.fonts.resolve(he.request);return Ke instanceof d||Ke.id!==he.id?null:{request:he.request,id:Ke.id,bytes:Ke.bytes,hash:Ke.hash,faceIndex:Ke.faceIndex}}).filter(he=>he!==null),Ln=await Ig(ct,void 0,Te.substitutions??[]);if(P||p!==U){Ln.dispose(),Wn(me),p===U&&(pe=!1);return}j(),T=Ln;let Nn=Jd(ze(),{context:o?rr(o.ownerDocument):null,...T?{fontAlias:T.alias}:{}}),Dn=new Map;if(G=Od({shaper:me.shaper,resolveFont:he=>{let Ke=he.fontFamily??Te.defaultFont.family;if(Ke.trim().length===0)return null;let rn={family:Ke,weight:he.bold?700:400,style:he.italic?"italic":"normal"},ut=e(rn);if(Dn.has(ut))return Dn.get(ut)??null;let Hn;try{Hn=me.fonts.resolve(rn);}catch{return Dn.set(ut,null),null}let To=Hn instanceof d?null:Hn;return Dn.set(ut,To),To},fallback:Nn.measurer,shapingLibrary:n,unicodeDataVersion:"16.0.0",...Te.language?{language:Te.language}:{}}),E=`shaped:${me.operation.extensionFingerprint}+fallback:${Nn.producer}@scale:${ze()}`,pe=!1,h){h.flushPendingInput();let he=h.session.save(),Ke=h.state().selection,rn=typeof document<"u"&&document.activeElement!==null&&o!==null&&o.contains(document.activeElement);try{Ne(he);}catch(ut){G=void 0,E=void 0,h||(d$2=he,Ne(he)),at(Un(ut));}rn&&h?.focus(),h?.setSelection(Ke);}else q$1();}catch(Q){if(P||p!==U)return;pe=false,q$1(),at(Un(Q));}}}let ve=Ji();function ke(){let p=h?.state()??null;return {scope:h?.activeScope?.()??tv,isLoading:H===null&&h===null&&d$2===null&&!c$1.isScheduled(),isOpening:c$1.isScheduled(),parseError:H,editable:h!==null&&h.session.editable&&C!=="view"&&m!=="viewing",zoom:Ee.zoom(),zoomMode:Ee.mode(),selection:ys(h),selectionCollapsed:p===null||p.selection.anchor.paragraphId===p.selection.head.paragraphId&&p.selection.anchor.offset===p.selection.head.offset,formatting:bu(h),table:xs(h),tocContext:ve(p?.contextTocId??null),image:Kt(h),page:{current:vs(h),total:bs(h)},canUndo:p?.canUndo??false,canRedo:p?.canRedo??false,pageSetup:hs(h),reviewPaneOpen:X,hasReviewContent:h?.session.hasReviewContent()??false,editingMode:m,lastRejection:p?.lastRejection??L,fontSubstitutions:Ge()}}function it(){if(ne&&W===D)return ne;let p=ne,F=h?.state().selection??null,z=os(F,y);y=F;let se=h?.session.packageRevision()??-1,Q=se===I;I=se;let ae=ke(),ye=ae;if(p){let we=$i(ae.formatting,p.formatting)?p.formatting:ae.formatting,oe=Xi(ae.page,p.page)?p.page:ae.page,Te=Yi(ae.pageSetup??null,p.pageSetup??null)?p.pageSetup:ae.pageSetup,me=Qi(ae.selection,p.selection)?p.selection:ae.selection,Be=uu(ae.image,p.image)?p.image:ae.image,ct=p.fontSubstitutions!==void 0&&ae.fontSubstitutions!==void 0&&p.fontSubstitutions.length===ae.fontSubstitutions.length&&ae.fontSubstitutions.every((Ln,Nn)=>p.fontSubstitutions[Nn]===Ln)?p.fontSubstitutions:ae.fontSubstitutions;ye={...ae,formatting:we,page:oe,pageSetup:Te,selection:me,image:Be,fontSubstitutions:ct},es(ye,p)&&z&&Q&&(ye=p);}return ne=ua(ye),W=D,ne}if(e$1.document){let p=as(e$1.document);p?gn(p):(H=is(e$1.document),ce(Qn("unsupported",H)));}let wt=0,ur=null,tn="",nn=null,bo=true,On=null;function An(){let p=`${h?.session.packageRevision()??-1}:${h?.session.revision()??-1}`,F=Ht(),z=Rt()?.anchorY??null;return (h!==ur||p!==tn||F!==nn||X!==bo||z!==On)&&(ur=h,tn=p,nn=F,bo=X,On=z,wt+=1),wt}function Y$1(p){return p.kind==="revision"?p.ranges[0]??null:p.range}function Pt(p){return Y$1(p)===null?false:!(p.kind==="revision"&&x!==null&&x.includes(p.revisionKind))}let vo=Mp(),jt=new WeakMap;function Ha(p){let F=jt.get(p);if(F)return F;let z=new Map;for(let se of p.pages)for(let Q of [se.footnotes,se.endnotes])if(Q)for(let ae of Q.notes)for(let ye of Y(ae.fragments))for(let we of vc(ye))z.has(we)||z.set(we,ae.scopeId);return jt.set(p,z),z}function mn(p){let F=Y$1(p)?.partName;if(!F||!h||F===h.session.part().name)return null;for(let z of h.session.headerFooterResolutionBySection())for(let se of ["header","footer"]){let Q=se==="header"?z.headers:z.footers;for(let ae of Q.values())if(ae.partName===F)return {kind:se,rId:ae.rId}}return null}function fr(p){let F=Y$1(p),z=h?.publishedLayout();return !F||!z?null:Ha(z).get(F.start.paragraphId)??null}function pr(p){let F=Y$1(p)?.partName;if(!F||!h)return null;for(let z of ["footnote","endnote"])if(_d(h.session.currentPackage(),z)?.name===F)return {kind:"notesPart",noteKind:z};return null}function gr(p){let F=mn(p);return F!==null?{kind:"headerFooter",rId:F.rId}:pr(p)??{kind:"body"}}function xo(p){!h||h.activeScope().kind==="body"||h.session.paragraphIds().includes(p)&&(h.exitNote?.(),h.exitHeaderFooter?.());}let Mn=()=>`${new Date().toISOString().slice(0,19)}Z`,Io=new WeakMap;function Dt(p){let F=Io.get(p);if(F)return F;let z=new Map;for(let[se,Q]of rc(p).entries())z.set(Q,se);return Io.set(p,z),z}function mr(){h?.flushPendingInput();let p=h?.retainedSelection()??h?.state().selection??null;if(!p)return null;let{anchor:F,head:z}=p;if(F.paragraphId===z.paragraphId&&F.offset===z.offset)return null;let se=h?.publishedLayout();if(!se)return null;let Q=Dt(se),ae=Q.get(F.paragraphId)??-1,ye=Q.get(z.paragraphId)??-1;if(ae===-1||ye===-1){let oe=_a();ae=oe.get(F.paragraphId)??-1,ye=oe.get(z.paragraphId)??-1;}return ae===-1||ye===-1?null:ae<ye||ae===ye&&F.offset<=z.offset?{from:F,to:z}:{from:z,to:F}}function So(){let p=h?.activeScope();if(p?.kind==="headerFooter")return {kind:"headerFooter",rId:p.rId};if(p?.kind==="note"){let F=hd(p.id);if(F)return {kind:"notesPart",noteKind:F.noteKind}}return {kind:"body"}}function Ct(p){if(!h)return {kind:"body"};let F=p.slice(0,p.indexOf("#"));if(F.length===0||F===h.session.part().name)return {kind:"body"};for(let z of h.session.headerFooterResolutionBySection())for(let se of [z.headers,z.footers])for(let Q of se.values())if(Q.partName===F)return {kind:"headerFooter",rId:Q.rId};for(let z of ["footnote","endnote"])if(_d(h.session.currentPackage(),z)?.name===F)return {kind:"notesPart",noteKind:z};return So()}function _a(){if(!h)return new Map;let p=So();if(p.kind==="body")return new Map;let F=new Map;for(let[z,se]of h.session.paragraphIdsIn(p).entries())F.set(se,z);return F}function Ba(p){if(p.kind==="revision"){let z=p.ranges;if(z.length===0)return null;let Q=p.revisionKind==="replace"||p.revisionKind==="insert"||p.revisionKind==="delete"?z[z.length-1]:z[0];return {start:z[0].start,end:Q.end}}let F=Y$1(p);return F?{start:F.start,end:F.end}:null}function Rt(){if(h&&h.activatedReviewKey()!==null)return null;let p=mr(),F=h?.publishedLayout();if(!p||!F)return null;let z=vo(F).get(p.from.paragraphId);return z?{pageIndex:z.pageIndex,anchorY:z.contentY+Ld$1(z,p.from.paragraphId,p.from.offset)}:null}function Ht(){return h?.activeReviewKey()??null}function _t(p){if(!l)return [];let F=h?.session.reviewItems()??[],z=p?.excludeRevisionKinds;if(z&&z.length>0){let oe=new Set(z);F=F.filter(me=>me.kind!=="revision"||!oe.has(me.revisionKind));let Te=new Set(F.filter(me=>me.kind==="revision").map(me=>me.id));F=F.map(me=>{if(me.kind!=="comment"||me.parentRevisionId===void 0||Te.has(me.parentRevisionId))return me;let{parentRevisionId:Be,...ct}=me;return ct});}let se=p?.placement!==false,Q=null;if(se&&F.length>0){let oe=h?.publishedLayout()??null;oe&&(Q=vo(oe));}let ae=Ht(),ye=oe=>{let Te=mn(oe);return Te===null?1:Te.kind==="header"?0:2},we=F.map((oe,Te)=>({item:oe,position:Te,pageIndex:Q?Nd(oe,Q)?.pageIndex??null:null,group:ye(oe)}));return we.sort((oe,Te)=>{let me=oe.pageIndex??Number.MAX_SAFE_INTEGER,Be=Te.pageIndex??Number.MAX_SAFE_INTEGER;return me!==Be?me-Be:oe.group!==Te.group?oe.group-Te.group:oe.position-Te.position}),we.map(({item:oe})=>{let Te=tg$1(oe),me=Q?Nd(oe,Q):null,Be={key:Te,id:oe.id,...st(oe)!==void 0?{date:st(oe)}:{},activatable:Pt(oe),anchorY:me?.y??null,pageIndex:me?.pageIndex??null,isActive:Te===ae};return oe.kind==="comment"?{...Be,kind:"comment",author:oe.comment.author,initials:Bg(oe.comment),text:Ag(oe.comment),resolved:oe.resolved,...oe.parentId!==void 0?{parentId:oe.parentId}:{},...oe.parentRevisionId!==void 0?{parentRevisionId:oe.parentRevisionId}:{},replyIds:oe.replyIds,readOnly:false,item:oe}:oe.kind==="revision"?{...Be,kind:"revision",revisionKind:oe.revisionKind,author:oe.author,initials:hr(oe.author),text:oe.text,...oe.replacedText?{replacedText:oe.replacedText}:{},replyIds:oe.replyIds,readOnly:oe.readOnly,item:oe}:{...Be,kind:"custom",author:"",initials:"",text:oe.detail??oe.text,replyIds:[],readOnly:true,item:oe}})}function xe(){return h?.session.trackingSettings()??N}function qa(){let p=xe(),F=Eg({viewOnly:C==="view",reviewEnabled:l,hasAuthor:!!e$1.author,hostChoseMode:e$1.mode!==void 0,readerChoseMode:R,currentMode:m,trackRevisions:p.trackRevisions,restrictedToTrackedChanges:p.restrictedToTrackedChanges});F.rejection!==null&&(L=F.rejection),F.mode==="suggesting"&&(m="suggesting",h?.setEditingMode("suggest"));}function ko(p){return p!=="editing"||!xe().restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function st(p){return p.kind==="comment"?p.comment.date:p.kind==="revision"?p.date:void 0}function hr(p){let F=p.trim().split(/\s+/).filter(Boolean);return F.length===0?"?":F.slice(0,2).map(z=>z[0].toUpperCase()).join("")}function yr(p,F){if(!l)return {ok:false,code:"unsupported",reason:Nt};let se=_t().find(ae=>ae.key===p)?.item;if(!se||se.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(se.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let Q;return h?.commitReviewOps(()=>(Q=h.session.applyTreeOps(se.addresses.map(ae=>F==="accept"?{op:"acceptRevision",revision:ae}:{op:"rejectRevision",revision:ae}),void 0,void 0,gr(se)),Q)),Q?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof Q?.reason=="string"?Q.reason:"the revision was refused"}}let Ut={get mountGeneration(){return V},get surface(){return h},setHyperlinkChrome:J.push,setEquationChrome:k.push,stateVersion:()=>D,fontMeasurement:()=>({measurer:G?"shaped":"fixed",resolving:pe,...G&&E?{producer:E}:{}}),attach(p){if(P){ce(Qn("destroyed","this editor was destroyed; create a new instance to remount"));return}if(h&&o===p)return;h&&(h.flushPendingInput(),d$2=h.session.save(),tt());let F=c$1.cancel();F&&(d$2=F),Ee.detach(),o=p,fe=null;let z=d$2;d$2=null,z&&c$1.shouldYield(z)?c$1.schedule(z):z?Ne(z):q$1();},detach(){if(P)return;Ee.detach();let p=c$1.cancel();h&&(h.flushPendingInput(),d$2=h.session.save(),tt()),p&&(d$2=p),o=null,fe=null,q$1();},load(p){let F=as(p);if(!F){ce(Qn("unsupported",is(p)));return}gn(F);},save(){if(c$1.flush(),!h)return Promise.reject(Qn("notFound","no document is loaded"));h.flushPendingInput();let F=h.session.save().slice();return Promise.resolve(F.buffer)},getDocumentHandle(){return Object.freeze({revision:h?.session.packageRevision()??0})},exec(p,F){if(c$1.flush(),P&&(p.type==="toggleReviewPane"||p.type==="setEditingMode"))return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(p.type==="setEditingMode"){if(C==="view"&&p.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(p.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Nt};let we=ko(p.mode);return we||(R=true,L=null,m=p.mode,h?.setEditingMode(p.mode==="suggesting"?"suggest":p.mode==="viewing"?"view":"edit"),h?.setEditable(p.mode!=="viewing"),q$1(),Me(),{ok:true,changed:false})}if(p.type==="toggleReviewPane")return l?(X=!X,q$1(),Me(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Nt};if(ol(p))return gg(p,h,al(m),F);let z=Qr(p);if(m==="viewing"&&z.supported&&z.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let se=ao(p,h,C,F);if(!se.ok)return se.refusal;let Q=h,ae=Q.session.packageRevision(),ye=$p(Q,p,{...se.tablePlan?{admittedTablePlan:se.tablePlan}:{},editor:Ut});return ye||{ok:true,changed:Q.session.packageRevision()!==ae}},can(p,F){if(p.type==="insertImage"||p.type==="replaceImage"){if(P)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(F?.scope){let Q=ao(p,h,C,F);if(!Q.ok)return Q.refusal}return hu(p,h)}if(p.type==="toggleReviewPane"||p.type==="setEditingMode"){if(P)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(p.type==="toggleReviewPane"&&!l)return {ok:false,code:"unsupported",reason:Nt};if(p.type==="setEditingMode"&&C==="view"&&p.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(p.type==="setEditingMode"){if(p.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Nt};let Q=ko(p.mode);if(Q)return Q}return {ok:true}}if(ol(p))return il(p,h,al(m),F);let z=Qr(p);if(m==="viewing"&&z.supported&&z.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let se=ao(p,h,C,F);if(!se.ok)return se.refusal;if(p.type==="proposeInsertion"||p.type==="proposeDeletion"||p.type==="proposeReplacement"){if(!(p.author??e$1.author??"").trim())return {ok:false,code:"invalidArgs",reason:`${p.type} requires a non-empty author`};let ae=p.target===void 0?{ok:true,selection:h.state().selection}:Ca(h,p.target);if(!ae.ok)return ae;let{anchor:ye,head:we}=ae.selection,oe=ye.paragraphId===we.paragraphId&&ye.offset===we.offset;if(p.type!=="proposeInsertion"&&oe)return {ok:false,code:"invalidArgs",reason:`${p.type} needs a non-collapsed selection`};if(p.type==="proposeReplacement"&&ye.paragraphId!==we.paragraphId)return {ok:false,code:"unsupported",reason:"tracked replacement across paragraph marks is not supported"}}if(to(p)&&us(p)){let Q=no(Ut);if(Q){let ae=fs(Ut,p,Q);if(ae)return ae}}return {ok:true}},isActive(p){if(p.type==="toggleReviewPane")return X;if(p.type==="setEditingMode")return m===p.mode;let F=h?it().formatting:null;if(!F)return false;switch(p.type){case "toggleMark":switch(p.mark){case "bold":return F.bold===true;case "italic":return F.italic===true;case "underline":return F.underline===true;case "strike":return F.strike===true;case "superscript":return F.superscript===true;case "subscript":return F.subscript===true;default:return false}case "setAlignment":return F.alignment===(p.align==="justify"?"both":p.align);case "toggleList":return h?.isListActive(p.kind)??false;default:return false}},getDocumentStyles:()=>h?.session.documentStyles()??[],getDocumentFonts:()=>h?.session.documentFonts()??[],getAvailableFonts:()=>hg(ge(),h?.session.documentFonts()??[]),getDocumentThemeColors:()=>h?.session.documentThemeColors()??[],getOutline:()=>h?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>Su(h?it().formatting:null),findMatches:(p,F)=>h?.session.findText(p,{...F?.matchCase!==void 0?{matchCase:F.matchCase}:{},...F?.wholeWord!==void 0?{wholeWord:F.wholeWord}:{}}).matches??[],selectMatch(p){return c$1.flush(),h?typeof p?.blockId!="string"||p.blockId.length===0||!Number.isInteger(p.start)||p.start<0||!Number.isInteger(p.length)||p.length<0?{ok:false,code:"invalidArgs",reason:"match must carry a blockId and offsets"}:(xo(p.blockId),h.setSelection({anchor:{paragraphId:p.blockId,offset:p.start},head:{paragraphId:p.blockId,offset:p.start+p.length}}),h.revealParagraph(p.blockId),{ok:true,changed:false}):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>it().image,getSelectedTable:()=>Iu(h),getTableCellSelection:()=>{let p=h?.state().cellSelection;return p?{tableId:p.tableId,rows:p.rows,columns:p.columns,cellIds:p.cellIds}:null},setTableInteractionLabel(p){h?.setTableInteractionLabel(p);},canExecuteImageCommand(p,F){if(P)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(F?.scope){let z=ao(p,h,C,F);if(!z.ok)return z.refusal}return ps(p,h)},executeImageCommand(p){return P?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):gs(Ut,p)},getPageSetup:()=>hs(h),getWatermark:()=>null,getTrackedChanges:()=>(h?.session.reviewItems()??[]).filter(p=>p.kind==="revision").map(p=>{let F=mn(p);return {id:p.id,kind:p.kind==="revision"?p.revisionKind:"revision",...p.kind==="revision"&&p.author?{author:p.author}:{},story:F!==null?F.kind:pr(p)?.noteKind??"body"}}),getReviewItems:p=>_t(p),getCustomNodeDefinitions:()=>a$2.customNodes,reportCustomNodeDiagnostic:i,addComment(p,F){if(!l)return {ok:false,code:"unsupported",reason:Nt};let z=mr();if(!z||!h)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let se=(F??e$1.author??"").trim();if(se.length===0||p.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let Q=null;return h.commitReviewOps(()=>(Q=h.session.replyToComment(null,{paragraphId:z.from.paragraphId,start:z.from.offset,end:z.to.offset,...z.to.paragraphId===z.from.paragraphId?{}:{endParagraphId:z.to.paragraphId}},p,se,Mn(),Ct(z.from.paragraphId)),{committed:Q!==null})),Q===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>Rt(),isReviewPaneOpen:()=>X,getEditingMode:()=>m,getReviewAuthors:()=>v.authorsFor(h?.revisionAuthors()??Fg),getConfiguredAuthor:()=>e$1.author?.trim()||null,getReviewAuthorStyle:p=>v.styleFor(p),setRevisionStyles(p){v.set(p),h?.setRevisionStyles(p),q$1(),Me();},setEditingMode:p=>Ut.exec({type:"setEditingMode",mode:p}),getReviewRevision:()=>An(),setActiveReviewItem(p,F){if(p===null)return h?.dismissActiveReview(),q$1(),Me(),{ok:true,changed:false};if(!h)return {ok:false,code:"notFound",reason:"no document is open"};h.flushPendingInput();let se=_t().find(we=>we.key===p)?.item;if(!se)return {ok:false,code:"notFound",reason:"no review item with that key"};let Q=Y$1(se);if(!Q)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!Pt(se))return {ok:false,code:"unsupported",reason:`review items of kind '${se.revisionKind}' are excluded from activation`};let ae=se?mn(se):null,ye=ae===null&&se?fr(se):null;if(ae!==null){if(!h.enterHeaderFooter?.({rId:ae.rId,kind:ae.kind,position:{paragraphId:Q.start.paragraphId,offset:Q.start.offset}}))return {ok:false,code:"unsupported",reason:"the header or footer this change lives in could not be opened"}}else if(ye!==null){if(!h.enterNote?.(ye,{paragraphId:Q.start.paragraphId,offset:Q.start.offset}))return {ok:false,code:"unsupported",reason:"the note this change lives in could not be opened"}}else {h.exitNote?.(),h.exitHeaderFooter?.();let we=Ba(se)??Q,oe={paragraphId:we.start.paragraphId,offset:we.start.offset};h.activateReview(p,{anchor:oe,head:oe});let Te=F?.reveal??"centerIfNeeded";Te!==false&&h.revealPosition?.(we.start,{block:Te});}return (ae!==null||ye!==null)&&h.activateReview(p),q$1(),Me(),{ok:true,changed:false}},setReviewActivationExclusions(p){x=p===null?null:[...p],h?.setReviewActivationExclusions(x);},acceptReviewItem:p=>yr(p,"accept"),rejectReviewItem:p=>yr(p,"reject"),setCommentResolved(p,F){return eg({reviewEnabled:l,editingMode:m,placements:_t,surface:h,proReviewReason:Nt,bump:q$1},p,F)},deleteReviewItem(p){if(!l)return {ok:false,code:"unsupported",reason:Nt};let z=_t().find(Q=>Q.key===p)?.item;if(!z||!h)return {ok:false,code:"notFound",reason:"no review item with that key"};if(z.kind==="revision")return yr(p,"reject");if(z.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};Ht()===p&&h.dismissActiveReview();let se=false;return h.commitReviewOps(()=>{let Q=fr(z),ae=Q===null?null:hd(Q);return se=h.session.deleteComment(z.id,gr(z),ae?.noteId),{committed:se}}),se?(q$1(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(p,F,z){if(!l)return {ok:false,code:"unsupported",reason:Nt};h?.flushPendingInput();let Q=_t().find(me=>me.key===p)?.item;if(!Q||!h)return {ok:false,code:"notFound",reason:"no review item with that key"};let ae=Y$1(Q);if(!ae)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let ye=(z??e$1.author??"").trim(),we=tg(Q,F,ye);if(we)return we;let oe=Q.kind==="comment"?Q.id:null,Te=null;return h.commitReviewOps(()=>(Te=h.session.replyToComment(oe,{paragraphId:ae.start.paragraphId,start:ae.start.offset,end:ae.end.offset},F,ye,Mn(),gr(Q)),{committed:Te!==null})),Te===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>h?.headerFooterState()??null,getNotePropertiesState:()=>h?.notePropertiesState?.()??null,getNotePreviewText:p=>h?.notePreviewText?.(p)??null,setActiveScope(p){h?.setActiveScope(p)&&q$1();},getActiveScope:()=>h?.activeScope()??{kind:"body"},query(p){switch(p.type){case "selectedText":return h?.selectedText()??"";case "selectionFormatting":return h?it().formatting:null;case "selection":return ys(h);case "paragraphs":return xu(h,p.container);case "isInsideToc":return h?h.isInsideToc(h.state().selection.head.paragraphId):false;case "hyperlinkAt":return vu(h);case "contentControls":return dg(h,p.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 rl(h,p.filter);case "tableContext":return xs(h);default:return null}},snapshot:()=>it(),getTotalPages:()=>bs(h),getCurrentPage:p=>vs(h,p),scrollToPage:p=>!Number.isInteger(p)||p<1?false:(c$1.flush(),h?.revealPage(p-1)??false),scrollToBlock:p=>typeof p!="string"||p.length===0?false:(c$1.flush(),xo(p),h?.revealParagraph(p)??false),...Cg(Ee,()=>h),relayout(p){p?.sync,h?.layout();},retainSelection:()=>h?.retainSelection()??null,releaseSelection:p=>h?.releaseSelection(p),focus(p){return c$1.flush(),h?p&&p.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:p&&!h.setActiveScope(p)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(h.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){P=true,c$1.cancel(),Ee.detach(),j(),tt(),o=null,d$2=null,V+=1,q$1();for(let p of Object.values($))p.clear();},on(p,F){return $[p].add(F),()=>{$[p].delete(F);}}};return Ut}var Lg=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function rv(e){return g$1({port:ov(e),capabilities:Lg})}function ov(e){let t=0,n=0,r=null,o=false,a=false,i=()=>{if(a)return null;let l=e.surface?.session??null;return l!==r&&(o&&(t+=n+1),o=true,r=l,n=0),l&&(n=l.packageRevision()),l};return {revision(){return i(),t+n},currentPackage:()=>i()?.currentPackage()??null,apply(l,d){i();let c=e.surface;if(!c)return {ok:false,reason:"no-document"};let m=c.applyAutomationOps(l,d);return m.rejected?{ok:false,reason:String(m.reason??"refused")}:{ok:true,changed:m.committed}},applyLifecycle(l){i();let d=e.surface;if(!d)return {ok:false,reason:"no-document"};let c=d.applyAutomationOps(()=>[l]);return c.rejected?{ok:false,reason:String(c.reason??"refused")}:{ok:true,changed:c.committed}},applyCommentWrites(l,d){let c=e.surface,m=i();if(!c||!m)return {ok:false,reason:"no-document"};if(l.length===0)return {ok:true,changed:false};if(d.kind!=="body")return {ok:false,reason:"unsupported-story"};let x=e.can({type:"toggleReviewPane"});if(!x.ok)return {ok:false,reason:x.reason??"review-module-required"};let v={ok:false,reason:"refused"};return c.commitReviewOps(()=>{if(l.every(L=>L.kind==="delete")){let L=l.find(K=>K.kind==="delete"),C=m.deleteComments(l.map(K=>{if(K.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:K.commentId,...K.parentCommentId===void 0?{}:{parentCommentId:K.parentCommentId}}}),d,L?.kind==="delete"?L.noteId:void 0);return v=C?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:C}}if(l.length!==1)return v={ok:false,reason:"mixed-comment-writes"},{committed:false};let w=l[0];if(w.kind==="resolve"){let L=m.setCommentResolved(w.commentId,w.resolved);return v=L?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:L}}if(w.kind!=="create"&&w.kind!=="reply")return v={ok:false,reason:"unsupported-comment-write"},{committed:false};let R=m.replyToComment(w.kind==="reply"?w.parentCommentId:null,w.anchor,w.text,w.author,w.date);return v=R===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:R},{committed:R!==null}}),v},applyCustomNodeWrite(l,d){let c=e.surface,m=i();if(!c||!m)return {ok:false,reason:"no-document"};if(d.kind!=="body")return {ok:false,reason:"unsupported-story"};let x={ok:false,reason:"refused"};return c.commitReviewOps(()=>{let v=m.insertCustomNode(l);return x=v.ok?{ok:true,changed:v.change!==null}:{ok:false,reason:v.detail?`${v.reason}: ${v.detail}`:v.reason},{committed:v.ok}}),x},save:()=>i()?.save()??null,select(l,d){if(!e.surface)return;let m=d==="end"?l.end:l.start,x=d==="start"?l.start:l.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:m.paragraphId,offset:m.offset},head:{paragraphId:x.paragraphId,offset:x.offset}}});},subscribe:l=>e.on("change",()=>l()),dispose(){a=true,r=null;}}}function av(e){return e*(96/72)}function iv(e,t){return e*t}function sv(e,t){return e/t}function lv(e,t,n){let r=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 Dg(e,t,n){return t?true:e.length===1?false:!n}var Ng=["e","se","s","sw","w","nw","n","ne"];function dv(e,t){let n=Ng.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return Ng[(n-r+8)%8]}function cv(e,t,n){let r=e,o=t,a=-n.rotationDegrees*Math.PI/180,i=Math.cos(a),l=Math.sin(a),d=r*i-o*l,c=r*l+o*i;return r=d,o=c,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function Fn(e){return e/oo}function Hg(e){let t=cv(e.deltaXPt,e.deltaYPt,e.transform),n=Fn(e.startWidthEmu),r=Fn(e.startHeightEmu),o=n/r,a=dv(e.handle,e.transform),i=a.includes("e")?t.x:a.includes("w")?-t.x:0,l=a.includes("s")?t.y:a.includes("n")?-t.y:0;if(n=Math.max(1,n+i),r=Math.max(1,r+l),e.preserveAspect)if(a.length===2){let H=Math.max(n/Fn(e.startWidthEmu),r/Fn(e.startHeightEmu));n=Math.max(1,Fn(e.startWidthEmu)*H),r=Math.max(1,n/o);}else a==="e"||a==="w"?r=Math.max(1,n/o):n=Math.max(1,r*o);let d=Fn(e.startWidthEmu),c=Fn(e.startHeightEmu),m=n/d,x=r/c,v=Math.max(1,e.startBounds.width*m),w=Math.max(1,e.startBounds.height*x),R=e.startBounds.x,L=e.startBounds.y,C=e.handle;C.includes("w")&&(R=e.startBounds.x+e.startBounds.width-v),C.includes("n")&&(L=e.startBounds.y+e.startBounds.height-w);let K=null;if(e.kind==="anchored"&&e.startPosition&&(C.includes("w")||C.includes("n")))if(e.startPosition.mode==="simple"){let h=C.includes("w")?et(R-e.startBounds.x):0,H=C.includes("n")?et(L-e.startBounds.y):0;K=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+h,verticalEmu:(e.startPosition.verticalEmu??0)+H});}else if(e.anchorFrameOrigin)K=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...C.includes("w")?{horizontalEmu:et(R-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...C.includes("n")?{verticalEmu:et(L-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let h=C.includes("w")?et(R-e.startBounds.x):0,H=C.includes("n")?et(L-e.startBounds.y):0;K=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+h}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+H}:{},...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:R,y:L,width:v,height:w}),position:K})}function uv(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 fv(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&&ms(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?Hg({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:Dg(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})}
15
- export{ga as $,Ui as A,y0 as Aa,Wi as B,b0 as Ba,Ym as C,v0 as Ca,ss as D,ba as Da,Ch as E,hp as Ea,Jr as F,Gs as Fa,eo as G,ho as Ga,ls as H,yo as Ha,Rh as I,dr as Ia,ds as J,Xb as Ja,Kt as K,La as Ka,no as L,Na as La,ps as M,nv as Ma,gs as N,Lg as Na,Zh as O,rv as Oa,zh as P,av as Pa,oo as Q,iv as Qa,Kh as R,sv as Ra,et as S,lv as Sa,Jn as T,Dg as Ta,jh as U,Hg as Ua,ms as V,uv as Va,Uh as W,fv as Wa,pa as X,tr as Y,Tu as Z,Is as _,Un as a,Yh as aa,ra as b,wu as ba,Wn as c,Pu as ca,ym as d,Qh as da,Li as e,wn as ea,oa as f,Ss as fa,aa as g,n0 as ga,Ni as h,r0 as ha,$n as i,a0 as ia,Hm as j,ma as ja,_m as k,Eu as ka,Bm as l,ha as la,_c as m,Fu as ma,qm as n,Ou as na,Zm as o,l0 as oa,zm as p,d0 as pa,Vm as q,c0 as qa,Km as r,u0 as ra,jm as s,f0 as sa,Um as t,p0 as ta,Bc as u,g0 as ua,Wm as v,Ts as va,Ki as w,m0 as wa,jc as x,Mu as xa,Uc as y,h0 as ya,ca as z,Lu as za};