@docx-editor.dev/core 2.35.0 → 2.35.1-canary.20261106032727.sha-b131138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +8 -8
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +12 -12
  6. package/dist/binding.js +1 -1
  7. package/dist/{chrome-print-H0uSxdg3.d.ts → chrome-print-D77Z2MRQ.d.ts} +11 -11
  8. package/dist/{chunk-LMASPHYS.js → chunk-27XCGHXI.js} +1 -1
  9. package/dist/chunk-2JVOX642.cjs +236 -0
  10. package/dist/{chunk-2C75IWUN.cjs → chunk-462QYTNK.cjs} +1 -1
  11. package/dist/{chunk-JGE2O6IF.cjs → chunk-5QL7GBV2.cjs} +2 -2
  12. package/dist/{chunk-4NISR27M.cjs → chunk-7AFHVNPA.cjs} +13 -13
  13. package/dist/{chunk-6767S7UF.js → chunk-ASWUP7GU.js} +1 -1
  14. package/dist/{chunk-K2BBJDM7.js → chunk-CCM264XP.js} +1 -1
  15. package/dist/{chunk-NYZP5NM3.js → chunk-CORSCVCC.js} +1 -1
  16. package/dist/{chunk-Q5YVLUGG.js → chunk-FIT3HAWE.js} +1 -1
  17. package/dist/{chunk-SJV6WCTP.cjs → chunk-FTEXTGTC.cjs} +1 -1
  18. package/dist/{chunk-66ZAVRGB.js → chunk-GOXXQ2G3.js} +1 -1
  19. package/dist/{chunk-WWZWT26M.cjs → chunk-GP46C4QJ.cjs} +1 -1
  20. package/dist/{chunk-QDUMZYTX.js → chunk-I7C2C6IZ.js} +1 -1
  21. package/dist/chunk-KIDYIVZ5.js +236 -0
  22. package/dist/{chunk-6BZINLEN.cjs → chunk-Q3OARWRD.cjs} +1 -1
  23. package/dist/{chunk-QLANEOTJ.cjs → chunk-QHE5FKW3.cjs} +4 -4
  24. package/dist/{chunk-TMCMXIBT.js → chunk-R6SVC45W.js} +4 -4
  25. package/dist/{chunk-Y3JSN52G.cjs → chunk-RB55BB5N.cjs} +1 -1
  26. package/dist/{chunk-FLEFHRJG.cjs → chunk-RFM64DRG.cjs} +5 -5
  27. package/dist/{chunk-UAUB5YV6.js → chunk-RTOCN5IQ.js} +1 -1
  28. package/dist/{chunk-2V3V57SC.js → chunk-SCK44KXL.js} +1 -1
  29. package/dist/{chunk-5ZE7ROGP.js → chunk-STK3RNDU.js} +1 -1
  30. package/dist/{chunk-QALWAAPL.cjs → chunk-TRNTPFVY.cjs} +2 -2
  31. package/dist/{chunk-CBJMRC4L.cjs → chunk-TUSRTFEW.cjs} +1 -1
  32. package/dist/{chunk-FMSXJ22B.js → chunk-UMSQMNZU.js} +1 -1
  33. package/dist/{chunk-I4OZW2NO.js → chunk-V5NOTQ6L.js} +1 -1
  34. package/dist/{chunk-AVGSD7FB.js → chunk-XEGE36HF.js} +1 -1
  35. package/dist/{chunk-32YOHLEK.cjs → chunk-Y6FY46N6.cjs} +23 -23
  36. package/dist/{chunk-DSIDCA3V.cjs → chunk-YRJYEXVN.cjs} +4 -4
  37. package/dist/{chunk-TY5CE2JR.cjs → chunk-ZG6KPMLF.cjs} +1 -1
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +3 -3
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.d.ts +2 -2
  42. package/dist/contracts/document.d.ts +2 -2
  43. package/dist/contracts/editor.d.ts +8 -8
  44. package/dist/contracts/modules.d.ts +10 -10
  45. package/dist/contracts/types.d.ts +3 -3
  46. package/dist/{custom-node-writes-Cj0itq58.d.ts → custom-node-writes-BXn8hCVV.d.ts} +2 -2
  47. package/dist/{document-protection-CDLoYQI3.d.ts → document-protection-CfNgyZ4W.d.ts} +1 -1
  48. package/dist/{drawing-graphic-kind-8zt6pugF.d.ts → drawing-graphic-kind-C_kXByHh.d.ts} +2 -2
  49. package/dist/{drawing-preview-package-8o9LSfzP.d.ts → drawing-preview-package-W4jCeIW0.d.ts} +1 -1
  50. package/dist/{editor-CujQcn1z.d.ts → editor-CG4FJl_e.d.ts} +4 -4
  51. package/dist/editor.cjs +1 -1
  52. package/dist/editor.d.ts +25 -25
  53. package/dist/editor.js +1 -1
  54. package/dist/export.cjs +2 -2
  55. package/dist/export.d.ts +6 -6
  56. package/dist/export.js +1 -1
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.d.ts +17 -17
  59. package/dist/index.js +1 -1
  60. package/dist/{layout-shaping-ZjLRz_qa.d.ts → layout-shaping-Cxkd9f_f.d.ts} +1 -1
  61. package/dist/layout.cjs +1 -1
  62. package/dist/layout.d.ts +17 -17
  63. package/dist/layout.js +1 -1
  64. package/dist/{note-properties-BRpskBeh.d.ts → note-properties-DvCg9hqk.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +10 -10
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-GVVQQwCX.d.ts → protocol-BVr4_nzI.d.ts} +2 -2
  69. package/dist/{review-paragraph-order-aEHnQTt7.d.ts → review-paragraph-order-cFZfc4oS.d.ts} +1 -1
  70. package/dist/{revision-projection-vU_UiTLx.d.ts → revision-projection-BcWPdgFd.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection-CaRIISu-.d.ts → semantic-cell-selection-CYS_l73g.d.ts} +2 -2
  72. package/dist/{semantic-interaction-LJtUJJS5.d.ts → semantic-interaction-DyXHZhFO.d.ts} +1 -1
  73. package/dist/{semantic-paint-2LBYlQcn.d.ts → semantic-paint-ChK1a0Qd.d.ts} +4 -4
  74. package/dist/{semantic-record-queries-C_YK2gCz.d.ts → semantic-record-queries-CYAipThi.d.ts} +1 -1
  75. package/dist/{semantic-records-AU2pIYRp.d.ts → semantic-records-D0NEAzyD.d.ts} +3 -3
  76. package/dist/store.cjs +1 -1
  77. package/dist/store.d.ts +12 -12
  78. package/dist/store.js +1 -1
  79. package/dist/{tree-op-types-DmrePCMo.d.ts → tree-op-types-Ds9-dl3T.d.ts} +7 -1
  80. package/dist/{tree-package-fragment-DXZ2B7x0.d.ts → tree-package-fragment-Cya6ExyS.d.ts} +1 -1
  81. package/dist/{tree-session-contract-D3e-5YNq.d.ts → tree-session-contract-DiNorPOQ.d.ts} +4 -4
  82. package/dist/{unsupported-elements-9Pz4I_F6.d.ts → unsupported-elements-CJ33VvL9.d.ts} +1 -1
  83. package/package.json +2 -2
  84. package/dist/chunk-DCILO4XD.cjs +0 -236
  85. package/dist/chunk-P3XUE72N.js +0 -236
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkDCILO4XD_cjs=require('./chunk-DCILO4XD.cjs'),fflate=require('fflate');var zd=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Wd=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Kd=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function el(e){return Wd.test(e)||Kd.test(e)}function ur(e,t){if(!el(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var Xd=/^(\d+)\.(\d+)\.(\d+)$/;function vt(e){let t=Xd.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function fr(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function gr(e,t){let n=vt(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=vt(r.slice(1));return fr(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let a=true;for(let i of o){let s=i.startsWith(">=")?">=":i.startsWith("<")?"<":null;if(!s)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let l=vt(i.slice(s.length)),c=fr(n,l);s===">="?a=a&&c>=0:a=a&&c<0;}return a}return fr(n,vt(r))===0}var Re=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},vo=(e,t)=>`${e}:${t}`;function Yd(e,t={}){let n=new Map;for(let c of e){if(ur(c.id,"extension"),tl(c.version,c.id),n.has(c.id))throw new Re("duplicate-extension",`duplicate extension id ${c.id}`,[c.id]);n.set(c.id,c);for(let d of c.contributions)ur(d.id,d.kind),tl(d.version,`${c.id} \u2192 ${d.id}`),d.replaces&&Qd(d.replaces.targetRange,`${c.id} \u2192 replaces ${d.replaces.targetId}`);}for(let c of e){for(let d of c.dependencies??[])if(!n.has(d))throw new Re("missing-dependency",`${c.id} requires missing extension ${d}`,[c.id,d]);for(let d of c.conflicts??[])if(n.has(d)){let m=[c.id,d].sort();throw new Re("conflict",`extensions ${m[0]} and ${m[1]} conflict`,m)}}Jd(n);let r=new Set(t.availablePorts??[]);for(let c of e)for(let d of c.contributions)d.kind==="runtimePort"&&r.add(d.id);for(let c of e)for(let d of c.requiredPorts??[])if(!r.has(d))throw new Re("missing-port",`${c.id} requires unavailable port ${d}`,[c.id,d]);let o=new Map,a=new Map,i=new Map;for(let c of e)for(let d of c.contributions){let m=vo(d.kind,d.id);if(d.replaces){let f=vo(d.kind,d.replaces.targetId),h=i.get(f)??[];h.push({ext:c.id,c:d}),i.set(f,h);continue}if(a.has(m)){let f=[o.get(m),c.id].sort();throw new Re("id-collision",`${d.kind} id ${d.id} registered by both ${f[0]} and ${f[1]}`,f)}a.set(m,d),o.set(m,c.id);}let s=new Map(a);for(let[c,d]of i){let m=a.get(c);if(!m){let y=d[0];throw new Re("replacement-target-missing",`${y.ext} replaces missing target ${y.c.replaces.targetId}`,[y.ext,y.c.replaces.targetId])}let f=m.replaceable??{kind:"none"};for(let{ext:y,c:P}of d){if(!gr(m.version,P.replaces.targetRange))throw new Re("replacement-version-mismatch",`${y} replaces ${P.replaces.targetId}@${m.version} outside range ${P.replaces.targetRange}`,[y,P.replaces.targetId]);if(f.kind==="none")throw new Re("unauthorized-replacement",`${P.replaces.targetId} does not authorize replacement (attempted by ${y})`,[y,P.replaces.targetId])}let h=qd(m,d);s.set(c,h);}return {extensions:n,contributions:s,get:(c,d)=>s.get(vo(c,d))}}function qd(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((s,l)=>(l.c.replaces.priority??0)-(s.c.replaces.priority??0)),a=o[0].c.replaces.priority??0,i=o.filter(s=>(s.c.replaces.priority??0)===a);if(i.length>1){let s=i.map(l=>l.ext).sort();throw new Re("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${a}: ${s.join(", ")}`,s)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new Re("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function Jd(e){let o=new Map,a=[],i=s=>{o.set(s,1),a.push(s);let l=[...e.get(s)?.dependencies??[]].sort();for(let c of l){let d=o.get(c)??0;if(d===1){let m=a.indexOf(c),f=[...a.slice(m),c];throw new Re("dependency-cycle",`dependency cycle: ${f.join(" -> ")}`,f)}d===0&&i(c);}a.pop(),o.set(s,2);};for(let s of [...e.keys()].sort())(o.get(s)??0)===0&&i(s);}function tl(e,t){try{vt(e);}catch{throw new Re("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Qd(e,t){try{gr("0.0.0",e);}catch{throw new Re("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var wt=class extends Error{constructor(t){super(t),this.name="BudgetError";}},pn=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new chunkDCILO4XD_cjs.u(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new wt(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new wt(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new wt(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new wt(`${this.label}: budget already released`)}};var hr=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},un=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new hr(t.derivedOnly,t._reason)}}}};var yr=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},wo=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new yr(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(chunkDCILO4XD_cjs.k.clock)}identity(){return this.resolve(chunkDCILO4XD_cjs.k.identity)}},Eo=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},To=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Zd(e){let t=chunkDCILO4XD_cjs.p(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",a={id:o,limits:t,config:n,ports:e.ports,budget:new pn(`op:${o}`,r),cancellation:new un};return Object.freeze(a)}function em(e){e.budget.dispose();}var Mo=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),nl=Object.keys(Mo);function tm(e,t){return new chunkDCILO4XD_cjs.u(`${Mo[t].phase}:${t}`,e[t])}var Co=class{counter;current=0;peak=0;constructor(t){this.counter=new chunkDCILO4XD_cjs.u("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function nm(){for(let e of nl){let t=chunkDCILO4XD_cjs.o[e],n=chunkDCILO4XD_cjs.n[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}var Qe="dev.docx-editor.core.comparator",Do={authoredState:{id:`${Qe}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${Qe}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${Qe}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${Qe}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${Qe}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${Qe}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${Qe}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${Qe}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${Qe}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${Qe}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Ao(e,t,n,r={}){let o=Do[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:rl(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let a=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,i=chunkDCILO4XD_cjs.v(t,a),s=chunkDCILO4XD_cjs.v(n,a);return i===s?{equal:true}:{equal:false,left:i,right:s}}}}function _o(e,t){let n=Do[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return chunkDCILO4XD_cjs.w(t,r)}function rl(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>rl(r,t[o],n)):false}var al=new Set([...chunkDCILO4XD_cjs.h,...chunkDCILO4XD_cjs.i]),ol=/^[0-9a-f]{16}$/,rm=/^[0-9a-f]*$/;function Uo(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,a)=>{let i=`step[${a}]`;al.has(o.origin)||n(`${i}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${i}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${i}: baseRevision regressed below ${r}`);let s=o.expect;s.outcome==="applied"?(s.committedRevision===void 0?n(`${i}: applied step needs committedRevision`):s.committedRevision<=o.baseRevision?n(`${i}: committedRevision ${s.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=s.committedRevision,s.modelChange&&om(s.modelChange,i,n)):(s.committedRevision!==void 0&&n(`${i}: ${s.outcome} step must not commit a revision`),s.authoredStateHash!==void 0&&n(`${i}: ${s.outcome} step must not change authored state`)),s.authoredStateHash!==void 0&&!ol.test(s.authoredStateHash)&&n(`${i}: authoredStateHash must be 16-hex`),s.outputHash!==void 0&&!ol.test(s.outputHash)&&n(`${i}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),rm.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function om(e,t,n){al.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function am(e,t){let n=Uo(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,a)=>{let i=`step[${a}]`,s=t.applyStep(o),l=o.expect;if(s.outcome!==l.outcome){r.push(`${i}: outcome ${s.outcome} != expected ${l.outcome}`);return}if(l.outcome==="applied"&&(s.committedRevision!==l.committedRevision&&r.push(`${i}: revision ${s.committedRevision} != expected ${l.committedRevision}`),l.authoredStateHash!==void 0))if(s.authoredState===void 0)r.push(`${i}: store returned no authored state to hash`);else {Ao("authoredState",s.authoredState,s.authoredState).equal||r.push(`${i}: authored state is not self-consistent`);let d=il(s.authoredState);d!==l.authoredStateHash&&r.push(`${i}: authoredStateHash ${d} != expected ${l.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function il(e){return _o("authoredState",e)}var im="urn:schemas-microsoft-com:office:office";function sm(e){return e.namespaceUri!==chunkDCILO4XD_cjs.pa?false:e.localName==="object"?true:e.localName==="pict"&&e.children.some(t=>t.kind!=="textValue"&&t.namespaceUri===im&&t.localName==="OLEObject")}function sl(e){if(e.kind==="textValue")return false;if(chunkDCILO4XD_cjs.ob(e))return chunkDCILO4XD_cjs.Ae(e)!==null;let t=e;return (t.kind==="drawing"||t.namespaceUri===chunkDCILO4XD_cjs.pa&&t.localName==="drawing")&&chunkDCILO4XD_cjs.ze(t)}function lm(e){return e.kind==="textValue"?false:sm(e)||sl(e)}function ll(e,t){let n=[...e];for(;n.length;){let r=n.pop();if(r.kind!=="textValue"){if(t(r))return true;for(let o of r.children)n.push(o);}}return false}function fn(e){return ll(e,lm)}function Og(e){return ll(e,sl)}var cl=24,kr=Object.freeze([Object.freeze({localName:"kern",attributes:Object.freeze({val:"2"})}),Object.freeze({localName:"sz",attributes:Object.freeze({val:String(cl)})}),Object.freeze({localName:"szCs",attributes:Object.freeze({val:String(cl)})})]),Pr=Object.freeze([Object.freeze({localName:"spacing",attributes:Object.freeze({after:"160",line:"278",lineRule:"auto"})})]),ml=Object.freeze({run:true,paragraph:true}),pl=Object.freeze({run:false,paragraph:false});function ul(e){if(!e)return ml;let t=n=>e.children.some(r=>r.kind!=="textValue"&&r.namespaceUri===chunkDCILO4XD_cjs.pa&&r.localName===n);return {run:!t("rPrDefault"),paragraph:!t("pPrDefault")}}function Fo(e,t){return e&&e.namespaceUri!==chunkDCILO4XD_cjs.pa?pl:ul(t)}function Ng(e){return e?e.namespaceUri!==chunkDCILO4XD_cjs.pa?pl:ul(cm(e)):ml}function xr(e,t,n,r){return {id:n,kind:e,namespaceUri:chunkDCILO4XD_cjs.pa,localName:t,prefix:"w",namespaceBindings:[],attributes:[],children:r}}function dl(e,t){let n=e==="rPr"?kr:Pr;return xr(e==="rPr"?"runProperties":"paragraphProperties",e,`${t}-${e}`,n.map(r=>chunkDCILO4XD_cjs.Bk(r,`${t}-${e}-${r.localName}`)))}function cm(e){let t=e.children.find(n=>n.kind!=="textValue"&&n.namespaceUri===chunkDCILO4XD_cjs.pa&&n.localName==="docDefaults");return t&&t.kind!=="textValue"?t:void 0}function fl(e,t,n){let r=Fo(e,t);if(!r.run&&!r.paragraph)return t;let o=[];r.run&&o.push(xr("generic","rPrDefault",`${n}-rPrDefault`,[dl("rPr",n)])),r.paragraph&&o.push(xr("generic","pPrDefault",`${n}-pPrDefault`,[dl("pPr",n)]));let a=r.run?[...o,...t?.children??[]]:[...t?.children??[],...o];return t?{...t,children:a}:xr("generic","docDefaults",`${n}-docDefaults`,a)}var Et="http://schemas.openxmlformats.org/officeDocument/2006/relationships",dm="http://schemas.openxmlformats.org/package/2006/relationships",mm="http://schemas.openxmlformats.org/drawingml/2006/main",yl="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",xl="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",kl="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Pl="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",Ol="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",Lo="application/vnd.openxmlformats-package.relationships+xml",$o=`${Et}/styles`,Bo=`${Et}/numbering`,bl=`${Et}/footnotes`,Rl=`${Et}/endnotes`,Il=`${Et}/officeDocument`,pm=`${Et}/theme`;function We(e){return e.kind!=="textValue"}function gl(e,t){return {...e,children:t}}function ht(e,t){if(t(e),e.kind!=="textValue")for(let n of e.children)ht(n,t);}var um=new Set(["pStyle","rStyle","tblStyle"]);function Ho(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue"&&um.has(r.localName)&&r.namespaceUri===chunkDCILO4XD_cjs.pa){let o=chunkDCILO4XD_cjs.Jh(r,"val");o&&t.add(o);}});}function Vo(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue"&&r.localName==="numId"&&r.namespaceUri===chunkDCILO4XD_cjs.pa){let o=chunkDCILO4XD_cjs.Jh(r,"val");o&&t.add(o);}});}function jo(e){let t=new Set;return gn(e,t),t}function gn(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue")for(let o of r.attributes)o.namespaceUri===Et&&o.value.length>0&&t.add(o.value);});}function He(e){return /^\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}function br(e,t){let n={footnote:new Set,endnote:new Set},r=[],o=a=>{for(let i of a)ht(i,s=>{if(s.kind!=="noteReference")return;let l=s.localName==="footnoteReference"?"footnote":"endnote",c=chunkDCILO4XD_cjs.Jh(s,"id");if(c===void 0)return;let d=He(c);n[l].has(d)||(n[l].add(d),r.push({kind:l,id:d}));});};for(o(e);r.length>0;){let a=r.pop(),i=t(a.kind,a.id);i!==null&&o([i]);}return n}function Go(e,t,n){if(e.kind==="textValue")return e;let r=[],o=false;for(let a of e.children){if(a.kind!=="textValue"&&a.namespaceUri===chunkDCILO4XD_cjs.pa&&(a.localName==="footnoteReference"||a.localName==="endnoteReference")){let l=a.localName==="footnoteReference"?t:n,c=chunkDCILO4XD_cjs.Jh(a,"id");if(a.kind!=="noteReference"||c===void 0||!l.has(He(c))){o=true;continue}}let s=Go(a,t,n);s!==a&&(o=true),r.push(s);}return o?{...e,children:r}:e}function fm(e,t){for(let n of chunkDCILO4XD_cjs.tg(e,t)){if(n.type!==$o||n.targetMode==="External")continue;let r=chunkDCILO4XD_cjs.E(n.ownerPart,n.rawTarget);if(r.ok)return e.parts.get(r.partName)??null}return e.parts.get("/word/styles.xml")??null}function Nl(e,t,n){for(let r of chunkDCILO4XD_cjs.tg(e,t)){if(r.type!==n||r.targetMode==="External")continue;let o=chunkDCILO4XD_cjs.E(r.ownerPart,r.rawTarget);if(o.ok)return e.parts.get(o.partName)??null}return null}function Sl(e,t){let n=fm(e,t),r=new Map,o=[],a=null;if(n&&We(n.root))for(let i of n.root.children){if(!We(i))continue;if(i.localName==="docDefaults"&&i.namespaceUri===chunkDCILO4XD_cjs.pa){a=i;continue}if(i.localName!=="style"||i.namespaceUri!==chunkDCILO4XD_cjs.pa)continue;let s=chunkDCILO4XD_cjs.Jh(i,"styleId");s&&r.set(s,i),(chunkDCILO4XD_cjs.Jh(i,"default")==="1"||chunkDCILO4XD_cjs.Jh(i,"default")==="true")&&o.push(i);}return {part:n,byId:r,defaults:o,docDefaults:a}}var gm=new Set(["basedOn","link","next"]);function vl(e,t){let n=new Set,r=[...t];for(let i of e.defaults){let s=chunkDCILO4XD_cjs.Jh(i,"styleId");s&&r.push(s);}let o=[];for(;r.length>0;){let i=r.pop();if(n.has(i))continue;n.add(i);let s=e.byId.get(i);if(s){o.push(s);for(let l of s.children)if(We(l)&&gm.has(l.localName)&&l.namespaceUri===chunkDCILO4XD_cjs.pa){let c=chunkDCILO4XD_cjs.Jh(l,"val");c&&r.push(c);}}}if(!e.part||!We(e.part.root))return o;let a=new Map;return e.part.root.children.forEach((i,s)=>a.set(i,s)),o.sort((i,s)=>(a.get(i)??0)-(a.get(s)??0))}function zo(e,t,n){let r=Nl(e,t,Bo)??e.parts.get("/word/numbering.xml")??null;if(!r||!We(r.root)||n.size===0)return {part:r,nums:[],abstracts:[]};let o=[],a=new Set;for(let s of r.root.children){if(!We(s)||s.localName!=="num"||s.namespaceUri!==chunkDCILO4XD_cjs.pa)continue;let l=chunkDCILO4XD_cjs.Jh(s,"numId");if(!(!l||!n.has(l))){o.push(s);for(let c of s.children)if(We(c)&&c.localName==="abstractNumId"){let d=chunkDCILO4XD_cjs.Jh(c,"val");d&&a.add(d);}}}let i=[];for(let s of r.root.children){if(!We(s)||s.localName!=="abstractNum"||s.namespaceUri!==chunkDCILO4XD_cjs.pa)continue;let l=chunkDCILO4XD_cjs.Jh(s,"abstractNumId");l&&a.has(l)&&i.push(s);}return {part:r,nums:o,abstracts:i}}var Or={latin:null,eastAsia:null,cs:null};function wl(e,t){let n=Nl(e,t,pm);if(!n)return {major:Or,minor:Or};let r={major:{...Or},minor:{...Or}};return ht(n.root,o=>{if(o.kind==="textValue"||o.namespaceUri!==mm||o.localName!=="majorFont"&&o.localName!=="minorFont")return;let a=o.localName==="majorFont"?r.major:r.minor;for(let i of o.children){if(!We(i))continue;let s=chunkDCILO4XD_cjs.Jh(i,"typeface");s&&(i.localName==="latin"?a.latin=s:i.localName==="ea"?a.eastAsia=s:i.localName==="cs"&&(a.cs=s));}}),{major:r.major,minor:r.minor}}function hm(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 ym=[["asciiTheme","ascii"],["hAnsiTheme","hAnsi"],["eastAsiaTheme","eastAsia"],["cstheme","cs"]],hl=new Set(["themeColor","themeTint","themeShade","themeFill","themeFillTint","themeFillShade"]);function yt(e,t){if(e.kind==="textValue")return e;let n=e.attributes;if(e.localName==="rFonts"&&e.namespaceUri===chunkDCILO4XD_cjs.pa){let a=[],i=new Map;for(let s of e.attributes){let l=ym.find(([c])=>c===s.localName);if(l&&s.namespaceUri===chunkDCILO4XD_cjs.pa){let c=hm(t,s.value);c&&i.set(l[1],c);continue}a.push(s);}for(let[s,l]of i)a.some(c=>c.localName===s)||a.push({kind:"genericExtension",namespaceUri:chunkDCILO4XD_cjs.pa,localName:s,prefix:"w",value:l});n=a;}else e.attributes.some(a=>hl.has(a.localName)&&a.namespaceUri===chunkDCILO4XD_cjs.pa&&e.attributes.some(i=>i.localName==="val"))&&(n=e.attributes.filter(a=>!(hl.has(a.localName)&&a.namespaceUri===chunkDCILO4XD_cjs.pa)));let r=e.children.map(a=>yt(a,t)),o=r.some((a,i)=>a!==e.children[i]);return n===e.attributes&&!o?e:{...e,attributes:n,children:r}}function El(e,t,n){return {id:e,name:e,contentType:t,root:n}}function Tl(e,t){if(e.root.kind==="document"){let r=e.root.children.find(a=>a.kind==="body"),o=r&&We(r)?gl(r,t):{id:"fragment#body",kind:"body",namespaceUri:chunkDCILO4XD_cjs.pa,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return gl(e.root,[o])}let n={id:"fragment#body",kind:"body",namespaceUri:chunkDCILO4XD_cjs.pa,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return {id:"fragment#document",kind:"document",namespaceUri:chunkDCILO4XD_cjs.pa,localName:"document",prefix:"w",namespaceBindings:We(e.root)?e.root.namespaceBindings:[],attributes:[],children:[n]}}function hn(e){let t=e.map(n=>{let r=n.targetMode==="External"?' TargetMode="External"':"";return `<Relationship Id="${chunkDCILO4XD_cjs.W(n.id)}" Type="${chunkDCILO4XD_cjs.W(n.type)}" Target="${chunkDCILO4XD_cjs.W(n.rawTarget)}"${r}/>`}).join("");return `<Relationships xmlns="${dm}">${t}</Relationships>`}function Cl(e,t){let n=t;for(;e.has(`rId${n}`);)n+=1;return `rId${n}`}function Ml(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}function Rr(e,t){return {...e,children:t}}function Ir(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkDCILO4XD_cjs.pa}function yn(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)yn(n,t);return t}function Dl(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=Dl(n,t);if(r)return r}return null}function xm(e){let t=(n,r)=>{if(n.kind==="textValue")return n;if(r&&Ir(n,"vMerge")){if(chunkDCILO4XD_cjs.Jh(n,"val")==="restart")return n;let a=[...n.attributes.filter(i=>!(i.localName==="val"&&i.namespaceUri===chunkDCILO4XD_cjs.pa)),{kind:"wmlVal",namespaceUri:chunkDCILO4XD_cjs.pa,localName:"val",prefix:"w",value:"restart"}];return {...n,attributes:a}}if(n.kind==="paragraph"||n.kind==="table")return n;let o=r||Ir(n,"tc");return Rr(n,n.children.map(a=>t(a,o)))};return Rr(e,e.children.map(n=>t(n,false)))}function Al(e,t){if(!(e.kind==="textValue"||e.kind==="table")){if(Ir(e,"tr")){t.push(e);return}for(let n of e.children)Al(n,t);}}function _l(e,t,n){if(e.kind==="textValue"||e.kind==="table")return {node:e,hadRows:false,keptRows:false};if(Ir(e,"tr")){if(!t.has(e))return {node:null,hadRows:true,keptRows:false};let i=n.value?xm(e):e;return n.value=false,{node:i,hadRows:true,keptRows:true}}let r=false,o=false,a=[];for(let i of e.children){let s=_l(i,t,n);r||=s.hadRows,o||=s.keptRows,s.node!==null&&a.push(s.node);}return r?{node:o?Rr(e,a):null,hadRows:true,keptRows:o}:{node:e,hadRows:false,keptRows:false}}function Ul(e,t,n){let r=[];for(let l of e.children)Al(l,r);let o=new Set(yn(e).filter(l=>t.inRange.has(l)));if(o.size===0)return;let a=r.filter(l=>{let c=yn(l);return c.length>0&&c.every(d=>t.covered.has(d))}),i=new Set(a.flatMap(l=>yn(l)));if(a.length>0&&o.size===i.size&&[...o].every(l=>i.has(l))){let l={value:true},c=new Set(a),d=[];for(let m of e.children){let f=_l(m,c,l);f.node!==null&&d.push(f.node);}n.push(Rr(e,d));return}for(let l of yn(e)){if(!t.inRange.has(l))continue;let c=Dl(e,l);c&&n.push(c);}}var km="http://schemas.openxmlformats.org/package/2006/content-types",Pm=5e4;function Ze(e){return e.kind!=="textValue"}function Fl(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)Fl(n,t);return t}function Wo(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=Wo(n,t);if(r)return r}return null}function Om(){return {id:"fragment#styles",kind:"generic",namespaceUri:chunkDCILO4XD_cjs.pa,localName:"styles",prefix:"w",namespaceBindings:[{prefix:"w",namespaceUri:chunkDCILO4XD_cjs.pa}],attributes:[],children:[]}}function st(e,t){return {...e,children:t}}function bm(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkDCILO4XD_cjs.pa}function Rm(e){if(e.root.kind==="document"){let t=e.root.children.find(n=>n.kind==="body");return t&&Ze(t)?t:null}return Ze(e.root)?e.root:null}function Im(e,t){return Fl(e).some(n=>t.has(n))}function Ko(e,t,n){for(let r of e)if(Ze(r)){if(r.kind==="paragraph"){t.inRange.has(r.id)&&n.push(r);continue}if(t.fullBlocks.has(r.id)){n.push(r);continue}if(r.kind==="table"){Ul(r,t,n);continue}if(r.kind==="contentControl"){let o=r.children.find(a=>a.kind==="contentControlContent");o&&Ze(o)&&Ko(o.children,t,n);continue}Im(r,t.inRange)&&Ko(r.children,t,n);}}var Nm=new Set(["commentRangeStart","commentRangeEnd"]);function Sm(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}function Xo(e){if(e.kind==="textValue")return e;if(Nm.has(e.localName)&&e.namespaceUri===chunkDCILO4XD_cjs.pa||Sm(e)||bm(e,"sectPr"))return null;let t=false,n=[];for(let r of e.children){let o=Xo(r);if(o===null){t=true;continue}o!==r&&(t=true),n.push(o);}return t?st(e,n):e}function vm(e){let t=[],n=l=>{if(l.kind!=="textValue"){if(l.kind==="run"){for(let c of l.children)if(c.kind==="fldChar"){let d=chunkDCILO4XD_cjs.Jh(c,"fldCharType");t.push({nodeId:c.id,type:d==="separate"||d==="end"?d:"begin"});}else c.kind==="instrText"&&t.push({nodeId:c.id,type:"instr"});return}for(let c of l.children)n(c);}};for(let l of e)n(l);if(t.length===0)return e;let r=new Set,o=[],a=null,i=[];for(let l of t){if(l.type==="begin"){o.push({beginId:l.nodeId,separateId:null,instrIds:[]});continue}if(l.type==="separate"){let d=o[o.length-1];d?d.separateId=l.nodeId:a=l.nodeId;continue}if(l.type==="instr"){let d=o[o.length-1];d?d.instrIds.push(l.nodeId):a===null&&i.push(l.nodeId);continue}if(!o.pop()){r.add(l.nodeId),a!==null&&r.add(a);for(let d of i)r.add(d);a=null,i=[];}}for(let l of o){r.add(l.beginId),l.separateId!==null&&r.add(l.separateId);for(let c of l.instrIds)r.add(c);}a!==null&&r.add(a);for(let l of i)r.add(l);if(r.size===0)return e;let s=l=>{if(l.kind==="textValue")return l;if(r.has(l.id))return null;let c=[],d=false;for(let m of l.children){let f=s(m);if(f===null){d=true;continue}f!==m&&(d=true),c.push(f);}return d?st(l,c):l};return e.map(l=>s(l)).filter(l=>l!==null)}function Yo(e){if(e.kind==="textValue")return e.value.length;let t=0;for(let n of e.children)t+=Yo(n);return t}function wm(e,t){let n=[];for(let r of e.children){if(r.kind!=="contentControl"){n.push(r);continue}let o=t.get(r.id),a=Yo(r);if(o===void 0||a>=o){n.push(r);continue}if(a===0)continue;let i=r.children.find(s=>s.kind==="contentControlContent");i&&Ze(i)?n.push(...i.children):n.push(r);}return st(e,n)}function Em(e){let t=new Set,n=new Set,r=i=>{if(i.kind!=="textValue"){if(i.kind==="bookmarkStart"){let s=chunkDCILO4XD_cjs.Jh(i,"id");s!==void 0&&t.add(s);}if(i.kind==="bookmarkEnd"){let s=chunkDCILO4XD_cjs.Jh(i,"id");s!==void 0&&n.add(s);}for(let s of i.children)r(s);}};for(let i of e)r(i);let o=new Set([...t].filter(i=>n.has(i)));if(o.size===t.size&&o.size===n.size)return e;let a=i=>{if(i.kind==="textValue")return i;if(i.kind==="bookmarkStart"||i.kind==="bookmarkEnd"){let c=chunkDCILO4XD_cjs.Jh(i,"id");return c!==void 0&&o.has(c)?i:null}let s=[],l=false;for(let c of i.children){let d=a(c);if(d===null){l=true;continue}d!==c&&(l=true),s.push(d);}return l?st(i,s):i};return e.map(i=>a(i)??i)}function Tm(e,t,n){let r=e.parts.get(t.partName);if(!r)return {ok:false,reason:"unknown-part"};if(t.paragraphIds.length===0)return {ok:false,reason:"empty-range"};let o=t.paragraphIds[0],a=t.paragraphIds[t.paragraphIds.length-1],i=new Map;for(let R of [o,a]){let G=Wo(r.root,R);if(!G)return {ok:false,reason:"empty-range"};for(let W of G.children)W.kind==="contentControl"&&i.set(W.id,Yo(W));}let s=r,l=Wo(s.root,a);if(!l)return {ok:false,reason:"empty-range"};let c=chunkDCILO4XD_cjs.Gi(l);if(t.endOffset<c){let R=chunkDCILO4XD_cjs.Gn(s,{op:"deleteText",paragraphId:a,start:t.endOffset,end:c},{deferValidation:true});if(!R.ok)return {ok:false,reason:"trim-refused"};s=R.part;}if(t.startOffset>0){let R=chunkDCILO4XD_cjs.Gn(s,{op:"deleteText",paragraphId:o,start:0,end:t.startOffset},{deferValidation:true});if(!R.ok)return {ok:false,reason:"trim-refused"};s=R.part;}let d=Rm(s);if(!d)return {ok:false,reason:"unknown-part"};let m={inRange:new Set(t.paragraphIds),covered:new Set(t.coveredParagraphIds),fullBlocks:new Set(t.fullyCoveredBlockIds)},f=[];if(Ko(d.children,m,f),f.length===0)return {ok:false,reason:"empty-range"};if(f.length>Pm)return {ok:false,reason:"resource-limit"};let h=f.map(R=>Xo(R)).filter(R=>R!==null).map(R=>R.kind!=="paragraph"||R.id!==o&&R.id!==a?R:wm(R,i));h=[...vm(h)],h=[...Em(h)];let y=chunkDCILO4XD_cjs.pj(e,"footnote"),P=chunkDCILO4XD_cjs.pj(e,"endnote"),T=(R,G)=>Ze(R)&&R.namespaceUri===chunkDCILO4XD_cjs.pa&&R.localName===G,p=br(h,(R,G)=>{let W=R==="footnote"?y:P;if(!W||!Ze(W.root))return null;for(let re of W.root.children){if(!T(re,R))continue;let Y=chunkDCILO4XD_cjs.Jh(re,"id");if(Y!==void 0&&He(Y)===G)return re}return null}),x=p.footnote,k=p.endnote;x.size===0&&(y=null),k.size===0&&(P=null);let v=(R,G,W)=>{if(!R||!Ze(R.root))return [];let re=[];for(let Y of R.root.children){if(!T(Y,G))continue;let se=chunkDCILO4XD_cjs.Jh(Y,"id"),g=chunkDCILO4XD_cjs.Jh(Y,"type");if(g==="separator"||g==="continuationSeparator"){re.push(Y);continue}if(se!==void 0&&W.has(He(se))){let u=Xo(Y);u&&Ze(u)&&re.push(u);}}return re},A=v(y,"footnote",x),O=v(P,"endnote",k),D=[...A,...O];if(fn(h)||fn(D))return {ok:false,reason:"unsupported-content"};let F=[...h,...D],w=new Set;Ho(F,w);let N=Sl(e,e.mainDocumentPart),S=new Set;Vo(F,S);let I=[],_=zo(e,e.mainDocumentPart,S);for(;;){let R=w.size,G=S.size;I=vl(N,w),Vo(I,S),_=zo(e,e.mainDocumentPart,S);let W=[..._.nums,..._.abstracts];Ho(W,w);for(let re of W)ht(re,Y=>{if(Y.kind!=="textValue"&&(Y.localName==="styleLink"||Y.localName==="numStyleLink")&&Y.namespaceUri===chunkDCILO4XD_cjs.pa){let se=chunkDCILO4XD_cjs.Jh(Y,"val");se&&w.add(se);}});if(w.size===R&&S.size===G)break}let q=wl(e,e.mainDocumentPart),ee=I.map(R=>yt(R,q)),K=N.part&&Ze(N.part.root)?N.part.root:null,ae=fl(K,N.docDefaults,"fragment#doc-defaults"),B=ae?yt(ae,q):null;h=h.map(R=>yt(R,q));let V=A.map(R=>yt(R,q)),z=O.map(R=>yt(R,q)),ne=new Set;gn(h,ne);let ie=chunkDCILO4XD_cjs.tg(e,r.name).filter(R=>ne.has(R.id)),Ne=new Map,Xe=0,Ce=R=>{let G=new Set;for(let W of R){if(W.targetMode==="External")continue;let re=chunkDCILO4XD_cjs.E(W.ownerPart,W.rawTarget);if(!re.ok){G.add(W.id);continue}if((chunkDCILO4XD_cjs.ug(e,re.partName)??"").toLowerCase().startsWith("image/")&&n?.omitMedia!==true){let se=e.partBytes.get(re.partName)??e.partBytes.get(re.partName.replace(/^\//,""));se?(Ne.set(re.partName,se),Xe+=se.byteLength):G.add(W.id);continue}G.add(W.id);}return G},Ve=Ce(ie),J=(R,G)=>{if(R.kind==="textValue")return R;if(R.kind==="drawing"||R.namespaceUri===chunkDCILO4XD_cjs.pa&&(R.localName==="pict"||R.localName==="object")){let Y=new Set;gn([R],Y);for(let se of Y)if(G.has(se))return null;return R}let W=[],re=false;for(let Y of R.children){let se=J(Y,G);if(se===null){re=true;continue}se!==Y&&(re=true),W.push(se);}return re?st(R,W):R};Ve.size>0&&(h=h.map(R=>J(R,Ve)).filter(R=>R!==null));let Me=ie.filter(R=>!Ve.has(R.id)),de=(R,G)=>{if(!R)return [];let W=new Set;gn(G,W);let re=chunkDCILO4XD_cjs.tg(e,R.name).filter(se=>W.has(se.id)),Y=Ce(re);if(Y.size>0)for(let se=0;se<G.length;se+=1){let g=J(G[se],Y);g!==null&&(G[se]=g);}return re.filter(se=>!Y.has(se.id))},At=de(y,V),dt=de(P,z),Pe=new Map,tt=[],nn=new Map,Oe=(R,G,W)=>{let re=El(R,G,W);Pe.set(R.slice(1),chunkDCILO4XD_cjs.bf(chunkDCILO4XD_cjs.Ha(re))),tt.push([R,G]),nn.set(R,re);},b=(R,G)=>R.map(W=>{if(W.targetMode==="External")return {...W,ownerPart:G};let re=chunkDCILO4XD_cjs.E(W.ownerPart,W.rawTarget);return {...W,ownerPart:G,rawTarget:re.ok?re.partName:W.rawTarget}}),U=b(Me,"/word/document.xml"),$=b(At,"/word/footnotes.xml"),j=b(dt,"/word/endnotes.xml"),X=new Set(U.map(R=>R.id)),Z=9001,me=(R,G)=>{let W=Cl(X,Z);Z+=1,X.add(W),U.push({ownerPart:"/word/document.xml",id:W,type:R,rawTarget:G,targetMode:"Internal",order:U.length});},we=Tl(s,h);if(Oe("/word/document.xml",yl,we),ee.length>0||B){let R=st(K??Om(),[...B?[B]:[],...ee]);Oe("/word/styles.xml",xl,R),me($o,"styles.xml");}if(_.part&&(_.nums.length>0||_.abstracts.length>0)){let R=st(_.part.root,[..._.abstracts.map(G=>yt(G,q)),..._.nums]);Oe("/word/numbering.xml",kl,R),me(Bo,"numbering.xml");}y&&V.length>0&&(Oe("/word/footnotes.xml",Pl,st(y.root,V)),me(bl,"footnotes.xml"),$.length>0&&Pe.set("word/_rels/footnotes.xml.rels",chunkDCILO4XD_cjs.bf(hn($)))),P&&z.length>0&&(Oe("/word/endnotes.xml",Ol,st(P.root,z)),me(Rl,"endnotes.xml"),j.length>0&&Pe.set("word/_rels/endnotes.xml.rels",chunkDCILO4XD_cjs.bf(hn(j))));let xe=new Map;for(let[R,G]of Ne){Pe.set(R.slice(1),G);let W=Ml(R);W&&!xe.has(W)&&xe.set(W,chunkDCILO4XD_cjs.H(chunkDCILO4XD_cjs.ug(e,R)??"application/octet-stream"));}let De={ownerPart:"/",id:"rId1",type:Il,rawTarget:"word/document.xml",targetMode:"Internal",order:0};Pe.set("word/_rels/document.xml.rels",chunkDCILO4XD_cjs.bf(hn(U))),Pe.set("_rels/.rels",chunkDCILO4XD_cjs.bf(hn([De])));let Ye=[`<Default Extension="rels" ContentType="${Lo}"/>`,'<Default Extension="xml" ContentType="application/xml"/>',...[...xe].map(([R,G])=>`<Default Extension="${chunkDCILO4XD_cjs.W(R)}" ContentType="${chunkDCILO4XD_cjs.W(G)}"/>`)].join(""),Ae=tt.map(([R,G])=>`<Override PartName="${chunkDCILO4XD_cjs.W(R)}" ContentType="${chunkDCILO4XD_cjs.W(G)}"/>`).join("");Pe.set("[Content_Types].xml",chunkDCILO4XD_cjs.bf(`<Types xmlns="${km}">${Ye}${Ae}</Types>`));let _e=new Map;_e.set("/",[De]),_e.set("/word/document.xml",U),$.length>0&&_e.set("/word/footnotes.xml",$),j.length>0&&_e.set("/word/endnotes.xml",j);let le=[];for(let R of _e.values())for(let G of R)G.targetMode==="External"&&le.push({ownerPart:G.ownerPart,id:G.id,type:G.type,rawTarget:G.rawTarget,sinkSafe:chunkDCILO4XD_cjs.F(G.rawTarget).ok});let pe=new Map;pe.set("rels",Lo),pe.set("xml","application/xml");for(let[R,G]of xe)pe.set(R,G);let qe={defaults:pe,overrides:new Map(tt)},mt=new Map;for(let[R,G]of Pe)mt.set(R.startsWith("/")?R:`/${R}`,G);return {ok:true,bytes:chunkDCILO4XD_cjs.af(Pe),package:Object.freeze({parts:nn,partBytes:mt,relationships:_e,externalTargets:le,contentTypes:qe,mainDocumentPart:"/word/document.xml"}),lastMarkCovered:t.lastMarkCovered,blockCount:h.length,mediaBytes:Xe}}function ue(e){return e.kind!=="textValue"}function oe(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkDCILO4XD_cjs.pa}function Ke(e,t){for(let n of e)t(n),n.kind!=="textValue"&&Ke(n.children,t);}function xt(e){if(e.kind==="textValue")return `T(${e.value})`;if(e.namespaceUri===chunkDCILO4XD_cjs.pa&&e.localName.startsWith("rsid"))return "";let t=e.attributes.filter(r=>!r.localName.startsWith("rsid")&&!(r.namespaceUri===chunkDCILO4XD_cjs.ua&&(r.localName==="paraId"||r.localName==="textId"))).map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(","),n=e.children.map(xt).join("");return `E(${e.namespaceUri}:${e.localName}[${t}]{${n}})`}function kn(e){return `S[${e.attributes.filter(n=>n.localName!=="styleId").map(n=>`${n.localName}=${n.value}`).sort().join(",")}]${e.children.map(xt).join("")}`}function vr(e){let t=[],n=new Map,r=new Set,o=null;if(e&&ue(e.root))for(let a of e.root.children){if(!ue(a))continue;if(oe(a,"docDefaults")){o=a;continue}if(!oe(a,"style"))continue;t.push(a);let i=chunkDCILO4XD_cjs.Jh(a,"styleId");i&&n.set(i,a);let s=a.children.find(c=>oe(c,"name")),l=s?chunkDCILO4XD_cjs.Jh(s,"val"):void 0;l&&r.add(l);}return {part:e,styles:t,docDefaults:o,byId:n,names:r}}function Nr(e,t,n){let r=new Map;if(!e)return r;let o=e.children.find(i=>oe(i,t));if(!o||!ue(o))return r;let a=o.children.find(i=>oe(i,n));if(!a||!ue(a))return r;for(let i of a.children)i.kind!=="textValue"&&r.set(i.localName,i);return r}function $l(e){let t=e.part?.root;return t&&ue(t)?t:null}function Ll(e){return Fo($l(e),e.docDefaults)}function Sr(e){return new Map(e.map(t=>[t.localName,chunkDCILO4XD_cjs.Bk(t,`fragment#application-${t.localName}`)]))}function Cm(e,t){let n=new Set,r=t;for(let o=0;o<16&&r;o+=1){let a=e.byId.get(r);if(!a)break;let s=xn(a,"pPr")?.children.find(c=>oe(c,"spacing"));if(s&&ue(s))for(let c of s.attributes)n.add(c.localName);let l=a.children.find(c=>oe(c,"basedOn"));r=l?chunkDCILO4XD_cjs.Jh(l,"val"):void 0;}return n}function qo(e,t,n,r){let o=t;for(let a=0;a<16&&o;a+=1){let i=e.byId.get(o);if(!i)return false;let s=i.children.find(c=>oe(c,n));if(s&&ue(s)&&s.children.some(c=>c.kind!=="textValue"&&c.localName===r))return true;let l=i.children.find(c=>oe(c,"basedOn"));o=l?chunkDCILO4XD_cjs.Jh(l,"val"):void 0;}return false}function Mm(e,t){for(let n of e.styles){if(chunkDCILO4XD_cjs.Jh(n,"type")!==t)continue;let r=chunkDCILO4XD_cjs.Jh(n,"default");if(r==="1"||r==="true")return chunkDCILO4XD_cjs.Jh(n,"styleId")}}function xn(e,t){let n=e.children.find(r=>oe(r,t));return n&&ue(n)?n:null}var Dm=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])),Am=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 Jo(e,t,n){let r=$l(t)?Ll(t):null,o=Ll(n),a=r?.run?Sr(kr):Nr(t.docDefaults,"rPrDefault","rPr"),i=o.run?Sr(kr):Nr(n.docDefaults,"rPrDefault","rPr"),s=r?.paragraph?Sr(Pr):Nr(t.docDefaults,"pPrDefault","pPr"),l=o.paragraph?Sr(Pr):Nr(n.docDefaults,"pPrDefault","pPr"),c=(x,k,v)=>{let A=Mm(x,"paragraph"),O=A?x.byId.get(A):void 0;if(!O)return A;for(let[D,F]of [["rPr",k],["pPr",v]]){let w=xn(O,D);if(w)for(let N of w.children)N.kind!=="textValue"&&F.set(N.localName,N);}return A};c(t,a,s),c(n,i,l);let d=new Map;for(let[x,k]of a){let v=i.get(x);(!v||xt(v)!==xt(k))&&d.set(x,k);}let m=new Map;for(let[x,k]of s){if(x==="sectPr")continue;let v=l.get(x);(!v||xt(v)!==xt(k))&&m.set(x,k);}if(d.size===0&&m.size===0)return e;let f=0,h=()=>`fragment#materialized-${f++}`,y=x=>{let k=v=>v.kind==="textValue"?{id:h(),kind:"textValue",value:v.value}:{...v,id:h(),children:v.children.map(k)};return k(x)},P=(x,k,v)=>{if(v.length===0)return x;let A=xn(x,k);if(A){let D=k==="rPr"?Am:Dm,F=[...A.children];for(let N of v){let S=N.kind==="textValue"?Number.MAX_SAFE_INTEGER:D.get(N.localName)??Number.MAX_SAFE_INTEGER,I=F.length;for(let _=0;_<F.length;_+=1){let q=F[_];if(q.kind==="textValue")continue;let ee=D.get(q.localName);if(ee!==void 0&&ee>S){I=_;break}}F.splice(I,0,N);}let w={...A,children:F};return {...x,children:x.children.map(N=>N===A?w:N)}}let O={id:h(),kind:k==="rPr"?"runProperties":"paragraphProperties",namespaceUri:chunkDCILO4XD_cjs.pa,localName:k,prefix:"w",namespaceBindings:[],attributes:[],children:v};return {...x,children:[O,...x.children]}},T=(x,k,v,A,O)=>{let D=Cm(t,O),F=k.children.find(_=>oe(_,"spacing"));if(F&&ue(F))for(let _ of F.attributes)D.add(_.localName);let w=new Map(A&&ue(A)?A.attributes.map(_=>[_.localName,_.value]):[]),N=v.attributes.filter(_=>!D.has(_.localName)&&w.get(_.localName)!==_.value);if(N.length===0)return x;let S=F&&ue(F)?{...F,attributes:[...F.attributes,...N]}:{...v,id:h(),attributes:N,children:[]},I=F?{...k,children:k.children.map(_=>_===F?S:_)}:P(x,"pPr",[S]).children.find(_=>oe(_,"pPr"));return {...x,children:x.children.map(_=>_===k?I:_)}},M=x=>{let k=xn(x,"pPr"),v=k?.children.find(N=>oe(N,"pStyle")),A=v?chunkDCILO4XD_cjs.Jh(v,"val"):void 0,O=[],D=x;for(let[N,S]of m){let I=k?.children.some(q=>q.kind!=="textValue"&&q.localName===N),_=!!A&&qo(t,A,"pPr",N);N==="spacing"&&(I||_)&&k!==null&&ue(S)&&(D=T(D,k,S,l.get("spacing"),A)),!(I||_)&&O.push(y(S));}let F=N=>{if(N.kind==="textValue")return N;if(N.kind==="run"){let I=xn(N,"rPr"),_=I?.children.find(K=>oe(K,"rStyle")),q=_?chunkDCILO4XD_cjs.Jh(_,"val"):void 0,ee=[];for(let[K,ae]of d)I?.children.some(V=>V.kind!=="textValue"&&V.localName===K)||q&&qo(t,q,"rPr",K)||A&&qo(t,A,"rPr",K)||ee.push(y(ae));return P(N,"rPr",ee)}if(N.kind==="paragraphProperties"||N.kind==="runProperties")return N;let S=N.children.map(F);return S.some((I,_)=>I!==N.children[_])?{...N,children:S}:N};return F(P(D,"pPr",O))},p=x=>{if(x.kind==="textValue")return x;if(x.kind==="paragraph")return M(x);let k=x.children.map(p);return k.some((v,A)=>v!==x.children[A])?{...x,children:k}:x};return e.map(p)}var Bl="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Ie(e,t,n,r){return {...e,attributes:e.attributes.map(o=>o.localName===n&&o.namespaceUri===t?{...o,value:r}:o)}}var _m=new Set(["pStyle","rStyle","tblStyle","basedOn","link","next","styleLink","numStyleLink"]),Qo=chunkDCILO4XD_cjs.Pb,lt=new Map;function zt(e,t){let n=t.styleIds??lt,r=t.numIds??lt,o=t.relIds??lt,a=t.footnoteIds??lt,i=t.endnoteIds??lt,s=t.bookmarkIds??lt,l=t.sdtIds??lt,c=t.revisionIds??lt,d=t.docPrIds??lt,m=(f,h)=>{if(f.kind==="textValue")return f;let y=f;if(f.namespaceUri===chunkDCILO4XD_cjs.pa&&_m.has(f.localName)){let p=chunkDCILO4XD_cjs.Jh(f,"val"),x=p!==void 0?n.get(p):void 0;x!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"val",x));}if(oe(f,"numId")){let p=chunkDCILO4XD_cjs.Jh(f,"val"),x=p!==void 0?r.get(p):void 0;x!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"val",x));}if(f.kind==="noteReference"){let p=f.localName==="footnoteReference"?a:i,x=chunkDCILO4XD_cjs.Jh(f,"id"),k=x!==void 0?p.get(He(x)):void 0;k!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"id",k));}if(f.kind==="bookmarkStart"||f.kind==="bookmarkEnd"){let p=chunkDCILO4XD_cjs.Jh(f,"id"),x=p!==void 0?s.get(p):void 0;x!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"id",x));}if(oe(f,"id")&&h==="sdtPr"){let p=chunkDCILO4XD_cjs.Jh(f,"val"),x=p!==void 0?l.get(p):void 0;x!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"val",x));}if(Qo(f)){let p=chunkDCILO4XD_cjs.Jh(f,"id"),x=p!==void 0?c.get(p):void 0;x!==void 0&&(y=Ie(y,chunkDCILO4XD_cjs.pa,"id",x));}if(f.kind==="drawingDocPr"){let p=f.attributes.find(k=>k.localName==="id"&&k.namespaceUri==="")?.value,x=p!==void 0?d.get(p):void 0;x!==void 0&&(y=Ie(y,"","id",x));}for(let p of y.attributes){if(p.namespaceUri!==Bl)continue;let x=o.get(p.value);x!==void 0&&x!==p.value&&(y=Ie(y,Bl,p.localName,x));}let P=f.localName,T=y.children.map(p=>m(p,P));return y!==f||T.some((p,x)=>p!==y.children[x])?{...y,children:T}:f};return m(e,"")}function Hl(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 Vl(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 Um=1e5;function jl(e){let t=chunkDCILO4XD_cjs.Ib(),n=Fm(e,t),r=Lm(e,t),o=$m(e,t);return !n||!r||!o?null:{bookmarkIds:n,revisionIds:r,docPrIds:o}}function Zo(e,t,n,r){if(e)return chunkDCILO4XD_cjs.Lb(t,e,r);let o=n;return ()=>{for(;t.has(String(o));)o+=1;return o>r?null:String(o++)}}function Gl(e,t){if(e.add(t),!/^\d{1,10}$/.test(t))return;let n=Number(t);n<=chunkDCILO4XD_cjs.Fb&&e.add(String(n));}function zl(e,t){if(t===void 0)return e;let n=Number(t);return Number.isInteger(n)&&n>e?n:e}function Fm(e,t){let n=new Map;if(e.fragmentBookmarkIds.length===0)return n;let r=0,o=new Set;for(let i of [e.ownerPart,...e.notesParts])Ke([i.root],s=>{if(s.kind!=="bookmarkStart"&&s.kind!=="bookmarkEnd")return;let l=chunkDCILO4XD_cjs.Jh(s,"id");l!==void 0&&(Gl(o,l),s.kind==="bookmarkStart"&&(r=zl(r,l)));});let a=Zo(t,o,r+1,chunkDCILO4XD_cjs.Fb);for(let i of e.fragmentBookmarkIds){if(n.has(i))continue;let s=a();if(s===null)return null;n.set(i,s);}return n}function Lm(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 l=s===e.ownerPart;Ke([s.root],c=>{if(!chunkDCILO4XD_cjs.Pb(c))return;let d=chunkDCILO4XD_cjs.Jh(c,"id");d!==void 0&&Gl(o,d),l&&(r=zl(r,d));});}let a=Zo(t,o,r+1,chunkDCILO4XD_cjs.Fb),i=false;return Ke(e.travelling,s=>{if(i||!chunkDCILO4XD_cjs.Pb(s))return;let l=chunkDCILO4XD_cjs.Jh(s,"id");if(l===void 0||n.has(l))return;let c=a();c===null?i=true:n.set(l,c);}),i?null:n}function $m(e,t){let n=new Map;if(!e.hasDocPr)return n;let{used:r}=chunkDCILO4XD_cjs.Zf(e.pkg),o=Um;if(!t){let s=chunkDCILO4XD_cjs._f(e.pkg);s.ok&&(o=s.id);}let a=Zo(t,r,o,chunkDCILO4XD_cjs.Yf),i=false;return Ke(e.travelling,s=>{if(i||s.kind==="textValue"||s.kind!=="drawingDocPr")return;let l=s.attributes.find(d=>d.localName==="id"&&d.namespaceUri==="")?.value;if(l===void 0||n.has(l))return;let c=a();c===null?i=true:n.set(l,c);}),i?null:n}function Wl(e,t){return `${t?kn(t):"none"}::${e.children.filter(n=>oe(n,"lvlOverride")).map(xt).join("")}`}function Kl(e){let t=e.children.find(n=>oe(n,"abstractNumId"));return t?chunkDCILO4XD_cjs.Jh(t,"val"):void 0}function Xl(e,t,n){let r=new Set(["0"]),o=0;for(let s of e?.root.children??[]){if(!ue(s)||!oe(s,t))continue;let l=chunkDCILO4XD_cjs.Jh(s,n);if(l===void 0)continue;let c=Number(l);Number.isInteger(c)&&(r.add(String(c)),c>o&&(o=c));}let a=chunkDCILO4XD_cjs.Ib();if(a)return chunkDCILO4XD_cjs.Lb(r,a,chunkDCILO4XD_cjs.Gb);let i=o+1;return ()=>String(i++)}function Yl(e,t){let n={numIdMap:new Map,numsToImport:[],abstractsToImport:[]};if(!e||!ue(e.root))return n;let r=new Map,o=[];for(let c of e.root.children)if(ue(c))if(oe(c,"abstractNum")){let d=chunkDCILO4XD_cjs.Jh(c,"abstractNumId");d&&r.set(d,c);}else oe(c,"num")&&o.push(c);let a=new Map;if(t&&ue(t.root)){let c=new Map;for(let d of t.root.children){if(!ue(d)||!oe(d,"abstractNum"))continue;let m=chunkDCILO4XD_cjs.Jh(d,"abstractNumId");m&&c.set(m,d);}for(let d of t.root.children){if(!ue(d)||!oe(d,"num"))continue;let m=chunkDCILO4XD_cjs.Jh(d,"numId");if(!m)continue;let f=Kl(d),h=f?c.get(f):void 0;a.set(Wl(d,h),m);}}let i=Xl(t,"abstractNum","abstractNumId"),s=Xl(t,"num","numId"),l=new Map;for(let c of o){let d=chunkDCILO4XD_cjs.Jh(c,"numId");if(!d)continue;let m=Kl(c),f=m?r.get(m):void 0,h=Wl(c,f),y=a.get(h);if(y!==void 0){n.numIdMap.set(d,y);continue}let P=m?l.get(m):void 0;if(P===void 0&&f&&m){let p=i();if(p===null)return null;P=p,l.set(m,P),n.abstractsToImport.push(Ie(f,chunkDCILO4XD_cjs.pa,"abstractNumId",P));}let T=s();if(T===null)return null;n.numIdMap.set(d,T);let M=Ie(c,chunkDCILO4XD_cjs.pa,"numId",T);if(P!==void 0){let p=M.children.map(x=>oe(x,"abstractNumId")?Ie(x,chunkDCILO4XD_cjs.pa,"val",P):x);M={...M,children:p};}n.numsToImport.push(M),a.set(h,T);}return n}var Wt="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Bm=`${Wt}/hyperlink`,ql=`${Wt}/image`,wr=`${Wt}/numbering`,ea=`${Wt}/styles`,Jl="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Ql="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function Pn(e,t,n,r){for(let o of chunkDCILO4XD_cjs.tg(e,t)){if(o.type!==n||o.targetMode==="External")continue;let a=chunkDCILO4XD_cjs.E(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i)return i}}return e.parts.get(r)??null}function Hm(e,t){let n=0;return Ke([e],r=>{let o=t(r);if(o===void 0)return;let a=Number(o);Number.isInteger(a)&&a>n&&(n=a);}),n}function Er(e,t,n,r){if(n.length===0)return e;let o=chunkDCILO4XD_cjs.cb(t,"paste"),a=n.map(c=>chunkDCILO4XD_cjs.Ph(c,o)),i=chunkDCILO4XD_cjs.Im(t,a),s=r??i.root.children.length,l=chunkDCILO4XD_cjs.jb(i,i.root.id,s,a,{deferValidation:true});return l.ok?chunkDCILO4XD_cjs.rg(e,l.part):null}function Zl(e,t){if(t.size===0)return [...e];let n=o=>{if(o.kind==="textValue")return o;if(o.kind==="drawing"||oe(o,"pict")||oe(o,"object")){let i=false;return Ke([o],s=>{if(s.kind!=="textValue")for(let l of s.attributes)l.namespaceUri===Wt&&t.has(l.value)&&(i=true);}),i?null:o}if(o.kind==="hyperlink"){let i=o.attributes.find(s=>s.namespaceUri===Wt)?.value;if(i!==void 0&&t.has(i))return r(o.children)}let a=r(o.children);return a.length===o.children.length&&a.every((i,s)=>i===o.children[s])?o:{...o,children:a}};function r(o){let a=[];for(let i of o){let s=n(i);s!==null&&(Array.isArray(s)?a.push(...s):a.push(s));}return a}return r(e)}var Vm=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),ec={"image/jpg":"image/jpeg","image/x-ms-bmp":"image/bmp","image/x-bmp":"image/bmp"};function jm(e,t){let n=chunkDCILO4XD_cjs.Of(e);if(n==="unknown")return null;let r=chunkDCILO4XD_cjs.H(t);return (Object.hasOwn(ec,r)?ec[r]:r)!==n||Vm.has(n)&&!chunkDCILO4XD_cjs.$f(e,n)?null:n}function ta(e,t,n){for(let b of t.parts.values())if(fn([b.root]))return {ok:false,reason:"unsupported-content"};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(b=>b.kind==="body"):null;if(!o||!ue(o))return {ok:false,reason:"no-fragment-document"};let a=chunkDCILO4XD_cjs.$m(o.children.filter(b=>b.kind==="paragraph"||b.kind==="table"||b.kind==="contentControl"));if(a.length===0)return {ok:false,reason:"no-fragment-document"};let i=e,s=Yl(Pn(t,t.mainDocumentPart,wr,"/word/numbering.xml"),Pn(i,i.mainDocumentPart,wr,"/word/numbering.xml"));if(!s)return {ok:false,reason:"merge-refused"};let{numIdMap:l,numsToImport:c,abstractsToImport:d}=s,m=vr(Pn(t,t.mainDocumentPart,ea,"/word/styles.xml")),f=Pn(i,i.mainDocumentPart,ea,"/word/styles.xml"),h=vr(f),y=new Map,P=[],T=new Set(h.byId.keys()),M=new Set(h.names),p=new Map,x=new Map,k=new Map,v=(b,U)=>{let $=k.get(b);return $===void 0&&($=kn(U),k.set(b,$)),$},A=b=>({...b,attributes:b.attributes.filter(U=>!(U.localName==="default"&&U.namespaceUri===chunkDCILO4XD_cjs.pa))});for(let b of m.styles){let U=chunkDCILO4XD_cjs.Jh(b,"styleId");if(!U)continue;let $=h.byId.get(U),j=kn(zt(b,{styleIds:y,numIds:l}));if($&&v(U,$)===j){y.set(U,U);continue}if(!$){y.set(U,U),T.add(U),P.push(A(b));continue}let X=Hl(`${U}Pasted`,T,p);T.add(X),y.set(U,X),P.push(A(Ie(b,chunkDCILO4XD_cjs.pa,"styleId",X)));}let O=P.map(b=>{let U=b.children.find(Z=>oe(Z,"name")),$=U?chunkDCILO4XD_cjs.Jh(U,"val"):void 0;if(!$||!M.has($))return $&&M.add($),b;let j=Vl($,M,x);M.add(j);let X=b.children.map(Z=>oe(Z,"name")?Ie(Z,chunkDCILO4XD_cjs.pa,"val",j):Z);return {...b,children:X}}),D=null,F=1,w=chunkDCILO4XD_cjs.Ib()===void 0?null:chunkDCILO4XD_cjs.Mb(Number.MAX_SAFE_INTEGER),N=()=>{if(D)return D;let b=new Map;for(let[U,$]of i.partBytes){let j=U.startsWith("/")?U:`/${U}`;if(!j.startsWith("/word/media/"))continue;b.set(chunkDCILO4XD_cjs.f($),j);let X=/\/image(\d+)\./.exec(j);X&&(F=Math.max(F,Number(X[1])+1));}return D=b,b},S=new Map,I=b=>{let U=S.get(b);if(!U){U=new Map;for(let $ of chunkDCILO4XD_cjs.tg(i,b)){if($.targetMode==="External"||$.type!==ql)continue;let j=chunkDCILO4XD_cjs.E($.ownerPart,$.rawTarget);j.ok&&U.set(j.partName,$.id);}S.set(b,U);}return U},_=(b,U)=>{let $=b.lastIndexOf("."),j=$===-1?"":b.slice($+1);return /^[A-Za-z0-9]{1,8}$/.test(j)?j.toLowerCase():U==="image/jpeg"?"jpeg":U==="image/gif"?"gif":"png"},q=(b,U,$)=>{let j=new Map,X=new Set,Z=I(U),me=[],we=new Set,xe=[],De=[],Ye=new Map,Ae=[],_e=t.relationships.get(b)??[];for(let le of _e){if(!$.has(le.id))continue;if(le.targetMode==="External"){if(le.type===Bm){let E=chunkDCILO4XD_cjs.ej(i,le.rawTarget,U);E?(i=E.pkg,j.set(le.id,E.relationshipId)):X.add(le.id);}else X.add(le.id);continue}let pe=chunkDCILO4XD_cjs.E(le.ownerPart,le.rawTarget);if(!pe.ok){X.add(le.id);continue}let qe=t.partBytes.get(pe.partName)??t.partBytes.get(pe.partName.replace(/^\//,"")),mt=(chunkDCILO4XD_cjs.ug(t,pe.partName)??"").toLowerCase();if(!qe||!mt.startsWith("image/")){X.add(le.id);continue}let R=jm(qe,mt);if(R===null){X.add(le.id);continue}let G=R,W=N(),re=chunkDCILO4XD_cjs.f(qe),Y=W.get(re);if(!Y){let E=_(pe.partName,G),L=fe=>i.partBytes.has(fe)||i.partBytes.has(fe.slice(1))||i.parts.has(fe)||we.has(fe),Q;if(w)do Q=`/word/media/image${w.next().value}.${E}`;while(L(Q));else {for(Q=`/word/media/image${F}.${E}`;L(Q);)F+=1,Q=`/word/media/image${F}.${E}`;F+=1;}Y=Q,me.push({partName:Y,bytes:qe,contentType:G}),we.add(Y),W.set(re,Y);}let se=Y.startsWith("/word/")?Y.slice(6):Y,g=Z.get(Y);if(g!==void 0){j.set(le.id,g);continue}let u=Ye.get(Y);u===void 0&&(u=xe.length,Ye.set(Y,u),xe.push(se),De.push(Y)),Ae.push({recordId:le.id,index:u});}if(me.length>0&&(i=chunkDCILO4XD_cjs.dg(i,me)),xe.length>0){let le=chunkDCILO4XD_cjs.xg(chunkDCILO4XD_cjs.zg(i,U),U,xe.map(pe=>[ql,pe]));if(le.ok){i=le.pkg,le.ids.forEach((pe,qe)=>{Z.set(De[qe],pe);});for(let pe of Ae)j.set(pe.recordId,le.ids[pe.index]);}else for(let pe of Ae)X.add(pe.recordId);}return {relIdMap:j,dropRelIds:X}},ee=q(t.mainDocumentPart,n,jo(a));a=Zl(a,ee.dropRelIds);let K=new Map,ae=new Map,B=[],V=(b,U)=>ue(b)&&b.namespaceUri===chunkDCILO4XD_cjs.pa&&b.localName===U,z={},ne=br(a,(b,U)=>{let $=z[b];if($===void 0){$=new Map,z[b]=$;let j=chunkDCILO4XD_cjs.pj(t,b);if(j&&ue(j.root))for(let X of j.root.children){if(!V(X,b))continue;let Z=chunkDCILO4XD_cjs.Jh(X,"id");if(Z===void 0)continue;let me=He(Z);$.has(me)||$.set(me,X);}}return $.get(U)??null});for(let b of ["footnote","endnote"]){let U=b==="footnote"?K:ae,$=ne[b];if($.size===0)continue;let j=chunkDCILO4XD_cjs.pj(t,b);if(!j||!ue(j.root))continue;let X=chunkDCILO4XD_cjs.Ij(i,b);if(!X.ok||!X.package)return {ok:false,reason:"merge-refused"};i=X.package;let Z=chunkDCILO4XD_cjs.pj(i,b);if(!Z)return {ok:false,reason:"merge-refused"};let me=Hm(Z.root,xe=>V(xe,b)?chunkDCILO4XD_cjs.Jh(xe,"id"):void 0)+1,we=[];for(let xe of j.root.children){if(!V(xe,b))continue;let De=chunkDCILO4XD_cjs.Jh(xe,"id"),Ye=chunkDCILO4XD_cjs.Jh(xe,"type");if(Ye==="separator"||Ye==="continuationSeparator"||De===void 0||!$.has(He(De))||U.has(He(De)))continue;let Ae=String(me++);U.set(He(De),Ae),we.push(Ie(xe,chunkDCILO4XD_cjs.pa,"id",Ae));}we.length>0&&B.push({kind:b,fragmentPartName:j.name,bodies:chunkDCILO4XD_cjs.$m(we)});}let ie=i.parts.get(n),Ne=[...a,...B.flatMap(b=>b.bodies)],Xe=[],Ce=new Set,Ve=false,J=false,Me=new Map;Ke(Ne,b=>{if(b.kind!=="textValue"){if(b.kind==="bookmarkStart"||b.kind==="bookmarkEnd"){let U=chunkDCILO4XD_cjs.Jh(b,"id");if(U!==void 0&&Xe.push(U),b.kind==="bookmarkStart"){let $=chunkDCILO4XD_cjs.Jh(b,"name");$&&Ce.add($);}return}if(Qo(b)){Ve=true;return}if(b.kind==="drawingDocPr"){J=true;return}if(b.kind==="contentControlProperties")for(let U of b.children){if(!oe(U,"id"))continue;let $=chunkDCILO4XD_cjs.Jh(U,"val");if($!==void 0&&!Me.has($)){let j=0,X=`${$}:${Me.size}`;for(let Z=0;Z<X.length;Z+=1)j=j*31+X.charCodeAt(Z)>>>0;Me.set($,String(j%2147483647||1));}}}});let de=jl({pkg:i,ownerPart:ie,notesParts:B.map(b=>chunkDCILO4XD_cjs.pj(i,b.kind)).filter(b=>b!==null),travelling:Ne,fragmentBookmarkIds:Xe,hasRevision:Ve,hasDocPr:J});if(!de)return {ok:false,reason:"merge-refused"};let At=de.bookmarkIds,dt=de.revisionIds,Pe=de.docPrIds;if(Ce.size>0){let b=new Set;if(Ke([ie.root],U=>{if(U.kind!=="textValue"&&U.kind==="bookmarkStart"){let $=chunkDCILO4XD_cjs.Jh(U,"name"),j=chunkDCILO4XD_cjs.Jh(U,"id");$&&j!==void 0&&Ce.has($)&&b.add(j);}}),b.size>0){let U=j=>{if(j.kind==="textValue")return j;let X=[],Z=false;for(let me of j.children){if((me.kind==="bookmarkStart"||me.kind==="bookmarkEnd")&&b.has(chunkDCILO4XD_cjs.Jh(me,"id")??"")){Z=true;continue}let we=U(me);we!==me&&(Z=true),X.push(we);}return Z?{...j,children:X}:j},$=U(ie.root);$!==ie.root&&(chunkDCILO4XD_cjs.gb(ie.root,$),i=chunkDCILO4XD_cjs.rg(i,{...ie,root:$}));}}let tt=b=>Go(b,K,ae);for(let b of B){b.bodies=b.bodies.map(tt);let U=chunkDCILO4XD_cjs.pj(i,b.kind);if(!U)return {ok:false,reason:"merge-refused"};let $=q(b.fragmentPartName,U.name,jo(b.bodies)),j=Zl(b.bodies,$.dropRelIds);j=[...Jo(j,m,h)],j=j.map(Z=>zt(Z,{styleIds:y,numIds:l,relIds:$.relIdMap,footnoteIds:K,endnoteIds:ae,bookmarkIds:At,sdtIds:Me,revisionIds:dt,docPrIds:Pe}));let X=Er(i,i.parts.get(U.name),j);if(!X)return {ok:false,reason:"merge-refused"};i=X;}if(O.length>0){let b=O.map($=>zt($,{styleIds:y,numIds:l}));if(!f){let $=chunkDCILO4XD_cjs.Pa(`<w:styles xmlns:w="${chunkDCILO4XD_cjs.pa}"></w:styles>`,{name:"/word/styles.xml",contentType:Ql});if(!$.ok)return {ok:false,reason:"merge-refused"};i=chunkDCILO4XD_cjs.Bg(i,"/word/styles.xml",$.part.root,Ql);let j=chunkDCILO4XD_cjs.Ag(chunkDCILO4XD_cjs.zg(i,i.mainDocumentPart),i.mainDocumentPart,ea,"styles.xml");if(!j.ok)return {ok:false,reason:"merge-refused"};i=j.pkg,f=i.parts.get("/word/styles.xml")??null;}if(!f)return {ok:false,reason:"merge-refused"};let U=Er(i,i.parts.get(f.name),b);if(!U)return {ok:false,reason:"merge-refused"};i=U,h=vr(i.parts.get(f.name)??null);}if(d.length>0||c.length>0){let b=Pn(i,i.mainDocumentPart,wr,"/word/numbering.xml");if(!b){let Z=chunkDCILO4XD_cjs.Pa(`<w:numbering xmlns:w="${chunkDCILO4XD_cjs.pa}"></w:numbering>`,{name:"/word/numbering.xml",contentType:Jl});if(!Z.ok)return {ok:false,reason:"merge-refused"};i=chunkDCILO4XD_cjs.Bg(i,"/word/numbering.xml",Z.part.root,Jl);let me=chunkDCILO4XD_cjs.Ag(chunkDCILO4XD_cjs.zg(i,i.mainDocumentPart),i.mainDocumentPart,wr,"numbering.xml");if(!me.ok)return {ok:false,reason:"merge-refused"};i=me.pkg,b=i.parts.get("/word/numbering.xml")??null;}if(!b)return {ok:false,reason:"merge-refused"};let U=i.parts.get(b.name),$=U.root.children.findIndex(Z=>oe(Z,"num")),j=d.map(Z=>zt(Z,{styleIds:y,numIds:l})),X=Er(i,U,j,$===-1?void 0:$);if(!X)return {ok:false,reason:"merge-refused"};if(i=X,X=Er(i,i.parts.get(b.name),c),!X)return {ok:false,reason:"merge-refused"};i=X;}let Oe=[...Jo(a,m,h)].map(tt).map(b=>zt(b,{styleIds:y,numIds:l,relIds:ee.relIdMap,footnoteIds:K,endnoteIds:ae,bookmarkIds:At,sdtIds:Me,revisionIds:dt,docPrIds:Pe}));return {ok:true,pkg:i,blocks:Oe}}var Kt=class extends Error{},On=e=>e.kind==="textValue"?"":e.localName??"",he=(e,t)=>e.kind!=="textValue"&&e.namespaceUri===chunkDCILO4XD_cjs.pa&&On(e)===t,Gm=new Set(["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","permStart","permEnd","proofErr"]),tc=new Set(["moveFrom","moveTo","moveFromRangeStart","moveFromRangeEnd","moveToRangeStart","moveToRangeEnd"]),Tr=e=>e.kind!=="textValue"&&e.namespaceUri===chunkDCILO4XD_cjs.pa&&Gm.has(On(e));function zm(e){let t=-1,n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===chunkDCILO4XD_cjs.pa&&chunkDCILO4XD_cjs.Ob.has(r.localName))for(let o of r.attributes)o.namespaceUri!==chunkDCILO4XD_cjs.pa||o.localName!=="id"||/^\d{1,9}$/.test(o.value)&&(t=Math.max(t,Number(o.value)));for(let o of r.children)n(o);}};for(let r of e.parts.values())n(r.root);return t}function nc(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||n.root.kind!=="document")return null;let r=chunkDCILO4XD_cjs.cb(n),o=zm(e)+1,a=p=>chunkDCILO4XD_cjs.ti(r(),"revisionInsert","ins",chunkDCILO4XD_cjs.ui(String(o++),t),p),i=()=>chunkDCILO4XD_cjs.ti(r(),"generic","ins",chunkDCILO4XD_cjs.ui(String(o++),t),[]),s=p=>{let x=[],k=[],v=()=>{if(k.some(O=>!Tr(O)))x.push(a(k));else for(let O of k)x.push(O);k=[];},A=O=>{if(O.kind==="textValue"){k.push(O);return}if(tc.has(On(O))&&O.namespaceUri===chunkDCILO4XD_cjs.pa)throw new Kt;if(O.kind==="revisionInsert"){for(let D of O.children)A(D);return}if(O.kind==="revisionDelete"){k.push(O);return}if(chunkDCILO4XD_cjs.dh(O)){for(let D of chunkDCILO4XD_cjs.Ak(O,r))A(D);return}if(chunkDCILO4XD_cjs.Ca(O)){v();let D=O.children.filter(w=>chunkDCILO4XD_cjs.vf(O,w)),F=O.children.filter(w=>!chunkDCILO4XD_cjs.vf(O,w));x.push({...O,children:[...D,...s(F)]});return}k.push(O);};for(let O of p)A(O);return v(),x},l=p=>{let x=p&&p.kind!=="textValue"?p.children:[],k=x.find(I=>he(I,"rPr")),v=k&&k.kind!=="textValue"?k.children:[];if(v.some(I=>tc.has(On(I))))throw new Kt;let A=v.filter(I=>!he(I,"ins")),O=A.filter(I=>he(I,"del")),D=A.filter(I=>!he(I,"del")),F=chunkDCILO4XD_cjs.ti(k?.id??r(),"runProperties","rPr",k&&k.kind!=="textValue"?k.attributes:[],[i(),...O,...D]),w=x.filter(I=>!he(I,"rPr")),N=w.filter(I=>he(I,"sectPr")||he(I,"pPrChange")),S=w.filter(I=>!N.includes(I));return chunkDCILO4XD_cjs.ti(p?.id??r(),"paragraphProperties","pPr",p&&p.kind!=="textValue"?p.attributes:[],[...S,F,...N])},c=p=>{let x=p.children.find(v=>v.kind==="paragraphProperties"),k=p.children.filter(v=>v.kind!=="paragraphProperties");return {...p,children:[l(x),...s(k)]}},d=p=>{let k=(p&&p.kind!=="textValue"?p.children:[]).filter(O=>!he(O,"ins")),v=k.filter(O=>he(O,"del")||he(O,"trPrChange")),A=k.filter(O=>!v.includes(O));return chunkDCILO4XD_cjs.ti(p?.id??r(),p&&p.kind!=="textValue"?p.kind:"generic","trPr",p&&p.kind!=="textValue"?p.attributes:[],[...A,i(),...v])},m=p=>{let x=p.children.find(O=>he(O,"trPr")),k=p.children.filter(O=>!he(O,"trPr")),v=k.filter(O=>he(O,"tblPrEx")),A=k.filter(O=>!he(O,"tblPrEx")).map(O=>O.kind==="tableCell"?{...O,children:O.children.map(y)}:O.kind==="textValue"||Tr(O)?O:f(O));return {...p,children:[...v,d(x),...A]}};function f(p){throw new Kt(On(p))}function h(p){return p.kind==="textValue"||Tr(p)?p:p.kind==="tableRow"?m(p):p.kind==="tableProperties"||p.kind==="tableGrid"?p:p.kind==="contentControl"||p.kind==="contentControlContent"?{...p,children:p.children.map(x=>chunkDCILO4XD_cjs.vf(p,x)?x:h(x))}:he(p,"tblPr")||he(p,"tblGrid")?p:f(p)}function y(p){if(p.kind==="textValue"||Tr(p))return p;switch(p.kind){case "paragraph":return c(p);case "table":return {...p,children:p.children.map(h)};case "tableProperties":case "tableGrid":return p;case "contentControl":case "contentControlContent":return {...p,children:p.children.map(x=>chunkDCILO4XD_cjs.vf(p,x)?x:y(x))};default:return he(p,"tcPr")||he(p,"sectPr")||he(p,"sdtPr")||he(p,"sdtEndPr")?p:f(p)}}let T=n.root.children.find(p=>p.kind==="body");if(!T||T.kind!=="body")return null;let M=new Map(e.parts);try{let p=chunkDCILO4XD_cjs.ib(n,T.id,T.children.map(y));if(!p.ok)return null;M.set(e.mainDocumentPart,p.part);for(let[x,k]of e.parts){if(!Wm.test(x))continue;r=chunkDCILO4XD_cjs.cb(k);let v=k;for(let A of k.root.children){if(!he(A,"footnote")&&!he(A,"endnote")||A.kind==="textValue")continue;let O=A.attributes.find(F=>F.localName==="type")?.value;if(O!==void 0&&O!=="normal")continue;let D=chunkDCILO4XD_cjs.ib(v,A.id,A.children.map(y));if(!D.ok)return null;v=D.part;}M.set(x,v);}}catch(p){if(p instanceof Kt)return null;throw p}return {...e,parts:M}}var Wm=/\/(?:footnotes|endnotes)\.xml$/;var rc=16*1024*1024;function Km(e){let t=e.parts.get(e.mainDocumentPart);if(!t||t.root.kind!=="document")return false;let n=t.root.children.find(a=>a.kind==="body");if(!n||n.kind!=="body"||n.children.length>chunkDCILO4XD_cjs.Fm)return false;let r=0,o=(a,i,s)=>{if(i>s||(r+=1,r>chunkDCILO4XD_cjs.Hm))return false;if(a.kind==="textValue")return true;for(let l of a.children)if(!o(l,i+1,s))return false;return true};for(let a of n.children)if(!o(a,1,chunkDCILO4XD_cjs.Gm))return false;for(let[a,i]of e.parts)if(a!==e.mainDocumentPart&&/\/(styles|numbering|footnotes|endnotes)\.xml$/.test(a)&&!o(i.root,1,chunkDCILO4XD_cjs.Gm*4))return false;return true}function na(e,t,n){if(n.fragmentBytes.byteLength>rc)return {ok:false,reason:"invalidArgs",detail:"fragment-too-large"};let r=chunkDCILO4XD_cjs.lg(n.fragmentBytes);if(!r.ok)return {ok:false,reason:"invalidArgs",detail:`fragment-read:${r.reason}`};let o=n.revision?nc(r.package,n.revision):r.package;if(!o)return {ok:false,reason:"invalidArgs",detail:"fragment-untrackable"};let a=o;if(!Km(a))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:s,story:l}=i;if(s.compositionActive||e.compositionSessionOpen())return {ok:false,reason:"invalidArgs",detail:"ime-composition-active"};let c=e.currentPackage(),d=s.checkpoint();s.graftPackage(()=>e.currentPackage());let m=0,f="";return chunkDCILO4XD_cjs.Xa(e,()=>{let h=s.transact(P=>{for(let x of n.priorOps??[])if(!P.apply(x))return;let T=null,M=P.applyPackage(x=>(T=ta(x,a,l.partName),T.ok?T.pkg:x)),p=T;if(!p||!p.ok){f=`fragment-merge:${p?p.reason:"no-merge"}`,P.apply({op:"insertText",paragraphId:"\0fragment-abort",offset:0,text:"x"});return}M&&(m=p.blocks.length,P.apply({op:"insertFragment",paragraphId:n.paragraphId,offset:n.offset,blocks:p.blocks,lastMarkCovered:n.lastMarkCovered})&&n.revision&&p.blocks[0]?.kind!=="paragraph"&&P.apply({op:"setParagraphMarkRevision",paragraphId:n.paragraphId,kind:"ins",revision:n.revision}));},{story:l,...n.actorId?{actorId:n.actorId}:{}});return f.length>0?{ok:false,reason:"invalidArgs",detail:f}:h.ok?h.change?{ok:true,change:e.promoteStoryTransactionToPackageUnit(c,s,d),blockCount:m}:{ok:true,change:null,blockCount:m}:{ok:false,reason:h.reason,...h.detail?{detail:h.detail}:{}}},h=>chunkDCILO4XD_cjs.Ya(h))}function oc(){let e=null;return (t,n,r)=>{let o=e;if(e=null,!chunkDCILO4XD_cjs.Vk(n)||!("paragraphId"in r)||!chunkDCILO4XD_cjs.Xk(t,r.paragraphId))return r;if(r.op==="insertText"&&!r.revision&&r.inside===void 0&&o&&o.partName===t.name&&o.paragraphId===r.paragraphId&&o.offset===r.offset)return {...r,inside:o.controlId};if(r.op!=="deleteText"||r.revision||r.start>=r.end)return r;let a=chunkDCILO4XD_cjs.eb(t,r.paragraphId);if(a?.kind!=="paragraph")return r;let i=chunkDCILO4XD_cjs.rm(t,chunkDCILO4XD_cjs.qm(r));if(i.unprotected.length)return r;let s=chunkDCILO4XD_cjs.Ei(a);for(let l of i.touches){let c=s.spanOf(l.control);c&&c.start<=r.start&&c.end>=r.end&&(e={partName:t.name,paragraphId:r.paragraphId,offset:r.start,controlId:l.control.id});}return r}}function ra(e,t){for(let[n,r]of t.parts){let o=e.parts.get(n);!o||o.root===r.root||o.root.id!==r.root.id||chunkDCILO4XD_cjs.hb(o.root,r.root);}return t}var ac=new WeakSet;function Xm(e){return ac.add(e),e}function ic(e){return ac.has(e)}function bn(e){return {...e,applyPackage:t=>e.applyPackage(Xm(t))}}var sc=new Set(["insertText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertComplexField","insertEquation","insertDrawing","deleteText","setParagraphMarkRevision"]),oa=new Set(["insertDrawing"]),Ym=new Set(["insertContentControl","insertInlineContentControl","setContentControlProperties","removeContentControl","splitParagraph"]);function lc(e){return Ym.has(e.op)&&!("revision"in e&&e.revision)}function qm(e){if(!(e===null||e.start!==e.end))return e}var Xt={"text-local":0,"paragraph-local":1,"flow-structural":2,global:3},Rn=new WeakMap;function Cr(e){return Rn.get(e)?.()??e.part}var Tt=class{current;storyPartName;rev=0;commitCounter=0;undoStack=[];redoStack=[];pushCount=0;subscribers=new Set;historyLimit;settingsPartOverride;placeholderTextOverride;contentLockPolicy;storyRef=null;composition=null;constructor(t,n,r={}){let o="root"in t,a=typeof n=="string"?n:void 0,i=typeof n=="object"&&n!==null?n:r;this.current=o?chunkDCILO4XD_cjs.qg(t):t,this.storyPartName=a??(o?t.name:t.mainDocumentPart),this.historyLimit=i.historyLimit??200,this.settingsPartOverride=i.settingsPart,this.placeholderTextOverride=i.placeholderText,this.contentLockPolicy=chunkDCILO4XD_cjs.Qk(i.contentLockPolicy);}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 historyPushCount(){return this.pushCount}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=chunkDCILO4XD_cjs.rg(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 chunkDCILO4XD_cjs.Hb(n.actorId,()=>chunkDCILO4XD_cjs.Ug(n.fieldResults,()=>this.commitTransaction(t,n)))}commitTransaction(t,n){let r=n.origin??chunkDCILO4XD_cjs.g.mutationHuman,o=n.recordsHistory??(r!==chunkDCILO4XD_cjs.g.projection&&r!==chunkDCILO4XD_cjs.g.awareness),a=this.undoStack[this.undoStack.length-1];o&&!this.composition&&a?.group!==n.historyGroup&&this.closeHistoryGroup();let i=this.current,s=this.rev,l=this.current,c=null,d=0,m=new Set,f=new Set,h=new Set,y=new Set,P=new Set,T=[],M=n.minimumImpact??"text-local",p=null,x=false,k=null,v=null,A=new Map,O=new Map,D=B=>{let V=O.get(B.name);V||(V={mint:null,written:new Set},O.set(B.name,V));let z=V;return {mint:()=>(z.mint??=chunkDCILO4XD_cjs.Nb(B))(),wrote:ne=>{z.written.add(ne);},wroteUnder:ne=>z.written.has(ne)}},F=()=>{for(let B of O.values())B.mint=null;},w=(B,V)=>{let z=chunkDCILO4XD_cjs.dl.get(B.op);if(z===void 0)return A.clear(),null;let ne=`${V.name}\0${z}`,ie=A.get(ne);ie||(ie={id:null},A.set(ne,ie));let Ne=ie;return ()=>Ne.id??=D(V).mint()},N=(B,V)=>{let z=sc.has(B.op);return !z&&chunkDCILO4XD_cjs.dl.get(B.op)!==void 0?null:((z?oa.has(B.op):!lc(B))&&F(),z?D(V):null)},S=oc(),I=null,_=(B,V)=>{if(c)return false;let z=l.parts.get(B);if(!z)return c={reason:"unknown-part",detail:B},false;V=S(z,this.settingsPartOverride?.()??chunkDCILO4XD_cjs.Bf(l),V);let ne=chunkDCILO4XD_cjs.Uk(this.settingsPartOverride?.()??chunkDCILO4XD_cjs.Bf(l),V)??chunkDCILO4XD_cjs.sm(z,this.settingsPartOverride?.()??chunkDCILO4XD_cjs.Bf(l),V,I?.partName===B&&"paragraphId"in V&&I.paragraphId===V.paragraphId?I.fieldNodeId:void 0);if(ne)return c={reason:ne},false;let ie=w(V,z),Ne=N(V,z),Xe=this.settingsPartOverride?.()??chunkDCILO4XD_cjs.Bf(l),Ce=chunkDCILO4XD_cjs.Vk(Xe)&&"paragraphId"in V&&chunkDCILO4XD_cjs.Xk(z,V.paragraphId)?chunkDCILO4XD_cjs.Zk(z,V,I?.partName===B&&I.paragraphId===V.paragraphId?I.fieldNodeId:void 0):null;I=Ce&&"paragraphId"in V?{partName:B,paragraphId:V.paragraphId,fieldNodeId:Ce.fieldNodeId}:null;let Ve={deferValidation:true,placeholderText:this.placeholderTextOverride??(de=>chunkDCILO4XD_cjs.cj(l,de)),...this.contentLockPolicy?{contentLockPolicy:this.contentLockPolicy}:{},...ie?{revisionIds:ie}:{},...Ne?{trackedRevisionIds:Ne}:{}},J=Ce?chunkDCILO4XD_cjs.Cn(z,V,Ce,Ve):chunkDCILO4XD_cjs.Hn(z,V,Ve);if(!J.ok)return c={reason:J.reason,...J.detail?{detail:J.detail}:{}},false;if(oa.has(V.op)&&F(),l=chunkDCILO4XD_cjs.rg(l,J.part),J.part===z&&J.effect.dirty.length===0&&J.effect.created.length===0&&J.effect.deleted.length===0&&J.effect.split===void 0&&(J.effect.splits===void 0||J.effect.splits.length===0)&&J.effect.join===void 0&&J.effect.caret===void 0)return true;m.add(B),d+=1;for(let de of J.effect.dirty)f.add(de);for(let de of J.effect.created)h.add(de);for(let de of J.effect.deleted)y.add(de);for(let de of J.effect.dependencyKeys)P.add(de);J.effect.split&&T.push({split:J.effect.split});for(let de of J.effect.splits??[])T.push({split:de});if(J.effect.join&&T.push({join:J.effect.join}),Xt[J.effect.impact]>Xt[M]&&(M=J.effect.impact),J.effect.caret){let de=J.effect.caret.offset??0;v={paragraphId:J.effect.caret.paragraphId,start:de,end:de};}return true},q=Rn.get(this);Rn.set(this,()=>l.parts.get(this.storyPartName)??this.part);try{t({apply:B=>_(this.storyPartName,B),applyTo:(B,V)=>_(B,V),applyPackage:B=>{if(c)return !1;let V=this.settingsPartOverride?.()??chunkDCILO4XD_cjs.Bf(l),z=ic(B)?chunkDCILO4XD_cjs.Tk(V,{op:"comment"}):chunkDCILO4XD_cjs.Uk(V);if(z)return c={reason:z},!1;A.clear(),F();let ne;try{ne=B(l);}catch(ie){if(!chunkDCILO4XD_cjs.Lk(ie))throw ie;return c={reason:ie.reason,detail:ie.message},!1}if(ne===l)return !0;for(let[ie,Ne]of ne.parts)l.parts.get(ie)!==Ne&&m.add(ie);return l=ne,d+=1,Xt["flow-structural"]>Xt[M]&&(M="flow-structural"),!0},selectionBefore:B=>{p=B;},selectionAfter:B=>{x=!0,k=B;}});}finally{q?Rn.set(this,q):Rn.delete(this);}if(c){let B=c;return {ok:false,reason:B.reason,...B.detail?{detail:B.detail}:{}}}if(d===0)return {ok:true,change:null};let ee=x?k:v,K=x?qm(k):v??void 0;for(let B of m){let V=i.parts.get(B),z=l.parts.get(B);if(z===void 0)continue;let ne=V?chunkDCILO4XD_cjs.Na(V,z):chunkDCILO4XD_cjs.Na(z,z);if(!ne.ok)return {ok:false,reason:"tree-invariant",detail:JSON.stringify(ne.issues)}}let ae=chunkDCILO4XD_cjs.Cg(l);if(!ae.ok)return {ok:false,reason:"package-invariant",detail:JSON.stringify(ae.issues)};if(o)if(this.composition)chunkDCILO4XD_cjs.Kn(n.historyGroup,"split","composition"),this.composition.committed=true,this.composition={...this.composition,entry:{...this.composition.entry,selectionAfter:ee}};else {let B=n.historyGroup,V=this.undoStack[this.undoStack.length-1];B!==void 0&&V!==void 0&&V.group===B?this.undoStack[this.undoStack.length-1]={...V,selectionAfter:ee??V.selectionAfter}:this.pushUndo({pkg:i,revision:s,selectionBefore:p,selectionAfter:ee,group:B}),chunkDCILO4XD_cjs.Kn(B,V?.group===B?"extended":"started"),this.redoStack.length=0;}return this.current=l,this.rev+=1,n.story&&(this.storyRef=n.story),n.minimumImpact&&Xt[n.minimumImpact]>Xt[M]&&(M=n.minimumImpact),{ok:true,change:this.publish(r,s,{dirty:f,created:h,deleted:y,dependencyKeys:P,splitJoin:T,impact:M,caret:K},n.story??this.storyRef??void 0,n.actorId,n.operationId)}}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;}closeHistoryGroup(){let t=this.undoStack[this.undoStack.length-1];t===void 0||t.group===void 0||(this.undoStack[this.undoStack.length-1]={...t,group:void 0});}undo(){let t=this.undoStack.pop();if(!t)return null;this.closeHistoryGroup();let n=this.rev;return this.redoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=ra(this.current,t.pkg),this.rev+=1,this.publish(chunkDCILO4XD_cjs.g.mutationUndo,n,null,this.storyRef??void 0)}redo(){let t=this.redoStack.pop();if(!t)return null;this.closeHistoryGroup();let n=this.rev;return this.undoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=ra(this.current,t.pkg),this.rev+=1,this.publish(chunkDCILO4XD_cjs.g.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}discardNewestUndoEntry(){let t=this.undoStack.pop();return t?{selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}:null}pushUndo(t){this.pushCount+=1,this.undoStack.push(t),this.undoStack.length>this.historyLimit&&this.undoStack.shift();}publish(t,n,r,o,a,i){this.commitCounter+=1;let s={change:"model-change",fromRevision:n,toRevision:this.rev,commitId:`commit-${this.commitCounter}`,origin:t,...a?{actorId:a}:{},...i?{operationId:i}:{},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}:{}};return chunkDCILO4XD_cjs.Ug("atomic",()=>{for(let l of this.subscribers)l(s);}),s}};function aa(e,t,n,r){if(!e)return null;if(e.kind==="package")return (r==="undo"?e.selectionBefore:e.selectionAfter)??null;let o=e.partName===t.part.name?t:n.get(e.partName);return (r==="undo"?o?.selectionForUndo():o?.selectionForRedo())??null}function cc(e){let t=null,n;return {context:{selectionBefore(r){t=r,e.selectionBefore(r);},selectionAfter(r){n=r,e.selectionAfter(r);}},snapshot(r){return {selectionBefore:t,selectionAfter:n===void 0?r??null:n}}}}function ia(e,t){return [...e.values()].map(n=>n.part).filter(n=>t.parts.has(n.name))}function dc(e,t){return ia(e,t).map(n=>n.name).sort().join(",")}function mc(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 pc="/word/numbering.xml";function Yt(e,t){return e===void 0?void 0:{group:e,before:t}}function sa(e){return e.kind==="package"&&e.before.parts.get(pc)!==e.after.parts.get(pc)?{...e,restoreNumbering:true}:e}var Mr=class{open=null;close(){this.open=null;}admit(t,n,r,o,a){let i=this.open;if(n===void 0)return this.open=null,sa(t);if(i===null||i.group!==n.group||r.at(-1)!==i.pointer){let f=sa(t);return this.open={group:n.group,before:n.before,pointer:f},chunkDCILO4XD_cjs.Kn(n.group,"started"),f}r.pop();let s=t.kind==="story"?o(t.partName):null,l=i.pointer.kind==="story"?o(i.pointer.partName):null,c=i.pointer.kind==="package"?i.pointer.selectionAfter??null:null,d={kind:"package",before:i.before,after:a(),selectionBefore:i.pointer.kind==="package"?i.pointer.selectionBefore??null:l?.selectionBefore??null,selectionAfter:(t.kind==="package"?t.selectionAfter:s?.selectionAfter)??c},m=sa(d);return this.open={...i,pointer:m},chunkDCILO4XD_cjs.Kn(n.group,"extended"),m}};var Ar="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Jm="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function qt(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===Ar&&n.localName===t)return n;return null}function Dr(e,t){return e.attributes.find(n=>n.namespaceUri===Ar&&n.localName===t)?.value}function Qm(e){let t=Dr(e,"val");return t===void 0||t==="1"||t==="true"||t==="on"}function fc(e,t){return e.kind==="textValue"?Object.freeze({...e,id:t()}):Object.freeze({...e,id:t(),children:e.children.map(n=>fc(n,t))})}function Zm(e){let t=chunkDCILO4XD_cjs.Pa(`<w:styles xmlns:w="${Ar}"><w:style w:type="paragraph" w:styleId="ListParagraph"><w:pPr><w:contextualSpacing/></w:pPr></w:style></w:styles>`,{name:e.name,contentType:Jm});if(!t.ok)return null;let n=qt(t.part.root,"style"),r=n?qt(n,"pPr"):null;return r?fc(r,chunkDCILO4XD_cjs.cb(e)):null}var uc=["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 ep(e,t){let n=uc.indexOf(t),r=0;return e.forEach((o,a)=>{if(o.kind==="textValue")return;let i=uc.indexOf(o.localName);i!==-1&&i<=n&&(r=a+1);}),r}function gc(e,t){let n=chunkDCILO4XD_cjs.ud(e);if(!n)return null;let r=null;for(let c of n.root.children)if(c.kind!=="textValue"&&c.namespaceUri===Ar&&c.localName==="style"&&Dr(c,"type")==="paragraph"&&Dr(c,"styleId")===t){r=c;break}if(!r)return null;let o=qt(r,"name");if(o&&Dr(o,"val")?.trim().toLowerCase()!=="list paragraph"&&t!=="ListParagraph")return null;let a=Zm(n);if(!a)return null;let i=qt(a,"contextualSpacing");if(!i)return null;let s=qt(r,"pPr"),l;if(s){let c=qt(s,"contextualSpacing");if(c&&Qm(c))return e;l=c?chunkDCILO4XD_cjs.kb(n,c.id,i):chunkDCILO4XD_cjs.jb(n,s.id,ep(s.children,"contextualSpacing"),[i]);}else {let c=r.children.findIndex(d=>d.kind!=="textValue"&&["rPr","tblPr","tcPr","tblStylePr"].includes(d.localName));l=chunkDCILO4XD_cjs.jb(n,r.id,c===-1?r.children.length:c,[a]);}return l.ok?Object.freeze({...e,parts:new Map([...e.parts,[n.name,l.part]])}):null}var kc="http://schemas.openxmlformats.org/package/2006/relationships",Pc="application/vnd.openxmlformats-package.relationships+xml",rp="http://schemas.openxmlformats.org/package/2006/content-types",hc="/[Content_Types].xml",Ct="/word/numbering.xml",yc="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",In="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",op=`<Override PartName="${Ct}" ContentType="${In}"/>`;function _r(e){return `${e.ownerPart}\0${e.id}`}function Oc(e,t,n){let r=new Set(t.externalTargets.filter(s=>s.type===chunkDCILO4XD_cjs.De).map(_r)),o=n.externalTargets.filter(s=>s.type===chunkDCILO4XD_cjs.De&&!r.has(_r(s)));if(o.length===0)return e;let a=new Set(e.map(_r)),i=o.filter(s=>!a.has(_r(s)));return i.length===0?e:Object.freeze([...e,...i])}function bc(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 Rc(e,t,n=[],r=false){if(e===t)return e;let o=ap(e,t,r);return o=sp(o,t,n),o}function Ic(e,t){let n=new Set;for(let o of e.externalTargets)o.type===chunkDCILO4XD_cjs.De&&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 a=mp(o);!a||a===e.mainDocumentPart||e.parts.has(a)||t.has(a)||e.externalTargets.some(i=>i.ownerPart===a)||n.add(a);}if(n.size===0)return e;let r=e;for(let o of n)r=pp(r,o);return r}function ap(e,t,n){let r=t.parts.get(Ct);if(!r)return e;let o=e.parts.get(Ct),a=n&&o?ip(o,r):r,i=chunkDCILO4XD_cjs.rg(e,a),s=(t.relationships.get(t.mainDocumentPart)??[]).find(c=>c.type===yc),l=i.relationships.get(i.mainDocumentPart)??[];if(s&&!l.some(c=>c.type===yc)&&!l.some(c=>c.id===s.id)){let c=cp(i,{...s,ownerPart:i.mainDocumentPart});c&&(i=c);}if(i.contentTypes.overrides.get(chunkDCILO4XD_cjs.C(Ct))!==In){let c=up(i);c&&(i=c);}return i}function ip(e,t){let n="http://schemas.openxmlformats.org/wordprocessingml/2006/main",r=l=>{if(l.kind==="textValue"||l.namespaceUri!==n)return null;let c=l.localName==="abstractNum"?"abstractNumId":l.localName==="num"?"numId":l.localName==="numPicBullet"?"numPicBulletId":null;if(!c)return null;let d=l.attributes.find(m=>m.namespaceUri===n&&m.localName===c)?.value;return d===void 0?null:`${l.localName}:${d}`},o=new Set(e.root.children.map(r).filter(Boolean)),a=chunkDCILO4XD_cjs.cb(e),i=["numPicBullet","abstractNum","num","numIdMacAtCleanup"],s=e;for(let l of t.root.children){let c=r(l);if(!c||o.has(c)||l.kind==="textValue")continue;let d=i.indexOf(l.localName),m=s.root.children.findIndex(h=>h.kind!=="textValue"&&h.namespaceUri===n&&i.indexOf(h.localName)>d),f=chunkDCILO4XD_cjs.jb(s,s.root.id,m<0?s.root.children.length:m,[la(l,a)]);f.ok&&(s=f.part,o.add(c));}return s}function sp(e,t,n){let r=n.filter(a=>a.type===chunkDCILO4XD_cjs.De);if(r.length===0)return e;let o=e;for(let a of r){let i=lp(e,t,a.ownerPart);if(!i||o.externalTargets.some(c=>c.ownerPart===i&&c.id===a.id)||new Set((o.relationships.get(i)??[]).map(c=>c.id)).has(a.id))continue;let l=dp(o,{ownerPart:i,id:a.id,type:chunkDCILO4XD_cjs.De,rawTarget:a.rawTarget,sinkSafe:a.sinkSafe},i);l&&(o=l);}return o}function lp(e,t,n){return n===t.mainDocumentPart?e.mainDocumentPart:typeof n!="string"||n.length===0?null:n}function cp(e,t){let n=e.mainDocumentPart,r=ca(n),o=e.parts.get(r),a=chunkDCILO4XD_cjs.Pa(`<Relationships xmlns="${kc}"><Relationship Id="${chunkDCILO4XD_cjs.Y(t.id,"relationship id")}" Type="${chunkDCILO4XD_cjs.Y(t.type,"relationship type")}" Target="${chunkDCILO4XD_cjs.Y(t.rawTarget,"relationship target")}"/></Relationships>`,{name:r,contentType:Pc});if(!a.ok)return null;let i=e.relationships.get(n)??[];if(i.some(c=>c.id===t.id))return null;let s={...t,ownerPart:n,order:i.reduce((c,d)=>Math.max(c,d.order),-1)+1},l=new Map([...e.relationships,[n,[...i,s]]]);return o?Nc(e,o,a.part.root.children[0],l):Object.freeze({...e,parts:new Map([...e.parts,[r,a.part]]),relationships:l})}function dp(e,t,n=e.mainDocumentPart){let r=n;if(typeof r!="string"||r.length===0)return null;let o=ca(r),a=e.parts.get(o),i=chunkDCILO4XD_cjs.Pa(`<Relationships xmlns="${kc}"><Relationship Id="${chunkDCILO4XD_cjs.Y(t.id,"relationship id")}" Type="${chunkDCILO4XD_cjs.De}" Target="${chunkDCILO4XD_cjs.Y(t.rawTarget,"relationship target")}" TargetMode="External"/></Relationships>`,{name:o,contentType:Pc});if(!i.ok)return null;let s=[...e.externalTargets,t];if(!a)return Object.freeze({...e,parts:new Map([...e.parts,[o,i.part]]),externalTargets:s});let l=Nc(e,a,i.part.root.children[0],e.relationships);return l?Object.freeze({...l,externalTargets:s}):null}function Nc(e,t,n,r){if(!n)return null;let o=chunkDCILO4XD_cjs.cb(t),a=chunkDCILO4XD_cjs.jb(t,t.root.id,t.root.children.length,[la(n,o)]);return a.ok?Object.freeze({...e,parts:new Map([...e.parts,[t.name,a.part]]),relationships:r}):null}function la(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>la(n,t))}}function ca(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function mp(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 pp(e,t){let n=ca(t),r=new Map(e.parts);r.delete(n);let o=new Map(e.partBytes);o.delete(n);let a=new Map(e.relationships);a.delete(t);let i=Object.freeze(e.externalTargets.filter(s=>s.ownerPart!==t));return Object.freeze({...e,parts:r,partBytes:o,relationships:a,externalTargets:i})}function up(e){let t=e.contentTypes.overrides.get(chunkDCILO4XD_cjs.C(Ct));if(t===In)return e;if(t!==void 0)return null;let n=e.partBytes.get(hc);if(!n)return null;let r=fflate.strFromU8(n),o=xc(r);if(!o)return null;let a=r.lastIndexOf(`</${o.rootName}>`);if(a===-1)return null;let i=r.slice(0,a)+op+r.slice(a),s=xc(i);if(!s||s.rootName!==o.rootName)return null;let l=[...o.children,Sc("Override",{PartName:Ct,ContentType:In})];return s.children.length!==l.length||s.children.some((c,d)=>c!==l[d])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[hc,fflate.strToU8(i)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunkDCILO4XD_cjs.C(Ct),In]])})})}function xc(e){let t=chunkDCILO4XD_cjs.ea(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(":"),a=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[a?`xmlns:${a}`:"xmlns"]!==rp)return null;let i=[];for(let s of r.children)s.type==="element"&&i.push(Sc(s.name,s.attributes));return {rootName:r.name,children:i}}function Sc(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}var vc=4e3,wc=64;function Ec(e){return chunkDCILO4XD_cjs.pj(e,"footnote")!==null||chunkDCILO4XD_cjs.pj(e,"endnote")!==null}function Tc(e,t,n,r){if(!Ec(e))return false;if(r.has(n.paragraphId))return true;r.add(n.paragraphId);let o=chunkDCILO4XD_cjs.eb(Cr(t),n.paragraphId);return !o||o.kind!=="paragraph"?true:chunkDCILO4XD_cjs.Bi(o).some(a=>a.node.kind==="noteReference"&&a.start<n.end&&a.end>n.start)}function Cc(e,t,n,r){if(!Ec(e))return false;if(r.has(n.blockId))return true;r.add(n.blockId);let o=chunkDCILO4XD_cjs.eb(Cr(t),n.blockId);if(!o||o.kind==="textValue")return true;let a=0,i=(s,l)=>{if(a>=vc||l>wc)return true;if(a+=1,s.kind==="textValue")return false;if(s.kind==="paragraph")return chunkDCILO4XD_cjs.Bi(s).some(c=>c.node.kind==="noteReference");for(let c of s.children)if(i(c,l+1))return true;return false};return i(o,0)}function Mc(e,t,n){if(n.count>=vc||t>wc)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(Mc(r,t+1,n))return true;return false}function Dc(e,t,n,r){if(!e())return false;let o=n.op==="deleteText"?n.paragraphId:n.blockId;if(r.has(o))return true;r.add(o);let a=chunkDCILO4XD_cjs.eb(Cr(t),o);return !a||a.kind==="textValue"?true:Mc(a,0,{count:0})}var da="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",ma="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function Ac(e,t){let r=(e.relationships.get(e.mainDocumentPart)??[]).find(o=>o.id===t);return r?r.type!==da&&r.type!==ma?{ok:false,reason:"wrong-relationship-type",detail:r.type}:fp(e,r):{ok:false,reason:"dangling-relationship",detail:t}}function fp(e,t){let n=chunkDCILO4XD_cjs.N(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}}var pa=new Set(["acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions"]),ua=new Set(["authorTable","deleteTableRow","deleteTableColumn","mergeTableCells","removeContentControl","removeRepeatingSectionItem","removeToc"]);function _c(e,t,n){return {historyLimit:t,settingsPart:()=>chunkDCILO4XD_cjs.Bf(e()),placeholderText:r=>chunkDCILO4XD_cjs.cj(e(),r),...n?{contentLockPolicy:n}:{}}}function Mt(e,t){return t.compositionActive||e.compositionSessionOpen()?{ok:false,reason:"invalidArgs",detail:"ime-composition-active"}:null}function Uc(e,t){let n=chunkDCILO4XD_cjs.eb(e,t);return !n||n.kind!=="drawing"?null:n.children.find(o=>o.kind==="inlineDrawing"||o.kind==="anchoredDrawing")??null}function Fc(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=chunkDCILO4XD_cjs.eb(r,n);return !o||o.kind!=="drawing"?null:chunkDCILO4XD_cjs.We(o,{ownerPartName:t,supportedMcRequires:chunkDCILO4XD_cjs.Qe,limits:chunkDCILO4XD_cjs.Pe,resolveRelationship:chunkDCILO4XD_cjs.Se(e,t)})}function Lc(e,t,n){let r=chunkDCILO4XD_cjs.O(e.relationships.get(t)??[],t,n);return r.mode==="internal"?r.partName:null}function Jt(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=Mt(e,o.store);if(a)return a;let{store:i,story:s}=o;return chunkDCILO4XD_cjs.Xa(e,()=>gp(e,i,s,n,r),l=>chunkDCILO4XD_cjs.Ya(l))}function gp(e,t,n,r,o){let a=n.partName,i=e.currentPackage(),s=t.checkpoint();t.graftPackage(()=>e.currentPackage());let l=null,c=false,d=false,m=t.transact(y=>{if(o?.commitGuard?.()===false){d=true;return}if(o?.expectedPackageRevision!==void 0&&e.packageRevision!==o.expectedPackageRevision){c=true;return}let P=r(y,a);if(P===null){y.apply({op:"insertText",paragraphId:"\0task12-abort",offset:0,text:"x"});return}l=P;},{story:n,...o?.actorId?{actorId:o.actorId}:{},...n.kind==="headerFooter"||n.kind==="notesPart"?{minimumImpact:"global"}:{}});if(d)return {ok:false,reason:"invalidArgs",detail:"stale drawing selection"};if(c)return {ok:false,reason:"invalidArgs",detail:"stale-package-epoch"};if(!m.ok)return {ok:false,reason:m.reason,...m.detail?{detail:m.detail}:{}};if(!m.change)return {ok:true,change:null};let f=m.change.created.find(y=>{let P=t.part;return chunkDCILO4XD_cjs.eb(P,y)?.kind==="drawing"});return f&&(l=f),{ok:true,change:e.promoteStoryTransactionToPackageUnit(i,t,s),...l?{drawingNodeId:l}:{}}}function $c(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=Uc(r,n);return o?chunkDCILO4XD_cjs.un(o):null}function fa(e,t,n,r){let o=false;return e.applyPackage(a=>{let i=a.parts.get(t);if(!i)return a;let s=chunkDCILO4XD_cjs.eb(i,n);if(!s||s.kind!=="drawing")return a;let l=Uc(i,n);if(!l)return a;let c=chunkDCILO4XD_cjs.vn(l,r),d=hp(s,c),m=chunkDCILO4XD_cjs.kb(i,s.id,d,{deferValidation:true});return m.ok?(o=true,chunkDCILO4XD_cjs.rg(a,m.part)):a}),o}function hp(e,t){return {...e,children:e.children.map(n=>n.id===t.id?t:n)}}async function Bc(e,t,n){let r=chunkDCILO4XD_cjs.fg(n.widthPoints),o=chunkDCILO4XD_cjs.fg(n.heightPoints);if(r===null||o===null)return {ok:false,reason:"invalidArgs",detail:"invalid-dimensions"};let a=e.resolveStory(t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let i=Mt(e,a.store);if(i)return i;let s=a.story.partName,l=await chunkDCILO4XD_cjs.ag(n.decodePort,n.bytes,n.mime);if(!l.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let c=l.bytes,d=chunkDCILO4XD_cjs.cg(e.currentPackage(),s,{bytes:c,mime:n.mime});if(!d.ok)return {ok:false,reason:"invalidArgs",detail:d.reason==="invalid-image"?"invalid-image":d.reason};let m=d.partName,f=Jt(e,t,(h,y)=>{let P=e.currentPackage(),T=chunkDCILO4XD_cjs.cg(P,y,{bytes:c,mime:n.mime});if(!T.ok)return null;P=T.pkg,m=T.partName;let M;if(n.hyperlink){let x=chunkDCILO4XD_cjs.ej(P,n.hyperlink,y);if(!x)return null;P=x.pkg,M=x.relationshipId;}if(!h.applyPackage(()=>P))return null;let p=chunkDCILO4XD_cjs.gg({docPrId:T.docPrId,relationshipId:T.relationshipId,extentEmu:{cx:r,cy:o},...n.title!==void 0?{title:n.title}:{},...n.description!==void 0?{description:n.description}:{},...M?{hyperlinkRelationshipId:M}:{}});return h.apply({op:"insertDrawing",paragraphId:n.paragraphId,offset:n.offset,drawing:p,...n.revision?{revision:n.revision}:{}})?p.id:null},{expectedPackageRevision:n.expectedPackageRevision,...n.commitGuard?{commitGuard:n.commitGuard}:{},...n.actorId?{actorId:n.actorId}:{}});return f.ok?f.change?{...f,mediaPartName:m}:{ok:true,change:null,mediaPartName:m}:f}async function ga(e,t,n,r,o,a,i){let s=e.resolveStory(t);if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let l=Mt(e,s.store);if(l)return l;let c=s.story.partName,d=await chunkDCILO4XD_cjs.ag(a,r,o);if(!d.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let m=d.bytes,f=chunkDCILO4XD_cjs.cg(e.currentPackage(),c,{bytes:m,mime:o});return f.ok?Jt(e,t,(h,y)=>{let P=e.currentPackage(),T=Fc(P,c,n),M=T?.picture?.embeddedRelationshipId??null,p=T?.picture?.linkedRelationshipId??null,x=M??p;if(!x)return null;let k=M!==null?Lc(P,c,M):null,v=P,A=chunkDCILO4XD_cjs.cg(v,y,{bytes:m,mime:o});return !A.ok||(v=A.pkg,!h.applyPackage(()=>v))||!h.apply({op:"replaceDrawingResource",drawingNodeId:n,relationshipId:A.relationshipId})?null:(h.applyPackage(O=>chunkDCILO4XD_cjs.ig(O,y,k,x)),n)},{expectedPackageRevision:i.expectedPackageRevision,...i.commitGuard?{commitGuard:i.commitGuard}:{},...i.actorId?{actorId:i.actorId}:{}}):{ok:false,reason:"invalidArgs",detail:f.reason==="invalid-image"?"invalid-image":f.reason}}function Hc(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Mt(e,r.store);if(o)return o;let a=r.story.partName,i=e.currentPackage(),s=i.parts.get(a),l=Fc(i,a,n)??(s?chunkDCILO4XD_cjs.in(s,n):null);if(!l)return {ok:false,reason:"unknown-drawing"};let c=l.picture?.embeddedRelationshipId??null,d=l.picture?.linkedRelationshipId??null,m=c??d,f=c!==null?Lc(i,a,c):null;return Jt(e,t,(h,y)=>h.apply({op:"deleteDrawing",drawingNodeId:n})?(h.applyPackage(P=>chunkDCILO4XD_cjs.ig(P,y,f,m)),n):null)}function yp(e,t){let n=null,r=a=>{let i=false,s=false,l=(c,d)=>{if(i||c.kind==="textValue")return;if(c.id===t){i=true,s=d;return}let m=d||c.kind==="revisionDelete"||c.kind==="revisionMoveFrom";for(let f of c.children)l(f,m);};return l(a,false),s},o=a=>{if(!(n!==null||a.kind==="textValue")){if(a.kind==="paragraph"){let i=chunkDCILO4XD_cjs.Ei(a).spanOf(t);if(i!==null&&i.end>i.start){let s=chunkDCILO4XD_cjs.eb(e,t);if(!s||s.kind!=="drawing"&&!chunkDCILO4XD_cjs.Te(s))return;n={paragraphId:a.id,start:i.start,end:i.end,alreadyDeleted:r(a)};}return}for(let i of a.children)o(i);}};return o(e.root),n}function Vc(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=Mt(e,o.store);if(a)return a;let i=e.currentPackage().parts.get(o.story.partName);if(!i)return {ok:false,reason:"unknown-drawing"};let s=yp(i,n);return s?s.alreadyDeleted?{ok:true,change:null}:Jt(e,t,l=>l.apply({op:"deleteText",paragraphId:s.paragraphId,start:s.start,end:s.end,revision:r})?n:null):{ok:false,reason:"unknown-drawing"}}async function jc(e,t,n,r,o,a,i,s){let l=await chunkDCILO4XD_cjs.jg(o,r,a,void 0,i);return l.ok?ga(e,t,n,l.bytes,l.mime,i,{expectedPackageRevision:e.packageRevision,...s?{actorId:s}:{}}):{ok:false,reason:"invalidArgs",detail:`${l.reason}${l.detail?`:${l.detail}`:""}`}}function Gc(e,t,n,r,o,a){let i=e.resolveStory(t);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let s=Mt(e,i.store);return s||Jt(e,t,(l,c)=>{let d=$c(e.currentPackage(),c,n),m=null;if(a!==null){let h=chunkDCILO4XD_cjs.ej(e.currentPackage(),a,c);if(!h||!l.applyPackage(()=>h.pkg))return null;m=h.relationshipId;}if(!l.apply({op:"setDrawingMetadata",drawingNodeId:n,title:r,description:o,...a===null?{hyperlink:null}:{}}))return null;if(a!==null&&m!==null){if(!fa(l,c,n,m))return null}else if(a===null&&!fa(l,c,n,null))return null;let f=false;return l.applyPackage(h=>{let y=chunkDCILO4XD_cjs.gj(h,c,d);return y===null?(f=true,h):y}),f?null:n})}function zc(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Mt(e,r.store);return o||Jt(e,t,(a,i)=>{let s=$c(e.currentPackage(),i,n.drawingNodeId),l=null;if(n.hyperlink!==null){let d=chunkDCILO4XD_cjs.ej(e.currentPackage(),n.hyperlink,i);if(!d||!a.applyPackage(()=>d.pkg))return null;l=d.relationshipId;}for(let d of n.ops)if(!a.apply(d))return null;if(!fa(a,i,n.drawingNodeId,n.hyperlink===null?null:l))return null;let c=false;return a.applyPackage(d=>{let m=chunkDCILO4XD_cjs.gj(d,i,s);return m===null?(c=true,d):m}),c?null:n.drawingNodeId})}function xp(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 Wc(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 kp(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 Pp(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((a,i)=>!kp(a,o[i])))return false}return true}function Op(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 bp(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||!xp(r,o))return false}return true}function Rp(e,t){return e.contentTypes===t.contentTypes||Wc(e.contentTypes.defaults,t.contentTypes.defaults)&&Wc(e.contentTypes.overrides,t.contentTypes.overrides)}var Ur=Object.freeze({equal:true,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"}),Qt=Object.freeze({equal:false,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"});function Kc(e){for(let[t,n]of e)if(!chunkDCILO4XD_cjs.Ka(t,n)||!chunkDCILO4XD_cjs.La(n.root,t.root).idsPreserved)return Qt;return Ur}function Ip(e,t){if(e===t)return Ur;if(e.mainDocumentPart!==t.mainDocumentPart||e.parts.size!==t.parts.size||!bp(e.partBytes,t.partBytes)||!Pp(e.relationships,t.relationships)||!Op(e.externalTargets,t.externalTargets)||!Rp(e,t))return Qt;let n=[];for(let[i,s]of e.parts){let l=t.parts.get(i);if(!l)return Qt;s!==l&&n.push([s,l]);}if(n.length===0)return Ur;let[r,o]=n[0];if(n.length>1||r.name!==e.mainDocumentPart)return Kc(n);let a=chunkDCILO4XD_cjs.La(o.root,r.root);return a.undecided?Kc(n):a.equal&&a.idsPreserved?Ur:a.equal?a.renamedOutsideParagraphs||a.renamedParagraphIds.length===0?Qt:{equal:false,dirty:a.renamedParagraphIds,dependencyKeys:[chunkDCILO4XD_cjs.l.story],impact:"text-local"}:!a.idsPreserved||a.reach==="outside-paragraph"||a.paragraphIds.length===0?Qt:{equal:false,dirty:a.paragraphIds,dependencyKeys:[chunkDCILO4XD_cjs.l.story],impact:a.reach==="paragraph-text"?"text-local":"flow-structural"}}function ha(e){return {ok:false,reason:"package-invariant",detail:e}}function Np(e,t){if(!e.parts.get(e.mainDocumentPart))return ha("no-main-document");for(let[r,o]of e.parts){let a=t?.parts.get(r);if(a===o)continue;let i=a?chunkDCILO4XD_cjs.Na(a,o):chunkDCILO4XD_cjs.Ma(o);if(!i.ok)return ha(`invalid-part:${r}:${i.issues[0]?.code??"invalid"}`)}let n=chunkDCILO4XD_cjs.Cg(e);return n.ok?null:ha(n.issues[0]?.code??"package-invariant")}function Xc(e,t,n){let r=e.currentPackage(),o=Ip(t,r);if(o.equal)return {ok:true,change:null};let a=Np(t,r);if(a)return a;let i=e.bodyStore().part.name,s=o.impact!=="global"&&t.mainDocumentPart===i;return chunkDCILO4XD_cjs.Xa(e,()=>{let l=e.packageRevision;return e.installAuthoritativePackageSnapshot(t),{ok:true,change:e.publishStoryWrite({change:"model-change",fromRevision:l,toRevision:l+1,commitId:`pkg-remote-${l+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:i}})}},()=>false)}function Sp(e,t,n,r){let o=[...t],a=new Set;for(let i of o)e.parts.has(i)&&a.add(i);for(let i of n)Yc(i,o,a);for(let i of r)Yc(i,o,a);return a}function vp(e,t,n,r,o){let a=new Set(e);a.add(t),a.add(n);for(let i of r)qc(i,a);for(let i of o)qc(i,a);return a}function Yc(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 qc(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);}function Jc(e){let{stories:t,rIdToPartName:n,undoOrder:r,redoOrder:o}=e,a=Sp(e.pkg,t.keys(),r,o);for(let[l]of [...t])if(!a.has(l)){t.delete(l);for(let[c,d]of [...n])d===l&&n.delete(c);}let i=vp(a,e.pkg.mainDocumentPart,e.bodyPartName,r,o),s=Ic(e.pkg,i);return {pkg:s,shellHyperlinks:bc(e.shellHyperlinks,i,s.mainDocumentPart)}}function Qc(e,t,n,r,o,a){return {change:"model-change",fromRevision:Math.max(0,t-1),toRevision:t,commitId:`pkg-commit-${e}`,origin:n,dirty:[],created:[...a],deleted:[],splitJoin:[],dependencyKeys:[],impact:r,story:o}}var Zc=64,Nn=class{pkg;packageRev=0;body;stories=new Map;rIdToPartName=new Map;undoOrder=[];redoOrder=[];historyGroups=new Mr;subscribers=new Set;historyLimit;contentLockPolicy;maxEditableStoryParts;cascadeNoteReferences;lastChange=null;shellHyperlinks=Object.freeze([]);compositionSession=null;commitCounter=0;currentPackageMemo=null;storyStoreOptions(){return _c(()=>this.pkg,this.historyLimit,this.contentLockPolicy)}constructor(t,n,r={}){this.pkg=chunkDCILO4XD_cjs.rg(t,n),this.historyLimit=r.historyLimit??200,this.contentLockPolicy=chunkDCILO4XD_cjs.Qk(r.contentLockPolicy),this.maxEditableStoryParts=r.maxEditableStoryParts??Zc,this.cascadeNoteReferences=r.cascadeDeletedNoteReferences??chunkDCILO4XD_cjs.Hj,this.body=new Tt(this.pkg,n.name,this.storyStoreOptions()),this.body.setStoryRef({kind:"body",partName:n.name}),chunkDCILO4XD_cjs.Ln(this,{current:()=>this.undoOrder.at(-1)??null,split:()=>{this.closeHistoryGroups(),this.redoOrder.length=0;}});}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,a=true;for(let i of this.stories.values()){if(t.storyParts[o]!==i.part){a=false;break}o+=1;}if(a&&o===t.storyParts.length)return t.result}let n=chunkDCILO4XD_cjs.rg(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=chunkDCILO4XD_cjs.rg(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 chunkDCILO4XD_cjs.Xa(this,()=>this.commitStoryTransaction(t,n,r),chunkDCILO4XD_cjs.Ya,r.historyGroup)}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:a,story:i}=o,s=this.currentPackage(),l=a.historyPushCount,c=a.compositionActive,d=a.checkpoint(),m=false,f=new Set,h=false,y,P=new Set,T=false,M,p=false,x;a.graftPackage(()=>this.currentPackage());let k=a.transact(O=>{x=cc(O),n({...O,applyTo:(D,F)=>{let w=O.applyTo(D,F);return w&&D!==i.partName&&(p=true),w},applyPackage:D=>O.applyPackage(F=>{let w=D(F);return w!==F&&!p&&(p=mc(F,w,i.partName)),w}),apply:D=>(D.op==="setListNumbering"&&Number(D.numId)>0&&(T=true),D.op==="setParagraphProperties"&&(M??=D.properties.find(F=>F.localName==="pStyle")?.attributes?.val),m||(D.op==="deleteText"&&Tc(this.pkg,a,D,f)||D.op==="deleteBlock"&&Cc(this.pkg,a,D,f)||pa.has(D.op)||ua.has(D.op))&&(m=true),h||(D.op==="deleteText"||D.op==="deleteBlock"?h=Dc(()=>y??=chunkDCILO4XD_cjs.Uj(this.pkg),a,D,P):(pa.has(D.op)||ua.has(D.op))&&(h=true)),O.apply(D)),...x.context});},{...r,story:i,...i.kind==="headerFooter"||i.kind==="notesPart"?{minimumImpact:"global"}:{}});if(!k.ok)return {ok:false,reason:k.reason,...k.detail?{detail:k.detail}:{}};this.syncPackageFromStore(a);let v=false;if(k.change&&p&&(this.installPackageSnapshotInternal(a.package,false),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),v=true),T&&M){let O=gc(this.pkg,M);O&&this.replacePackageShell(O);}let A=false;if(k.change&&m){let O=this.currentPackage(),D=this.cascadeNoteReferences(s,O);if(D===null)return a.restoreCheckpoint(d),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"note-cascade-failed"};D!==O&&(this.installPackageSnapshotInternal(D),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),A=true);}if(k.change&&h){let O=this.currentPackage(),D=chunkDCILO4XD_cjs.Wj(s,O,{storyPartName:i.partName});if(D===null)return a.restoreCheckpoint(d),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"comment-cascade-failed"};D!==O&&(this.installPackageSnapshotInternal(D),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),A=true);}if(k.change){this.packageRev+=1;let O=A||v;if(!c&&r.recordsHistory!==false&&(a.historyPushCount>l||O))if(O)this.pushUndoPointer({kind:"package",before:s,after:this.currentPackage(),...x?.snapshot(k.change.caret)},Yt(r.historyGroup,s));else {let F=Yt(r.historyGroup,s);this.pushUndoPointer({kind:"story",partName:i.partName,story:i},F);}let D=O?this.publishSynthetic(k.change.origin,"global",i,k.change.created):k.change;return O||this.publish(D),{ok:true,change:D}}return {ok:true,change:k.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.historyPushCount;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.historyPushCount>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(chunkDCILO4XD_cjs.g.mutationHuman,"global",r??{kind:"body",partName:this.body.part.name},[]);return}n?.cancelComposition();}applyLifecycleOp(t,n={}){let r=()=>this.commitLifecycleOp(t,n.historyGroup);return chunkDCILO4XD_cjs.Hb(n.actorId,()=>chunkDCILO4XD_cjs.Xa(this,r,chunkDCILO4XD_cjs.Ya,n.historyGroup))}commitLifecycleOp(t,n){let r=this.currentPackage(),o=chunkDCILO4XD_cjs.Tk(chunkDCILO4XD_cjs.Bf(r),t);if(o)return {ok:false,reason:o};if(chunkDCILO4XD_cjs.Fj(t)){let c=chunkDCILO4XD_cjs.Gj(r,t);if(!c.ok)return {ok:false,reason:c.reason,...c.detail?{detail:c.detail}:{}};if(c.package===r)return {ok:true,change:null};this.installPackageSnapshotInternal(c.package);let d=Yt(n,r);this.pushUndoPointer({kind:"package",before:r,after:c.package},d),this.packageRev+=1;let m={kind:"body",partName:this.body.part.name},f=this.publishSynthetic(chunkDCILO4XD_cjs.g.mutationHuman,c.impact,m,c.createdPartName?[c.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:f}}if(!chunkDCILO4XD_cjs.kj(t))return {ok:false,reason:"invalidArgs",detail:"not-lifecycle-op"};let a=chunkDCILO4XD_cjs.lj(r,t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};this.installPackageSnapshotInternal(a.package);let i=Yt(n,r);this.pushUndoPointer({kind:"package",before:r,after:a.package},i),this.packageRev+=1;let s={kind:"body",partName:this.body.part.name},l=this.publishSynthetic(chunkDCILO4XD_cjs.g.mutationHuman,a.impact,s,a.createdPartName?[a.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:l}}undo(){let t=this.undoOrder.pop();if(!t)return null;if(this.closeHistoryGroups(),t.kind==="package"){this.installPackageSnapshotInternal(t.before,true,t.restoreNumbering),this.redoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkDCILO4XD_cjs.g.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(this.closeHistoryGroups(),t.kind==="package"){this.installPackageSnapshotInternal(t.after,true,t.restoreNumbering),this.undoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkDCILO4XD_cjs.g.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(){return aa(this.undoOrder.at(-1),this.body,this.stories,"undo")}selectionForRedo(){return aa(this.redoOrder.at(-1),this.body,this.stories,"redo")}openStoryParts(){return ia(this.stories,this.pkg)}openedStoryCount(){return 1+this.stories.size}openStoryToken(){return dc(this.stories,this.pkg)}insertImage(t,n){return Bc(this,t,n)}applyFragmentPaste(t,n){return na(this,t,n)}replaceImage(t,n,r,o,a,i){return ga(this,t,n,r,o,a,i)}deleteImage(t,n){return Hc(this,t,n)}deleteImageTracked(t,n,r){return Vc(this,t,n,r)}embedExternalImage(t,n,r,o,a,i,s){return jc(this,t,n,r,o,a,i,s)}setDrawingMetadataWithHyperlink(t,n,r,o,a){return Gc(this,t,n,r,o,a)}applyImageProperties(t,n){return zc(this,t,n)}promoteStoryTransactionToPackageUnit(t,n,r,o){this.installPackageSnapshotInternal(n.package,false),n.restoreHistoryStacks(r),this.pushUndoPointer({kind:"package",before:t,after:this.currentPackage()}),this.packageRev+=1;let a=n.part.name===this.body.part.name?{kind:"body",partName:n.part.name}:this.storyRefForPart(n.part.name);return this.publishSynthetic(chunkDCILO4XD_cjs.g.mutationHuman,a?.kind==="headerFooter"?"global":"flow-structural",a??{kind:"body",partName:this.body.part.name},[])}publishStoryWrite(t){return t?(this.packageRev+=1,this.publish(t),t):null}adoptPackageUnit(t){this.adoptGroupedPackageUnit(t,void 0);}adoptGroupedPackageUnit(t,n){let r=this.currentPackage();t!==r&&this.pushUndoPointer({kind:"package",before:t,after:r},Yt(n,t));}installPackageSnapshot(t){this.installPackageSnapshotInternal(t);}installAuthoritativePackageSnapshot(t){this.installPackageSnapshotInternal(t,false);}publishRemotePackage(t,n){return Xc(this,t,n)}replacePackageShell(t){this.shellHyperlinks=Oc(this.shellHyperlinks,this.pkg,t);let n=t;n=chunkDCILO4XD_cjs.rg(n,this.body.part);for(let r of this.stories.values())t.parts.has(r.part.name)&&(n=chunkDCILO4XD_cjs.rg(n,r.part));this.pkg=n;}installPackageSnapshotInternal(t,n=true,r=false){let o=n?Rc(t,this.pkg,this.shellHyperlinks,r):t,a=o.parts.get(o.mainDocumentPart);if(!a)return;this.body.replacePart(a);for(let[s,l]of this.stories){let c=o.parts.get(s);c&&l.replacePart(c);}this.rIdToPartName.clear();let i=o.relationships.get(o.mainDocumentPart)??[];for(let s of i){if(s.type!==da&&s.type!==ma)continue;let l=chunkDCILO4XD_cjs.N(s);l.mode!=="Internal"||!l.target.ok||this.stories.has(l.target.partName)&&o.parts.has(l.target.partName)&&this.rIdToPartName.set(s.id,l.target.partName);}this.pkg=o,this.pkg=chunkDCILO4XD_cjs.rg(this.pkg,this.body.part);for(let s of this.stories.values())this.pkg.parts.has(s.part.name)&&(this.pkg=chunkDCILO4XD_cjs.rg(this.pkg,s.part));}openNotesPartStore(t){let n=chunkDCILO4XD_cjs.pj(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=chunkDCILO4XD_cjs.Eb(n),a=new Tt(o,this.storyStoreOptions()),i={kind:"notesPart",partName:o.name,noteKind:t};return a.setStoryRef(i),this.stories.set(o.name,a),o!==n&&(this.pkg=chunkDCILO4XD_cjs.rg(this.pkg,o)),{ok:true,story:i,store:a}}openHeaderFooterStore(t){let n=this.rIdToPartName.get(t);if(n){let l=this.stories.get(n);if(l)return {ok:true,story:{kind:"headerFooter",partName:n,rId:t},store:l}}let r=Ac(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 a=chunkDCILO4XD_cjs.Eb(r.part),i=new Tt(a,this.storyStoreOptions()),s={kind:"headerFooter",partName:a.name,rId:t};return i.setStoryRef(s),this.stories.set(a.name,i),this.rIdToPartName.set(t,a.name),a!==r.part&&(this.pkg=chunkDCILO4XD_cjs.rg(this.pkg,a)),{ok:true,story:s,store:i}}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=chunkDCILO4XD_cjs.rg(this.pkg,t.part);}closeHistoryGroups(){chunkDCILO4XD_cjs.In(this.body,this.stories,null),this.historyGroups.close();}pushUndoPointer(t,n){t=this.historyGroups.admit(t,n,this.undoOrder,r=>(r===this.body.part.name?this.body:this.stories.get(r))?.discardNewestUndoEntry()??null,()=>this.currentPackage()),chunkDCILO4XD_cjs.In(this.body,this.stories,t),this.undoOrder.push(t),this.redoOrder.length=0,this.undoOrder.length>this.historyLimit&&this.undoOrder.shift(),this.evictUnreachableStories();}evictUnreachableStories(){let t=Jc({pkg:this.pkg,stories:this.stories,rIdToPartName:this.rIdToPartName,bodyPartName:this.body.part.name,shellHyperlinks:this.shellHyperlinks,undoOrder:this.undoOrder,redoOrder:this.redoOrder});this.pkg=t.pkg,this.shellHyperlinks=t.shellHyperlinks;}publish(t){this.lastChange=t;for(let n of this.subscribers)n(t);}publishSynthetic(t,n,r,o){this.commitCounter+=1;let a=Qc(this.commitCounter,this.packageRev,t,n,r,o);return this.publish(a),a}};function ed(e,t){let n=e,r=chunkDCILO4XD_cjs.Va(),o=[];for(let[a,i]of t){let s=n.parts.get(a);if(!s)continue;let l=m=>{if(i.removed.has(m.id))return null;if(m.kind==="textValue")return m;let f=i.replaced.get(m.id)??m,h;for(let y=0;y<m.children.length;y+=1){let P=m.children[y],T=l(P);T!==P&&h===void 0&&(h=m.children.slice(0,y)),h!==void 0&&T!==null&&h.push(T);}if(r){for(let y=m.children.length-1;y>=0;y-=1)i.removed.has(m.children[y].id)&&o.push(()=>chunkDCILO4XD_cjs.$a(m.id,y,1,[]));for(let y=0;y<f.attributes.length;y+=1){let P=f.attributes[y];P!==m.attributes[y]&&o.push(()=>chunkDCILO4XD_cjs._a(m.id,{namespaceUri:P.namespaceUri,localName:P.localName,...P.prefix===void 0?{}:{prefix:P.prefix}},P.value));}}return h!==void 0||f!==m?Object.freeze({...f,children:h===void 0?m.children:Object.freeze(h)}):m},c=l(s.root);if(c===s.root)continue;if(c===null)return null;let d=chunkDCILO4XD_cjs.Za(()=>chunkDCILO4XD_cjs.kb(s,s.root.id,c,{deferValidation:true}));if(!d.ok)return null;n=chunkDCILO4XD_cjs.rg(n,d.part);}for(let a of o)a();return n}function ya(e){for(let t=e.children.length-1;t>=0;t-=1){let n=e.children[t];if(n.kind==="paragraph")return chunkDCILO4XD_cjs.jf(n,chunkDCILO4XD_cjs.ua,"paraId")?.toUpperCase()??null}return null}function td(e,t,n){return t.length===0?e:wp(e,t,n,chunkDCILO4XD_cjs.Jj(e))}function wp(e,t,n,r){let o=chunkDCILO4XD_cjs.kf(e,n.storyPartName),a=o===null?void 0:e.parts.get(o);if(!a)return e;let i=[];if(!chunkDCILO4XD_cjs.hf(r))return null;chunkDCILO4XD_cjs.if(a.root,r,w=>w.kind!=="comment"?false:(chunkDCILO4XD_cjs.jf(w,chunkDCILO4XD_cjs.pa,"id")!==void 0&&i.push({partName:a.name,node:w}),true));let s=chunkDCILO4XD_cjs.Kj(e,n),l=chunkDCILO4XD_cjs.mf(e,[s.extended,s.ids],r);if(r.truncated)return null;let c=e.parts.get(n.storyPartName),d=c===void 0?null:n.noteId===void 0?c.root:chunkDCILO4XD_cjs.ad(c.root).find(w=>chunkDCILO4XD_cjs.Rc(w)===n.noteId)??null,m=new Map,f=new Map;for(let w of e.parts.values()){if(!w.name.endsWith(".xml"))continue;if(!chunkDCILO4XD_cjs.hf(r))return null;if(w.root===d)continue;let N;if(chunkDCILO4XD_cjs.if(w.root,r,S=>{if(S===d)return true;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(S.kind))return false;let I=chunkDCILO4XD_cjs.jf(S,chunkDCILO4XD_cjs.pa,"id");return I===void 0||(N??=chunkDCILO4XD_cjs.kf(e,w.name)===o,N&&(m.set(`${w.name}\0${S.id}`,I),f.set(I,(f.get(I)??0)+1))),true}),r.truncated)return null}let h=new Map,y=w=>{let N=h.get(w);return N||(N={removed:new Set,replaced:new Map},h.set(w,N)),N},P=w=>{let N=h.get(w.partName);return N?.removed.has(w.node.id)?null:N?.replaced.get(w.node.id)??w.node},T=w=>{y(w.partName).removed.add(w.node.id);let N=S=>{y(w.partName).removed.add(S.id);let I=`${w.partName}\0${S.id}`,_=m.get(I);if(_!==void 0&&(m.delete(I),f.set(_,f.get(_)-1)),S.kind!=="textValue")for(let q of S.children)N(q);};N(w.node);},M=(w,N,S,I)=>{let _=P(w);if(!_)return;let q=_.attributes.map(ee=>ee.kind==="genericExtension"&&ee.namespaceUri===N&&ee.localName===S&&ee.value!==I?{...ee,value:I}:ee);q.some((ee,K)=>ee!==_.attributes[K])&&y(w.partName).replaced.set(_.id,{..._,attributes:q});},p=()=>{let w=new Map,N=new Set;for(let S of i){let I=P(S);if(!I)continue;let _=chunkDCILO4XD_cjs.jf(I,chunkDCILO4XD_cjs.pa,"id");w.has(_)?N.add(_):w.set(_,{...S,node:I});}return {byId:w,duplicateIds:N}},x=()=>l.flatMap(w=>{let N=P(w);return N?[{...w,node:N}]:[]}),k=()=>chunkDCILO4XD_cjs.Lj(e,n,r,false,{records:p(),metadata:x()}),v=t.every(w=>w.parentCommentId===void 0)?k():null;if(r.truncated)return null;let A=v&&!v.malformed&&v.duplicateIds.size===0?v:null,O=new Set,D=new Map;for(let w of l){let N=chunkDCILO4XD_cjs.jf(w.node,chunkDCILO4XD_cjs.ef,"paraId")??chunkDCILO4XD_cjs.jf(w.node,chunkDCILO4XD_cjs.ff,"paraId");if(N===void 0)continue;let S=N.toUpperCase(),I=D.get(S);I?I.push(w):D.set(S,[w]);}let F=w=>{for(let N of w)for(let S of D.get(N)??[])P(S)&&T(S);};for(let w of t){let{commentId:N,parentCommentId:S}=w;if(S!==void 0){let K=p().byId,ae=K.get(N),B=K.get(S);if(!ae||!B||N===S||(O.add(N),(f.get(N)??0)>0))continue;let V=ya(ae.node),z=ya(B.node);for(let ne of K.values())chunkDCILO4XD_cjs.jf(ne.node,chunkDCILO4XD_cjs.ff,"parentId")===N&&M(ne,chunkDCILO4XD_cjs.ff,"parentId",S);if(V!==null&&z!==null)for(let ne of l){let ie=P(ne);ne.partName===s.extended&&ie&&chunkDCILO4XD_cjs.jf(ie,chunkDCILO4XD_cjs.ef,"paraIdParent")?.toUpperCase()===V&&M(ne,chunkDCILO4XD_cjs.ef,"paraIdParent",z);}T(ae),V!==null&&F(new Set([V]));continue}let I=A??k();if(r.truncated)return null;if(!I.records.has(N))continue;let _=chunkDCILO4XD_cjs.Mj(N,I.childrenOf,r);if(r.truncated)return null;let q=new Set,ee=[..._].filter(K=>(f.get(K)??0)===0);for(let K of _)O.add(K);for(let K of ee){let ae=I.records.get(K);if(!ae)continue;let B=ya(ae.node);if(B!==null&&q.add(B),T(ae),A){A.records.delete(K),A.childrenOf.delete(K);let V=A.parentCommentIdByChildId.get(K);if(V!==void 0){let z=A.childrenOf.get(V);z&&A.childrenOf.set(V,z.filter(ne=>ne!==K));}}}F(q);}if(d&&O.size>0){if(!chunkDCILO4XD_cjs.hf(r))return null;let w=chunkDCILO4XD_cjs.nf(d,O,r);if(w.truncated)return null;let N=y(n.storyPartName).removed;for(let S of w.emptiedRuns)N.add(S);for(let S of w.doomed)N.add(S);}return ed(e,h)}var Ep=256,Tp=65535,nd=64;function Fr(e,t){return e.length>t}function rd(e){return typeof e!="string"||e.trim().length===0?"invalid-author":Fr(e,Ep)?"resource-limit":chunkDCILO4XD_cjs.X(e)?null:"invalid-author"}function od(e){return typeof e!="string"||e.length===0?"invalid-text":Fr(e,Tp)?"resource-limit":chunkDCILO4XD_cjs.X(e)?null:"invalid-text"}function xa(e){if(typeof e!="string")return {ok:false,rejection:"invalid-date"};let t=e.trim();if(Fr(t,nd))return {ok:false,rejection:"resource-limit"};if(!chunkDCILO4XD_cjs.X(t))return {ok:false,rejection:"invalid-date"};let n=chunkDCILO4XD_cjs.Nh(t);return n===null?{ok:false,rejection:"invalid-date"}:Fr(n,nd)?{ok:false,rejection:"resource-limit"}:{ok:true,value:n}}function kk(e){if(e===void 0)return null;let t=xa(e);return t.ok?null:t.rejection}function ka(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 Cp(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Pa(e,t){if(!e){let i=chunkDCILO4XD_cjs.Ib(t);return i?chunkDCILO4XD_cjs.Kb(new Set,i,chunkDCILO4XD_cjs.Fb):"0"}let n=-1,r=new Set,o=i=>{if(i.kind!=="textValue"){if(i.kind==="comment"){let s=Cp(i,chunkDCILO4XD_cjs.pa,"id");if(s!==void 0&&/^\d{1,10}$/.test(s)){let l=Number(s);Number.isSafeInteger(l)&&l<=chunkDCILO4XD_cjs.Fb&&(r.add(String(l)),l>n&&(n=l));}}for(let s of i.children)o(s);}};o(e.root);let a=chunkDCILO4XD_cjs.Ib(t);return a?chunkDCILO4XD_cjs.Kb(r,a,chunkDCILO4XD_cjs.Fb):String(n+1)}function ad(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 a of e.children){let i=ad(a,t);i!==a&&(r=true),o.push(i);}return r?{...e,children:o}:e}function Ap(e,t,n){let r=ad(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:chunkDCILO4XD_cjs.ua}]};return chunkDCILO4XD_cjs.kb(e,e.root.id,o,{deferValidation:true})}function id(e,t,n){let r=new Map;for(let a of t){if(a.stampParagraph===null)continue;let i=r.get(a.commentsPartName);i||(i=new Map,r.set(a.commentsPartName,i)),i.set(a.stampParagraph.id,{paragraph:a.stampParagraph,paraId:a.paraId});}let o=e;for(let[a,i]of r){let s=o.parts.get(a);if(!s)return null;let l=chunkDCILO4XD_cjs.Ab(s.root),c=l??"w14",d=new Map;for(let f of i.values())d.set(f.paragraph.id,n(f.paragraph,f.paraId,c));let m=Ap(s,d,l===null?c:null);if(!m.ok)return null;o=chunkDCILO4XD_cjs.rg(o,m.part);}return o}function sd(e,t,n){let r=e.root.children.map(o=>o.kind==="textValue"?o:t.get(o.id)??o);return chunkDCILO4XD_cjs.ib(e,e.root.id,[...r,...n],{deferValidation:true})}var dd="/word/comments.xml",md="/word/commentsExtended.xml",Na="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",Sa="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",_p=[Sa,"application/vnd.ms-word.commentsExtended+xml"],pd="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",va="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",kt="http://schemas.microsoft.com/office/word/2012/wordml";function vn(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Zt(e,t){return {kind:"genericExtension",namespaceUri:chunkDCILO4XD_cjs.pa,localName:e,prefix:"w",value:t}}function ct(e,t,n,r,o,a,i,s=[]){return {id:e,kind:t,namespaceUri:n,localName:o,prefix:r,namespaceBindings:s,attributes:a,children:i}}function ud(e,t,n,r,o){let a=t===e.mainDocumentPart?[t]:[t,e.mainDocumentPart];for(let i of a)for(let s of chunkDCILO4XD_cjs.tg(e,i)){if(s.type!==n)continue;let l=chunkDCILO4XD_cjs.E(i,s.rawTarget);if(!l.ok)continue;if(!e.parts.has(l.partName))return l.partName;let c=chunkDCILO4XD_cjs.ug(e,l.partName);if(c!==null&&(typeof r=="string"?c===r:r.includes(c)))return l.partName}return o}function Oa(e,t,n){let r=e.mainDocumentPart;for(let a of chunkDCILO4XD_cjs.tg(e,r)){if(a.type!==t)continue;let i=chunkDCILO4XD_cjs.E(r,a.rawTarget);if(i.ok&&i.partName===n)return e}let o=chunkDCILO4XD_cjs.zg(e,r);return chunkDCILO4XD_cjs.Ag(o,r,t,chunkDCILO4XD_cjs.hk(r,n)).pkg}function wa(e,t){return ud(e,t,pd,Na,dd)}function fd(e,t){let n=chunkDCILO4XD_cjs.kf(e,t),r=chunkDCILO4XD_cjs.lf(e,t,n).extended;return r!==null?r:ud(e,t,va,_p,md)}function ld(e){let t=new Set;for(let n of e.parts.values())for(let r of chunkDCILO4XD_cjs.zb(n.root))t.add(r);return t}function Up(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&vn(o,chunkDCILO4XD_cjs.pa,"id")===t){for(let a=o.children.length-1;a>=0;a-=1){let i=o.children[a];if(i.kind!=="paragraph")continue;let s=vn(i,chunkDCILO4XD_cjs.ua,"paraId");s!==void 0&&chunkDCILO4XD_cjs.vb(s)&&(n=s.toUpperCase());return}return}for(let a of o.children)r(a);}};return r(e.root),n}function Fp(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&vn(o,chunkDCILO4XD_cjs.pa,"id")===t){for(let a=o.children.length-1;a>=0;a-=1){let i=o.children[a];if(i.kind==="paragraph"){n=i;return}}return}for(let a of o.children)r(a);}};return r(e.root),n}function gd(e){let t=chunkDCILO4XD_cjs.Ab(e.root);if(t!==null)return {part:e,prefix:t};let n={...e.root,namespaceBindings:[...e.root.namespaceBindings,{prefix:"w14",namespaceUri:chunkDCILO4XD_cjs.ua}]},r=chunkDCILO4XD_cjs.kb(e,e.root.id,n,{deferValidation:true});return r.ok?{part:r.part,prefix:"w14"}:(chunkDCILO4XD_cjs.gb(e.root,n),{part:{...e,root:n},prefix:"w14"})}function hd(e,t,n){return ct(e.id,"paragraph",e.namespaceUri,e.prefix??"w",e.localName,[...e.attributes.filter(r=>!(r.namespaceUri===chunkDCILO4XD_cjs.ua&&r.localName==="paraId")),{kind:"genericExtension",namespaceUri:chunkDCILO4XD_cjs.ua,localName:"paraId",prefix:n,value:t}],e.children,e.namespaceBindings)}function Lp(e,t,n,r){let o=e.parts.get(t);if(!o)return e;let a=gd(o),i=chunkDCILO4XD_cjs.eb(a.part,n);if(!i||i.kind!=="paragraph")return chunkDCILO4XD_cjs.rg(e,a.part);let s=chunkDCILO4XD_cjs.kb(a.part,i.id,hd(i,r,a.prefix),{deferValidation:true});return chunkDCILO4XD_cjs.rg(e,s.ok?s.part:a.part)}function $p(e,t,n,r){let o=`${dd}#comment-${e}`,a=n.text!==n.text.trim(),i=ct(`${o}.t`,"text",chunkDCILO4XD_cjs.pa,"w","t",a?[{kind:"xmlSpace",namespaceUri:chunkDCILO4XD_cjs.qa,localName:"space",prefix:"xml",value:"preserve"}]:[],[{id:`${o}.tv`,kind:"textValue",value:n.text}]),s=ct(`${o}.rPr`,"runProperties",chunkDCILO4XD_cjs.pa,"w","rPr",[],[ct(`${o}.rStyle`,"generic",chunkDCILO4XD_cjs.pa,"w","rStyle",[Zt("val","CommentReference")],[])]),l=ct(`${o}.r`,"run",chunkDCILO4XD_cjs.pa,"w","r",[],[s,i]),c=ct(`${o}.pPr`,"paragraphProperties",chunkDCILO4XD_cjs.pa,"w","pPr",[],[ct(`${o}.pStyle`,"generic",chunkDCILO4XD_cjs.pa,"w","pStyle",[Zt("val","CommentText")],[])]),d=ct(`${o}.p`,"paragraph",chunkDCILO4XD_cjs.pa,"w","p",[{kind:"genericExtension",namespaceUri:chunkDCILO4XD_cjs.ua,localName:"paraId",prefix:r,value:t}],[c,l]);return ct(o,"comment",chunkDCILO4XD_cjs.pa,"w","comment",[Zt("id",e),Zt("author",n.author),...n.initials===void 0?[]:[Zt("initials",n.initials)],...n.date===void 0?[]:[Zt("date",n.date)]],[d])}function ba(e,t){let n=chunkDCILO4XD_cjs.Pa(t,{name:e,contentType:"application/xml"});return n.ok?n.part.root:null}function Ea(e,t){for(let M of [rd(t.author),od(t.text)])if(M)return {ok:false,reason:ka(M)};let n;if(t.date!==void 0){let M=xa(t.date);if(!M.ok)return {ok:false,reason:ka(M.rejection)};n=M.value;}let r={...t,...n===void 0?{}:{date:n}},o=e.package,a=e.part.name,i=wa(o,a),s=fd(o,a),l=o.parts.get(i),c=Pa(l,r.actorId),d=chunkDCILO4XD_cjs.yb(`${i}#${c}`,ld(o)),m=t.replyToCommentId===void 0?null:Up(l,t.replyToCommentId),f=t.replyToCommentId!==void 0&&m===null?Fp(l,t.replyToCommentId):null;if(t.replyToCommentId!==void 0&&m===null&&!f)return {ok:false,reason:"unknown-revision"};let h=f?chunkDCILO4XD_cjs.yb(`${i}#parent-${t.replyToCommentId}`,new Set([...ld(o),d])):null,y=m??h,P=t.anchor.endParagraphId??t.anchor.paragraphId,T=e.transact(M=>{let p=bn(M);p.applyPackage(x=>{let k=x.parts.has(i)?x:(()=>{let v=ba(i,`<w:comments xmlns:w="${chunkDCILO4XD_cjs.pa}"/>`);return v?chunkDCILO4XD_cjs.Bg(x,i,v,Na):null})();return k===null?x:Oa(k,pd,i)}),f&&h&&p.applyPackage(x=>Lp(x,i,f.id,h)),p.applyPackage(x=>{let k=x.parts.get(i);if(!k)return x;let v=gd(k),A=chunkDCILO4XD_cjs.jb(v.part,v.part.root.id,v.part.root.children.length,[$p(c,d,r,v.prefix)],{deferValidation:true});return A.ok?chunkDCILO4XD_cjs.rg(x,A.part):x}),y!==null&&(p.applyPackage(x=>{let k=x.parts.has(s)?x:(()=>{let v=ba(s,`<w15:commentsEx xmlns:w15="${kt}"/>`);return v?chunkDCILO4XD_cjs.Bg(x,s,v,Sa):null})();return k===null?x:Oa(k,va,s)}),p.applyPackage(x=>{let k=x.parts.get(s);if(!k)return x;let A=[...Bp(k).has(y.toUpperCase())?[]:[Ia(`${s}#ex-${y}`,y,void 0,false)],Ia(`${s}#ex-${d}`,d,y,false)],O=chunkDCILO4XD_cjs.jb(k,k.root.id,k.root.children.length,A,{deferValidation:true});return O.ok?chunkDCILO4XD_cjs.rg(x,O.part):x})),p.applyTo(a,{op:"insertCommentMarker",paragraphId:P,offset:t.anchor.end,commentId:c,marker:"reference"}),p.applyTo(a,{op:"insertCommentMarker",paragraphId:P,offset:t.anchor.end,commentId:c,marker:"end"}),p.applyTo(a,{op:"insertCommentMarker",paragraphId:t.anchor.paragraphId,offset:t.anchor.start,commentId:c,marker:"start"});},r.actorId===void 0?{}:{actorId:r.actorId});return T.ok?{ok:true,commentId:c,change:T.change}:{ok:false,reason:T.reason}}function Ra(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 cd(e){let t=Ra(e);if(!t)return null;let n=vn(t,chunkDCILO4XD_cjs.ua,"paraId");return n!==void 0&&chunkDCILO4XD_cjs.vb(n)?n.toUpperCase():null}function Bp(e){let t=new Map;if(!e)return t;let n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===kt&&r.localName==="commentEx"){let o=vn(r,kt,"paraId");o!==void 0&&chunkDCILO4XD_cjs.vb(o)&&t.set(o.toUpperCase(),r);}for(let o of r.children)n(o);}};return n(e.root),t}function Sn(e,t){return {kind:"genericExtension",namespaceUri:kt,localName:e,prefix:"w15",value:t}}function Hp(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 Vp(e,t,n){let r=[],o=false,a=false;for(let i of e.attributes){if(i.namespaceUri===kt&&i.localName==="done"){o=true,r.push({kind:"genericExtension",namespaceUri:i.namespaceUri,localName:i.localName,...i.prefix===void 0?{}:{prefix:i.prefix},value:n?"1":"0"});continue}i.namespaceUri===kt&&i.localName==="paraIdParent"&&(a=true),r.push(i);}return !a&&t!==void 0&&r.push(Sn("paraIdParent",t)),o||r.push(Sn("done",n?"1":"0")),Hp(e,r)}function Ia(e,t,n,r){return {id:e,kind:"generic",namespaceUri:kt,localName:"commentEx",prefix:"w15",namespaceBindings:[],attributes:[Sn("paraId",t),...n===void 0?[]:[Sn("paraIdParent",n)],Sn("done",r?"1":"0")],children:[]}}function Ta(e,t,n){return jp(e,t,n,chunkDCILO4XD_cjs.gf())}function jp(e,t,n,r){let o=e.package,a=e.part.name;if(chunkDCILO4XD_cjs.kf(o,a)===null)return {ok:false,reason:"unknown-comment"};let s=chunkDCILO4XD_cjs.Nj(o,t,{storyPartName:a},r);if(!s.ok)return {ok:false,reason:"unknown-comment"};let l=chunkDCILO4XD_cjs.of(o,r);if(l.truncated||r.truncated)return {ok:false,reason:"unknown-comment"};let c=l.used,d=new Map,m=[];for(let P of s.ids){let T=s.records.get(P);if(!T)return {ok:false,reason:"unknown-comment"};if(!Ra(T.node))return {ok:false,reason:"unknown-comment"};let p=cd(T.node),x=p??chunkDCILO4XD_cjs.yb(`${T.partName}#done-${P}`,c);p===null&&c.add(x),d.set(P,x);}for(let P of s.ids){let T=s.records.get(P),M=Ra(T.node),p=d.get(P),x=cd(T.node),k=s.parentCommentIdByChildId.get(P),v=s.parentParaIdByCommentId.get(P)??(k===void 0?void 0:d.get(k)),A=s.commentExByParaId.get(p);m.push({paraId:p,stampParagraph:x===null?M:null,commentsPartName:T.partName,parentParaId:v,existing:A?.node,existingParentParaId:A?.parentParaId,existingDone:A?.done??false});}if(m.length===0)return {ok:false,reason:"unknown-comment"};if(m.every(P=>P.existingDone===n))return {ok:true,changed:false,change:null};let f=s.extendedPartName??md,h=s.extendedPartName===null,y=e.transact(P=>{bn(P).applyPackage(M=>{let p=id(M,m,hd);if(p===null)return M;let x=p;if(!x.parts.has(f)){let D=ba(f,`<w15:commentsEx xmlns:w15="${kt}"/>`);if(!D)return M;let F=chunkDCILO4XD_cjs.Bg(x,f,D,Sa);x=h?Oa(F,va,f):F;}let k=x.parts.get(f);if(!k)return M;let v=new Map,A=[];for(let D of m){let F=D.existingParentParaId??D.parentParaId;D.existing?v.set(D.existing.id,Vp(D.existing,F,n)):A.push(Ia(`${f}#done-${D.paraId}`,D.paraId,F,n));}let O=sd(k,v,A);return O.ok?chunkDCILO4XD_cjs.rg(x,O.part):M});});return y.ok?{ok:true,changed:true,change:y.change}:{ok:false,reason:y.reason}}function Gp(e,t){let n=wa(e,t);return e.parts.has(n)&&chunkDCILO4XD_cjs.ug(e,n)===Na}function zp(e,t){return wa(e,t)}function Wp(e,t){return fd(e,t)}var yd={kind:"body"};function Kp(e,t,n=yd,r){let o=n.kind==="body"?null:e.resolveStory(n),a=o?.ok?o.store:e.bodyStore(),i=e.currentPackage(),s=a.checkpoint();return a.graftPackage(()=>e.currentPackage()),chunkDCILO4XD_cjs.Xa(e,()=>{let l=Ea(a,t);return l.ok&&(a.restoreHistoryStacks(s),e.replacePackageShell(a.package),e.adoptGroupedPackageUnit(i,r),e.publishStoryWrite(l.change)),l},l=>chunkDCILO4XD_cjs.Ya(l),r)}function Xp(e,t,n,r){let o=e.bodyStore(),a=e.currentPackage(),i=chunkDCILO4XD_cjs.Tk(chunkDCILO4XD_cjs.Bf(a),{op:"setCommentResolved"});if(i)return {ok:false,reason:i};let s=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunkDCILO4XD_cjs.Xa(e,()=>{let l=Ta(o,t,n);return !l.ok||!l.changed||(o.restoreHistoryStacks(s),e.replacePackageShell(o.package),e.adoptGroupedPackageUnit(a,r),e.publishStoryWrite(l.change)),l},l=>l.ok&&l.changed,r)}function Yp(e,t,n=yd,r,o){if(t.length===0||chunkDCILO4XD_cjs.Tk(chunkDCILO4XD_cjs.Bf(e.currentPackage()),{op:"deleteComments"}))return false;let a=n.kind==="body"?e.bodyStore().part:e.partFor(n);if(!a)return false;let i={storyPartName:a.name,...r===void 0?{}:{noteId:r}},s=e.bodyStore(),l=e.currentPackage(),c=s.checkpoint();return s.graftPackage(()=>e.currentPackage()),chunkDCILO4XD_cjs.Xa(e,()=>{let d=false,m=false,f=s.transact(h=>{bn(h).applyPackage(P=>{let T=td(P,t,i);return T===null?(d=true,P):(m=T!==P,T)});});return d||!f.ok||!m?false:(s.restoreHistoryStacks(c),e.installPackageSnapshot(s.package),e.adoptGroupedPackageUnit(l,o),e.publishStoryWrite(f.change),true)},d=>d,o)}var kd=256*1024,Pd=4096;function qp(e,t){for(let n=chunkDCILO4XD_cjs.fb(e.part,t);n;n=chunkDCILO4XD_cjs.fb(e.part,n.id)){if(n.kind==="paragraph")return false;if(n.kind.startsWith("revision"))return true}return false}function Ca(e,t,n){let r=t.payload,o=e.part.name,a=n??o;if(r){if(r.data.length>kd)return {ok:false,reason:"payload-too-large",detail:"data"};if(r.label.length>Pd)return {ok:false,reason:"payload-too-large",detail:"label"}}if(t.revision&&(t.replaceControlId!==void 0||t.replaceUntil!==void 0))return {ok:false,reason:"unsupported",detail:"tracked custom node wrap or rewrite"};let i=t.revision?{revision:t.revision}:{};if(t.replaceControlId!==void 0&&qp(e,t.replaceControlId))return {ok:false,reason:"unsupported",detail:"custom node inside a pending revision"};let s=new Set(chunkDCILO4XD_cjs.sc(e.part.root).map(h=>h.node.id)),l=t.replaceControlId===void 0?[]:Od(e,o,t.replaceControlId),c=null,d,m=e.transact(h=>{if(t.replaceControlId!==void 0){h.apply({op:"removeContentControl",controlId:t.replaceControlId,keepContent:false});for(let T of l)h.applyPackage(M=>chunkDCILO4XD_cjs.pk(M,T.partName,T.nodeId));}let y=t.replaceUntil;if(y!==void 0&&y<=t.offset){c="invalid-range",d="replaceUntil must be past offset";return}if(y!==void 0&&h.apply({op:"deleteText",paragraphId:t.paragraphId,start:t.offset,end:y}),!r){h.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},...i});return}let P=null;h.applyPackage(T=>{let M=chunkDCILO4XD_cjs.kk(T,a,r.namespaceUri,r.rootLocalName);if(!M.part)return c="store-not-authored",d=`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})`,T;if(P=chunkDCILO4XD_cjs.uk(M.part,r.rootLocalName,r.nodeId),!P)return c="unaddressable-payload",d=`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`,T;let p=chunkDCILO4XD_cjs.ok(M.pkg,M.part.partName,{id:r.nodeId,label:r.label,data:r.data});return chunkDCILO4XD_cjs.nk(p,M.part.partName,r.nodeId)?p:(c="store-not-authored",d="the payload node could not be written into the store",T)}),!(c!==null||!P)&&h.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,...i});});if(c!==null)return {ok:false,reason:c,...d===void 0?{}:{detail:d}};if(!m.ok)return {ok:false,reason:m.reason,...m.detail===void 0?{}:{detail:m.detail}};let f=Jp(e,s);return {ok:true,change:m.change,...f===void 0?{}:{nodeId:f}}}function Jp(e,t){for(let n of chunkDCILO4XD_cjs.sc(e.part.root))if(!t.has(n.node.id))return n.node.id}function Od(e,t,n){let r=chunkDCILO4XD_cjs.sc(e.part.root).find(a=>a.node.id===n);if(!r)return [];let o=[];for(let a of chunkDCILO4XD_cjs.ik(e.package,t)){let i=chunkDCILO4XD_cjs.xk(r.node,a.itemId);i!==null&&o.push({partName:a.partName,nodeId:i});}return o}function Ma(e,t){let n=e.part.name,r=Od(e,n,t),o=e.transact(a=>{a.apply({op:"removeContentControl",controlId:t,keepContent:false});for(let i of r)a.applyPackage(s=>chunkDCILO4XD_cjs.pk(s,i.partName,i.nodeId));});return o.ok?{ok:true,change:o.change}:{ok:false,reason:o.reason,...o.detail===void 0?{}:{detail:o.detail}}}function Qp(e,t,n){if(!e.parts.has(t)||n.length===0)return {ok:true,pkg:e,removed:[]};let r=e,o=[];for(let a of n){let i=chunkDCILO4XD_cjs.jk(r,t,a);if(!i)continue;let s=chunkDCILO4XD_cjs.wk(r,i.itemId),l=chunkDCILO4XD_cjs.qk(r,i.partName,s);if(l.pkg===r&&chunkDCILO4XD_cjs.mk(r,i.partName).some(c=>!s.has(c.id)))return {ok:false,reason:`the payload store for ${a} refused the sweep`};r=l.pkg,o.push(...l.removed);}return {ok:true,pkg:r,removed:o}}var xd=new WeakMap;function Zp(e,t){let n=xd.get(e);n||(n=new Map,xd.set(e,n));let r=n.get(t);if(r)return r;let o=chunkDCILO4XD_cjs.ik(e,t).map(a=>({itemId:a.itemId,nodes:new Map(chunkDCILO4XD_cjs.mk(e,a.partName).map(i=>[i.id,i]))}));return n.set(t,o),o}function eu(e,t,n=t){let r=new Map,o=e.parts.get(t);if(!o)return r;let a=Zp(e,n);if(a.length===0)return r;for(let i of chunkDCILO4XD_cjs.sc(o.root))for(let s of a){let l=chunkDCILO4XD_cjs.xk(i.node,s.itemId);if(l===null)continue;let c=s.nodes.get(l);if(c){r.set(i.node.id,{nodeId:l,label:c.label,data:c.data});break}}return r}function tu(e,t,n){let r=new Map,o=chunkDCILO4XD_cjs.jk(e,t,n);if(!o)return r;for(let a of chunkDCILO4XD_cjs.mk(e,o.partName))r.set(a.id,{label:a.label,data:a.data});return r}var bd={kind:"body"};function Rd(e,t,n,r){let o=t.kind==="body"?null:e.resolveStory(t),a=o?.ok?o.store:e.bodyStore(),i=e.currentPackage(),s=a.checkpoint();return a.graftPackage(()=>e.currentPackage()),chunkDCILO4XD_cjs.Xa(e,()=>{let l=n(a);return l.ok&&(a.restoreHistoryStacks(s),e.replacePackageShell(a.package),e.adoptGroupedPackageUnit(i,r),e.publishStoryWrite(l.change)),l},l=>chunkDCILO4XD_cjs.Ya(l),r)}function nu(e,t,n=bd,r){return Rd(e,n,o=>Ca(o,t,e.bodyStore().part.name),r)}function ru(e,t,n=bd){return Rd(e,n,r=>Ma(r,t))}var en="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Lr="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",wn="http://purl.org/dc/elements/1.1/",Da="application/vnd.openxmlformats-package.core-properties+xml",Aa={author:[wn,"creator"],title:[wn,"title"],subject:[wn,"subject"],comments:[wn,"description"],keywords:[en,"keywords"],category:[en,"category"]},Id={...Aa,lastAuthor:[en,"lastModifiedBy"]},hP=Object.keys(Id);function $r(e){let t=(e.relationships.get("/")??[]).find(r=>r.type===Lr);if(!t||t.targetMode!=="Internal")return null;let n=chunkDCILO4XD_cjs.E("/",t.rawTarget);return n.ok?e.parts.get(n.partName)??null:null}function yP(e,t){let n=$r(e),[r,o]=Id[t],a=n?.root.children.find(i=>i.kind!=="textValue"&&i.namespaceUri===r&&i.localName===o);return a&&a.kind!=="textValue"?a.children.map(i=>i.kind==="textValue"?i.value:"").join(""):""}function ou(e){if(!e||typeof e!="object"||Array.isArray(e))return false;let t=Object.entries(e);return t.length>0&&t.every(([n,r])=>Object.hasOwn(Aa,n)&&typeof r=="string"&&r.length<=4096&&chunkDCILO4XD_cjs.X(r))}function xP(e,t){if(!ou(t)||(e.relationships.get("/")??[]).filter(s=>s.type===Lr).length>1)return null;let n=$r(e);if(n&&(n.contentType!==Da||n.root.namespaceUri!==en||n.root.localName!=="coreProperties")||!n&&(e.relationships.get("/")??[]).some(s=>s.type===Lr))return null;let r=n?.name??"/docProps/core.xml";if(!n&&(e.parts.has(r)||e.partBytes.has(r)))return null;let o=chunkDCILO4XD_cjs.Pa(`<cp:coreProperties xmlns:cp="${en}" xmlns:dc="${wn}">${Object.entries(t).map(([s,l])=>{let[c,d]=Aa[s],m=c===en?"cp":"dc";return `<${m}:${d}>${chunkDCILO4XD_cjs.V(l)}</${m}:${d}>`}).join("")}</cp:coreProperties>`,{name:r,contentType:Da});if(!o.ok)return null;if(n){let s=n,l=chunkDCILO4XD_cjs.cb(n),c=d=>d.kind==="textValue"?{...d,id:l()}:{...d,id:l(),children:d.children.map(c)};for(let d of o.part.root.children){if(d.kind==="textValue")continue;let m=s.root.children.filter(y=>y.kind!=="textValue"&&y.namespaceUri===d.namespaceUri&&y.localName===d.localName);if(m.length>1)return null;let f=m[0],h;if(f&&f.kind!=="textValue"){if(f.children.some(M=>M.kind!=="textValue"))return null;let y=f.children.length===1&&f.children[0]?.kind==="textValue"?f.children[0]:null,P=d.children.find(M=>M.kind==="textValue"),T=y&&P?.kind==="textValue"?[{...y,value:P.value}]:d.children.map(c);h=chunkDCILO4XD_cjs.kb(s,f.id,{...f,children:T});}else {let y=Array.from(s.root.children);y.push(c(d)),h=chunkDCILO4XD_cjs.ib(s,s.root.id,y);}if(!h.ok)return null;s=h.part;}return chunkDCILO4XD_cjs.rg(e,s)}let a=chunkDCILO4XD_cjs.Bg(e,r,o.part.root,Da);if(!a.parts.has(r))return null;let i=chunkDCILO4XD_cjs.Ag(a,"/",Lr,r.slice(1));return i.ok?i.pkg:null}var au="{6C3C8BC8-F283-45AE-878A-BAB7291924A1}",iu="{6668398D-A668-4E3E-A5EB-62B293D839F1}",su="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",lu=1024,cu=32,du=1e5,mu=8192,En=32768,pu=1e4;function uu(e){let t=new Map;if(e===void 0||e.trim()==="")return t;if(e.length>mu)return null;let n=/xmlns:([^\s=]+)\s*=\s*(?:'([^']*)'|"([^"]*)")/g,r="";for(let o of e.matchAll(n)){let a=o[1];if(!chunkDCILO4XD_cjs.ia(a))return null;t.set(a,o[2]??o[3]??""),r+=o[0];}return e.replace(n,"").trim()!==""||r===""?null:t}function Nd(e,t){let n=e.indexOf(":");if(n===-1)return chunkDCILO4XD_cjs.ia(e)?{namespaceUri:"",localName:e}:null;let r=e.slice(0,n),o=e.slice(n+1),a=t.get(r);return a===void 0||!chunkDCILO4XD_cjs.ia(o)?null:{namespaceUri:a,localName:o}}function fu(e,t){if(!e||e.length>lu||!e.startsWith("/"))return null;let n=e.slice(1).split("/");if(n.length===0||n.length>cu)return null;let r=[];for(let[o,a]of n.entries()){let i=o===n.length-1,s=a.trim();if(s==="text()"){if(!i||r.length===0)return null;r.push({kind:"text"});continue}if(s.startsWith("@")){let m=i&&r.length>0?Nd(s.slice(1),t):null;if(!m)return null;r.push({kind:"attribute",...m});continue}let l=/^([^[\]]+)(?:\[(\d{1,6})\])?$/.exec(s);if(!l)return null;let c=Nd(l[1],t),d=l[2]===void 0?1:Number(l[2]);if(!c||d<1||d>du)return null;r.push({kind:"element",...c,position:d});}return r}function gu(e){return e.kind!=="textValue"}function hu(e){let t="",n=0,r=[e];for(;r.length>0;){let o=r.pop();if(++n>pu)return null;if(o.kind==="textValue"){if(t+=o.value,t.length>En)return null;continue}for(let a=o.children.length-1;a>=0;a-=1)r.push(o.children[a]);}return t}function yu(e,t){let n=t[0];if(n?.kind!=="element"||n.position!==1||e.namespaceUri!==n.namespaceUri||e.localName!==n.localName)return null;let r=e;for(let o of t.slice(1)){if(o.kind==="attribute"){let s=r.attributes.find(l=>l.localName===o.localName&&l.namespaceUri===o.namespaceUri);return !s||s.value.length>En?null:s.value}if(o.kind==="text"){let s="";for(let l of r.children)l.kind==="textValue"&&(s+=l.value);return s.length>En?null:s}let a=0,i=null;for(let s of r.children)if(gu(s)&&!(s.localName!==o.localName||s.namespaceUri!==o.namespaceUri)&&(a+=1,a===o.position)){i=s;break}if(!i)return null;r=i;}return hu(r)}function Sd(e){let t=new Map;for(let i of chunkDCILO4XD_cjs.ik(e,e.mainDocumentPart)){let s=e.parts.get(i.partName),l=i.itemId.toUpperCase();s&&!t.has(l)&&t.set(l,s.root);}let n=$r(e);n&&t.set(au,n.root);let r=(e.relationships.get("/")??[]).find(i=>i.type===su&&i.targetMode!=="External"),o=r?chunkDCILO4XD_cjs.E("/",r.rawTarget):null,a=o?.ok?e.parts.get(o.partName):void 0;return a&&t.set(iu,a.root),t}function vd(e,t){let n=t.storeItemID?.trim().toUpperCase(),r=n?e.get(n):void 0;if(!r)return null;let o=uu(t.prefixMappings);if(!o)return null;let a=fu(t.xpath,o);return a?yu(r,a):null}var xu=96,Br="http://schemas.openxmlformats.org/officeDocument/2006/relationships",ku=new Set([`${Br}/header`,`${Br}/footer`,`${Br}/footnotes`,`${Br}/endnotes`]);function wd(e){let t=[],n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:o}=n.pop();if(!(r.kind==="textValue"||o>xu)){if(chunkDCILO4XD_cjs.Gh(r)&&chunkDCILO4XD_cjs.qc(r).dataBinding){t.push(r);continue}for(let a=r.children.length-1;a>=0;a-=1)n.push({node:r.children[a],depth:o+1});}}return t}function Pu(e,t){let n=t.replace(/\r\n?/g,`
1
+ 'use strict';var chunk2JVOX642_cjs=require('./chunk-2JVOX642.cjs'),fflate=require('fflate');var zd=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Wd=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Kd=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function el(e){return Wd.test(e)||Kd.test(e)}function ur(e,t){if(!el(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var Xd=/^(\d+)\.(\d+)\.(\d+)$/;function vt(e){let t=Xd.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function fr(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function gr(e,t){let n=vt(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=vt(r.slice(1));return fr(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let a=true;for(let i of o){let s=i.startsWith(">=")?">=":i.startsWith("<")?"<":null;if(!s)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let l=vt(i.slice(s.length)),c=fr(n,l);s===">="?a=a&&c>=0:a=a&&c<0;}return a}return fr(n,vt(r))===0}var Re=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},vo=(e,t)=>`${e}:${t}`;function Yd(e,t={}){let n=new Map;for(let c of e){if(ur(c.id,"extension"),tl(c.version,c.id),n.has(c.id))throw new Re("duplicate-extension",`duplicate extension id ${c.id}`,[c.id]);n.set(c.id,c);for(let d of c.contributions)ur(d.id,d.kind),tl(d.version,`${c.id} \u2192 ${d.id}`),d.replaces&&Qd(d.replaces.targetRange,`${c.id} \u2192 replaces ${d.replaces.targetId}`);}for(let c of e){for(let d of c.dependencies??[])if(!n.has(d))throw new Re("missing-dependency",`${c.id} requires missing extension ${d}`,[c.id,d]);for(let d of c.conflicts??[])if(n.has(d)){let m=[c.id,d].sort();throw new Re("conflict",`extensions ${m[0]} and ${m[1]} conflict`,m)}}Jd(n);let r=new Set(t.availablePorts??[]);for(let c of e)for(let d of c.contributions)d.kind==="runtimePort"&&r.add(d.id);for(let c of e)for(let d of c.requiredPorts??[])if(!r.has(d))throw new Re("missing-port",`${c.id} requires unavailable port ${d}`,[c.id,d]);let o=new Map,a=new Map,i=new Map;for(let c of e)for(let d of c.contributions){let m=vo(d.kind,d.id);if(d.replaces){let f=vo(d.kind,d.replaces.targetId),h=i.get(f)??[];h.push({ext:c.id,c:d}),i.set(f,h);continue}if(a.has(m)){let f=[o.get(m),c.id].sort();throw new Re("id-collision",`${d.kind} id ${d.id} registered by both ${f[0]} and ${f[1]}`,f)}a.set(m,d),o.set(m,c.id);}let s=new Map(a);for(let[c,d]of i){let m=a.get(c);if(!m){let y=d[0];throw new Re("replacement-target-missing",`${y.ext} replaces missing target ${y.c.replaces.targetId}`,[y.ext,y.c.replaces.targetId])}let f=m.replaceable??{kind:"none"};for(let{ext:y,c:P}of d){if(!gr(m.version,P.replaces.targetRange))throw new Re("replacement-version-mismatch",`${y} replaces ${P.replaces.targetId}@${m.version} outside range ${P.replaces.targetRange}`,[y,P.replaces.targetId]);if(f.kind==="none")throw new Re("unauthorized-replacement",`${P.replaces.targetId} does not authorize replacement (attempted by ${y})`,[y,P.replaces.targetId])}let h=qd(m,d);s.set(c,h);}return {extensions:n,contributions:s,get:(c,d)=>s.get(vo(c,d))}}function qd(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((s,l)=>(l.c.replaces.priority??0)-(s.c.replaces.priority??0)),a=o[0].c.replaces.priority??0,i=o.filter(s=>(s.c.replaces.priority??0)===a);if(i.length>1){let s=i.map(l=>l.ext).sort();throw new Re("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${a}: ${s.join(", ")}`,s)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new Re("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function Jd(e){let o=new Map,a=[],i=s=>{o.set(s,1),a.push(s);let l=[...e.get(s)?.dependencies??[]].sort();for(let c of l){let d=o.get(c)??0;if(d===1){let m=a.indexOf(c),f=[...a.slice(m),c];throw new Re("dependency-cycle",`dependency cycle: ${f.join(" -> ")}`,f)}d===0&&i(c);}a.pop(),o.set(s,2);};for(let s of [...e.keys()].sort())(o.get(s)??0)===0&&i(s);}function tl(e,t){try{vt(e);}catch{throw new Re("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Qd(e,t){try{gr("0.0.0",e);}catch{throw new Re("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var wt=class extends Error{constructor(t){super(t),this.name="BudgetError";}},pn=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new chunk2JVOX642_cjs.u(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new wt(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new wt(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new wt(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new wt(`${this.label}: budget already released`)}};var hr=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},un=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new hr(t.derivedOnly,t._reason)}}}};var yr=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},wo=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new yr(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(chunk2JVOX642_cjs.k.clock)}identity(){return this.resolve(chunk2JVOX642_cjs.k.identity)}},Eo=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},To=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Zd(e){let t=chunk2JVOX642_cjs.p(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",a={id:o,limits:t,config:n,ports:e.ports,budget:new pn(`op:${o}`,r),cancellation:new un};return Object.freeze(a)}function em(e){e.budget.dispose();}var Mo=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),nl=Object.keys(Mo);function tm(e,t){return new chunk2JVOX642_cjs.u(`${Mo[t].phase}:${t}`,e[t])}var Co=class{counter;current=0;peak=0;constructor(t){this.counter=new chunk2JVOX642_cjs.u("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function nm(){for(let e of nl){let t=chunk2JVOX642_cjs.o[e],n=chunk2JVOX642_cjs.n[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}var Qe="dev.docx-editor.core.comparator",Do={authoredState:{id:`${Qe}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${Qe}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${Qe}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${Qe}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${Qe}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${Qe}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${Qe}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${Qe}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${Qe}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${Qe}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Ao(e,t,n,r={}){let o=Do[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:rl(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let a=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,i=chunk2JVOX642_cjs.v(t,a),s=chunk2JVOX642_cjs.v(n,a);return i===s?{equal:true}:{equal:false,left:i,right:s}}}}function _o(e,t){let n=Do[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return chunk2JVOX642_cjs.w(t,r)}function rl(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>rl(r,t[o],n)):false}var al=new Set([...chunk2JVOX642_cjs.h,...chunk2JVOX642_cjs.i]),ol=/^[0-9a-f]{16}$/,rm=/^[0-9a-f]*$/;function Uo(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,a)=>{let i=`step[${a}]`;al.has(o.origin)||n(`${i}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${i}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${i}: baseRevision regressed below ${r}`);let s=o.expect;s.outcome==="applied"?(s.committedRevision===void 0?n(`${i}: applied step needs committedRevision`):s.committedRevision<=o.baseRevision?n(`${i}: committedRevision ${s.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=s.committedRevision,s.modelChange&&om(s.modelChange,i,n)):(s.committedRevision!==void 0&&n(`${i}: ${s.outcome} step must not commit a revision`),s.authoredStateHash!==void 0&&n(`${i}: ${s.outcome} step must not change authored state`)),s.authoredStateHash!==void 0&&!ol.test(s.authoredStateHash)&&n(`${i}: authoredStateHash must be 16-hex`),s.outputHash!==void 0&&!ol.test(s.outputHash)&&n(`${i}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),rm.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function om(e,t,n){al.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function am(e,t){let n=Uo(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,a)=>{let i=`step[${a}]`,s=t.applyStep(o),l=o.expect;if(s.outcome!==l.outcome){r.push(`${i}: outcome ${s.outcome} != expected ${l.outcome}`);return}if(l.outcome==="applied"&&(s.committedRevision!==l.committedRevision&&r.push(`${i}: revision ${s.committedRevision} != expected ${l.committedRevision}`),l.authoredStateHash!==void 0))if(s.authoredState===void 0)r.push(`${i}: store returned no authored state to hash`);else {Ao("authoredState",s.authoredState,s.authoredState).equal||r.push(`${i}: authored state is not self-consistent`);let d=il(s.authoredState);d!==l.authoredStateHash&&r.push(`${i}: authoredStateHash ${d} != expected ${l.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function il(e){return _o("authoredState",e)}var im="urn:schemas-microsoft-com:office:office";function sm(e){return e.namespaceUri!==chunk2JVOX642_cjs.pa?false:e.localName==="object"?true:e.localName==="pict"&&e.children.some(t=>t.kind!=="textValue"&&t.namespaceUri===im&&t.localName==="OLEObject")}function sl(e){if(e.kind==="textValue")return false;if(chunk2JVOX642_cjs.ob(e))return chunk2JVOX642_cjs.Ae(e)!==null;let t=e;return (t.kind==="drawing"||t.namespaceUri===chunk2JVOX642_cjs.pa&&t.localName==="drawing")&&chunk2JVOX642_cjs.ze(t)}function lm(e){return e.kind==="textValue"?false:sm(e)||sl(e)}function ll(e,t){let n=[...e];for(;n.length;){let r=n.pop();if(r.kind!=="textValue"){if(t(r))return true;for(let o of r.children)n.push(o);}}return false}function fn(e){return ll(e,lm)}function Og(e){return ll(e,sl)}var cl=24,kr=Object.freeze([Object.freeze({localName:"kern",attributes:Object.freeze({val:"2"})}),Object.freeze({localName:"sz",attributes:Object.freeze({val:String(cl)})}),Object.freeze({localName:"szCs",attributes:Object.freeze({val:String(cl)})})]),Pr=Object.freeze([Object.freeze({localName:"spacing",attributes:Object.freeze({after:"160",line:"278",lineRule:"auto"})})]),ml=Object.freeze({run:true,paragraph:true}),pl=Object.freeze({run:false,paragraph:false});function ul(e){if(!e)return ml;let t=n=>e.children.some(r=>r.kind!=="textValue"&&r.namespaceUri===chunk2JVOX642_cjs.pa&&r.localName===n);return {run:!t("rPrDefault"),paragraph:!t("pPrDefault")}}function Fo(e,t){return e&&e.namespaceUri!==chunk2JVOX642_cjs.pa?pl:ul(t)}function Ng(e){return e?e.namespaceUri!==chunk2JVOX642_cjs.pa?pl:ul(cm(e)):ml}function xr(e,t,n,r){return {id:n,kind:e,namespaceUri:chunk2JVOX642_cjs.pa,localName:t,prefix:"w",namespaceBindings:[],attributes:[],children:r}}function dl(e,t){let n=e==="rPr"?kr:Pr;return xr(e==="rPr"?"runProperties":"paragraphProperties",e,`${t}-${e}`,n.map(r=>chunk2JVOX642_cjs.Bk(r,`${t}-${e}-${r.localName}`)))}function cm(e){let t=e.children.find(n=>n.kind!=="textValue"&&n.namespaceUri===chunk2JVOX642_cjs.pa&&n.localName==="docDefaults");return t&&t.kind!=="textValue"?t:void 0}function fl(e,t,n){let r=Fo(e,t);if(!r.run&&!r.paragraph)return t;let o=[];r.run&&o.push(xr("generic","rPrDefault",`${n}-rPrDefault`,[dl("rPr",n)])),r.paragraph&&o.push(xr("generic","pPrDefault",`${n}-pPrDefault`,[dl("pPr",n)]));let a=r.run?[...o,...t?.children??[]]:[...t?.children??[],...o];return t?{...t,children:a}:xr("generic","docDefaults",`${n}-docDefaults`,a)}var Et="http://schemas.openxmlformats.org/officeDocument/2006/relationships",dm="http://schemas.openxmlformats.org/package/2006/relationships",mm="http://schemas.openxmlformats.org/drawingml/2006/main",yl="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",xl="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",kl="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Pl="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",Ol="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",Lo="application/vnd.openxmlformats-package.relationships+xml",$o=`${Et}/styles`,Bo=`${Et}/numbering`,bl=`${Et}/footnotes`,Rl=`${Et}/endnotes`,Il=`${Et}/officeDocument`,pm=`${Et}/theme`;function We(e){return e.kind!=="textValue"}function gl(e,t){return {...e,children:t}}function ht(e,t){if(t(e),e.kind!=="textValue")for(let n of e.children)ht(n,t);}var um=new Set(["pStyle","rStyle","tblStyle"]);function Ho(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue"&&um.has(r.localName)&&r.namespaceUri===chunk2JVOX642_cjs.pa){let o=chunk2JVOX642_cjs.Jh(r,"val");o&&t.add(o);}});}function Vo(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue"&&r.localName==="numId"&&r.namespaceUri===chunk2JVOX642_cjs.pa){let o=chunk2JVOX642_cjs.Jh(r,"val");o&&t.add(o);}});}function jo(e){let t=new Set;return gn(e,t),t}function gn(e,t){for(let n of e)ht(n,r=>{if(r.kind!=="textValue")for(let o of r.attributes)o.namespaceUri===Et&&o.value.length>0&&t.add(o.value);});}function He(e){return /^\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}function br(e,t){let n={footnote:new Set,endnote:new Set},r=[],o=a=>{for(let i of a)ht(i,s=>{if(s.kind!=="noteReference")return;let l=s.localName==="footnoteReference"?"footnote":"endnote",c=chunk2JVOX642_cjs.Jh(s,"id");if(c===void 0)return;let d=He(c);n[l].has(d)||(n[l].add(d),r.push({kind:l,id:d}));});};for(o(e);r.length>0;){let a=r.pop(),i=t(a.kind,a.id);i!==null&&o([i]);}return n}function Go(e,t,n){if(e.kind==="textValue")return e;let r=[],o=false;for(let a of e.children){if(a.kind!=="textValue"&&a.namespaceUri===chunk2JVOX642_cjs.pa&&(a.localName==="footnoteReference"||a.localName==="endnoteReference")){let l=a.localName==="footnoteReference"?t:n,c=chunk2JVOX642_cjs.Jh(a,"id");if(a.kind!=="noteReference"||c===void 0||!l.has(He(c))){o=true;continue}}let s=Go(a,t,n);s!==a&&(o=true),r.push(s);}return o?{...e,children:r}:e}function fm(e,t){for(let n of chunk2JVOX642_cjs.tg(e,t)){if(n.type!==$o||n.targetMode==="External")continue;let r=chunk2JVOX642_cjs.E(n.ownerPart,n.rawTarget);if(r.ok)return e.parts.get(r.partName)??null}return e.parts.get("/word/styles.xml")??null}function Nl(e,t,n){for(let r of chunk2JVOX642_cjs.tg(e,t)){if(r.type!==n||r.targetMode==="External")continue;let o=chunk2JVOX642_cjs.E(r.ownerPart,r.rawTarget);if(o.ok)return e.parts.get(o.partName)??null}return null}function Sl(e,t){let n=fm(e,t),r=new Map,o=[],a=null;if(n&&We(n.root))for(let i of n.root.children){if(!We(i))continue;if(i.localName==="docDefaults"&&i.namespaceUri===chunk2JVOX642_cjs.pa){a=i;continue}if(i.localName!=="style"||i.namespaceUri!==chunk2JVOX642_cjs.pa)continue;let s=chunk2JVOX642_cjs.Jh(i,"styleId");s&&r.set(s,i),(chunk2JVOX642_cjs.Jh(i,"default")==="1"||chunk2JVOX642_cjs.Jh(i,"default")==="true")&&o.push(i);}return {part:n,byId:r,defaults:o,docDefaults:a}}var gm=new Set(["basedOn","link","next"]);function vl(e,t){let n=new Set,r=[...t];for(let i of e.defaults){let s=chunk2JVOX642_cjs.Jh(i,"styleId");s&&r.push(s);}let o=[];for(;r.length>0;){let i=r.pop();if(n.has(i))continue;n.add(i);let s=e.byId.get(i);if(s){o.push(s);for(let l of s.children)if(We(l)&&gm.has(l.localName)&&l.namespaceUri===chunk2JVOX642_cjs.pa){let c=chunk2JVOX642_cjs.Jh(l,"val");c&&r.push(c);}}}if(!e.part||!We(e.part.root))return o;let a=new Map;return e.part.root.children.forEach((i,s)=>a.set(i,s)),o.sort((i,s)=>(a.get(i)??0)-(a.get(s)??0))}function zo(e,t,n){let r=Nl(e,t,Bo)??e.parts.get("/word/numbering.xml")??null;if(!r||!We(r.root)||n.size===0)return {part:r,nums:[],abstracts:[]};let o=[],a=new Set;for(let s of r.root.children){if(!We(s)||s.localName!=="num"||s.namespaceUri!==chunk2JVOX642_cjs.pa)continue;let l=chunk2JVOX642_cjs.Jh(s,"numId");if(!(!l||!n.has(l))){o.push(s);for(let c of s.children)if(We(c)&&c.localName==="abstractNumId"){let d=chunk2JVOX642_cjs.Jh(c,"val");d&&a.add(d);}}}let i=[];for(let s of r.root.children){if(!We(s)||s.localName!=="abstractNum"||s.namespaceUri!==chunk2JVOX642_cjs.pa)continue;let l=chunk2JVOX642_cjs.Jh(s,"abstractNumId");l&&a.has(l)&&i.push(s);}return {part:r,nums:o,abstracts:i}}var Or={latin:null,eastAsia:null,cs:null};function wl(e,t){let n=Nl(e,t,pm);if(!n)return {major:Or,minor:Or};let r={major:{...Or},minor:{...Or}};return ht(n.root,o=>{if(o.kind==="textValue"||o.namespaceUri!==mm||o.localName!=="majorFont"&&o.localName!=="minorFont")return;let a=o.localName==="majorFont"?r.major:r.minor;for(let i of o.children){if(!We(i))continue;let s=chunk2JVOX642_cjs.Jh(i,"typeface");s&&(i.localName==="latin"?a.latin=s:i.localName==="ea"?a.eastAsia=s:i.localName==="cs"&&(a.cs=s));}}),{major:r.major,minor:r.minor}}function hm(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 ym=[["asciiTheme","ascii"],["hAnsiTheme","hAnsi"],["eastAsiaTheme","eastAsia"],["cstheme","cs"]],hl=new Set(["themeColor","themeTint","themeShade","themeFill","themeFillTint","themeFillShade"]);function yt(e,t){if(e.kind==="textValue")return e;let n=e.attributes;if(e.localName==="rFonts"&&e.namespaceUri===chunk2JVOX642_cjs.pa){let a=[],i=new Map;for(let s of e.attributes){let l=ym.find(([c])=>c===s.localName);if(l&&s.namespaceUri===chunk2JVOX642_cjs.pa){let c=hm(t,s.value);c&&i.set(l[1],c);continue}a.push(s);}for(let[s,l]of i)a.some(c=>c.localName===s)||a.push({kind:"genericExtension",namespaceUri:chunk2JVOX642_cjs.pa,localName:s,prefix:"w",value:l});n=a;}else e.attributes.some(a=>hl.has(a.localName)&&a.namespaceUri===chunk2JVOX642_cjs.pa&&e.attributes.some(i=>i.localName==="val"))&&(n=e.attributes.filter(a=>!(hl.has(a.localName)&&a.namespaceUri===chunk2JVOX642_cjs.pa)));let r=e.children.map(a=>yt(a,t)),o=r.some((a,i)=>a!==e.children[i]);return n===e.attributes&&!o?e:{...e,attributes:n,children:r}}function El(e,t,n){return {id:e,name:e,contentType:t,root:n}}function Tl(e,t){if(e.root.kind==="document"){let r=e.root.children.find(a=>a.kind==="body"),o=r&&We(r)?gl(r,t):{id:"fragment#body",kind:"body",namespaceUri:chunk2JVOX642_cjs.pa,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return gl(e.root,[o])}let n={id:"fragment#body",kind:"body",namespaceUri:chunk2JVOX642_cjs.pa,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return {id:"fragment#document",kind:"document",namespaceUri:chunk2JVOX642_cjs.pa,localName:"document",prefix:"w",namespaceBindings:We(e.root)?e.root.namespaceBindings:[],attributes:[],children:[n]}}function hn(e){let t=e.map(n=>{let r=n.targetMode==="External"?' TargetMode="External"':"";return `<Relationship Id="${chunk2JVOX642_cjs.W(n.id)}" Type="${chunk2JVOX642_cjs.W(n.type)}" Target="${chunk2JVOX642_cjs.W(n.rawTarget)}"${r}/>`}).join("");return `<Relationships xmlns="${dm}">${t}</Relationships>`}function Cl(e,t){let n=t;for(;e.has(`rId${n}`);)n+=1;return `rId${n}`}function Ml(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}function Rr(e,t){return {...e,children:t}}function Ir(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunk2JVOX642_cjs.pa}function yn(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)yn(n,t);return t}function Dl(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=Dl(n,t);if(r)return r}return null}function xm(e){let t=(n,r)=>{if(n.kind==="textValue")return n;if(r&&Ir(n,"vMerge")){if(chunk2JVOX642_cjs.Jh(n,"val")==="restart")return n;let a=[...n.attributes.filter(i=>!(i.localName==="val"&&i.namespaceUri===chunk2JVOX642_cjs.pa)),{kind:"wmlVal",namespaceUri:chunk2JVOX642_cjs.pa,localName:"val",prefix:"w",value:"restart"}];return {...n,attributes:a}}if(n.kind==="paragraph"||n.kind==="table")return n;let o=r||Ir(n,"tc");return Rr(n,n.children.map(a=>t(a,o)))};return Rr(e,e.children.map(n=>t(n,false)))}function Al(e,t){if(!(e.kind==="textValue"||e.kind==="table")){if(Ir(e,"tr")){t.push(e);return}for(let n of e.children)Al(n,t);}}function _l(e,t,n){if(e.kind==="textValue"||e.kind==="table")return {node:e,hadRows:false,keptRows:false};if(Ir(e,"tr")){if(!t.has(e))return {node:null,hadRows:true,keptRows:false};let i=n.value?xm(e):e;return n.value=false,{node:i,hadRows:true,keptRows:true}}let r=false,o=false,a=[];for(let i of e.children){let s=_l(i,t,n);r||=s.hadRows,o||=s.keptRows,s.node!==null&&a.push(s.node);}return r?{node:o?Rr(e,a):null,hadRows:true,keptRows:o}:{node:e,hadRows:false,keptRows:false}}function Ul(e,t,n){let r=[];for(let l of e.children)Al(l,r);let o=new Set(yn(e).filter(l=>t.inRange.has(l)));if(o.size===0)return;let a=r.filter(l=>{let c=yn(l);return c.length>0&&c.every(d=>t.covered.has(d))}),i=new Set(a.flatMap(l=>yn(l)));if(a.length>0&&o.size===i.size&&[...o].every(l=>i.has(l))){let l={value:true},c=new Set(a),d=[];for(let m of e.children){let f=_l(m,c,l);f.node!==null&&d.push(f.node);}n.push(Rr(e,d));return}for(let l of yn(e)){if(!t.inRange.has(l))continue;let c=Dl(e,l);c&&n.push(c);}}var km="http://schemas.openxmlformats.org/package/2006/content-types",Pm=5e4;function Ze(e){return e.kind!=="textValue"}function Fl(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)Fl(n,t);return t}function Wo(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=Wo(n,t);if(r)return r}return null}function Om(){return {id:"fragment#styles",kind:"generic",namespaceUri:chunk2JVOX642_cjs.pa,localName:"styles",prefix:"w",namespaceBindings:[{prefix:"w",namespaceUri:chunk2JVOX642_cjs.pa}],attributes:[],children:[]}}function st(e,t){return {...e,children:t}}function bm(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunk2JVOX642_cjs.pa}function Rm(e){if(e.root.kind==="document"){let t=e.root.children.find(n=>n.kind==="body");return t&&Ze(t)?t:null}return Ze(e.root)?e.root:null}function Im(e,t){return Fl(e).some(n=>t.has(n))}function Ko(e,t,n){for(let r of e)if(Ze(r)){if(r.kind==="paragraph"){t.inRange.has(r.id)&&n.push(r);continue}if(t.fullBlocks.has(r.id)){n.push(r);continue}if(r.kind==="table"){Ul(r,t,n);continue}if(r.kind==="contentControl"){let o=r.children.find(a=>a.kind==="contentControlContent");o&&Ze(o)&&Ko(o.children,t,n);continue}Im(r,t.inRange)&&Ko(r.children,t,n);}}var Nm=new Set(["commentRangeStart","commentRangeEnd"]);function Sm(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}function Xo(e){if(e.kind==="textValue")return e;if(Nm.has(e.localName)&&e.namespaceUri===chunk2JVOX642_cjs.pa||Sm(e)||bm(e,"sectPr"))return null;let t=false,n=[];for(let r of e.children){let o=Xo(r);if(o===null){t=true;continue}o!==r&&(t=true),n.push(o);}return t?st(e,n):e}function vm(e){let t=[],n=l=>{if(l.kind!=="textValue"){if(l.kind==="run"){for(let c of l.children)if(c.kind==="fldChar"){let d=chunk2JVOX642_cjs.Jh(c,"fldCharType");t.push({nodeId:c.id,type:d==="separate"||d==="end"?d:"begin"});}else c.kind==="instrText"&&t.push({nodeId:c.id,type:"instr"});return}for(let c of l.children)n(c);}};for(let l of e)n(l);if(t.length===0)return e;let r=new Set,o=[],a=null,i=[];for(let l of t){if(l.type==="begin"){o.push({beginId:l.nodeId,separateId:null,instrIds:[]});continue}if(l.type==="separate"){let d=o[o.length-1];d?d.separateId=l.nodeId:a=l.nodeId;continue}if(l.type==="instr"){let d=o[o.length-1];d?d.instrIds.push(l.nodeId):a===null&&i.push(l.nodeId);continue}if(!o.pop()){r.add(l.nodeId),a!==null&&r.add(a);for(let d of i)r.add(d);a=null,i=[];}}for(let l of o){r.add(l.beginId),l.separateId!==null&&r.add(l.separateId);for(let c of l.instrIds)r.add(c);}a!==null&&r.add(a);for(let l of i)r.add(l);if(r.size===0)return e;let s=l=>{if(l.kind==="textValue")return l;if(r.has(l.id))return null;let c=[],d=false;for(let m of l.children){let f=s(m);if(f===null){d=true;continue}f!==m&&(d=true),c.push(f);}return d?st(l,c):l};return e.map(l=>s(l)).filter(l=>l!==null)}function Yo(e){if(e.kind==="textValue")return e.value.length;let t=0;for(let n of e.children)t+=Yo(n);return t}function wm(e,t){let n=[];for(let r of e.children){if(r.kind!=="contentControl"){n.push(r);continue}let o=t.get(r.id),a=Yo(r);if(o===void 0||a>=o){n.push(r);continue}if(a===0)continue;let i=r.children.find(s=>s.kind==="contentControlContent");i&&Ze(i)?n.push(...i.children):n.push(r);}return st(e,n)}function Em(e){let t=new Set,n=new Set,r=i=>{if(i.kind!=="textValue"){if(i.kind==="bookmarkStart"){let s=chunk2JVOX642_cjs.Jh(i,"id");s!==void 0&&t.add(s);}if(i.kind==="bookmarkEnd"){let s=chunk2JVOX642_cjs.Jh(i,"id");s!==void 0&&n.add(s);}for(let s of i.children)r(s);}};for(let i of e)r(i);let o=new Set([...t].filter(i=>n.has(i)));if(o.size===t.size&&o.size===n.size)return e;let a=i=>{if(i.kind==="textValue")return i;if(i.kind==="bookmarkStart"||i.kind==="bookmarkEnd"){let c=chunk2JVOX642_cjs.Jh(i,"id");return c!==void 0&&o.has(c)?i:null}let s=[],l=false;for(let c of i.children){let d=a(c);if(d===null){l=true;continue}d!==c&&(l=true),s.push(d);}return l?st(i,s):i};return e.map(i=>a(i)??i)}function Tm(e,t,n){let r=e.parts.get(t.partName);if(!r)return {ok:false,reason:"unknown-part"};if(t.paragraphIds.length===0)return {ok:false,reason:"empty-range"};let o=t.paragraphIds[0],a=t.paragraphIds[t.paragraphIds.length-1],i=new Map;for(let R of [o,a]){let G=Wo(r.root,R);if(!G)return {ok:false,reason:"empty-range"};for(let W of G.children)W.kind==="contentControl"&&i.set(W.id,Yo(W));}let s=r,l=Wo(s.root,a);if(!l)return {ok:false,reason:"empty-range"};let c=chunk2JVOX642_cjs.Gi(l);if(t.endOffset<c){let R=chunk2JVOX642_cjs.Gn(s,{op:"deleteText",paragraphId:a,start:t.endOffset,end:c},{deferValidation:true});if(!R.ok)return {ok:false,reason:"trim-refused"};s=R.part;}if(t.startOffset>0){let R=chunk2JVOX642_cjs.Gn(s,{op:"deleteText",paragraphId:o,start:0,end:t.startOffset},{deferValidation:true});if(!R.ok)return {ok:false,reason:"trim-refused"};s=R.part;}let d=Rm(s);if(!d)return {ok:false,reason:"unknown-part"};let m={inRange:new Set(t.paragraphIds),covered:new Set(t.coveredParagraphIds),fullBlocks:new Set(t.fullyCoveredBlockIds)},f=[];if(Ko(d.children,m,f),f.length===0)return {ok:false,reason:"empty-range"};if(f.length>Pm)return {ok:false,reason:"resource-limit"};let h=f.map(R=>Xo(R)).filter(R=>R!==null).map(R=>R.kind!=="paragraph"||R.id!==o&&R.id!==a?R:wm(R,i));h=[...vm(h)],h=[...Em(h)];let y=chunk2JVOX642_cjs.pj(e,"footnote"),P=chunk2JVOX642_cjs.pj(e,"endnote"),T=(R,G)=>Ze(R)&&R.namespaceUri===chunk2JVOX642_cjs.pa&&R.localName===G,p=br(h,(R,G)=>{let W=R==="footnote"?y:P;if(!W||!Ze(W.root))return null;for(let re of W.root.children){if(!T(re,R))continue;let Y=chunk2JVOX642_cjs.Jh(re,"id");if(Y!==void 0&&He(Y)===G)return re}return null}),x=p.footnote,k=p.endnote;x.size===0&&(y=null),k.size===0&&(P=null);let v=(R,G,W)=>{if(!R||!Ze(R.root))return [];let re=[];for(let Y of R.root.children){if(!T(Y,G))continue;let se=chunk2JVOX642_cjs.Jh(Y,"id"),g=chunk2JVOX642_cjs.Jh(Y,"type");if(g==="separator"||g==="continuationSeparator"){re.push(Y);continue}if(se!==void 0&&W.has(He(se))){let u=Xo(Y);u&&Ze(u)&&re.push(u);}}return re},A=v(y,"footnote",x),O=v(P,"endnote",k),D=[...A,...O];if(fn(h)||fn(D))return {ok:false,reason:"unsupported-content"};let F=[...h,...D],w=new Set;Ho(F,w);let N=Sl(e,e.mainDocumentPart),S=new Set;Vo(F,S);let I=[],_=zo(e,e.mainDocumentPart,S);for(;;){let R=w.size,G=S.size;I=vl(N,w),Vo(I,S),_=zo(e,e.mainDocumentPart,S);let W=[..._.nums,..._.abstracts];Ho(W,w);for(let re of W)ht(re,Y=>{if(Y.kind!=="textValue"&&(Y.localName==="styleLink"||Y.localName==="numStyleLink")&&Y.namespaceUri===chunk2JVOX642_cjs.pa){let se=chunk2JVOX642_cjs.Jh(Y,"val");se&&w.add(se);}});if(w.size===R&&S.size===G)break}let q=wl(e,e.mainDocumentPart),ee=I.map(R=>yt(R,q)),K=N.part&&Ze(N.part.root)?N.part.root:null,ae=fl(K,N.docDefaults,"fragment#doc-defaults"),B=ae?yt(ae,q):null;h=h.map(R=>yt(R,q));let V=A.map(R=>yt(R,q)),z=O.map(R=>yt(R,q)),ne=new Set;gn(h,ne);let ie=chunk2JVOX642_cjs.tg(e,r.name).filter(R=>ne.has(R.id)),Ne=new Map,Xe=0,Ce=R=>{let G=new Set;for(let W of R){if(W.targetMode==="External")continue;let re=chunk2JVOX642_cjs.E(W.ownerPart,W.rawTarget);if(!re.ok){G.add(W.id);continue}if((chunk2JVOX642_cjs.ug(e,re.partName)??"").toLowerCase().startsWith("image/")&&n?.omitMedia!==true){let se=e.partBytes.get(re.partName)??e.partBytes.get(re.partName.replace(/^\//,""));se?(Ne.set(re.partName,se),Xe+=se.byteLength):G.add(W.id);continue}G.add(W.id);}return G},Ve=Ce(ie),J=(R,G)=>{if(R.kind==="textValue")return R;if(R.kind==="drawing"||R.namespaceUri===chunk2JVOX642_cjs.pa&&(R.localName==="pict"||R.localName==="object")){let Y=new Set;gn([R],Y);for(let se of Y)if(G.has(se))return null;return R}let W=[],re=false;for(let Y of R.children){let se=J(Y,G);if(se===null){re=true;continue}se!==Y&&(re=true),W.push(se);}return re?st(R,W):R};Ve.size>0&&(h=h.map(R=>J(R,Ve)).filter(R=>R!==null));let Me=ie.filter(R=>!Ve.has(R.id)),de=(R,G)=>{if(!R)return [];let W=new Set;gn(G,W);let re=chunk2JVOX642_cjs.tg(e,R.name).filter(se=>W.has(se.id)),Y=Ce(re);if(Y.size>0)for(let se=0;se<G.length;se+=1){let g=J(G[se],Y);g!==null&&(G[se]=g);}return re.filter(se=>!Y.has(se.id))},At=de(y,V),dt=de(P,z),Pe=new Map,tt=[],nn=new Map,Oe=(R,G,W)=>{let re=El(R,G,W);Pe.set(R.slice(1),chunk2JVOX642_cjs.bf(chunk2JVOX642_cjs.Ha(re))),tt.push([R,G]),nn.set(R,re);},b=(R,G)=>R.map(W=>{if(W.targetMode==="External")return {...W,ownerPart:G};let re=chunk2JVOX642_cjs.E(W.ownerPart,W.rawTarget);return {...W,ownerPart:G,rawTarget:re.ok?re.partName:W.rawTarget}}),U=b(Me,"/word/document.xml"),$=b(At,"/word/footnotes.xml"),j=b(dt,"/word/endnotes.xml"),X=new Set(U.map(R=>R.id)),Z=9001,me=(R,G)=>{let W=Cl(X,Z);Z+=1,X.add(W),U.push({ownerPart:"/word/document.xml",id:W,type:R,rawTarget:G,targetMode:"Internal",order:U.length});},we=Tl(s,h);if(Oe("/word/document.xml",yl,we),ee.length>0||B){let R=st(K??Om(),[...B?[B]:[],...ee]);Oe("/word/styles.xml",xl,R),me($o,"styles.xml");}if(_.part&&(_.nums.length>0||_.abstracts.length>0)){let R=st(_.part.root,[..._.abstracts.map(G=>yt(G,q)),..._.nums]);Oe("/word/numbering.xml",kl,R),me(Bo,"numbering.xml");}y&&V.length>0&&(Oe("/word/footnotes.xml",Pl,st(y.root,V)),me(bl,"footnotes.xml"),$.length>0&&Pe.set("word/_rels/footnotes.xml.rels",chunk2JVOX642_cjs.bf(hn($)))),P&&z.length>0&&(Oe("/word/endnotes.xml",Ol,st(P.root,z)),me(Rl,"endnotes.xml"),j.length>0&&Pe.set("word/_rels/endnotes.xml.rels",chunk2JVOX642_cjs.bf(hn(j))));let xe=new Map;for(let[R,G]of Ne){Pe.set(R.slice(1),G);let W=Ml(R);W&&!xe.has(W)&&xe.set(W,chunk2JVOX642_cjs.H(chunk2JVOX642_cjs.ug(e,R)??"application/octet-stream"));}let De={ownerPart:"/",id:"rId1",type:Il,rawTarget:"word/document.xml",targetMode:"Internal",order:0};Pe.set("word/_rels/document.xml.rels",chunk2JVOX642_cjs.bf(hn(U))),Pe.set("_rels/.rels",chunk2JVOX642_cjs.bf(hn([De])));let Ye=[`<Default Extension="rels" ContentType="${Lo}"/>`,'<Default Extension="xml" ContentType="application/xml"/>',...[...xe].map(([R,G])=>`<Default Extension="${chunk2JVOX642_cjs.W(R)}" ContentType="${chunk2JVOX642_cjs.W(G)}"/>`)].join(""),Ae=tt.map(([R,G])=>`<Override PartName="${chunk2JVOX642_cjs.W(R)}" ContentType="${chunk2JVOX642_cjs.W(G)}"/>`).join("");Pe.set("[Content_Types].xml",chunk2JVOX642_cjs.bf(`<Types xmlns="${km}">${Ye}${Ae}</Types>`));let _e=new Map;_e.set("/",[De]),_e.set("/word/document.xml",U),$.length>0&&_e.set("/word/footnotes.xml",$),j.length>0&&_e.set("/word/endnotes.xml",j);let le=[];for(let R of _e.values())for(let G of R)G.targetMode==="External"&&le.push({ownerPart:G.ownerPart,id:G.id,type:G.type,rawTarget:G.rawTarget,sinkSafe:chunk2JVOX642_cjs.F(G.rawTarget).ok});let pe=new Map;pe.set("rels",Lo),pe.set("xml","application/xml");for(let[R,G]of xe)pe.set(R,G);let qe={defaults:pe,overrides:new Map(tt)},mt=new Map;for(let[R,G]of Pe)mt.set(R.startsWith("/")?R:`/${R}`,G);return {ok:true,bytes:chunk2JVOX642_cjs.af(Pe),package:Object.freeze({parts:nn,partBytes:mt,relationships:_e,externalTargets:le,contentTypes:qe,mainDocumentPart:"/word/document.xml"}),lastMarkCovered:t.lastMarkCovered,blockCount:h.length,mediaBytes:Xe}}function ue(e){return e.kind!=="textValue"}function oe(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunk2JVOX642_cjs.pa}function Ke(e,t){for(let n of e)t(n),n.kind!=="textValue"&&Ke(n.children,t);}function xt(e){if(e.kind==="textValue")return `T(${e.value})`;if(e.namespaceUri===chunk2JVOX642_cjs.pa&&e.localName.startsWith("rsid"))return "";let t=e.attributes.filter(r=>!r.localName.startsWith("rsid")&&!(r.namespaceUri===chunk2JVOX642_cjs.ua&&(r.localName==="paraId"||r.localName==="textId"))).map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(","),n=e.children.map(xt).join("");return `E(${e.namespaceUri}:${e.localName}[${t}]{${n}})`}function kn(e){return `S[${e.attributes.filter(n=>n.localName!=="styleId").map(n=>`${n.localName}=${n.value}`).sort().join(",")}]${e.children.map(xt).join("")}`}function vr(e){let t=[],n=new Map,r=new Set,o=null;if(e&&ue(e.root))for(let a of e.root.children){if(!ue(a))continue;if(oe(a,"docDefaults")){o=a;continue}if(!oe(a,"style"))continue;t.push(a);let i=chunk2JVOX642_cjs.Jh(a,"styleId");i&&n.set(i,a);let s=a.children.find(c=>oe(c,"name")),l=s?chunk2JVOX642_cjs.Jh(s,"val"):void 0;l&&r.add(l);}return {part:e,styles:t,docDefaults:o,byId:n,names:r}}function Nr(e,t,n){let r=new Map;if(!e)return r;let o=e.children.find(i=>oe(i,t));if(!o||!ue(o))return r;let a=o.children.find(i=>oe(i,n));if(!a||!ue(a))return r;for(let i of a.children)i.kind!=="textValue"&&r.set(i.localName,i);return r}function $l(e){let t=e.part?.root;return t&&ue(t)?t:null}function Ll(e){return Fo($l(e),e.docDefaults)}function Sr(e){return new Map(e.map(t=>[t.localName,chunk2JVOX642_cjs.Bk(t,`fragment#application-${t.localName}`)]))}function Cm(e,t){let n=new Set,r=t;for(let o=0;o<16&&r;o+=1){let a=e.byId.get(r);if(!a)break;let s=xn(a,"pPr")?.children.find(c=>oe(c,"spacing"));if(s&&ue(s))for(let c of s.attributes)n.add(c.localName);let l=a.children.find(c=>oe(c,"basedOn"));r=l?chunk2JVOX642_cjs.Jh(l,"val"):void 0;}return n}function qo(e,t,n,r){let o=t;for(let a=0;a<16&&o;a+=1){let i=e.byId.get(o);if(!i)return false;let s=i.children.find(c=>oe(c,n));if(s&&ue(s)&&s.children.some(c=>c.kind!=="textValue"&&c.localName===r))return true;let l=i.children.find(c=>oe(c,"basedOn"));o=l?chunk2JVOX642_cjs.Jh(l,"val"):void 0;}return false}function Mm(e,t){for(let n of e.styles){if(chunk2JVOX642_cjs.Jh(n,"type")!==t)continue;let r=chunk2JVOX642_cjs.Jh(n,"default");if(r==="1"||r==="true")return chunk2JVOX642_cjs.Jh(n,"styleId")}}function xn(e,t){let n=e.children.find(r=>oe(r,t));return n&&ue(n)?n:null}var Dm=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])),Am=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 Jo(e,t,n){let r=$l(t)?Ll(t):null,o=Ll(n),a=r?.run?Sr(kr):Nr(t.docDefaults,"rPrDefault","rPr"),i=o.run?Sr(kr):Nr(n.docDefaults,"rPrDefault","rPr"),s=r?.paragraph?Sr(Pr):Nr(t.docDefaults,"pPrDefault","pPr"),l=o.paragraph?Sr(Pr):Nr(n.docDefaults,"pPrDefault","pPr"),c=(x,k,v)=>{let A=Mm(x,"paragraph"),O=A?x.byId.get(A):void 0;if(!O)return A;for(let[D,F]of [["rPr",k],["pPr",v]]){let w=xn(O,D);if(w)for(let N of w.children)N.kind!=="textValue"&&F.set(N.localName,N);}return A};c(t,a,s),c(n,i,l);let d=new Map;for(let[x,k]of a){let v=i.get(x);(!v||xt(v)!==xt(k))&&d.set(x,k);}let m=new Map;for(let[x,k]of s){if(x==="sectPr")continue;let v=l.get(x);(!v||xt(v)!==xt(k))&&m.set(x,k);}if(d.size===0&&m.size===0)return e;let f=0,h=()=>`fragment#materialized-${f++}`,y=x=>{let k=v=>v.kind==="textValue"?{id:h(),kind:"textValue",value:v.value}:{...v,id:h(),children:v.children.map(k)};return k(x)},P=(x,k,v)=>{if(v.length===0)return x;let A=xn(x,k);if(A){let D=k==="rPr"?Am:Dm,F=[...A.children];for(let N of v){let S=N.kind==="textValue"?Number.MAX_SAFE_INTEGER:D.get(N.localName)??Number.MAX_SAFE_INTEGER,I=F.length;for(let _=0;_<F.length;_+=1){let q=F[_];if(q.kind==="textValue")continue;let ee=D.get(q.localName);if(ee!==void 0&&ee>S){I=_;break}}F.splice(I,0,N);}let w={...A,children:F};return {...x,children:x.children.map(N=>N===A?w:N)}}let O={id:h(),kind:k==="rPr"?"runProperties":"paragraphProperties",namespaceUri:chunk2JVOX642_cjs.pa,localName:k,prefix:"w",namespaceBindings:[],attributes:[],children:v};return {...x,children:[O,...x.children]}},T=(x,k,v,A,O)=>{let D=Cm(t,O),F=k.children.find(_=>oe(_,"spacing"));if(F&&ue(F))for(let _ of F.attributes)D.add(_.localName);let w=new Map(A&&ue(A)?A.attributes.map(_=>[_.localName,_.value]):[]),N=v.attributes.filter(_=>!D.has(_.localName)&&w.get(_.localName)!==_.value);if(N.length===0)return x;let S=F&&ue(F)?{...F,attributes:[...F.attributes,...N]}:{...v,id:h(),attributes:N,children:[]},I=F?{...k,children:k.children.map(_=>_===F?S:_)}:P(x,"pPr",[S]).children.find(_=>oe(_,"pPr"));return {...x,children:x.children.map(_=>_===k?I:_)}},M=x=>{let k=xn(x,"pPr"),v=k?.children.find(N=>oe(N,"pStyle")),A=v?chunk2JVOX642_cjs.Jh(v,"val"):void 0,O=[],D=x;for(let[N,S]of m){let I=k?.children.some(q=>q.kind!=="textValue"&&q.localName===N),_=!!A&&qo(t,A,"pPr",N);N==="spacing"&&(I||_)&&k!==null&&ue(S)&&(D=T(D,k,S,l.get("spacing"),A)),!(I||_)&&O.push(y(S));}let F=N=>{if(N.kind==="textValue")return N;if(N.kind==="run"){let I=xn(N,"rPr"),_=I?.children.find(K=>oe(K,"rStyle")),q=_?chunk2JVOX642_cjs.Jh(_,"val"):void 0,ee=[];for(let[K,ae]of d)I?.children.some(V=>V.kind!=="textValue"&&V.localName===K)||q&&qo(t,q,"rPr",K)||A&&qo(t,A,"rPr",K)||ee.push(y(ae));return P(N,"rPr",ee)}if(N.kind==="paragraphProperties"||N.kind==="runProperties")return N;let S=N.children.map(F);return S.some((I,_)=>I!==N.children[_])?{...N,children:S}:N};return F(P(D,"pPr",O))},p=x=>{if(x.kind==="textValue")return x;if(x.kind==="paragraph")return M(x);let k=x.children.map(p);return k.some((v,A)=>v!==x.children[A])?{...x,children:k}:x};return e.map(p)}var Bl="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Ie(e,t,n,r){return {...e,attributes:e.attributes.map(o=>o.localName===n&&o.namespaceUri===t?{...o,value:r}:o)}}var _m=new Set(["pStyle","rStyle","tblStyle","basedOn","link","next","styleLink","numStyleLink"]),Qo=chunk2JVOX642_cjs.Pb,lt=new Map;function zt(e,t){let n=t.styleIds??lt,r=t.numIds??lt,o=t.relIds??lt,a=t.footnoteIds??lt,i=t.endnoteIds??lt,s=t.bookmarkIds??lt,l=t.sdtIds??lt,c=t.revisionIds??lt,d=t.docPrIds??lt,m=(f,h)=>{if(f.kind==="textValue")return f;let y=f;if(f.namespaceUri===chunk2JVOX642_cjs.pa&&_m.has(f.localName)){let p=chunk2JVOX642_cjs.Jh(f,"val"),x=p!==void 0?n.get(p):void 0;x!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"val",x));}if(oe(f,"numId")){let p=chunk2JVOX642_cjs.Jh(f,"val"),x=p!==void 0?r.get(p):void 0;x!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"val",x));}if(f.kind==="noteReference"){let p=f.localName==="footnoteReference"?a:i,x=chunk2JVOX642_cjs.Jh(f,"id"),k=x!==void 0?p.get(He(x)):void 0;k!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"id",k));}if(f.kind==="bookmarkStart"||f.kind==="bookmarkEnd"){let p=chunk2JVOX642_cjs.Jh(f,"id"),x=p!==void 0?s.get(p):void 0;x!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"id",x));}if(oe(f,"id")&&h==="sdtPr"){let p=chunk2JVOX642_cjs.Jh(f,"val"),x=p!==void 0?l.get(p):void 0;x!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"val",x));}if(Qo(f)){let p=chunk2JVOX642_cjs.Jh(f,"id"),x=p!==void 0?c.get(p):void 0;x!==void 0&&(y=Ie(y,chunk2JVOX642_cjs.pa,"id",x));}if(f.kind==="drawingDocPr"){let p=f.attributes.find(k=>k.localName==="id"&&k.namespaceUri==="")?.value,x=p!==void 0?d.get(p):void 0;x!==void 0&&(y=Ie(y,"","id",x));}for(let p of y.attributes){if(p.namespaceUri!==Bl)continue;let x=o.get(p.value);x!==void 0&&x!==p.value&&(y=Ie(y,Bl,p.localName,x));}let P=f.localName,T=y.children.map(p=>m(p,P));return y!==f||T.some((p,x)=>p!==y.children[x])?{...y,children:T}:f};return m(e,"")}function Hl(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 Vl(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 Um=1e5;function jl(e){let t=chunk2JVOX642_cjs.Ib(),n=Fm(e,t),r=Lm(e,t),o=$m(e,t);return !n||!r||!o?null:{bookmarkIds:n,revisionIds:r,docPrIds:o}}function Zo(e,t,n,r){if(e)return chunk2JVOX642_cjs.Lb(t,e,r);let o=n;return ()=>{for(;t.has(String(o));)o+=1;return o>r?null:String(o++)}}function Gl(e,t){if(e.add(t),!/^\d{1,10}$/.test(t))return;let n=Number(t);n<=chunk2JVOX642_cjs.Fb&&e.add(String(n));}function zl(e,t){if(t===void 0)return e;let n=Number(t);return Number.isInteger(n)&&n>e?n:e}function Fm(e,t){let n=new Map;if(e.fragmentBookmarkIds.length===0)return n;let r=0,o=new Set;for(let i of [e.ownerPart,...e.notesParts])Ke([i.root],s=>{if(s.kind!=="bookmarkStart"&&s.kind!=="bookmarkEnd")return;let l=chunk2JVOX642_cjs.Jh(s,"id");l!==void 0&&(Gl(o,l),s.kind==="bookmarkStart"&&(r=zl(r,l)));});let a=Zo(t,o,r+1,chunk2JVOX642_cjs.Fb);for(let i of e.fragmentBookmarkIds){if(n.has(i))continue;let s=a();if(s===null)return null;n.set(i,s);}return n}function Lm(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 l=s===e.ownerPart;Ke([s.root],c=>{if(!chunk2JVOX642_cjs.Pb(c))return;let d=chunk2JVOX642_cjs.Jh(c,"id");d!==void 0&&Gl(o,d),l&&(r=zl(r,d));});}let a=Zo(t,o,r+1,chunk2JVOX642_cjs.Fb),i=false;return Ke(e.travelling,s=>{if(i||!chunk2JVOX642_cjs.Pb(s))return;let l=chunk2JVOX642_cjs.Jh(s,"id");if(l===void 0||n.has(l))return;let c=a();c===null?i=true:n.set(l,c);}),i?null:n}function $m(e,t){let n=new Map;if(!e.hasDocPr)return n;let{used:r}=chunk2JVOX642_cjs.Zf(e.pkg),o=Um;if(!t){let s=chunk2JVOX642_cjs._f(e.pkg);s.ok&&(o=s.id);}let a=Zo(t,r,o,chunk2JVOX642_cjs.Yf),i=false;return Ke(e.travelling,s=>{if(i||s.kind==="textValue"||s.kind!=="drawingDocPr")return;let l=s.attributes.find(d=>d.localName==="id"&&d.namespaceUri==="")?.value;if(l===void 0||n.has(l))return;let c=a();c===null?i=true:n.set(l,c);}),i?null:n}function Wl(e,t){return `${t?kn(t):"none"}::${e.children.filter(n=>oe(n,"lvlOverride")).map(xt).join("")}`}function Kl(e){let t=e.children.find(n=>oe(n,"abstractNumId"));return t?chunk2JVOX642_cjs.Jh(t,"val"):void 0}function Xl(e,t,n){let r=new Set(["0"]),o=0;for(let s of e?.root.children??[]){if(!ue(s)||!oe(s,t))continue;let l=chunk2JVOX642_cjs.Jh(s,n);if(l===void 0)continue;let c=Number(l);Number.isInteger(c)&&(r.add(String(c)),c>o&&(o=c));}let a=chunk2JVOX642_cjs.Ib();if(a)return chunk2JVOX642_cjs.Lb(r,a,chunk2JVOX642_cjs.Gb);let i=o+1;return ()=>String(i++)}function Yl(e,t){let n={numIdMap:new Map,numsToImport:[],abstractsToImport:[]};if(!e||!ue(e.root))return n;let r=new Map,o=[];for(let c of e.root.children)if(ue(c))if(oe(c,"abstractNum")){let d=chunk2JVOX642_cjs.Jh(c,"abstractNumId");d&&r.set(d,c);}else oe(c,"num")&&o.push(c);let a=new Map;if(t&&ue(t.root)){let c=new Map;for(let d of t.root.children){if(!ue(d)||!oe(d,"abstractNum"))continue;let m=chunk2JVOX642_cjs.Jh(d,"abstractNumId");m&&c.set(m,d);}for(let d of t.root.children){if(!ue(d)||!oe(d,"num"))continue;let m=chunk2JVOX642_cjs.Jh(d,"numId");if(!m)continue;let f=Kl(d),h=f?c.get(f):void 0;a.set(Wl(d,h),m);}}let i=Xl(t,"abstractNum","abstractNumId"),s=Xl(t,"num","numId"),l=new Map;for(let c of o){let d=chunk2JVOX642_cjs.Jh(c,"numId");if(!d)continue;let m=Kl(c),f=m?r.get(m):void 0,h=Wl(c,f),y=a.get(h);if(y!==void 0){n.numIdMap.set(d,y);continue}let P=m?l.get(m):void 0;if(P===void 0&&f&&m){let p=i();if(p===null)return null;P=p,l.set(m,P),n.abstractsToImport.push(Ie(f,chunk2JVOX642_cjs.pa,"abstractNumId",P));}let T=s();if(T===null)return null;n.numIdMap.set(d,T);let M=Ie(c,chunk2JVOX642_cjs.pa,"numId",T);if(P!==void 0){let p=M.children.map(x=>oe(x,"abstractNumId")?Ie(x,chunk2JVOX642_cjs.pa,"val",P):x);M={...M,children:p};}n.numsToImport.push(M),a.set(h,T);}return n}var Wt="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Bm=`${Wt}/hyperlink`,ql=`${Wt}/image`,wr=`${Wt}/numbering`,ea=`${Wt}/styles`,Jl="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Ql="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function Pn(e,t,n,r){for(let o of chunk2JVOX642_cjs.tg(e,t)){if(o.type!==n||o.targetMode==="External")continue;let a=chunk2JVOX642_cjs.E(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i)return i}}return e.parts.get(r)??null}function Hm(e,t){let n=0;return Ke([e],r=>{let o=t(r);if(o===void 0)return;let a=Number(o);Number.isInteger(a)&&a>n&&(n=a);}),n}function Er(e,t,n,r){if(n.length===0)return e;let o=chunk2JVOX642_cjs.cb(t,"paste"),a=n.map(c=>chunk2JVOX642_cjs.Ph(c,o)),i=chunk2JVOX642_cjs.Im(t,a),s=r??i.root.children.length,l=chunk2JVOX642_cjs.jb(i,i.root.id,s,a,{deferValidation:true});return l.ok?chunk2JVOX642_cjs.rg(e,l.part):null}function Zl(e,t){if(t.size===0)return [...e];let n=o=>{if(o.kind==="textValue")return o;if(o.kind==="drawing"||oe(o,"pict")||oe(o,"object")){let i=false;return Ke([o],s=>{if(s.kind!=="textValue")for(let l of s.attributes)l.namespaceUri===Wt&&t.has(l.value)&&(i=true);}),i?null:o}if(o.kind==="hyperlink"){let i=o.attributes.find(s=>s.namespaceUri===Wt)?.value;if(i!==void 0&&t.has(i))return r(o.children)}let a=r(o.children);return a.length===o.children.length&&a.every((i,s)=>i===o.children[s])?o:{...o,children:a}};function r(o){let a=[];for(let i of o){let s=n(i);s!==null&&(Array.isArray(s)?a.push(...s):a.push(s));}return a}return r(e)}var Vm=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),ec={"image/jpg":"image/jpeg","image/x-ms-bmp":"image/bmp","image/x-bmp":"image/bmp"};function jm(e,t){let n=chunk2JVOX642_cjs.Of(e);if(n==="unknown")return null;let r=chunk2JVOX642_cjs.H(t);return (Object.hasOwn(ec,r)?ec[r]:r)!==n||Vm.has(n)&&!chunk2JVOX642_cjs.$f(e,n)?null:n}function ta(e,t,n){for(let b of t.parts.values())if(fn([b.root]))return {ok:false,reason:"unsupported-content"};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(b=>b.kind==="body"):null;if(!o||!ue(o))return {ok:false,reason:"no-fragment-document"};let a=chunk2JVOX642_cjs.$m(o.children.filter(b=>b.kind==="paragraph"||b.kind==="table"||b.kind==="contentControl"));if(a.length===0)return {ok:false,reason:"no-fragment-document"};let i=e,s=Yl(Pn(t,t.mainDocumentPart,wr,"/word/numbering.xml"),Pn(i,i.mainDocumentPart,wr,"/word/numbering.xml"));if(!s)return {ok:false,reason:"merge-refused"};let{numIdMap:l,numsToImport:c,abstractsToImport:d}=s,m=vr(Pn(t,t.mainDocumentPart,ea,"/word/styles.xml")),f=Pn(i,i.mainDocumentPart,ea,"/word/styles.xml"),h=vr(f),y=new Map,P=[],T=new Set(h.byId.keys()),M=new Set(h.names),p=new Map,x=new Map,k=new Map,v=(b,U)=>{let $=k.get(b);return $===void 0&&($=kn(U),k.set(b,$)),$},A=b=>({...b,attributes:b.attributes.filter(U=>!(U.localName==="default"&&U.namespaceUri===chunk2JVOX642_cjs.pa))});for(let b of m.styles){let U=chunk2JVOX642_cjs.Jh(b,"styleId");if(!U)continue;let $=h.byId.get(U),j=kn(zt(b,{styleIds:y,numIds:l}));if($&&v(U,$)===j){y.set(U,U);continue}if(!$){y.set(U,U),T.add(U),P.push(A(b));continue}let X=Hl(`${U}Pasted`,T,p);T.add(X),y.set(U,X),P.push(A(Ie(b,chunk2JVOX642_cjs.pa,"styleId",X)));}let O=P.map(b=>{let U=b.children.find(Z=>oe(Z,"name")),$=U?chunk2JVOX642_cjs.Jh(U,"val"):void 0;if(!$||!M.has($))return $&&M.add($),b;let j=Vl($,M,x);M.add(j);let X=b.children.map(Z=>oe(Z,"name")?Ie(Z,chunk2JVOX642_cjs.pa,"val",j):Z);return {...b,children:X}}),D=null,F=1,w=chunk2JVOX642_cjs.Ib()===void 0?null:chunk2JVOX642_cjs.Mb(Number.MAX_SAFE_INTEGER),N=()=>{if(D)return D;let b=new Map;for(let[U,$]of i.partBytes){let j=U.startsWith("/")?U:`/${U}`;if(!j.startsWith("/word/media/"))continue;b.set(chunk2JVOX642_cjs.f($),j);let X=/\/image(\d+)\./.exec(j);X&&(F=Math.max(F,Number(X[1])+1));}return D=b,b},S=new Map,I=b=>{let U=S.get(b);if(!U){U=new Map;for(let $ of chunk2JVOX642_cjs.tg(i,b)){if($.targetMode==="External"||$.type!==ql)continue;let j=chunk2JVOX642_cjs.E($.ownerPart,$.rawTarget);j.ok&&U.set(j.partName,$.id);}S.set(b,U);}return U},_=(b,U)=>{let $=b.lastIndexOf("."),j=$===-1?"":b.slice($+1);return /^[A-Za-z0-9]{1,8}$/.test(j)?j.toLowerCase():U==="image/jpeg"?"jpeg":U==="image/gif"?"gif":"png"},q=(b,U,$)=>{let j=new Map,X=new Set,Z=I(U),me=[],we=new Set,xe=[],De=[],Ye=new Map,Ae=[],_e=t.relationships.get(b)??[];for(let le of _e){if(!$.has(le.id))continue;if(le.targetMode==="External"){if(le.type===Bm){let E=chunk2JVOX642_cjs.ej(i,le.rawTarget,U);E?(i=E.pkg,j.set(le.id,E.relationshipId)):X.add(le.id);}else X.add(le.id);continue}let pe=chunk2JVOX642_cjs.E(le.ownerPart,le.rawTarget);if(!pe.ok){X.add(le.id);continue}let qe=t.partBytes.get(pe.partName)??t.partBytes.get(pe.partName.replace(/^\//,"")),mt=(chunk2JVOX642_cjs.ug(t,pe.partName)??"").toLowerCase();if(!qe||!mt.startsWith("image/")){X.add(le.id);continue}let R=jm(qe,mt);if(R===null){X.add(le.id);continue}let G=R,W=N(),re=chunk2JVOX642_cjs.f(qe),Y=W.get(re);if(!Y){let E=_(pe.partName,G),L=fe=>i.partBytes.has(fe)||i.partBytes.has(fe.slice(1))||i.parts.has(fe)||we.has(fe),Q;if(w)do Q=`/word/media/image${w.next().value}.${E}`;while(L(Q));else {for(Q=`/word/media/image${F}.${E}`;L(Q);)F+=1,Q=`/word/media/image${F}.${E}`;F+=1;}Y=Q,me.push({partName:Y,bytes:qe,contentType:G}),we.add(Y),W.set(re,Y);}let se=Y.startsWith("/word/")?Y.slice(6):Y,g=Z.get(Y);if(g!==void 0){j.set(le.id,g);continue}let u=Ye.get(Y);u===void 0&&(u=xe.length,Ye.set(Y,u),xe.push(se),De.push(Y)),Ae.push({recordId:le.id,index:u});}if(me.length>0&&(i=chunk2JVOX642_cjs.dg(i,me)),xe.length>0){let le=chunk2JVOX642_cjs.xg(chunk2JVOX642_cjs.zg(i,U),U,xe.map(pe=>[ql,pe]));if(le.ok){i=le.pkg,le.ids.forEach((pe,qe)=>{Z.set(De[qe],pe);});for(let pe of Ae)j.set(pe.recordId,le.ids[pe.index]);}else for(let pe of Ae)X.add(pe.recordId);}return {relIdMap:j,dropRelIds:X}},ee=q(t.mainDocumentPart,n,jo(a));a=Zl(a,ee.dropRelIds);let K=new Map,ae=new Map,B=[],V=(b,U)=>ue(b)&&b.namespaceUri===chunk2JVOX642_cjs.pa&&b.localName===U,z={},ne=br(a,(b,U)=>{let $=z[b];if($===void 0){$=new Map,z[b]=$;let j=chunk2JVOX642_cjs.pj(t,b);if(j&&ue(j.root))for(let X of j.root.children){if(!V(X,b))continue;let Z=chunk2JVOX642_cjs.Jh(X,"id");if(Z===void 0)continue;let me=He(Z);$.has(me)||$.set(me,X);}}return $.get(U)??null});for(let b of ["footnote","endnote"]){let U=b==="footnote"?K:ae,$=ne[b];if($.size===0)continue;let j=chunk2JVOX642_cjs.pj(t,b);if(!j||!ue(j.root))continue;let X=chunk2JVOX642_cjs.Ij(i,b);if(!X.ok||!X.package)return {ok:false,reason:"merge-refused"};i=X.package;let Z=chunk2JVOX642_cjs.pj(i,b);if(!Z)return {ok:false,reason:"merge-refused"};let me=Hm(Z.root,xe=>V(xe,b)?chunk2JVOX642_cjs.Jh(xe,"id"):void 0)+1,we=[];for(let xe of j.root.children){if(!V(xe,b))continue;let De=chunk2JVOX642_cjs.Jh(xe,"id"),Ye=chunk2JVOX642_cjs.Jh(xe,"type");if(Ye==="separator"||Ye==="continuationSeparator"||De===void 0||!$.has(He(De))||U.has(He(De)))continue;let Ae=String(me++);U.set(He(De),Ae),we.push(Ie(xe,chunk2JVOX642_cjs.pa,"id",Ae));}we.length>0&&B.push({kind:b,fragmentPartName:j.name,bodies:chunk2JVOX642_cjs.$m(we)});}let ie=i.parts.get(n),Ne=[...a,...B.flatMap(b=>b.bodies)],Xe=[],Ce=new Set,Ve=false,J=false,Me=new Map;Ke(Ne,b=>{if(b.kind!=="textValue"){if(b.kind==="bookmarkStart"||b.kind==="bookmarkEnd"){let U=chunk2JVOX642_cjs.Jh(b,"id");if(U!==void 0&&Xe.push(U),b.kind==="bookmarkStart"){let $=chunk2JVOX642_cjs.Jh(b,"name");$&&Ce.add($);}return}if(Qo(b)){Ve=true;return}if(b.kind==="drawingDocPr"){J=true;return}if(b.kind==="contentControlProperties")for(let U of b.children){if(!oe(U,"id"))continue;let $=chunk2JVOX642_cjs.Jh(U,"val");if($!==void 0&&!Me.has($)){let j=0,X=`${$}:${Me.size}`;for(let Z=0;Z<X.length;Z+=1)j=j*31+X.charCodeAt(Z)>>>0;Me.set($,String(j%2147483647||1));}}}});let de=jl({pkg:i,ownerPart:ie,notesParts:B.map(b=>chunk2JVOX642_cjs.pj(i,b.kind)).filter(b=>b!==null),travelling:Ne,fragmentBookmarkIds:Xe,hasRevision:Ve,hasDocPr:J});if(!de)return {ok:false,reason:"merge-refused"};let At=de.bookmarkIds,dt=de.revisionIds,Pe=de.docPrIds;if(Ce.size>0){let b=new Set;if(Ke([ie.root],U=>{if(U.kind!=="textValue"&&U.kind==="bookmarkStart"){let $=chunk2JVOX642_cjs.Jh(U,"name"),j=chunk2JVOX642_cjs.Jh(U,"id");$&&j!==void 0&&Ce.has($)&&b.add(j);}}),b.size>0){let U=j=>{if(j.kind==="textValue")return j;let X=[],Z=false;for(let me of j.children){if((me.kind==="bookmarkStart"||me.kind==="bookmarkEnd")&&b.has(chunk2JVOX642_cjs.Jh(me,"id")??"")){Z=true;continue}let we=U(me);we!==me&&(Z=true),X.push(we);}return Z?{...j,children:X}:j},$=U(ie.root);$!==ie.root&&(chunk2JVOX642_cjs.gb(ie.root,$),i=chunk2JVOX642_cjs.rg(i,{...ie,root:$}));}}let tt=b=>Go(b,K,ae);for(let b of B){b.bodies=b.bodies.map(tt);let U=chunk2JVOX642_cjs.pj(i,b.kind);if(!U)return {ok:false,reason:"merge-refused"};let $=q(b.fragmentPartName,U.name,jo(b.bodies)),j=Zl(b.bodies,$.dropRelIds);j=[...Jo(j,m,h)],j=j.map(Z=>zt(Z,{styleIds:y,numIds:l,relIds:$.relIdMap,footnoteIds:K,endnoteIds:ae,bookmarkIds:At,sdtIds:Me,revisionIds:dt,docPrIds:Pe}));let X=Er(i,i.parts.get(U.name),j);if(!X)return {ok:false,reason:"merge-refused"};i=X;}if(O.length>0){let b=O.map($=>zt($,{styleIds:y,numIds:l}));if(!f){let $=chunk2JVOX642_cjs.Pa(`<w:styles xmlns:w="${chunk2JVOX642_cjs.pa}"></w:styles>`,{name:"/word/styles.xml",contentType:Ql});if(!$.ok)return {ok:false,reason:"merge-refused"};i=chunk2JVOX642_cjs.Bg(i,"/word/styles.xml",$.part.root,Ql);let j=chunk2JVOX642_cjs.Ag(chunk2JVOX642_cjs.zg(i,i.mainDocumentPart),i.mainDocumentPart,ea,"styles.xml");if(!j.ok)return {ok:false,reason:"merge-refused"};i=j.pkg,f=i.parts.get("/word/styles.xml")??null;}if(!f)return {ok:false,reason:"merge-refused"};let U=Er(i,i.parts.get(f.name),b);if(!U)return {ok:false,reason:"merge-refused"};i=U,h=vr(i.parts.get(f.name)??null);}if(d.length>0||c.length>0){let b=Pn(i,i.mainDocumentPart,wr,"/word/numbering.xml");if(!b){let Z=chunk2JVOX642_cjs.Pa(`<w:numbering xmlns:w="${chunk2JVOX642_cjs.pa}"></w:numbering>`,{name:"/word/numbering.xml",contentType:Jl});if(!Z.ok)return {ok:false,reason:"merge-refused"};i=chunk2JVOX642_cjs.Bg(i,"/word/numbering.xml",Z.part.root,Jl);let me=chunk2JVOX642_cjs.Ag(chunk2JVOX642_cjs.zg(i,i.mainDocumentPart),i.mainDocumentPart,wr,"numbering.xml");if(!me.ok)return {ok:false,reason:"merge-refused"};i=me.pkg,b=i.parts.get("/word/numbering.xml")??null;}if(!b)return {ok:false,reason:"merge-refused"};let U=i.parts.get(b.name),$=U.root.children.findIndex(Z=>oe(Z,"num")),j=d.map(Z=>zt(Z,{styleIds:y,numIds:l})),X=Er(i,U,j,$===-1?void 0:$);if(!X)return {ok:false,reason:"merge-refused"};if(i=X,X=Er(i,i.parts.get(b.name),c),!X)return {ok:false,reason:"merge-refused"};i=X;}let Oe=[...Jo(a,m,h)].map(tt).map(b=>zt(b,{styleIds:y,numIds:l,relIds:ee.relIdMap,footnoteIds:K,endnoteIds:ae,bookmarkIds:At,sdtIds:Me,revisionIds:dt,docPrIds:Pe}));return {ok:true,pkg:i,blocks:Oe}}var Kt=class extends Error{},On=e=>e.kind==="textValue"?"":e.localName??"",he=(e,t)=>e.kind!=="textValue"&&e.namespaceUri===chunk2JVOX642_cjs.pa&&On(e)===t,Gm=new Set(["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","permStart","permEnd","proofErr"]),tc=new Set(["moveFrom","moveTo","moveFromRangeStart","moveFromRangeEnd","moveToRangeStart","moveToRangeEnd"]),Tr=e=>e.kind!=="textValue"&&e.namespaceUri===chunk2JVOX642_cjs.pa&&Gm.has(On(e));function zm(e){let t=-1,n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===chunk2JVOX642_cjs.pa&&chunk2JVOX642_cjs.Ob.has(r.localName))for(let o of r.attributes)o.namespaceUri!==chunk2JVOX642_cjs.pa||o.localName!=="id"||/^\d{1,9}$/.test(o.value)&&(t=Math.max(t,Number(o.value)));for(let o of r.children)n(o);}};for(let r of e.parts.values())n(r.root);return t}function nc(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||n.root.kind!=="document")return null;let r=chunk2JVOX642_cjs.cb(n),o=zm(e)+1,a=p=>chunk2JVOX642_cjs.ti(r(),"revisionInsert","ins",chunk2JVOX642_cjs.ui(String(o++),t),p),i=()=>chunk2JVOX642_cjs.ti(r(),"generic","ins",chunk2JVOX642_cjs.ui(String(o++),t),[]),s=p=>{let x=[],k=[],v=()=>{if(k.some(O=>!Tr(O)))x.push(a(k));else for(let O of k)x.push(O);k=[];},A=O=>{if(O.kind==="textValue"){k.push(O);return}if(tc.has(On(O))&&O.namespaceUri===chunk2JVOX642_cjs.pa)throw new Kt;if(O.kind==="revisionInsert"){for(let D of O.children)A(D);return}if(O.kind==="revisionDelete"){k.push(O);return}if(chunk2JVOX642_cjs.dh(O)){for(let D of chunk2JVOX642_cjs.Ak(O,r))A(D);return}if(chunk2JVOX642_cjs.Ca(O)){v();let D=O.children.filter(w=>chunk2JVOX642_cjs.vf(O,w)),F=O.children.filter(w=>!chunk2JVOX642_cjs.vf(O,w));x.push({...O,children:[...D,...s(F)]});return}k.push(O);};for(let O of p)A(O);return v(),x},l=p=>{let x=p&&p.kind!=="textValue"?p.children:[],k=x.find(I=>he(I,"rPr")),v=k&&k.kind!=="textValue"?k.children:[];if(v.some(I=>tc.has(On(I))))throw new Kt;let A=v.filter(I=>!he(I,"ins")),O=A.filter(I=>he(I,"del")),D=A.filter(I=>!he(I,"del")),F=chunk2JVOX642_cjs.ti(k?.id??r(),"runProperties","rPr",k&&k.kind!=="textValue"?k.attributes:[],[i(),...O,...D]),w=x.filter(I=>!he(I,"rPr")),N=w.filter(I=>he(I,"sectPr")||he(I,"pPrChange")),S=w.filter(I=>!N.includes(I));return chunk2JVOX642_cjs.ti(p?.id??r(),"paragraphProperties","pPr",p&&p.kind!=="textValue"?p.attributes:[],[...S,F,...N])},c=p=>{let x=p.children.find(v=>v.kind==="paragraphProperties"),k=p.children.filter(v=>v.kind!=="paragraphProperties");return {...p,children:[l(x),...s(k)]}},d=p=>{let k=(p&&p.kind!=="textValue"?p.children:[]).filter(O=>!he(O,"ins")),v=k.filter(O=>he(O,"del")||he(O,"trPrChange")),A=k.filter(O=>!v.includes(O));return chunk2JVOX642_cjs.ti(p?.id??r(),p&&p.kind!=="textValue"?p.kind:"generic","trPr",p&&p.kind!=="textValue"?p.attributes:[],[...A,i(),...v])},m=p=>{let x=p.children.find(O=>he(O,"trPr")),k=p.children.filter(O=>!he(O,"trPr")),v=k.filter(O=>he(O,"tblPrEx")),A=k.filter(O=>!he(O,"tblPrEx")).map(O=>O.kind==="tableCell"?{...O,children:O.children.map(y)}:O.kind==="textValue"||Tr(O)?O:f(O));return {...p,children:[...v,d(x),...A]}};function f(p){throw new Kt(On(p))}function h(p){return p.kind==="textValue"||Tr(p)?p:p.kind==="tableRow"?m(p):p.kind==="tableProperties"||p.kind==="tableGrid"?p:p.kind==="contentControl"||p.kind==="contentControlContent"?{...p,children:p.children.map(x=>chunk2JVOX642_cjs.vf(p,x)?x:h(x))}:he(p,"tblPr")||he(p,"tblGrid")?p:f(p)}function y(p){if(p.kind==="textValue"||Tr(p))return p;switch(p.kind){case "paragraph":return c(p);case "table":return {...p,children:p.children.map(h)};case "tableProperties":case "tableGrid":return p;case "contentControl":case "contentControlContent":return {...p,children:p.children.map(x=>chunk2JVOX642_cjs.vf(p,x)?x:y(x))};default:return he(p,"tcPr")||he(p,"sectPr")||he(p,"sdtPr")||he(p,"sdtEndPr")?p:f(p)}}let T=n.root.children.find(p=>p.kind==="body");if(!T||T.kind!=="body")return null;let M=new Map(e.parts);try{let p=chunk2JVOX642_cjs.ib(n,T.id,T.children.map(y));if(!p.ok)return null;M.set(e.mainDocumentPart,p.part);for(let[x,k]of e.parts){if(!Wm.test(x))continue;r=chunk2JVOX642_cjs.cb(k);let v=k;for(let A of k.root.children){if(!he(A,"footnote")&&!he(A,"endnote")||A.kind==="textValue")continue;let O=A.attributes.find(F=>F.localName==="type")?.value;if(O!==void 0&&O!=="normal")continue;let D=chunk2JVOX642_cjs.ib(v,A.id,A.children.map(y));if(!D.ok)return null;v=D.part;}M.set(x,v);}}catch(p){if(p instanceof Kt)return null;throw p}return {...e,parts:M}}var Wm=/\/(?:footnotes|endnotes)\.xml$/;var rc=16*1024*1024;function Km(e){let t=e.parts.get(e.mainDocumentPart);if(!t||t.root.kind!=="document")return false;let n=t.root.children.find(a=>a.kind==="body");if(!n||n.kind!=="body"||n.children.length>chunk2JVOX642_cjs.Fm)return false;let r=0,o=(a,i,s)=>{if(i>s||(r+=1,r>chunk2JVOX642_cjs.Hm))return false;if(a.kind==="textValue")return true;for(let l of a.children)if(!o(l,i+1,s))return false;return true};for(let a of n.children)if(!o(a,1,chunk2JVOX642_cjs.Gm))return false;for(let[a,i]of e.parts)if(a!==e.mainDocumentPart&&/\/(styles|numbering|footnotes|endnotes)\.xml$/.test(a)&&!o(i.root,1,chunk2JVOX642_cjs.Gm*4))return false;return true}function na(e,t,n){if(n.fragmentBytes.byteLength>rc)return {ok:false,reason:"invalidArgs",detail:"fragment-too-large"};let r=chunk2JVOX642_cjs.lg(n.fragmentBytes);if(!r.ok)return {ok:false,reason:"invalidArgs",detail:`fragment-read:${r.reason}`};let o=n.revision?nc(r.package,n.revision):r.package;if(!o)return {ok:false,reason:"invalidArgs",detail:"fragment-untrackable"};let a=o;if(!Km(a))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:s,story:l}=i;if(s.compositionActive||e.compositionSessionOpen())return {ok:false,reason:"invalidArgs",detail:"ime-composition-active"};let c=e.currentPackage(),d=s.checkpoint();s.graftPackage(()=>e.currentPackage());let m=0,f="";return chunk2JVOX642_cjs.Xa(e,()=>{let h=s.transact(P=>{for(let x of n.priorOps??[])if(!P.apply(x))return;let T=null,M=P.applyPackage(x=>(T=ta(x,a,l.partName),T.ok?T.pkg:x)),p=T;if(!p||!p.ok){f=`fragment-merge:${p?p.reason:"no-merge"}`,P.apply({op:"insertText",paragraphId:"\0fragment-abort",offset:0,text:"x"});return}M&&(m=p.blocks.length,P.apply({op:"insertFragment",paragraphId:n.paragraphId,offset:n.offset,blocks:p.blocks,lastMarkCovered:n.lastMarkCovered})&&n.revision&&p.blocks[0]?.kind!=="paragraph"&&P.apply({op:"setParagraphMarkRevision",paragraphId:n.paragraphId,kind:"ins",revision:n.revision}));},{story:l,...n.actorId?{actorId:n.actorId}:{}});return f.length>0?{ok:false,reason:"invalidArgs",detail:f}:h.ok?h.change?{ok:true,change:e.promoteStoryTransactionToPackageUnit(c,s,d),blockCount:m}:{ok:true,change:null,blockCount:m}:{ok:false,reason:h.reason,...h.detail?{detail:h.detail}:{}}},h=>chunk2JVOX642_cjs.Ya(h))}function oc(){let e=null;return (t,n,r)=>{let o=e;if(e=null,!chunk2JVOX642_cjs.Vk(n)||!("paragraphId"in r)||!chunk2JVOX642_cjs.Xk(t,r.paragraphId))return r;if(r.op==="insertText"&&!r.revision&&r.inside===void 0&&o&&o.partName===t.name&&o.paragraphId===r.paragraphId&&o.offset===r.offset)return {...r,inside:o.controlId};if(r.op!=="deleteText"||r.revision||r.start>=r.end)return r;let a=chunk2JVOX642_cjs.eb(t,r.paragraphId);if(a?.kind!=="paragraph")return r;let i=chunk2JVOX642_cjs.rm(t,chunk2JVOX642_cjs.qm(r));if(i.unprotected.length)return r;let s=chunk2JVOX642_cjs.Ei(a);for(let l of i.touches){let c=s.spanOf(l.control);c&&c.start<=r.start&&c.end>=r.end&&(e={partName:t.name,paragraphId:r.paragraphId,offset:r.start,controlId:l.control.id});}return r}}function ra(e,t){for(let[n,r]of t.parts){let o=e.parts.get(n);!o||o.root===r.root||o.root.id!==r.root.id||chunk2JVOX642_cjs.hb(o.root,r.root);}return t}var ac=new WeakSet;function Xm(e){return ac.add(e),e}function ic(e){return ac.has(e)}function bn(e){return {...e,applyPackage:t=>e.applyPackage(Xm(t))}}var sc=new Set(["insertText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertComplexField","insertEquation","insertDrawing","deleteText","setParagraphMarkRevision"]),oa=new Set(["insertDrawing"]),Ym=new Set(["insertContentControl","insertInlineContentControl","setContentControlProperties","removeContentControl","splitParagraph"]);function lc(e){return Ym.has(e.op)&&!("revision"in e&&e.revision)}function qm(e){if(!(e===null||e.start!==e.end))return e}var Xt={"text-local":0,"paragraph-local":1,"flow-structural":2,global:3},Rn=new WeakMap;function Cr(e){return Rn.get(e)?.()??e.part}var Tt=class{current;storyPartName;rev=0;commitCounter=0;undoStack=[];redoStack=[];pushCount=0;subscribers=new Set;historyLimit;settingsPartOverride;placeholderTextOverride;contentLockPolicy;storyRef=null;composition=null;constructor(t,n,r={}){let o="root"in t,a=typeof n=="string"?n:void 0,i=typeof n=="object"&&n!==null?n:r;this.current=o?chunk2JVOX642_cjs.qg(t):t,this.storyPartName=a??(o?t.name:t.mainDocumentPart),this.historyLimit=i.historyLimit??200,this.settingsPartOverride=i.settingsPart,this.placeholderTextOverride=i.placeholderText,this.contentLockPolicy=chunk2JVOX642_cjs.Qk(i.contentLockPolicy);}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 historyPushCount(){return this.pushCount}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=chunk2JVOX642_cjs.rg(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 chunk2JVOX642_cjs.Hb(n.actorId,()=>chunk2JVOX642_cjs.Ug(n.fieldResults,()=>this.commitTransaction(t,n)))}commitTransaction(t,n){let r=n.origin??chunk2JVOX642_cjs.g.mutationHuman,o=n.recordsHistory??(r!==chunk2JVOX642_cjs.g.projection&&r!==chunk2JVOX642_cjs.g.awareness),a=this.undoStack[this.undoStack.length-1];o&&!this.composition&&a?.group!==n.historyGroup&&this.closeHistoryGroup();let i=this.current,s=this.rev,l=this.current,c=null,d=0,m=new Set,f=new Set,h=new Set,y=new Set,P=new Set,T=[],M=n.minimumImpact??"text-local",p=null,x=false,k=null,v=null,A=new Map,O=new Map,D=B=>{let V=O.get(B.name);V||(V={mint:null,written:new Set},O.set(B.name,V));let z=V;return {mint:()=>(z.mint??=chunk2JVOX642_cjs.Nb(B))(),wrote:ne=>{z.written.add(ne);},wroteUnder:ne=>z.written.has(ne)}},F=()=>{for(let B of O.values())B.mint=null;},w=(B,V)=>{let z=chunk2JVOX642_cjs.dl.get(B.op);if(z===void 0)return A.clear(),null;let ne=`${V.name}\0${z}`,ie=A.get(ne);ie||(ie={id:null},A.set(ne,ie));let Ne=ie;return ()=>Ne.id??=D(V).mint()},N=(B,V)=>{let z=sc.has(B.op);return !z&&chunk2JVOX642_cjs.dl.get(B.op)!==void 0?null:((z?oa.has(B.op):!lc(B))&&F(),z?D(V):null)},S=oc(),I=null,_=(B,V)=>{if(c)return false;let z=l.parts.get(B);if(!z)return c={reason:"unknown-part",detail:B},false;V=S(z,this.settingsPartOverride?.()??chunk2JVOX642_cjs.Bf(l),V);let ne=chunk2JVOX642_cjs.Uk(this.settingsPartOverride?.()??chunk2JVOX642_cjs.Bf(l),V)??chunk2JVOX642_cjs.sm(z,this.settingsPartOverride?.()??chunk2JVOX642_cjs.Bf(l),V,I?.partName===B&&"paragraphId"in V&&I.paragraphId===V.paragraphId?I.fieldNodeId:void 0);if(ne)return c={reason:ne},false;let ie=w(V,z),Ne=N(V,z),Xe=this.settingsPartOverride?.()??chunk2JVOX642_cjs.Bf(l),Ce=chunk2JVOX642_cjs.Vk(Xe)&&"paragraphId"in V&&chunk2JVOX642_cjs.Xk(z,V.paragraphId)?chunk2JVOX642_cjs.Zk(z,V,I?.partName===B&&I.paragraphId===V.paragraphId?I.fieldNodeId:void 0):null;I=Ce&&"paragraphId"in V?{partName:B,paragraphId:V.paragraphId,fieldNodeId:Ce.fieldNodeId}:null;let Ve={deferValidation:true,placeholderText:this.placeholderTextOverride??(de=>chunk2JVOX642_cjs.cj(l,de)),...this.contentLockPolicy?{contentLockPolicy:this.contentLockPolicy}:{},...ie?{revisionIds:ie}:{},...Ne?{trackedRevisionIds:Ne}:{}},J=Ce?chunk2JVOX642_cjs.Cn(z,V,Ce,Ve):chunk2JVOX642_cjs.Hn(z,V,Ve);if(!J.ok)return c={reason:J.reason,...J.detail?{detail:J.detail}:{}},false;if(oa.has(V.op)&&F(),l=chunk2JVOX642_cjs.rg(l,J.part),J.part===z&&J.effect.dirty.length===0&&J.effect.created.length===0&&J.effect.deleted.length===0&&J.effect.split===void 0&&(J.effect.splits===void 0||J.effect.splits.length===0)&&J.effect.join===void 0&&J.effect.caret===void 0)return true;m.add(B),d+=1;for(let de of J.effect.dirty)f.add(de);for(let de of J.effect.created)h.add(de);for(let de of J.effect.deleted)y.add(de);for(let de of J.effect.dependencyKeys)P.add(de);J.effect.split&&T.push({split:J.effect.split});for(let de of J.effect.splits??[])T.push({split:de});if(J.effect.join&&T.push({join:J.effect.join}),Xt[J.effect.impact]>Xt[M]&&(M=J.effect.impact),J.effect.caret){let de=J.effect.caret.offset??0;v={paragraphId:J.effect.caret.paragraphId,start:de,end:de};}return true},q=Rn.get(this);Rn.set(this,()=>l.parts.get(this.storyPartName)??this.part);try{t({apply:B=>_(this.storyPartName,B),applyTo:(B,V)=>_(B,V),applyPackage:B=>{if(c)return !1;let V=this.settingsPartOverride?.()??chunk2JVOX642_cjs.Bf(l),z=ic(B)?chunk2JVOX642_cjs.Tk(V,{op:"comment"}):chunk2JVOX642_cjs.Uk(V);if(z)return c={reason:z},!1;A.clear(),F();let ne;try{ne=B(l);}catch(ie){if(!chunk2JVOX642_cjs.Lk(ie))throw ie;return c={reason:ie.reason,detail:ie.message},!1}if(ne===l)return !0;for(let[ie,Ne]of ne.parts)l.parts.get(ie)!==Ne&&m.add(ie);return l=ne,d+=1,Xt["flow-structural"]>Xt[M]&&(M="flow-structural"),!0},selectionBefore:B=>{p=B;},selectionAfter:B=>{x=!0,k=B;}});}finally{q?Rn.set(this,q):Rn.delete(this);}if(c){let B=c;return {ok:false,reason:B.reason,...B.detail?{detail:B.detail}:{}}}if(d===0)return {ok:true,change:null};let ee=x?k:v,K=x?qm(k):v??void 0;for(let B of m){let V=i.parts.get(B),z=l.parts.get(B);if(z===void 0)continue;let ne=V?chunk2JVOX642_cjs.Na(V,z):chunk2JVOX642_cjs.Na(z,z);if(!ne.ok)return {ok:false,reason:"tree-invariant",detail:JSON.stringify(ne.issues)}}let ae=chunk2JVOX642_cjs.Cg(l);if(!ae.ok)return {ok:false,reason:"package-invariant",detail:JSON.stringify(ae.issues)};if(o)if(this.composition)chunk2JVOX642_cjs.Kn(n.historyGroup,"split","composition"),this.composition.committed=true,this.composition={...this.composition,entry:{...this.composition.entry,selectionAfter:ee}};else {let B=n.historyGroup,V=this.undoStack[this.undoStack.length-1];B!==void 0&&V!==void 0&&V.group===B?this.undoStack[this.undoStack.length-1]={...V,selectionAfter:ee??V.selectionAfter}:this.pushUndo({pkg:i,revision:s,selectionBefore:p,selectionAfter:ee,group:B}),chunk2JVOX642_cjs.Kn(B,V?.group===B?"extended":"started"),this.redoStack.length=0;}return this.current=l,this.rev+=1,n.story&&(this.storyRef=n.story),n.minimumImpact&&Xt[n.minimumImpact]>Xt[M]&&(M=n.minimumImpact),{ok:true,change:this.publish(r,s,{dirty:f,created:h,deleted:y,dependencyKeys:P,splitJoin:T,impact:M,caret:K},n.story??this.storyRef??void 0,n.actorId,n.operationId)}}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;}closeHistoryGroup(){let t=this.undoStack[this.undoStack.length-1];t===void 0||t.group===void 0||(this.undoStack[this.undoStack.length-1]={...t,group:void 0});}undo(){let t=this.undoStack.pop();if(!t)return null;this.closeHistoryGroup();let n=this.rev;return this.redoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=ra(this.current,t.pkg),this.rev+=1,this.publish(chunk2JVOX642_cjs.g.mutationUndo,n,null,this.storyRef??void 0)}redo(){let t=this.redoStack.pop();if(!t)return null;this.closeHistoryGroup();let n=this.rev;return this.undoStack.push({pkg:this.current,revision:this.rev,selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}),this.current=ra(this.current,t.pkg),this.rev+=1,this.publish(chunk2JVOX642_cjs.g.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}discardNewestUndoEntry(){let t=this.undoStack.pop();return t?{selectionBefore:t.selectionBefore,selectionAfter:t.selectionAfter}:null}pushUndo(t){this.pushCount+=1,this.undoStack.push(t),this.undoStack.length>this.historyLimit&&this.undoStack.shift();}publish(t,n,r,o,a,i){this.commitCounter+=1;let s={change:"model-change",fromRevision:n,toRevision:this.rev,commitId:`commit-${this.commitCounter}`,origin:t,...a?{actorId:a}:{},...i?{operationId:i}:{},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}:{}};return chunk2JVOX642_cjs.Ug("atomic",()=>{for(let l of this.subscribers)l(s);}),s}};function aa(e,t,n,r){if(!e)return null;if(e.kind==="package")return (r==="undo"?e.selectionBefore:e.selectionAfter)??null;let o=e.partName===t.part.name?t:n.get(e.partName);return (r==="undo"?o?.selectionForUndo():o?.selectionForRedo())??null}function cc(e){let t=null,n;return {context:{selectionBefore(r){t=r,e.selectionBefore(r);},selectionAfter(r){n=r,e.selectionAfter(r);}},snapshot(r){return {selectionBefore:t,selectionAfter:n===void 0?r??null:n}}}}function ia(e,t){return [...e.values()].map(n=>n.part).filter(n=>t.parts.has(n.name))}function dc(e,t){return ia(e,t).map(n=>n.name).sort().join(",")}function mc(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 pc="/word/numbering.xml";function Yt(e,t){return e===void 0?void 0:{group:e,before:t}}function sa(e){return e.kind==="package"&&e.before.parts.get(pc)!==e.after.parts.get(pc)?{...e,restoreNumbering:true}:e}var Mr=class{open=null;close(){this.open=null;}admit(t,n,r,o,a){let i=this.open;if(n===void 0)return this.open=null,sa(t);if(i===null||i.group!==n.group||r.at(-1)!==i.pointer){let f=sa(t);return this.open={group:n.group,before:n.before,pointer:f},chunk2JVOX642_cjs.Kn(n.group,"started"),f}r.pop();let s=t.kind==="story"?o(t.partName):null,l=i.pointer.kind==="story"?o(i.pointer.partName):null,c=i.pointer.kind==="package"?i.pointer.selectionAfter??null:null,d={kind:"package",before:i.before,after:a(),selectionBefore:i.pointer.kind==="package"?i.pointer.selectionBefore??null:l?.selectionBefore??null,selectionAfter:(t.kind==="package"?t.selectionAfter:s?.selectionAfter)??c},m=sa(d);return this.open={...i,pointer:m},chunk2JVOX642_cjs.Kn(n.group,"extended"),m}};var Ar="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Jm="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function qt(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===Ar&&n.localName===t)return n;return null}function Dr(e,t){return e.attributes.find(n=>n.namespaceUri===Ar&&n.localName===t)?.value}function Qm(e){let t=Dr(e,"val");return t===void 0||t==="1"||t==="true"||t==="on"}function fc(e,t){return e.kind==="textValue"?Object.freeze({...e,id:t()}):Object.freeze({...e,id:t(),children:e.children.map(n=>fc(n,t))})}function Zm(e){let t=chunk2JVOX642_cjs.Pa(`<w:styles xmlns:w="${Ar}"><w:style w:type="paragraph" w:styleId="ListParagraph"><w:pPr><w:contextualSpacing/></w:pPr></w:style></w:styles>`,{name:e.name,contentType:Jm});if(!t.ok)return null;let n=qt(t.part.root,"style"),r=n?qt(n,"pPr"):null;return r?fc(r,chunk2JVOX642_cjs.cb(e)):null}var uc=["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 ep(e,t){let n=uc.indexOf(t),r=0;return e.forEach((o,a)=>{if(o.kind==="textValue")return;let i=uc.indexOf(o.localName);i!==-1&&i<=n&&(r=a+1);}),r}function gc(e,t){let n=chunk2JVOX642_cjs.ud(e);if(!n)return null;let r=null;for(let c of n.root.children)if(c.kind!=="textValue"&&c.namespaceUri===Ar&&c.localName==="style"&&Dr(c,"type")==="paragraph"&&Dr(c,"styleId")===t){r=c;break}if(!r)return null;let o=qt(r,"name");if(o&&Dr(o,"val")?.trim().toLowerCase()!=="list paragraph"&&t!=="ListParagraph")return null;let a=Zm(n);if(!a)return null;let i=qt(a,"contextualSpacing");if(!i)return null;let s=qt(r,"pPr"),l;if(s){let c=qt(s,"contextualSpacing");if(c&&Qm(c))return e;l=c?chunk2JVOX642_cjs.kb(n,c.id,i):chunk2JVOX642_cjs.jb(n,s.id,ep(s.children,"contextualSpacing"),[i]);}else {let c=r.children.findIndex(d=>d.kind!=="textValue"&&["rPr","tblPr","tcPr","tblStylePr"].includes(d.localName));l=chunk2JVOX642_cjs.jb(n,r.id,c===-1?r.children.length:c,[a]);}return l.ok?Object.freeze({...e,parts:new Map([...e.parts,[n.name,l.part]])}):null}var kc="http://schemas.openxmlformats.org/package/2006/relationships",Pc="application/vnd.openxmlformats-package.relationships+xml",rp="http://schemas.openxmlformats.org/package/2006/content-types",hc="/[Content_Types].xml",Ct="/word/numbering.xml",yc="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",In="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",op=`<Override PartName="${Ct}" ContentType="${In}"/>`;function _r(e){return `${e.ownerPart}\0${e.id}`}function Oc(e,t,n){let r=new Set(t.externalTargets.filter(s=>s.type===chunk2JVOX642_cjs.De).map(_r)),o=n.externalTargets.filter(s=>s.type===chunk2JVOX642_cjs.De&&!r.has(_r(s)));if(o.length===0)return e;let a=new Set(e.map(_r)),i=o.filter(s=>!a.has(_r(s)));return i.length===0?e:Object.freeze([...e,...i])}function bc(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 Rc(e,t,n=[],r=false){if(e===t)return e;let o=ap(e,t,r);return o=sp(o,t,n),o}function Ic(e,t){let n=new Set;for(let o of e.externalTargets)o.type===chunk2JVOX642_cjs.De&&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 a=mp(o);!a||a===e.mainDocumentPart||e.parts.has(a)||t.has(a)||e.externalTargets.some(i=>i.ownerPart===a)||n.add(a);}if(n.size===0)return e;let r=e;for(let o of n)r=pp(r,o);return r}function ap(e,t,n){let r=t.parts.get(Ct);if(!r)return e;let o=e.parts.get(Ct),a=n&&o?ip(o,r):r,i=chunk2JVOX642_cjs.rg(e,a),s=(t.relationships.get(t.mainDocumentPart)??[]).find(c=>c.type===yc),l=i.relationships.get(i.mainDocumentPart)??[];if(s&&!l.some(c=>c.type===yc)&&!l.some(c=>c.id===s.id)){let c=cp(i,{...s,ownerPart:i.mainDocumentPart});c&&(i=c);}if(i.contentTypes.overrides.get(chunk2JVOX642_cjs.C(Ct))!==In){let c=up(i);c&&(i=c);}return i}function ip(e,t){let n="http://schemas.openxmlformats.org/wordprocessingml/2006/main",r=l=>{if(l.kind==="textValue"||l.namespaceUri!==n)return null;let c=l.localName==="abstractNum"?"abstractNumId":l.localName==="num"?"numId":l.localName==="numPicBullet"?"numPicBulletId":null;if(!c)return null;let d=l.attributes.find(m=>m.namespaceUri===n&&m.localName===c)?.value;return d===void 0?null:`${l.localName}:${d}`},o=new Set(e.root.children.map(r).filter(Boolean)),a=chunk2JVOX642_cjs.cb(e),i=["numPicBullet","abstractNum","num","numIdMacAtCleanup"],s=e;for(let l of t.root.children){let c=r(l);if(!c||o.has(c)||l.kind==="textValue")continue;let d=i.indexOf(l.localName),m=s.root.children.findIndex(h=>h.kind!=="textValue"&&h.namespaceUri===n&&i.indexOf(h.localName)>d),f=chunk2JVOX642_cjs.jb(s,s.root.id,m<0?s.root.children.length:m,[la(l,a)]);f.ok&&(s=f.part,o.add(c));}return s}function sp(e,t,n){let r=n.filter(a=>a.type===chunk2JVOX642_cjs.De);if(r.length===0)return e;let o=e;for(let a of r){let i=lp(e,t,a.ownerPart);if(!i||o.externalTargets.some(c=>c.ownerPart===i&&c.id===a.id)||new Set((o.relationships.get(i)??[]).map(c=>c.id)).has(a.id))continue;let l=dp(o,{ownerPart:i,id:a.id,type:chunk2JVOX642_cjs.De,rawTarget:a.rawTarget,sinkSafe:a.sinkSafe},i);l&&(o=l);}return o}function lp(e,t,n){return n===t.mainDocumentPart?e.mainDocumentPart:typeof n!="string"||n.length===0?null:n}function cp(e,t){let n=e.mainDocumentPart,r=ca(n),o=e.parts.get(r),a=chunk2JVOX642_cjs.Pa(`<Relationships xmlns="${kc}"><Relationship Id="${chunk2JVOX642_cjs.Y(t.id,"relationship id")}" Type="${chunk2JVOX642_cjs.Y(t.type,"relationship type")}" Target="${chunk2JVOX642_cjs.Y(t.rawTarget,"relationship target")}"/></Relationships>`,{name:r,contentType:Pc});if(!a.ok)return null;let i=e.relationships.get(n)??[];if(i.some(c=>c.id===t.id))return null;let s={...t,ownerPart:n,order:i.reduce((c,d)=>Math.max(c,d.order),-1)+1},l=new Map([...e.relationships,[n,[...i,s]]]);return o?Nc(e,o,a.part.root.children[0],l):Object.freeze({...e,parts:new Map([...e.parts,[r,a.part]]),relationships:l})}function dp(e,t,n=e.mainDocumentPart){let r=n;if(typeof r!="string"||r.length===0)return null;let o=ca(r),a=e.parts.get(o),i=chunk2JVOX642_cjs.Pa(`<Relationships xmlns="${kc}"><Relationship Id="${chunk2JVOX642_cjs.Y(t.id,"relationship id")}" Type="${chunk2JVOX642_cjs.De}" Target="${chunk2JVOX642_cjs.Y(t.rawTarget,"relationship target")}" TargetMode="External"/></Relationships>`,{name:o,contentType:Pc});if(!i.ok)return null;let s=[...e.externalTargets,t];if(!a)return Object.freeze({...e,parts:new Map([...e.parts,[o,i.part]]),externalTargets:s});let l=Nc(e,a,i.part.root.children[0],e.relationships);return l?Object.freeze({...l,externalTargets:s}):null}function Nc(e,t,n,r){if(!n)return null;let o=chunk2JVOX642_cjs.cb(t),a=chunk2JVOX642_cjs.jb(t,t.root.id,t.root.children.length,[la(n,o)]);return a.ok?Object.freeze({...e,parts:new Map([...e.parts,[t.name,a.part]]),relationships:r}):null}function la(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>la(n,t))}}function ca(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function mp(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 pp(e,t){let n=ca(t),r=new Map(e.parts);r.delete(n);let o=new Map(e.partBytes);o.delete(n);let a=new Map(e.relationships);a.delete(t);let i=Object.freeze(e.externalTargets.filter(s=>s.ownerPart!==t));return Object.freeze({...e,parts:r,partBytes:o,relationships:a,externalTargets:i})}function up(e){let t=e.contentTypes.overrides.get(chunk2JVOX642_cjs.C(Ct));if(t===In)return e;if(t!==void 0)return null;let n=e.partBytes.get(hc);if(!n)return null;let r=fflate.strFromU8(n),o=xc(r);if(!o)return null;let a=r.lastIndexOf(`</${o.rootName}>`);if(a===-1)return null;let i=r.slice(0,a)+op+r.slice(a),s=xc(i);if(!s||s.rootName!==o.rootName)return null;let l=[...o.children,Sc("Override",{PartName:Ct,ContentType:In})];return s.children.length!==l.length||s.children.some((c,d)=>c!==l[d])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[hc,fflate.strToU8(i)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunk2JVOX642_cjs.C(Ct),In]])})})}function xc(e){let t=chunk2JVOX642_cjs.ea(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(":"),a=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[a?`xmlns:${a}`:"xmlns"]!==rp)return null;let i=[];for(let s of r.children)s.type==="element"&&i.push(Sc(s.name,s.attributes));return {rootName:r.name,children:i}}function Sc(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}var vc=4e3,wc=64;function Ec(e){return chunk2JVOX642_cjs.pj(e,"footnote")!==null||chunk2JVOX642_cjs.pj(e,"endnote")!==null}function Tc(e,t,n,r){if(!Ec(e))return false;if(r.has(n.paragraphId))return true;r.add(n.paragraphId);let o=chunk2JVOX642_cjs.eb(Cr(t),n.paragraphId);return !o||o.kind!=="paragraph"?true:chunk2JVOX642_cjs.Bi(o).some(a=>a.node.kind==="noteReference"&&a.start<n.end&&a.end>n.start)}function Cc(e,t,n,r){if(!Ec(e))return false;if(r.has(n.blockId))return true;r.add(n.blockId);let o=chunk2JVOX642_cjs.eb(Cr(t),n.blockId);if(!o||o.kind==="textValue")return true;let a=0,i=(s,l)=>{if(a>=vc||l>wc)return true;if(a+=1,s.kind==="textValue")return false;if(s.kind==="paragraph")return chunk2JVOX642_cjs.Bi(s).some(c=>c.node.kind==="noteReference");for(let c of s.children)if(i(c,l+1))return true;return false};return i(o,0)}function Mc(e,t,n){if(n.count>=vc||t>wc)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(Mc(r,t+1,n))return true;return false}function Dc(e,t,n,r){if(!e())return false;let o=n.op==="deleteText"?n.paragraphId:n.blockId;if(r.has(o))return true;r.add(o);let a=chunk2JVOX642_cjs.eb(Cr(t),o);return !a||a.kind==="textValue"?true:Mc(a,0,{count:0})}var da="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",ma="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function Ac(e,t){let r=(e.relationships.get(e.mainDocumentPart)??[]).find(o=>o.id===t);return r?r.type!==da&&r.type!==ma?{ok:false,reason:"wrong-relationship-type",detail:r.type}:fp(e,r):{ok:false,reason:"dangling-relationship",detail:t}}function fp(e,t){let n=chunk2JVOX642_cjs.N(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}}var pa=new Set(["acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions"]),ua=new Set(["authorTable","deleteTableRow","deleteTableColumn","mergeTableCells","removeContentControl","removeRepeatingSectionItem","removeToc"]);function _c(e,t,n){return {historyLimit:t,settingsPart:()=>chunk2JVOX642_cjs.Bf(e()),placeholderText:r=>chunk2JVOX642_cjs.cj(e(),r),...n?{contentLockPolicy:n}:{}}}function Mt(e,t){return t.compositionActive||e.compositionSessionOpen()?{ok:false,reason:"invalidArgs",detail:"ime-composition-active"}:null}function Uc(e,t){let n=chunk2JVOX642_cjs.eb(e,t);return !n||n.kind!=="drawing"?null:n.children.find(o=>o.kind==="inlineDrawing"||o.kind==="anchoredDrawing")??null}function Fc(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=chunk2JVOX642_cjs.eb(r,n);return !o||o.kind!=="drawing"?null:chunk2JVOX642_cjs.We(o,{ownerPartName:t,supportedMcRequires:chunk2JVOX642_cjs.Qe,limits:chunk2JVOX642_cjs.Pe,resolveRelationship:chunk2JVOX642_cjs.Se(e,t)})}function Lc(e,t,n){let r=chunk2JVOX642_cjs.O(e.relationships.get(t)??[],t,n);return r.mode==="internal"?r.partName:null}function Jt(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=Mt(e,o.store);if(a)return a;let{store:i,story:s}=o;return chunk2JVOX642_cjs.Xa(e,()=>gp(e,i,s,n,r),l=>chunk2JVOX642_cjs.Ya(l))}function gp(e,t,n,r,o){let a=n.partName,i=e.currentPackage(),s=t.checkpoint();t.graftPackage(()=>e.currentPackage());let l=null,c=false,d=false,m=t.transact(y=>{if(o?.commitGuard?.()===false){d=true;return}if(o?.expectedPackageRevision!==void 0&&e.packageRevision!==o.expectedPackageRevision){c=true;return}let P=r(y,a);if(P===null){y.apply({op:"insertText",paragraphId:"\0task12-abort",offset:0,text:"x"});return}l=P;},{story:n,...o?.actorId?{actorId:o.actorId}:{},...n.kind==="headerFooter"||n.kind==="notesPart"?{minimumImpact:"global"}:{}});if(d)return {ok:false,reason:"invalidArgs",detail:"stale drawing selection"};if(c)return {ok:false,reason:"invalidArgs",detail:"stale-package-epoch"};if(!m.ok)return {ok:false,reason:m.reason,...m.detail?{detail:m.detail}:{}};if(!m.change)return {ok:true,change:null};let f=m.change.created.find(y=>{let P=t.part;return chunk2JVOX642_cjs.eb(P,y)?.kind==="drawing"});return f&&(l=f),{ok:true,change:e.promoteStoryTransactionToPackageUnit(i,t,s),...l?{drawingNodeId:l}:{}}}function $c(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=Uc(r,n);return o?chunk2JVOX642_cjs.un(o):null}function fa(e,t,n,r){let o=false;return e.applyPackage(a=>{let i=a.parts.get(t);if(!i)return a;let s=chunk2JVOX642_cjs.eb(i,n);if(!s||s.kind!=="drawing")return a;let l=Uc(i,n);if(!l)return a;let c=chunk2JVOX642_cjs.vn(l,r),d=hp(s,c),m=chunk2JVOX642_cjs.kb(i,s.id,d,{deferValidation:true});return m.ok?(o=true,chunk2JVOX642_cjs.rg(a,m.part)):a}),o}function hp(e,t){return {...e,children:e.children.map(n=>n.id===t.id?t:n)}}async function Bc(e,t,n){let r=chunk2JVOX642_cjs.fg(n.widthPoints),o=chunk2JVOX642_cjs.fg(n.heightPoints);if(r===null||o===null)return {ok:false,reason:"invalidArgs",detail:"invalid-dimensions"};let a=e.resolveStory(t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let i=Mt(e,a.store);if(i)return i;let s=a.story.partName,l=await chunk2JVOX642_cjs.ag(n.decodePort,n.bytes,n.mime);if(!l.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let c=l.bytes,d=chunk2JVOX642_cjs.cg(e.currentPackage(),s,{bytes:c,mime:n.mime});if(!d.ok)return {ok:false,reason:"invalidArgs",detail:d.reason==="invalid-image"?"invalid-image":d.reason};let m=d.partName,f=Jt(e,t,(h,y)=>{let P=e.currentPackage(),T=chunk2JVOX642_cjs.cg(P,y,{bytes:c,mime:n.mime});if(!T.ok)return null;P=T.pkg,m=T.partName;let M;if(n.hyperlink){let x=chunk2JVOX642_cjs.ej(P,n.hyperlink,y);if(!x)return null;P=x.pkg,M=x.relationshipId;}if(!h.applyPackage(()=>P))return null;let p=chunk2JVOX642_cjs.gg({docPrId:T.docPrId,relationshipId:T.relationshipId,extentEmu:{cx:r,cy:o},...n.title!==void 0?{title:n.title}:{},...n.description!==void 0?{description:n.description}:{},...M?{hyperlinkRelationshipId:M}:{}});return h.apply({op:"insertDrawing",paragraphId:n.paragraphId,offset:n.offset,drawing:p,...n.revision?{revision:n.revision}:{}})?p.id:null},{expectedPackageRevision:n.expectedPackageRevision,...n.commitGuard?{commitGuard:n.commitGuard}:{},...n.actorId?{actorId:n.actorId}:{}});return f.ok?f.change?{...f,mediaPartName:m}:{ok:true,change:null,mediaPartName:m}:f}async function ga(e,t,n,r,o,a,i){let s=e.resolveStory(t);if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let l=Mt(e,s.store);if(l)return l;let c=s.story.partName,d=await chunk2JVOX642_cjs.ag(a,r,o);if(!d.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let m=d.bytes,f=chunk2JVOX642_cjs.cg(e.currentPackage(),c,{bytes:m,mime:o});return f.ok?Jt(e,t,(h,y)=>{let P=e.currentPackage(),T=Fc(P,c,n),M=T?.picture?.embeddedRelationshipId??null,p=T?.picture?.linkedRelationshipId??null,x=M??p;if(!x)return null;let k=M!==null?Lc(P,c,M):null,v=P,A=chunk2JVOX642_cjs.cg(v,y,{bytes:m,mime:o});return !A.ok||(v=A.pkg,!h.applyPackage(()=>v))||!h.apply({op:"replaceDrawingResource",drawingNodeId:n,relationshipId:A.relationshipId})?null:(h.applyPackage(O=>chunk2JVOX642_cjs.ig(O,y,k,x)),n)},{expectedPackageRevision:i.expectedPackageRevision,...i.commitGuard?{commitGuard:i.commitGuard}:{},...i.actorId?{actorId:i.actorId}:{}}):{ok:false,reason:"invalidArgs",detail:f.reason==="invalid-image"?"invalid-image":f.reason}}function Hc(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Mt(e,r.store);if(o)return o;let a=r.story.partName,i=e.currentPackage(),s=i.parts.get(a),l=Fc(i,a,n)??(s?chunk2JVOX642_cjs.in(s,n):null);if(!l)return {ok:false,reason:"unknown-drawing"};let c=l.picture?.embeddedRelationshipId??null,d=l.picture?.linkedRelationshipId??null,m=c??d,f=c!==null?Lc(i,a,c):null;return Jt(e,t,(h,y)=>h.apply({op:"deleteDrawing",drawingNodeId:n})?(h.applyPackage(P=>chunk2JVOX642_cjs.ig(P,y,f,m)),n):null)}function yp(e,t){let n=null,r=a=>{let i=false,s=false,l=(c,d)=>{if(i||c.kind==="textValue")return;if(c.id===t){i=true,s=d;return}let m=d||c.kind==="revisionDelete"||c.kind==="revisionMoveFrom";for(let f of c.children)l(f,m);};return l(a,false),s},o=a=>{if(!(n!==null||a.kind==="textValue")){if(a.kind==="paragraph"){let i=chunk2JVOX642_cjs.Ei(a).spanOf(t);if(i!==null&&i.end>i.start){let s=chunk2JVOX642_cjs.eb(e,t);if(!s||s.kind!=="drawing"&&!chunk2JVOX642_cjs.Te(s))return;n={paragraphId:a.id,start:i.start,end:i.end,alreadyDeleted:r(a)};}return}for(let i of a.children)o(i);}};return o(e.root),n}function Vc(e,t,n,r){let o=e.resolveStory(t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=Mt(e,o.store);if(a)return a;let i=e.currentPackage().parts.get(o.story.partName);if(!i)return {ok:false,reason:"unknown-drawing"};let s=yp(i,n);return s?s.alreadyDeleted?{ok:true,change:null}:Jt(e,t,l=>l.apply({op:"deleteText",paragraphId:s.paragraphId,start:s.start,end:s.end,revision:r})?n:null):{ok:false,reason:"unknown-drawing"}}async function jc(e,t,n,r,o,a,i,s){let l=await chunk2JVOX642_cjs.jg(o,r,a,void 0,i);return l.ok?ga(e,t,n,l.bytes,l.mime,i,{expectedPackageRevision:e.packageRevision,...s?{actorId:s}:{}}):{ok:false,reason:"invalidArgs",detail:`${l.reason}${l.detail?`:${l.detail}`:""}`}}function Gc(e,t,n,r,o,a){let i=e.resolveStory(t);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let s=Mt(e,i.store);return s||Jt(e,t,(l,c)=>{let d=$c(e.currentPackage(),c,n),m=null;if(a!==null){let h=chunk2JVOX642_cjs.ej(e.currentPackage(),a,c);if(!h||!l.applyPackage(()=>h.pkg))return null;m=h.relationshipId;}if(!l.apply({op:"setDrawingMetadata",drawingNodeId:n,title:r,description:o,...a===null?{hyperlink:null}:{}}))return null;if(a!==null&&m!==null){if(!fa(l,c,n,m))return null}else if(a===null&&!fa(l,c,n,null))return null;let f=false;return l.applyPackage(h=>{let y=chunk2JVOX642_cjs.gj(h,c,d);return y===null?(f=true,h):y}),f?null:n})}function zc(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=Mt(e,r.store);return o||Jt(e,t,(a,i)=>{let s=$c(e.currentPackage(),i,n.drawingNodeId),l=null;if(n.hyperlink!==null){let d=chunk2JVOX642_cjs.ej(e.currentPackage(),n.hyperlink,i);if(!d||!a.applyPackage(()=>d.pkg))return null;l=d.relationshipId;}for(let d of n.ops)if(!a.apply(d))return null;if(!fa(a,i,n.drawingNodeId,n.hyperlink===null?null:l))return null;let c=false;return a.applyPackage(d=>{let m=chunk2JVOX642_cjs.gj(d,i,s);return m===null?(c=true,d):m}),c?null:n.drawingNodeId})}function xp(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 Wc(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 kp(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 Pp(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((a,i)=>!kp(a,o[i])))return false}return true}function Op(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 bp(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||!xp(r,o))return false}return true}function Rp(e,t){return e.contentTypes===t.contentTypes||Wc(e.contentTypes.defaults,t.contentTypes.defaults)&&Wc(e.contentTypes.overrides,t.contentTypes.overrides)}var Ur=Object.freeze({equal:true,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"}),Qt=Object.freeze({equal:false,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"});function Kc(e){for(let[t,n]of e)if(!chunk2JVOX642_cjs.Ka(t,n)||!chunk2JVOX642_cjs.La(n.root,t.root).idsPreserved)return Qt;return Ur}function Ip(e,t){if(e===t)return Ur;if(e.mainDocumentPart!==t.mainDocumentPart||e.parts.size!==t.parts.size||!bp(e.partBytes,t.partBytes)||!Pp(e.relationships,t.relationships)||!Op(e.externalTargets,t.externalTargets)||!Rp(e,t))return Qt;let n=[];for(let[i,s]of e.parts){let l=t.parts.get(i);if(!l)return Qt;s!==l&&n.push([s,l]);}if(n.length===0)return Ur;let[r,o]=n[0];if(n.length>1||r.name!==e.mainDocumentPart)return Kc(n);let a=chunk2JVOX642_cjs.La(o.root,r.root);return a.undecided?Kc(n):a.equal&&a.idsPreserved?Ur:a.equal?a.renamedOutsideParagraphs||a.renamedParagraphIds.length===0?Qt:{equal:false,dirty:a.renamedParagraphIds,dependencyKeys:[chunk2JVOX642_cjs.l.story],impact:"text-local"}:!a.idsPreserved||a.reach==="outside-paragraph"||a.paragraphIds.length===0?Qt:{equal:false,dirty:a.paragraphIds,dependencyKeys:[chunk2JVOX642_cjs.l.story],impact:a.reach==="paragraph-text"?"text-local":"flow-structural"}}function ha(e){return {ok:false,reason:"package-invariant",detail:e}}function Np(e,t){if(!e.parts.get(e.mainDocumentPart))return ha("no-main-document");for(let[r,o]of e.parts){let a=t?.parts.get(r);if(a===o)continue;let i=a?chunk2JVOX642_cjs.Na(a,o):chunk2JVOX642_cjs.Ma(o);if(!i.ok)return ha(`invalid-part:${r}:${i.issues[0]?.code??"invalid"}`)}let n=chunk2JVOX642_cjs.Cg(e);return n.ok?null:ha(n.issues[0]?.code??"package-invariant")}function Xc(e,t,n){let r=e.currentPackage(),o=Ip(t,r);if(o.equal)return {ok:true,change:null};let a=Np(t,r);if(a)return a;let i=e.bodyStore().part.name,s=o.impact!=="global"&&t.mainDocumentPart===i;return chunk2JVOX642_cjs.Xa(e,()=>{let l=e.packageRevision;return e.installAuthoritativePackageSnapshot(t),{ok:true,change:e.publishStoryWrite({change:"model-change",fromRevision:l,toRevision:l+1,commitId:`pkg-remote-${l+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:i}})}},()=>false)}function Sp(e,t,n,r){let o=[...t],a=new Set;for(let i of o)e.parts.has(i)&&a.add(i);for(let i of n)Yc(i,o,a);for(let i of r)Yc(i,o,a);return a}function vp(e,t,n,r,o){let a=new Set(e);a.add(t),a.add(n);for(let i of r)qc(i,a);for(let i of o)qc(i,a);return a}function Yc(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 qc(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);}function Jc(e){let{stories:t,rIdToPartName:n,undoOrder:r,redoOrder:o}=e,a=Sp(e.pkg,t.keys(),r,o);for(let[l]of [...t])if(!a.has(l)){t.delete(l);for(let[c,d]of [...n])d===l&&n.delete(c);}let i=vp(a,e.pkg.mainDocumentPart,e.bodyPartName,r,o),s=Ic(e.pkg,i);return {pkg:s,shellHyperlinks:bc(e.shellHyperlinks,i,s.mainDocumentPart)}}function Qc(e,t,n,r,o,a){return {change:"model-change",fromRevision:Math.max(0,t-1),toRevision:t,commitId:`pkg-commit-${e}`,origin:n,dirty:[],created:[...a],deleted:[],splitJoin:[],dependencyKeys:[],impact:r,story:o}}var Zc=64,Nn=class{pkg;packageRev=0;body;stories=new Map;rIdToPartName=new Map;undoOrder=[];redoOrder=[];historyGroups=new Mr;subscribers=new Set;historyLimit;contentLockPolicy;maxEditableStoryParts;cascadeNoteReferences;lastChange=null;shellHyperlinks=Object.freeze([]);compositionSession=null;commitCounter=0;currentPackageMemo=null;storyStoreOptions(){return _c(()=>this.pkg,this.historyLimit,this.contentLockPolicy)}constructor(t,n,r={}){this.pkg=chunk2JVOX642_cjs.rg(t,n),this.historyLimit=r.historyLimit??200,this.contentLockPolicy=chunk2JVOX642_cjs.Qk(r.contentLockPolicy),this.maxEditableStoryParts=r.maxEditableStoryParts??Zc,this.cascadeNoteReferences=r.cascadeDeletedNoteReferences??chunk2JVOX642_cjs.Hj,this.body=new Tt(this.pkg,n.name,this.storyStoreOptions()),this.body.setStoryRef({kind:"body",partName:n.name}),chunk2JVOX642_cjs.Ln(this,{current:()=>this.undoOrder.at(-1)??null,split:()=>{this.closeHistoryGroups(),this.redoOrder.length=0;}});}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,a=true;for(let i of this.stories.values()){if(t.storyParts[o]!==i.part){a=false;break}o+=1;}if(a&&o===t.storyParts.length)return t.result}let n=chunk2JVOX642_cjs.rg(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=chunk2JVOX642_cjs.rg(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 chunk2JVOX642_cjs.Xa(this,()=>this.commitStoryTransaction(t,n,r),chunk2JVOX642_cjs.Ya,r.historyGroup)}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:a,story:i}=o,s=this.currentPackage(),l=a.historyPushCount,c=a.compositionActive,d=a.checkpoint(),m=false,f=new Set,h=false,y,P=new Set,T=false,M,p=false,x;a.graftPackage(()=>this.currentPackage());let k=a.transact(O=>{x=cc(O),n({...O,applyTo:(D,F)=>{let w=O.applyTo(D,F);return w&&D!==i.partName&&(p=true),w},applyPackage:D=>O.applyPackage(F=>{let w=D(F);return w!==F&&!p&&(p=mc(F,w,i.partName)),w}),apply:D=>(D.op==="setListNumbering"&&Number(D.numId)>0&&(T=true),D.op==="setParagraphProperties"&&(M??=D.properties.find(F=>F.localName==="pStyle")?.attributes?.val),m||(D.op==="deleteText"&&Tc(this.pkg,a,D,f)||D.op==="deleteBlock"&&Cc(this.pkg,a,D,f)||pa.has(D.op)||ua.has(D.op))&&(m=true),h||(D.op==="deleteText"||D.op==="deleteBlock"?h=Dc(()=>y??=chunk2JVOX642_cjs.Uj(this.pkg),a,D,P):(pa.has(D.op)||ua.has(D.op))&&(h=true)),O.apply(D)),...x.context});},{...r,story:i,...i.kind==="headerFooter"||i.kind==="notesPart"?{minimumImpact:"global"}:{}});if(!k.ok)return {ok:false,reason:k.reason,...k.detail?{detail:k.detail}:{}};this.syncPackageFromStore(a);let v=false;if(k.change&&p&&(this.installPackageSnapshotInternal(a.package,false),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),v=true),T&&M){let O=gc(this.pkg,M);O&&this.replacePackageShell(O);}let A=false;if(k.change&&m){let O=this.currentPackage(),D=this.cascadeNoteReferences(s,O);if(D===null)return a.restoreCheckpoint(d),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"note-cascade-failed"};D!==O&&(this.installPackageSnapshotInternal(D),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),A=true);}if(k.change&&h){let O=this.currentPackage(),D=chunk2JVOX642_cjs.Wj(s,O,{storyPartName:i.partName});if(D===null)return a.restoreCheckpoint(d),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"comment-cascade-failed"};D!==O&&(this.installPackageSnapshotInternal(D),c?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(d),A=true);}if(k.change){this.packageRev+=1;let O=A||v;if(!c&&r.recordsHistory!==false&&(a.historyPushCount>l||O))if(O)this.pushUndoPointer({kind:"package",before:s,after:this.currentPackage(),...x?.snapshot(k.change.caret)},Yt(r.historyGroup,s));else {let F=Yt(r.historyGroup,s);this.pushUndoPointer({kind:"story",partName:i.partName,story:i},F);}let D=O?this.publishSynthetic(k.change.origin,"global",i,k.change.created):k.change;return O||this.publish(D),{ok:true,change:D}}return {ok:true,change:k.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.historyPushCount;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.historyPushCount>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(chunk2JVOX642_cjs.g.mutationHuman,"global",r??{kind:"body",partName:this.body.part.name},[]);return}n?.cancelComposition();}applyLifecycleOp(t,n={}){let r=()=>this.commitLifecycleOp(t,n.historyGroup);return chunk2JVOX642_cjs.Hb(n.actorId,()=>chunk2JVOX642_cjs.Xa(this,r,chunk2JVOX642_cjs.Ya,n.historyGroup))}commitLifecycleOp(t,n){let r=this.currentPackage(),o=chunk2JVOX642_cjs.Tk(chunk2JVOX642_cjs.Bf(r),t);if(o)return {ok:false,reason:o};if(chunk2JVOX642_cjs.Fj(t)){let c=chunk2JVOX642_cjs.Gj(r,t);if(!c.ok)return {ok:false,reason:c.reason,...c.detail?{detail:c.detail}:{}};if(c.package===r)return {ok:true,change:null};this.installPackageSnapshotInternal(c.package);let d=Yt(n,r);this.pushUndoPointer({kind:"package",before:r,after:c.package},d),this.packageRev+=1;let m={kind:"body",partName:this.body.part.name},f=this.publishSynthetic(chunk2JVOX642_cjs.g.mutationHuman,c.impact,m,c.createdPartName?[c.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:f}}if(!chunk2JVOX642_cjs.kj(t))return {ok:false,reason:"invalidArgs",detail:"not-lifecycle-op"};let a=chunk2JVOX642_cjs.lj(r,t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};this.installPackageSnapshotInternal(a.package);let i=Yt(n,r);this.pushUndoPointer({kind:"package",before:r,after:a.package},i),this.packageRev+=1;let s={kind:"body",partName:this.body.part.name},l=this.publishSynthetic(chunk2JVOX642_cjs.g.mutationHuman,a.impact,s,a.createdPartName?[a.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:l}}undo(){let t=this.undoOrder.pop();if(!t)return null;if(this.closeHistoryGroups(),t.kind==="package"){this.installPackageSnapshotInternal(t.before,true,t.restoreNumbering),this.redoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunk2JVOX642_cjs.g.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(this.closeHistoryGroups(),t.kind==="package"){this.installPackageSnapshotInternal(t.after,true,t.restoreNumbering),this.undoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunk2JVOX642_cjs.g.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(){return aa(this.undoOrder.at(-1),this.body,this.stories,"undo")}selectionForRedo(){return aa(this.redoOrder.at(-1),this.body,this.stories,"redo")}openStoryParts(){return ia(this.stories,this.pkg)}openedStoryCount(){return 1+this.stories.size}openStoryToken(){return dc(this.stories,this.pkg)}insertImage(t,n){return Bc(this,t,n)}applyFragmentPaste(t,n){return na(this,t,n)}replaceImage(t,n,r,o,a,i){return ga(this,t,n,r,o,a,i)}deleteImage(t,n){return Hc(this,t,n)}deleteImageTracked(t,n,r){return Vc(this,t,n,r)}embedExternalImage(t,n,r,o,a,i,s){return jc(this,t,n,r,o,a,i,s)}setDrawingMetadataWithHyperlink(t,n,r,o,a){return Gc(this,t,n,r,o,a)}applyImageProperties(t,n){return zc(this,t,n)}promoteStoryTransactionToPackageUnit(t,n,r,o){this.installPackageSnapshotInternal(n.package,false),n.restoreHistoryStacks(r),this.pushUndoPointer({kind:"package",before:t,after:this.currentPackage()}),this.packageRev+=1;let a=n.part.name===this.body.part.name?{kind:"body",partName:n.part.name}:this.storyRefForPart(n.part.name);return this.publishSynthetic(chunk2JVOX642_cjs.g.mutationHuman,a?.kind==="headerFooter"?"global":"flow-structural",a??{kind:"body",partName:this.body.part.name},[])}publishStoryWrite(t){return t?(this.packageRev+=1,this.publish(t),t):null}adoptPackageUnit(t){this.adoptGroupedPackageUnit(t,void 0);}adoptGroupedPackageUnit(t,n){let r=this.currentPackage();t!==r&&this.pushUndoPointer({kind:"package",before:t,after:r},Yt(n,t));}installPackageSnapshot(t){this.installPackageSnapshotInternal(t);}installAuthoritativePackageSnapshot(t){this.installPackageSnapshotInternal(t,false);}publishRemotePackage(t,n){return Xc(this,t,n)}replacePackageShell(t){this.shellHyperlinks=Oc(this.shellHyperlinks,this.pkg,t);let n=t;n=chunk2JVOX642_cjs.rg(n,this.body.part);for(let r of this.stories.values())t.parts.has(r.part.name)&&(n=chunk2JVOX642_cjs.rg(n,r.part));this.pkg=n;}installPackageSnapshotInternal(t,n=true,r=false){let o=n?Rc(t,this.pkg,this.shellHyperlinks,r):t,a=o.parts.get(o.mainDocumentPart);if(!a)return;this.body.replacePart(a);for(let[s,l]of this.stories){let c=o.parts.get(s);c&&l.replacePart(c);}this.rIdToPartName.clear();let i=o.relationships.get(o.mainDocumentPart)??[];for(let s of i){if(s.type!==da&&s.type!==ma)continue;let l=chunk2JVOX642_cjs.N(s);l.mode!=="Internal"||!l.target.ok||this.stories.has(l.target.partName)&&o.parts.has(l.target.partName)&&this.rIdToPartName.set(s.id,l.target.partName);}this.pkg=o,this.pkg=chunk2JVOX642_cjs.rg(this.pkg,this.body.part);for(let s of this.stories.values())this.pkg.parts.has(s.part.name)&&(this.pkg=chunk2JVOX642_cjs.rg(this.pkg,s.part));}openNotesPartStore(t){let n=chunk2JVOX642_cjs.pj(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=chunk2JVOX642_cjs.Eb(n),a=new Tt(o,this.storyStoreOptions()),i={kind:"notesPart",partName:o.name,noteKind:t};return a.setStoryRef(i),this.stories.set(o.name,a),o!==n&&(this.pkg=chunk2JVOX642_cjs.rg(this.pkg,o)),{ok:true,story:i,store:a}}openHeaderFooterStore(t){let n=this.rIdToPartName.get(t);if(n){let l=this.stories.get(n);if(l)return {ok:true,story:{kind:"headerFooter",partName:n,rId:t},store:l}}let r=Ac(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 a=chunk2JVOX642_cjs.Eb(r.part),i=new Tt(a,this.storyStoreOptions()),s={kind:"headerFooter",partName:a.name,rId:t};return i.setStoryRef(s),this.stories.set(a.name,i),this.rIdToPartName.set(t,a.name),a!==r.part&&(this.pkg=chunk2JVOX642_cjs.rg(this.pkg,a)),{ok:true,story:s,store:i}}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=chunk2JVOX642_cjs.rg(this.pkg,t.part);}closeHistoryGroups(){chunk2JVOX642_cjs.In(this.body,this.stories,null),this.historyGroups.close();}pushUndoPointer(t,n){t=this.historyGroups.admit(t,n,this.undoOrder,r=>(r===this.body.part.name?this.body:this.stories.get(r))?.discardNewestUndoEntry()??null,()=>this.currentPackage()),chunk2JVOX642_cjs.In(this.body,this.stories,t),this.undoOrder.push(t),this.redoOrder.length=0,this.undoOrder.length>this.historyLimit&&this.undoOrder.shift(),this.evictUnreachableStories();}evictUnreachableStories(){let t=Jc({pkg:this.pkg,stories:this.stories,rIdToPartName:this.rIdToPartName,bodyPartName:this.body.part.name,shellHyperlinks:this.shellHyperlinks,undoOrder:this.undoOrder,redoOrder:this.redoOrder});this.pkg=t.pkg,this.shellHyperlinks=t.shellHyperlinks;}publish(t){this.lastChange=t;for(let n of this.subscribers)n(t);}publishSynthetic(t,n,r,o){this.commitCounter+=1;let a=Qc(this.commitCounter,this.packageRev,t,n,r,o);return this.publish(a),a}};function ed(e,t){let n=e,r=chunk2JVOX642_cjs.Va(),o=[];for(let[a,i]of t){let s=n.parts.get(a);if(!s)continue;let l=m=>{if(i.removed.has(m.id))return null;if(m.kind==="textValue")return m;let f=i.replaced.get(m.id)??m,h;for(let y=0;y<m.children.length;y+=1){let P=m.children[y],T=l(P);T!==P&&h===void 0&&(h=m.children.slice(0,y)),h!==void 0&&T!==null&&h.push(T);}if(r){for(let y=m.children.length-1;y>=0;y-=1)i.removed.has(m.children[y].id)&&o.push(()=>chunk2JVOX642_cjs.$a(m.id,y,1,[]));for(let y=0;y<f.attributes.length;y+=1){let P=f.attributes[y];P!==m.attributes[y]&&o.push(()=>chunk2JVOX642_cjs._a(m.id,{namespaceUri:P.namespaceUri,localName:P.localName,...P.prefix===void 0?{}:{prefix:P.prefix}},P.value));}}return h!==void 0||f!==m?Object.freeze({...f,children:h===void 0?m.children:Object.freeze(h)}):m},c=l(s.root);if(c===s.root)continue;if(c===null)return null;let d=chunk2JVOX642_cjs.Za(()=>chunk2JVOX642_cjs.kb(s,s.root.id,c,{deferValidation:true}));if(!d.ok)return null;n=chunk2JVOX642_cjs.rg(n,d.part);}for(let a of o)a();return n}function ya(e){for(let t=e.children.length-1;t>=0;t-=1){let n=e.children[t];if(n.kind==="paragraph")return chunk2JVOX642_cjs.jf(n,chunk2JVOX642_cjs.ua,"paraId")?.toUpperCase()??null}return null}function td(e,t,n){return t.length===0?e:wp(e,t,n,chunk2JVOX642_cjs.Jj(e))}function wp(e,t,n,r){let o=chunk2JVOX642_cjs.kf(e,n.storyPartName),a=o===null?void 0:e.parts.get(o);if(!a)return e;let i=[];if(!chunk2JVOX642_cjs.hf(r))return null;chunk2JVOX642_cjs.if(a.root,r,w=>w.kind!=="comment"?false:(chunk2JVOX642_cjs.jf(w,chunk2JVOX642_cjs.pa,"id")!==void 0&&i.push({partName:a.name,node:w}),true));let s=chunk2JVOX642_cjs.Kj(e,n),l=chunk2JVOX642_cjs.mf(e,[s.extended,s.ids],r);if(r.truncated)return null;let c=e.parts.get(n.storyPartName),d=c===void 0?null:n.noteId===void 0?c.root:chunk2JVOX642_cjs.ad(c.root).find(w=>chunk2JVOX642_cjs.Rc(w)===n.noteId)??null,m=new Map,f=new Map;for(let w of e.parts.values()){if(!w.name.endsWith(".xml"))continue;if(!chunk2JVOX642_cjs.hf(r))return null;if(w.root===d)continue;let N;if(chunk2JVOX642_cjs.if(w.root,r,S=>{if(S===d)return true;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(S.kind))return false;let I=chunk2JVOX642_cjs.jf(S,chunk2JVOX642_cjs.pa,"id");return I===void 0||(N??=chunk2JVOX642_cjs.kf(e,w.name)===o,N&&(m.set(`${w.name}\0${S.id}`,I),f.set(I,(f.get(I)??0)+1))),true}),r.truncated)return null}let h=new Map,y=w=>{let N=h.get(w);return N||(N={removed:new Set,replaced:new Map},h.set(w,N)),N},P=w=>{let N=h.get(w.partName);return N?.removed.has(w.node.id)?null:N?.replaced.get(w.node.id)??w.node},T=w=>{y(w.partName).removed.add(w.node.id);let N=S=>{y(w.partName).removed.add(S.id);let I=`${w.partName}\0${S.id}`,_=m.get(I);if(_!==void 0&&(m.delete(I),f.set(_,f.get(_)-1)),S.kind!=="textValue")for(let q of S.children)N(q);};N(w.node);},M=(w,N,S,I)=>{let _=P(w);if(!_)return;let q=_.attributes.map(ee=>ee.kind==="genericExtension"&&ee.namespaceUri===N&&ee.localName===S&&ee.value!==I?{...ee,value:I}:ee);q.some((ee,K)=>ee!==_.attributes[K])&&y(w.partName).replaced.set(_.id,{..._,attributes:q});},p=()=>{let w=new Map,N=new Set;for(let S of i){let I=P(S);if(!I)continue;let _=chunk2JVOX642_cjs.jf(I,chunk2JVOX642_cjs.pa,"id");w.has(_)?N.add(_):w.set(_,{...S,node:I});}return {byId:w,duplicateIds:N}},x=()=>l.flatMap(w=>{let N=P(w);return N?[{...w,node:N}]:[]}),k=()=>chunk2JVOX642_cjs.Lj(e,n,r,false,{records:p(),metadata:x()}),v=t.every(w=>w.parentCommentId===void 0)?k():null;if(r.truncated)return null;let A=v&&!v.malformed&&v.duplicateIds.size===0?v:null,O=new Set,D=new Map;for(let w of l){let N=chunk2JVOX642_cjs.jf(w.node,chunk2JVOX642_cjs.ef,"paraId")??chunk2JVOX642_cjs.jf(w.node,chunk2JVOX642_cjs.ff,"paraId");if(N===void 0)continue;let S=N.toUpperCase(),I=D.get(S);I?I.push(w):D.set(S,[w]);}let F=w=>{for(let N of w)for(let S of D.get(N)??[])P(S)&&T(S);};for(let w of t){let{commentId:N,parentCommentId:S}=w;if(S!==void 0){let K=p().byId,ae=K.get(N),B=K.get(S);if(!ae||!B||N===S||(O.add(N),(f.get(N)??0)>0))continue;let V=ya(ae.node),z=ya(B.node);for(let ne of K.values())chunk2JVOX642_cjs.jf(ne.node,chunk2JVOX642_cjs.ff,"parentId")===N&&M(ne,chunk2JVOX642_cjs.ff,"parentId",S);if(V!==null&&z!==null)for(let ne of l){let ie=P(ne);ne.partName===s.extended&&ie&&chunk2JVOX642_cjs.jf(ie,chunk2JVOX642_cjs.ef,"paraIdParent")?.toUpperCase()===V&&M(ne,chunk2JVOX642_cjs.ef,"paraIdParent",z);}T(ae),V!==null&&F(new Set([V]));continue}let I=A??k();if(r.truncated)return null;if(!I.records.has(N))continue;let _=chunk2JVOX642_cjs.Mj(N,I.childrenOf,r);if(r.truncated)return null;let q=new Set,ee=[..._].filter(K=>(f.get(K)??0)===0);for(let K of _)O.add(K);for(let K of ee){let ae=I.records.get(K);if(!ae)continue;let B=ya(ae.node);if(B!==null&&q.add(B),T(ae),A){A.records.delete(K),A.childrenOf.delete(K);let V=A.parentCommentIdByChildId.get(K);if(V!==void 0){let z=A.childrenOf.get(V);z&&A.childrenOf.set(V,z.filter(ne=>ne!==K));}}}F(q);}if(d&&O.size>0){if(!chunk2JVOX642_cjs.hf(r))return null;let w=chunk2JVOX642_cjs.nf(d,O,r);if(w.truncated)return null;let N=y(n.storyPartName).removed;for(let S of w.emptiedRuns)N.add(S);for(let S of w.doomed)N.add(S);}return ed(e,h)}var Ep=256,Tp=65535,nd=64;function Fr(e,t){return e.length>t}function rd(e){return typeof e!="string"||e.trim().length===0?"invalid-author":Fr(e,Ep)?"resource-limit":chunk2JVOX642_cjs.X(e)?null:"invalid-author"}function od(e){return typeof e!="string"||e.length===0?"invalid-text":Fr(e,Tp)?"resource-limit":chunk2JVOX642_cjs.X(e)?null:"invalid-text"}function xa(e){if(typeof e!="string")return {ok:false,rejection:"invalid-date"};let t=e.trim();if(Fr(t,nd))return {ok:false,rejection:"resource-limit"};if(!chunk2JVOX642_cjs.X(t))return {ok:false,rejection:"invalid-date"};let n=chunk2JVOX642_cjs.Nh(t);return n===null?{ok:false,rejection:"invalid-date"}:Fr(n,nd)?{ok:false,rejection:"resource-limit"}:{ok:true,value:n}}function kk(e){if(e===void 0)return null;let t=xa(e);return t.ok?null:t.rejection}function ka(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 Cp(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Pa(e,t){if(!e){let i=chunk2JVOX642_cjs.Ib(t);return i?chunk2JVOX642_cjs.Kb(new Set,i,chunk2JVOX642_cjs.Fb):"0"}let n=-1,r=new Set,o=i=>{if(i.kind!=="textValue"){if(i.kind==="comment"){let s=Cp(i,chunk2JVOX642_cjs.pa,"id");if(s!==void 0&&/^\d{1,10}$/.test(s)){let l=Number(s);Number.isSafeInteger(l)&&l<=chunk2JVOX642_cjs.Fb&&(r.add(String(l)),l>n&&(n=l));}}for(let s of i.children)o(s);}};o(e.root);let a=chunk2JVOX642_cjs.Ib(t);return a?chunk2JVOX642_cjs.Kb(r,a,chunk2JVOX642_cjs.Fb):String(n+1)}function ad(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 a of e.children){let i=ad(a,t);i!==a&&(r=true),o.push(i);}return r?{...e,children:o}:e}function Ap(e,t,n){let r=ad(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:chunk2JVOX642_cjs.ua}]};return chunk2JVOX642_cjs.kb(e,e.root.id,o,{deferValidation:true})}function id(e,t,n){let r=new Map;for(let a of t){if(a.stampParagraph===null)continue;let i=r.get(a.commentsPartName);i||(i=new Map,r.set(a.commentsPartName,i)),i.set(a.stampParagraph.id,{paragraph:a.stampParagraph,paraId:a.paraId});}let o=e;for(let[a,i]of r){let s=o.parts.get(a);if(!s)return null;let l=chunk2JVOX642_cjs.Ab(s.root),c=l??"w14",d=new Map;for(let f of i.values())d.set(f.paragraph.id,n(f.paragraph,f.paraId,c));let m=Ap(s,d,l===null?c:null);if(!m.ok)return null;o=chunk2JVOX642_cjs.rg(o,m.part);}return o}function sd(e,t,n){let r=e.root.children.map(o=>o.kind==="textValue"?o:t.get(o.id)??o);return chunk2JVOX642_cjs.ib(e,e.root.id,[...r,...n],{deferValidation:true})}var dd="/word/comments.xml",md="/word/commentsExtended.xml",Na="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",Sa="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",_p=[Sa,"application/vnd.ms-word.commentsExtended+xml"],pd="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",va="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",kt="http://schemas.microsoft.com/office/word/2012/wordml";function vn(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Zt(e,t){return {kind:"genericExtension",namespaceUri:chunk2JVOX642_cjs.pa,localName:e,prefix:"w",value:t}}function ct(e,t,n,r,o,a,i,s=[]){return {id:e,kind:t,namespaceUri:n,localName:o,prefix:r,namespaceBindings:s,attributes:a,children:i}}function ud(e,t,n,r,o){let a=t===e.mainDocumentPart?[t]:[t,e.mainDocumentPart];for(let i of a)for(let s of chunk2JVOX642_cjs.tg(e,i)){if(s.type!==n)continue;let l=chunk2JVOX642_cjs.E(i,s.rawTarget);if(!l.ok)continue;if(!e.parts.has(l.partName))return l.partName;let c=chunk2JVOX642_cjs.ug(e,l.partName);if(c!==null&&(typeof r=="string"?c===r:r.includes(c)))return l.partName}return o}function Oa(e,t,n){let r=e.mainDocumentPart;for(let a of chunk2JVOX642_cjs.tg(e,r)){if(a.type!==t)continue;let i=chunk2JVOX642_cjs.E(r,a.rawTarget);if(i.ok&&i.partName===n)return e}let o=chunk2JVOX642_cjs.zg(e,r);return chunk2JVOX642_cjs.Ag(o,r,t,chunk2JVOX642_cjs.hk(r,n)).pkg}function wa(e,t){return ud(e,t,pd,Na,dd)}function fd(e,t){let n=chunk2JVOX642_cjs.kf(e,t),r=chunk2JVOX642_cjs.lf(e,t,n).extended;return r!==null?r:ud(e,t,va,_p,md)}function ld(e){let t=new Set;for(let n of e.parts.values())for(let r of chunk2JVOX642_cjs.zb(n.root))t.add(r);return t}function Up(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&vn(o,chunk2JVOX642_cjs.pa,"id")===t){for(let a=o.children.length-1;a>=0;a-=1){let i=o.children[a];if(i.kind!=="paragraph")continue;let s=vn(i,chunk2JVOX642_cjs.ua,"paraId");s!==void 0&&chunk2JVOX642_cjs.vb(s)&&(n=s.toUpperCase());return}return}for(let a of o.children)r(a);}};return r(e.root),n}function Fp(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&vn(o,chunk2JVOX642_cjs.pa,"id")===t){for(let a=o.children.length-1;a>=0;a-=1){let i=o.children[a];if(i.kind==="paragraph"){n=i;return}}return}for(let a of o.children)r(a);}};return r(e.root),n}function gd(e){let t=chunk2JVOX642_cjs.Ab(e.root);if(t!==null)return {part:e,prefix:t};let n={...e.root,namespaceBindings:[...e.root.namespaceBindings,{prefix:"w14",namespaceUri:chunk2JVOX642_cjs.ua}]},r=chunk2JVOX642_cjs.kb(e,e.root.id,n,{deferValidation:true});return r.ok?{part:r.part,prefix:"w14"}:(chunk2JVOX642_cjs.gb(e.root,n),{part:{...e,root:n},prefix:"w14"})}function hd(e,t,n){return ct(e.id,"paragraph",e.namespaceUri,e.prefix??"w",e.localName,[...e.attributes.filter(r=>!(r.namespaceUri===chunk2JVOX642_cjs.ua&&r.localName==="paraId")),{kind:"genericExtension",namespaceUri:chunk2JVOX642_cjs.ua,localName:"paraId",prefix:n,value:t}],e.children,e.namespaceBindings)}function Lp(e,t,n,r){let o=e.parts.get(t);if(!o)return e;let a=gd(o),i=chunk2JVOX642_cjs.eb(a.part,n);if(!i||i.kind!=="paragraph")return chunk2JVOX642_cjs.rg(e,a.part);let s=chunk2JVOX642_cjs.kb(a.part,i.id,hd(i,r,a.prefix),{deferValidation:true});return chunk2JVOX642_cjs.rg(e,s.ok?s.part:a.part)}function $p(e,t,n,r){let o=`${dd}#comment-${e}`,a=n.text!==n.text.trim(),i=ct(`${o}.t`,"text",chunk2JVOX642_cjs.pa,"w","t",a?[{kind:"xmlSpace",namespaceUri:chunk2JVOX642_cjs.qa,localName:"space",prefix:"xml",value:"preserve"}]:[],[{id:`${o}.tv`,kind:"textValue",value:n.text}]),s=ct(`${o}.rPr`,"runProperties",chunk2JVOX642_cjs.pa,"w","rPr",[],[ct(`${o}.rStyle`,"generic",chunk2JVOX642_cjs.pa,"w","rStyle",[Zt("val","CommentReference")],[])]),l=ct(`${o}.r`,"run",chunk2JVOX642_cjs.pa,"w","r",[],[s,i]),c=ct(`${o}.pPr`,"paragraphProperties",chunk2JVOX642_cjs.pa,"w","pPr",[],[ct(`${o}.pStyle`,"generic",chunk2JVOX642_cjs.pa,"w","pStyle",[Zt("val","CommentText")],[])]),d=ct(`${o}.p`,"paragraph",chunk2JVOX642_cjs.pa,"w","p",[{kind:"genericExtension",namespaceUri:chunk2JVOX642_cjs.ua,localName:"paraId",prefix:r,value:t}],[c,l]);return ct(o,"comment",chunk2JVOX642_cjs.pa,"w","comment",[Zt("id",e),Zt("author",n.author),...n.initials===void 0?[]:[Zt("initials",n.initials)],...n.date===void 0?[]:[Zt("date",n.date)]],[d])}function ba(e,t){let n=chunk2JVOX642_cjs.Pa(t,{name:e,contentType:"application/xml"});return n.ok?n.part.root:null}function Ea(e,t){for(let M of [rd(t.author),od(t.text)])if(M)return {ok:false,reason:ka(M)};let n;if(t.date!==void 0){let M=xa(t.date);if(!M.ok)return {ok:false,reason:ka(M.rejection)};n=M.value;}let r={...t,...n===void 0?{}:{date:n}},o=e.package,a=e.part.name,i=wa(o,a),s=fd(o,a),l=o.parts.get(i),c=Pa(l,r.actorId),d=chunk2JVOX642_cjs.yb(`${i}#${c}`,ld(o)),m=t.replyToCommentId===void 0?null:Up(l,t.replyToCommentId),f=t.replyToCommentId!==void 0&&m===null?Fp(l,t.replyToCommentId):null;if(t.replyToCommentId!==void 0&&m===null&&!f)return {ok:false,reason:"unknown-revision"};let h=f?chunk2JVOX642_cjs.yb(`${i}#parent-${t.replyToCommentId}`,new Set([...ld(o),d])):null,y=m??h,P=t.anchor.endParagraphId??t.anchor.paragraphId,T=e.transact(M=>{let p=bn(M);p.applyPackage(x=>{let k=x.parts.has(i)?x:(()=>{let v=ba(i,`<w:comments xmlns:w="${chunk2JVOX642_cjs.pa}"/>`);return v?chunk2JVOX642_cjs.Bg(x,i,v,Na):null})();return k===null?x:Oa(k,pd,i)}),f&&h&&p.applyPackage(x=>Lp(x,i,f.id,h)),p.applyPackage(x=>{let k=x.parts.get(i);if(!k)return x;let v=gd(k),A=chunk2JVOX642_cjs.jb(v.part,v.part.root.id,v.part.root.children.length,[$p(c,d,r,v.prefix)],{deferValidation:true});return A.ok?chunk2JVOX642_cjs.rg(x,A.part):x}),y!==null&&(p.applyPackage(x=>{let k=x.parts.has(s)?x:(()=>{let v=ba(s,`<w15:commentsEx xmlns:w15="${kt}"/>`);return v?chunk2JVOX642_cjs.Bg(x,s,v,Sa):null})();return k===null?x:Oa(k,va,s)}),p.applyPackage(x=>{let k=x.parts.get(s);if(!k)return x;let A=[...Bp(k).has(y.toUpperCase())?[]:[Ia(`${s}#ex-${y}`,y,void 0,false)],Ia(`${s}#ex-${d}`,d,y,false)],O=chunk2JVOX642_cjs.jb(k,k.root.id,k.root.children.length,A,{deferValidation:true});return O.ok?chunk2JVOX642_cjs.rg(x,O.part):x})),p.applyTo(a,{op:"insertCommentMarker",paragraphId:P,offset:t.anchor.end,commentId:c,marker:"reference"}),p.applyTo(a,{op:"insertCommentMarker",paragraphId:P,offset:t.anchor.end,commentId:c,marker:"end"}),p.applyTo(a,{op:"insertCommentMarker",paragraphId:t.anchor.paragraphId,offset:t.anchor.start,commentId:c,marker:"start"});},r.actorId===void 0?{}:{actorId:r.actorId});return T.ok?{ok:true,commentId:c,change:T.change}:{ok:false,reason:T.reason}}function Ra(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 cd(e){let t=Ra(e);if(!t)return null;let n=vn(t,chunk2JVOX642_cjs.ua,"paraId");return n!==void 0&&chunk2JVOX642_cjs.vb(n)?n.toUpperCase():null}function Bp(e){let t=new Map;if(!e)return t;let n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===kt&&r.localName==="commentEx"){let o=vn(r,kt,"paraId");o!==void 0&&chunk2JVOX642_cjs.vb(o)&&t.set(o.toUpperCase(),r);}for(let o of r.children)n(o);}};return n(e.root),t}function Sn(e,t){return {kind:"genericExtension",namespaceUri:kt,localName:e,prefix:"w15",value:t}}function Hp(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 Vp(e,t,n){let r=[],o=false,a=false;for(let i of e.attributes){if(i.namespaceUri===kt&&i.localName==="done"){o=true,r.push({kind:"genericExtension",namespaceUri:i.namespaceUri,localName:i.localName,...i.prefix===void 0?{}:{prefix:i.prefix},value:n?"1":"0"});continue}i.namespaceUri===kt&&i.localName==="paraIdParent"&&(a=true),r.push(i);}return !a&&t!==void 0&&r.push(Sn("paraIdParent",t)),o||r.push(Sn("done",n?"1":"0")),Hp(e,r)}function Ia(e,t,n,r){return {id:e,kind:"generic",namespaceUri:kt,localName:"commentEx",prefix:"w15",namespaceBindings:[],attributes:[Sn("paraId",t),...n===void 0?[]:[Sn("paraIdParent",n)],Sn("done",r?"1":"0")],children:[]}}function Ta(e,t,n){return jp(e,t,n,chunk2JVOX642_cjs.gf())}function jp(e,t,n,r){let o=e.package,a=e.part.name;if(chunk2JVOX642_cjs.kf(o,a)===null)return {ok:false,reason:"unknown-comment"};let s=chunk2JVOX642_cjs.Nj(o,t,{storyPartName:a},r);if(!s.ok)return {ok:false,reason:"unknown-comment"};let l=chunk2JVOX642_cjs.of(o,r);if(l.truncated||r.truncated)return {ok:false,reason:"unknown-comment"};let c=l.used,d=new Map,m=[];for(let P of s.ids){let T=s.records.get(P);if(!T)return {ok:false,reason:"unknown-comment"};if(!Ra(T.node))return {ok:false,reason:"unknown-comment"};let p=cd(T.node),x=p??chunk2JVOX642_cjs.yb(`${T.partName}#done-${P}`,c);p===null&&c.add(x),d.set(P,x);}for(let P of s.ids){let T=s.records.get(P),M=Ra(T.node),p=d.get(P),x=cd(T.node),k=s.parentCommentIdByChildId.get(P),v=s.parentParaIdByCommentId.get(P)??(k===void 0?void 0:d.get(k)),A=s.commentExByParaId.get(p);m.push({paraId:p,stampParagraph:x===null?M:null,commentsPartName:T.partName,parentParaId:v,existing:A?.node,existingParentParaId:A?.parentParaId,existingDone:A?.done??false});}if(m.length===0)return {ok:false,reason:"unknown-comment"};if(m.every(P=>P.existingDone===n))return {ok:true,changed:false,change:null};let f=s.extendedPartName??md,h=s.extendedPartName===null,y=e.transact(P=>{bn(P).applyPackage(M=>{let p=id(M,m,hd);if(p===null)return M;let x=p;if(!x.parts.has(f)){let D=ba(f,`<w15:commentsEx xmlns:w15="${kt}"/>`);if(!D)return M;let F=chunk2JVOX642_cjs.Bg(x,f,D,Sa);x=h?Oa(F,va,f):F;}let k=x.parts.get(f);if(!k)return M;let v=new Map,A=[];for(let D of m){let F=D.existingParentParaId??D.parentParaId;D.existing?v.set(D.existing.id,Vp(D.existing,F,n)):A.push(Ia(`${f}#done-${D.paraId}`,D.paraId,F,n));}let O=sd(k,v,A);return O.ok?chunk2JVOX642_cjs.rg(x,O.part):M});});return y.ok?{ok:true,changed:true,change:y.change}:{ok:false,reason:y.reason}}function Gp(e,t){let n=wa(e,t);return e.parts.has(n)&&chunk2JVOX642_cjs.ug(e,n)===Na}function zp(e,t){return wa(e,t)}function Wp(e,t){return fd(e,t)}var yd={kind:"body"};function Kp(e,t,n=yd,r){let o=n.kind==="body"?null:e.resolveStory(n),a=o?.ok?o.store:e.bodyStore(),i=e.currentPackage(),s=a.checkpoint();return a.graftPackage(()=>e.currentPackage()),chunk2JVOX642_cjs.Xa(e,()=>{let l=Ea(a,t);return l.ok&&(a.restoreHistoryStacks(s),e.replacePackageShell(a.package),e.adoptGroupedPackageUnit(i,r),e.publishStoryWrite(l.change)),l},l=>chunk2JVOX642_cjs.Ya(l),r)}function Xp(e,t,n,r){let o=e.bodyStore(),a=e.currentPackage(),i=chunk2JVOX642_cjs.Tk(chunk2JVOX642_cjs.Bf(a),{op:"setCommentResolved"});if(i)return {ok:false,reason:i};let s=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunk2JVOX642_cjs.Xa(e,()=>{let l=Ta(o,t,n);return !l.ok||!l.changed||(o.restoreHistoryStacks(s),e.replacePackageShell(o.package),e.adoptGroupedPackageUnit(a,r),e.publishStoryWrite(l.change)),l},l=>l.ok&&l.changed,r)}function Yp(e,t,n=yd,r,o){if(t.length===0||chunk2JVOX642_cjs.Tk(chunk2JVOX642_cjs.Bf(e.currentPackage()),{op:"deleteComments"}))return false;let a=n.kind==="body"?e.bodyStore().part:e.partFor(n);if(!a)return false;let i={storyPartName:a.name,...r===void 0?{}:{noteId:r}},s=e.bodyStore(),l=e.currentPackage(),c=s.checkpoint();return s.graftPackage(()=>e.currentPackage()),chunk2JVOX642_cjs.Xa(e,()=>{let d=false,m=false,f=s.transact(h=>{bn(h).applyPackage(P=>{let T=td(P,t,i);return T===null?(d=true,P):(m=T!==P,T)});});return d||!f.ok||!m?false:(s.restoreHistoryStacks(c),e.installPackageSnapshot(s.package),e.adoptGroupedPackageUnit(l,o),e.publishStoryWrite(f.change),true)},d=>d,o)}var kd=256*1024,Pd=4096;function qp(e,t){for(let n=chunk2JVOX642_cjs.fb(e.part,t);n;n=chunk2JVOX642_cjs.fb(e.part,n.id)){if(n.kind==="paragraph")return false;if(n.kind.startsWith("revision"))return true}return false}function Ca(e,t,n){let r=t.payload,o=e.part.name,a=n??o;if(r){if(r.data.length>kd)return {ok:false,reason:"payload-too-large",detail:"data"};if(r.label.length>Pd)return {ok:false,reason:"payload-too-large",detail:"label"}}if(t.revision&&(t.replaceControlId!==void 0||t.replaceUntil!==void 0))return {ok:false,reason:"unsupported",detail:"tracked custom node wrap or rewrite"};let i=t.revision?{revision:t.revision}:{};if(t.replaceControlId!==void 0&&qp(e,t.replaceControlId))return {ok:false,reason:"unsupported",detail:"custom node inside a pending revision"};let s=new Set(chunk2JVOX642_cjs.sc(e.part.root).map(h=>h.node.id)),l=t.replaceControlId===void 0?[]:Od(e,o,t.replaceControlId),c=null,d,m=e.transact(h=>{if(t.replaceControlId!==void 0){h.apply({op:"removeContentControl",controlId:t.replaceControlId,keepContent:false});for(let T of l)h.applyPackage(M=>chunk2JVOX642_cjs.pk(M,T.partName,T.nodeId));}let y=t.replaceUntil;if(y!==void 0&&y<=t.offset){c="invalid-range",d="replaceUntil must be past offset";return}if(y!==void 0&&h.apply({op:"deleteText",paragraphId:t.paragraphId,start:t.offset,end:y}),!r){h.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},...i});return}let P=null;h.applyPackage(T=>{let M=chunk2JVOX642_cjs.kk(T,a,r.namespaceUri,r.rootLocalName);if(!M.part)return c="store-not-authored",d=`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})`,T;if(P=chunk2JVOX642_cjs.uk(M.part,r.rootLocalName,r.nodeId),!P)return c="unaddressable-payload",d=`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`,T;let p=chunk2JVOX642_cjs.ok(M.pkg,M.part.partName,{id:r.nodeId,label:r.label,data:r.data});return chunk2JVOX642_cjs.nk(p,M.part.partName,r.nodeId)?p:(c="store-not-authored",d="the payload node could not be written into the store",T)}),!(c!==null||!P)&&h.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,...i});});if(c!==null)return {ok:false,reason:c,...d===void 0?{}:{detail:d}};if(!m.ok)return {ok:false,reason:m.reason,...m.detail===void 0?{}:{detail:m.detail}};let f=Jp(e,s);return {ok:true,change:m.change,...f===void 0?{}:{nodeId:f}}}function Jp(e,t){for(let n of chunk2JVOX642_cjs.sc(e.part.root))if(!t.has(n.node.id))return n.node.id}function Od(e,t,n){let r=chunk2JVOX642_cjs.sc(e.part.root).find(a=>a.node.id===n);if(!r)return [];let o=[];for(let a of chunk2JVOX642_cjs.ik(e.package,t)){let i=chunk2JVOX642_cjs.xk(r.node,a.itemId);i!==null&&o.push({partName:a.partName,nodeId:i});}return o}function Ma(e,t){let n=e.part.name,r=Od(e,n,t),o=e.transact(a=>{a.apply({op:"removeContentControl",controlId:t,keepContent:false});for(let i of r)a.applyPackage(s=>chunk2JVOX642_cjs.pk(s,i.partName,i.nodeId));});return o.ok?{ok:true,change:o.change}:{ok:false,reason:o.reason,...o.detail===void 0?{}:{detail:o.detail}}}function Qp(e,t,n){if(!e.parts.has(t)||n.length===0)return {ok:true,pkg:e,removed:[]};let r=e,o=[];for(let a of n){let i=chunk2JVOX642_cjs.jk(r,t,a);if(!i)continue;let s=chunk2JVOX642_cjs.wk(r,i.itemId),l=chunk2JVOX642_cjs.qk(r,i.partName,s);if(l.pkg===r&&chunk2JVOX642_cjs.mk(r,i.partName).some(c=>!s.has(c.id)))return {ok:false,reason:`the payload store for ${a} refused the sweep`};r=l.pkg,o.push(...l.removed);}return {ok:true,pkg:r,removed:o}}var xd=new WeakMap;function Zp(e,t){let n=xd.get(e);n||(n=new Map,xd.set(e,n));let r=n.get(t);if(r)return r;let o=chunk2JVOX642_cjs.ik(e,t).map(a=>({itemId:a.itemId,nodes:new Map(chunk2JVOX642_cjs.mk(e,a.partName).map(i=>[i.id,i]))}));return n.set(t,o),o}function eu(e,t,n=t){let r=new Map,o=e.parts.get(t);if(!o)return r;let a=Zp(e,n);if(a.length===0)return r;for(let i of chunk2JVOX642_cjs.sc(o.root))for(let s of a){let l=chunk2JVOX642_cjs.xk(i.node,s.itemId);if(l===null)continue;let c=s.nodes.get(l);if(c){r.set(i.node.id,{nodeId:l,label:c.label,data:c.data});break}}return r}function tu(e,t,n){let r=new Map,o=chunk2JVOX642_cjs.jk(e,t,n);if(!o)return r;for(let a of chunk2JVOX642_cjs.mk(e,o.partName))r.set(a.id,{label:a.label,data:a.data});return r}var bd={kind:"body"};function Rd(e,t,n,r){let o=t.kind==="body"?null:e.resolveStory(t),a=o?.ok?o.store:e.bodyStore(),i=e.currentPackage(),s=a.checkpoint();return a.graftPackage(()=>e.currentPackage()),chunk2JVOX642_cjs.Xa(e,()=>{let l=n(a);return l.ok&&(a.restoreHistoryStacks(s),e.replacePackageShell(a.package),e.adoptGroupedPackageUnit(i,r),e.publishStoryWrite(l.change)),l},l=>chunk2JVOX642_cjs.Ya(l),r)}function nu(e,t,n=bd,r){return Rd(e,n,o=>Ca(o,t,e.bodyStore().part.name),r)}function ru(e,t,n=bd){return Rd(e,n,r=>Ma(r,t))}var en="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Lr="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",wn="http://purl.org/dc/elements/1.1/",Da="application/vnd.openxmlformats-package.core-properties+xml",Aa={author:[wn,"creator"],title:[wn,"title"],subject:[wn,"subject"],comments:[wn,"description"],keywords:[en,"keywords"],category:[en,"category"]},Id={...Aa,lastAuthor:[en,"lastModifiedBy"]},hP=Object.keys(Id);function $r(e){let t=(e.relationships.get("/")??[]).find(r=>r.type===Lr);if(!t||t.targetMode!=="Internal")return null;let n=chunk2JVOX642_cjs.E("/",t.rawTarget);return n.ok?e.parts.get(n.partName)??null:null}function yP(e,t){let n=$r(e),[r,o]=Id[t],a=n?.root.children.find(i=>i.kind!=="textValue"&&i.namespaceUri===r&&i.localName===o);return a&&a.kind!=="textValue"?a.children.map(i=>i.kind==="textValue"?i.value:"").join(""):""}function ou(e){if(!e||typeof e!="object"||Array.isArray(e))return false;let t=Object.entries(e);return t.length>0&&t.every(([n,r])=>Object.hasOwn(Aa,n)&&typeof r=="string"&&r.length<=4096&&chunk2JVOX642_cjs.X(r))}function xP(e,t){if(!ou(t)||(e.relationships.get("/")??[]).filter(s=>s.type===Lr).length>1)return null;let n=$r(e);if(n&&(n.contentType!==Da||n.root.namespaceUri!==en||n.root.localName!=="coreProperties")||!n&&(e.relationships.get("/")??[]).some(s=>s.type===Lr))return null;let r=n?.name??"/docProps/core.xml";if(!n&&(e.parts.has(r)||e.partBytes.has(r)))return null;let o=chunk2JVOX642_cjs.Pa(`<cp:coreProperties xmlns:cp="${en}" xmlns:dc="${wn}">${Object.entries(t).map(([s,l])=>{let[c,d]=Aa[s],m=c===en?"cp":"dc";return `<${m}:${d}>${chunk2JVOX642_cjs.V(l)}</${m}:${d}>`}).join("")}</cp:coreProperties>`,{name:r,contentType:Da});if(!o.ok)return null;if(n){let s=n,l=chunk2JVOX642_cjs.cb(n),c=d=>d.kind==="textValue"?{...d,id:l()}:{...d,id:l(),children:d.children.map(c)};for(let d of o.part.root.children){if(d.kind==="textValue")continue;let m=s.root.children.filter(y=>y.kind!=="textValue"&&y.namespaceUri===d.namespaceUri&&y.localName===d.localName);if(m.length>1)return null;let f=m[0],h;if(f&&f.kind!=="textValue"){if(f.children.some(M=>M.kind!=="textValue"))return null;let y=f.children.length===1&&f.children[0]?.kind==="textValue"?f.children[0]:null,P=d.children.find(M=>M.kind==="textValue"),T=y&&P?.kind==="textValue"?[{...y,value:P.value}]:d.children.map(c);h=chunk2JVOX642_cjs.kb(s,f.id,{...f,children:T});}else {let y=Array.from(s.root.children);y.push(c(d)),h=chunk2JVOX642_cjs.ib(s,s.root.id,y);}if(!h.ok)return null;s=h.part;}return chunk2JVOX642_cjs.rg(e,s)}let a=chunk2JVOX642_cjs.Bg(e,r,o.part.root,Da);if(!a.parts.has(r))return null;let i=chunk2JVOX642_cjs.Ag(a,"/",Lr,r.slice(1));return i.ok?i.pkg:null}var au="{6C3C8BC8-F283-45AE-878A-BAB7291924A1}",iu="{6668398D-A668-4E3E-A5EB-62B293D839F1}",su="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",lu=1024,cu=32,du=1e5,mu=8192,En=32768,pu=1e4;function uu(e){let t=new Map;if(e===void 0||e.trim()==="")return t;if(e.length>mu)return null;let n=/xmlns:([^\s=]+)\s*=\s*(?:'([^']*)'|"([^"]*)")/g,r="";for(let o of e.matchAll(n)){let a=o[1];if(!chunk2JVOX642_cjs.ia(a))return null;t.set(a,o[2]??o[3]??""),r+=o[0];}return e.replace(n,"").trim()!==""||r===""?null:t}function Nd(e,t){let n=e.indexOf(":");if(n===-1)return chunk2JVOX642_cjs.ia(e)?{namespaceUri:"",localName:e}:null;let r=e.slice(0,n),o=e.slice(n+1),a=t.get(r);return a===void 0||!chunk2JVOX642_cjs.ia(o)?null:{namespaceUri:a,localName:o}}function fu(e,t){if(!e||e.length>lu||!e.startsWith("/"))return null;let n=e.slice(1).split("/");if(n.length===0||n.length>cu)return null;let r=[];for(let[o,a]of n.entries()){let i=o===n.length-1,s=a.trim();if(s==="text()"){if(!i||r.length===0)return null;r.push({kind:"text"});continue}if(s.startsWith("@")){let m=i&&r.length>0?Nd(s.slice(1),t):null;if(!m)return null;r.push({kind:"attribute",...m});continue}let l=/^([^[\]]+)(?:\[(\d{1,6})\])?$/.exec(s);if(!l)return null;let c=Nd(l[1],t),d=l[2]===void 0?1:Number(l[2]);if(!c||d<1||d>du)return null;r.push({kind:"element",...c,position:d});}return r}function gu(e){return e.kind!=="textValue"}function hu(e){let t="",n=0,r=[e];for(;r.length>0;){let o=r.pop();if(++n>pu)return null;if(o.kind==="textValue"){if(t+=o.value,t.length>En)return null;continue}for(let a=o.children.length-1;a>=0;a-=1)r.push(o.children[a]);}return t}function yu(e,t){let n=t[0];if(n?.kind!=="element"||n.position!==1||e.namespaceUri!==n.namespaceUri||e.localName!==n.localName)return null;let r=e;for(let o of t.slice(1)){if(o.kind==="attribute"){let s=r.attributes.find(l=>l.localName===o.localName&&l.namespaceUri===o.namespaceUri);return !s||s.value.length>En?null:s.value}if(o.kind==="text"){let s="";for(let l of r.children)l.kind==="textValue"&&(s+=l.value);return s.length>En?null:s}let a=0,i=null;for(let s of r.children)if(gu(s)&&!(s.localName!==o.localName||s.namespaceUri!==o.namespaceUri)&&(a+=1,a===o.position)){i=s;break}if(!i)return null;r=i;}return hu(r)}function Sd(e){let t=new Map;for(let i of chunk2JVOX642_cjs.ik(e,e.mainDocumentPart)){let s=e.parts.get(i.partName),l=i.itemId.toUpperCase();s&&!t.has(l)&&t.set(l,s.root);}let n=$r(e);n&&t.set(au,n.root);let r=(e.relationships.get("/")??[]).find(i=>i.type===su&&i.targetMode!=="External"),o=r?chunk2JVOX642_cjs.E("/",r.rawTarget):null,a=o?.ok?e.parts.get(o.partName):void 0;return a&&t.set(iu,a.root),t}function vd(e,t){let n=t.storeItemID?.trim().toUpperCase(),r=n?e.get(n):void 0;if(!r)return null;let o=uu(t.prefixMappings);if(!o)return null;let a=fu(t.xpath,o);return a?yu(r,a):null}var xu=96,Br="http://schemas.openxmlformats.org/officeDocument/2006/relationships",ku=new Set([`${Br}/header`,`${Br}/footer`,`${Br}/footnotes`,`${Br}/endnotes`]);function wd(e){let t=[],n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:o}=n.pop();if(!(r.kind==="textValue"||o>xu)){if(chunk2JVOX642_cjs.Gh(r)&&chunk2JVOX642_cjs.qc(r).dataBinding){t.push(r);continue}for(let a=r.children.length-1;a>=0;a-=1)n.push({node:r.children[a],depth:o+1});}}return t}function Pu(e,t){let n=t.replace(/\r\n?/g,`
2
2
  `);switch(e.type){case "plainText":return {kind:"text",text:n.replaceAll(`
3
- `,e.multiLine?chunkDCILO4XD_cjs.xj:"")};case "comboBox":{let r=e.listItems.find(o=>o.value===n);return r?{kind:"listItem",value:r.value}:{kind:"text",text:n}}case "dropDownList":return n===""?{kind:"text",text:n}:{kind:"listItem",value:n};case "checkbox":return n.trim()===""?null:{kind:"text",text:n};case "date":{if(n.trim()==="")return {kind:"text",text:""};let r=/^\s*(\d{4}-\d{2}-\d{2})(?:[T\s]|$)/.exec(n);return r?{kind:"date",iso:r[1]}:null}default:return null}}function Ou(e,t){if(t.length>En)return null;let n=Pu(e,t);if(!n)return null;if(n.kind==="text"&&n.text==="")return e.placeholderDocPart!==void 0?{text:chunkDCILO4XD_cjs.nm(e.type),showingPlaceholder:true}:{text:"",showingPlaceholder:false};if(e.type==="checkbox"){let o=bu(n.kind==="text"?n.text:"");if(o===null)return null;let a=chunkDCILO4XD_cjs.vm(e,{kind:"checkbox",checked:o});return typeof a=="string"?null:a}let r=chunkDCILO4XD_cjs.vm(e,n);return typeof r=="string"?null:r}function bu(e){let t=e.trim().toLowerCase();return t==="true"||t==="1"?true:t==="false"||t==="0"?false:null}function Ru(e,t,n){return n.showingPlaceholder?t.showingPlaceholder:t.showingPlaceholder?false:n.fullDate!==void 0?t.date?.fullDate?.slice(0,10)===n.fullDate.slice(0,10):n.checked!==void 0&&t.checkbox?.checked!==n.checked||n.lastValue!==void 0&&t.lastValue!==void 0&&t.lastValue!==n.lastValue?false:chunkDCILO4XD_cjs.uc(e,chunkDCILO4XD_cjs.xj)===n.text}function Iu(e,t,n,r,o){let a=e,i=chunkDCILO4XD_cjs.qc(n),s=Ou(i,r);if(!s||Ru(n,i,s))return a;let l=chunkDCILO4XD_cjs.Ih(n),c=chunkDCILO4XD_cjs.al(t,n.id),d=s.showingPlaceholder?[]:s.symbol?chunkDCILO4XD_cjs.bl(l,s.symbol,s.text,o,c):chunkDCILO4XD_cjs.xm(l,s.text,o,c);if(!d||!l)return a;let m=chunkDCILO4XD_cjs.Hh(n),f=chunkDCILO4XD_cjs.wm(m,{showingPlaceholder:s.showingPlaceholder,...s.lastValue===void 0?{}:{lastValue:s.lastValue},...s.fullDate===void 0?{}:{fullDate:s.fullDate},...s.checked===void 0?{}:{checked:s.checked}},o),h={...n,children:n.children.map(P=>P.id===l.id?{...l,children:d}:P.id===m?.id?f:P)},y=chunkDCILO4XD_cjs.kb(a,n.id,h);return y.ok?y.part:a}function Nu(e,t,n=wd(e.root)){if(t.size===0||n.length===0)return e;let r=e,o=null;for(let a of n){let i=chunkDCILO4XD_cjs.qc(a).dataBinding,s=vd(t,i);s!==null&&(o??=chunkDCILO4XD_cjs.cb(e,"paste"),r=Iu(r,e,a,s,o));}return r}function _a(e){let t=[e.mainDocumentPart];for(let a of e.relationships.get(e.mainDocumentPart)??[]){if(!ku.has(a.type)||a.targetMode==="External")continue;let i=chunkDCILO4XD_cjs.E(e.mainDocumentPart,a.rawTarget);i.ok&&!t.includes(i.partName)&&t.push(i.partName);}let n=[];for(let a of t){let i=e.parts.get(a),s=i?wd(i.root):[];i&&s.length>0&&n.push({part:i,controls:s});}if(n.length===0)return e;let r=Sd(e);if(r.size===0)return e;let o=e;for(let{part:a,controls:i}of n){let s=Nu(a,r,i);s!==a&&(o=chunkDCILO4XD_cjs.rg(o,s));}return o}var Su=256,vu=2e3,Ed=/[\p{L}\p{N}_]/u;function Ua(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],a=o.toLowerCase();n+=a.length===1?a:o;}return n}function Td(e,t,n){let r=t>0?e[t-1]:void 0,o=n<e.length?e[n]:void 0;return !(r!==void 0&&Ed.test(r)||o!==void 0&&Ed.test(o))}function Cd(e){return typeof e=="string"&&e.length>0&&e.length<=256}function wu(e,t,n,r={}){let o={matches:[],truncated:false};if(!Cd(t)||e.length===0||n<=0)return o;let a=r.matchCase===true,i=r.wholeWord===true,s=a?t:Ua(t),l=a?e:Ua(e),c=Math.max(0,r.from??0),d=Math.min(e.length,r.to??e.length),m=[],f=l.indexOf(s,c);for(;f>=0;){let h=f+s.length;if(h>d)return {matches:m,truncated:false};if(!i||Td(e,f,h)){if(m.length>=n)return {matches:m,truncated:true};m.push({start:f,length:s.length});}f=l.indexOf(s,h);}return {matches:m,truncated:false}}var Eu=new Set(["plainText","richText","date","dropDownList","comboBox","docPartList"]),Tu=96;function Fa(e,t){return e.kind!=="textValue"&&e.namespaceUri===chunkDCILO4XD_cjs.pa&&e.localName===t}function Cu(e){return e.kind==="textValue"&&e.value.trim()===""}function Mu(e){let t=[],n=(r,o,a)=>{if(r.kind==="textValue"||a>Tu)return;if(chunkDCILO4XD_cjs.Gh(r)){let s=chunkDCILO4XD_cjs.Ih(r),l=chunkDCILO4XD_cjs.qc(r);if(s&&l&&s.children.every(Cu)&&Eu.has(l.type)){t.push({control:r,content:s,kind:l.type,docPart:l.placeholderDocPart,inline:o});return}}let i=o||r.kind==="paragraph"||Fa(r,"p");for(let s of r.children)n(s,i,a+1);};return n(e,false,0),t}function Du(e){return chunkDCILO4XD_cjs.tm(e,"rPr",{kind:"runProperties",children:[chunkDCILO4XD_cjs.tm(e,"rStyle",{attributes:[["val","PlaceholderText"]]})]})}function Au(e){let t=e.find(r=>r.kind==="paragraph"||Fa(r,"p"));if(!t||t.kind==="textValue")return null;let n=t.children.filter(r=>r.kind!=="paragraphProperties"&&!Fa(r,"pPr"));return n.length>0?n:null}function La(e,t){let n=Mu(t.root);if(n.length===0)return t;let r=null,o=c=>{if(c!==void 0)return r??=chunkDCILO4XD_cjs.$i(e),r.find(d=>d.name===c)},a=chunkDCILO4XD_cjs.cb(t,"paste"),i=new Set(chunkDCILO4XD_cjs.zb(t.root)),s={value:0},l=t;for(let[c,d]of n.entries()){let m=o(d.docPart),f=chunkDCILO4XD_cjs.Bb(t,d.control),h=null;if(m){let p=m.blocks.map((x,k)=>chunkDCILO4XD_cjs.Db(chunkDCILO4XD_cjs.Ph(x,a),i,chunkDCILO4XD_cjs.Jb(`${d.control.id}:placeholder:${c}:${k}`),s,f));h=d.inline?Au(p):p;}if(!h){let p=chunkDCILO4XD_cjs.um(a,chunkDCILO4XD_cjs.nm(d.kind),Du(a));h=d.inline?[p]:[chunkDCILO4XD_cjs.Db(chunkDCILO4XD_cjs.tm(a,"p",{kind:"paragraph",children:[p]}),i,chunkDCILO4XD_cjs.Jb(`${d.control.id}:placeholder:${c}`),s,f)];}let y=chunkDCILO4XD_cjs.wm(chunkDCILO4XD_cjs.Hh(d.control),{showingPlaceholder:true},a),P={...d.content,children:h},T=d.control.children.map(p=>p.id===d.content.id?P:p.kind!=="textValue"&&p.localName==="sdtPr"?y:p),M=chunkDCILO4XD_cjs.ib(l,d.control.id,T);M.ok&&(l=M.part);}return l}function Md(e,t,n){let r=t.filter(i=>i.node.localName==="tblGridChange"&&n.has(i.node.id));if(!r.length)return new Set;let o=new Map;for(let i of t){if(!["trPrChange","tcPrChange","tblPrExChange"].includes(i.node.localName))continue;let s=i.parent;for(;s&&s.kind!=="table";)s=chunkDCILO4XD_cjs.fb(e,s.id);if(!s)continue;let l=o.get(s.id)??[];l.push(i.node.id),o.set(s.id,l);}let a=new Set;for(let i of r){let s=i.parent&&chunkDCILO4XD_cjs.fb(e,i.parent.id),l=s&&o.get(s.id);l?.some(c=>n.has(c))&&l.some(c=>!n.has(c))&&a.add(i.node.id);}return a}function Dd(e){if(e.kind==="textValue")return;let t=r=>e.attributes.find(o=>o.namespaceUri===chunkDCILO4XD_cjs.pa&&o.localName===r)?.value,n=t("author");return n===void 0?void 0:`${n}\0${t("date")??""}`}function _u(e){let t=[],n=r=>{if(r.kind!=="textValue"){if(r.kind==="paragraph"){let o=[],a=[],i=s=>{if(s.kind!=="textValue"){if(s.localName==="txbxContent")return n(s);a.push(s);for(let l of s.children)i(l);}};for(let s of r.children){if(s.localName!=="pPr"){i(s);continue}for(let l of s.children)if(l.kind!=="textValue"&&l.localName==="rPr")for(let c of l.children)c.kind!=="textValue"&&c.localName==="moveTo"&&o.push(c);}t.push({marks:o,inline:a});return}for(let o of r.children)n(o);}};return n(e),t}function Ad(e,t){let n=[];if(t.size===0)return n;for(let r of _u(e))for(let o of r.marks){if(!t.has(o.id))continue;let a=Dd(o),i=r.inline.filter(s=>t.has(s.id)&&Dd(s)===a);i.length>0&&n.push([o.id,...i.map(s=>s.id)]);}return n}var Uu=new Set(["tblPrChange","tblGridChange","tblPrExChange","trPrChange","tcPrChange"]);function Fu(e,t,n,r,o){let a=_d(e,t,n,r,o);for(let l=0;n&&l<3&&a.partial?.length&&a.result.skipped.some(c=>c.reason==="incomplete-group");l++)n=[...new Set([...n,...a.partial])],a=_d(e,t,n,r,o);let{partial:i,...s}=a;return s}function _d(e,t,n,r,o){let a=r??e.root,i=a.kind==="textValue"?e:{...e,root:a},s=chunkDCILO4XD_cjs.cm(i),l=n===void 0?chunkDCILO4XD_cjs.Ol(i):[],c=[...chunkDCILO4XD_cjs.fl(i,l),...l.filter(g=>g.node.localName==="numberingChange").map(g=>g.node.id)],d=c.length?[{op:"acceptAllRevisions",siteNodeIds:c,...r?{scopeRootId:r.id}:{}}]:[];if(n?.length===0||s.length===0)return {ops:d,result:{resolved:[],skipped:[...new Set(n??[])].map(g=>({key:g,reason:"unknown-revision"})),remaining:s.length}};let m=new Set(n??s.map(chunkDCILO4XD_cjs.ml)),f=new Map(s.map(g=>[chunkDCILO4XD_cjs.ml(g),g])),h=new Set;for(let g of m){let u=f.get(g);if(u)for(let E of chunkDCILO4XD_cjs.ll(u))h.add(E);}let y=chunkDCILO4XD_cjs.Ol(i),P=chunkDCILO4XD_cjs.il(a,y,h,t);for(let g of P.selected)h.add(g);let T=[...chunkDCILO4XD_cjs.yl(a).values()],M=chunkDCILO4XD_cjs.Ql(a,y),p=g=>{let u=chunkDCILO4XD_cjs.eb(i,g);return u&&u.kind!=="textValue"?chunkDCILO4XD_cjs.Hl(u,"author"):void 0},x=chunkDCILO4XD_cjs.gl(i,y),k=new Set(s.map(chunkDCILO4XD_cjs.ll).filter(g=>g.some(u=>x.has(u))).flat()),v=new Set(h),A=new Set([...v].map(p)),O=chunkDCILO4XD_cjs.Ll(i,y,t).filter(g=>{let u=g.slice(0,-1),E=p(g.at(-1));return !u.every(L=>p(L)===E)&&!u.some(L=>v.has(L))?false:o?.explicit?k.has(g.at(-1))&&!u.some(L=>v.has(L))?false:g.some(L=>v.has(L))||u.every(L=>A.has(p(L))):true}),D=[...y.some(g=>g.node.localName==="cellMerge")?chunkDCILO4XD_cjs.Ml(i,t):[],...Ad(a,M),...O,...chunkDCILO4XD_cjs.hl(i,y)];if(o?.explicit){let g=[...T.map(u=>u.wrappers.map(E=>E.id)),...D,...D.length?s.map(chunkDCILO4XD_cjs.ll).filter(u=>!u.some(E=>k.has(E))):[]];for(let u=true,E=0;u&&E<=g.length;E++){u=false;for(let L of g)if(L.some(Q=>h.has(Q)))for(let Q of L)h.has(Q)||(u=!!h.add(Q));}}for(let g of s){let u=chunkDCILO4XD_cjs.ll(g);u.length&&u.every(E=>h.has(E))&&m.add(chunkDCILO4XD_cjs.ml(g));}let F=new Map(y.map((g,u)=>[g.node.id,u])),w=y.map((g,u)=>u),N=g=>{for(;w[g]!==g;)w[g]=w[w[g]],g=w[g];return g},S=(g,u)=>{w[N(u)]=N(g);};for(let g of P.dependencies){let u=g.flatMap(E=>F.has(E)?[F.get(E)]:[]);for(let E of u)S(u[0],E);}let I=new Map;for(let g of s){let u=chunkDCILO4XD_cjs.ll(g).flatMap(E=>{let L=F.get(E);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}let _=y.filter(g=>h.has(g.node.id)),q=new Set(chunkDCILO4XD_cjs.Il(e,_,t).keys()),ee=new Map,K=new Set,ae=new Map,B=(g,u)=>{K.add(g),ae.set(g,u);},V=new Set(chunkDCILO4XD_cjs.Al(e,y,t)),z=g=>!g.refused&&!V.has(g.node.id);for(let[g,u]of y.entries()){if(h.has(u.node.id)&&z(u)&&!u.paragraphMark&&!M.has(u.node.id)&&(t==="accept"?u.node.kind==="revisionDelete"||u.node.kind==="revisionMoveFrom":u.node.kind==="revisionInsert"||u.node.kind==="revisionMoveTo")&&B(u.node.id,g),t==="reject"&&u.propertyChange&&u.parent&&h.has(u.node.id))for(let L of u.parent.children)chunkDCILO4XD_cjs.cl(u.node.localName,L)||(I.set(L.id,g),L.id!==u.node.id&&z(u)&&B(L.id,g));let E=t==="accept"?u.node.localName==="del"||u.node.localName==="moveFrom":u.node.localName==="ins"||u.node.localName==="moveTo";if(u.paragraphMark&&u.parent&&E&&!M.has(u.node.id)&&h.has(u.node.id)){let L=chunkDCILO4XD_cjs.fb(e,u.parent.id),Q=L&&chunkDCILO4XD_cjs.fb(e,L.id),fe=Q&&chunkDCILO4XD_cjs.fb(e,Q.id);if(L&&Q&&fe){let ge=ee.get(fe.id);ge||(ge=chunkDCILO4XD_cjs.El(fe.children,q),ee.set(fe.id,ge)),ge.has(Q.id)&&(I.set(L.id,g),z(u)&&B(L.id,g));}}if(h.has(u.node.id)&&chunkDCILO4XD_cjs.Jl(e,u,t)){let L=chunkDCILO4XD_cjs.Jl(e,u,t);L&&!u.refused&&(I.set(L.id,g),z(u)&&B(L.id,g));}}for(let[g,u]of chunkDCILO4XD_cjs.Kl(e,_,t)){let E=chunkDCILO4XD_cjs.eb(e,g),L=F.get(u[0]);if(!(E?.kind!=="tableCell"||L===void 0)){for(let Q of E.children)if(Q.localName==="tcPr")for(let fe of Q.children)fe.kind==="textValue"||chunkDCILO4XD_cjs.Gl.has(fe.localName)||I.set(fe.id,L);}}let ne=chunkDCILO4XD_cjs.km(e),ie=g=>{for(let u=chunkDCILO4XD_cjs.fb(e,y[g].node.id);u;u=chunkDCILO4XD_cjs.fb(e,u.id))if(ne.has(u.id))return true;return false},Ne=new Map,Xe=g=>{let u=Ne.get(g);return u===void 0&&(u=chunkDCILO4XD_cjs.lm(e,[y[g].node.id],t)!==null,Ne.set(g,u)),u},Ce=(g,u)=>ne.size>0&&["revisionInsert","revisionDelete"].includes(y[u].node.kind)&&["revisionInsert","revisionDelete"].includes(y[g].node.kind)&&ie(u)&&Xe(g)&&!Xe(u),Ve=chunkDCILO4XD_cjs.Dl(i,[...F.keys(),...I.keys()]),J=(g,u)=>{if(!Ve.has(g.id))return;let E=F.get(g.id),L=I.get(g.id);E!==void 0&&L!==void 0&&S(L,E);let Q=E??L,fe=o?.explicit===true&&Q!==void 0&&(E===void 0||L===void 0||L===E)&&y[Q].node.localName==="rPrChange"||Q!==void 0&&u!==void 0&&Ce(u,Q);Q!==void 0&&u!==void 0&&!fe&&S(u,Q);let ge=Q??u;if(g.kind!=="textValue")for(let je of g.children)J(je,ge);};J(a);for(let g of T){let u=g.wrappers.flatMap(E=>{let L=F.get(E.id);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}for(let g of D){let u=g.flatMap(E=>{let L=F.get(E);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}let Me=new Map,de=()=>{Me.clear();for(let[g,u]of y.entries()){let E=N(g),L=Me.get(E)??[];L.push(u),Me.set(E,L);}};de();let At=g=>g.kind==="revisionInsert"||g.kind==="revisionDelete"||g.kind==="revisionMoveFrom"||g.kind==="revisionMoveTo",dt=g=>{if(!g||g.kind==="textValue"||!At(g))return false;let u=g.children.filter(E=>E.kind!=="textValue"&&!chunkDCILO4XD_cjs.zl(E));return u.length>0&&u.every(E=>K.has(E.id))},Pe=g=>{if(!o?.explicit||!K.size)return false;for(let u=chunkDCILO4XD_cjs.fb(e,g);u;u=chunkDCILO4XD_cjs.fb(e,u.id))if(K.has(u.id))return true;return dt(chunkDCILO4XD_cjs.eb(e,g))},tt=new Set([...T.map(g=>g.wrappers.map(u=>u.id)),...D,...P.dependencies,...s.map(chunkDCILO4XD_cjs.ll)].filter(g=>g.some(u=>h.has(u)||Pe(u))).flat()),nn=g=>{if(tt.has(g.node.id)||I.has(g.node.id))return false;for(let u=chunkDCILO4XD_cjs.fb(e,g.node.id);u;u=chunkDCILO4XD_cjs.fb(e,u.id))if(I.has(u.id)||K.has(u.id))return false;return !dt(g.node)},Oe=new Map,b=new Map,U=chunkDCILO4XD_cjs.jm(e),$=new Map,j=g=>{if(!U)return null;let u=g.map(Q=>Q.node.id),E=u.join("\0"),L=$.get(E);return L===void 0&&(L=chunkDCILO4XD_cjs.lm(e,u,t),$.set(E,L)),L},X=()=>{Oe.clear(),b.clear();for(let[g,u]of Me){let E=u.some(ge=>h.has(ge.node.id)),L=u.find(ge=>ge.refused),Q=t==="reject"&&u.some(ge=>ge.propertyChange&&chunkDCILO4XD_cjs.el(ge.node)===null),fe=!L&&!Q&&j(u);if(L||Q||fe)Oe.set(g,"unsupported-revision"),b.set(g,L?.refusal??(fe||"unrecorded-properties"));else {let ge=u.find(je=>!h.has(je.node.id)&&!Pe(je.node.id)&&!(o?.explicit&&k.has(je.node.id))&&!(E&&nn(je)));ge&&(Oe.set(g,"incomplete-group"),b.set(g,Z(ge)));}}},Z=g=>{if(tt.has(g.node.id))return "paired-change";for(let E=chunkDCILO4XD_cjs.fb(e,g.node.id);E;E=chunkDCILO4XD_cjs.fb(e,E.id)){if(K.has(E.id))return "removed-content";if(I.has(E.id))return "replaced-properties"}return dt(g.node)?"emptied-change":[...h].some(E=>{for(let L=chunkDCILO4XD_cjs.fb(e,E);L;L=chunkDCILO4XD_cjs.fb(e,L.id))if(L.id===g.node.id)return true;return false})?"enclosing-change":"grouped-change"},me=()=>{for(let g of s)if(g.readOnly)for(let u of chunkDCILO4XD_cjs.ll(g)){let E=F.get(u);E!==void 0&&(Oe.set(N(E),"unsupported-revision"),b.has(N(E))||b.set(N(E),"read-only"));}},we=()=>{for(;;){X(),me();let g=[...ae].filter(([,u])=>Oe.get(N(u))==="unsupported-revision");if(!g.length)return;for(let[u]of g)K.delete(u),ae.delete(u);}};we();let xe=y.filter((g,u)=>h.has(g.node.id)&&!Oe.has(N(u))),De=false,Ye=chunkDCILO4XD_cjs.Il(e,xe,t);for(let[g,u]of Ye){if(I.has(g))continue;let E=F.get(u[0]);E!==void 0&&(I.set(g,E),B(g,E),De=true);}De&&(J(a),de(),we());let Ae=[],_e=[],le=new Set,pe=new Set(V);for(let g of pe){let u=chunkDCILO4XD_cjs.fb(e,g);for(;u;){if(Ye.has(u.id)){pe.delete(g);break}u=chunkDCILO4XD_cjs.fb(e,u.id);}}for(let g of m){let u=f.get(g);if(!u){_e.push({key:g,reason:"unknown-revision"});continue}let E={key:g,author:u.author,partName:e.name,revisionKind:u.revisionKind,...u.formattingKind?{formattingKind:u.formattingKind}:{}},L=chunkDCILO4XD_cjs.ll(u),Q,fe;for(let ge of L){let je=F.get(ge);if(Q=je===void 0?"incomplete-group":Oe.get(N(je)),fe=je===void 0?void 0:b.get(N(je)),Q)break}if(L.length||(Q="unsupported-revision",fe="no-sites"),Q)_e.push({key:g,reason:Q,revision:E,...fe?{detail:fe}:{}});else {L.some(ge=>pe.has(ge))?_e.push({key:g,reason:"retained-structure",revision:E,detail:"nested-table"}):Ae.push(E);for(let ge of L)pe.has(ge)||le.add(ge);}}let qe=Md(e,y,le),mt=new Set;for(let g of s){let u=chunkDCILO4XD_cjs.ll(g);if(g.formattingKind!=="tblGridChange"&&u.length>1)for(let E of u)qe.has(E)&&mt.add(E);}let R=[...le].filter(g=>!P.implicit.has(g)&&!mt.has(g));for(let[g,u]of ae)Oe.has(N(u))&&(K.delete(g),ae.delete(g));let G=o?.explicit?s.filter(g=>{if(m.has(chunkDCILO4XD_cjs.ml(g)))return false;let u=chunkDCILO4XD_cjs.ll(g);return u.length>0&&u.every(Pe)}):[],W=g=>{for(let u=chunkDCILO4XD_cjs.fb(e,g);u;u=chunkDCILO4XD_cjs.fb(e,u.id))if(q.has(u.id))return true;return Pe(g)},re=g=>{let u=F.get(g);return u!==void 0&&Uu.has(y[u].node.localName)},Y=o?.explicit?s.filter(g=>{if(m.has(chunkDCILO4XD_cjs.ml(g)))return false;let u=chunkDCILO4XD_cjs.ll(g),E=u.filter(L=>!W(L));return E.length<u.length&&E.length>0&&E.every(re)&&!u.some(L=>k.has(L))}):[];for(let g of G)Ae.push({key:chunkDCILO4XD_cjs.ml(g),author:g.author,partName:e.name,revisionKind:g.revisionKind,...g.formattingKind?{formattingKind:g.formattingKind}:{}});let se=s.length-Ae.length;if(se>0&&R.length&&o?.countRemaining!==false){let g={...e,root:{...e.root}},u=chunkDCILO4XD_cjs.Rl(g,t,void 0,{siteNodeIds:R,...r?{scopeRootId:r.id}:{}});if(u.ok&&u.part){let E=r?chunkDCILO4XD_cjs.eb(u.part,r.id):u.part.root;se=E&&E.kind!=="textValue"?chunkDCILO4XD_cjs.cm({...u.part,root:E}).length:0;}}return {...G.length?{swept:G.map(chunkDCILO4XD_cjs.ml)}:{},...Y.length?{partial:Y.map(chunkDCILO4XD_cjs.ml)}:{},ops:le.size?[...d,{op:t==="accept"?"acceptAllRevisions":"rejectAllRevisions",siteNodeIds:R,...r?{scopeRootId:r.id}:{}}]:d,result:{resolved:Ae,skipped:_e,remaining:se}}}var Pt=Object.freeze({styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"});function $a(e,t,n,r){let o=(e.relationships.get(t)??[]).find(a=>a.type===n);if(o){let a=chunkDCILO4XD_cjs.N(o);if(a.mode==="Internal"&&a.target.ok){let i=e.parts.get(a.target.partName);if(i)return i}}return e.parts.get(r)}function Zb(e){let t=chunkDCILO4XD_cjs.lg(e);if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let n=_a(t.package),r=n.parts.get(n.mainDocumentPart);if(!r)return {ok:false,reason:"no-main-document-tree",detail:n.mainDocumentPart};let o=new Nn(n,La(n,chunkDCILO4XD_cjs.Eb(r)));return {ok:true,view:Lu(o)}}function Lu(e){let t=()=>e.currentPackage(),n=()=>e.bodyStore().part,r=(c,d)=>$a(t(),t().mainDocumentPart,c,d)?.root??null,o=Object.freeze(chunkDCILO4XD_cjs.oe(null)),a=null,i=chunkDCILO4XD_cjs.$j,s=null;return Object.freeze({part:n,currentPackage:t,packageRevision:()=>e.packageRevision,stylesRoot:()=>r(Pt.styles,"/word/styles.xml"),numberingRoot:()=>r(Pt.numbering,"/word/numbering.xml"),settingsRoot:()=>r(Pt.settings,"/word/settings.xml"),documentThemeFonts(){let c=t();return a!==c&&(o=Object.freeze(chunkDCILO4XD_cjs.oe(r(Pt.theme,"/word/theme/theme1.xml"),r(Pt.settings,"/word/settings.xml"),r(Pt.fontTable,"/word/fontTable.xml"))),a=c),o},documentProperties(){let c=t();if(s!==c){let d=$a(c,"/",Pt.coreProperties,"/docProps/core.xml"),m=$a(c,"/",Pt.extendedProperties,"/docProps/app.xml");i=chunkDCILO4XD_cjs.ak(d?.root??null,m?.root??null),s=c;}return i},headerFooterPartsBySection:()=>chunkDCILO4XD_cjs.tf(t()),headerFooterResolutionBySection:()=>chunkDCILO4XD_cjs.sf(t()),relationshipTarget:c=>chunkDCILO4XD_cjs.fj(t(),n().name,c)})}var $u=new Set(["unsupported-effect","renderer-required","unverified-3d","saved-fallback","inspection-limit","projection-diagnostic"]);function Ud(e,t){return e==="placeholder"?"unrendered":e==="fallback"||t.some(n=>$u.has(n.code)&&!n.detail.startsWith("wrap-polygon"))?"partial":"native"}var Bu=new Set(["alphaModFix","biLevel","grayscl","lum","extLst"]),Hu=new Set(["glow","innerShdw","reflection","softEdge"]),Vu=new Set(["blur","fillOverlay","prstShdw"]),Fd="http://schemas.openxmlformats.org/markup-compatibility/2006",ju="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function et(e,t,n){return Object.freeze({code:t,nodeId:e.id,namespaceUri:e.namespaceUri,localName:e.localName,detail:n})}function tn(e,t){let n=[{node:e,fallback:false}],r=0;for(;n.length&&++r<=4096;){let o=n.pop();if(o.node.id===t)return {...o,complete:true};for(let a of o.node.children)a.kind!=="textValue"&&n.push({node:a,fallback:o.fallback||a.namespaceUri===Fd&&a.localName==="Fallback"});}return {node:e,fallback:false,complete:n.length===0}}function Ld(e,t){let n=tn(e,t),r=[];n.complete||r.push(et(e,"inspection-limit","drawing-selection-budget")),n.fallback&&r.push(et(e,"saved-fallback","mc:Fallback"));let o=[{node:n.node,parent:"",depth:0}],a=0;for(;o.length;){let{node:i,parent:s,depth:l}=o.pop();if(++a>4096||l>64){r.push(et(i,"inspection-limit","drawing-source-budget"));break}if(!(i.namespaceUri===ju&&i.localName==="txbxContent")&&!(i.namespaceUri===Fd&&i.localName==="AlternateContent")){i.namespaceUri===chunkDCILO4XD_cjs.va?i.localName==="effectDag"||s==="blip"&&!Bu.has(i.localName)||s==="effectLst"&&Vu.has(i.localName)?r.push(et(i,"unsupported-effect",`a:${i.localName}`)):s==="effectLst"&&Hu.has(i.localName)&&!chunkDCILO4XD_cjs.be().effects?r.push(et(i,"renderer-required",`a:${i.localName}`)):(i.localName==="scene3d"||i.localName==="sp3d")&&r.push(et(i,"unverified-3d",`a:${i.localName}`)):i.namespaceUri==="http://schemas.microsoft.com/office/drawing/2010/main"&&i.localName==="imgProps"&&r.push(et(i,"unsupported-effect","a14:imgProps"));for(let c=i.children.length-1;c>=0;c--){let d=i.children[c];d.kind!=="textValue"&&o.push({node:d,parent:i.namespaceUri===chunkDCILO4XD_cjs.va?i.localName:"",depth:l+1});}}}return Object.freeze(r)}var Gu=new Map([["http://schemas.openxmlformats.org/drawingml/2006/picture","picture"],["http://schemas.openxmlformats.org/drawingml/2006/chart","chart"],["http://schemas.microsoft.com/office/drawing/2014/chartex","chart"],["http://schemas.openxmlformats.org/drawingml/2006/diagram","diagram"],["http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","group"],["http://schemas.microsoft.com/office/word/2010/wordprocessingShape","textbox"],["http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","canvas"]]),zu="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Wu="urn:schemas-microsoft-com:vml";function Ku(e){return Gu.get(e)}function Ba(e){let t=[e],n=0,r=false;for(;t.length&&++n<=4096;){let o=t.pop();if(o.namespaceUri===chunkDCILO4XD_cjs.va&&o.localName==="graphicData"){let a=chunkDCILO4XD_cjs.oa(o.attributes,"uri");return a&&Ku(a)||"graphic"}if(!(o.namespaceUri===zu&&o.localName==="txbxContent")){r||=o.namespaceUri===Wu;for(let a=o.children.length-1;a>=0;a--){let i=o.children[a];i.kind!=="textValue"&&t.push(i);}}}return r?"shape":"graphic"}function sR(e,t){return Ba(tn(e,t).node)}var Tn="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Xu="http://schemas.openxmlformats.org/markup-compatibility/2006",Yu=new Set(["document","hdr","ftr","footnotes","endnotes"]),$d=new Set(["drawing","pict","object"]);function qu(e,t){return e?e.hidden||e.footprintOnly?"hidden":e.chartSummary?.shownAs==="fallback"||t?"fallback":e.picture||e.vectorShape||e.groupPicture||e.textboxStory||e.textArt||e.legacyGraphic||e.horizontalRule||e.groupTextboxes?.length?"projected":"placeholder":"unplaced"}function Ju(e){let t=chunkDCILO4XD_cjs.te(e),n=[],r=true,o=0;for(let a of e.parts.values()){if(a.root.namespaceUri!==Tn||!Yu.has(a.root.localName))continue;let i=new Map(chunkDCILO4XD_cjs.Ye(a,{stylesPart:chunkDCILO4XD_cjs.ud(e),resolveRelationship:chunkDCILO4XD_cjs.Se(e,a.name),resolveSchemeColor:t.resolveSchemeColor,resolveStyleMatrixReference:t.resolveStyleMatrixReference,resolveDiagramParts:chunkDCILO4XD_cjs.Ke(e,a.name)}).map(c=>[`${a.name}\0${c.drawingNodeId}`,c])),s=[{node:a.root,depth:0}],l=new Map;for(;s.length;){let{node:c,depth:d}=s.pop();if(++o>1e6||d>128){r=false;break}let m=c.namespaceUri===Tn&&$d.has(c.localName),f=c.namespaceUri===Xu&&c.localName==="AlternateContent";if(m||f){let h=i.get(`${a.name}\0${c.id}`),y=m,P=[c],T=0;for(;P.length;){let M=P.pop();if(++T>4096||++o>1e6){r=false;break}if(!(M.namespaceUri===Tn&&M.localName==="txbxContent")){y||=M.namespaceUri===Tn&&$d.has(M.localName),h??=i.get(`${a.name}\0${M.id}`);for(let p of M.children)p.kind!=="textValue"&&P.push(p);}}if(y&&l.set(c,h),h){let p=[tn(c,h.drawingNodeId).node],x=0;for(;p.length&&++x<=4096&&++o<=1e6;){let k=p.pop();if(k.namespaceUri===Tn&&k.localName==="txbxContent"){s.push({node:k,depth:d+1});continue}for(let v of k.children)v.kind!=="textValue"&&p.push(v);}p.length&&(r=false);}continue}for(let h=c.children.length-1;h>=0;h--){let y=c.children[h];y.kind!=="textValue"&&s.push({node:y,depth:d+1});}}for(let[c,d]of l){let m=tn(c,d?.drawingNodeId??c.id),f=[...Ld(c,d?.drawingNodeId??c.id)];d||f.push(et(c,"unplaced-drawing","no-layout-projection"));let h=qu(d,m.fallback);for(let y of d?.diagnostics??[])y.code==="unsupported-graphic"&&h!=="placeholder"||f.push(Object.freeze({...et(m.node,"projection-diagnostic",y.code),nodeId:y.nodeId}));f.some(y=>y.code==="inspection-limit")&&(r=false),n.push(Object.freeze({ownerPartName:a.name,nodeId:c.id,drawingNodeId:d?.drawingNodeId??null,state:h,support:Ud(h==="placeholder"||h==="unplaced"?"placeholder":h==="fallback"?"fallback":"rendered",f),graphicKind:Ba(m.node),source:c,issues:Object.freeze(f)}));}if(!r&&o>1e6)break}return Object.freeze({entries:Object.freeze(n),complete:r,coverage:"explicit-source-effects"})}var Dt="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Qu="urn:schemas-microsoft-com:office:office",Hr="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Zu="http://schemas.openxmlformats.org/package/2006/relationships",ef="http://schemas.openxmlformats.org/package/2006/content-types",tf="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",Ha="application/vnd.openxmlformats-package.relationships+xml",nf=new Set(["drawing","pict","object"]),rf=new Set(["oleObject","package","control","vbaProject","attachedTemplate","externalLinkPath","subDocument","frame"].map(e=>`${Hr}/${e}`)),of=["styles","theme","settings","fontTable"].map(e=>`${Hr}/${e}`),af=`${Hr}/diagramData`,sf=4,lf='<w:pPr><w:spacing w:before="0" w:after="0" w:line="240" w:lineRule="auto"/><w:ind w:left="0" w:right="0" w:firstLine="0"/><w:jc w:val="left"/></w:pPr>',Ga=1e5;function cf(e,t){let n=chunkDCILO4XD_cjs.eb(e,t);if(!n||n.kind==="textValue")return null;let r=null,o=n;for(let a=0;o&&a<64&&(o.namespaceUri===Dt&&nf.has(o.localName)&&(r=o),o.namespaceUri===chunkDCILO4XD_cjs.sa&&o.localName==="AlternateContent"&&(r=o),!(o.namespaceUri===Dt&&(o.localName==="r"||o.localName==="p")));a++)o=chunkDCILO4XD_cjs.fb(e,o.id);return r}function Bd(e,t,n){let r=[e],o=0;for(;r.length&&++o<=Ga;){let a=r.pop();for(let{namespaceUri:i,localName:s,value:l}of a.attributes)((n?s===n:i===chunkDCILO4XD_cjs.ya)||!n&&i===Qu&&s==="relid")&&t.add(l);for(let i of a.children)i.kind!=="textValue"&&r.push(i);}}function df(e,t){let n=chunkDCILO4XD_cjs.Fa(t),{rootBindings:r,declarations:o}=chunkDCILO4XD_cjs.Ia(n),a=[];chunkDCILO4XD_cjs.Ga(e,n,r,false,o,a);let i=new TextDecoder;return a.map(s=>typeof s=="string"?s:i.decode(s)).join("")}var mf=new Set(["extent","effectExtent","docPr","cNvGraphicFramePr"]),pf=635,jd="urn:schemas-microsoft-com:vml";function Gd(e,t=0,n=false){if(t>32||e.namespaceUri===Dt&&e.localName==="txbxContent")return e;if(n&&e.namespaceUri===jd){let a=e.attributes.map(i=>i.namespaceUri===""&&i.localName==="style"?{...i,value:gf(i.value)}:i);return {...e,attributes:a}}if(e.namespaceUri===chunkDCILO4XD_cjs.wa&&e.localName==="anchor")return {id:e.id,kind:"generic",namespaceUri:chunkDCILO4XD_cjs.wa,localName:"inline",namespaceBindings:e.namespaceBindings,attributes:e.attributes.filter(a=>a.namespaceUri===""&&/^dist[TBLR]$/.test(a.localName)),children:e.children.filter(a=>a.kind!=="textValue"&&(a.namespaceUri===chunkDCILO4XD_cjs.wa&&mf.has(a.localName)||a.namespaceUri===chunkDCILO4XD_cjs.va&&a.localName==="graphic"))};let r=false,o=e.children.map(a=>{if(a.kind==="textValue")return a;let i=e.namespaceUri===Dt&&(e.localName==="pict"||e.localName==="object"),s=Gd(a,t+1,i);return r||=s!==a,s});return r?{...e,children:o}:e}var uf=/^(position|left|top|margin-(left|top|right|bottom)|z-index|mso-position-.*)$/,ff={pt:1,in:72,cm:72/2.54,mm:72/25.4,pc:12,px:.75,"":.75};function gf(e){return e.split(";").filter(t=>!uf.test(t.split(":")[0].trim().toLowerCase())).join(";")}function Hd(e,t){for(let n of e.split(";")){let[r,o]=n.split(":");if(r?.trim().toLowerCase()!==t||o===void 0)continue;let a=/^\s*([0-9]+(?:\.[0-9]+)?)\s*(pt|in|cm|mm|pc|px|)\s*$/i.exec(o);return a?Number(a[1])*ff[a[2].toLowerCase()]*20:null}return null}function hf(e){let t=[{node:e,inWrapper:false}],n=0;for(;t.length&&++n<=Ga;){let{node:r,inWrapper:o}=t.shift();if(o&&r.namespaceUri===jd&&r.localName!=="shapetype"){let i=r.attributes.find(c=>c.namespaceUri===""&&c.localName==="style")?.value,s=i?Hd(i,"width"):null,l=i?Hd(i,"height"):null;if(s!==null&&l!==null&&(s>0||l>0)){let c=Number(/(?:^|;)\s*rotation\s*:\s*(-?[0-9.]+)/i.exec(i)?.[1]??0),d=(Number.isFinite(c)?c:0)*Math.PI/180,m=Math.abs(Math.cos(d)),f=Math.abs(Math.sin(d)),h=y=>Math.min(31680,Math.max(1,Math.ceil(y)));return {width:h(s*m+l*f),height:h(s*f+l*m)}}}let a=r.namespaceUri===Dt&&(r.localName==="pict"||r.localName==="object");for(let i of r.children)i.kind!=="textValue"&&t.push({node:i,inWrapper:a});}return null}function yf(e){let t=[e],n=0;for(;t.length&&++n<=Ga;){let r=t.pop();if(r.namespaceUri===chunkDCILO4XD_cjs.wa&&(r.localName==="anchor"||r.localName==="inline")){let o=(l,c)=>{let d=r.children.find(h=>h.kind!=="textValue"&&h.namespaceUri===chunkDCILO4XD_cjs.wa&&h.localName===l),m=d&&d.kind!=="textValue"?d.attributes.find(h=>h.localName===c)?.value:void 0,f=m===void 0?0:Number(m);return Number.isFinite(f)?f:0},a=o("extent","cx")+o("effectExtent","l")+o("effectExtent","r"),i=o("extent","cy")+o("effectExtent","t")+o("effectExtent","b");if(a<=0&&i<=0)return null;let s=l=>Math.min(31680,Math.max(1,Math.ceil(l/pf)));return {width:s(a),height:s(i)}}for(let o of r.children)o.kind!=="textValue"&&t.push(o);}return null}function xf(e){return `<w:sectPr><w:pgSz w:w="${e.width}" w:h="${Math.min(31680,e.height+120)}"/><w:pgMar w:top="0" w:right="0" w:bottom="0" w:left="0" w:header="0" w:footer="0" w:gutter="0"/></w:sectPr>`}function Va(e,t){let n;for(let r of e?.children??[])r.kind!=="textValue"&&r.namespaceUri===Dt&&r.localName===t&&(n=r);return n}function kf(e){let t=Va(e.parts.get(e.mainDocumentPart)?.root,"body"),n=Va(t,"sectPr"),r=(o,a)=>{let i=Va(n,"pgSz")?.attributes.find(l=>l.localName===o)?.value,s=i===void 0?NaN:Number(i);return Number.isInteger(s)&&s>0&&s<=31680?s:a};return `<w:sectPr><w:pgSz w:w="${r("w",12240)}" w:h="${r("h",15840)}"/><w:pgMar w:top="0" w:right="0" w:bottom="0" w:left="0" w:header="0" w:footer="0" w:gutter="0"/></w:sectPr>`}function ja(e){let t=e.map(({id:n,type:r,target:o})=>`<Relationship Id="${chunkDCILO4XD_cjs.V(n)}" Type="${chunkDCILO4XD_cjs.V(r)}" Target="${chunkDCILO4XD_cjs.V(o)}"/>`).join("");return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Zu}">${t}</Relationships>`}function Vd(e){return e.startsWith("/word/")?e.slice(6):e}function Pf(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function Of(e,t,n={}){let r=n.maxParts??64,o=n.maxBytes??64*1024*1024,a=e.parts.get(t.ownerPartName),i=a?cf(a,t.nodeId):null;if(!a||!i)return {ok:false,reason:"drawing-not-found"};let s=new Map,l=new Map,c=[],d=0,m=new TextEncoder,f=null,h=S=>{if(S.targetMode==="External"||rf.has(S.type))return null;let I=chunkDCILO4XD_cjs.N(S);if(I.mode!=="Internal"||!I.target.ok)return null;let _=I.target.partName;return e.parts.has(_)||e.partBytes.has(_)?_:null},y=(S,I,_)=>s.has(S)?true:(s.size>=r?f="too-many-parts":d+I.byteLength>o&&(f="too-large"),f?false:(s.set(S,I),d+=I.byteLength,_&&l.set(S,_),true)),P=(S,I)=>{if(f||s.has(S)||S==="/word/document.xml")return;let _=e.parts.get(S),q=_?m.encode(chunkDCILO4XD_cjs.Ha(_)):e.partBytes.get(S);if(!q)return;let ee=chunkDCILO4XD_cjs.K(e.contentTypes,S);if(!y(S,q,ee.ok?ee.contentType:null)||(c.push(S),!_||I>=sf))return;let K=[];for(let ae of e.relationships.get(S)??[]){let B=h(ae);B&&(K.push({id:ae.id,type:ae.type,target:ae.rawTarget}),P(B,I+1));}K.length&&y(Pf(S),m.encode(ja(K)),Ha);},T=new Set;Bd(i,T);let M=e.relationships.get(a.name)??[],p=[],x=S=>{let I=h(S);if(!I||p.some(q=>q.id===S.id))return;p.push({id:S.id,type:S.type,target:Vd(I)}),P(I,1);let _=e.parts.get(I);if(S.type===af&&_){let q=new Set;Bd(_.root,q,"relId");for(let ee of M)q.has(ee.id)&&x(ee);}};for(let S of M)T.has(S.id)&&x(S);let k=0;for(let S of e.relationships.get(e.mainDocumentPart)??[]){if(!of.includes(S.type))continue;let I=h(S);I&&(p.push({id:`rIdPreviewContext${++k}`,type:S.type,target:Vd(I)}),P(I,1));}if(f)return {ok:false,reason:f};let v=yf(i)??hf(i),A=`xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:mc="${chunkDCILO4XD_cjs.sa}" mc:Ignorable="w14 wp14 w15"`,O=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${Dt}" ${A}><w:body><w:p>${lf}<w:r>${df(Gd(i),a.root)}</w:r></w:p>${v?xf(v):kf(e)}</w:body></w:document>`;if(!y("/word/document.xml",m.encode(O),tf)||!y("/word/_rels/document.xml.rels",m.encode(ja(p)),Ha))return {ok:false,reason:f??"too-large"};let D=ja([{id:"rId1",type:`${Hr}/officeDocument`,target:"word/document.xml"}]),F=[...l].map(([S,I])=>`<Override PartName="${chunkDCILO4XD_cjs.V(S)}" ContentType="${chunkDCILO4XD_cjs.V(I)}"/>`).join(""),w=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${ef}"><Default Extension="rels" ContentType="${Ha}"/><Default Extension="xml" ContentType="application/xml"/>${F}</Types>`,N=new Map([["/[Content_Types].xml",m.encode(w)],["/_rels/.rels",m.encode(D)]]);for(let[S,I]of s)N.set(S,I);return {ok:true,docx:chunkDCILO4XD_cjs.af(N),pageFitsDrawing:v!==null,copiedParts:Object.freeze(c)}}
3
+ `,e.multiLine?chunk2JVOX642_cjs.xj:"")};case "comboBox":{let r=e.listItems.find(o=>o.value===n);return r?{kind:"listItem",value:r.value}:{kind:"text",text:n}}case "dropDownList":return n===""?{kind:"text",text:n}:{kind:"listItem",value:n};case "checkbox":return n.trim()===""?null:{kind:"text",text:n};case "date":{if(n.trim()==="")return {kind:"text",text:""};let r=/^\s*(\d{4}-\d{2}-\d{2})(?:[T\s]|$)/.exec(n);return r?{kind:"date",iso:r[1]}:null}default:return null}}function Ou(e,t){if(t.length>En)return null;let n=Pu(e,t);if(!n)return null;if(n.kind==="text"&&n.text==="")return e.placeholderDocPart!==void 0?{text:chunk2JVOX642_cjs.nm(e.type),showingPlaceholder:true}:{text:"",showingPlaceholder:false};if(e.type==="checkbox"){let o=bu(n.kind==="text"?n.text:"");if(o===null)return null;let a=chunk2JVOX642_cjs.vm(e,{kind:"checkbox",checked:o});return typeof a=="string"?null:a}let r=chunk2JVOX642_cjs.vm(e,n);return typeof r=="string"?null:r}function bu(e){let t=e.trim().toLowerCase();return t==="true"||t==="1"?true:t==="false"||t==="0"?false:null}function Ru(e,t,n){return n.showingPlaceholder?t.showingPlaceholder:t.showingPlaceholder?false:n.fullDate!==void 0?t.date?.fullDate?.slice(0,10)===n.fullDate.slice(0,10):n.checked!==void 0&&t.checkbox?.checked!==n.checked||n.lastValue!==void 0&&t.lastValue!==void 0&&t.lastValue!==n.lastValue?false:chunk2JVOX642_cjs.uc(e,chunk2JVOX642_cjs.xj)===n.text}function Iu(e,t,n,r,o){let a=e,i=chunk2JVOX642_cjs.qc(n),s=Ou(i,r);if(!s||Ru(n,i,s))return a;let l=chunk2JVOX642_cjs.Ih(n),c=chunk2JVOX642_cjs.al(t,n.id),d=s.showingPlaceholder?[]:s.symbol?chunk2JVOX642_cjs.bl(l,s.symbol,s.text,o,c):chunk2JVOX642_cjs.xm(l,s.text,o,c);if(!d||!l)return a;let m=chunk2JVOX642_cjs.Hh(n),f=chunk2JVOX642_cjs.wm(m,{showingPlaceholder:s.showingPlaceholder,...s.lastValue===void 0?{}:{lastValue:s.lastValue},...s.fullDate===void 0?{}:{fullDate:s.fullDate},...s.checked===void 0?{}:{checked:s.checked}},o),h={...n,children:n.children.map(P=>P.id===l.id?{...l,children:d}:P.id===m?.id?f:P)},y=chunk2JVOX642_cjs.kb(a,n.id,h);return y.ok?y.part:a}function Nu(e,t,n=wd(e.root)){if(t.size===0||n.length===0)return e;let r=e,o=null;for(let a of n){let i=chunk2JVOX642_cjs.qc(a).dataBinding,s=vd(t,i);s!==null&&(o??=chunk2JVOX642_cjs.cb(e,"paste"),r=Iu(r,e,a,s,o));}return r}function _a(e){let t=[e.mainDocumentPart];for(let a of e.relationships.get(e.mainDocumentPart)??[]){if(!ku.has(a.type)||a.targetMode==="External")continue;let i=chunk2JVOX642_cjs.E(e.mainDocumentPart,a.rawTarget);i.ok&&!t.includes(i.partName)&&t.push(i.partName);}let n=[];for(let a of t){let i=e.parts.get(a),s=i?wd(i.root):[];i&&s.length>0&&n.push({part:i,controls:s});}if(n.length===0)return e;let r=Sd(e);if(r.size===0)return e;let o=e;for(let{part:a,controls:i}of n){let s=Nu(a,r,i);s!==a&&(o=chunk2JVOX642_cjs.rg(o,s));}return o}var Su=256,vu=2e3,Ed=/[\p{L}\p{N}_]/u;function Ua(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],a=o.toLowerCase();n+=a.length===1?a:o;}return n}function Td(e,t,n){let r=t>0?e[t-1]:void 0,o=n<e.length?e[n]:void 0;return !(r!==void 0&&Ed.test(r)||o!==void 0&&Ed.test(o))}function Cd(e){return typeof e=="string"&&e.length>0&&e.length<=256}function wu(e,t,n,r={}){let o={matches:[],truncated:false};if(!Cd(t)||e.length===0||n<=0)return o;let a=r.matchCase===true,i=r.wholeWord===true,s=a?t:Ua(t),l=a?e:Ua(e),c=Math.max(0,r.from??0),d=Math.min(e.length,r.to??e.length),m=[],f=l.indexOf(s,c);for(;f>=0;){let h=f+s.length;if(h>d)return {matches:m,truncated:false};if(!i||Td(e,f,h)){if(m.length>=n)return {matches:m,truncated:true};m.push({start:f,length:s.length});}f=l.indexOf(s,h);}return {matches:m,truncated:false}}var Eu=new Set(["plainText","richText","date","dropDownList","comboBox","docPartList"]),Tu=96;function Fa(e,t){return e.kind!=="textValue"&&e.namespaceUri===chunk2JVOX642_cjs.pa&&e.localName===t}function Cu(e){return e.kind==="textValue"&&e.value.trim()===""}function Mu(e){let t=[],n=(r,o,a)=>{if(r.kind==="textValue"||a>Tu)return;if(chunk2JVOX642_cjs.Gh(r)){let s=chunk2JVOX642_cjs.Ih(r),l=chunk2JVOX642_cjs.qc(r);if(s&&l&&s.children.every(Cu)&&Eu.has(l.type)){t.push({control:r,content:s,kind:l.type,docPart:l.placeholderDocPart,inline:o});return}}let i=o||r.kind==="paragraph"||Fa(r,"p");for(let s of r.children)n(s,i,a+1);};return n(e,false,0),t}function Du(e){return chunk2JVOX642_cjs.tm(e,"rPr",{kind:"runProperties",children:[chunk2JVOX642_cjs.tm(e,"rStyle",{attributes:[["val","PlaceholderText"]]})]})}function Au(e){let t=e.find(r=>r.kind==="paragraph"||Fa(r,"p"));if(!t||t.kind==="textValue")return null;let n=t.children.filter(r=>r.kind!=="paragraphProperties"&&!Fa(r,"pPr"));return n.length>0?n:null}function La(e,t){let n=Mu(t.root);if(n.length===0)return t;let r=null,o=c=>{if(c!==void 0)return r??=chunk2JVOX642_cjs.$i(e),r.find(d=>d.name===c)},a=chunk2JVOX642_cjs.cb(t,"paste"),i=new Set(chunk2JVOX642_cjs.zb(t.root)),s={value:0},l=t;for(let[c,d]of n.entries()){let m=o(d.docPart),f=chunk2JVOX642_cjs.Bb(t,d.control),h=null;if(m){let p=m.blocks.map((x,k)=>chunk2JVOX642_cjs.Db(chunk2JVOX642_cjs.Ph(x,a),i,chunk2JVOX642_cjs.Jb(`${d.control.id}:placeholder:${c}:${k}`),s,f));h=d.inline?Au(p):p;}if(!h){let p=chunk2JVOX642_cjs.um(a,chunk2JVOX642_cjs.nm(d.kind),Du(a));h=d.inline?[p]:[chunk2JVOX642_cjs.Db(chunk2JVOX642_cjs.tm(a,"p",{kind:"paragraph",children:[p]}),i,chunk2JVOX642_cjs.Jb(`${d.control.id}:placeholder:${c}`),s,f)];}let y=chunk2JVOX642_cjs.wm(chunk2JVOX642_cjs.Hh(d.control),{showingPlaceholder:true},a),P={...d.content,children:h},T=d.control.children.map(p=>p.id===d.content.id?P:p.kind!=="textValue"&&p.localName==="sdtPr"?y:p),M=chunk2JVOX642_cjs.ib(l,d.control.id,T);M.ok&&(l=M.part);}return l}function Md(e,t,n){let r=t.filter(i=>i.node.localName==="tblGridChange"&&n.has(i.node.id));if(!r.length)return new Set;let o=new Map;for(let i of t){if(!["trPrChange","tcPrChange","tblPrExChange"].includes(i.node.localName))continue;let s=i.parent;for(;s&&s.kind!=="table";)s=chunk2JVOX642_cjs.fb(e,s.id);if(!s)continue;let l=o.get(s.id)??[];l.push(i.node.id),o.set(s.id,l);}let a=new Set;for(let i of r){let s=i.parent&&chunk2JVOX642_cjs.fb(e,i.parent.id),l=s&&o.get(s.id);l?.some(c=>n.has(c))&&l.some(c=>!n.has(c))&&a.add(i.node.id);}return a}function Dd(e){if(e.kind==="textValue")return;let t=r=>e.attributes.find(o=>o.namespaceUri===chunk2JVOX642_cjs.pa&&o.localName===r)?.value,n=t("author");return n===void 0?void 0:`${n}\0${t("date")??""}`}function _u(e){let t=[],n=r=>{if(r.kind!=="textValue"){if(r.kind==="paragraph"){let o=[],a=[],i=s=>{if(s.kind!=="textValue"){if(s.localName==="txbxContent")return n(s);a.push(s);for(let l of s.children)i(l);}};for(let s of r.children){if(s.localName!=="pPr"){i(s);continue}for(let l of s.children)if(l.kind!=="textValue"&&l.localName==="rPr")for(let c of l.children)c.kind!=="textValue"&&c.localName==="moveTo"&&o.push(c);}t.push({marks:o,inline:a});return}for(let o of r.children)n(o);}};return n(e),t}function Ad(e,t){let n=[];if(t.size===0)return n;for(let r of _u(e))for(let o of r.marks){if(!t.has(o.id))continue;let a=Dd(o),i=r.inline.filter(s=>t.has(s.id)&&Dd(s)===a);i.length>0&&n.push([o.id,...i.map(s=>s.id)]);}return n}var Uu=new Set(["tblPrChange","tblGridChange","tblPrExChange","trPrChange","tcPrChange"]);function Fu(e,t,n,r,o){let a=_d(e,t,n,r,o);for(let l=0;n&&l<3&&a.partial?.length&&a.result.skipped.some(c=>c.reason==="incomplete-group");l++)n=[...new Set([...n,...a.partial])],a=_d(e,t,n,r,o);let{partial:i,...s}=a;return s}function _d(e,t,n,r,o){let a=r??e.root,i=a.kind==="textValue"?e:{...e,root:a},s=chunk2JVOX642_cjs.cm(i),l=n===void 0?chunk2JVOX642_cjs.Ol(i):[],c=[...chunk2JVOX642_cjs.fl(i,l),...l.filter(g=>g.node.localName==="numberingChange").map(g=>g.node.id)],d=c.length?[{op:"acceptAllRevisions",siteNodeIds:c,...r?{scopeRootId:r.id}:{}}]:[];if(n?.length===0||s.length===0)return {ops:d,result:{resolved:[],skipped:[...new Set(n??[])].map(g=>({key:g,reason:"unknown-revision"})),remaining:s.length}};let m=new Set(n??s.map(chunk2JVOX642_cjs.ml)),f=new Map(s.map(g=>[chunk2JVOX642_cjs.ml(g),g])),h=new Set;for(let g of m){let u=f.get(g);if(u)for(let E of chunk2JVOX642_cjs.ll(u))h.add(E);}let y=chunk2JVOX642_cjs.Ol(i),P=chunk2JVOX642_cjs.il(a,y,h,t);for(let g of P.selected)h.add(g);let T=[...chunk2JVOX642_cjs.yl(a).values()],M=chunk2JVOX642_cjs.Ql(a,y),p=g=>{let u=chunk2JVOX642_cjs.eb(i,g);return u&&u.kind!=="textValue"?chunk2JVOX642_cjs.Hl(u,"author"):void 0},x=chunk2JVOX642_cjs.gl(i,y),k=new Set(s.map(chunk2JVOX642_cjs.ll).filter(g=>g.some(u=>x.has(u))).flat()),v=new Set(h),A=new Set([...v].map(p)),O=chunk2JVOX642_cjs.Ll(i,y,t).filter(g=>{let u=g.slice(0,-1),E=p(g.at(-1));return !u.every(L=>p(L)===E)&&!u.some(L=>v.has(L))?false:o?.explicit?k.has(g.at(-1))&&!u.some(L=>v.has(L))?false:g.some(L=>v.has(L))||u.every(L=>A.has(p(L))):true}),D=[...y.some(g=>g.node.localName==="cellMerge")?chunk2JVOX642_cjs.Ml(i,t):[],...Ad(a,M),...O,...chunk2JVOX642_cjs.hl(i,y)];if(o?.explicit){let g=[...T.map(u=>u.wrappers.map(E=>E.id)),...D,...D.length?s.map(chunk2JVOX642_cjs.ll).filter(u=>!u.some(E=>k.has(E))):[]];for(let u=true,E=0;u&&E<=g.length;E++){u=false;for(let L of g)if(L.some(Q=>h.has(Q)))for(let Q of L)h.has(Q)||(u=!!h.add(Q));}}for(let g of s){let u=chunk2JVOX642_cjs.ll(g);u.length&&u.every(E=>h.has(E))&&m.add(chunk2JVOX642_cjs.ml(g));}let F=new Map(y.map((g,u)=>[g.node.id,u])),w=y.map((g,u)=>u),N=g=>{for(;w[g]!==g;)w[g]=w[w[g]],g=w[g];return g},S=(g,u)=>{w[N(u)]=N(g);};for(let g of P.dependencies){let u=g.flatMap(E=>F.has(E)?[F.get(E)]:[]);for(let E of u)S(u[0],E);}let I=new Map;for(let g of s){let u=chunk2JVOX642_cjs.ll(g).flatMap(E=>{let L=F.get(E);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}let _=y.filter(g=>h.has(g.node.id)),q=new Set(chunk2JVOX642_cjs.Il(e,_,t).keys()),ee=new Map,K=new Set,ae=new Map,B=(g,u)=>{K.add(g),ae.set(g,u);},V=new Set(chunk2JVOX642_cjs.Al(e,y,t)),z=g=>!g.refused&&!V.has(g.node.id);for(let[g,u]of y.entries()){if(h.has(u.node.id)&&z(u)&&!u.paragraphMark&&!M.has(u.node.id)&&(t==="accept"?u.node.kind==="revisionDelete"||u.node.kind==="revisionMoveFrom":u.node.kind==="revisionInsert"||u.node.kind==="revisionMoveTo")&&B(u.node.id,g),t==="reject"&&u.propertyChange&&u.parent&&h.has(u.node.id))for(let L of u.parent.children)chunk2JVOX642_cjs.cl(u.node.localName,L)||(I.set(L.id,g),L.id!==u.node.id&&z(u)&&B(L.id,g));let E=t==="accept"?u.node.localName==="del"||u.node.localName==="moveFrom":u.node.localName==="ins"||u.node.localName==="moveTo";if(u.paragraphMark&&u.parent&&E&&!M.has(u.node.id)&&h.has(u.node.id)){let L=chunk2JVOX642_cjs.fb(e,u.parent.id),Q=L&&chunk2JVOX642_cjs.fb(e,L.id),fe=Q&&chunk2JVOX642_cjs.fb(e,Q.id);if(L&&Q&&fe){let ge=ee.get(fe.id);ge||(ge=chunk2JVOX642_cjs.El(fe.children,q),ee.set(fe.id,ge)),ge.has(Q.id)&&(I.set(L.id,g),z(u)&&B(L.id,g));}}if(h.has(u.node.id)&&chunk2JVOX642_cjs.Jl(e,u,t)){let L=chunk2JVOX642_cjs.Jl(e,u,t);L&&!u.refused&&(I.set(L.id,g),z(u)&&B(L.id,g));}}for(let[g,u]of chunk2JVOX642_cjs.Kl(e,_,t)){let E=chunk2JVOX642_cjs.eb(e,g),L=F.get(u[0]);if(!(E?.kind!=="tableCell"||L===void 0)){for(let Q of E.children)if(Q.localName==="tcPr")for(let fe of Q.children)fe.kind==="textValue"||chunk2JVOX642_cjs.Gl.has(fe.localName)||I.set(fe.id,L);}}let ne=chunk2JVOX642_cjs.km(e),ie=g=>{for(let u=chunk2JVOX642_cjs.fb(e,y[g].node.id);u;u=chunk2JVOX642_cjs.fb(e,u.id))if(ne.has(u.id))return true;return false},Ne=new Map,Xe=g=>{let u=Ne.get(g);return u===void 0&&(u=chunk2JVOX642_cjs.lm(e,[y[g].node.id],t)!==null,Ne.set(g,u)),u},Ce=(g,u)=>ne.size>0&&["revisionInsert","revisionDelete"].includes(y[u].node.kind)&&["revisionInsert","revisionDelete"].includes(y[g].node.kind)&&ie(u)&&Xe(g)&&!Xe(u),Ve=chunk2JVOX642_cjs.Dl(i,[...F.keys(),...I.keys()]),J=(g,u)=>{if(!Ve.has(g.id))return;let E=F.get(g.id),L=I.get(g.id);E!==void 0&&L!==void 0&&S(L,E);let Q=E??L,fe=o?.explicit===true&&Q!==void 0&&(E===void 0||L===void 0||L===E)&&y[Q].node.localName==="rPrChange"||Q!==void 0&&u!==void 0&&Ce(u,Q);Q!==void 0&&u!==void 0&&!fe&&S(u,Q);let ge=Q??u;if(g.kind!=="textValue")for(let je of g.children)J(je,ge);};J(a);for(let g of T){let u=g.wrappers.flatMap(E=>{let L=F.get(E.id);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}for(let g of D){let u=g.flatMap(E=>{let L=F.get(E);return L===void 0?[]:[L]});for(let E of u)S(u[0],E);}let Me=new Map,de=()=>{Me.clear();for(let[g,u]of y.entries()){let E=N(g),L=Me.get(E)??[];L.push(u),Me.set(E,L);}};de();let At=g=>g.kind==="revisionInsert"||g.kind==="revisionDelete"||g.kind==="revisionMoveFrom"||g.kind==="revisionMoveTo",dt=g=>{if(!g||g.kind==="textValue"||!At(g))return false;let u=g.children.filter(E=>E.kind!=="textValue"&&!chunk2JVOX642_cjs.zl(E));return u.length>0&&u.every(E=>K.has(E.id))},Pe=g=>{if(!o?.explicit||!K.size)return false;for(let u=chunk2JVOX642_cjs.fb(e,g);u;u=chunk2JVOX642_cjs.fb(e,u.id))if(K.has(u.id))return true;return dt(chunk2JVOX642_cjs.eb(e,g))},tt=new Set([...T.map(g=>g.wrappers.map(u=>u.id)),...D,...P.dependencies,...s.map(chunk2JVOX642_cjs.ll)].filter(g=>g.some(u=>h.has(u)||Pe(u))).flat()),nn=g=>{if(tt.has(g.node.id)||I.has(g.node.id))return false;for(let u=chunk2JVOX642_cjs.fb(e,g.node.id);u;u=chunk2JVOX642_cjs.fb(e,u.id))if(I.has(u.id)||K.has(u.id))return false;return !dt(g.node)},Oe=new Map,b=new Map,U=chunk2JVOX642_cjs.jm(e),$=new Map,j=g=>{if(!U)return null;let u=g.map(Q=>Q.node.id),E=u.join("\0"),L=$.get(E);return L===void 0&&(L=chunk2JVOX642_cjs.lm(e,u,t),$.set(E,L)),L},X=()=>{Oe.clear(),b.clear();for(let[g,u]of Me){let E=u.some(ge=>h.has(ge.node.id)),L=u.find(ge=>ge.refused),Q=t==="reject"&&u.some(ge=>ge.propertyChange&&chunk2JVOX642_cjs.el(ge.node)===null),fe=!L&&!Q&&j(u);if(L||Q||fe)Oe.set(g,"unsupported-revision"),b.set(g,L?.refusal??(fe||"unrecorded-properties"));else {let ge=u.find(je=>!h.has(je.node.id)&&!Pe(je.node.id)&&!(o?.explicit&&k.has(je.node.id))&&!(E&&nn(je)));ge&&(Oe.set(g,"incomplete-group"),b.set(g,Z(ge)));}}},Z=g=>{if(tt.has(g.node.id))return "paired-change";for(let E=chunk2JVOX642_cjs.fb(e,g.node.id);E;E=chunk2JVOX642_cjs.fb(e,E.id)){if(K.has(E.id))return "removed-content";if(I.has(E.id))return "replaced-properties"}return dt(g.node)?"emptied-change":[...h].some(E=>{for(let L=chunk2JVOX642_cjs.fb(e,E);L;L=chunk2JVOX642_cjs.fb(e,L.id))if(L.id===g.node.id)return true;return false})?"enclosing-change":"grouped-change"},me=()=>{for(let g of s)if(g.readOnly)for(let u of chunk2JVOX642_cjs.ll(g)){let E=F.get(u);E!==void 0&&(Oe.set(N(E),"unsupported-revision"),b.has(N(E))||b.set(N(E),"read-only"));}},we=()=>{for(;;){X(),me();let g=[...ae].filter(([,u])=>Oe.get(N(u))==="unsupported-revision");if(!g.length)return;for(let[u]of g)K.delete(u),ae.delete(u);}};we();let xe=y.filter((g,u)=>h.has(g.node.id)&&!Oe.has(N(u))),De=false,Ye=chunk2JVOX642_cjs.Il(e,xe,t);for(let[g,u]of Ye){if(I.has(g))continue;let E=F.get(u[0]);E!==void 0&&(I.set(g,E),B(g,E),De=true);}De&&(J(a),de(),we());let Ae=[],_e=[],le=new Set,pe=new Set(V);for(let g of pe){let u=chunk2JVOX642_cjs.fb(e,g);for(;u;){if(Ye.has(u.id)){pe.delete(g);break}u=chunk2JVOX642_cjs.fb(e,u.id);}}for(let g of m){let u=f.get(g);if(!u){_e.push({key:g,reason:"unknown-revision"});continue}let E={key:g,author:u.author,partName:e.name,revisionKind:u.revisionKind,...u.formattingKind?{formattingKind:u.formattingKind}:{}},L=chunk2JVOX642_cjs.ll(u),Q,fe;for(let ge of L){let je=F.get(ge);if(Q=je===void 0?"incomplete-group":Oe.get(N(je)),fe=je===void 0?void 0:b.get(N(je)),Q)break}if(L.length||(Q="unsupported-revision",fe="no-sites"),Q)_e.push({key:g,reason:Q,revision:E,...fe?{detail:fe}:{}});else {L.some(ge=>pe.has(ge))?_e.push({key:g,reason:"retained-structure",revision:E,detail:"nested-table"}):Ae.push(E);for(let ge of L)pe.has(ge)||le.add(ge);}}let qe=Md(e,y,le),mt=new Set;for(let g of s){let u=chunk2JVOX642_cjs.ll(g);if(g.formattingKind!=="tblGridChange"&&u.length>1)for(let E of u)qe.has(E)&&mt.add(E);}let R=[...le].filter(g=>!P.implicit.has(g)&&!mt.has(g));for(let[g,u]of ae)Oe.has(N(u))&&(K.delete(g),ae.delete(g));let G=o?.explicit?s.filter(g=>{if(m.has(chunk2JVOX642_cjs.ml(g)))return false;let u=chunk2JVOX642_cjs.ll(g);return u.length>0&&u.every(Pe)}):[],W=g=>{for(let u=chunk2JVOX642_cjs.fb(e,g);u;u=chunk2JVOX642_cjs.fb(e,u.id))if(q.has(u.id))return true;return Pe(g)},re=g=>{let u=F.get(g);return u!==void 0&&Uu.has(y[u].node.localName)},Y=o?.explicit?s.filter(g=>{if(m.has(chunk2JVOX642_cjs.ml(g)))return false;let u=chunk2JVOX642_cjs.ll(g),E=u.filter(L=>!W(L));return E.length<u.length&&E.length>0&&E.every(re)&&!u.some(L=>k.has(L))}):[];for(let g of G)Ae.push({key:chunk2JVOX642_cjs.ml(g),author:g.author,partName:e.name,revisionKind:g.revisionKind,...g.formattingKind?{formattingKind:g.formattingKind}:{}});let se=s.length-Ae.length;if(se>0&&R.length&&o?.countRemaining!==false){let g={...e,root:{...e.root}},u=chunk2JVOX642_cjs.Rl(g,t,void 0,{siteNodeIds:R,...r?{scopeRootId:r.id}:{}});if(u.ok&&u.part){let E=r?chunk2JVOX642_cjs.eb(u.part,r.id):u.part.root;se=E&&E.kind!=="textValue"?chunk2JVOX642_cjs.cm({...u.part,root:E}).length:0;}}return {...G.length?{swept:G.map(chunk2JVOX642_cjs.ml)}:{},...Y.length?{partial:Y.map(chunk2JVOX642_cjs.ml)}:{},ops:le.size?[...d,{op:t==="accept"?"acceptAllRevisions":"rejectAllRevisions",siteNodeIds:R,...r?{scopeRootId:r.id}:{}}]:d,result:{resolved:Ae,skipped:_e,remaining:se}}}var Pt=Object.freeze({styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"});function $a(e,t,n,r){let o=(e.relationships.get(t)??[]).find(a=>a.type===n);if(o){let a=chunk2JVOX642_cjs.N(o);if(a.mode==="Internal"&&a.target.ok){let i=e.parts.get(a.target.partName);if(i)return i}}return e.parts.get(r)}function Zb(e){let t=chunk2JVOX642_cjs.lg(e);if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let n=_a(t.package),r=n.parts.get(n.mainDocumentPart);if(!r)return {ok:false,reason:"no-main-document-tree",detail:n.mainDocumentPart};let o=new Nn(n,La(n,chunk2JVOX642_cjs.Eb(r)));return {ok:true,view:Lu(o)}}function Lu(e){let t=()=>e.currentPackage(),n=()=>e.bodyStore().part,r=(c,d)=>$a(t(),t().mainDocumentPart,c,d)?.root??null,o=Object.freeze(chunk2JVOX642_cjs.oe(null)),a=null,i=chunk2JVOX642_cjs.$j,s=null;return Object.freeze({part:n,currentPackage:t,packageRevision:()=>e.packageRevision,stylesRoot:()=>r(Pt.styles,"/word/styles.xml"),numberingRoot:()=>r(Pt.numbering,"/word/numbering.xml"),settingsRoot:()=>r(Pt.settings,"/word/settings.xml"),documentThemeFonts(){let c=t();return a!==c&&(o=Object.freeze(chunk2JVOX642_cjs.oe(r(Pt.theme,"/word/theme/theme1.xml"),r(Pt.settings,"/word/settings.xml"),r(Pt.fontTable,"/word/fontTable.xml"))),a=c),o},documentProperties(){let c=t();if(s!==c){let d=$a(c,"/",Pt.coreProperties,"/docProps/core.xml"),m=$a(c,"/",Pt.extendedProperties,"/docProps/app.xml");i=chunk2JVOX642_cjs.ak(d?.root??null,m?.root??null),s=c;}return i},headerFooterPartsBySection:()=>chunk2JVOX642_cjs.tf(t()),headerFooterResolutionBySection:()=>chunk2JVOX642_cjs.sf(t()),relationshipTarget:c=>chunk2JVOX642_cjs.fj(t(),n().name,c)})}var $u=new Set(["unsupported-effect","renderer-required","unverified-3d","saved-fallback","inspection-limit","projection-diagnostic"]);function Ud(e,t){return e==="placeholder"?"unrendered":e==="fallback"||t.some(n=>$u.has(n.code)&&!n.detail.startsWith("wrap-polygon"))?"partial":"native"}var Bu=new Set(["alphaModFix","biLevel","grayscl","lum","extLst"]),Hu=new Set(["glow","innerShdw","reflection","softEdge"]),Vu=new Set(["blur","fillOverlay","prstShdw"]),Fd="http://schemas.openxmlformats.org/markup-compatibility/2006",ju="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function et(e,t,n){return Object.freeze({code:t,nodeId:e.id,namespaceUri:e.namespaceUri,localName:e.localName,detail:n})}function tn(e,t){let n=[{node:e,fallback:false}],r=0;for(;n.length&&++r<=4096;){let o=n.pop();if(o.node.id===t)return {...o,complete:true};for(let a of o.node.children)a.kind!=="textValue"&&n.push({node:a,fallback:o.fallback||a.namespaceUri===Fd&&a.localName==="Fallback"});}return {node:e,fallback:false,complete:n.length===0}}function Ld(e,t){let n=tn(e,t),r=[];n.complete||r.push(et(e,"inspection-limit","drawing-selection-budget")),n.fallback&&r.push(et(e,"saved-fallback","mc:Fallback"));let o=[{node:n.node,parent:"",depth:0}],a=0;for(;o.length;){let{node:i,parent:s,depth:l}=o.pop();if(++a>4096||l>64){r.push(et(i,"inspection-limit","drawing-source-budget"));break}if(!(i.namespaceUri===ju&&i.localName==="txbxContent")&&!(i.namespaceUri===Fd&&i.localName==="AlternateContent")){i.namespaceUri===chunk2JVOX642_cjs.va?i.localName==="effectDag"||s==="blip"&&!Bu.has(i.localName)||s==="effectLst"&&Vu.has(i.localName)?r.push(et(i,"unsupported-effect",`a:${i.localName}`)):s==="effectLst"&&Hu.has(i.localName)&&!chunk2JVOX642_cjs.be().effects?r.push(et(i,"renderer-required",`a:${i.localName}`)):(i.localName==="scene3d"||i.localName==="sp3d")&&r.push(et(i,"unverified-3d",`a:${i.localName}`)):i.namespaceUri==="http://schemas.microsoft.com/office/drawing/2010/main"&&i.localName==="imgProps"&&r.push(et(i,"unsupported-effect","a14:imgProps"));for(let c=i.children.length-1;c>=0;c--){let d=i.children[c];d.kind!=="textValue"&&o.push({node:d,parent:i.namespaceUri===chunk2JVOX642_cjs.va?i.localName:"",depth:l+1});}}}return Object.freeze(r)}var Gu=new Map([["http://schemas.openxmlformats.org/drawingml/2006/picture","picture"],["http://schemas.openxmlformats.org/drawingml/2006/chart","chart"],["http://schemas.microsoft.com/office/drawing/2014/chartex","chart"],["http://schemas.openxmlformats.org/drawingml/2006/diagram","diagram"],["http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","group"],["http://schemas.microsoft.com/office/word/2010/wordprocessingShape","textbox"],["http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","canvas"]]),zu="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Wu="urn:schemas-microsoft-com:vml";function Ku(e){return Gu.get(e)}function Ba(e){let t=[e],n=0,r=false;for(;t.length&&++n<=4096;){let o=t.pop();if(o.namespaceUri===chunk2JVOX642_cjs.va&&o.localName==="graphicData"){let a=chunk2JVOX642_cjs.oa(o.attributes,"uri");return a&&Ku(a)||"graphic"}if(!(o.namespaceUri===zu&&o.localName==="txbxContent")){r||=o.namespaceUri===Wu;for(let a=o.children.length-1;a>=0;a--){let i=o.children[a];i.kind!=="textValue"&&t.push(i);}}}return r?"shape":"graphic"}function sR(e,t){return Ba(tn(e,t).node)}var Tn="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Xu="http://schemas.openxmlformats.org/markup-compatibility/2006",Yu=new Set(["document","hdr","ftr","footnotes","endnotes"]),$d=new Set(["drawing","pict","object"]);function qu(e,t){return e?e.hidden||e.footprintOnly?"hidden":e.chartSummary?.shownAs==="fallback"||t?"fallback":e.picture||e.vectorShape||e.groupPicture||e.textboxStory||e.textArt||e.legacyGraphic||e.horizontalRule||e.groupTextboxes?.length?"projected":"placeholder":"unplaced"}function Ju(e){let t=chunk2JVOX642_cjs.te(e),n=[],r=true,o=0;for(let a of e.parts.values()){if(a.root.namespaceUri!==Tn||!Yu.has(a.root.localName))continue;let i=new Map(chunk2JVOX642_cjs.Ye(a,{stylesPart:chunk2JVOX642_cjs.ud(e),resolveRelationship:chunk2JVOX642_cjs.Se(e,a.name),resolveSchemeColor:t.resolveSchemeColor,resolveStyleMatrixReference:t.resolveStyleMatrixReference,resolveDiagramParts:chunk2JVOX642_cjs.Ke(e,a.name)}).map(c=>[`${a.name}\0${c.drawingNodeId}`,c])),s=[{node:a.root,depth:0}],l=new Map;for(;s.length;){let{node:c,depth:d}=s.pop();if(++o>1e6||d>128){r=false;break}let m=c.namespaceUri===Tn&&$d.has(c.localName),f=c.namespaceUri===Xu&&c.localName==="AlternateContent";if(m||f){let h=i.get(`${a.name}\0${c.id}`),y=m,P=[c],T=0;for(;P.length;){let M=P.pop();if(++T>4096||++o>1e6){r=false;break}if(!(M.namespaceUri===Tn&&M.localName==="txbxContent")){y||=M.namespaceUri===Tn&&$d.has(M.localName),h??=i.get(`${a.name}\0${M.id}`);for(let p of M.children)p.kind!=="textValue"&&P.push(p);}}if(y&&l.set(c,h),h){let p=[tn(c,h.drawingNodeId).node],x=0;for(;p.length&&++x<=4096&&++o<=1e6;){let k=p.pop();if(k.namespaceUri===Tn&&k.localName==="txbxContent"){s.push({node:k,depth:d+1});continue}for(let v of k.children)v.kind!=="textValue"&&p.push(v);}p.length&&(r=false);}continue}for(let h=c.children.length-1;h>=0;h--){let y=c.children[h];y.kind!=="textValue"&&s.push({node:y,depth:d+1});}}for(let[c,d]of l){let m=tn(c,d?.drawingNodeId??c.id),f=[...Ld(c,d?.drawingNodeId??c.id)];d||f.push(et(c,"unplaced-drawing","no-layout-projection"));let h=qu(d,m.fallback);for(let y of d?.diagnostics??[])y.code==="unsupported-graphic"&&h!=="placeholder"||f.push(Object.freeze({...et(m.node,"projection-diagnostic",y.code),nodeId:y.nodeId}));f.some(y=>y.code==="inspection-limit")&&(r=false),n.push(Object.freeze({ownerPartName:a.name,nodeId:c.id,drawingNodeId:d?.drawingNodeId??null,state:h,support:Ud(h==="placeholder"||h==="unplaced"?"placeholder":h==="fallback"?"fallback":"rendered",f),graphicKind:Ba(m.node),source:c,issues:Object.freeze(f)}));}if(!r&&o>1e6)break}return Object.freeze({entries:Object.freeze(n),complete:r,coverage:"explicit-source-effects"})}var Dt="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Qu="urn:schemas-microsoft-com:office:office",Hr="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Zu="http://schemas.openxmlformats.org/package/2006/relationships",ef="http://schemas.openxmlformats.org/package/2006/content-types",tf="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",Ha="application/vnd.openxmlformats-package.relationships+xml",nf=new Set(["drawing","pict","object"]),rf=new Set(["oleObject","package","control","vbaProject","attachedTemplate","externalLinkPath","subDocument","frame"].map(e=>`${Hr}/${e}`)),of=["styles","theme","settings","fontTable"].map(e=>`${Hr}/${e}`),af=`${Hr}/diagramData`,sf=4,lf='<w:pPr><w:spacing w:before="0" w:after="0" w:line="240" w:lineRule="auto"/><w:ind w:left="0" w:right="0" w:firstLine="0"/><w:jc w:val="left"/></w:pPr>',Ga=1e5;function cf(e,t){let n=chunk2JVOX642_cjs.eb(e,t);if(!n||n.kind==="textValue")return null;let r=null,o=n;for(let a=0;o&&a<64&&(o.namespaceUri===Dt&&nf.has(o.localName)&&(r=o),o.namespaceUri===chunk2JVOX642_cjs.sa&&o.localName==="AlternateContent"&&(r=o),!(o.namespaceUri===Dt&&(o.localName==="r"||o.localName==="p")));a++)o=chunk2JVOX642_cjs.fb(e,o.id);return r}function Bd(e,t,n){let r=[e],o=0;for(;r.length&&++o<=Ga;){let a=r.pop();for(let{namespaceUri:i,localName:s,value:l}of a.attributes)((n?s===n:i===chunk2JVOX642_cjs.ya)||!n&&i===Qu&&s==="relid")&&t.add(l);for(let i of a.children)i.kind!=="textValue"&&r.push(i);}}function df(e,t){let n=chunk2JVOX642_cjs.Fa(t),{rootBindings:r,declarations:o}=chunk2JVOX642_cjs.Ia(n),a=[];chunk2JVOX642_cjs.Ga(e,n,r,false,o,a);let i=new TextDecoder;return a.map(s=>typeof s=="string"?s:i.decode(s)).join("")}var mf=new Set(["extent","effectExtent","docPr","cNvGraphicFramePr"]),pf=635,jd="urn:schemas-microsoft-com:vml";function Gd(e,t=0,n=false){if(t>32||e.namespaceUri===Dt&&e.localName==="txbxContent")return e;if(n&&e.namespaceUri===jd){let a=e.attributes.map(i=>i.namespaceUri===""&&i.localName==="style"?{...i,value:gf(i.value)}:i);return {...e,attributes:a}}if(e.namespaceUri===chunk2JVOX642_cjs.wa&&e.localName==="anchor")return {id:e.id,kind:"generic",namespaceUri:chunk2JVOX642_cjs.wa,localName:"inline",namespaceBindings:e.namespaceBindings,attributes:e.attributes.filter(a=>a.namespaceUri===""&&/^dist[TBLR]$/.test(a.localName)),children:e.children.filter(a=>a.kind!=="textValue"&&(a.namespaceUri===chunk2JVOX642_cjs.wa&&mf.has(a.localName)||a.namespaceUri===chunk2JVOX642_cjs.va&&a.localName==="graphic"))};let r=false,o=e.children.map(a=>{if(a.kind==="textValue")return a;let i=e.namespaceUri===Dt&&(e.localName==="pict"||e.localName==="object"),s=Gd(a,t+1,i);return r||=s!==a,s});return r?{...e,children:o}:e}var uf=/^(position|left|top|margin-(left|top|right|bottom)|z-index|mso-position-.*)$/,ff={pt:1,in:72,cm:72/2.54,mm:72/25.4,pc:12,px:.75,"":.75};function gf(e){return e.split(";").filter(t=>!uf.test(t.split(":")[0].trim().toLowerCase())).join(";")}function Hd(e,t){for(let n of e.split(";")){let[r,o]=n.split(":");if(r?.trim().toLowerCase()!==t||o===void 0)continue;let a=/^\s*([0-9]+(?:\.[0-9]+)?)\s*(pt|in|cm|mm|pc|px|)\s*$/i.exec(o);return a?Number(a[1])*ff[a[2].toLowerCase()]*20:null}return null}function hf(e){let t=[{node:e,inWrapper:false}],n=0;for(;t.length&&++n<=Ga;){let{node:r,inWrapper:o}=t.shift();if(o&&r.namespaceUri===jd&&r.localName!=="shapetype"){let i=r.attributes.find(c=>c.namespaceUri===""&&c.localName==="style")?.value,s=i?Hd(i,"width"):null,l=i?Hd(i,"height"):null;if(s!==null&&l!==null&&(s>0||l>0)){let c=Number(/(?:^|;)\s*rotation\s*:\s*(-?[0-9.]+)/i.exec(i)?.[1]??0),d=(Number.isFinite(c)?c:0)*Math.PI/180,m=Math.abs(Math.cos(d)),f=Math.abs(Math.sin(d)),h=y=>Math.min(31680,Math.max(1,Math.ceil(y)));return {width:h(s*m+l*f),height:h(s*f+l*m)}}}let a=r.namespaceUri===Dt&&(r.localName==="pict"||r.localName==="object");for(let i of r.children)i.kind!=="textValue"&&t.push({node:i,inWrapper:a});}return null}function yf(e){let t=[e],n=0;for(;t.length&&++n<=Ga;){let r=t.pop();if(r.namespaceUri===chunk2JVOX642_cjs.wa&&(r.localName==="anchor"||r.localName==="inline")){let o=(l,c)=>{let d=r.children.find(h=>h.kind!=="textValue"&&h.namespaceUri===chunk2JVOX642_cjs.wa&&h.localName===l),m=d&&d.kind!=="textValue"?d.attributes.find(h=>h.localName===c)?.value:void 0,f=m===void 0?0:Number(m);return Number.isFinite(f)?f:0},a=o("extent","cx")+o("effectExtent","l")+o("effectExtent","r"),i=o("extent","cy")+o("effectExtent","t")+o("effectExtent","b");if(a<=0&&i<=0)return null;let s=l=>Math.min(31680,Math.max(1,Math.ceil(l/pf)));return {width:s(a),height:s(i)}}for(let o of r.children)o.kind!=="textValue"&&t.push(o);}return null}function xf(e){return `<w:sectPr><w:pgSz w:w="${e.width}" w:h="${Math.min(31680,e.height+120)}"/><w:pgMar w:top="0" w:right="0" w:bottom="0" w:left="0" w:header="0" w:footer="0" w:gutter="0"/></w:sectPr>`}function Va(e,t){let n;for(let r of e?.children??[])r.kind!=="textValue"&&r.namespaceUri===Dt&&r.localName===t&&(n=r);return n}function kf(e){let t=Va(e.parts.get(e.mainDocumentPart)?.root,"body"),n=Va(t,"sectPr"),r=(o,a)=>{let i=Va(n,"pgSz")?.attributes.find(l=>l.localName===o)?.value,s=i===void 0?NaN:Number(i);return Number.isInteger(s)&&s>0&&s<=31680?s:a};return `<w:sectPr><w:pgSz w:w="${r("w",12240)}" w:h="${r("h",15840)}"/><w:pgMar w:top="0" w:right="0" w:bottom="0" w:left="0" w:header="0" w:footer="0" w:gutter="0"/></w:sectPr>`}function ja(e){let t=e.map(({id:n,type:r,target:o})=>`<Relationship Id="${chunk2JVOX642_cjs.V(n)}" Type="${chunk2JVOX642_cjs.V(r)}" Target="${chunk2JVOX642_cjs.V(o)}"/>`).join("");return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Zu}">${t}</Relationships>`}function Vd(e){return e.startsWith("/word/")?e.slice(6):e}function Pf(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function Of(e,t,n={}){let r=n.maxParts??64,o=n.maxBytes??64*1024*1024,a=e.parts.get(t.ownerPartName),i=a?cf(a,t.nodeId):null;if(!a||!i)return {ok:false,reason:"drawing-not-found"};let s=new Map,l=new Map,c=[],d=0,m=new TextEncoder,f=null,h=S=>{if(S.targetMode==="External"||rf.has(S.type))return null;let I=chunk2JVOX642_cjs.N(S);if(I.mode!=="Internal"||!I.target.ok)return null;let _=I.target.partName;return e.parts.has(_)||e.partBytes.has(_)?_:null},y=(S,I,_)=>s.has(S)?true:(s.size>=r?f="too-many-parts":d+I.byteLength>o&&(f="too-large"),f?false:(s.set(S,I),d+=I.byteLength,_&&l.set(S,_),true)),P=(S,I)=>{if(f||s.has(S)||S==="/word/document.xml")return;let _=e.parts.get(S),q=_?m.encode(chunk2JVOX642_cjs.Ha(_)):e.partBytes.get(S);if(!q)return;let ee=chunk2JVOX642_cjs.K(e.contentTypes,S);if(!y(S,q,ee.ok?ee.contentType:null)||(c.push(S),!_||I>=sf))return;let K=[];for(let ae of e.relationships.get(S)??[]){let B=h(ae);B&&(K.push({id:ae.id,type:ae.type,target:ae.rawTarget}),P(B,I+1));}K.length&&y(Pf(S),m.encode(ja(K)),Ha);},T=new Set;Bd(i,T);let M=e.relationships.get(a.name)??[],p=[],x=S=>{let I=h(S);if(!I||p.some(q=>q.id===S.id))return;p.push({id:S.id,type:S.type,target:Vd(I)}),P(I,1);let _=e.parts.get(I);if(S.type===af&&_){let q=new Set;Bd(_.root,q,"relId");for(let ee of M)q.has(ee.id)&&x(ee);}};for(let S of M)T.has(S.id)&&x(S);let k=0;for(let S of e.relationships.get(e.mainDocumentPart)??[]){if(!of.includes(S.type))continue;let I=h(S);I&&(p.push({id:`rIdPreviewContext${++k}`,type:S.type,target:Vd(I)}),P(I,1));}if(f)return {ok:false,reason:f};let v=yf(i)??hf(i),A=`xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:mc="${chunk2JVOX642_cjs.sa}" mc:Ignorable="w14 wp14 w15"`,O=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${Dt}" ${A}><w:body><w:p>${lf}<w:r>${df(Gd(i),a.root)}</w:r></w:p>${v?xf(v):kf(e)}</w:body></w:document>`;if(!y("/word/document.xml",m.encode(O),tf)||!y("/word/_rels/document.xml.rels",m.encode(ja(p)),Ha))return {ok:false,reason:f??"too-large"};let D=ja([{id:"rId1",type:`${Hr}/officeDocument`,target:"word/document.xml"}]),F=[...l].map(([S,I])=>`<Override PartName="${chunk2JVOX642_cjs.V(S)}" ContentType="${chunk2JVOX642_cjs.V(I)}"/>`).join(""),w=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${ef}"><Default Extension="rels" ContentType="${Ha}"/><Default Extension="xml" ContentType="application/xml"/>${F}</Types>`,N=new Map([["/[Content_Types].xml",m.encode(w)],["/_rels/.rels",m.encode(D)]]);for(let[S,I]of s)N.set(S,I);return {ok:true,docx:chunk2JVOX642_cjs.af(N),pageFitsDrawing:v!==null,copiedParts:Object.freeze(c)}}
4
4
  exports.$=zp;exports.A=Uo;exports.Aa=Fu;exports.B=am;exports.Ba=Zb;exports.C=il;exports.Ca=Lu;exports.D=sl;exports.Da=Ud;exports.E=lm;exports.Ea=Ld;exports.F=fn;exports.Fa=Ku;exports.G=Og;exports.Ga=sR;exports.H=kr;exports.Ha=Ju;exports.I=Pr;exports.Ia=Of;exports.J=ul;exports.K=Ng;exports.L=dl;exports.M=Tm;exports.N=ta;exports.O=rc;exports.P=na;exports.Q=Tt;exports.R=Zc;exports.S=Nn;exports.T=rd;exports.U=od;exports.V=xa;exports.W=kk;exports.X=Pa;exports.Y=Ea;exports.Z=Ta;exports._=Gp;exports.a=zd;exports.aa=Wp;exports.b=el;exports.ba=Kp;exports.c=ur;exports.ca=Xp;exports.d=vt;exports.da=Yp;exports.e=fr;exports.ea=kd;exports.f=gr;exports.fa=Pd;exports.g=Re;exports.ga=Ca;exports.h=Yd;exports.ha=Ma;exports.i=wt;exports.ia=Qp;exports.j=pn;exports.ja=eu;exports.k=hr;exports.ka=tu;exports.l=un;exports.la=nu;exports.m=yr;exports.ma=ru;exports.n=wo;exports.na=hP;exports.o=Eo;exports.oa=$r;exports.p=To;exports.pa=yP;exports.q=Zd;exports.qa=ou;exports.r=em;exports.ra=xP;exports.s=Mo;exports.sa=_a;exports.t=nl;exports.ta=Su;exports.u=tm;exports.ua=vu;exports.v=Co;exports.va=Ua;exports.w=nm;exports.wa=Td;exports.x=Do;exports.xa=Cd;exports.y=Ao;exports.ya=wu;exports.z=_o;exports.za=La;