@docx-editor.dev/core 2.16.0 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +10 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-4RDCLCLB.js +2 -0
- package/dist/chunk-7QG5FJ4X.js +1 -0
- package/dist/chunk-BML3CNUT.js +2 -0
- package/dist/chunk-FRRMJK2G.js +5 -0
- package/dist/{chunk-FAD7DH6Q.cjs → chunk-G5GLQ4SX.cjs} +1 -1
- package/dist/chunk-JP253KIZ.cjs +2 -0
- package/dist/chunk-JROG4U3Z.cjs +21 -0
- package/dist/{chunk-DYPT6YDY.js → chunk-MBXGQN6J.js} +1 -1
- package/dist/{chunk-QVJO5FUR.js → chunk-MDMM3XVQ.js} +6 -6
- package/dist/{chunk-4MIFIUEV.cjs → chunk-NO7U62I2.cjs} +1 -1
- package/dist/{chunk-WGHVIB6B.cjs → chunk-NPZX5O23.cjs} +1 -1
- package/dist/chunk-OISZDVXT.cjs +5 -0
- package/dist/{chunk-YRTRPSSA.cjs → chunk-PRNYSOQL.cjs} +1 -1
- package/dist/chunk-QQP2SGAT.js +20 -0
- package/dist/chunk-RXPOTTQQ.js +21 -0
- package/dist/chunk-T7JERNXT.cjs +2 -0
- package/dist/{chunk-TDHR2QLH.cjs → chunk-TDMGSCCL.cjs} +1 -1
- package/dist/{chunk-BPSGGVP5.cjs → chunk-UIB2MDE3.cjs} +1 -1
- package/dist/{chunk-I4ENGOOZ.js → chunk-UXAWPVH6.js} +1 -1
- package/dist/{chunk-AEIAYDCG.js → chunk-VYQTZIYH.js} +1 -1
- package/dist/chunk-W7GY2IJC.js +2 -0
- package/dist/chunk-XC7YDJBL.cjs +20 -0
- package/dist/{chunk-YKDRBDI2.js → chunk-XXLS6O6B.js} +1 -1
- package/dist/{chunk-GHNTGVKG.cjs → chunk-ZFBNCHRP.cjs} +6 -6
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -4
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/modules.d.ts +8 -8
- package/dist/{custom-node-writes-4WOL8JB_.d.ts → custom-node-writes-ClTkWM7s.d.ts} +2 -2
- package/dist/{editor-PDx0fqSo.d.ts → editor-BlerWPyk.d.ts} +21 -3
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.d.ts +26 -26
- package/dist/editor.js +1 -1
- package/dist/export.cjs +1 -1
- package/dist/export.d.ts +11 -11
- package/dist/export.js +1 -1
- package/dist/{font-resolver-CdqOugwZ.d.ts → font-resolver-DtADJcLL.d.ts} +1 -1
- package/dist/{headless-document-view-C9ONlGtf.d.ts → headless-document-view-BDSeMGoK.d.ts} +2 -2
- package/dist/{hf-references-BZVHctVD.d.ts → hf-references-kSSFMq9X.d.ts} +1 -1
- package/dist/{index-BVb4a6O3.d.ts → index-D51bUVBE.d.ts} +96 -15
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-D_U5z-Qh.d.ts → layout-shaping-rTElghj2.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +21 -19
- package/dist/layout.js +1 -1
- package/dist/{note-properties-BosjbkGC.d.ts → note-properties-D5_fXW9K.d.ts} +1 -1
- package/dist/{omml-equation-oLlbPpVy.d.ts → omml-equation-C9AJfWy5.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-CUsqt13U.d.ts → protocol-K-Djpjjw.d.ts} +2 -2
- package/dist/{review-items-kC-YI70C.d.ts → review-items-CiliAz8H.d.ts} +11 -1
- package/dist/review-paragraph-order-BlSnyg9a.d.ts +79 -0
- package/dist/{revision-projection-CN_DiOl_.d.ts → revision-projection-JiDclAFU.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BMrXDniV.d.ts → semantic-cell-selection-C-VsxNee.d.ts} +4 -4
- package/dist/{semantic-interaction-NGeYzYCN.d.ts → semantic-interaction-2vPh96Ey.d.ts} +1 -1
- package/dist/{semantic-paint-CM8F-8pH.d.ts → semantic-paint-BEjYcsPK.d.ts} +4 -2
- package/dist/{semantic-records-BreR44Ki.d.ts → semantic-records-Bc-MGXbM.d.ts} +9 -3
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +99 -15
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-C5rZzoAz.d.ts → tree-op-types-C71G7rIv.d.ts} +6 -2
- package/dist/{tree-package-fragment-DDQHk8sv.d.ts → tree-package-fragment-DRJkmfTW.d.ts} +3 -3
- package/dist/{tree-session-contract-dKgbKH9A.d.ts → tree-session-contract-Cp5W25RC.d.ts} +7 -7
- package/dist/{tree-store-DU192chS.d.ts → tree-store-BRfhZceK.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-66DTF4TD.cjs +0 -2
- package/dist/chunk-67U2OZS7.cjs +0 -2
- package/dist/chunk-6EGMDUL7.js +0 -21
- package/dist/chunk-ABXCIZVW.js +0 -2
- package/dist/chunk-CMV2MTDE.js +0 -5
- package/dist/chunk-EWV5JMJY.cjs +0 -21
- package/dist/chunk-GQVKCK33.js +0 -2
- package/dist/chunk-IZHDCQUC.js +0 -20
- package/dist/chunk-KEXMDQ2Z.js +0 -1
- package/dist/chunk-KQEUFAAG.cjs +0 -20
- package/dist/chunk-SIUUTE5M.js +0 -2
- package/dist/chunk-XKQTITOJ.cjs +0 -5
- package/dist/review-reads-DdvADsmp.d.ts +0 -161
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkZFBNCHRP_cjs=require('./chunk-ZFBNCHRP.cjs'),fflate=require('fflate');function Y(e){return e.kind!=="textValue"}function L(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkZFBNCHRP_cjs.da}function ae(e,t){for(let n of e)t(n),n.kind!=="textValue"&&ae(n.children,t);}function xe(e){if(e.kind==="textValue")return `T(${e.value})`;if(e.namespaceUri===chunkZFBNCHRP_cjs.da&&e.localName.startsWith("rsid"))return "";let t=e.attributes.filter(r=>!r.localName.startsWith("rsid")&&!(r.namespaceUri===chunkZFBNCHRP_cjs.ga&&(r.localName==="paraId"||r.localName==="textId"))).map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(","),n=e.children.map(xe).join("");return `E(${e.namespaceUri}:${e.localName}[${t}]{${n}})`}function ft(e){return `S[${e.attributes.filter(n=>n.localName!=="styleId").map(n=>`${n.localName}=${n.value}`).sort().join(",")}]${e.children.map(xe).join("")}`}function Ft(e){let t=[],n=new Map,r=new Set,o=null;if(e&&Y(e.root))for(let i of e.root.children){if(!Y(i))continue;if(L(i,"docDefaults")){o=i;continue}if(!L(i,"style"))continue;t.push(i);let a=chunkZFBNCHRP_cjs.De(i,"styleId");a&&n.set(a,i);let s=i.children.find(l=>L(l,"name")),d=s?chunkZFBNCHRP_cjs.De(s,"val"):void 0;d&&r.add(d);}return {part:e,styles:t,docDefaults:o,byId:n,names:r}}function At(e,t,n){let r=new Map;if(!e)return r;let o=e.children.find(a=>L(a,t));if(!o||!Y(o))return r;let i=o.children.find(a=>L(a,n));if(!i||!Y(i))return r;for(let a of i.children)a.kind!=="textValue"&&r.set(a.localName,a);return r}function yn(e,t,n,r){let o=t;for(let i=0;i<16&&o;i+=1){let a=e.byId.get(o);if(!a)return false;let s=a.children.find(l=>L(l,n));if(s&&Y(s)&&s.children.some(l=>l.kind!=="textValue"&&l.localName===r))return true;let d=a.children.find(l=>L(l,"basedOn"));o=d?chunkZFBNCHRP_cjs.De(d,"val"):void 0;}return false}function Ui(e,t){for(let n of e.styles){if(chunkZFBNCHRP_cjs.De(n,"type")!==t)continue;let r=chunkZFBNCHRP_cjs.De(n,"default");if(r==="1"||r==="true")return chunkZFBNCHRP_cjs.De(n,"styleId")}}function _t(e,t){let n=e.children.find(r=>L(r,t));return n&&Y(n)?n:null}var Li=new Map(["pStyle","keepNext","keepLines","pageBreakBefore","framePr","widowControl","numPr","suppressLineNumbers","pBdr","shd","tabs","suppressAutoHyphens","kinsoku","wordWrap","overflowPunct","topLinePunct","autoSpaceDE","autoSpaceDN","bidi","adjustRightInd","snapToGrid","spacing","ind","contextualSpacing","mirrorIndents","suppressOverlap","jc","textDirection","textAlignment","textboxTightWrap","outlineLvl","divId","cnfStyle","rPr","sectPr","pPrChange"].map((e,t)=>[e,t])),$i=new Map(["rStyle","rFonts","b","bCs","i","iCs","caps","smallCaps","strike","dstrike","outline","shadow","emboss","imprint","noProof","snapToGrid","vanish","webHidden","color","spacing","w","kern","position","sz","szCs","highlight","u","effect","bdr","shd","fitText","vertAlign","rtl","cs","em","lang","eastAsianLayout","specVanish","oMath","rPrChange"].map((e,t)=>[e,t]));function kn(e,t,n){let r=At(t.docDefaults,"rPrDefault","rPr"),o=At(n.docDefaults,"rPrDefault","rPr"),i=At(t.docDefaults,"pPrDefault","pPr"),a=At(n.docDefaults,"pPrDefault","pPr"),s=(g,k,f)=>{let P=Ui(g,"paragraph"),O=P?g.byId.get(P):void 0;if(!O)return P;for(let[b,N]of [["rPr",k],["pPr",f]]){let T=_t(O,b);if(T)for(let A of T.children)A.kind!=="textValue"&&N.set(A.localName,A);}return P};s(t,r,i),s(n,o,a);let d=new Map;for(let[g,k]of r){let f=o.get(g);(!f||xe(f)!==xe(k))&&d.set(g,k);}let l=new Map;for(let[g,k]of i){if(g==="sectPr")continue;let f=a.get(g);(!f||xe(f)!==xe(k))&&l.set(g,k);}if(d.size===0&&l.size===0)return e;let c=0,m=()=>`fragment#materialized-${c++}`,u=g=>{let k=f=>f.kind==="textValue"?{id:m(),kind:"textValue",value:f.value}:{...f,id:m(),children:f.children.map(k)};return k(g)},y=(g,k,f)=>{if(f.length===0)return g;let P=_t(g,k);if(P){let b=k==="rPr"?$i:Li,N=[...P.children];for(let A of f){let G=A.kind==="textValue"?Number.MAX_SAFE_INTEGER:b.get(A.localName)??Number.MAX_SAFE_INTEGER,H=N.length;for(let Q=0;Q<N.length;Q+=1){let me=N[Q];if(me.kind==="textValue")continue;let te=b.get(me.localName);if(te!==void 0&&te>G){H=Q;break}}N.splice(H,0,A);}let T={...P,children:N};return {...g,children:g.children.map(A=>A===P?T:A)}}let O={id:m(),kind:k==="rPr"?"runProperties":"paragraphProperties",namespaceUri:chunkZFBNCHRP_cjs.da,localName:k,prefix:"w",namespaceBindings:[],attributes:[],children:f};return {...g,children:[O,...g.children]}},p=g=>{let k=_t(g,"pPr"),f=k?.children.find(T=>L(T,"pStyle")),P=f?chunkZFBNCHRP_cjs.De(f,"val"):void 0,O=[];for(let[T,A]of l)k?.children.some(H=>H.kind!=="textValue"&&H.localName===T)||P&&yn(t,P,"pPr",T)||O.push(u(A));let b=T=>{if(T.kind==="textValue")return T;if(T.kind==="run"){let G=_t(T,"rPr"),H=G?.children.find(te=>L(te,"rStyle")),Q=H?chunkZFBNCHRP_cjs.De(H,"val"):void 0,me=[];for(let[te,we]of d)G?.children.some(E=>E.kind!=="textValue"&&E.localName===te)||Q&&yn(t,Q,"rPr",te)||P&&yn(t,P,"rPr",te)||me.push(u(we));return y(T,"rPr",me)}if(T.kind==="paragraphProperties"||T.kind==="runProperties")return T;let A=T.children.map(b);return A.some((G,H)=>G!==T.children[H])?{...T,children:A}:T};return b(y(g,"pPr",O))},h=g=>{if(g.kind==="textValue")return g;if(g.kind==="paragraph")return p(g);let k=g.children.map(h);return k.some((f,P)=>f!==g.children[P])?{...g,children:k}:g};return e.map(h)}function Bi(e,t){return {...e,children:t}}function Hi(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkZFBNCHRP_cjs.da}var ji=new Set(["commentRangeStart","commentRangeEnd"]),Vi=new Set(["altChunk","subDoc"]);function Wi(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}var Ki=new Set(["DDE","DDEAUTO","INCLUDE","INCLUDEPICTURE","INCLUDETEXT","IMPORT","LINK","DATABASE","AUTOTEXT","AUTOTEXTLIST","GOTOBUTTON","MACROBUTTON","PRINT","ADDIN"]);function wo(e){if(e===void 0)return false;let t=e.trim().replace(/^"+/,"").split(/\s+/,1)[0]??"";return Ki.has(t.toUpperCase())}function zi(e){if(e.kind!=="run")return null;for(let t of e.children)if(t.kind==="fldChar"){let n=chunkZFBNCHRP_cjs.De(t,"fldCharType");return n==="separate"||n==="end"?n:"begin"}return null}function Gi(e){if(e.kind!=="run")return null;let t="",n=false;for(let r of e.children)if(r.kind==="instrText"){n=true;for(let o of r.children)o.kind==="textValue"&&(t+=o.value);}return n?t:null}function Xi(e){let t=[],n=new Set,r=i=>{if(i.dangerous){for(let a of i.machinery)n.add(a);for(let a of i.instr)n.add(a);for(let a of i.preResult)n.add(a);}},o=i=>{if(i.kind!=="textValue"){if(i.kind==="run"){let a=zi(i);if(a==="begin"){t.push({dangerous:false,afterSeparate:false,machinery:[i.id],instr:[],preResult:[]});return}let s=t[t.length-1];if(s){if(a==="separate"){s.afterSeparate=true,s.machinery.push(i.id);return}if(a==="end"){s.machinery.push(i.id),t.pop(),r(s);return}let d=Gi(i);if(d!==null){s.instr.push(i.id),wo(d)&&(s.dangerous=true);return}s.afterSeparate||s.preResult.push(i.id);return}return}for(let a of i.children)o(a);}};for(let i of e)o(i);for(;t.length>0;){let i=t.pop();i.dangerous=true,r(i);}return n}function Yi(e,t){if(e.kind==="textValue")return e;if(e.namespaceUri===chunkZFBNCHRP_cjs.da&&(ji.has(e.localName)||e.localName==="sectPr"||Vi.has(e.localName))||Wi(e)||t.has(e.id))return "drop";if(Hi(e,"fldSimple")&&wo(chunkZFBNCHRP_cjs.De(e,"instr")))return xn(e.children,t);let n=xn(e.children,t);return n.length===e.children.length&&n.every((r,o)=>r===e.children[o])?e:Bi(e,n)}function xn(e,t){let n=[];for(let r of e){let o=Yi(r,t);o!=="drop"&&(Array.isArray(o)?n.push(...o):n.push(o));}return n}function Pn(e){let t=Xi(e);return xn(e,t)}var Fe="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Ji="http://schemas.openxmlformats.org/package/2006/relationships",qi="http://schemas.openxmlformats.org/drawingml/2006/main",bd="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",Nd="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",Sd="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",wd="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",Td="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",Ed="application/vnd.openxmlformats-package.relationships+xml",Qi=`${Fe}/styles`,Zi=`${Fe}/numbering`,Md=`${Fe}/footnotes`,Cd=`${Fe}/endnotes`,Dd=`${Fe}/officeDocument`,es=`${Fe}/theme`;function ce(e){return e.kind!=="textValue"}function To(e,t){return {...e,children:t}}function Ye(e,t){if(t(e),e.kind!=="textValue")for(let n of e.children)Ye(n,t);}var ts=new Set(["pStyle","rStyle","tblStyle"]);function Ad(e,t){for(let n of e)Ye(n,r=>{if(r.kind!=="textValue"&&ts.has(r.localName)&&r.namespaceUri===chunkZFBNCHRP_cjs.da){let o=chunkZFBNCHRP_cjs.De(r,"val");o&&t.add(o);}});}function _d(e,t){for(let n of e)Ye(n,r=>{if(r.kind!=="textValue"&&r.localName==="numId"&&r.namespaceUri===chunkZFBNCHRP_cjs.da){let o=chunkZFBNCHRP_cjs.De(r,"val");o&&t.add(o);}});}function Fd(e,t){for(let n of e)Ye(n,r=>{if(r.kind!=="textValue")for(let o of r.attributes)o.namespaceUri===Fe&&o.value.length>0&&t.add(o.value);});}function Pe(e){return /^\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}function Mo(e,t){let n={footnote:new Set,endnote:new Set},r=[],o=i=>{for(let a of i)Ye(a,s=>{if(s.kind!=="noteReference")return;let d=s.localName==="footnoteReference"?"footnote":"endnote",l=chunkZFBNCHRP_cjs.De(s,"id");if(l===void 0)return;let c=Pe(l);n[d].has(c)||(n[d].add(c),r.push({kind:d,id:c}));});};for(o(e);r.length>0;){let i=r.pop(),a=t(i.kind,i.id);a!==null&&o([a]);}return n}function On(e,t,n){if(e.kind==="textValue")return e;let r=[],o=false;for(let i of e.children){if(i.kind!=="textValue"&&i.namespaceUri===chunkZFBNCHRP_cjs.da&&(i.localName==="footnoteReference"||i.localName==="endnoteReference")){let d=i.localName==="footnoteReference"?t:n,l=chunkZFBNCHRP_cjs.De(i,"id");if(i.kind!=="noteReference"||l===void 0||!d.has(Pe(l))){o=true;continue}}let s=On(i,t,n);s!==i&&(o=true),r.push(s);}return o?{...e,children:r}:e}function ns(e,t){for(let n of chunkZFBNCHRP_cjs.gc(e,t)){if(n.type!==Qi||n.targetMode==="External")continue;let r=chunkZFBNCHRP_cjs.w(n.ownerPart,n.rawTarget);if(r.ok)return e.parts.get(r.partName)??null}return e.parts.get("/word/styles.xml")??null}function Co(e,t,n){for(let r of chunkZFBNCHRP_cjs.gc(e,t)){if(r.type!==n||r.targetMode==="External")continue;let o=chunkZFBNCHRP_cjs.w(r.ownerPart,r.rawTarget);if(o.ok)return e.parts.get(o.partName)??null}return null}function Ud(e,t){let n=ns(e,t),r=new Map,o=[],i=null;if(n&&ce(n.root))for(let a of n.root.children){if(!ce(a))continue;if(a.localName==="docDefaults"&&a.namespaceUri===chunkZFBNCHRP_cjs.da){i=a;continue}if(a.localName!=="style"||a.namespaceUri!==chunkZFBNCHRP_cjs.da)continue;let s=chunkZFBNCHRP_cjs.De(a,"styleId");s&&r.set(s,a),(chunkZFBNCHRP_cjs.De(a,"default")==="1"||chunkZFBNCHRP_cjs.De(a,"default")==="true")&&o.push(a);}return {part:n,byId:r,defaults:o,docDefaults:i}}var rs=new Set(["basedOn","link","next"]);function Ld(e,t){let n=new Set,r=[...t];for(let a of e.defaults){let s=chunkZFBNCHRP_cjs.De(a,"styleId");s&&r.push(s);}let o=[];for(;r.length>0;){let a=r.pop();if(n.has(a))continue;n.add(a);let s=e.byId.get(a);if(s){o.push(s);for(let d of s.children)if(ce(d)&&rs.has(d.localName)&&d.namespaceUri===chunkZFBNCHRP_cjs.da){let l=chunkZFBNCHRP_cjs.De(d,"val");l&&r.push(l);}}}if(!e.part||!ce(e.part.root))return o;let i=new Map;return e.part.root.children.forEach((a,s)=>i.set(a,s)),o.sort((a,s)=>(i.get(a)??0)-(i.get(s)??0))}function $d(e,t,n){let r=Co(e,t,Zi)??e.parts.get("/word/numbering.xml")??null;if(!r||!ce(r.root)||n.size===0)return {part:r,nums:[],abstracts:[]};let o=[],i=new Set;for(let s of r.root.children){if(!ce(s)||s.localName!=="num"||s.namespaceUri!==chunkZFBNCHRP_cjs.da)continue;let d=chunkZFBNCHRP_cjs.De(s,"numId");if(!(!d||!n.has(d))){o.push(s);for(let l of s.children)if(ce(l)&&l.localName==="abstractNumId"){let c=chunkZFBNCHRP_cjs.De(l,"val");c&&i.add(c);}}}let a=[];for(let s of r.root.children){if(!ce(s)||s.localName!=="abstractNum"||s.namespaceUri!==chunkZFBNCHRP_cjs.da)continue;let d=chunkZFBNCHRP_cjs.De(s,"abstractNumId");d&&i.has(d)&&a.push(s);}return {part:r,nums:o,abstracts:a}}var Ut={latin:null,eastAsia:null,cs:null};function Bd(e,t){let n=Co(e,t,es);if(!n)return {major:Ut,minor:Ut};let r={major:{...Ut},minor:{...Ut}};return Ye(n.root,o=>{if(o.kind==="textValue"||o.namespaceUri!==qi||o.localName!=="majorFont"&&o.localName!=="minorFont")return;let i=o.localName==="majorFont"?r.major:r.minor;for(let a of o.children){if(!ce(a))continue;let s=chunkZFBNCHRP_cjs.De(a,"typeface");s&&(a.localName==="latin"?i.latin=s:a.localName==="ea"?i.eastAsia=s:a.localName==="cs"&&(i.cs=s));}}),{major:r.major,minor:r.minor}}function os(e,t){let n=t.startsWith("major")?e.major:e.minor;return t.endsWith("EastAsia")?n.eastAsia??n.latin:t.endsWith("Bidi")?n.cs??n.latin:n.latin}var as=[["asciiTheme","ascii"],["hAnsiTheme","hAnsi"],["eastAsiaTheme","eastAsia"],["cstheme","cs"]],Eo=new Set(["themeColor","themeTint","themeShade","themeFill","themeFillTint","themeFillShade"]);function is(e,t){if(e.kind==="textValue")return e;let n=e.attributes;if(e.localName==="rFonts"&&e.namespaceUri===chunkZFBNCHRP_cjs.da){let i=[],a=new Map;for(let s of e.attributes){let d=as.find(([l])=>l===s.localName);if(d&&s.namespaceUri===chunkZFBNCHRP_cjs.da){let l=os(t,s.value);l&&a.set(d[1],l);continue}i.push(s);}for(let[s,d]of a)i.some(l=>l.localName===s)||i.push({kind:"genericExtension",namespaceUri:chunkZFBNCHRP_cjs.da,localName:s,prefix:"w",value:d});n=i;}else e.attributes.some(i=>Eo.has(i.localName)&&i.namespaceUri===chunkZFBNCHRP_cjs.da&&e.attributes.some(a=>a.localName==="val"))&&(n=e.attributes.filter(i=>!(Eo.has(i.localName)&&i.namespaceUri===chunkZFBNCHRP_cjs.da)));let r=e.children.map(i=>is(i,t)),o=r.some((i,a)=>i!==e.children[a]);return n===e.attributes&&!o?e:{...e,attributes:n,children:r}}function Hd(e,t,n){return {id:e,name:e,contentType:t,root:n}}function jd(e,t){if(e.root.kind==="document"){let r=e.root.children.find(i=>i.kind==="body"),o=r&&ce(r)?To(r,t):{id:"fragment#body",kind:"body",namespaceUri:chunkZFBNCHRP_cjs.da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return To(e.root,[o])}let n={id:"fragment#body",kind:"body",namespaceUri:chunkZFBNCHRP_cjs.da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return {id:"fragment#document",kind:"document",namespaceUri:chunkZFBNCHRP_cjs.da,localName:"document",prefix:"w",namespaceBindings:ce(e.root)?e.root.namespaceBindings:[],attributes:[],children:[n]}}function Vd(e){let t=e.map(n=>{let r=n.targetMode==="External"?' TargetMode="External"':"";return `<Relationship Id="${chunkZFBNCHRP_cjs.N(n.id)}" Type="${chunkZFBNCHRP_cjs.N(n.type)}" Target="${chunkZFBNCHRP_cjs.N(n.rawTarget)}"${r}/>`}).join("");return `<Relationships xmlns="${Ji}">${t}</Relationships>`}function Wd(e,t){let n=t;for(;e.has(`rId${n}`);)n+=1;return `rId${n}`}function Kd(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}var Do="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function q(e,t,n,r){return {...e,attributes:e.attributes.map(o=>o.localName===n&&o.namespaceUri===t?{...o,value:r}:o)}}var ss=new Set(["pStyle","rStyle","tblStyle","basedOn","link","next","styleLink","numStyleLink"]),In=chunkZFBNCHRP_cjs.Sf,Oe=new Map;function Je(e,t){let n=t.styleIds??Oe,r=t.numIds??Oe,o=t.relIds??Oe,i=t.footnoteIds??Oe,a=t.endnoteIds??Oe,s=t.bookmarkIds??Oe,d=t.sdtIds??Oe,l=t.revisionIds??Oe,c=t.docPrIds??Oe,m=(u,y)=>{if(u.kind==="textValue")return u;let p=u;if(u.namespaceUri===chunkZFBNCHRP_cjs.da&&ss.has(u.localName)){let f=chunkZFBNCHRP_cjs.De(u,"val"),P=f!==void 0?n.get(f):void 0;P!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"val",P));}if(L(u,"numId")){let f=chunkZFBNCHRP_cjs.De(u,"val"),P=f!==void 0?r.get(f):void 0;P!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"val",P));}if(u.kind==="noteReference"){let f=u.localName==="footnoteReference"?i:a,P=chunkZFBNCHRP_cjs.De(u,"id"),O=P!==void 0?f.get(Pe(P)):void 0;O!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"id",O));}if(u.kind==="bookmarkStart"||u.kind==="bookmarkEnd"){let f=chunkZFBNCHRP_cjs.De(u,"id"),P=f!==void 0?s.get(f):void 0;P!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"id",P));}if(L(u,"id")&&y==="sdtPr"){let f=chunkZFBNCHRP_cjs.De(u,"val"),P=f!==void 0?d.get(f):void 0;P!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"val",P));}if(In(u)){let f=chunkZFBNCHRP_cjs.De(u,"id"),P=f!==void 0?l.get(f):void 0;P!==void 0&&(p=q(p,chunkZFBNCHRP_cjs.da,"id",P));}if(u.kind==="drawingDocPr"){let f=u.attributes.find(O=>O.localName==="id"&&O.namespaceUri==="")?.value,P=f!==void 0?c.get(f):void 0;P!==void 0&&(p=q(p,"","id",P));}for(let f of p.attributes){if(f.namespaceUri!==Do)continue;let P=o.get(f.value);P!==void 0&&P!==f.value&&(p=q(p,Do,f.localName,P));}let h=u.localName,g=p.children.map(f=>m(f,h));return p!==u||g.some((f,P)=>f!==p.children[P])?{...p,children:g}:u};return m(e,"")}function Ao(e,t,n){let r=e,o=n.get(e)??2;for(;t.has(r);)r=`${e}${o}`,o+=1;return n.set(e,o),r}function _o(e,t,n){let r=`${e} (pasted)`,o=n.get(e)??2;for(;t.has(r);)r=`${e} (pasted ${o})`,o+=1;return n.set(e,o),r}var ls=1e5;function Fo(e){let t=chunkZFBNCHRP_cjs.Nb(),n=ds(e,t),r=cs(e,t),o=ms(e,t);return !n||!r||!o?null:{bookmarkIds:n,revisionIds:r,docPrIds:o}}function Rn(e,t,n,r){if(e)return chunkZFBNCHRP_cjs.Pb(t,e,r);let o=n;return ()=>String(o++)}function Uo(e,t){if(e.add(t),!/^\d{1,10}$/.test(t))return;let n=Number(t);n<=chunkZFBNCHRP_cjs.Lb&&e.add(String(n));}function Lo(e,t){if(t===void 0)return e;let n=Number(t);return Number.isInteger(n)&&n>e?n:e}function ds(e,t){let n=new Map;if(e.fragmentBookmarkIds.length===0)return n;let r=0,o=new Set;for(let a of [e.ownerPart,...e.notesParts])ae([a.root],s=>{if(s.kind!=="bookmarkStart"&&s.kind!=="bookmarkEnd")return;let d=chunkZFBNCHRP_cjs.De(s,"id");d!==void 0&&(Uo(o,d),s.kind==="bookmarkStart"&&(r=Lo(r,d)));});let i=Rn(t,o,r+1,chunkZFBNCHRP_cjs.Lb);for(let a of e.fragmentBookmarkIds){if(n.has(a))continue;let s=i();if(s===null)return null;n.set(a,s);}return n}function cs(e,t){let n=new Map;if(!e.hasRevision)return n;let r=0,o=new Set;for(let s of [e.ownerPart,...e.notesParts]){let d=s===e.ownerPart;ae([s.root],l=>{if(!chunkZFBNCHRP_cjs.Sf(l))return;let c=chunkZFBNCHRP_cjs.De(l,"id");c!==void 0&&Uo(o,c),d&&(r=Lo(r,c));});}let i=Rn(t,o,r+1,chunkZFBNCHRP_cjs.Lb),a=false;return ae(e.travelling,s=>{if(a||!chunkZFBNCHRP_cjs.Sf(s))return;let d=chunkZFBNCHRP_cjs.De(s,"id");if(d===void 0||n.has(d))return;let l=i();l===null?a=true:n.set(d,l);}),a?null:n}function ms(e,t){let n=new Map;if(!e.hasDocPr)return n;let{used:r}=chunkZFBNCHRP_cjs.Rb(e.pkg),o=ls;if(!t){let s=chunkZFBNCHRP_cjs.Sb(e.pkg);s.ok&&(o=s.id);}let i=Rn(t,r,o,chunkZFBNCHRP_cjs.Qb),a=false;return ae(e.travelling,s=>{if(a||s.kind==="textValue"||s.kind!=="drawingDocPr")return;let d=s.attributes.find(c=>c.localName==="id"&&c.namespaceUri==="")?.value;if(d===void 0||n.has(d))return;let l=i();l===null?a=true:n.set(d,l);}),a?null:n}var Ue="http://schemas.openxmlformats.org/officeDocument/2006/relationships",us=`${Ue}/hyperlink`,$o=`${Ue}/image`,Lt=`${Ue}/numbering`,vn=`${Ue}/styles`,Bo="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Ho="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function gt(e,t,n,r){for(let o of chunkZFBNCHRP_cjs.gc(e,t)){if(o.type!==n||o.targetMode==="External")continue;let i=chunkZFBNCHRP_cjs.w(o.ownerPart,o.rawTarget);if(i.ok){let a=e.parts.get(i.partName);if(a)return a}}return e.parts.get(r)??null}function bn(e,t){let n=0;return ae([e],r=>{let o=t(r);if(o===void 0)return;let i=Number(o);Number.isInteger(i)&&i>n&&(n=i);}),n}function $t(e,t,n,r){if(n.length===0)return e;let o=chunkZFBNCHRP_cjs.Ea(t,"paste"),i=n.map(l=>chunkZFBNCHRP_cjs.He(l,o)),a=chunkZFBNCHRP_cjs.Uh(t,i),s=r??a.root.children.length,d=chunkZFBNCHRP_cjs.Ka(a,a.root.id,s,i,{deferValidation:true});return d.ok?chunkZFBNCHRP_cjs.ec(e,d.part):null}function jo(e){let t=new Set;return ae(e,n=>{if(n.kind!=="textValue")for(let r of n.attributes)r.namespaceUri===Ue&&r.value.length>0&&t.add(r.value);}),t}function Vo(e,t){if(t.size===0)return [...e];let n=o=>{if(o.kind==="textValue")return o;if(o.kind==="drawing"||L(o,"pict")){let a=false;return ae([o],s=>{if(s.kind!=="textValue")for(let d of s.attributes)d.namespaceUri===Ue&&t.has(d.value)&&(a=true);}),a?null:o}if(o.kind==="hyperlink"){let a=o.attributes.find(s=>s.namespaceUri===Ue)?.value;if(a!==void 0&&t.has(a))return r(o.children)}let i=r(o.children);return i.length===o.children.length&&i.every((a,s)=>a===o.children[s])?o:{...o,children:i}};function r(o){let i=[];for(let a of o){let s=n(a);s!==null&&(Array.isArray(s)?i.push(...s):i.push(s));}return i}return r(e)}var ps=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),Wo={"image/jpg":"image/jpeg","image/x-ms-bmp":"image/bmp","image/x-bmp":"image/bmp"};function fs(e,t){let n=chunkZFBNCHRP_cjs.tb(e);return n==="unknown"||(Object.hasOwn(Wo,t)?Wo[t]:t)!==n||ps.has(n)&&!chunkZFBNCHRP_cjs.Tb(e,n)?null:n}function Ko(e,t,n){let r=t.parts.get(t.mainDocumentPart);if(!r)return {ok:false,reason:"no-fragment-document"};if(!e.parts.has(n))return {ok:false,reason:"no-target-part"};let o=r.root.kind==="document"?r.root.children.find(x=>x.kind==="body"):null;if(!o||!Y(o))return {ok:false,reason:"no-fragment-document"};let i=Pn(o.children.filter(x=>x.kind==="paragraph"||x.kind==="table"||x.kind==="contentControl"));if(i.length===0)return {ok:false,reason:"no-fragment-document"};let a=e,s=gt(t,t.mainDocumentPart,Lt,"/word/numbering.xml"),d=new Map,l=[],c=[];if(s&&Y(s.root)){let x=new Map,R=[];for(let M of s.root.children)if(Y(M))if(L(M,"abstractNum")){let j=chunkZFBNCHRP_cjs.De(M,"abstractNumId");j&&x.set(j,M);}else L(M,"num")&&R.push(M);let I=gt(a,a.mainDocumentPart,Lt,"/word/numbering.xml"),w=new Map,C=new Map;if(I&&Y(I.root)){for(let M of I.root.children)if(Y(M)&&L(M,"abstractNum")){let j=chunkZFBNCHRP_cjs.De(M,"abstractNumId");j&&C.set(j,M);}for(let M of I.root.children){if(!Y(M)||!L(M,"num"))continue;let j=chunkZFBNCHRP_cjs.De(M,"numId");if(!j)continue;let ie=M.children.find(B=>L(B,"abstractNumId")),X=ie?chunkZFBNCHRP_cjs.De(ie,"val"):void 0,he=X?C.get(X):void 0;w.set(`${he?ft(he):"none"}::${M.children.filter(B=>L(B,"lvlOverride")).map(xe).join("")}`,j);}}let F=(I?bn(I.root,M=>M.kind!=="textValue"&&L(M,"abstractNum")?chunkZFBNCHRP_cjs.De(M,"abstractNumId"):void 0):0)+1,V=(I?bn(I.root,M=>M.kind!=="textValue"&&L(M,"num")?chunkZFBNCHRP_cjs.De(M,"numId"):void 0):0)+1,re=new Map;for(let M of R){let j=chunkZFBNCHRP_cjs.De(M,"numId");if(!j)continue;let ie=M.children.find(be=>L(be,"abstractNumId")),X=ie?chunkZFBNCHRP_cjs.De(ie,"val"):void 0,he=X?x.get(X):void 0,B=`${he?ft(he):"none"}::${M.children.filter(be=>L(be,"lvlOverride")).map(xe).join("")}`,z=w.get(B);if(z!==void 0){d.set(j,z);continue}let Z=X?re.get(X):void 0;Z===void 0&&he&&X&&(Z=String(F++),re.set(X,Z),c.push(q(he,chunkZFBNCHRP_cjs.da,"abstractNumId",Z)));let je=String(V++);d.set(j,je);let Ee=q(M,chunkZFBNCHRP_cjs.da,"numId",je);if(Z!==void 0){let be=Ee.children.map(Ve=>L(Ve,"abstractNumId")?q(Ve,chunkZFBNCHRP_cjs.da,"val",Z):Ve);Ee={...Ee,children:be};}l.push(Ee),w.set(B,je);}}let m=Ft(gt(t,t.mainDocumentPart,vn,"/word/styles.xml")),u=gt(a,a.mainDocumentPart,vn,"/word/styles.xml"),y=Ft(u),p=new Map,h=[],g=new Set(y.byId.keys()),k=new Set(y.names),f=new Map,P=new Map,O=new Map,b=(x,R)=>{let I=O.get(x);return I===void 0&&(I=ft(R),O.set(x,I)),I},N=x=>({...x,attributes:x.attributes.filter(R=>!(R.localName==="default"&&R.namespaceUri===chunkZFBNCHRP_cjs.da))});for(let x of m.styles){let R=chunkZFBNCHRP_cjs.De(x,"styleId");if(!R)continue;let I=y.byId.get(R),w=ft(Je(x,{styleIds:p,numIds:d}));if(I&&b(R,I)===w){p.set(R,R);continue}if(!I){p.set(R,R),g.add(R),h.push(N(x));continue}let C=Ao(`${R}Pasted`,g,f);g.add(C),p.set(R,C),h.push(N(q(x,chunkZFBNCHRP_cjs.da,"styleId",C)));}let T=h.map(x=>{let R=x.children.find(F=>L(F,"name")),I=R?chunkZFBNCHRP_cjs.De(R,"val"):void 0;if(!I||!k.has(I))return I&&k.add(I),x;let w=_o(I,k,P);k.add(w);let C=x.children.map(F=>L(F,"name")?q(F,chunkZFBNCHRP_cjs.da,"val",w):F);return {...x,children:C}}),A=null,G=1,H=()=>{if(A)return A;let x=new Map;for(let[R,I]of a.partBytes){let w=R.startsWith("/")?R:`/${R}`;if(!w.startsWith("/word/media/"))continue;x.set(chunkZFBNCHRP_cjs.a(I),w);let C=/\/image(\d+)\./.exec(w);C&&(G=Math.max(G,Number(C[1])+1));}return A=x,x},Q=new Map,me=x=>{let R=Q.get(x);if(!R){R=new Map;for(let I of chunkZFBNCHRP_cjs.gc(a,x)){if(I.targetMode==="External"||I.type!==$o)continue;let w=chunkZFBNCHRP_cjs.w(I.ownerPart,I.rawTarget);w.ok&&R.set(w.partName,I.id);}Q.set(x,R);}return R},te=(x,R)=>{let I=x.lastIndexOf("."),w=I===-1?"":x.slice(I+1);return /^[A-Za-z0-9]{1,8}$/.test(w)?w.toLowerCase():R==="image/jpeg"?"jpeg":R==="image/gif"?"gif":"png"},we=(x,R,I)=>{let w=new Map,C=new Set,F=me(R),V=[],re=new Set,M=[],j=[],ie=new Map,X=[],he=t.relationships.get(x)??[];for(let B of he){if(!I.has(B.id))continue;if(B.targetMode==="External"){if(B.type===us){let We=chunkZFBNCHRP_cjs.of(a,B.rawTarget,R);We?(a=We.pkg,w.set(B.id,We.relationshipId)):C.add(B.id);}else C.add(B.id);continue}let z=chunkZFBNCHRP_cjs.w(B.ownerPart,B.rawTarget);if(!z.ok){C.add(B.id);continue}let Z=t.partBytes.get(z.partName)??t.partBytes.get(z.partName.replace(/^\//,"")),je=(chunkZFBNCHRP_cjs.hc(t,z.partName)??"").toLowerCase();if(!Z||!je.startsWith("image/")){C.add(B.id);continue}let Ee=fs(Z,je);if(Ee===null){C.add(B.id);continue}let be=Ee,Ve=H(),ar=chunkZFBNCHRP_cjs.a(Z),oe=Ve.get(ar);if(!oe){let We=te(z.partName,be),Fi=Rt=>a.partBytes.has(Rt)||a.partBytes.has(Rt.slice(1))||a.parts.has(Rt)||re.has(Rt),Jt=`/word/media/image${G}.${We}`;for(;Fi(Jt);)G+=1,Jt=`/word/media/image${G}.${We}`;G+=1,oe=Jt,V.push({partName:oe,bytes:Z,contentType:be}),re.add(oe),Ve.set(ar,oe);}let _i=oe.startsWith("/word/")?oe.slice(6):oe,ir=F.get(oe);if(ir!==void 0){w.set(B.id,ir);continue}let It=ie.get(oe);It===void 0&&(It=M.length,ie.set(oe,It),M.push(_i),j.push(oe)),X.push({recordId:B.id,index:It});}if(V.length>0&&(a=chunkZFBNCHRP_cjs.Xb(a,V)),M.length>0){let B=chunkZFBNCHRP_cjs.kc(chunkZFBNCHRP_cjs.lc(a,R),R,M.map(z=>[$o,z]));if(B.ok){a=B.pkg,B.ids.forEach((z,Z)=>{F.set(j[Z],z);});for(let z of X)w.set(z.recordId,B.ids[z.index]);}else for(let z of X)C.add(z.recordId);}return {relIdMap:w,dropRelIds:C}},Pt=we(t.mainDocumentPart,n,jo(i));i=Vo(i,Pt.dropRelIds);let E=new Map,D=new Map,_=[],W=(x,R)=>Y(x)&&x.namespaceUri===chunkZFBNCHRP_cjs.da&&x.localName===R,ue={},He=Mo(i,(x,R)=>{let I=ue[x];if(I===void 0){I=new Map,ue[x]=I;let w=chunkZFBNCHRP_cjs.Jf(t,x);if(w&&Y(w.root))for(let C of w.root.children){if(!W(C,x))continue;let F=chunkZFBNCHRP_cjs.De(C,"id");if(F===void 0)continue;let V=Pe(F);I.has(V)||I.set(V,C);}}return I.get(R)??null});for(let x of ["footnote","endnote"]){let R=x==="footnote"?E:D,I=He[x];if(I.size===0)continue;let w=chunkZFBNCHRP_cjs.Jf(t,x);if(!w||!Y(w.root))continue;let C=chunkZFBNCHRP_cjs.bg(a,x);if(!C.ok||!C.package)return {ok:false,reason:"merge-refused"};a=C.package;let F=chunkZFBNCHRP_cjs.Jf(a,x);if(!F)return {ok:false,reason:"merge-refused"};let V=bn(F.root,M=>W(M,x)?chunkZFBNCHRP_cjs.De(M,"id"):void 0)+1,re=[];for(let M of w.root.children){if(!W(M,x))continue;let j=chunkZFBNCHRP_cjs.De(M,"id"),ie=chunkZFBNCHRP_cjs.De(M,"type");if(ie==="separator"||ie==="continuationSeparator"||j===void 0||!I.has(Pe(j))||R.has(Pe(j)))continue;let X=String(V++);R.set(Pe(j),X),re.push(q(M,chunkZFBNCHRP_cjs.da,"id",X));}re.length>0&&_.push({kind:x,fragmentPartName:w.name,bodies:Pn(re)});}let ve=a.parts.get(n),Te=[...i,..._.flatMap(x=>x.bodies)],ot=[],U=new Set,Yt=false,ne=false,at=new Map;ae(Te,x=>{if(x.kind!=="textValue"){if(x.kind==="bookmarkStart"||x.kind==="bookmarkEnd"){let R=chunkZFBNCHRP_cjs.De(x,"id");if(R!==void 0&&ot.push(R),x.kind==="bookmarkStart"){let I=chunkZFBNCHRP_cjs.De(x,"name");I&&U.add(I);}return}if(In(x)){Yt=true;return}if(x.kind==="drawingDocPr"){ne=true;return}if(x.kind==="contentControlProperties")for(let R of x.children){if(!L(R,"id"))continue;let I=chunkZFBNCHRP_cjs.De(R,"val");if(I!==void 0&&!at.has(I)){let w=0,C=`${I}:${at.size}`;for(let F=0;F<C.length;F+=1)w=w*31+C.charCodeAt(F)>>>0;at.set(I,String(w%2147483647||1));}}}});let Ot=Fo({pkg:a,ownerPart:ve,notesParts:_.map(x=>chunkZFBNCHRP_cjs.Jf(a,x.kind)).filter(x=>x!==null),travelling:Te,fragmentBookmarkIds:ot,hasRevision:Yt,hasDocPr:ne});if(!Ot)return {ok:false,reason:"merge-refused"};let tr=Ot.bookmarkIds,nr=Ot.revisionIds,rr=Ot.docPrIds;if(U.size>0){let x=new Set;if(ae([ve.root],R=>{if(R.kind!=="textValue"&&R.kind==="bookmarkStart"){let I=chunkZFBNCHRP_cjs.De(R,"name"),w=chunkZFBNCHRP_cjs.De(R,"id");I&&w!==void 0&&U.has(I)&&x.add(w);}}),x.size>0){let R=w=>{if(w.kind==="textValue")return w;let C=[],F=false;for(let V of w.children){if((V.kind==="bookmarkStart"||V.kind==="bookmarkEnd")&&x.has(chunkZFBNCHRP_cjs.De(V,"id")??"")){F=true;continue}let re=R(V);re!==V&&(F=true),C.push(re);}return F?{...w,children:C}:w},I=R(ve.root);I!==ve.root&&(chunkZFBNCHRP_cjs.Ia(ve.root,I),a=chunkZFBNCHRP_cjs.ec(a,{...ve,root:I}));}}let or=x=>On(x,E,D);for(let x of _){x.bodies=x.bodies.map(or);let R=chunkZFBNCHRP_cjs.Jf(a,x.kind);if(!R)return {ok:false,reason:"merge-refused"};let I=we(x.fragmentPartName,R.name,jo(x.bodies)),w=Vo(x.bodies,I.dropRelIds);w=[...kn(w,m,y)],w=w.map(F=>Je(F,{styleIds:p,numIds:d,relIds:I.relIdMap,footnoteIds:E,endnoteIds:D,bookmarkIds:tr,sdtIds:at,revisionIds:nr,docPrIds:rr}));let C=$t(a,a.parts.get(R.name),w);if(!C)return {ok:false,reason:"merge-refused"};a=C;}if(T.length>0){let x=T.map(I=>Je(I,{styleIds:p,numIds:d}));if(!u){let I=chunkZFBNCHRP_cjs.xa(`<w:styles xmlns:w="${chunkZFBNCHRP_cjs.da}"></w:styles>`,{name:"/word/styles.xml",contentType:Ho});if(!I.ok)return {ok:false,reason:"merge-refused"};a=chunkZFBNCHRP_cjs.nc(a,"/word/styles.xml",I.part.root,Ho);let w=chunkZFBNCHRP_cjs.mc(chunkZFBNCHRP_cjs.lc(a,a.mainDocumentPart),a.mainDocumentPart,vn,"styles.xml");if(!w.ok)return {ok:false,reason:"merge-refused"};a=w.pkg,u=a.parts.get("/word/styles.xml")??null;}if(!u)return {ok:false,reason:"merge-refused"};let R=$t(a,a.parts.get(u.name),x);if(!R)return {ok:false,reason:"merge-refused"};a=R,y=Ft(a.parts.get(u.name)??null);}if(c.length>0||l.length>0){let x=gt(a,a.mainDocumentPart,Lt,"/word/numbering.xml");if(!x){let F=chunkZFBNCHRP_cjs.xa(`<w:numbering xmlns:w="${chunkZFBNCHRP_cjs.da}"></w:numbering>`,{name:"/word/numbering.xml",contentType:Bo});if(!F.ok)return {ok:false,reason:"merge-refused"};a=chunkZFBNCHRP_cjs.nc(a,"/word/numbering.xml",F.part.root,Bo);let V=chunkZFBNCHRP_cjs.mc(chunkZFBNCHRP_cjs.lc(a,a.mainDocumentPart),a.mainDocumentPart,Lt,"numbering.xml");if(!V.ok)return {ok:false,reason:"merge-refused"};a=V.pkg,x=a.parts.get("/word/numbering.xml")??null;}if(!x)return {ok:false,reason:"merge-refused"};let R=a.parts.get(x.name),I=R.root.children.findIndex(F=>L(F,"num")),w=c.map(F=>Je(F,{styleIds:p,numIds:d})),C=$t(a,R,w,I===-1?void 0:I);if(!C)return {ok:false,reason:"merge-refused"};if(a=C,C=$t(a,a.parts.get(x.name),l),!C)return {ok:false,reason:"merge-refused"};a=C;}let Ai=[...kn(i,m,y)].map(or).map(x=>Je(x,{styleIds:p,numIds:d,relIds:Pt.relIdMap,footnoteIds:E,endnoteIds:D,bookmarkIds:tr,sdtIds:at,revisionIds:nr,docPrIds:rr}));return {ok:true,pkg:a,blocks:Ai}}var gs=16*1024*1024;function hs(e){let t=e.parts.get(e.mainDocumentPart);if(!t||t.root.kind!=="document")return false;let n=t.root.children.find(i=>i.kind==="body");if(!n||n.kind!=="body"||n.children.length>chunkZFBNCHRP_cjs.Rh)return false;let r=0,o=(i,a,s)=>{if(a>s||(r+=1,r>chunkZFBNCHRP_cjs.Th))return false;if(i.kind==="textValue")return true;for(let d of i.children)if(!o(d,a+1,s))return false;return true};for(let i of n.children)if(!o(i,1,chunkZFBNCHRP_cjs.Sh))return false;for(let[i,a]of e.parts)if(i!==e.mainDocumentPart&&/\/(styles|numbering|footnotes|endnotes)\.xml$/.test(i)&&!o(a.root,1,chunkZFBNCHRP_cjs.Sh*4))return false;return true}function zo(e,t,n){if(n.fragmentBytes.byteLength>gs)return {ok:false,reason:"invalidArgs",detail:"fragment-too-large"};let r=chunkZFBNCHRP_cjs.cc(n.fragmentBytes);if(!r.ok)return {ok:false,reason:"invalidArgs",detail:`fragment-read:${r.reason}`};let o=r.package;if(!hs(o))return {ok:false,reason:"invalidArgs",detail:"fragment-over-budget"};let i=e.resolveStory(t);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let{store:a,story:s}=i;if(a.compositionActive||e.compositionSessionOpen())return {ok:false,reason:"invalidArgs",detail:"ime-composition-active"};let d=e.currentPackage(),l=a.checkpoint(),c=a.historyDepth,m=0,u="";return chunkZFBNCHRP_cjs.Ba(e,()=>{let y=a.transact(h=>{for(let P of n.priorOps??[])if(!h.apply(P))return;let g=null,k=h.applyPackage(P=>(g=Ko(P,o,s.partName),g.ok?g.pkg:P)),f=g;if(!f||!f.ok){u=`fragment-merge:${f?f.reason:"no-merge"}`,h.apply({op:"insertText",paragraphId:"\0fragment-abort",offset:0,text:"x"});return}k&&(m=f.blocks.length,h.apply({op:"insertFragment",paragraphId:n.paragraphId,offset:n.offset,blocks:f.blocks,lastMarkCovered:n.lastMarkCovered}));},{story:s,...n.actorId?{actorId:n.actorId}:{}});return u.length>0?{ok:false,reason:"invalidArgs",detail:u}:y.ok?y.change?{ok:true,change:e.promoteStoryTransactionToPackageUnit(d,a,l,c),blockCount:m}:{ok:true,change:null,blockCount:m}:{ok:false,reason:y.reason,...y.detail?{detail:y.detail}:{}}},y=>chunkZFBNCHRP_cjs.Ca(y))}var ys=new Set(["insertText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertDrawing","deleteText"]),Go=new Set(["insertDrawing"]);function ks(e){if(!(e===null||e.start!==e.end))return e}var qe={"text-local":0,"paragraph-local":1,"flow-structural":2,global:3};function xs(e){return Object.freeze({parts:new Map([[e.name,e]]),partBytes:new Map,relationships:new Map,externalTargets:[],contentTypes:{defaults:new Map,overrides:new Map([[e.name.toLowerCase(),e.contentType]])},mainDocumentPart:e.name})}var Qe=class{current;storyPartName;rev=0;commitCounter=0;undoStack=[];redoStack=[];subscribers=new Set;historyLimit;settingsPartOverride;storyRef=null;composition=null;constructor(t,n,r={}){let o="root"in t,i=typeof n=="string"?n:void 0,a=typeof n=="object"&&n!==null?n:r;this.current=o?xs(t):t,this.storyPartName=i??(o?t.name:t.mainDocumentPart),this.historyLimit=a.historyLimit??200,this.settingsPartOverride=a.settingsPart;}setStoryRef(t){this.storyRef=t;}get part(){let t=this.current.parts.get(this.storyPartName);if(!t)throw new Error(`story part missing: ${this.storyPartName}`);return t}get package(){return this.current}get revision(){return this.rev}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}get historyDepth(){return this.undoStack.length}get compositionActive(){return this.composition!==null}graftPackage(t){this.current=t(this.current);}replacePart(t){let n=this.current.parts.get(t.name);t!==n&&(this.current=chunkZFBNCHRP_cjs.ec(this.current,t),this.rev+=1);}checkpoint(){return {pkg:this.current,revision:this.rev,undoStack:this.undoStack.slice(),redoStack:this.redoStack.slice(),composition:this.composition?{entry:{...this.composition.entry},committed:this.composition.committed}:null}}restoreCheckpoint(t){this.current=t.pkg,this.rev=t.revision,this.undoStack.length=0,this.undoStack.push(...t.undoStack),this.redoStack.length=0,this.redoStack.push(...t.redoStack),this.composition=t.composition?{entry:{...t.composition.entry},committed:t.composition.committed}:null;}restoreHistoryStacks(t){this.undoStack.length=0,this.undoStack.push(...t.undoStack),this.redoStack.length=0,this.redoStack.push(...t.redoStack);}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}transact(t,n={}){return chunkZFBNCHRP_cjs.Mb(n.actorId,()=>this.commitTransaction(t,n))}commitTransaction(t,n){let r=n.origin??chunkZFBNCHRP_cjs.b.mutationHuman,o=this.current,i=this.rev,a=this.current,s=null,d=0,l=new Set,c=new Set,m=new Set,u=new Set,y=new Set,p=[],h=n.minimumImpact??"text-local",g=null,k=false,f=null,P=null,O=new Map,b=new Map,N=E=>{let D=b.get(E.name);D||(D={mint:null,written:new Set},b.set(E.name,D));let _=D;return {mint:()=>(_.mint??=chunkZFBNCHRP_cjs.Rf(E))(),wrote:W=>{_.written.add(W);},wroteUnder:W=>_.written.has(W)}},T=()=>{for(let E of b.values())E.mint=null;},A=(E,D)=>{let _=chunkZFBNCHRP_cjs.jh.get(E.op);if(_===void 0)return O.clear(),null;let W=`${D.name}\0${_}`,ue=O.get(W);ue||(ue={id:null},O.set(W,ue));let He=ue;return ()=>He.id??=N(D).mint()},G=(E,D)=>{let _=ys.has(E.op);return !_&&chunkZFBNCHRP_cjs.jh.get(E.op)!==void 0?null:((!_||Go.has(E.op))&&T(),_?N(D):null)},H=null,Q=(E,D)=>{if(s)return false;let _=a.parts.get(E);if(!_)return s={reason:"unknown-part",detail:E},false;let W=chunkZFBNCHRP_cjs.ph(_,this.settingsPartOverride?.()??chunkZFBNCHRP_cjs.yf(a),D,H?.partName===E&&"paragraphId"in D&&H.paragraphId===D.paragraphId?H.fieldNodeId:void 0);if(W)return s={reason:W},false;let ue=A(D,_),He=G(D,_),ve=this.settingsPartOverride?.()??chunkZFBNCHRP_cjs.yf(a),Te=chunkZFBNCHRP_cjs.gh(ve)&&"paragraphId"in D&&chunkZFBNCHRP_cjs.ih(_,D.paragraphId)?chunkZFBNCHRP_cjs.ah(_,D,H?.partName===E&&H.paragraphId===D.paragraphId?H.fieldNodeId:void 0):null;H=Te&&"paragraphId"in D?{partName:E,paragraphId:D.paragraphId,fieldNodeId:Te.fieldNodeId}:null;let ot={deferValidation:true,...ue?{revisionIds:ue}:{},...He?{trackedRevisionIds:He}:{}},U=Te?chunkZFBNCHRP_cjs.fh(_,D,Te,ot):chunkZFBNCHRP_cjs.Ph(_,D,ot);if(!U.ok)return s={reason:U.reason,...U.detail?{detail:U.detail}:{}},false;if(Go.has(D.op)&&T(),a=chunkZFBNCHRP_cjs.ec(a,U.part),U.part===_&&U.effect.dirty.length===0&&U.effect.created.length===0&&U.effect.deleted.length===0&&U.effect.split===void 0&&(U.effect.splits===void 0||U.effect.splits.length===0)&&U.effect.join===void 0&&U.effect.caret===void 0)return true;l.add(E),d+=1;for(let ne of U.effect.dirty)c.add(ne);for(let ne of U.effect.created)m.add(ne);for(let ne of U.effect.deleted)u.add(ne);for(let ne of U.effect.dependencyKeys)y.add(ne);U.effect.split&&p.push({split:U.effect.split});for(let ne of U.effect.splits??[])p.push({split:ne});return U.effect.join&&p.push({join:U.effect.join}),qe[U.effect.impact]>qe[h]&&(h=U.effect.impact),U.effect.caret&&(P={paragraphId:U.effect.caret.paragraphId,start:0,end:0}),true};if(t({apply:E=>Q(this.storyPartName,E),applyTo:(E,D)=>Q(E,D),applyPackage:E=>{if(s)return false;O.clear(),T();let D=E(a);if(D===a)return true;for(let[_,W]of D.parts)a.parts.get(_)!==W&&l.add(_);return a=D,d+=1,qe["flow-structural"]>qe[h]&&(h="flow-structural"),true},selectionBefore:E=>{g=E;},selectionAfter:E=>{k=true,f=E;}}),s){let E=s;return {ok:false,reason:E.reason,...E.detail?{detail:E.detail}:{}}}if(d===0)return {ok:true,change:null};let me=k?f:P,te=k?ks(f):P??void 0;for(let E of l){let D=o.parts.get(E),_=a.parts.get(E);if(_===void 0)continue;let W=D?chunkZFBNCHRP_cjs.va(D,_):chunkZFBNCHRP_cjs.va(_,_);if(!W.ok)return {ok:false,reason:"tree-invariant",detail:JSON.stringify(W.issues)}}let we=chunkZFBNCHRP_cjs.oc(a);return we.ok?((n.recordsHistory??(r!==chunkZFBNCHRP_cjs.b.projection&&r!==chunkZFBNCHRP_cjs.b.awareness))&&(this.composition?(this.composition.committed=true,this.composition={...this.composition,entry:{...this.composition.entry,selectionAfter:me}}):(this.pushUndo({pkg:o,revision:i,selectionBefore:g,selectionAfter:me}),this.redoStack.length=0)),this.current=a,this.rev+=1,n.story&&(this.storyRef=n.story),n.minimumImpact&&qe[n.minimumImpact]>qe[h]&&(h=n.minimumImpact),{ok:true,change:this.publish(r,i,{dirty:c,created:m,deleted:u,dependencyKeys:y,splitJoin:p,impact:h,caret:te},n.story??this.storyRef??void 0,n.actorId,n.operationId)}):{ok:false,reason:"package-invariant",detail:JSON.stringify(we.issues)}}beginComposition(t=null){this.composition||(this.composition={entry:{pkg:this.current,revision:this.rev,selectionBefore:t,selectionAfter:null},committed:false});}endComposition(){let t=this.composition;this.composition=null,!(!t||!t.committed)&&(this.pushUndo(t.entry),this.redoStack.length=0);}cancelComposition(){this.composition=null;}undo(){let t=this.undoStack.pop();if(!t)return null;let n=this.rev;return this.redoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=t.pkg,this.rev+=1,this.publish(chunkZFBNCHRP_cjs.b.mutationUndo,n,null,this.storyRef??void 0)}redo(){let t=this.redoStack.pop();if(!t)return null;let n=this.rev;return this.undoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=t.pkg,this.rev+=1,this.publish(chunkZFBNCHRP_cjs.b.mutationRedo,n,null,this.storyRef??void 0)}selectionForUndo(){return this.undoStack[this.undoStack.length-1]?.selectionBefore??null}selectionForRedo(){return this.redoStack[this.redoStack.length-1]?.selectionAfter??null}pushUndo(t){this.undoStack.push(t),this.undoStack.length>this.historyLimit&&this.undoStack.shift();}publish(t,n,r,o,i,a){this.commitCounter+=1;let s={change:"model-change",fromRevision:n,toRevision:this.rev,commitId:`commit-${this.commitCounter}`,origin:t,...i?{actorId:i}:{},...a?{operationId:a}:{},dirty:r?[...r.dirty]:[],created:r?[...r.created]:[],deleted:r?[...r.deleted]:[],splitJoin:r?r.splitJoin:[],dependencyKeys:r?[...r.dependencyKeys]:[],impact:r?r.impact:o?.kind==="headerFooter"?"global":"flow-structural",...r?.caret?{caret:r.caret}:{},...o?{story:o}:{}};for(let d of this.subscribers)d(s);return s}};function Nn(e,t){return [...e.values()].map(n=>n.part).filter(n=>t.parts.has(n.name))}function Xo(e,t){return Nn(e,t).map(n=>n.name).sort().join(",")}function Yo(e,t,n){if(e.relationships!==t.relationships||e.contentTypes!==t.contentTypes||e.partBytes!==t.partBytes||e.externalTargets!==t.externalTargets||e.mainDocumentPart!==t.mainDocumentPart)return true;if(e.parts===t.parts)return false;if(e.parts.size!==t.parts.size)return true;for(let[r,o]of t.parts)if(r!==n&&e.parts.get(r)!==o)return true;return false}var Ht="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Ps="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function Ze(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===Ht&&n.localName===t)return n;return null}function Bt(e,t){return e.attributes.find(n=>n.namespaceUri===Ht&&n.localName===t)?.value}function Os(e){let t=Bt(e,"val");return t===void 0||t==="1"||t==="true"||t==="on"}function qo(e,t){return e.kind==="textValue"?Object.freeze({...e,id:t()}):Object.freeze({...e,id:t(),children:e.children.map(n=>qo(n,t))})}function Is(e){let t=chunkZFBNCHRP_cjs.xa(`<w:styles xmlns:w="${Ht}"><w:style w:type="paragraph" w:styleId="ListParagraph"><w:pPr><w:contextualSpacing/></w:pPr></w:style></w:styles>`,{name:e.name,contentType:Ps});if(!t.ok)return null;let n=Ze(t.part.root,"style"),r=n?Ze(n,"pPr"):null;return r?qo(r,chunkZFBNCHRP_cjs.Ea(e)):null}var Jo=["pStyle","keepNext","keepLines","pageBreakBefore","framePr","widowControl","numPr","suppressLineNumbers","pBdr","shd","tabs","suppressAutoHyphens","kinsoku","wordWrap","overflowPunct","topLinePunct","autoSpaceDE","autoSpaceDN","bidi","adjustRightInd","snapToGrid","spacing","ind","contextualSpacing","mirrorIndents","suppressOverlap","jc","textDirection","textAlignment","textboxTightWrap","outlineLvl","divId","cnfStyle","rPr","sectPr","pPrChange"];function Rs(e,t){let n=Jo.indexOf(t),r=0;return e.forEach((o,i)=>{if(o.kind==="textValue")return;let a=Jo.indexOf(o.localName);a!==-1&&a<=n&&(r=i+1);}),r}function Qo(e,t){let n=chunkZFBNCHRP_cjs.gf(e);if(!n)return null;let r=null;for(let l of n.root.children)if(l.kind!=="textValue"&&l.namespaceUri===Ht&&l.localName==="style"&&Bt(l,"type")==="paragraph"&&Bt(l,"styleId")===t){r=l;break}if(!r)return null;let o=Ze(r,"name");if(o&&Bt(o,"val")?.trim().toLowerCase()!=="list paragraph"&&t!=="ListParagraph")return null;let i=Is(n);if(!i)return null;let a=Ze(i,"contextualSpacing");if(!a)return null;let s=Ze(r,"pPr"),d;if(s){let l=Ze(s,"contextualSpacing");if(l&&Os(l))return e;d=l?chunkZFBNCHRP_cjs.La(n,l.id,a):chunkZFBNCHRP_cjs.Ka(n,s.id,Rs(s.children,"contextualSpacing"),[a]);}else {let l=r.children.findIndex(c=>c.kind!=="textValue"&&["rPr","tblPr","tcPr","tblStylePr"].includes(c.localName));d=chunkZFBNCHRP_cjs.Ka(n,r.id,l===-1?r.children.length:l,[i]);}return d.ok?Object.freeze({...e,parts:new Map([...e.parts,[n.name,d.part]])}):null}var na="http://schemas.openxmlformats.org/package/2006/relationships",ra="application/vnd.openxmlformats-package.relationships+xml",Ns="http://schemas.openxmlformats.org/package/2006/content-types",Zo="/[Content_Types].xml",et="/word/numbering.xml",ea="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",ht="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Ss=`<Override PartName="${et}" ContentType="${ht}"/>`;function jt(e){return `${e.ownerPart}\0${e.id}`}function oa(e,t,n){let r=new Set(t.externalTargets.filter(s=>s.type===chunkZFBNCHRP_cjs.Xa).map(jt)),o=n.externalTargets.filter(s=>s.type===chunkZFBNCHRP_cjs.Xa&&!r.has(jt(s)));if(o.length===0)return e;let i=new Set(e.map(jt)),a=o.filter(s=>!i.has(jt(s)));return a.length===0?e:Object.freeze([...e,...a])}function aa(e,t,n){let r=e.filter(o=>o.ownerPart===n||t.has(o.ownerPart));return r.length===e.length?e:Object.freeze(r)}function ia(e,t,n=[]){if(e===t)return e;let r=ws(e,t);return r=Ts(r,t,n),r}function sa(e,t){let n=new Set;for(let o of e.externalTargets)o.type===chunkZFBNCHRP_cjs.Xa&&o.ownerPart!==e.mainDocumentPart&&(e.parts.has(o.ownerPart)||t.has(o.ownerPart)||n.add(o.ownerPart));for(let o of e.parts.keys()){let i=Ds(o);!i||i===e.mainDocumentPart||e.parts.has(i)||t.has(i)||e.externalTargets.some(a=>a.ownerPart===i)||n.add(i);}if(n.size===0)return e;let r=e;for(let o of n)r=As(r,o);return r}function ws(e,t){let n=t.parts.get(et);if(!n)return e;let r=chunkZFBNCHRP_cjs.ec(e,n),o=(t.relationships.get(t.mainDocumentPart)??[]).find(a=>a.type===ea),i=r.relationships.get(r.mainDocumentPart)??[];if(o&&!i.some(a=>a.type===ea)&&!i.some(a=>a.id===o.id)){let a=Ms(r,{...o,ownerPart:r.mainDocumentPart});a&&(r=a);}if(r.contentTypes.overrides.get(chunkZFBNCHRP_cjs.u(et))!==ht){let a=_s(r);a&&(r=a);}return r}function Ts(e,t,n){let r=n.filter(i=>i.type===chunkZFBNCHRP_cjs.Xa);if(r.length===0)return e;let o=e;for(let i of r){let a=Es(e,t,i.ownerPart);if(!a||o.externalTargets.some(l=>l.ownerPart===a&&l.id===i.id)||new Set((o.relationships.get(a)??[]).map(l=>l.id)).has(i.id))continue;let d=Cs(o,{ownerPart:a,id:i.id,type:chunkZFBNCHRP_cjs.Xa,rawTarget:i.rawTarget,sinkSafe:i.sinkSafe},a);d&&(o=d);}return o}function Es(e,t,n){return n===t.mainDocumentPart?e.mainDocumentPart:typeof n!="string"||n.length===0?null:n}function Ms(e,t){let n=e.mainDocumentPart,r=Sn(n),o=e.parts.get(r),i=chunkZFBNCHRP_cjs.xa(`<Relationships xmlns="${na}"><Relationship Id="${chunkZFBNCHRP_cjs.P(t.id,"relationship id")}" Type="${chunkZFBNCHRP_cjs.P(t.type,"relationship type")}" Target="${chunkZFBNCHRP_cjs.P(t.rawTarget,"relationship target")}"/></Relationships>`,{name:r,contentType:ra});if(!i.ok)return null;let a=e.relationships.get(n)??[];if(a.some(l=>l.id===t.id))return null;let s={...t,ownerPart:n,order:a.reduce((l,c)=>Math.max(l,c.order),-1)+1},d=new Map([...e.relationships,[n,[...a,s]]]);return o?la(e,o,i.part.root.children[0],d):Object.freeze({...e,parts:new Map([...e.parts,[r,i.part]]),relationships:d})}function Cs(e,t,n=e.mainDocumentPart){let r=n;if(typeof r!="string"||r.length===0)return null;let o=Sn(r),i=e.parts.get(o),a=chunkZFBNCHRP_cjs.xa(`<Relationships xmlns="${na}"><Relationship Id="${chunkZFBNCHRP_cjs.P(t.id,"relationship id")}" Type="${chunkZFBNCHRP_cjs.Xa}" Target="${chunkZFBNCHRP_cjs.P(t.rawTarget,"relationship target")}" TargetMode="External"/></Relationships>`,{name:o,contentType:ra});if(!a.ok)return null;let s=[...e.externalTargets,t];if(!i)return Object.freeze({...e,parts:new Map([...e.parts,[o,a.part]]),externalTargets:s});let d=la(e,i,a.part.root.children[0],e.relationships);return d?Object.freeze({...d,externalTargets:s}):null}function la(e,t,n,r){if(!n)return null;let o=chunkZFBNCHRP_cjs.Ea(t),i=chunkZFBNCHRP_cjs.Ka(t,t.root.id,t.root.children.length,[da(n,o)]);return i.ok?Object.freeze({...e,parts:new Map([...e.parts,[t.name,i.part]]),relationships:r}):null}function da(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>da(n,t))}}function Sn(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function Ds(e){let t=/^(.*)\/_rels\/([^/]+)\.rels$/.exec(e);if(!t)return null;let n=t[1],r=t[2];return n===""||r===""?null:`${n}/${r}`}function As(e,t){let n=Sn(t),r=new Map(e.parts);r.delete(n);let o=new Map(e.partBytes);o.delete(n);let i=new Map(e.relationships);i.delete(t);let a=Object.freeze(e.externalTargets.filter(s=>s.ownerPart!==t));return Object.freeze({...e,parts:r,partBytes:o,relationships:i,externalTargets:a})}function _s(e){let t=e.contentTypes.overrides.get(chunkZFBNCHRP_cjs.u(et));if(t===ht)return e;if(t!==void 0)return null;let n=e.partBytes.get(Zo);if(!n)return null;let r=fflate.strFromU8(n),o=ta(r);if(!o)return null;let i=r.lastIndexOf(`</${o.rootName}>`);if(i===-1)return null;let a=r.slice(0,i)+Ss+r.slice(i),s=ta(a);if(!s||s.rootName!==o.rootName)return null;let d=[...o.children,ca("Override",{PartName:et,ContentType:ht})];return s.children.length!==d.length||s.children.some((l,c)=>l!==d[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[Zo,fflate.strToU8(a)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunkZFBNCHRP_cjs.u(et),ht]])})})}function ta(e){let t=chunkZFBNCHRP_cjs.X(e);if(!t.ok)return null;let n=t.nodes.filter(s=>s.type==="element");if(n.length!==1)return null;let r=n[0],o=r.name.indexOf(":"),i=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[i?`xmlns:${i}`:"xmlns"]!==Ns)return null;let a=[];for(let s of r.children)s.type==="element"&&a.push(ca(s.name,s.attributes));return {rootName:r.name,children:a}}function ca(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}var ma=4e3,ua=64;function pa(e){return chunkZFBNCHRP_cjs.Jf(e,"footnote")!==null||chunkZFBNCHRP_cjs.Jf(e,"endnote")!==null}function fa(e,t,n,r){if(!pa(e))return false;if(r.has(n.paragraphId))return true;r.add(n.paragraphId);let o=chunkZFBNCHRP_cjs.Ga(t,n.paragraphId);return !o||o.kind!=="paragraph"?true:chunkZFBNCHRP_cjs.Le(o).some(i=>i.node.kind==="noteReference"&&i.start<n.end&&i.end>n.start)}function ga(e,t,n,r){if(!pa(e))return false;if(r.has(n.blockId))return true;r.add(n.blockId);let o=chunkZFBNCHRP_cjs.Ga(t,n.blockId);if(!o||o.kind==="textValue")return true;let i=0,a=(s,d)=>{if(i>=ma||d>ua)return true;if(i+=1,s.kind==="textValue")return false;if(s.kind==="paragraph")return chunkZFBNCHRP_cjs.Le(s).some(l=>l.node.kind==="noteReference");for(let l of s.children)if(a(l,d+1))return true;return false};return a(o,0)}function ha(e,t,n){if(n.count>=ma||t>ua)return true;if(n.count+=1,e.kind==="textValue")return false;if(e.kind==="commentRangeStart"||e.kind==="commentRangeEnd"||e.kind==="commentReference")return true;for(let r of e.children)if(ha(r,t+1,n))return true;return false}function ya(e,t,n,r){if(!chunkZFBNCHRP_cjs.ng(e))return false;let o=n.op==="deleteText"?n.paragraphId:n.blockId;if(r.has(o))return true;r.add(o);let i=chunkZFBNCHRP_cjs.Ga(t,o);return !i||i.kind==="textValue"?true:ha(i,0,{count:0})}var wn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",Tn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function ka(e,t){let r=(e.relationships.get(e.mainDocumentPart)??[]).find(o=>o.id===t);return r?r.type!==wn&&r.type!==Tn?{ok:false,reason:"wrong-relationship-type",detail:r.type}:Fs(e,r):{ok:false,reason:"dangling-relationship",detail:t}}function Fs(e,t){let n=chunkZFBNCHRP_cjs.E(t);if(n.mode==="External")return {ok:false,reason:"external-relationship",detail:t.id};if(!n.target.ok)return {ok:false,reason:"bad-relationship-target",detail:n.target.reason};let r=e.parts.get(n.target.partName);if(!r)return {ok:false,reason:"missing-part",detail:n.target.partName};let o=r.root.localName;return o!=="hdr"&&o!=="ftr"?{ok:false,reason:"not-a-story-part",detail:o||r.name}:{ok:true,partName:r.name,part:r}}function Le(e,t){return t.compositionActive||e.compositionSessionOpen()?{ok:false,reason:"invalidArgs",detail:"ime-composition-active"}:null}function xa(e,t){let n=chunkZFBNCHRP_cjs.Ga(e,t);return !n||n.kind!=="drawing"?null:n.children.find(o=>o.kind==="inlineDrawing"||o.kind==="anchoredDrawing")??null}function Pa(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=chunkZFBNCHRP_cjs.Ga(r,n);return !o||o.kind!=="drawing"?null:chunkZFBNCHRP_cjs.lb(o,{ownerPartName:t,supportedMcRequires:chunkZFBNCHRP_cjs.eb,limits:chunkZFBNCHRP_cjs.db,resolveRelationship:chunkZFBNCHRP_cjs.gb(e,t)})}function Oa(e,t,n){let r=chunkZFBNCHRP_cjs.F(e.relationships.get(t)??[],t,n);return r.mode==="internal"?r.partName:null}function tt(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let i=Le(e,o.store);if(i)return i;let{store:a,story:s}=o;return chunkZFBNCHRP_cjs.Ba(e,()=>Us(e,a,s,n,r),d=>chunkZFBNCHRP_cjs.Ca(d))}function Us(e,t,n,r,o){let i=n.partName,a=e.currentPackage(),s=t.checkpoint(),d=t.historyDepth,l=null,c=false,m=false,u=t.transact(h=>{if(o?.commitGuard?.()===false){m=true;return}if(o?.expectedPackageRevision!==void 0&&e.packageRevision!==o.expectedPackageRevision){c=true;return}let g=r(h,i);if(g===null){h.apply({op:"insertText",paragraphId:"\0task12-abort",offset:0,text:"x"});return}l=g;},{story:n,...o?.actorId?{actorId:o.actorId}:{},...n.kind==="headerFooter"||n.kind==="notesPart"?{minimumImpact:"global"}:{}});if(m)return {ok:false,reason:"invalidArgs",detail:"stale drawing selection"};if(c)return {ok:false,reason:"invalidArgs",detail:"stale-package-epoch"};if(!u.ok)return {ok:false,reason:u.reason,...u.detail?{detail:u.detail}:{}};if(!u.change)return {ok:true,change:null};let y=u.change.created.find(h=>{let g=t.part;return chunkZFBNCHRP_cjs.Ga(g,h)?.kind==="drawing"});return y&&(l=y),{ok:true,change:e.promoteStoryTransactionToPackageUnit(a,t,s,d),...l?{drawingNodeId:l}:{}}}function Ia(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=xa(r,n);return o?chunkZFBNCHRP_cjs.Jh(o):null}function En(e,t,n,r){let o=false;return e.applyPackage(i=>{let a=i.parts.get(t);if(!a)return i;let s=chunkZFBNCHRP_cjs.Ga(a,n);if(!s||s.kind!=="drawing")return i;let d=xa(a,n);if(!d)return i;let l=chunkZFBNCHRP_cjs.Kh(d,r),c=Ls(s,l),m=chunkZFBNCHRP_cjs.La(a,s.id,c,{deferValidation:true});return m.ok?(o=true,chunkZFBNCHRP_cjs.ec(i,m.part)):i}),o}function Ls(e,t){return {...e,children:e.children.map(n=>n.id===t.id?t:n)}}async function Ra(e,t,n){let r=chunkZFBNCHRP_cjs.Yb(n.widthPoints),o=chunkZFBNCHRP_cjs.Yb(n.heightPoints);if(r===null||o===null)return {ok:false,reason:"invalidArgs",detail:"invalid-dimensions"};let i=e.resolveStory(t);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let a=Le(e,i.store);if(a)return a;let s=i.story.partName,d=await chunkZFBNCHRP_cjs.Ub(n.decodePort,n.bytes,n.mime);if(!d.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let l=d.bytes,c=chunkZFBNCHRP_cjs.Wb(e.currentPackage(),s,{bytes:l,mime:n.mime});if(!c.ok)return {ok:false,reason:"invalidArgs",detail:c.reason==="invalid-image"?"invalid-image":c.reason};let m=c.partName,u=tt(e,t,(y,p)=>{let h=e.currentPackage(),g=chunkZFBNCHRP_cjs.Wb(h,p,{bytes:l,mime:n.mime});if(!g.ok)return null;h=g.pkg,m=g.partName;let k;if(n.hyperlink){let P=chunkZFBNCHRP_cjs.of(h,n.hyperlink,p);if(!P)return null;h=P.pkg,k=P.relationshipId;}if(!y.applyPackage(()=>h))return null;let f=chunkZFBNCHRP_cjs.Zb({docPrId:g.docPrId,relationshipId:g.relationshipId,extentEmu:{cx:r,cy:o},...n.title!==void 0?{title:n.title}:{},...n.description!==void 0?{description:n.description}:{},...k?{hyperlinkRelationshipId:k}:{}});return y.apply({op:"insertDrawing",paragraphId:n.paragraphId,offset:n.offset,drawing:f,...n.revision?{revision:n.revision}:{}})?f.id:null},{expectedPackageRevision:n.expectedPackageRevision,...n.commitGuard?{commitGuard:n.commitGuard}:{},...n.actorId?{actorId:n.actorId}:{}});return u.ok?u.change?{...u,mediaPartName:m}:{ok:true,change:null,mediaPartName:m}:u}async function Mn(e,t,n,r,o,i,a){let s=e.resolveStory(t);if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let d=Le(e,s.store);if(d)return d;let l=s.story.partName,c=await chunkZFBNCHRP_cjs.Ub(i,r,o);if(!c.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let m=c.bytes,u=chunkZFBNCHRP_cjs.Wb(e.currentPackage(),l,{bytes:m,mime:o});return u.ok?tt(e,t,(y,p)=>{let h=e.currentPackage(),g=Pa(h,l,n),k=g?.picture?.embeddedRelationshipId??null,f=g?.picture?.linkedRelationshipId??null,P=k??f;if(!P)return null;let O=k!==null?Oa(h,l,k):null,b=h,N=chunkZFBNCHRP_cjs.Wb(b,p,{bytes:m,mime:o});return !N.ok||(b=N.pkg,!y.applyPackage(()=>b))||!y.apply({op:"replaceDrawingResource",drawingNodeId:n,relationshipId:N.relationshipId})?null:(y.applyPackage(T=>chunkZFBNCHRP_cjs.$b(T,p,O,P)),n)},{expectedPackageRevision:a.expectedPackageRevision,...a.commitGuard?{commitGuard:a.commitGuard}:{},...a.actorId?{actorId:a.actorId}:{}}):{ok:false,reason:"invalidArgs",detail:u.reason==="invalid-image"?"invalid-image":u.reason}}function va(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Le(e,r.store);if(o)return o;let i=r.story.partName,a=e.currentPackage(),s=Pa(a,i,n);if(!s)return {ok:false,reason:"unknown-drawing"};let d=s.picture?.embeddedRelationshipId??null,l=s.picture?.linkedRelationshipId??null,c=d??l,m=d!==null?Oa(a,i,d):null;return tt(e,t,(u,y)=>u.apply({op:"deleteDrawing",drawingNodeId:n})?(u.applyPackage(p=>chunkZFBNCHRP_cjs.$b(p,y,m,c)),n):null)}function $s(e,t){let n=null,r=i=>{let a=false,s=false,d=(l,c)=>{if(a||l.kind==="textValue")return;if(l.id===t){a=true,s=c;return}let m=c||l.kind==="revisionDelete"||l.kind==="revisionMoveFrom";for(let u of l.children)d(u,m);};return d(i,false),s},o=i=>{if(!(n!==null||i.kind==="textValue")){if(i.kind==="paragraph"){let a=chunkZFBNCHRP_cjs.Ne(i).spanOf(t);if(a!==null&&a.end>a.start){let s=chunkZFBNCHRP_cjs.Ga(e,t);if(!s||s.kind!=="drawing"&&!chunkZFBNCHRP_cjs.hb(s))return;n={paragraphId:i.id,start:a.start,end:a.end,alreadyDeleted:r(i)};}return}for(let a of i.children)o(a);}};return o(e.root),n}function ba(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let i=Le(e,o.store);if(i)return i;let a=e.currentPackage().parts.get(o.story.partName);if(!a)return {ok:false,reason:"unknown-drawing"};let s=$s(a,n);return s?s.alreadyDeleted?{ok:true,change:null}:tt(e,t,d=>d.apply({op:"deleteText",paragraphId:s.paragraphId,start:s.start,end:s.end,revision:r})?n:null):{ok:false,reason:"unknown-drawing"}}async function Na(e,t,n,r,o,i,a,s){let d=await chunkZFBNCHRP_cjs.ac(o,r,i,void 0,a);return d.ok?Mn(e,t,n,d.bytes,d.mime,a,{expectedPackageRevision:e.packageRevision,...s?{actorId:s}:{}}):{ok:false,reason:"invalidArgs",detail:`${d.reason}${d.detail?`:${d.detail}`:""}`}}function Sa(e,t,n,r,o,i){let a=e.resolveStory(t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let s=Le(e,a.store);return s||tt(e,t,(d,l)=>{let c=Ia(e.currentPackage(),l,n),m=null;if(i!==null){let y=chunkZFBNCHRP_cjs.of(e.currentPackage(),i,l);if(!y||!d.applyPackage(()=>y.pkg))return null;m=y.relationshipId;}if(!d.apply({op:"setDrawingMetadata",drawingNodeId:n,title:r,description:o,...i===null?{hyperlink:null}:{}}))return null;if(i!==null&&m!==null){if(!En(d,l,n,m))return null}else if(i===null&&!En(d,l,n,null))return null;let u=false;return d.applyPackage(y=>{let p=chunkZFBNCHRP_cjs.qf(y,l,c);return p===null?(u=true,y):p}),u?null:n})}function wa(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Le(e,r.store);return o||tt(e,t,(i,a)=>{let s=Ia(e.currentPackage(),a,n.drawingNodeId),d=null;if(n.hyperlink!==null){let c=chunkZFBNCHRP_cjs.of(e.currentPackage(),n.hyperlink,a);if(!c||!i.applyPackage(()=>c.pkg))return null;d=c.relationshipId;}for(let c of n.ops)if(!i.apply(c))return null;if(!En(i,a,n.drawingNodeId,n.hyperlink===null?null:d))return null;let l=false;return i.applyPackage(c=>{let m=chunkZFBNCHRP_cjs.qf(c,a,s);return m===null?(l=true,c):m}),l?null:n.drawingNodeId})}function Bs(e,t){if(e===t)return true;if(e.byteLength!==t.byteLength)return false;for(let n=0;n<e.byteLength;n+=1)if(e[n]!==t[n])return false;return true}function Ta(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let[n,r]of e)if(t.get(n)!==r)return false;return true}function Hs(e,t){return e===t||e.ownerPart===t.ownerPart&&e.id===t.id&&e.type===t.type&&e.rawTarget===t.rawTarget&&e.targetMode===t.targetMode&&e.order===t.order}function js(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let[n,r]of e){let o=t.get(n);if(!o||o.length!==r.length||o!==r&&r.some((i,a)=>!Hs(i,o[a])))return false}return true}function Vs(e,t){return e===t?true:e.length!==t.length?false:e.every((n,r)=>{let o=t[r];return n===o||n.ownerPart===o.ownerPart&&n.id===o.id&&n.type===o.type&&n.rawTarget===o.rawTarget&&n.sinkSafe===o.sinkSafe})}function Ws(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let[n,r]of e){let o=t.get(n);if(!o||!Bs(r,o))return false}return true}function Ks(e,t){return e.contentTypes===t.contentTypes||Ta(e.contentTypes.defaults,t.contentTypes.defaults)&&Ta(e.contentTypes.overrides,t.contentTypes.overrides)}var Vt=Object.freeze({equal:true,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"}),Wt=Object.freeze({equal:false,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"});function Ea(e){for(let[t,n]of e)if(!chunkZFBNCHRP_cjs.sa(t,n))return Wt;return Vt}function zs(e,t){if(e===t)return Vt;if(e.mainDocumentPart!==t.mainDocumentPart||e.parts.size!==t.parts.size||!Ws(e.partBytes,t.partBytes)||!js(e.relationships,t.relationships)||!Vs(e.externalTargets,t.externalTargets)||!Ks(e,t))return Wt;let n=[];for(let[a,s]of e.parts){let d=t.parts.get(a);if(!d)return Wt;s!==d&&n.push([s,d]);}if(n.length===0)return Vt;let[r,o]=n[0];if(n.length>1||r.name!==e.mainDocumentPart)return Ea(n);let i=chunkZFBNCHRP_cjs.ta(o.root,r.root);return i.undecided?Ea(n):i.equal?Vt:!i.idsPreserved||i.reach==="outside-paragraph"||i.paragraphIds.length===0?Wt:{equal:false,dirty:i.paragraphIds,dependencyKeys:[chunkZFBNCHRP_cjs.g.story],impact:i.reach==="paragraph-text"?"text-local":"flow-structural"}}function Cn(e){return {ok:false,reason:"package-invariant",detail:e}}function Gs(e,t){if(!e.parts.get(e.mainDocumentPart))return Cn("no-main-document");for(let[r,o]of e.parts){let i=t?.parts.get(r);if(i===o)continue;let a=i?chunkZFBNCHRP_cjs.va(i,o):chunkZFBNCHRP_cjs.ua(o);if(!a.ok)return Cn(`invalid-part:${r}:${a.issues[0]?.code??"invalid"}`)}let n=chunkZFBNCHRP_cjs.oc(e);return n.ok?null:Cn(n.issues[0]?.code??"package-invariant")}function Ma(e,t,n){let r=e.currentPackage(),o=zs(t,r);if(o.equal)return {ok:true,change:null};let i=Gs(t,r);if(i)return i;let a=e.bodyStore().part.name,s=o.impact!=="global"&&t.mainDocumentPart===a;return chunkZFBNCHRP_cjs.Ba(e,()=>{let d=e.packageRevision;return e.installAuthoritativePackageSnapshot(t),{ok:true,change:e.publishStoryWrite({change:"model-change",fromRevision:d,toRevision:d+1,commitId:`pkg-remote-${d+1}`,origin:n.origin,...n.actorId?{actorId:n.actorId}:{},...n.operationId?{operationId:n.operationId}:{},dirty:s?o.dirty:[],created:[],deleted:[],splitJoin:[],dependencyKeys:s?o.dependencyKeys:[],impact:s?o.impact:"global",story:{kind:"body",partName:a}})}},()=>false)}function Aa(e,t,n,r){let o=[...t],i=new Set;for(let a of o)e.parts.has(a)&&i.add(a);for(let a of n)Ca(a,o,i);for(let a of r)Ca(a,o,i);return i}function _a(e,t,n,r,o){let i=new Set(e);i.add(t),i.add(n);for(let a of r)Da(a,i);for(let a of o)Da(a,i);return i}function Ca(e,t,n){if(e.kind==="story"){n.add(e.partName);return}for(let r of t)(e.before.parts.has(r)||e.after.parts.has(r))&&n.add(r);}function Da(e,t){if(e.kind==="story"){t.add(e.partName);return}for(let n of e.before.parts.keys())t.add(n);for(let n of e.after.parts.keys())t.add(n);}var Fa=new Set(["acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions"]),Xs=new Set(["deleteTableRow","deleteTableColumn","removeContentControl","removeRepeatingSectionItem"]),Ys=64,Ua=class{pkg;packageRev=0;body;stories=new Map;rIdToPartName=new Map;undoOrder=[];redoOrder=[];subscribers=new Set;historyLimit;maxEditableStoryParts;cascadeNoteReferences;lastChange=null;shellHyperlinks=Object.freeze([]);compositionSession=null;commitCounter=0;currentPackageMemo=null;constructor(t,n,r={}){this.pkg=chunkZFBNCHRP_cjs.ec(t,n),this.historyLimit=r.historyLimit??200,this.maxEditableStoryParts=r.maxEditableStoryParts??Ys,this.cascadeNoteReferences=r.cascadeDeletedNoteReferences??chunkZFBNCHRP_cjs.ag,this.body=new Qe(this.pkg,n.name,{historyLimit:this.historyLimit,settingsPart:()=>chunkZFBNCHRP_cjs.yf(this.pkg)}),this.body.setStoryRef({kind:"body",partName:n.name});}get packageRevision(){return this.packageRev}get canUndo(){return this.undoOrder.length>0}get canRedo(){return this.redoOrder.length>0}get lastModelChange(){return this.lastChange}bodyStore(){return this.body}currentPackage(){let t=this.currentPackageMemo;if(t&&t.pkg===this.pkg&&t.bodyPart===this.body.part){let o=0,i=true;for(let a of this.stories.values()){if(t.storyParts[o]!==a.part){i=false;break}o+=1;}if(i&&o===t.storyParts.length)return t.result}let n=chunkZFBNCHRP_cjs.ec(this.pkg,this.body.part),r=[];for(let o of this.stories.values())r.push(o.part),this.pkg.parts.has(o.part.name)&&(n=chunkZFBNCHRP_cjs.ec(n,o.part));return this.currentPackageMemo={pkg:this.pkg,bodyPart:this.body.part,storyParts:r,result:n},n}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}resolveStory(t){return t.kind==="body"?{ok:true,story:{kind:"body",partName:this.body.part.name},store:this.body}:t.kind==="notesPart"?t.noteKind!=="footnote"&&t.noteKind!=="endnote"?{ok:false,reason:"unknown-scope",detail:String(t.noteKind)}:this.openNotesPartStore(t.noteKind):t.kind!=="headerFooter"||typeof t.rId!="string"||t.rId.length===0?{ok:false,reason:"unknown-scope",detail:String(t.kind)}:this.openHeaderFooterStore(t.rId)}partFor(t){let n=this.resolveStory(t);return n.ok?n.store.part:null}revisionFor(t){let n=this.resolveStory(t);return n.ok?n.store.revision:null}transact(t,n,r={}){return chunkZFBNCHRP_cjs.Ba(this,()=>this.commitStoryTransaction(t,n,r),chunkZFBNCHRP_cjs.Ca)}commitStoryTransaction(t,n,r={}){let o=this.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let{store:i,story:a}=o,s=this.currentPackage(),d=i.historyDepth,l=i.compositionActive,c=i.checkpoint(),m=false,u=new Set,y=false,p=new Set,h=false,g,k=false;i.graftPackage(()=>this.currentPackage());let f=i.transact(b=>{n({...b,applyTo:(N,T)=>{let A=b.applyTo(N,T);return A&&N!==a.partName&&(k=true),A},applyPackage:N=>b.applyPackage(T=>{let A=N(T);return A!==T&&!k&&(k=Yo(T,A,a.partName)),A}),apply:N=>(N.op==="setListNumbering"&&N.numId!==null&&(h=true),N.op==="setParagraphProperties"&&(g??=N.properties.find(T=>T.localName==="pStyle")?.attributes?.val),m||(N.op==="deleteText"&&fa(this.pkg,i.part,N,u)||N.op==="deleteBlock"&&ga(this.pkg,i.part,N,u)||Fa.has(N.op))&&(m=true),y||(N.op==="deleteText"||N.op==="deleteBlock"?y=ya(this.pkg,i.part,N,p):(Fa.has(N.op)||Xs.has(N.op))&&(y=true)),b.apply(N)),selectionBefore:N=>b.selectionBefore(N),selectionAfter:N=>b.selectionAfter(N)});},{...r,story:a,...a.kind==="headerFooter"||a.kind==="notesPart"?{minimumImpact:"global"}:{}});if(!f.ok)return {ok:false,reason:f.reason,...f.detail?{detail:f.detail}:{}};this.syncPackageFromStore(i);let P=false;if(f.change&&k&&(this.installPackageSnapshotInternal(i.package),l?this.compositionSession&&(this.compositionSession.packageWideEffects=true):i.restoreHistoryStacks(c),P=true),h&&g){let b=Qo(this.pkg,g);b&&this.replacePackageShell(b);}let O=false;if(f.change&&m){let b=this.currentPackage(),N=this.cascadeNoteReferences(s,b);if(N===null)return i.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"note-cascade-failed"};N!==b&&(this.installPackageSnapshotInternal(N),l?this.compositionSession&&(this.compositionSession.packageWideEffects=true):i.restoreHistoryStacks(c),O=true);}if(f.change&&y){let b=this.currentPackage(),N=chunkZFBNCHRP_cjs.rg(s,b,{storyPartName:a.partName});if(N===null)return i.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"comment-cascade-failed"};N!==b&&(this.installPackageSnapshotInternal(N),l?this.compositionSession&&(this.compositionSession.packageWideEffects=true):i.restoreHistoryStacks(c),O=true);}if(f.change){this.packageRev+=1;let b=O||P;!l&&r.recordsHistory!==false&&(i.historyDepth>d||b)&&(b?this.pushUndoPointer({kind:"package",before:s,after:this.currentPackage()}):this.pushUndoPointer({kind:"story",partName:a.partName,story:a}));let N=b?this.publishSynthetic(f.change.origin,"global",a,f.change.created):f.change;return b||this.publish(N),{ok:true,change:N}}return {ok:true,change:f.change}}compositionSessionOpen(){return this.compositionSession!==null}beginComposition(t,n=null){let r=this.resolveStory(t);return !r.ok||this.compositionSession&&this.compositionSession.partName!==r.story.partName&&(this.endComposition(),r=this.resolveStory(t),!r.ok)?false:(this.compositionSession||(this.compositionSession={partName:r.story.partName,beforePackage:this.currentPackage(),storyCheckpoint:r.store.checkpoint(),packageWideEffects:false}),r.store.beginComposition(n),true)}endComposition(){let t=this.compositionSession;if(this.compositionSession=null,!t){this.body.endComposition();return}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return;let r=n.historyDepth;if(n.endComposition(),t.packageWideEffects){n.restoreHistoryStacks(t.storyCheckpoint),this.syncPackageFromStore(n),this.pushUndoPointer({kind:"package",before:t.beforePackage,after:this.currentPackage()});return}if(n.historyDepth>r){let o=t.partName===this.body.part.name?{kind:"body",partName:t.partName}:this.storyRefForPart(t.partName);o&&this.pushUndoPointer({kind:"story",partName:t.partName,story:o});}this.syncPackageFromStore(n);}cancelComposition(){let t=this.compositionSession;if(this.compositionSession=null,!t){this.body.cancelComposition();return}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(t.packageWideEffects){n&&n.restoreCheckpoint(t.storyCheckpoint),this.installPackageSnapshotInternal(t.beforePackage),this.packageRev+=1;let r=t.partName===this.body.part.name?{kind:"body",partName:t.partName}:this.storyRefForPart(t.partName);this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationHuman,"global",r??{kind:"body",partName:this.body.part.name},[]);return}n?.cancelComposition();}applyLifecycleOp(t){return chunkZFBNCHRP_cjs.Ba(this,()=>this.commitLifecycleOp(t),chunkZFBNCHRP_cjs.Ca)}commitLifecycleOp(t){let n=this.currentPackage();if(chunkZFBNCHRP_cjs._f(t)){let a=chunkZFBNCHRP_cjs.$f(n,t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};if(a.package===n)return {ok:true,change:null};this.installPackageSnapshotInternal(a.package),this.pushUndoPointer({kind:"package",before:n,after:a.package}),this.packageRev+=1;let s={kind:"body",partName:this.body.part.name},d=this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationHuman,a.impact,s,a.createdPartName?[a.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:d}}if(!chunkZFBNCHRP_cjs.rf(t))return {ok:false,reason:"invalidArgs",detail:"not-lifecycle-op"};let r=chunkZFBNCHRP_cjs.sf(n,t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};this.installPackageSnapshotInternal(r.package),this.pushUndoPointer({kind:"package",before:n,after:r.package}),this.packageRev+=1;let o={kind:"body",partName:this.body.part.name},i=this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationHuman,r.impact,o,r.createdPartName?[r.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:i}}undo(){let t=this.undoOrder.pop();if(!t)return null;if(t.kind==="package"){this.installPackageSnapshotInternal(t.before),this.redoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationUndo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),o}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return null;let r=n.undo();return r?(this.redoOrder.push(t),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}redo(){let t=this.redoOrder.pop();if(!t)return null;if(t.kind==="package"){this.installPackageSnapshotInternal(t.after),this.undoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationRedo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),o}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return null;let r=n.redo();return r?(this.undoOrder.push(t),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}selectionForUndo(){let t=this.undoOrder[this.undoOrder.length-1];return !t||t.kind==="package"?null:(t.partName===this.body.part.name?this.body:this.stories.get(t.partName))?.selectionForUndo()??null}selectionForRedo(){let t=this.redoOrder[this.redoOrder.length-1];return !t||t.kind==="package"?null:(t.partName===this.body.part.name?this.body:this.stories.get(t.partName))?.selectionForRedo()??null}openStoryParts(){return Nn(this.stories,this.pkg)}openedStoryCount(){return 1+this.stories.size}openStoryToken(){return Xo(this.stories,this.pkg)}insertImage(t,n){return Ra(this,t,n)}applyFragmentPaste(t,n){return zo(this,t,n)}replaceImage(t,n,r,o,i,a){return Mn(this,t,n,r,o,i,a)}deleteImage(t,n){return va(this,t,n)}deleteImageTracked(t,n,r){return ba(this,t,n,r)}embedExternalImage(t,n,r,o,i,a,s){return Na(this,t,n,r,o,i,a,s)}setDrawingMetadataWithHyperlink(t,n,r,o,i){return Sa(this,t,n,r,o,i)}applyImageProperties(t,n){return wa(this,t,n)}promoteStoryTransactionToPackageUnit(t,n,r,o){this.installPackageSnapshotInternal(n.package),n.historyDepth>o&&n.restoreHistoryStacks(r),this.pushUndoPointer({kind:"package",before:t,after:this.currentPackage()}),this.packageRev+=1;let i=n.part.name===this.body.part.name?{kind:"body",partName:n.part.name}:this.storyRefForPart(n.part.name);return this.publishSynthetic(chunkZFBNCHRP_cjs.b.mutationHuman,i?.kind==="headerFooter"?"global":"flow-structural",i??{kind:"body",partName:this.body.part.name},[])}publishStoryWrite(t){return t?(this.packageRev+=1,this.publish(t),t):null}adoptPackageUnit(t){let n=this.currentPackage();t!==n&&this.pushUndoPointer({kind:"package",before:t,after:n});}installPackageSnapshot(t){this.installPackageSnapshotInternal(t);}installAuthoritativePackageSnapshot(t){this.installPackageSnapshotInternal(t,false);}publishRemotePackage(t,n){return Ma(this,t,n)}replacePackageShell(t){this.shellHyperlinks=oa(this.shellHyperlinks,this.pkg,t);let n=t;n=chunkZFBNCHRP_cjs.ec(n,this.body.part);for(let r of this.stories.values())t.parts.has(r.part.name)&&(n=chunkZFBNCHRP_cjs.ec(n,r.part));this.pkg=n;}installPackageSnapshotInternal(t,n=true){let r=n?ia(t,this.pkg,this.shellHyperlinks):t,o=r.parts.get(r.mainDocumentPart);if(!o)return;this.body.replacePart(o);for(let[a,s]of this.stories){let d=r.parts.get(a);d&&s.replacePart(d);}this.rIdToPartName.clear();let i=r.relationships.get(r.mainDocumentPart)??[];for(let a of i){if(a.type!==wn&&a.type!==Tn)continue;let s=chunkZFBNCHRP_cjs.E(a);s.mode!=="Internal"||!s.target.ok||this.stories.has(s.target.partName)&&r.parts.has(s.target.partName)&&this.rIdToPartName.set(a.id,s.target.partName);}this.pkg=r,this.pkg=chunkZFBNCHRP_cjs.ec(this.pkg,this.body.part);for(let a of this.stories.values())this.pkg.parts.has(a.part.name)&&(this.pkg=chunkZFBNCHRP_cjs.ec(this.pkg,a.part));}openNotesPartStore(t){let n=chunkZFBNCHRP_cjs.Jf(this.currentPackage(),t);if(!n)return {ok:false,reason:"missing-part",detail:t};let r=this.stories.get(n.name);if(r)return {ok:true,story:{kind:"notesPart",partName:n.name,noteKind:t},store:r};if(this.openedStoryCount()>=this.maxEditableStoryParts&&this.evictUnreachableStories(),this.openedStoryCount()>=this.maxEditableStoryParts)return {ok:false,reason:"too-many-story-stores",detail:String(this.maxEditableStoryParts)};let o=chunkZFBNCHRP_cjs.Kb(n),i=new Qe(o,{historyLimit:this.historyLimit,settingsPart:()=>chunkZFBNCHRP_cjs.yf(this.pkg)}),a={kind:"notesPart",partName:o.name,noteKind:t};return i.setStoryRef(a),this.stories.set(o.name,i),o!==n&&(this.pkg=chunkZFBNCHRP_cjs.ec(this.pkg,o)),{ok:true,story:a,store:i}}openHeaderFooterStore(t){let n=this.rIdToPartName.get(t);if(n){let d=this.stories.get(n);if(d)return {ok:true,story:{kind:"headerFooter",partName:n,rId:t},store:d}}let r=ka(this.currentPackage(),t);if(!r.ok)return r;let o=this.stories.get(r.partName);if(o)return this.rIdToPartName.set(t,r.partName),{ok:true,story:{kind:"headerFooter",partName:r.partName,rId:t},store:o};if(this.openedStoryCount()>=this.maxEditableStoryParts&&this.evictUnreachableStories(),this.openedStoryCount()>=this.maxEditableStoryParts)return {ok:false,reason:"too-many-story-stores",detail:String(this.maxEditableStoryParts)};let i=chunkZFBNCHRP_cjs.Kb(r.part),a=new Qe(i,{historyLimit:this.historyLimit,settingsPart:()=>chunkZFBNCHRP_cjs.yf(this.pkg)}),s={kind:"headerFooter",partName:i.name,rId:t};return a.setStoryRef(s),this.stories.set(i.name,a),this.rIdToPartName.set(t,i.name),i!==r.part&&(this.pkg=chunkZFBNCHRP_cjs.ec(this.pkg,i)),{ok:true,story:s,store:a}}storyRefForPart(t){if(t===this.body.part.name)return {kind:"body",partName:t};for(let[r,o]of this.rIdToPartName)if(o===t)return {kind:"headerFooter",partName:t,rId:r};let n=this.currentPackage().parts.get(t);return n?.root.localName==="footnotes"?{kind:"notesPart",partName:t,noteKind:"footnote"}:n?.root.localName==="endnotes"?{kind:"notesPart",partName:t,noteKind:"endnote"}:null}syncPackageFromStore(t){this.pkg=chunkZFBNCHRP_cjs.ec(this.pkg,t.part);}pushUndoPointer(t){this.undoOrder.push(t),this.redoOrder.length=0,this.undoOrder.length>this.historyLimit&&this.undoOrder.shift(),this.evictUnreachableStories();}evictUnreachableStories(){let t=Aa(this.pkg,this.stories.keys(),this.undoOrder,this.redoOrder);for(let[o]of [...this.stories])if(!t.has(o)){this.stories.delete(o);for(let[i,a]of [...this.rIdToPartName])a===o&&this.rIdToPartName.delete(i);}let n=_a(t,this.pkg.mainDocumentPart,this.body.part.name,this.undoOrder,this.redoOrder),r=sa(this.pkg,n);r!==this.pkg&&(this.pkg=r),this.shellHyperlinks=aa(this.shellHyperlinks,n,this.pkg.mainDocumentPart);}publish(t){this.lastChange=t;for(let n of this.subscribers)n(t);}publishSynthetic(t,n,r,o){this.commitCounter+=1;let i=this.packageRev-1,a={change:"model-change",fromRevision:i<0?0:i,toRevision:this.packageRev,commitId:`pkg-commit-${this.commitCounter}`,origin:t,dirty:[],created:[...o],deleted:[],splitJoin:[],dependencyKeys:[],impact:n,story:r};return this.publish(a),a}};function Js(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function La(e,t){if(!e){let a=chunkZFBNCHRP_cjs.Nb(t);return a?chunkZFBNCHRP_cjs.Ob(new Set,a,chunkZFBNCHRP_cjs.Lb):"0"}let n=-1,r=new Set,o=a=>{if(a.kind!=="textValue"){if(a.kind==="comment"){let s=Js(a,chunkZFBNCHRP_cjs.da,"id");if(s!==void 0&&/^\d{1,10}$/.test(s)){let d=Number(s);Number.isSafeInteger(d)&&d<=chunkZFBNCHRP_cjs.Lb&&(r.add(String(d)),d>n&&(n=d));}}for(let s of a.children)o(s);}};o(e.root);let i=chunkZFBNCHRP_cjs.Nb(t);return i?chunkZFBNCHRP_cjs.Ob(r,i,chunkZFBNCHRP_cjs.Lb):String(n+1)}var qs=256,Qs=65535,$a=64;function Kt(e,t){return e.length>t}function Ba(e){return typeof e!="string"||e.trim().length===0?"invalid-author":Kt(e,qs)?"resource-limit":chunkZFBNCHRP_cjs.O(e)?null:"invalid-author"}function Ha(e){return typeof e!="string"||e.length===0?"invalid-text":Kt(e,Qs)?"resource-limit":chunkZFBNCHRP_cjs.O(e)?null:"invalid-text"}function Dn(e){if(typeof e!="string")return {ok:false,rejection:"invalid-date"};let t=e.trim();if(Kt(t,$a))return {ok:false,rejection:"resource-limit"};if(!chunkZFBNCHRP_cjs.O(t))return {ok:false,rejection:"invalid-date"};let n=chunkZFBNCHRP_cjs.Fe(t);return n===null?{ok:false,rejection:"invalid-date"}:Kt(n,$a)?{ok:false,rejection:"resource-limit"}:{ok:true,value:n}}function Zm(e){if(e===void 0)return null;let t=Dn(e);return t.ok?null:t.rejection}function An(e){switch(e){case "invalid-author":return "invalid-author";case "invalid-text":return "invalid-text";case "invalid-date":return "invalid-property-value";case "resource-limit":return "resource-limit"}}function ja(e,t){if(e.kind==="textValue")return e;let n=t.get(e.id);if(n!==void 0)return n;let r=false,o=[];for(let i of e.children){let a=ja(i,t);a!==i&&(r=true),o.push(a);}return r?{...e,children:o}:e}function tl(e,t,n){let r=ja(e.root,t);if(r.kind==="textValue")return {ok:false,issues:[{code:"known-node-invariant",path:e.root.id,nodeId:e.root.id}]};let o=n===null?r:{...r,namespaceBindings:[...r.namespaceBindings,{prefix:n,namespaceUri:chunkZFBNCHRP_cjs.ga}]};return chunkZFBNCHRP_cjs.La(e,e.root.id,o,{deferValidation:true})}function Va(e,t,n){let r=new Map;for(let i of t){if(i.stampParagraph===null)continue;let a=r.get(i.commentsPartName);a||(a=new Map,r.set(i.commentsPartName,a)),a.set(i.stampParagraph.id,{paragraph:i.stampParagraph,paraId:i.paraId});}let o=e;for(let[i,a]of r){let s=o.parts.get(i);if(!s)return null;let d=chunkZFBNCHRP_cjs.Ib(s.root),l=d??"w14",c=new Map;for(let u of a.values())c.set(u.paragraph.id,n(u.paragraph,u.paraId,l));let m=tl(s,c,d===null?l:null);if(!m.ok)return null;o=chunkZFBNCHRP_cjs.ec(o,m.part);}return o}function Wa(e,t,n){let r=e.root.children.map(o=>o.kind==="textValue"?o:t.get(o.id)??o);return chunkZFBNCHRP_cjs.Ja(e,e.root.id,[...r,...n],{deferValidation:true})}var Ga="/word/comments.xml",Xa="/word/commentsExtended.xml",$n="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",Bn="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",nl=[Bn,"application/vnd.ms-word.commentsExtended+xml"],Ya="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Hn="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Se="http://schemas.microsoft.com/office/word/2012/wordml";function kt(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function nt(e,t){return {kind:"genericExtension",namespaceUri:chunkZFBNCHRP_cjs.da,localName:e,prefix:"w",value:t}}function Ie(e,t,n,r,o,i,a,s=[]){return {id:e,kind:t,namespaceUri:n,localName:o,prefix:r,namespaceBindings:s,attributes:i,children:a}}function Ja(e,t,n,r,o){let i=t===e.mainDocumentPart?[t]:[t,e.mainDocumentPart];for(let a of i)for(let s of chunkZFBNCHRP_cjs.gc(e,a)){if(s.type!==n)continue;let d=chunkZFBNCHRP_cjs.w(a,s.rawTarget);if(!d.ok)continue;if(!e.parts.has(d.partName))return d.partName;let l=chunkZFBNCHRP_cjs.hc(e,d.partName);if(l!==null&&(typeof r=="string"?l===r:r.includes(l)))return d.partName}return o}function _n(e,t,n){let r=e.mainDocumentPart;for(let i of chunkZFBNCHRP_cjs.gc(e,r)){if(i.type!==t)continue;let a=chunkZFBNCHRP_cjs.w(r,i.rawTarget);if(a.ok&&a.partName===n)return e}let o=chunkZFBNCHRP_cjs.lc(e,r);return chunkZFBNCHRP_cjs.mc(o,r,t,chunkZFBNCHRP_cjs.Eg(r,n)).pkg}function jn(e,t){return Ja(e,t,Ya,$n,Ga)}function qa(e,t){let n=chunkZFBNCHRP_cjs.dg(e,t),r=chunkZFBNCHRP_cjs.eg(e,t,n).extended;return r!==null?r:Ja(e,t,Hn,nl,Xa)}function Ka(e){let t=new Set;for(let n of e.parts.values())for(let r of chunkZFBNCHRP_cjs.Hb(n.root))t.add(r);return t}function rl(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&kt(o,chunkZFBNCHRP_cjs.da,"id")===t){for(let i=o.children.length-1;i>=0;i-=1){let a=o.children[i];if(a.kind!=="paragraph")continue;let s=kt(a,chunkZFBNCHRP_cjs.ga,"paraId");s!==void 0&&chunkZFBNCHRP_cjs.Db(s)&&(n=s.toUpperCase());return}return}for(let i of o.children)r(i);}};return r(e.root),n}function ol(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&kt(o,chunkZFBNCHRP_cjs.da,"id")===t){for(let i=o.children.length-1;i>=0;i-=1){let a=o.children[i];if(a.kind==="paragraph"){n=a;return}}return}for(let i of o.children)r(i);}};return r(e.root),n}function Qa(e){let t=chunkZFBNCHRP_cjs.Ib(e.root);if(t!==null)return {part:e,prefix:t};let n={...e.root,namespaceBindings:[...e.root.namespaceBindings,{prefix:"w14",namespaceUri:chunkZFBNCHRP_cjs.ga}]},r=chunkZFBNCHRP_cjs.La(e,e.root.id,n,{deferValidation:true});return r.ok?{part:r.part,prefix:"w14"}:(chunkZFBNCHRP_cjs.Ia(e.root,n),{part:{...e,root:n},prefix:"w14"})}function Za(e,t,n){return Ie(e.id,"paragraph",e.namespaceUri,e.prefix??"w",e.localName,[...e.attributes.filter(r=>!(r.namespaceUri===chunkZFBNCHRP_cjs.ga&&r.localName==="paraId")),{kind:"genericExtension",namespaceUri:chunkZFBNCHRP_cjs.ga,localName:"paraId",prefix:n,value:t}],e.children,e.namespaceBindings)}function al(e,t,n,r){let o=e.parts.get(t);if(!o)return e;let i=Qa(o),a=chunkZFBNCHRP_cjs.Ga(i.part,n);if(!a||a.kind!=="paragraph")return chunkZFBNCHRP_cjs.ec(e,i.part);let s=chunkZFBNCHRP_cjs.La(i.part,a.id,Za(a,r,i.prefix),{deferValidation:true});return chunkZFBNCHRP_cjs.ec(e,s.ok?s.part:i.part)}function il(e,t,n,r){let o=`${Ga}#comment-${e}`,i=n.text!==n.text.trim(),a=Ie(`${o}.t`,"text",chunkZFBNCHRP_cjs.da,"w","t",i?[{kind:"xmlSpace",namespaceUri:chunkZFBNCHRP_cjs.ea,localName:"space",prefix:"xml",value:"preserve"}]:[],[{id:`${o}.tv`,kind:"textValue",value:n.text}]),s=Ie(`${o}.rPr`,"runProperties",chunkZFBNCHRP_cjs.da,"w","rPr",[],[Ie(`${o}.rStyle`,"generic",chunkZFBNCHRP_cjs.da,"w","rStyle",[nt("val","CommentReference")],[])]),d=Ie(`${o}.r`,"run",chunkZFBNCHRP_cjs.da,"w","r",[],[s,a]),l=Ie(`${o}.pPr`,"paragraphProperties",chunkZFBNCHRP_cjs.da,"w","pPr",[],[Ie(`${o}.pStyle`,"generic",chunkZFBNCHRP_cjs.da,"w","pStyle",[nt("val","CommentText")],[])]),c=Ie(`${o}.p`,"paragraph",chunkZFBNCHRP_cjs.da,"w","p",[{kind:"genericExtension",namespaceUri:chunkZFBNCHRP_cjs.ga,localName:"paraId",prefix:r,value:t}],[l,d]);return Ie(o,"comment",chunkZFBNCHRP_cjs.da,"w","comment",[nt("id",e),nt("author",n.author),...n.initials===void 0?[]:[nt("initials",n.initials)],...n.date===void 0?[]:[nt("date",n.date)]],[c])}function Fn(e,t){let n=chunkZFBNCHRP_cjs.xa(t,{name:e,contentType:"application/xml"});return n.ok?n.part.root:null}function ei(e,t){for(let k of [Ba(t.author),Ha(t.text)])if(k)return {ok:false,reason:An(k)};let n;if(t.date!==void 0){let k=Dn(t.date);if(!k.ok)return {ok:false,reason:An(k.rejection)};n=k.value;}let r={...t,...n===void 0?{}:{date:n}},o=e.package,i=e.part.name,a=jn(o,i),s=qa(o,i),d=o.parts.get(a),l=La(d,r.actorId),c=chunkZFBNCHRP_cjs.Gb(`${a}#${l}`,Ka(o)),m=t.replyToCommentId===void 0?null:rl(d,t.replyToCommentId),u=t.replyToCommentId!==void 0&&m===null?ol(d,t.replyToCommentId):null;if(t.replyToCommentId!==void 0&&m===null&&!u)return {ok:false,reason:"unknown-revision"};let y=u?chunkZFBNCHRP_cjs.Gb(`${a}#parent-${t.replyToCommentId}`,new Set([...Ka(o),c])):null,p=m??y,h=t.anchor.endParagraphId??t.anchor.paragraphId,g=e.transact(k=>{k.applyPackage(f=>{let P=f.parts.has(a)?f:(()=>{let O=Fn(a,`<w:comments xmlns:w="${chunkZFBNCHRP_cjs.da}"/>`);return O?chunkZFBNCHRP_cjs.nc(f,a,O,$n):null})();return P===null?f:_n(P,Ya,a)}),u&&y&&k.applyPackage(f=>al(f,a,u.id,y)),k.applyPackage(f=>{let P=f.parts.get(a);if(!P)return f;let O=Qa(P),b=chunkZFBNCHRP_cjs.Ka(O.part,O.part.root.id,O.part.root.children.length,[il(l,c,r,O.prefix)],{deferValidation:true});return b.ok?chunkZFBNCHRP_cjs.ec(f,b.part):f}),p!==null&&(k.applyPackage(f=>{let P=f.parts.has(s)?f:(()=>{let O=Fn(s,`<w15:commentsEx xmlns:w15="${Se}"/>`);return O?chunkZFBNCHRP_cjs.nc(f,s,O,Bn):null})();return P===null?f:_n(P,Hn,s)}),k.applyPackage(f=>{let P=f.parts.get(s);if(!P)return f;let b=[...sl(P).has(p.toUpperCase())?[]:[Ln(`${s}#ex-${p}`,p,void 0,false)],Ln(`${s}#ex-${c}`,c,p,false)],N=chunkZFBNCHRP_cjs.Ka(P,P.root.id,P.root.children.length,b,{deferValidation:true});return N.ok?chunkZFBNCHRP_cjs.ec(f,N.part):f})),k.applyTo(i,{op:"insertCommentMarker",paragraphId:h,offset:t.anchor.end,commentId:l,marker:"reference"}),k.applyTo(i,{op:"insertCommentMarker",paragraphId:h,offset:t.anchor.end,commentId:l,marker:"end"}),k.applyTo(i,{op:"insertCommentMarker",paragraphId:t.anchor.paragraphId,offset:t.anchor.start,commentId:l,marker:"start"});},r.actorId===void 0?{}:{actorId:r.actorId});return g.ok?{ok:true,commentId:l,change:g.change}:{ok:false,reason:g.reason}}function Un(e){for(let t=e.children.length-1;t>=0;t-=1){let n=e.children[t];if(n.kind==="paragraph")return n}return null}function za(e){let t=Un(e);if(!t)return null;let n=kt(t,chunkZFBNCHRP_cjs.ga,"paraId");return n!==void 0&&chunkZFBNCHRP_cjs.Db(n)?n.toUpperCase():null}function sl(e){let t=new Map;if(!e)return t;let n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===Se&&r.localName==="commentEx"){let o=kt(r,Se,"paraId");o!==void 0&&chunkZFBNCHRP_cjs.Db(o)&&t.set(o.toUpperCase(),r);}for(let o of r.children)n(o);}};return n(e.root),t}function yt(e,t){return {kind:"genericExtension",namespaceUri:Se,localName:e,prefix:"w15",value:t}}function ll(e,t){return {id:e.id,kind:"generic",namespaceUri:e.namespaceUri,localName:e.localName,...e.prefix===void 0?{}:{prefix:e.prefix},namespaceBindings:e.namespaceBindings,attributes:t,children:e.children}}function dl(e,t,n){let r=[],o=false,i=false;for(let a of e.attributes){if(a.namespaceUri===Se&&a.localName==="done"){o=true,r.push({kind:"genericExtension",namespaceUri:a.namespaceUri,localName:a.localName,...a.prefix===void 0?{}:{prefix:a.prefix},value:n?"1":"0"});continue}a.namespaceUri===Se&&a.localName==="paraIdParent"&&(i=true),r.push(a);}return !i&&t!==void 0&&r.push(yt("paraIdParent",t)),o||r.push(yt("done",n?"1":"0")),ll(e,r)}function Ln(e,t,n,r){return {id:e,kind:"generic",namespaceUri:Se,localName:"commentEx",prefix:"w15",namespaceBindings:[],attributes:[yt("paraId",t),...n===void 0?[]:[yt("paraIdParent",n)],yt("done",r?"1":"0")],children:[]}}function ti(e,t,n){return cl(e,t,n,chunkZFBNCHRP_cjs.cg())}function cl(e,t,n,r){let o=e.package,i=e.part.name;if(chunkZFBNCHRP_cjs.dg(o,i)===null)return {ok:false,reason:"unknown-comment"};let s=chunkZFBNCHRP_cjs.gg(o,t,{storyPartName:i},r);if(!s.ok)return {ok:false,reason:"unknown-comment"};let d=chunkZFBNCHRP_cjs.fg(o,r);if(d.truncated||r.truncated)return {ok:false,reason:"unknown-comment"};let l=d.used,c=new Map,m=[];for(let h of s.ids){let g=s.records.get(h);if(!g)return {ok:false,reason:"unknown-comment"};if(!Un(g.node))return {ok:false,reason:"unknown-comment"};let f=za(g.node),P=f??chunkZFBNCHRP_cjs.Gb(`${g.partName}#done-${h}`,l);f===null&&l.add(P),c.set(h,P);}for(let h of s.ids){let g=s.records.get(h),k=Un(g.node),f=c.get(h),P=za(g.node),O=s.parentCommentIdByChildId.get(h),b=s.parentParaIdByCommentId.get(h)??(O===void 0?void 0:c.get(O)),N=s.commentExByParaId.get(f);m.push({paraId:f,stampParagraph:P===null?k:null,commentsPartName:g.partName,parentParaId:b,existing:N?.node,existingParentParaId:N?.parentParaId,existingDone:N?.done??false});}if(m.length===0)return {ok:false,reason:"unknown-comment"};if(m.every(h=>h.existingDone===n))return {ok:true,changed:false,change:null};let u=s.extendedPartName??Xa,y=s.extendedPartName===null,p=e.transact(h=>{h.applyPackage(g=>{let k=Va(g,m,Za);if(k===null)return g;let f=k;if(!f.parts.has(u)){let T=Fn(u,`<w15:commentsEx xmlns:w15="${Se}"/>`);if(!T)return g;let A=chunkZFBNCHRP_cjs.nc(f,u,T,Bn);f=y?_n(A,Hn,u):A;}let P=f.parts.get(u);if(!P)return g;let O=new Map,b=[];for(let T of m){let A=T.existingParentParaId??T.parentParaId;T.existing?O.set(T.existing.id,dl(T.existing,A,n)):b.push(Ln(`${u}#done-${T.paraId}`,T.paraId,A,n));}let N=Wa(P,O,b);return N.ok?chunkZFBNCHRP_cjs.ec(f,N.part):g});});return p.ok?{ok:true,changed:true,change:p.change}:{ok:false,reason:p.reason}}function Ou(e,t){let n=jn(e,t);return e.parts.has(n)&&chunkZFBNCHRP_cjs.hc(e,n)===$n}function Iu(e,t){return jn(e,t)}function Ru(e,t){return qa(e,t)}var ni={kind:"body"};function Tu(e,t,n=ni){let r=n.kind==="body"?null:e.resolveStory(n),o=r?.ok?r.store:e.bodyStore(),i=e.currentPackage(),a=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunkZFBNCHRP_cjs.Ba(e,()=>{let s=ei(o,t);return s.ok&&(o.restoreHistoryStacks(a),e.replacePackageShell(o.package),e.adoptPackageUnit(i),e.publishStoryWrite(s.change)),s},s=>chunkZFBNCHRP_cjs.Ca(s))}function Eu(e,t,n){let r=e.bodyStore(),o=e.currentPackage(),i=r.checkpoint();return r.graftPackage(()=>e.currentPackage()),chunkZFBNCHRP_cjs.Ba(e,()=>{let a=ti(r,t,n);return !a.ok||!a.changed||(r.restoreHistoryStacks(i),e.replacePackageShell(r.package),e.adoptPackageUnit(o),e.publishStoryWrite(a.change)),a},a=>a.ok&&a.changed)}function Mu(e,t,n=ni,r){if(t.length===0)return false;let o=n.kind==="body"?e.bodyStore().part:e.partFor(n);if(!o)return false;let i={storyPartName:o.name,...r===void 0?{}:{noteId:r}},a=e.bodyStore(),s=e.currentPackage(),d=a.checkpoint();return a.graftPackage(()=>e.currentPackage()),chunkZFBNCHRP_cjs.Ba(e,()=>{let l=false,c=false,m=a.transact(u=>{u.applyPackage(y=>{let p=y;for(let h of t){let g=h.parentCommentId===void 0?chunkZFBNCHRP_cjs.pg(p,h.commentId,i):chunkZFBNCHRP_cjs.qg(p,h.commentId,h.parentCommentId,i);if(g===null)return l=true,y;c||=g!==p,p=g;}return p});});return l||!m.ok||!c?false:(a.restoreHistoryStacks(d),e.installPackageSnapshot(a.package),e.adoptPackageUnit(s),e.publishStoryWrite(m.change),true)},l=>l)}var ml=256*1024,ul=4096;function oi(e,t,n){let r=t.payload,o=e.part.name,i=n??o;if(r){if(r.data.length>ml)return {ok:false,reason:"payload-too-large",detail:"data"};if(r.label.length>ul)return {ok:false,reason:"payload-too-large",detail:"label"}}let a=new Set(chunkZFBNCHRP_cjs.Jc(e.part.root).map(u=>u.node.id)),s=t.replaceControlId===void 0?[]:ai(e,o,t.replaceControlId),d=null,l,c=e.transact(u=>{if(t.replaceControlId!==void 0){u.apply({op:"removeContentControl",controlId:t.replaceControlId,keepContent:false});for(let h of s)u.applyPackage(g=>chunkZFBNCHRP_cjs.Mg(g,h.partName,h.nodeId));}let y=t.replaceUntil;if(y!==void 0&&y<=t.offset){d="invalid-range",l="replaceUntil must be past offset";return}if(y!==void 0&&u.apply({op:"deleteText",paragraphId:t.paragraphId,start:t.offset,end:y}),!r){u.apply({op:"insertInlineContentControl",paragraphId:t.paragraphId,offset:t.offset,tag:t.tag,text:t.text,...t.alias===void 0?{}:{alias:t.alias},...t.lock===void 0?{}:{lock:t.lock}});return}let p=null;u.applyPackage(h=>{let g=chunkZFBNCHRP_cjs.Hg(h,i,r.namespaceUri,r.rootLocalName);if(!g.part)return d="store-not-authored",l=`no customXml store could be created for ${r.namespaceUri}. The namespace must be free of control characters and quotes, the root name must be an XML name, and a store this document already carries for that namespace must use the same root name (${r.rootLocalName})`,h;if(p=chunkZFBNCHRP_cjs.Rg(g.part,r.rootLocalName,r.nodeId),!p)return d="unaddressable-payload",l=`the node id ${JSON.stringify(r.nodeId)} or the namespace ${JSON.stringify(r.namespaceUri)} cannot be written into an XPath. Ids and root names must match [A-Za-z_][\\w.-]{0,127}; a namespace may not contain a quote, an angle bracket or an ampersand`,h;let k=chunkZFBNCHRP_cjs.Lg(g.pkg,g.part.partName,{id:r.nodeId,label:r.label,data:r.data});return chunkZFBNCHRP_cjs.Kg(k,g.part.partName,r.nodeId)?k:(d="store-not-authored",l="the payload node could not be written into the store",h)}),!(d!==null||!p)&&u.apply({op:"insertInlineContentControl",paragraphId:t.paragraphId,offset:t.offset,tag:t.tag,text:t.text,...t.alias===void 0?{}:{alias:t.alias},...t.lock===void 0?{}:{lock:t.lock},dataBinding:p});});if(d!==null)return {ok:false,reason:d,...l===void 0?{}:{detail:l}};if(!c.ok)return {ok:false,reason:c.reason,...c.detail===void 0?{}:{detail:c.detail}};let m=pl(e,a);return {ok:true,change:c.change,...m===void 0?{}:{nodeId:m}}}function pl(e,t){for(let n of chunkZFBNCHRP_cjs.Jc(e.part.root))if(!t.has(n.node.id))return n.node.id}function ai(e,t,n){let r=chunkZFBNCHRP_cjs.Jc(e.part.root).find(i=>i.node.id===n);if(!r)return [];let o=[];for(let i of chunkZFBNCHRP_cjs.Fg(e.package,t)){let a=chunkZFBNCHRP_cjs.Ug(r.node,i.itemId);a!==null&&o.push({partName:i.partName,nodeId:a});}return o}function ii(e,t){let n=e.part.name,r=ai(e,n,t),o=e.transact(i=>{i.apply({op:"removeContentControl",controlId:t,keepContent:false});for(let a of r)i.applyPackage(s=>chunkZFBNCHRP_cjs.Mg(s,a.partName,a.nodeId));});return o.ok?{ok:true,change:o.change}:{ok:false,reason:o.reason,...o.detail===void 0?{}:{detail:o.detail}}}function Uu(e,t,n){if(!e.parts.has(t)||n.length===0)return {ok:true,pkg:e,removed:[]};let r=e,o=[];for(let i of n){let a=chunkZFBNCHRP_cjs.Gg(r,t,i);if(!a)continue;let s=chunkZFBNCHRP_cjs.Tg(r,a.itemId),d=chunkZFBNCHRP_cjs.Ng(r,a.partName,s);if(d.pkg===r&&chunkZFBNCHRP_cjs.Jg(r,a.partName).some(l=>!s.has(l.id)))return {ok:false,reason:`the payload store for ${i} refused the sweep`};r=d.pkg,o.push(...d.removed);}return {ok:true,pkg:r,removed:o}}var ri=new WeakMap;function fl(e,t){let n=ri.get(e);n||(n=new Map,ri.set(e,n));let r=n.get(t);if(r)return r;let o=chunkZFBNCHRP_cjs.Fg(e,t).map(i=>({itemId:i.itemId,nodes:new Map(chunkZFBNCHRP_cjs.Jg(e,i.partName).map(a=>[a.id,a]))}));return n.set(t,o),o}function Lu(e,t,n=t){let r=new Map,o=e.parts.get(t);if(!o)return r;let i=fl(e,n);if(i.length===0)return r;for(let a of chunkZFBNCHRP_cjs.Jc(o.root))for(let s of i){let d=chunkZFBNCHRP_cjs.Ug(a.node,s.itemId);if(d===null)continue;let l=s.nodes.get(d);if(l){r.set(a.node.id,{nodeId:d,label:l.label,data:l.data});break}}return r}function $u(e,t,n){let r=new Map,o=chunkZFBNCHRP_cjs.Gg(e,t,n);if(!o)return r;for(let i of chunkZFBNCHRP_cjs.Jg(e,o.partName))r.set(i.id,{label:i.label,data:i.data});return r}var si={kind:"body"};function li(e,t,n){let r=t.kind==="body"?null:e.resolveStory(t),o=r?.ok?r.store:e.bodyStore(),i=e.currentPackage(),a=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunkZFBNCHRP_cjs.Ba(e,()=>{let s=n(o);return s.ok&&(o.restoreHistoryStacks(a),e.replacePackageShell(o.package),e.adoptPackageUnit(i),e.publishStoryWrite(s.change)),s},s=>chunkZFBNCHRP_cjs.Ca(s))}function Vu(e,t,n=si){return li(e,n,r=>oi(r,t,e.bodyStore().part.name))}function Wu(e,t,n=si){return li(e,n,r=>ii(r,t))}var rt="proposed";function gl(e,t){switch(e){case "revisionInsert":case "revisionMoveTo":return t!=="original";case "revisionDelete":case "revisionMoveFrom":return t!=="proposed";default:return false}}function Vn(e,t=rt,n){let r=[];return xt(e.children,t,n,0,r),r}function Wn(e,t,n,r,o=rt,i){let a=[];for(let s of Vn(e,o,i)){let d=t.get(s.id);if(!d||d.end<=d.start)continue;let l=Math.max(d.start,n),c=Math.min(d.end,r);l>=c||a.push({run:s,start:l,end:c});}return a}function xt(e,t,n,r,o){if(!(r>=chunkZFBNCHRP_cjs.la)){for(let i of e)if(!(i.kind==="textValue"||i.kind==="paragraphProperties")){if(i.kind==="run"){o.push(i);continue}if(chunkZFBNCHRP_cjs.na(i)&&!chunkZFBNCHRP_cjs.ka(i.kind)){xt(i.children,t,n,r+1,o);continue}if(chunkZFBNCHRP_cjs.ka(i.kind)){let a=chunkZFBNCHRP_cjs.De(i,"author")??"",s=n?.includesNode?.(i.id,a)??!n?.hiddenAuthors.has(a),d=n&&!s?n.excludedNodeMode?.(i.id,a)??"proposed":t;if(!gl(i.kind,d))continue;xt(i.children,t,n,r+1,o);continue}if(chunkZFBNCHRP_cjs.de(i)){xt(i.children,t,n,r+1,o);continue}if(chunkZFBNCHRP_cjs.Be(i)){let a=chunkZFBNCHRP_cjs.Ce(i);a&&xt(a.children,t,n,r+1,o);continue}}}}var hl=new Set(chunkZFBNCHRP_cjs.Yf),zn=new Set(chunkZFBNCHRP_cjs.Xf);function np(e){return zn.has(e)}function zt(e,t,n){return !e||e.kind==="textValue"?void 0:e.children.find(o=>o.kind===t||o.kind==="generic"&&o.localName===n&&o.namespaceUri===chunkZFBNCHRP_cjs.da)}function Gn(e,t){if(!e||e.kind==="textValue")return [];let n=[];for(let r of e.children){if(r.kind==="textValue"||!t.has(r.localName))continue;let o=chunkZFBNCHRP_cjs.J();for(let i of r.attributes)o[i.localName]=i.value;n.push(Object.keys(o).length>0?{localName:r.localName,attributes:o}:{localName:r.localName});}return n}function rp(e,t){let n=chunkZFBNCHRP_cjs.Ga(e,t);return Gn(zt(n,"paragraphProperties","pPr"),hl)}function yl(e,t){let n=chunkZFBNCHRP_cjs.Ga(e,t),r=zt(n,"paragraphProperties","pPr");return Gn(zt(r,"runProperties","rPr"),zn)}function di(e,t){let n=Array.isArray(t)?t:[t],r=new Set(n.map(i=>i.localName));return [...e.filter(i=>!r.has(i.localName)),...n]}var kl=new Map([["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","cstheme"]]);function xl(e,t){let n=e.find(o=>o.localName==="rFonts")?.attributes;if(!n)return t;let r={...n,...t.attributes??{}};for(let o of Object.keys(t.attributes??{})){let i=kl.get(o);i&&delete r[i];}return {localName:"rFonts",attributes:r}}function Xn(e){let t=new Map;for(let n of chunkZFBNCHRP_cjs.Le(e)){let r=n.formatRunIds&&n.formatRunIds.length>0?n.formatRunIds:n.runId?[n.runId]:[];for(let o of r){let i=t.get(o);i?(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end)):t.set(o,{start:n.start,end:n.end});}}return t}function Pl(e){let t=new Set;for(let n of chunkZFBNCHRP_cjs.Le(e))if(n.formatRunIds)for(let r of n.formatRunIds)t.add(r);return t}function Kn(e,t){if(t.localName==="rFonts")return xl(e,t);if(t.localName!=="u")return t;let n=e.find(r=>r.localName==="u")?.attributes;return n?{localName:"u",attributes:{...n,...t.attributes??{}}}:t}function op(e,t,n){let r=yl(e,t),o=Array.isArray(n)?n:[n];return di(r,o.map(i=>Kn(r,i)))}function Ol(e,t){return Array.isArray(t)?t.map(n=>Kn(e,n)):Kn(e,t)}function ap(e,t,n,r,o,i=rt,a){let s=chunkZFBNCHRP_cjs.Ga(e,t);if(!s||s.kind!=="paragraph")return [];let d=[],l=Pl(s);for(let c of Wn(s,Xn(s),n,r,i,a)){let m=Gn(zt(c.run,"runProperties","rPr"),zn);d.push({start:c.start,end:c.end,properties:di(m,Ol(m,o)),...l.has(c.run.id)?{targetRunIds:[c.run.id]}:{}});}return d}function ip(e,t,n,r,o=rt,i){let a=chunkZFBNCHRP_cjs.Ga(e,t);if(!a||a.kind!=="paragraph"||r<=n)return [];let s=[];for(let d of Wn(a,Xn(a),n,r,o,i)){let l=s[s.length-1];l&&d.start<=l.end?l.end=Math.max(l.end,d.end):s.push({start:d.start,end:d.end});}return s}function sp(e,t,n,r,o=rt,i){let a=chunkZFBNCHRP_cjs.Ga(e,t);if(!a||a.kind!=="paragraph")return [];let s=Xn(a),d=[];for(let l of Vn(a,o,i)){let c=s.get(l.id);if(!c||c.end<=c.start)continue;(r>n?Math.max(c.start,n)<Math.min(c.end,r):c.start<=n&&n<c.end)&&d.push(l);}return d}function Il(e){let t=[],n=r=>{if(r.kind==="textValue"){t.push(r.value);return}for(let o of r.children)n(o);};for(let r of e.blocks)n(r);return t.join("")}function Rl(e){if(e.initials&&e.initials.trim().length>0)return e.initials.trim();let t=e.author.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function $e(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return chunkZFBNCHRP_cjs.Vd(e);if(chunkZFBNCHRP_cjs.be(e))return "";let t="";for(let n of e.children)t+=$e(n);return t}var mi=new WeakMap;function Be(e,t){return mi.set(e,t),e}function Re(e){return mi.get(e)??[]}function up(e){return `${e.kind}-${e.id}`}function ui(e){return e.kind==="revision"?e.ranges:e.range?[e.range]:[]}function vl(e){return ui(e)[0]??null}function Yn(e,t){let n=vl(e);if(!n)return Number.MAX_SAFE_INTEGER;let r=t.get(n.start.paragraphId);return r===void 0?Number.MAX_SAFE_INTEGER:r*1e6+Math.min(n.start.offset,999999)}function bl(e,t){let n=t.get(e.start.paragraphId),r=t.get(e.end.paragraphId);return n===void 0||r===void 0?Number.MAX_SAFE_INTEGER:(r-n)*1e6+(e.end.offset-e.start.offset)}var Nl=0,Sl=1,wl=2;function Tl(e,t,n){let r=n.get(t.paragraphId),o=n.get(e.start.paragraphId),i=n.get(e.end.paragraphId);return r===void 0||o===void 0||i===void 0||r<o||r>i||r===o&&t.offset<e.start.offset||r===i&&t.offset>e.end.offset?null:o===i&&e.start.offset===e.end.offset?Nl:r===i&&t.offset===e.end.offset?wl:Sl}function El(e,t,n){let r=null;for(let o of ui(e)){let i=Tl(o,t,n);if(i===null)continue;let a=bl(o,n);(r===null||i<r.grip||i===r.grip&&a<r.width)&&(r={grip:i,width:a});}return r}var ci={comment:0,custom:1,revision:2};function Ml(e,t,n){let r=[];for(let o of e){let i=El(o,t,n);i!==null&&r.push({item:o,grip:i.grip,width:i.width});}return r.sort((o,i)=>o.grip!==i.grip?o.grip-i.grip:o.width!==i.width?o.width-i.width:o.item.kind!==i.item.kind?ci[o.item.kind]-ci[i.item.kind]:o.item.kind==="revision"&&i.item.kind==="revision"?i.item.nesting-o.item.nesting:0).map(o=>o.item)}function pp(e,t,n){let o=Ml(e,t,n).filter(i=>!(i.kind==="comment"&&i.resolved))[0];return o?o.kind==="comment"?pi(e,o):o:null}function fp(e,t){return pi(e,t)}function pi(e,t){let n=new Map,r=new Map;for(let a of e)a.kind==="comment"?n.set(a.id,a):a.kind==="revision"&&r.set(a.id,a);let o=new Set([t.id]),i=t;for(;i.parentId!==void 0;){let a=n.get(i.parentId);if(!a||o.has(a.id))break;o.add(a.id),i=a;}if(i.parentRevisionId!==void 0){let a=r.get(i.parentRevisionId);if(a)return a}return i}function Jn(e){return yi(e,true)}function kp(e){return yi(e,false)}function yi(e,t){let n=t?gi.get(e.root):void 0;if(n)return n;let r=new Map,o=s=>{let d=t?fi.get(s):void 0;if(d){for(let[c,m]of d)r.set(c,m);return}let l=new Map;Dl(s,l,t),t&&fi.set(s,l);for(let[c,m]of l)r.set(c,m);},i=(s,d)=>{if(!(s.kind==="textValue"||d>64)){if(s.kind==="paragraph"){o(s);return}for(let l of s.children)i(l,d+1);}};i(e.root,0);let a=(s,d)=>{if(!(s.kind==="textValue"||d>64)){if(s.kind==="paragraph"){let l=t?hi.get(s):void 0;if(!l){let c=[];ki(s,0,c,t),l=c,t&&hi.set(s,l);}for(let[c,m]of l)r.set(c,m);return}if(s.kind==="tableRow"){let l=t?Gt.get(s):void 0;l||(l=xi(s),t&&Gt.set(s,l));for(let[c,m]of l)r.set(c,m);}for(let l of s.children)a(l,d+1);}};return a(e.root,0),t&&gi.set(e.root,r),r}function ki(e,t,n,r){if(!(e.kind==="textValue"||t>64)){if(e.kind==="tableRow"){let o=r?Gt.get(e):void 0;o||(o=xi(e),r&&Gt.set(e,o));for(let i of o)n.push(i);}for(let o of e.children)ki(o,t+1,n,r);}}function xi(e){let t=null,n=(a,s)=>{if(!(t||a.kind==="textValue"||s>64)){if(a.kind==="paragraph"){t=a;return}for(let d of a.children)n(d,s+1);}};if(n(e,0),!t)return Cl;let r={paragraphId:t.id,start:0,end:0},o=[],i=(a,s,d)=>{if(a.kind==="textValue"||d>64||a.kind==="paragraph")return;let l=s==="trPr"&&(a.localName==="ins"||a.localName==="del"),c=s==="tcPr"&&(a.localName==="cellIns"||a.localName==="cellDel");(l||c)&&o.push([a.id,r]);for(let m of a.children)i(m,a.localName,d+1);};return i(e,void 0,0),o}var Cl=[],fi=new WeakMap,gi=chunkZFBNCHRP_cjs.hg(8),Gt=new WeakMap,hi=new WeakMap;function Dl(e,t,n){let r=n?chunkZFBNCHRP_cjs.Ne(e):chunkZFBNCHRP_cjs.Pe(e),o=(s,d,l,c)=>{if(!(s.kind==="textValue"||c>64)){t.set(s.id,{paragraphId:e.id,start:d,end:l});for(let m of s.children)o(m,d,l,c+1);}},i=(s,d)=>{if(s.kind==="textValue"||d>64)return;let l=r.spanOf(s);if(s.kind==="run"){if(!l)return;t.set(s.id,{paragraphId:e.id,start:l.start,end:l.end});for(let c of s.children)c.kind==="runProperties"&&o(c,l.start,l.end,d+1);return}l&&t.set(s.id,{paragraphId:e.id,start:l.start,end:l.end});for(let c of s.children)i(c,d+1);};for(let s of e.children)s.kind!=="paragraphProperties"&&i(s,0);let a=e.children.find(s=>s.kind==="paragraphProperties");a&&o(a,r.length,r.length,0);}function Al(e){let t=Pi.get(e.root);if(t)return t;let n=new Map,r=(o,i)=>{if(!(o.kind==="textValue"||i>64)){if(o.kind==="paragraph"){n.has(o.id)||n.set(o.id,n.size);return}if(o.kind==="table"){let a=vi.get(o);if(!a){let s=[],d=(l,c)=>{if(!(l.kind==="textValue"||c>64)){if(l.kind==="paragraph"){s.push(l.id);return}for(let m of l.children)d(m,c+1);}};for(let l of o.children)d(l,0);a=s,vi.set(o,a);}for(let s of a)n.has(s)||n.set(s,n.size);return}for(let a of o.children)r(a,i+1);}};return r(e.root,0),Pi.set(e.root,n),n}var Pi=chunkZFBNCHRP_cjs.hg(8);function qn(e){let t=Ri.get(e.root);if(t)return t;let n=new Map;for(let r of bi(e.root,0))n.has(r)||n.set(r,n.size);return Ri.set(e.root,n),n}var Oi=Object.freeze([]),Ii=new WeakMap;function bi(e,t){if(e.kind==="textValue"||t>64)return Oi;let n=Ii.get(e);if(n&&n.depth===t)return n.ids;let r=null;e.kind==="paragraph"&&(r??=[]).push(e.id);for(let i of e.children){let a=bi(i,t+1);if(a.length!==0){r??=[];for(let s of a)r.push(s);}}let o=r??Oi;return Ii.set(e,{depth:t,ids:o}),o}var Ri=chunkZFBNCHRP_cjs.hg(8),vi=new WeakMap;function Ni(e,t,n,r){if(!e.some(p=>p.revisionKind==="paragraphMark"))return e;let o=new Map,i=(p,h)=>{if(!(p.kind==="textValue"||h>64))for(let g=0;g<p.children.length;g+=1){let k=p.children[g],f=p.children[g+1];k.kind==="paragraph"&&f?.kind==="paragraph"&&o.set(k.id,f.id),i(k,h+1);}};i(t.root,0);let a=e.map((p,h)=>h),s=p=>{for(;a[p]!==p;)a[p]=a[a[p]],p=a[p];return p},d=new Map,l=new Map,c=(p,h,g)=>JSON.stringify([p.revisionKind==="paragraphMark"?p.markDirection:p.revisionKind,p.author,p.nesting,h,g]),m=(p,h,g)=>{let k=p.get(h);k?k.push(g):p.set(h,[g]);};e.forEach((p,h)=>{if(!(p.readOnly||!["insert","delete","paragraphMark"].includes(p.revisionKind)))for(let g of p.ranges)m(d,c(p,g.start.paragraphId,g.start.offset),h),m(l,c(p,g.end.paragraphId,g.end.offset),h);});let u=(p,h)=>{for(let g of h){let k=e[p].date,f=e[g].date;k!==void 0&&f!==void 0&&!chunkZFBNCHRP_cjs.Vf(k,f)||(a[s(g)]=s(p));}};e.forEach((p,h)=>{if(!(p.readOnly||p.revisionKind!=="paragraphMark"||!["insert","delete"].includes(p.markDirection??"")))for(let g of p.ranges){u(h,l.get(c(p,g.start.paragraphId,g.start.offset))??[]);let k=o.get(g.end.paragraphId);k&&u(h,d.get(c(p,k,0))??[]);}});let y=new Map;return e.forEach((p,h)=>{let g=s(h),k=y.get(g);k?k.push(p):y.set(g,[p]);}),[...y.values()].map(p=>{if(p.length===1)return p[0];let h=p.flatMap(O=>O.ranges).sort((O,b)=>n.get(O.start.paragraphId)-n.get(b.start.paragraphId)||O.start.offset-b.start.offset),g=p.flatMap(O=>Re(O)).flatMap(O=>{let b=r.get(O);return b?[b]:[]}).sort((O,b)=>n.get(O.range.start.paragraphId)-n.get(b.range.start.paragraphId)||O.range.start.offset-b.range.start.offset),k=p[0],f=p.find(O=>O.revisionKind!=="paragraphMark"),P=[...new Map(p.flatMap(O=>O.addresses).map(O=>[JSON.stringify(O),O])).values()];return Be({...k,id:p.map(O=>O.id).join("+"),revisionKind:f?.revisionKind??"paragraphMark",...f?{markDirection:void 0}:{},addresses:P,ranges:h,text:f?g.map(O=>O.text).join(""):""},p.flatMap(O=>Re(O)))})}function Qn(e){if(!e.propertyChange||!e.parent)return [];let t=(o,i)=>{let a=o?.children.find(s=>s.kind!=="textValue"&&s.namespaceUri===chunkZFBNCHRP_cjs.da&&s.localName==="lang");return a&&a.kind!=="textValue"?a.attributes.find(s=>s.namespaceUri===chunkZFBNCHRP_cjs.da&&s.localName===i)?.value:void 0},n=e.node.children.find(o=>o.kind!=="textValue"&&o.localName===e.parent.localName),r=[];for(let o of ["val","eastAsia","bidi"]){let i=t(e.parent,o),a=t(n?.kind!=="textValue"?n:void 0,o);i&&i!==a&&!r.includes(i)&&r.push(i);}return r}var _l=[{property:"bold",element:"b",attribute:"val",kind:"toggle"},{property:"italic",element:"i",attribute:"val",kind:"toggle"},{property:"underline",element:"u",attribute:"val"},{property:"strike",element:"strike",attribute:"val",kind:"toggle"},{property:"fontFamily",element:"rFonts",attribute:"ascii"},{property:"fontSize",element:"sz",attribute:"val",kind:"halfPoints"},{property:"color",element:"color",attribute:"val"},{property:"alignment",element:"jc",attribute:"val"},{property:"leftIndent",element:"ind",attribute:"left",kind:"twips"},{property:"rightIndent",element:"ind",attribute:"right",kind:"twips"},{property:"firstLineIndent",element:"ind",attribute:"firstLine",kind:"twips"},{property:"hangingIndent",element:"ind",attribute:"hanging",kind:"twips"},{property:"spaceBefore",element:"spacing",attribute:"before",kind:"twips"},{property:"spaceAfter",element:"spacing",attribute:"after",kind:"twips"}];function Zn(e){if(!e.propertyChange||!e.parent)return [];let t=e.node.children.find(r=>r.kind!=="textValue"&&r.namespaceUri===chunkZFBNCHRP_cjs.da&&r.localName===e.parent.localName),n=[];for(let r of _l){let o=a=>{let s=a?.children.find(l=>l.kind!=="textValue"&&l.namespaceUri===chunkZFBNCHRP_cjs.da&&l.localName===r.element);if(!s||s.kind==="textValue")return null;let d=s.attributes.find(l=>l.namespaceUri===chunkZFBNCHRP_cjs.da&&l.localName===r.attribute)?.value;if(r.kind==="toggle")return d==="0"||d==="false"||d==="off"?"false":"true";if(d===void 0)return null;if(r.kind==="halfPoints"||r.kind==="twips"){let l=Number(d);return Number.isFinite(l)?String(l/(r.kind==="halfPoints"?2:20)):d}return d},i=o(e.parent);i!==o(t?.kind!=="textValue"?t:void 0)&&n.push({property:r.property,value:i});}return n}var Fl={ins:"insert",del:"delete",moveFrom:"moveFrom",moveTo:"moveTo"};function Xt(e,t){for(let n of e.attributes)if(n.localName===t&&n.namespaceUri===chunkZFBNCHRP_cjs.da)return n.value}function er(e){return `${e.id}\0${e.author}\0${e.date??""}`}var Ul={revisionInsert:"insert",revisionDelete:"delete",revisionMoveFrom:"moveFrom",revisionMoveTo:"moveTo"},Ti={retainRevisionItems:true,revisionSites:chunkZFBNCHRP_cjs.mh,locations:Jn,commentAnchors:chunkZFBNCHRP_cjs.jg,deepOrder:qn};function Up(e){return Ei(e,Ti)}function Ei(e,t){let n=e.root.kind!=="paragraph";if(n&&t.retainRevisionItems){let o=Si.get(e.root);if(o&&o.name===e.name)return o.items}let r=Ll(e,t);return n&&t.retainRevisionItems&&Si.set(e.root,{name:e.name,items:r}),r}var Si=chunkZFBNCHRP_cjs.hg(8);function Ll(e,t){let n=t.revisionSites(e);if(n.length===0)return [];let r=t.locations(e),o=n.some(l=>l.paragraphMark),i=new Map,a=new Map;for(let l of n){let c=Xt(l.node,"id");if(c===void 0)continue;let m=Xt(l.node,"author")??"",u=Xt(l.node,"author")===void 0,y=Xt(l.node,"date"),p=y===void 0?{id:c,author:m}:{id:c,author:m,date:y},h=l.propertyChange?"format":l.paragraphMark?"paragraphMark":Ul[l.node.kind]??"structural",g=l.paragraphMark?Fl[l.node.localName]:void 0,k=r.get(l.node.id),f=k?{partName:e.name,start:{paragraphId:k.paragraphId,offset:k.start},end:{paragraphId:k.paragraphId,offset:k.end}}:null;o&&f&&(h==="paragraphMark"||h==="insert"||h==="delete")&&i.set(l.node.id,{range:f,text:h==="paragraphMark"?`
|
|
2
|
+
`:$e(l.node)});let P=h==="structural"?`structural\0${er(p)}`:`${h}\0${l.node.localName}\0${er(p)}`,O=a.get(P);if(O){O.siteNodeIds.push(l.node.id),l.propertyChange&&(O.formattingLanguages=[...new Set([...O.formattingLanguages??[],...Qn(l)])],O.formattingChanges=[...new Map([...O.formattingChanges??[],...Zn(l)].map(b=>[JSON.stringify(b),b])).values()]),f&&!O.ranges.some(b=>b.partName===f.partName&&b.start.paragraphId===f.start.paragraphId&&b.start.offset===f.start.offset&&b.end.paragraphId===f.end.paragraphId&&b.end.offset===f.end.offset)&&O.ranges.push(f),h!=="structural"&&O.revisionKind==="structural"&&(O.revisionKind=h),(h==="insert"&&O.revisionKind==="delete"||h==="delete"&&O.revisionKind==="insert"||O.revisionKind==="replace")&&(O.revisionKind="replace"),O.readOnly||=l.refused||u,l.nesting>O.nesting&&(O.nesting=l.nesting),h==="delete"||h==="moveFrom"?O.deletedText+=$e(l.node):h!=="format"&&h!=="paragraphMark"&&(O.text+=$e(l.node));continue}a.set(P,{address:p,localName:l.node.localName,...l.propertyChange?{formattingLanguages:Qn(l),formattingChanges:Zn(l)}:{},revisionKind:h,...g?{markDirection:g}:{},author:m,...y===void 0?{}:{date:y},text:h==="format"||h==="paragraphMark"||h==="delete"||h==="moveFrom"?"":$e(l.node),deletedText:h==="delete"||h==="moveFrom"?$e(l.node):"",ranges:f?[f]:[],siteNodeIds:[l.node.id],nesting:l.nesting,readOnly:l.refused||u});}let s=[...a.values()].map(l=>Be({kind:"revision",id:`${l.revisionKind}${l.revisionKind==="format"||l.revisionKind==="paragraphMark"?`-${l.localName}`:""}-${e.name}\0${er(l.address)}`,address:l.address,addresses:[l.address],revisionKind:l.revisionKind,...l.revisionKind==="format"?{formattingKind:l.localName}:{},...l.formattingChanges?.length?{formattingChanges:l.formattingChanges}:{},...l.formattingLanguages?.length?{formattingLanguages:l.formattingLanguages}:{},...l.markDirection?{markDirection:l.markDirection}:{},author:l.author,...l.date===void 0?{}:{date:l.date},text:l.revisionKind==="replace"?l.text:l.text||l.deletedText,replacedText:l.revisionKind==="replace"?l.deletedText:"",ranges:l.ranges,nesting:l.nesting,readOnly:l.readOnly,replyIds:[]},l.siteNodeIds)),d=t.deepOrder(e);return $l(Ni(s,e,d,i),d)}function $l(e,t){let n=Bl(e,t),r=n.filter(d=>(d.revisionKind==="insert"||d.revisionKind==="delete")&&!d.readOnly&&d.ranges.length>0),o=new Set,i=new Map,a=new Map;for(let d of r){if(d.revisionKind!=="insert")continue;let l=d.ranges[0].start,c=`${l.paragraphId}\0${l.offset}`,m=a.get(c);m?m.push(d):a.set(c,[d]);}for(let d of r){if(d.revisionKind!=="delete"||o.has(d.id))continue;let l=d.ranges[d.ranges.length-1].end,c=a.get(`${l.paragraphId}\0${l.offset}`)??[],m=c.length>1?[...c].sort((u,y)=>(u.text.length>0?0:1)-(y.text.length>0?0:1)):c;for(let u of m){if(o.has(u.id)||u.author!==d.author)continue;o.add(d.id),o.add(u.id);let y=zl(d.ranges[0],u.ranges[0],t)?d:u,p=Kl(d.date,u.date);i.set(d.id,Be({...y,id:`replace-${d.id}-${u.id}`,revisionKind:"replace",...p===void 0?{}:{date:p},addresses:Wl([...d.addresses,...u.addresses]),text:u.text,replacedText:d.text,ranges:[...d.ranges,...u.ranges],replacedRangeCount:d.ranges.length,readOnly:d.readOnly||u.readOnly},[...Re(d),...Re(u)]));break}}let s=[];for(let d of n){let l=i.get(d.id);if(l){s.push(l);continue}o.has(d.id)||s.push(d);}return s}function Bl(e,t){let n=e.filter(l=>(l.revisionKind==="insert"||l.revisionKind==="delete")&&!l.readOnly&&l.ranges.length>0);if(n.length<2)return e;let r=l=>`${l.paragraphId}\0${l.offset}`,o=new Map;for(let l of n){let c=`${l.revisionKind}\0${l.author}`,m=o.get(c);m?m.push(l):o.set(c,[l]);}let i=(l,c)=>{let m=l.ranges[0].start,u=c.ranges[0].start,y=(t.get(m.paragraphId)??0)-(t.get(u.paragraphId)??0);return y!==0?y:m.offset-u.offset};for(let l of o.values()){let c=true;for(let m=1;m<l.length&&c;m+=1)c=i(l[m-1],l[m])<=0;c||l.sort(i);}let a=new Set,s=new Map;for(let l of o.values()){let c=[],m="",u=()=>{if(c.length>1){s.set(c[0].id,jl(c));for(let y=1;y<c.length;y+=1)a.add(c[y].id);}c=[];};for(let y of l){let p=r(y.ranges[0].start);c.length>0&&p!==m&&u();let h=c.length===0;c.push(y),(h||Hl(y))&&(m=r(y.ranges[y.ranges.length-1].end));}u();}if(s.size===0)return e;let d=[];for(let l of e)a.has(l.id)||d.push(s.get(l.id)??l);return d}function Hl(e){return e.ranges.some(t=>t.start.paragraphId!==t.end.paragraphId||t.start.offset!==t.end.offset)}function jl(e){let t=e[0],n=[...t.addresses],r=[...t.ranges],o=[...Re(t)],i=t.text,a=t.date;for(let s of e.slice(1)){for(let d of s.addresses)n.some(l=>Mi(l,d))||n.push(d);for(let d of s.ranges)r.push(d);for(let d of Re(s))o.push(d);i+=s.text,a=Vl(a,s.date);}return Be({...t,id:e.map(s=>s.id).join("+"),addresses:n,ranges:r,text:i,...a===void 0?{}:{date:a}},o)}function Vl(e,t){if(e===void 0)return t;if(t===void 0)return e;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?e:r>n?t:e}function Wl(e){let t=[];for(let n of e)t.some(r=>Mi(r,n))||t.push(n);return t}function Mi(e,t){return e.id===t.id&&e.author===t.author&&(e.date??"")===(t.date??"")}function Kl(e,t){if(t===void 0)return e;if(e===void 0)return t;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t:n>r?e:t}function zl(e,t,n){let r=n.get(e.start.paragraphId)??0,o=n.get(t.start.paragraphId)??0;return r!==o?r<o:e.start.offset<=t.start.offset}function Gl(e,t,n){let r=new Map(t.map(c=>[c.commentId,c])),o=new Map,i=new Map;for(let c of e)c.paraId&&o.set(c.paraId.toUpperCase(),c),i.set(c.id,c);let a=new Map,s=new Map;for(let c of e){let m=r.get(c.id);if(!m||m.orphaned||m.start.paragraphId===m.end.paragraphId&&m.start.offset===m.end.offset)continue;let u=`${m.start.paragraphId}:${m.start.offset}|${m.end.paragraphId}:${m.end.offset}`;a.has(u)?s.set(c.id,a.get(u)):a.set(u,c.id);}let d=new Map;for(let c of e){let m=c.paraId?n.get(c.paraId.toUpperCase()):void 0,u=m?.parentParaId?o.get(m.parentParaId):void 0,y=c.parentCommentId?i.get(c.parentCommentId):void 0,p=m===void 0?s.get(c.id):void 0,h=p?i.get(p):void 0,g=u??y??h;g&&g.id!==c.id&&d.set(c.id,g.id);}for(let c of [...d.keys()]){let m=new Set([c]),u=d.get(c);for(;u!==void 0;){if(m.has(u)){d.delete(c);break}m.add(u),u=d.get(u);}}let l=new Map;for(let[c,m]of d){let u=l.get(m);u?u.push(c):l.set(m,[c]);}return e.map(c=>{let m=r.get(c.id),u=c.paraId?n.get(c.paraId.toUpperCase()):void 0,y=d.get(c.id);return {kind:"comment",id:c.id,comment:c,range:m?{partName:m.partName,start:m.start,end:m.end}:null,resolved:u?.done??false,...y===void 0?{}:{parentId:y},replyIds:l.get(c.id)??[],orphaned:m===void 0||m.orphaned}})}function Lp(e){return Xl(e,Ti)}function Xl(e,t){let n=[e.storyPart],r=new Set([e.storyPart.name]);for(let c of e.furnitureParts??[])r.has(c.name)||(r.add(c.name),n.push(c));let o=e.commentsPart?chunkZFBNCHRP_cjs.lg(e.commentsPart):[],i=e.commentsExtendedPart?chunkZFBNCHRP_cjs.mg(e.commentsExtendedPart):new Map,a=[],s=[],d=n.length===1?t.deepOrder(n[0]):new Map;for(let c of n){for(let y of Ei(c,t))a.push(y);for(let y of t.commentAnchors(c))s.push(y);if(n.length===1)continue;let m=d,u=m.size;for(let[y,p]of t.deepOrder(c))m.has(y)||m.set(y,u+p);}return Jl([...a,...Gl(o,s,i)]).sort((c,m)=>Yn(c,d)-Yn(m,d))}function Yl(e,t){if(e.kind!=="comment")return e;let n=e.replyIds??[],r=n.filter(i=>t.has(i)),o=e.parentId!==void 0&&!t.has(e.parentId);if(!o&&r.length===n.length)return e;if(o){let{parentId:i,parentRevisionId:a,...s}=e;return r.length===n.length?s:{...s,replyIds:r}}return {...e,replyIds:r}}function wi(e){return `${e.partName}\0${e.start.paragraphId}:${e.start.offset}|${e.end.paragraphId}:${e.end.offset}`}function Jl(e){let t=new Set;for(let d of e)d.kind==="comment"&&t.add(d.id);let n=e.map(d=>Yl(d,t)),r=new Map;for(let d of n)if(d.kind==="revision")for(let l of d.ranges??[]){if(l.start.paragraphId===l.end.paragraphId&&l.start.offset===l.end.offset)continue;let c=wi(l),m=d.nesting??0,u=r.get(c);(u===void 0||m>u.nesting)&&r.set(c,{id:d.id,nesting:m});}let o=new Map;for(let d of n)d.kind==="comment"&&d.replyIds&&d.replyIds.length>0&&o.set(d.id,d.replyIds);let i=d=>{let l=[],c=new Set([d]),m=[...o.get(d)??[]];for(;m.length>0;){let u=m.shift();c.has(u)||(c.add(u),l.push(u),m.push(...o.get(u)??[]));}return l},a=new Map,s=new Map;for(let d of n){if(d.kind!=="comment"||d.parentId!==void 0||d.orphaned||!d.range)continue;let l=r.get(wi(d.range))?.id;if(l===void 0)continue;let c=[d.id,...i(d.id)];for(let u of c)s.set(u,l);let m=a.get(l);m?m.push(...c):a.set(l,c);}return n.map(d=>{if(d.kind==="revision"){let l=a.get(d.id)??[];return l.length===0&&(d.replyIds??[]).length===0?d:Be({...d,replyIds:l},Re(d))}if(d.kind==="comment"){let l=s.get(d.id);if(l===void 0){if(d.parentRevisionId===void 0)return d;let{parentRevisionId:c,...m}=d;return m}return d.parentRevisionId===l?d:{...d,parentRevisionId:l}}return d})}var Vp=256,Wp=2e3,Ci=/[\p{L}\p{N}_]/u;function Di(e){let t=e.toLowerCase();if(t.length===e.length)return t;let n="";for(let r=0;r<e.length;r+=1){let o=e[r],i=o.toLowerCase();n+=i.length===1?i:o;}return n}function ql(e,t,n){let r=t>0?e[t-1]:void 0,o=n<e.length?e[n]:void 0;return !(r!==void 0&&Ci.test(r)||o!==void 0&&Ci.test(o))}function Ql(e){return typeof e=="string"&&e.length>0&&e.length<=256}function Kp(e,t,n,r={}){let o={matches:[],truncated:false};if(!Ql(t)||e.length===0||n<=0)return o;let i=r.matchCase===true,a=r.wholeWord===true,s=i?t:Di(t),d=i?e:Di(e),l=Math.max(0,r.from??0),c=Math.min(e.length,r.to??e.length),m=[],u=d.indexOf(s,l);for(;u>=0;){let y=u+s.length;if(y>c)return {matches:m,truncated:false};if(!a||ql(e,u,y)){if(m.length>=n)return {matches:m,truncated:true};m.push({start:u,length:s.length});}u=d.indexOf(s,y);}return {matches:m,truncated:false}}exports.$=Vu;exports.A=Kd;exports.Aa=Yn;exports.B=Ko;exports.Ba=Ml;exports.C=gs;exports.Ca=pp;exports.D=zo;exports.Da=fp;exports.E=Qe;exports.Ea=Jn;exports.F=Ys;exports.Fa=kp;exports.G=Ua;exports.Ga=Al;exports.H=Ba;exports.Ha=qn;exports.I=Ha;exports.Ia=Up;exports.J=Dn;exports.Ja=Gl;exports.K=Zm;exports.Ka=Lp;exports.L=La;exports.La=Xl;exports.M=ei;exports.Ma=Jl;exports.N=ti;exports.Na=Vp;exports.O=Ou;exports.Oa=Wp;exports.P=Iu;exports.Pa=Di;exports.Q=Ru;exports.Qa=ql;exports.R=Tu;exports.Ra=Ql;exports.S=Eu;exports.Sa=Kp;exports.T=Mu;exports.U=ml;exports.V=ul;exports.W=oi;exports.X=ii;exports.Y=Uu;exports.Z=Lu;exports._=$u;exports.a=bd;exports.aa=Wu;exports.b=Nd;exports.ba=rt;exports.c=Sd;exports.ca=Vn;exports.d=wd;exports.da=Wn;exports.e=Td;exports.ea=hl;exports.f=Ed;exports.fa=zn;exports.g=Qi;exports.ga=np;exports.h=Zi;exports.ha=zt;exports.i=Md;exports.ia=Gn;exports.j=Cd;exports.ja=rp;exports.k=Dd;exports.ka=yl;exports.l=Ye;exports.la=di;exports.m=Ad;exports.ma=xl;exports.n=_d;exports.na=Xn;exports.o=Fd;exports.oa=Pl;exports.p=Pe;exports.pa=Kn;exports.q=Mo;exports.qa=op;exports.r=Ud;exports.ra=ap;exports.s=Ld;exports.sa=ip;exports.t=$d;exports.ta=sp;exports.u=Bd;exports.ua=Il;exports.v=is;exports.va=Rl;exports.w=Hd;exports.wa=Re;exports.x=jd;exports.xa=up;exports.y=Vd;exports.ya=ui;exports.z=Wd;exports.za=vl;
|