@docx-editor.dev/core 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +41 -35
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +10 -10
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +8 -8
  7. package/dist/binding.js +1 -1
  8. package/dist/{chunk-Q2B6HX3R.js → chunk-5RKCJ5DF.js} +1 -1
  9. package/dist/chunk-65GJRSZ5.cjs +18 -0
  10. package/dist/chunk-6TBRG6SA.cjs +20 -0
  11. package/dist/chunk-A72MJGY7.cjs +4 -0
  12. package/dist/chunk-AZ7QSAXH.js +4 -0
  13. package/dist/chunk-BL57VQ7E.js +1 -0
  14. package/dist/chunk-CB6RQ3GD.cjs +11 -0
  15. package/dist/chunk-GG4IAKFI.js +5 -0
  16. package/dist/chunk-HJYLFMLX.js +2 -0
  17. package/dist/chunk-HL6NO7IH.cjs +2 -0
  18. package/dist/chunk-HZQFGB2X.cjs +5 -0
  19. package/dist/{chunk-X5QNSISI.js → chunk-IWAUA732.js} +1 -1
  20. package/dist/chunk-OZXBAEWW.js +2 -0
  21. package/dist/{chunk-4EHMMSFR.cjs → chunk-P5PWSRNW.cjs} +1 -1
  22. package/dist/{chunk-BDAY2ETZ.js → chunk-PD5XKBJA.js} +1 -1
  23. package/dist/chunk-REMFTPDL.cjs +2 -0
  24. package/dist/{chunk-Z2ETEZRU.cjs → chunk-RLKX7BIP.cjs} +1 -1
  25. package/dist/chunk-UGLO2GA5.cjs +1 -0
  26. package/dist/chunk-UOQONZVQ.js +11 -0
  27. package/dist/chunk-VD2MWTR6.js +20 -0
  28. package/dist/chunk-VIXH2OVP.js +1 -0
  29. package/dist/chunk-W2JIZ5JH.js +18 -0
  30. package/dist/chunk-W5H62AWM.cjs +1 -0
  31. package/dist/chunk-X2LJDR53.cjs +5 -0
  32. package/dist/chunk-YQXY6TQ3.js +5 -0
  33. package/dist/{chunk-PYXMAUNR.cjs → chunk-YYFBYVW4.cjs} +1 -1
  34. package/dist/collaboration/replication.cjs +1 -1
  35. package/dist/collaboration/replication.d.ts +4 -4
  36. package/dist/collaboration/replication.js +1 -1
  37. package/dist/collaboration.d.ts +3 -3
  38. package/dist/contracts/document.d.ts +2 -2
  39. package/dist/contracts/editor.d.ts +8 -8
  40. package/dist/contracts/modules.d.ts +6 -6
  41. package/dist/contracts/types.d.ts +1 -1
  42. package/dist/{custom-node-writes-05qS32px.d.ts → custom-node-writes-Ck6eOiJ3.d.ts} +2 -2
  43. package/dist/{document-protection-Cr59VKLO.d.ts → document-protection-CMPEonQc.d.ts} +1 -1
  44. package/dist/{editor-BsLSz_7y.d.ts → editor-BKDVqXyk.d.ts} +75 -50
  45. package/dist/editor.cjs +1 -1
  46. package/dist/editor.css +1 -1
  47. package/dist/editor.d.ts +188 -26
  48. package/dist/editor.js +1 -1
  49. package/dist/export.cjs +2 -2
  50. package/dist/export.d.ts +31 -14
  51. package/dist/export.js +2 -2
  52. package/dist/{font-resolver-CzwdBJDE.d.ts → font-resolver-PBc8Vuxs.d.ts} +1 -1
  53. package/dist/{headless-document-view-B7nAiR7P.d.ts → headless-document-view-9wjJT20Y.d.ts} +2 -2
  54. package/dist/{image-resources-C4ilLzog.d.ts → image-resources-B0v-XaTM.d.ts} +2 -2
  55. package/dist/{index-zkvqBQ9o.d.ts → index-DQA53aR1.d.ts} +139 -20
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.d.ts +17 -17
  58. package/dist/index.js +1 -1
  59. package/dist/{layout-shaping-BJKVTI6i.d.ts → layout-shaping-Dyr0ZSOI.d.ts} +5 -2
  60. package/dist/layout.cjs +1 -1
  61. package/dist/layout.d.ts +378 -33
  62. package/dist/layout.js +1 -1
  63. package/dist/{note-properties-MNztEj5s.d.ts → note-properties-D_lmG9xx.d.ts} +1 -1
  64. package/dist/{omml-equation-CbnW9yXd.d.ts → omml-equation-CfTm3jOK.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +7 -7
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-Co_r0SZQ.d.ts → protocol-CkVDxyQ3.d.ts} +2 -2
  69. package/dist/{review-paragraph-order-EFaU7TqH.d.ts → review-paragraph-order-BjUs-tDd.d.ts} +1 -1
  70. package/dist/{revision-projection-DEIvpxiq.d.ts → revision-projection-DDVBYTIG.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection-DXmfnDCw.d.ts → semantic-cell-selection-DW6qsmoC.d.ts} +6 -4
  72. package/dist/{semantic-interaction-BLu3M6Nn.d.ts → semantic-interaction-BNiYSBcB.d.ts} +1 -1
  73. package/dist/{semantic-paint-CPsihA6k.d.ts → semantic-paint-DE236npp.d.ts} +2 -2
  74. package/dist/{semantic-records-CqD0b5Ex.d.ts → semantic-records-C5OeXnaL.d.ts} +546 -567
  75. package/dist/store.cjs +1 -1
  76. package/dist/store.d.ts +19 -25
  77. package/dist/store.js +1 -1
  78. package/dist/{tree-package-fragment-CwJDixNs.d.ts → tree-package-fragment-DBb97w3F.d.ts} +2 -2
  79. package/dist/{tree-session-contract-D9RRWE0C.d.ts → tree-session-contract-BYat3RKx.d.ts} +10 -5
  80. package/dist/{types-barrel-DLB11iSY.d.ts → types-barrel-ChGvWjkO.d.ts} +11 -5
  81. package/package.json +2 -2
  82. package/dist/chunk-44LQJIKH.cjs +0 -20
  83. package/dist/chunk-AFG7Q622.cjs +0 -2
  84. package/dist/chunk-AYMSP25Q.js +0 -4
  85. package/dist/chunk-B4KZSKF7.cjs +0 -5
  86. package/dist/chunk-BNZF6DYC.cjs +0 -18
  87. package/dist/chunk-BQXF2PFF.js +0 -2
  88. package/dist/chunk-GIHKVXEO.js +0 -2
  89. package/dist/chunk-ITNK6C5M.cjs +0 -3
  90. package/dist/chunk-MP3K4LC5.js +0 -1
  91. package/dist/chunk-MXOO7KRI.cjs +0 -11
  92. package/dist/chunk-NG6IQ4SI.js +0 -11
  93. package/dist/chunk-Q5JPPUNR.js +0 -5
  94. package/dist/chunk-S35UK656.cjs +0 -2
  95. package/dist/chunk-TE43S3LX.cjs +0 -1
  96. package/dist/chunk-VH2DLEZK.js +0 -20
  97. package/dist/chunk-VUNFWXHF.js +0 -1
  98. package/dist/chunk-WQFNWLNY.cjs +0 -4
  99. package/dist/chunk-WZX4UGRQ.js +0 -3
  100. package/dist/chunk-XS4FOHH6.js +0 -18
  101. package/dist/chunk-XZY4Q6PJ.cjs +0 -1
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunkCB6RQ3GD_cjs=require('./chunk-CB6RQ3GD.cjs'),fflate=require('fflate');var Ad=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Dd=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Fd=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function Bi(e){return Dd.test(e)||Fd.test(e)}function Fn(e,t){if(!Bi(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 _d=/^(\d+)\.(\d+)\.(\d+)$/;function st(e){let t=_d.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 _n(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 Ln(e,t){let n=st(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=st(r.slice(1));return _n(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=st(i.slice(s.length)),d=_n(n,l);s===">="?a=a&&d>=0:a=a&&d<0;}return a}return _n(n,st(r))===0}var ye=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},Wr=(e,t)=>`${e}:${t}`;function Ld(e,t={}){let n=new Map;for(let d of e){if(Fn(d.id,"extension"),ji(d.version,d.id),n.has(d.id))throw new ye("duplicate-extension",`duplicate extension id ${d.id}`,[d.id]);n.set(d.id,d);for(let c of d.contributions)Fn(c.id,c.kind),ji(c.version,`${d.id} \u2192 ${c.id}`),c.replaces&&Bd(c.replaces.targetRange,`${d.id} \u2192 replaces ${c.replaces.targetId}`);}for(let d of e){for(let c of d.dependencies??[])if(!n.has(c))throw new ye("missing-dependency",`${d.id} requires missing extension ${c}`,[d.id,c]);for(let c of d.conflicts??[])if(n.has(c)){let u=[d.id,c].sort();throw new ye("conflict",`extensions ${u[0]} and ${u[1]} conflict`,u)}}Ud(n);let r=new Set(t.availablePorts??[]);for(let d of e)for(let c of d.contributions)c.kind==="runtimePort"&&r.add(c.id);for(let d of e)for(let c of d.requiredPorts??[])if(!r.has(c))throw new ye("missing-port",`${d.id} requires unavailable port ${c}`,[d.id,c]);let o=new Map,a=new Map,i=new Map;for(let d of e)for(let c of d.contributions){let u=Wr(c.kind,c.id);if(c.replaces){let p=Wr(c.kind,c.replaces.targetId),P=i.get(p)??[];P.push({ext:d.id,c}),i.set(p,P);continue}if(a.has(u)){let p=[o.get(u),d.id].sort();throw new ye("id-collision",`${c.kind} id ${c.id} registered by both ${p[0]} and ${p[1]}`,p)}a.set(u,c),o.set(u,d.id);}let s=new Map(a);for(let[d,c]of i){let u=a.get(d);if(!u){let m=c[0];throw new ye("replacement-target-missing",`${m.ext} replaces missing target ${m.c.replaces.targetId}`,[m.ext,m.c.replaces.targetId])}let p=u.replaceable??{kind:"none"};for(let{ext:m,c:h}of c){if(!Ln(u.version,h.replaces.targetRange))throw new ye("replacement-version-mismatch",`${m} replaces ${h.replaces.targetId}@${u.version} outside range ${h.replaces.targetRange}`,[m,h.replaces.targetId]);if(p.kind==="none")throw new ye("unauthorized-replacement",`${h.replaces.targetId} does not authorize replacement (attempted by ${m})`,[m,h.replaces.targetId])}let P=$d(u,c);s.set(d,P);}return {extensions:n,contributions:s,get:(d,c)=>s.get(Wr(d,c))}}function $d(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 ye("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 ye("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function Ud(e){let o=new Map,a=[],i=s=>{o.set(s,1),a.push(s);let l=[...e.get(s)?.dependencies??[]].sort();for(let d of l){let c=o.get(d)??0;if(c===1){let u=a.indexOf(d),p=[...a.slice(u),d];throw new ye("dependency-cycle",`dependency cycle: ${p.join(" -> ")}`,p)}c===0&&i(d);}a.pop(),o.set(s,2);};for(let s of [...e.keys()].sort())(o.get(s)??0)===0&&i(s);}function ji(e,t){try{st(e);}catch{throw new ye("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Bd(e,t){try{Ln("0.0.0",e);}catch{throw new ye("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var lt=class extends Error{constructor(t){super(t),this.name="BudgetError";}},Gt=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new chunkCB6RQ3GD_cjs.p(`${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 lt(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new lt(`${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 lt(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new lt(`${this.label}: budget already released`)}};var $n=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},Xt=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 $n(t.derivedOnly,t._reason)}}}};var Un=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},zr=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 Un(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(chunkCB6RQ3GD_cjs.f.clock)}identity(){return this.resolve(chunkCB6RQ3GD_cjs.f.identity)}},Kr=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}},Gr=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function jd(e){let t=chunkCB6RQ3GD_cjs.k(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 Gt(`op:${o}`,r),cancellation:new Xt};return Object.freeze(a)}function Hd(e){e.budget.dispose();}var Yr=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"}}),Hi=Object.keys(Yr);function Vd(e,t){return new chunkCB6RQ3GD_cjs.p(`${Yr[t].phase}:${t}`,e[t])}var Xr=class{counter;current=0;peak=0;constructor(t){this.counter=new chunkCB6RQ3GD_cjs.p("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 Wd(){for(let e of Hi){let t=chunkCB6RQ3GD_cjs.j[e],n=chunkCB6RQ3GD_cjs.i[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`)}}function Yt(e,t=new Set){let n=new WeakSet,r=[],o=a=>{if(a===null)return "null";let i=typeof a;if(i==="boolean")return a?"true":"false";if(i==="number"){let l=a;if(!Number.isFinite(l))throw new Error(`non-finite number is not comparable: ${l}`);return Object.is(l,-0)?"0":String(l)}if(i==="string")return JSON.stringify(a);if(i==="bigint")return `${a.toString()}n`;if(Array.isArray(a))return `[${a.map((l,d)=>{r.push(d);try{return o(l)}finally{r.pop();}}).join(",")}]`;if(i==="object"){let l=a;if(n.has(l))throw new Error("cannot canonicalize a cyclic structure");n.add(l);let c=Object.keys(l).filter(u=>!t.has(u)).sort().map(u=>{r.push(u);try{return `${JSON.stringify(u)}:${o(l[u])}`}finally{r.pop();}}).join(",");return n.delete(l),`{${c}}`}let s=r.length>0?` at ${r.map(String).join(".")}`:"";throw new Error(`unsupported value type in comparator input: ${i}${s}`)};return o(e)}function Jr(e,t){return zd(Yt(e,t))}function zd(e){let t=3421674724,n=2216829733;for(let r=0;r<e.length;r++){n=(n^e.charCodeAt(r))>>>0;let o=n*435,a=Math.floor(o/4294967296);t=Math.imul(t,435)+Math.imul(n,256)+a>>>0,n=o>>>0;}return t.toString(16).padStart(8,"0")+n.toString(16).padStart(8,"0")}var $e="dev.docx-editor.core.comparator",qr={authoredState:{id:`${$e}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${$e}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${$e}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${$e}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${$e}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${$e}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${$e}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${$e}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${$e}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${$e}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Qr(e,t,n,r={}){let o=qr[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:Vi(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let a=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,i=Yt(t,a),s=Yt(n,a);return i===s?{equal:true}:{equal:false,left:i,right:s}}}}function Zr(e,t){let n=qr[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 Jr(t,r)}function Vi(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)=>Vi(r,t[o],n)):false}var zi=new Set([...chunkCB6RQ3GD_cjs.c,...chunkCB6RQ3GD_cjs.d]),Wi=/^[0-9a-f]{16}$/,Kd=/^[0-9a-f]*$/;function eo(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}]`;zi.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&&Gd(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&&!Wi.test(s.authoredStateHash)&&n(`${i}: authoredStateHash must be 16-hex`),s.outputHash!==void 0&&!Wi.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}`),Kd.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 Gd(e,t,n){zi.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function Xd(e,t){let n=eo(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 {Qr("authoredState",s.authoredState,s.authoredState).equal||r.push(`${i}: authored state is not self-consistent`);let c=Ki(s.authoredState);c!==l.authoredStateHash&&r.push(`${i}: authoredStateHash ${c} != expected ${l.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function Ki(e){return Zr("authoredState",e)}var dt="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Yd="http://schemas.openxmlformats.org/package/2006/relationships",Jd="http://schemas.openxmlformats.org/drawingml/2006/main",Yi="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",Ji="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",qi="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Qi="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",Zi="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",to="application/vnd.openxmlformats-package.relationships+xml",no=`${dt}/styles`,ro=`${dt}/numbering`,es=`${dt}/footnotes`,ts=`${dt}/endnotes`,ns=`${dt}/officeDocument`,qd=`${dt}/theme`;function _e(e){return e.kind!=="textValue"}function Gi(e,t){return {...e,children:t}}function qe(e,t){if(t(e),e.kind!=="textValue")for(let n of e.children)qe(n,t);}var Qd=new Set(["pStyle","rStyle","tblStyle"]);function oo(e,t){for(let n of e)qe(n,r=>{if(r.kind!=="textValue"&&Qd.has(r.localName)&&r.namespaceUri===chunkCB6RQ3GD_cjs.da){let o=chunkCB6RQ3GD_cjs.Ne(r,"val");o&&t.add(o);}});}function ao(e,t){for(let n of e)qe(n,r=>{if(r.kind!=="textValue"&&r.localName==="numId"&&r.namespaceUri===chunkCB6RQ3GD_cjs.da){let o=chunkCB6RQ3GD_cjs.Ne(r,"val");o&&t.add(o);}});}function jn(e,t){for(let n of e)qe(n,r=>{if(r.kind!=="textValue")for(let o of r.attributes)o.namespaceUri===dt&&o.value.length>0&&t.add(o.value);});}function Ce(e){return /^\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}function Hn(e,t){let n={footnote:new Set,endnote:new Set},r=[],o=a=>{for(let i of a)qe(i,s=>{if(s.kind!=="noteReference")return;let l=s.localName==="footnoteReference"?"footnote":"endnote",d=chunkCB6RQ3GD_cjs.Ne(s,"id");if(d===void 0)return;let c=Ce(d);n[l].has(c)||(n[l].add(c),r.push({kind:l,id:c}));});};for(o(e);r.length>0;){let a=r.pop(),i=t(a.kind,a.id);i!==null&&o([i]);}return n}function io(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===chunkCB6RQ3GD_cjs.da&&(a.localName==="footnoteReference"||a.localName==="endnoteReference")){let l=a.localName==="footnoteReference"?t:n,d=chunkCB6RQ3GD_cjs.Ne(a,"id");if(a.kind!=="noteReference"||d===void 0||!l.has(Ce(d))){o=true;continue}}let s=io(a,t,n);s!==a&&(o=true),r.push(s);}return o?{...e,children:r}:e}function Zd(e,t){for(let n of chunkCB6RQ3GD_cjs.nc(e,t)){if(n.type!==no||n.targetMode==="External")continue;let r=chunkCB6RQ3GD_cjs.w(n.ownerPart,n.rawTarget);if(r.ok)return e.parts.get(r.partName)??null}return e.parts.get("/word/styles.xml")??null}function rs(e,t,n){for(let r of chunkCB6RQ3GD_cjs.nc(e,t)){if(r.type!==n||r.targetMode==="External")continue;let o=chunkCB6RQ3GD_cjs.w(r.ownerPart,r.rawTarget);if(o.ok)return e.parts.get(o.partName)??null}return null}function os(e,t){let n=Zd(e,t),r=new Map,o=[],a=null;if(n&&_e(n.root))for(let i of n.root.children){if(!_e(i))continue;if(i.localName==="docDefaults"&&i.namespaceUri===chunkCB6RQ3GD_cjs.da){a=i;continue}if(i.localName!=="style"||i.namespaceUri!==chunkCB6RQ3GD_cjs.da)continue;let s=chunkCB6RQ3GD_cjs.Ne(i,"styleId");s&&r.set(s,i),(chunkCB6RQ3GD_cjs.Ne(i,"default")==="1"||chunkCB6RQ3GD_cjs.Ne(i,"default")==="true")&&o.push(i);}return {part:n,byId:r,defaults:o,docDefaults:a}}var ec=new Set(["basedOn","link","next"]);function as(e,t){let n=new Set,r=[...t];for(let i of e.defaults){let s=chunkCB6RQ3GD_cjs.Ne(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(_e(l)&&ec.has(l.localName)&&l.namespaceUri===chunkCB6RQ3GD_cjs.da){let d=chunkCB6RQ3GD_cjs.Ne(l,"val");d&&r.push(d);}}}if(!e.part||!_e(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 so(e,t,n){let r=rs(e,t,ro)??e.parts.get("/word/numbering.xml")??null;if(!r||!_e(r.root)||n.size===0)return {part:r,nums:[],abstracts:[]};let o=[],a=new Set;for(let s of r.root.children){if(!_e(s)||s.localName!=="num"||s.namespaceUri!==chunkCB6RQ3GD_cjs.da)continue;let l=chunkCB6RQ3GD_cjs.Ne(s,"numId");if(!(!l||!n.has(l))){o.push(s);for(let d of s.children)if(_e(d)&&d.localName==="abstractNumId"){let c=chunkCB6RQ3GD_cjs.Ne(d,"val");c&&a.add(c);}}}let i=[];for(let s of r.root.children){if(!_e(s)||s.localName!=="abstractNum"||s.namespaceUri!==chunkCB6RQ3GD_cjs.da)continue;let l=chunkCB6RQ3GD_cjs.Ne(s,"abstractNumId");l&&a.has(l)&&i.push(s);}return {part:r,nums:o,abstracts:i}}var Bn={latin:null,eastAsia:null,cs:null};function is(e,t){let n=rs(e,t,qd);if(!n)return {major:Bn,minor:Bn};let r={major:{...Bn},minor:{...Bn}};return qe(n.root,o=>{if(o.kind==="textValue"||o.namespaceUri!==Jd||o.localName!=="majorFont"&&o.localName!=="minorFont")return;let a=o.localName==="majorFont"?r.major:r.minor;for(let i of o.children){if(!_e(i))continue;let s=chunkCB6RQ3GD_cjs.Ne(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 tc(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 nc=[["asciiTheme","ascii"],["hAnsiTheme","hAnsi"],["eastAsiaTheme","eastAsia"],["cstheme","cs"]],Xi=new Set(["themeColor","themeTint","themeShade","themeFill","themeFillTint","themeFillShade"]);function Qe(e,t){if(e.kind==="textValue")return e;let n=e.attributes;if(e.localName==="rFonts"&&e.namespaceUri===chunkCB6RQ3GD_cjs.da){let a=[],i=new Map;for(let s of e.attributes){let l=nc.find(([d])=>d===s.localName);if(l&&s.namespaceUri===chunkCB6RQ3GD_cjs.da){let d=tc(t,s.value);d&&i.set(l[1],d);continue}a.push(s);}for(let[s,l]of i)a.some(d=>d.localName===s)||a.push({kind:"genericExtension",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:s,prefix:"w",value:l});n=a;}else e.attributes.some(a=>Xi.has(a.localName)&&a.namespaceUri===chunkCB6RQ3GD_cjs.da&&e.attributes.some(i=>i.localName==="val"))&&(n=e.attributes.filter(a=>!(Xi.has(a.localName)&&a.namespaceUri===chunkCB6RQ3GD_cjs.da)));let r=e.children.map(a=>Qe(a,t)),o=r.some((a,i)=>a!==e.children[i]);return n===e.attributes&&!o?e:{...e,attributes:n,children:r}}function ss(e,t,n){return {id:e,name:e,contentType:t,root:n}}function ls(e,t){if(e.root.kind==="document"){let r=e.root.children.find(a=>a.kind==="body"),o=r&&_e(r)?Gi(r,t):{id:"fragment#body",kind:"body",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return Gi(e.root,[o])}let n={id:"fragment#body",kind:"body",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return {id:"fragment#document",kind:"document",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:"document",prefix:"w",namespaceBindings:_e(e.root)?e.root.namespaceBindings:[],attributes:[],children:[n]}}function Jt(e){let t=e.map(n=>{let r=n.targetMode==="External"?' TargetMode="External"':"";return `<Relationship Id="${chunkCB6RQ3GD_cjs.N(n.id)}" Type="${chunkCB6RQ3GD_cjs.N(n.type)}" Target="${chunkCB6RQ3GD_cjs.N(n.rawTarget)}"${r}/>`}).join("");return `<Relationships xmlns="${Yd}">${t}</Relationships>`}function ds(e,t){let n=t;for(;e.has(`rId${n}`);)n+=1;return `rId${n}`}function cs(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}function Vn(e,t){return {...e,children:t}}function Wn(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkCB6RQ3GD_cjs.da}function qt(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)qt(n,t);return t}function ms(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=ms(n,t);if(r)return r}return null}function rc(e){let t=(n,r)=>{if(n.kind==="textValue")return n;if(r&&Wn(n,"vMerge")){if(chunkCB6RQ3GD_cjs.Ne(n,"val")==="restart")return n;let a=[...n.attributes.filter(i=>!(i.localName==="val"&&i.namespaceUri===chunkCB6RQ3GD_cjs.da)),{kind:"wmlVal",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:"val",prefix:"w",value:"restart"}];return {...n,attributes:a}}if(n.kind==="paragraph"||n.kind==="table")return n;let o=r||Wn(n,"tc");return Vn(n,n.children.map(a=>t(a,o)))};return Vn(e,e.children.map(n=>t(n,false)))}function us(e,t){if(!(e.kind==="textValue"||e.kind==="table")){if(Wn(e,"tr")){t.push(e);return}for(let n of e.children)us(n,t);}}function ps(e,t,n){if(e.kind==="textValue"||e.kind==="table")return {node:e,hadRows:false,keptRows:false};if(Wn(e,"tr")){if(!t.has(e))return {node:null,hadRows:true,keptRows:false};let i=n.value?rc(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=ps(i,t,n);r||=s.hadRows,o||=s.keptRows,s.node!==null&&a.push(s.node);}return r?{node:o?Vn(e,a):null,hadRows:true,keptRows:o}:{node:e,hadRows:false,keptRows:false}}function fs(e,t,n){let r=[];for(let l of e.children)us(l,r);let o=new Set(qt(e).filter(l=>t.inRange.has(l)));if(o.size===0)return;let a=r.filter(l=>{let d=qt(l);return d.length>0&&d.every(c=>t.covered.has(c))}),i=new Set(a.flatMap(l=>qt(l)));if(a.length>0&&o.size===i.size&&[...o].every(l=>i.has(l))){let l={value:true},d=new Set(a),c=[];for(let u of e.children){let p=ps(u,d,l);p.node!==null&&c.push(p.node);}n.push(Vn(e,c));return}for(let l of qt(e)){if(!t.inRange.has(l))continue;let d=ms(e,l);d&&n.push(d);}}var oc="http://schemas.openxmlformats.org/package/2006/content-types",ac=5e4;function ze(e){return e.kind!=="textValue"}function gs(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)gs(n,t);return t}function lo(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=lo(n,t);if(r)return r}return null}function We(e,t){return {...e,children:t}}function ic(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkCB6RQ3GD_cjs.da}function sc(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 lc(e,t){return gs(e).some(n=>t.has(n))}function co(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"){fs(r,t,n);continue}if(r.kind==="contentControl"){let o=r.children.find(a=>a.kind==="contentControlContent");o&&ze(o)&&co(o.children,t,n);continue}lc(r,t.inRange)&&co(r.children,t,n);}}var dc=new Set(["commentRangeStart","commentRangeEnd"]);function cc(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}function mo(e){if(e.kind==="textValue")return e;if(dc.has(e.localName)&&e.namespaceUri===chunkCB6RQ3GD_cjs.da||cc(e)||ic(e,"sectPr"))return null;let t=false,n=[];for(let r of e.children){let o=mo(r);if(o===null){t=true;continue}o!==r&&(t=true),n.push(o);}return t?We(e,n):e}function mc(e){let t=[],n=l=>{if(l.kind!=="textValue"){if(l.kind==="run"){for(let d of l.children)if(d.kind==="fldChar"){let c=chunkCB6RQ3GD_cjs.Ne(d,"fldCharType");t.push({nodeId:d.id,type:c==="separate"||c==="end"?c:"begin"});}else d.kind==="instrText"&&t.push({nodeId:d.id,type:"instr"});return}for(let d of l.children)n(d);}};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 c=o[o.length-1];c?c.separateId=l.nodeId:a=l.nodeId;continue}if(l.type==="instr"){let c=o[o.length-1];c?c.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 c of i)r.add(c);a=null,i=[];}}for(let l of o){r.add(l.beginId),l.separateId!==null&&r.add(l.separateId);for(let d of l.instrIds)r.add(d);}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 d=[],c=false;for(let u of l.children){let p=s(u);if(p===null){c=true;continue}p!==u&&(c=true),d.push(p);}return c?We(l,d):l};return e.map(l=>s(l)).filter(l=>l!==null)}function uo(e){if(e.kind==="textValue")return e.value.length;let t=0;for(let n of e.children)t+=uo(n);return t}function uc(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=uo(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 We(e,n)}function pc(e){let t=new Set,n=new Set,r=i=>{if(i.kind!=="textValue"){if(i.kind==="bookmarkStart"){let s=chunkCB6RQ3GD_cjs.Ne(i,"id");s!==void 0&&t.add(s);}if(i.kind==="bookmarkEnd"){let s=chunkCB6RQ3GD_cjs.Ne(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 d=chunkCB6RQ3GD_cjs.Ne(i,"id");return d!==void 0&&o.has(d)?i:null}let s=[],l=false;for(let d of i.children){let c=a(d);if(c===null){l=true;continue}c!==d&&(l=true),s.push(c);}return l?We(i,s):i};return e.map(i=>a(i)??i)}function fc(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 S of [o,a]){let L=lo(r.root,S);if(!L)return {ok:false,reason:"empty-range"};for(let H of L.children)H.kind==="contentControl"&&i.set(H.id,uo(H));}let s=r,l=lo(s.root,a);if(!l)return {ok:false,reason:"empty-range"};let d=chunkCB6RQ3GD_cjs.af(l);if(t.endOffset<d){let S=chunkCB6RQ3GD_cjs.Ti(s,{op:"deleteText",paragraphId:a,start:t.endOffset,end:d},{deferValidation:true});if(!S.ok)return {ok:false,reason:"trim-refused"};s=S.part;}if(t.startOffset>0){let S=chunkCB6RQ3GD_cjs.Ti(s,{op:"deleteText",paragraphId:o,start:0,end:t.startOffset},{deferValidation:true});if(!S.ok)return {ok:false,reason:"trim-refused"};s=S.part;}let c=sc(s);if(!c)return {ok:false,reason:"unknown-part"};let u={inRange:new Set(t.paragraphIds),covered:new Set(t.coveredParagraphIds),fullBlocks:new Set(t.fullyCoveredBlockIds)},p=[];if(co(c.children,u,p),p.length===0)return {ok:false,reason:"empty-range"};if(p.length>ac)return {ok:false,reason:"resource-limit"};let P=p.map(S=>mo(S)).filter(S=>S!==null).map(S=>S.kind!=="paragraph"||S.id!==o&&S.id!==a?S:uc(S,i));P=[...mc(P)],P=[...pc(P)];let m=chunkCB6RQ3GD_cjs.$f(e,"footnote"),h=chunkCB6RQ3GD_cjs.$f(e,"endnote"),g=(S,L)=>ze(S)&&S.namespaceUri===chunkCB6RQ3GD_cjs.da&&S.localName===L,k=Hn(P,(S,L)=>{let H=S==="footnote"?m:h;if(!H||!ze(H.root))return null;for(let Q of H.root.children){if(!g(Q,S))continue;let ae=chunkCB6RQ3GD_cjs.Ne(Q,"id");if(ae!==void 0&&Ce(ae)===L)return Q}return null}),f=k.footnote,v=k.endnote;f.size===0&&(m=null),v.size===0&&(h=null);let O=(S,L,H)=>{if(!S||!ze(S.root))return [];let Q=[];for(let ae of S.root.children){if(!g(ae,L))continue;let q=chunkCB6RQ3GD_cjs.Ne(ae,"id"),et=chunkCB6RQ3GD_cjs.Ne(ae,"type");if(et==="separator"||et==="continuationSeparator"){Q.push(ae);continue}if(q!==void 0&&H.has(Ce(q))){let kt=mo(ae);kt&&ze(kt)&&Q.push(kt);}}return Q},R=O(m,"footnote",f),y=O(h,"endnote",v),T=[...R,...y],w=[...P,...T],j=new Set;oo(w,j);let z=os(e,e.mainDocumentPart),ee=new Set;ao(w,ee);let X=[],F=so(e,e.mainDocumentPart,ee);for(;;){let S=j.size,L=ee.size;X=as(z,j),ao(X,ee),F=so(e,e.mainDocumentPart,ee);let H=[...F.nums,...F.abstracts];oo(H,j);for(let Q of H)qe(Q,ae=>{if(ae.kind!=="textValue"&&(ae.localName==="styleLink"||ae.localName==="numStyleLink")&&ae.namespaceUri===chunkCB6RQ3GD_cjs.da){let q=chunkCB6RQ3GD_cjs.Ne(ae,"val");q&&j.add(q);}});if(j.size===S&&ee.size===L)break}let B=is(e,e.mainDocumentPart),ie=X.map(S=>Qe(S,B)),be=z.docDefaults?Qe(z.docDefaults,B):null;P=P.map(S=>Qe(S,B));let $=R.map(S=>Qe(S,B)),U=y.map(S=>Qe(S,B)),Y=new Set;jn(P,Y);let N=chunkCB6RQ3GD_cjs.nc(e,r.name).filter(S=>Y.has(S.id)),I=new Map,A=0,K=S=>{let L=new Set;for(let H of S){if(H.targetMode==="External")continue;let Q=chunkCB6RQ3GD_cjs.w(H.ownerPart,H.rawTarget);if(!Q.ok){L.add(H.id);continue}if((chunkCB6RQ3GD_cjs.oc(e,Q.partName)??"").toLowerCase().startsWith("image/")&&n?.omitMedia!==true){let q=e.partBytes.get(Q.partName)??e.partBytes.get(Q.partName.replace(/^\//,""));q?(I.set(Q.partName,q),A+=q.byteLength):L.add(H.id);continue}L.add(H.id);}return L},te=K(N),se=(S,L)=>{if(S.kind==="textValue")return S;if(S.kind==="drawing"||S.namespaceUri===chunkCB6RQ3GD_cjs.da&&S.localName==="pict"){let ae=new Set;jn([S],ae);for(let q of ae)if(L.has(q))return null;return S}let H=[],Q=false;for(let ae of S.children){let q=se(ae,L);if(q===null){Q=true;continue}q!==ae&&(Q=true),H.push(q);}return Q?We(S,H):S};te.size>0&&(P=P.map(S=>se(S,te)).filter(S=>S!==null));let G=N.filter(S=>!te.has(S.id)),Ue=(S,L)=>{if(!S)return [];let H=new Set;jn(L,H);let Q=chunkCB6RQ3GD_cjs.nc(e,S.name).filter(q=>H.has(q.id)),ae=K(Q);if(ae.size>0)for(let q=0;q<L.length;q+=1){let et=se(L[q],ae);et!==null&&(L[q]=et);}return Q.filter(q=>!ae.has(q.id))},ge=Ue(m,$),cn=Ue(h,U),we=new Map,yt=[],$t=new Map,xt=(S,L,H)=>{let Q=ss(S,L,H);we.set(S.slice(1),chunkCB6RQ3GD_cjs.Sa(chunkCB6RQ3GD_cjs.qa(Q))),yt.push([S,L]),$t.set(S,Q);},Ut=(S,L)=>S.map(H=>{if(H.targetMode==="External")return {...H,ownerPart:L};let Q=chunkCB6RQ3GD_cjs.w(H.ownerPart,H.rawTarget);return {...H,ownerPart:L,rawTarget:Q.ok?Q.partName:H.rawTarget}}),b=Ut(G,"/word/document.xml"),M=Ut(ge,"/word/footnotes.xml"),C=Ut(cn,"/word/endnotes.xml"),_=new Set(b.map(S=>S.id)),W=9001,J=(S,L)=>{let H=ds(_,W);W+=1,_.add(H),b.push({ownerPart:"/word/document.xml",id:H,type:S,rawTarget:L,targetMode:"Internal",order:b.length});},me=ls(s,P);if(xt("/word/document.xml",Yi,me),z.part&&(ie.length>0||be)){let S=We(z.part.root,[...be?[be]:[],...ie]);xt("/word/styles.xml",Ji,S),J(no,"styles.xml");}if(F.part&&(F.nums.length>0||F.abstracts.length>0)){let S=We(F.part.root,[...F.abstracts.map(L=>Qe(L,B)),...F.nums]);xt("/word/numbering.xml",qi,S),J(ro,"numbering.xml");}m&&$.length>0&&(xt("/word/footnotes.xml",Qi,We(m.root,$)),J(es,"footnotes.xml"),M.length>0&&we.set("word/_rels/footnotes.xml.rels",chunkCB6RQ3GD_cjs.Sa(Jt(M)))),h&&U.length>0&&(xt("/word/endnotes.xml",Zi,We(h.root,U)),J(ts,"endnotes.xml"),C.length>0&&we.set("word/_rels/endnotes.xml.rels",chunkCB6RQ3GD_cjs.Sa(Jt(C))));let fe=new Map;for(let[S,L]of I){we.set(S.slice(1),L);let H=cs(S);H&&!fe.has(H)&&fe.set(H,chunkCB6RQ3GD_cjs.oc(e,S)??"application/octet-stream");}let V={ownerPart:"/",id:"rId1",type:ns,rawTarget:"word/document.xml",targetMode:"Internal",order:0};we.set("word/_rels/document.xml.rels",chunkCB6RQ3GD_cjs.Sa(Jt(b))),we.set("_rels/.rels",chunkCB6RQ3GD_cjs.Sa(Jt([V])));let ce=[`<Default Extension="rels" ContentType="${to}"/>`,'<Default Extension="xml" ContentType="application/xml"/>',...[...fe].map(([S,L])=>`<Default Extension="${chunkCB6RQ3GD_cjs.N(S)}" ContentType="${chunkCB6RQ3GD_cjs.N(L)}"/>`)].join(""),Se=yt.map(([S,L])=>`<Override PartName="${chunkCB6RQ3GD_cjs.N(S)}" ContentType="${chunkCB6RQ3GD_cjs.N(L)}"/>`).join("");we.set("[Content_Types].xml",chunkCB6RQ3GD_cjs.Sa(`<Types xmlns="${oc}">${ce}${Se}</Types>`));let le=new Map;le.set("/",[V]),le.set("/word/document.xml",b),M.length>0&&le.set("/word/footnotes.xml",M),C.length>0&&le.set("/word/endnotes.xml",C);let Ee=[];for(let S of le.values())for(let L of S)L.targetMode==="External"&&Ee.push({ownerPart:L.ownerPart,id:L.id,type:L.type,rawTarget:L.rawTarget,sinkSafe:chunkCB6RQ3GD_cjs.x(L.rawTarget).ok});let ne=new Map;ne.set("rels",to),ne.set("xml","application/xml");for(let[S,L]of fe)ne.set(S,L);let ue={defaults:ne,overrides:new Map(yt)},he=new Map;for(let[S,L]of we)he.set(S.startsWith("/")?S:`/${S}`,L);return {ok:true,bytes:chunkCB6RQ3GD_cjs.Ra(we),package:Object.freeze({parts:$t,partBytes:he,relationships:le,externalTargets:Ee,contentTypes:ue,mainDocumentPart:"/word/document.xml"}),lastMarkCovered:t.lastMarkCovered,blockCount:P.length,mediaBytes:A}}function xe(e){return e.kind!=="textValue"}function re(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===chunkCB6RQ3GD_cjs.da}function Me(e,t){for(let n of e)t(n),n.kind!=="textValue"&&Me(n.children,t);}function Ke(e){if(e.kind==="textValue")return `T(${e.value})`;if(e.namespaceUri===chunkCB6RQ3GD_cjs.da&&e.localName.startsWith("rsid"))return "";let t=e.attributes.filter(r=>!r.localName.startsWith("rsid")&&!(r.namespaceUri===chunkCB6RQ3GD_cjs.ga&&(r.localName==="paraId"||r.localName==="textId"))).map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(","),n=e.children.map(Ke).join("");return `E(${e.namespaceUri}:${e.localName}[${t}]{${n}})`}function Qt(e){return `S[${e.attributes.filter(n=>n.localName!=="styleId").map(n=>`${n.localName}=${n.value}`).sort().join(",")}]${e.children.map(Ke).join("")}`}function Gn(e){let t=[],n=new Map,r=new Set,o=null;if(e&&xe(e.root))for(let a of e.root.children){if(!xe(a))continue;if(re(a,"docDefaults")){o=a;continue}if(!re(a,"style"))continue;t.push(a);let i=chunkCB6RQ3GD_cjs.Ne(a,"styleId");i&&n.set(i,a);let s=a.children.find(d=>re(d,"name")),l=s?chunkCB6RQ3GD_cjs.Ne(s,"val"):void 0;l&&r.add(l);}return {part:e,styles:t,docDefaults:o,byId:n,names:r}}function zn(e,t,n){let r=new Map;if(!e)return r;let o=e.children.find(i=>re(i,t));if(!o||!xe(o))return r;let a=o.children.find(i=>re(i,n));if(!a||!xe(a))return r;for(let i of a.children)i.kind!=="textValue"&&r.set(i.localName,i);return r}function po(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(d=>re(d,n));if(s&&xe(s)&&s.children.some(d=>d.kind!=="textValue"&&d.localName===r))return true;let l=i.children.find(d=>re(d,"basedOn"));o=l?chunkCB6RQ3GD_cjs.Ne(l,"val"):void 0;}return false}function gc(e,t){for(let n of e.styles){if(chunkCB6RQ3GD_cjs.Ne(n,"type")!==t)continue;let r=chunkCB6RQ3GD_cjs.Ne(n,"default");if(r==="1"||r==="true")return chunkCB6RQ3GD_cjs.Ne(n,"styleId")}}function Kn(e,t){let n=e.children.find(r=>re(r,t));return n&&xe(n)?n:null}var hc=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])),yc=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 fo(e,t,n){let r=zn(t.docDefaults,"rPrDefault","rPr"),o=zn(n.docDefaults,"rPrDefault","rPr"),a=zn(t.docDefaults,"pPrDefault","pPr"),i=zn(n.docDefaults,"pPrDefault","pPr"),s=(g,x,k)=>{let f=gc(g,"paragraph"),v=f?g.byId.get(f):void 0;if(!v)return f;for(let[O,R]of [["rPr",x],["pPr",k]]){let y=Kn(v,O);if(y)for(let T of y.children)T.kind!=="textValue"&&R.set(T.localName,T);}return f};s(t,r,a),s(n,o,i);let l=new Map;for(let[g,x]of r){let k=o.get(g);(!k||Ke(k)!==Ke(x))&&l.set(g,x);}let d=new Map;for(let[g,x]of a){if(g==="sectPr")continue;let k=i.get(g);(!k||Ke(k)!==Ke(x))&&d.set(g,x);}if(l.size===0&&d.size===0)return e;let c=0,u=()=>`fragment#materialized-${c++}`,p=g=>{let x=k=>k.kind==="textValue"?{id:u(),kind:"textValue",value:k.value}:{...k,id:u(),children:k.children.map(x)};return x(g)},P=(g,x,k)=>{if(k.length===0)return g;let f=Kn(g,x);if(f){let O=x==="rPr"?yc:hc,R=[...f.children];for(let T of k){let w=T.kind==="textValue"?Number.MAX_SAFE_INTEGER:O.get(T.localName)??Number.MAX_SAFE_INTEGER,j=R.length;for(let z=0;z<R.length;z+=1){let ee=R[z];if(ee.kind==="textValue")continue;let X=O.get(ee.localName);if(X!==void 0&&X>w){j=z;break}}R.splice(j,0,T);}let y={...f,children:R};return {...g,children:g.children.map(T=>T===f?y:T)}}let v={id:u(),kind:x==="rPr"?"runProperties":"paragraphProperties",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:x,prefix:"w",namespaceBindings:[],attributes:[],children:k};return {...g,children:[v,...g.children]}},m=g=>{let x=Kn(g,"pPr"),k=x?.children.find(y=>re(y,"pStyle")),f=k?chunkCB6RQ3GD_cjs.Ne(k,"val"):void 0,v=[];for(let[y,T]of d)x?.children.some(j=>j.kind!=="textValue"&&j.localName===y)||f&&po(t,f,"pPr",y)||v.push(p(T));let O=y=>{if(y.kind==="textValue")return y;if(y.kind==="run"){let w=Kn(y,"rPr"),j=w?.children.find(X=>re(X,"rStyle")),z=j?chunkCB6RQ3GD_cjs.Ne(j,"val"):void 0,ee=[];for(let[X,F]of l)w?.children.some(ie=>ie.kind!=="textValue"&&ie.localName===X)||z&&po(t,z,"rPr",X)||f&&po(t,f,"rPr",X)||ee.push(p(F));return P(y,"rPr",ee)}if(y.kind==="paragraphProperties"||y.kind==="runProperties")return y;let T=y.children.map(O);return T.some((w,j)=>w!==y.children[j])?{...y,children:T}:y};return O(P(g,"pPr",v))},h=g=>{if(g.kind==="textValue")return g;if(g.kind==="paragraph")return m(g);let x=g.children.map(h);return x.some((k,f)=>k!==g.children[f])?{...g,children:x}:g};return e.map(h)}var hs="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Pe(e,t,n,r){return {...e,attributes:e.attributes.map(o=>o.localName===n&&o.namespaceUri===t?{...o,value:r}:o)}}var xc=new Set(["pStyle","rStyle","tblStyle","basedOn","link","next","styleLink","numStyleLink"]),go=chunkCB6RQ3GD_cjs.ig,Ge=new Map;function Tt(e,t){let n=t.styleIds??Ge,r=t.numIds??Ge,o=t.relIds??Ge,a=t.footnoteIds??Ge,i=t.endnoteIds??Ge,s=t.bookmarkIds??Ge,l=t.sdtIds??Ge,d=t.revisionIds??Ge,c=t.docPrIds??Ge,u=(p,P)=>{if(p.kind==="textValue")return p;let m=p;if(p.namespaceUri===chunkCB6RQ3GD_cjs.da&&xc.has(p.localName)){let k=chunkCB6RQ3GD_cjs.Ne(p,"val"),f=k!==void 0?n.get(k):void 0;f!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"val",f));}if(re(p,"numId")){let k=chunkCB6RQ3GD_cjs.Ne(p,"val"),f=k!==void 0?r.get(k):void 0;f!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"val",f));}if(p.kind==="noteReference"){let k=p.localName==="footnoteReference"?a:i,f=chunkCB6RQ3GD_cjs.Ne(p,"id"),v=f!==void 0?k.get(Ce(f)):void 0;v!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"id",v));}if(p.kind==="bookmarkStart"||p.kind==="bookmarkEnd"){let k=chunkCB6RQ3GD_cjs.Ne(p,"id"),f=k!==void 0?s.get(k):void 0;f!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"id",f));}if(re(p,"id")&&P==="sdtPr"){let k=chunkCB6RQ3GD_cjs.Ne(p,"val"),f=k!==void 0?l.get(k):void 0;f!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"val",f));}if(go(p)){let k=chunkCB6RQ3GD_cjs.Ne(p,"id"),f=k!==void 0?d.get(k):void 0;f!==void 0&&(m=Pe(m,chunkCB6RQ3GD_cjs.da,"id",f));}if(p.kind==="drawingDocPr"){let k=p.attributes.find(v=>v.localName==="id"&&v.namespaceUri==="")?.value,f=k!==void 0?c.get(k):void 0;f!==void 0&&(m=Pe(m,"","id",f));}for(let k of m.attributes){if(k.namespaceUri!==hs)continue;let f=o.get(k.value);f!==void 0&&f!==k.value&&(m=Pe(m,hs,k.localName,f));}let h=p.localName,g=m.children.map(k=>u(k,h));return m!==p||g.some((k,f)=>k!==m.children[f])?{...m,children:g}:p};return u(e,"")}function ys(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 xs(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 kc=1e5;function ks(e){let t=chunkCB6RQ3GD_cjs.Tb(),n=Pc(e,t),r=Rc(e,t),o=vc(e,t);return !n||!r||!o?null:{bookmarkIds:n,revisionIds:r,docPrIds:o}}function ho(e,t,n,r){if(e)return chunkCB6RQ3GD_cjs.Vb(t,e,r);let o=n;return ()=>String(o++)}function Ps(e,t){if(e.add(t),!/^\d{1,10}$/.test(t))return;let n=Number(t);n<=chunkCB6RQ3GD_cjs.Rb&&e.add(String(n));}function Rs(e,t){if(t===void 0)return e;let n=Number(t);return Number.isInteger(n)&&n>e?n:e}function Pc(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])Me([i.root],s=>{if(s.kind!=="bookmarkStart"&&s.kind!=="bookmarkEnd")return;let l=chunkCB6RQ3GD_cjs.Ne(s,"id");l!==void 0&&(Ps(o,l),s.kind==="bookmarkStart"&&(r=Rs(r,l)));});let a=ho(t,o,r+1,chunkCB6RQ3GD_cjs.Rb);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 Rc(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;Me([s.root],d=>{if(!chunkCB6RQ3GD_cjs.ig(d))return;let c=chunkCB6RQ3GD_cjs.Ne(d,"id");c!==void 0&&Ps(o,c),l&&(r=Rs(r,c));});}let a=ho(t,o,r+1,chunkCB6RQ3GD_cjs.Rb),i=false;return Me(e.travelling,s=>{if(i||!chunkCB6RQ3GD_cjs.ig(s))return;let l=chunkCB6RQ3GD_cjs.Ne(s,"id");if(l===void 0||n.has(l))return;let d=a();d===null?i=true:n.set(l,d);}),i?null:n}function vc(e,t){let n=new Map;if(!e.hasDocPr)return n;let{used:r}=chunkCB6RQ3GD_cjs.Xb(e.pkg),o=kc;if(!t){let s=chunkCB6RQ3GD_cjs.Yb(e.pkg);s.ok&&(o=s.id);}let a=ho(t,r,o,chunkCB6RQ3GD_cjs.Wb),i=false;return Me(e.travelling,s=>{if(i||s.kind==="textValue"||s.kind!=="drawingDocPr")return;let l=s.attributes.find(c=>c.localName==="id"&&c.namespaceUri==="")?.value;if(l===void 0||n.has(l))return;let d=a();d===null?i=true:n.set(l,d);}),i?null:n}var ct="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Oc=`${ct}/hyperlink`,vs=`${ct}/image`,Xn=`${ct}/numbering`,yo=`${ct}/styles`,Os="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Is="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function Zt(e,t,n,r){for(let o of chunkCB6RQ3GD_cjs.nc(e,t)){if(o.type!==n||o.targetMode==="External")continue;let a=chunkCB6RQ3GD_cjs.w(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 xo(e,t){let n=0;return Me([e],r=>{let o=t(r);if(o===void 0)return;let a=Number(o);Number.isInteger(a)&&a>n&&(n=a);}),n}function Yn(e,t,n,r){if(n.length===0)return e;let o=chunkCB6RQ3GD_cjs.Fa(t,"paste"),a=n.map(d=>chunkCB6RQ3GD_cjs.Se(d,o)),i=chunkCB6RQ3GD_cjs.Ri(t,a),s=r??i.root.children.length,l=chunkCB6RQ3GD_cjs.La(i,i.root.id,s,a,{deferValidation:true});return l.ok?chunkCB6RQ3GD_cjs.lc(e,l.part):null}function bs(e){let t=new Set;return Me(e,n=>{if(n.kind!=="textValue")for(let r of n.attributes)r.namespaceUri===ct&&r.value.length>0&&t.add(r.value);}),t}function Ss(e,t){if(t.size===0)return [...e];let n=o=>{if(o.kind==="textValue")return o;if(o.kind==="drawing"||re(o,"pict")){let i=false;return Me([o],s=>{if(s.kind!=="textValue")for(let l of s.attributes)l.namespaceUri===ct&&t.has(l.value)&&(i=true);}),i?null:o}if(o.kind==="hyperlink"){let i=o.attributes.find(s=>s.namespaceUri===ct)?.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 Ic=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),Ns={"image/jpg":"image/jpeg","image/x-ms-bmp":"image/bmp","image/x-bmp":"image/bmp"};function bc(e,t){let n=chunkCB6RQ3GD_cjs.zb(e);return n==="unknown"||(Object.hasOwn(Ns,t)?Ns[t]:t)!==n||Ic.has(n)&&!chunkCB6RQ3GD_cjs.Zb(e,n)?null:n}function ko(e,t,n){let r=t.parts.get(t.mainDocumentPart);if(!r)return {ok:false,reason:"no-fragment-document"};if(!e.parts.has(n))return {ok:false,reason:"no-target-part"};let o=r.root.kind==="document"?r.root.children.find(b=>b.kind==="body"):null;if(!o||!xe(o))return {ok:false,reason:"no-fragment-document"};let a=chunkCB6RQ3GD_cjs.Si(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=Zt(t,t.mainDocumentPart,Xn,"/word/numbering.xml"),l=new Map,d=[],c=[];if(s&&xe(s.root)){let b=new Map,M=[];for(let V of s.root.children)if(xe(V))if(re(V,"abstractNum")){let ce=chunkCB6RQ3GD_cjs.Ne(V,"abstractNumId");ce&&b.set(ce,V);}else re(V,"num")&&M.push(V);let C=Zt(i,i.mainDocumentPart,Xn,"/word/numbering.xml"),_=new Map,W=new Map;if(C&&xe(C.root)){for(let V of C.root.children)if(xe(V)&&re(V,"abstractNum")){let ce=chunkCB6RQ3GD_cjs.Ne(V,"abstractNumId");ce&&W.set(ce,V);}for(let V of C.root.children){if(!xe(V)||!re(V,"num"))continue;let ce=chunkCB6RQ3GD_cjs.Ne(V,"numId");if(!ce)continue;let Se=V.children.find(ne=>re(ne,"abstractNumId")),le=Se?chunkCB6RQ3GD_cjs.Ne(Se,"val"):void 0,Ee=le?W.get(le):void 0;_.set(`${Ee?Qt(Ee):"none"}::${V.children.filter(ne=>re(ne,"lvlOverride")).map(Ke).join("")}`,ce);}}let J=(C?xo(C.root,V=>V.kind!=="textValue"&&re(V,"abstractNum")?chunkCB6RQ3GD_cjs.Ne(V,"abstractNumId"):void 0):0)+1,me=(C?xo(C.root,V=>V.kind!=="textValue"&&re(V,"num")?chunkCB6RQ3GD_cjs.Ne(V,"numId"):void 0):0)+1,fe=new Map;for(let V of M){let ce=chunkCB6RQ3GD_cjs.Ne(V,"numId");if(!ce)continue;let Se=V.children.find(H=>re(H,"abstractNumId")),le=Se?chunkCB6RQ3GD_cjs.Ne(Se,"val"):void 0,Ee=le?b.get(le):void 0,ne=`${Ee?Qt(Ee):"none"}::${V.children.filter(H=>re(H,"lvlOverride")).map(Ke).join("")}`,ue=_.get(ne);if(ue!==void 0){l.set(ce,ue);continue}let he=le?fe.get(le):void 0;he===void 0&&Ee&&le&&(he=String(J++),fe.set(le,he),c.push(Pe(Ee,chunkCB6RQ3GD_cjs.da,"abstractNumId",he)));let S=String(me++);l.set(ce,S);let L=Pe(V,chunkCB6RQ3GD_cjs.da,"numId",S);if(he!==void 0){let H=L.children.map(Q=>re(Q,"abstractNumId")?Pe(Q,chunkCB6RQ3GD_cjs.da,"val",he):Q);L={...L,children:H};}d.push(L),_.set(ne,S);}}let u=Gn(Zt(t,t.mainDocumentPart,yo,"/word/styles.xml")),p=Zt(i,i.mainDocumentPart,yo,"/word/styles.xml"),P=Gn(p),m=new Map,h=[],g=new Set(P.byId.keys()),x=new Set(P.names),k=new Map,f=new Map,v=new Map,O=(b,M)=>{let C=v.get(b);return C===void 0&&(C=Qt(M),v.set(b,C)),C},R=b=>({...b,attributes:b.attributes.filter(M=>!(M.localName==="default"&&M.namespaceUri===chunkCB6RQ3GD_cjs.da))});for(let b of u.styles){let M=chunkCB6RQ3GD_cjs.Ne(b,"styleId");if(!M)continue;let C=P.byId.get(M),_=Qt(Tt(b,{styleIds:m,numIds:l}));if(C&&O(M,C)===_){m.set(M,M);continue}if(!C){m.set(M,M),g.add(M),h.push(R(b));continue}let W=ys(`${M}Pasted`,g,k);g.add(W),m.set(M,W),h.push(R(Pe(b,chunkCB6RQ3GD_cjs.da,"styleId",W)));}let y=h.map(b=>{let M=b.children.find(J=>re(J,"name")),C=M?chunkCB6RQ3GD_cjs.Ne(M,"val"):void 0;if(!C||!x.has(C))return C&&x.add(C),b;let _=xs(C,x,f);x.add(_);let W=b.children.map(J=>re(J,"name")?Pe(J,chunkCB6RQ3GD_cjs.da,"val",_):J);return {...b,children:W}}),T=null,w=1,j=()=>{if(T)return T;let b=new Map;for(let[M,C]of i.partBytes){let _=M.startsWith("/")?M:`/${M}`;if(!_.startsWith("/word/media/"))continue;b.set(chunkCB6RQ3GD_cjs.a(C),_);let W=/\/image(\d+)\./.exec(_);W&&(w=Math.max(w,Number(W[1])+1));}return T=b,b},z=new Map,ee=b=>{let M=z.get(b);if(!M){M=new Map;for(let C of chunkCB6RQ3GD_cjs.nc(i,b)){if(C.targetMode==="External"||C.type!==vs)continue;let _=chunkCB6RQ3GD_cjs.w(C.ownerPart,C.rawTarget);_.ok&&M.set(_.partName,C.id);}z.set(b,M);}return M},X=(b,M)=>{let C=b.lastIndexOf("."),_=C===-1?"":b.slice(C+1);return /^[A-Za-z0-9]{1,8}$/.test(_)?_.toLowerCase():M==="image/jpeg"?"jpeg":M==="image/gif"?"gif":"png"},F=(b,M,C)=>{let _=new Map,W=new Set,J=ee(M),me=[],fe=new Set,V=[],ce=[],Se=new Map,le=[],Ee=t.relationships.get(b)??[];for(let ne of Ee){if(!C.has(ne.id))continue;if(ne.targetMode==="External"){if(ne.type===Oc){let Pt=chunkCB6RQ3GD_cjs.Ef(i,ne.rawTarget,M);Pt?(i=Pt.pkg,_.set(ne.id,Pt.relationshipId)):W.add(ne.id);}else W.add(ne.id);continue}let ue=chunkCB6RQ3GD_cjs.w(ne.ownerPart,ne.rawTarget);if(!ue.ok){W.add(ne.id);continue}let he=t.partBytes.get(ue.partName)??t.partBytes.get(ue.partName.replace(/^\//,"")),S=(chunkCB6RQ3GD_cjs.oc(t,ue.partName)??"").toLowerCase();if(!he||!S.startsWith("image/")){W.add(ne.id);continue}let L=bc(he,S);if(L===null){W.add(ne.id);continue}let H=L,Q=j(),ae=chunkCB6RQ3GD_cjs.a(he),q=Q.get(ae);if(!q){let Pt=X(ue.partName,H),Md=un=>i.partBytes.has(un)||i.partBytes.has(un.slice(1))||i.parts.has(un)||fe.has(un),ur=`/word/media/image${w}.${Pt}`;for(;Md(ur);)w+=1,ur=`/word/media/image${w}.${Pt}`;w+=1,q=ur,me.push({partName:q,bytes:he,contentType:H}),fe.add(q),Q.set(ae,q);}let et=q.startsWith("/word/")?q.slice(6):q,kt=J.get(q);if(kt!==void 0){_.set(ne.id,kt);continue}let mn=Se.get(q);mn===void 0&&(mn=V.length,Se.set(q,mn),V.push(et),ce.push(q)),le.push({recordId:ne.id,index:mn});}if(me.length>0&&(i=chunkCB6RQ3GD_cjs.bc(i,me)),V.length>0){let ne=chunkCB6RQ3GD_cjs.rc(chunkCB6RQ3GD_cjs.sc(i,M),M,V.map(ue=>[vs,ue]));if(ne.ok){i=ne.pkg,ne.ids.forEach((ue,he)=>{J.set(ce[he],ue);});for(let ue of le)_.set(ue.recordId,ne.ids[ue.index]);}else for(let ue of le)W.add(ue.recordId);}return {relIdMap:_,dropRelIds:W}},B=F(t.mainDocumentPart,n,bs(a));a=Ss(a,B.dropRelIds);let ie=new Map,be=new Map,$=[],U=(b,M)=>xe(b)&&b.namespaceUri===chunkCB6RQ3GD_cjs.da&&b.localName===M,Y={},N=Hn(a,(b,M)=>{let C=Y[b];if(C===void 0){C=new Map,Y[b]=C;let _=chunkCB6RQ3GD_cjs.$f(t,b);if(_&&xe(_.root))for(let W of _.root.children){if(!U(W,b))continue;let J=chunkCB6RQ3GD_cjs.Ne(W,"id");if(J===void 0)continue;let me=Ce(J);C.has(me)||C.set(me,W);}}return C.get(M)??null});for(let b of ["footnote","endnote"]){let M=b==="footnote"?ie:be,C=N[b];if(C.size===0)continue;let _=chunkCB6RQ3GD_cjs.$f(t,b);if(!_||!xe(_.root))continue;let W=chunkCB6RQ3GD_cjs.tg(i,b);if(!W.ok||!W.package)return {ok:false,reason:"merge-refused"};i=W.package;let J=chunkCB6RQ3GD_cjs.$f(i,b);if(!J)return {ok:false,reason:"merge-refused"};let me=xo(J.root,V=>U(V,b)?chunkCB6RQ3GD_cjs.Ne(V,"id"):void 0)+1,fe=[];for(let V of _.root.children){if(!U(V,b))continue;let ce=chunkCB6RQ3GD_cjs.Ne(V,"id"),Se=chunkCB6RQ3GD_cjs.Ne(V,"type");if(Se==="separator"||Se==="continuationSeparator"||ce===void 0||!C.has(Ce(ce))||M.has(Ce(ce)))continue;let le=String(me++);M.set(Ce(ce),le),fe.push(Pe(V,chunkCB6RQ3GD_cjs.da,"id",le));}fe.length>0&&$.push({kind:b,fragmentPartName:_.name,bodies:chunkCB6RQ3GD_cjs.Si(fe)});}let I=i.parts.get(n),A=[...a,...$.flatMap(b=>b.bodies)],K=[],te=new Set,se=false,G=false,Ue=new Map;Me(A,b=>{if(b.kind!=="textValue"){if(b.kind==="bookmarkStart"||b.kind==="bookmarkEnd"){let M=chunkCB6RQ3GD_cjs.Ne(b,"id");if(M!==void 0&&K.push(M),b.kind==="bookmarkStart"){let C=chunkCB6RQ3GD_cjs.Ne(b,"name");C&&te.add(C);}return}if(go(b)){se=true;return}if(b.kind==="drawingDocPr"){G=true;return}if(b.kind==="contentControlProperties")for(let M of b.children){if(!re(M,"id"))continue;let C=chunkCB6RQ3GD_cjs.Ne(M,"val");if(C!==void 0&&!Ue.has(C)){let _=0,W=`${C}:${Ue.size}`;for(let J=0;J<W.length;J+=1)_=_*31+W.charCodeAt(J)>>>0;Ue.set(C,String(_%2147483647||1));}}}});let ge=ks({pkg:i,ownerPart:I,notesParts:$.map(b=>chunkCB6RQ3GD_cjs.$f(i,b.kind)).filter(b=>b!==null),travelling:A,fragmentBookmarkIds:K,hasRevision:se,hasDocPr:G});if(!ge)return {ok:false,reason:"merge-refused"};let cn=ge.bookmarkIds,we=ge.revisionIds,yt=ge.docPrIds;if(te.size>0){let b=new Set;if(Me([I.root],M=>{if(M.kind!=="textValue"&&M.kind==="bookmarkStart"){let C=chunkCB6RQ3GD_cjs.Ne(M,"name"),_=chunkCB6RQ3GD_cjs.Ne(M,"id");C&&_!==void 0&&te.has(C)&&b.add(_);}}),b.size>0){let M=_=>{if(_.kind==="textValue")return _;let W=[],J=false;for(let me of _.children){if((me.kind==="bookmarkStart"||me.kind==="bookmarkEnd")&&b.has(chunkCB6RQ3GD_cjs.Ne(me,"id")??"")){J=true;continue}let fe=M(me);fe!==me&&(J=true),W.push(fe);}return J?{..._,children:W}:_},C=M(I.root);C!==I.root&&(chunkCB6RQ3GD_cjs.Ja(I.root,C),i=chunkCB6RQ3GD_cjs.lc(i,{...I,root:C}));}}let $t=b=>io(b,ie,be);for(let b of $){b.bodies=b.bodies.map($t);let M=chunkCB6RQ3GD_cjs.$f(i,b.kind);if(!M)return {ok:false,reason:"merge-refused"};let C=F(b.fragmentPartName,M.name,bs(b.bodies)),_=Ss(b.bodies,C.dropRelIds);_=[...fo(_,u,P)],_=_.map(J=>Tt(J,{styleIds:m,numIds:l,relIds:C.relIdMap,footnoteIds:ie,endnoteIds:be,bookmarkIds:cn,sdtIds:Ue,revisionIds:we,docPrIds:yt}));let W=Yn(i,i.parts.get(M.name),_);if(!W)return {ok:false,reason:"merge-refused"};i=W;}if(y.length>0){let b=y.map(C=>Tt(C,{styleIds:m,numIds:l}));if(!p){let C=chunkCB6RQ3GD_cjs.xa(`<w:styles xmlns:w="${chunkCB6RQ3GD_cjs.da}"></w:styles>`,{name:"/word/styles.xml",contentType:Is});if(!C.ok)return {ok:false,reason:"merge-refused"};i=chunkCB6RQ3GD_cjs.uc(i,"/word/styles.xml",C.part.root,Is);let _=chunkCB6RQ3GD_cjs.tc(chunkCB6RQ3GD_cjs.sc(i,i.mainDocumentPart),i.mainDocumentPart,yo,"styles.xml");if(!_.ok)return {ok:false,reason:"merge-refused"};i=_.pkg,p=i.parts.get("/word/styles.xml")??null;}if(!p)return {ok:false,reason:"merge-refused"};let M=Yn(i,i.parts.get(p.name),b);if(!M)return {ok:false,reason:"merge-refused"};i=M,P=Gn(i.parts.get(p.name)??null);}if(c.length>0||d.length>0){let b=Zt(i,i.mainDocumentPart,Xn,"/word/numbering.xml");if(!b){let J=chunkCB6RQ3GD_cjs.xa(`<w:numbering xmlns:w="${chunkCB6RQ3GD_cjs.da}"></w:numbering>`,{name:"/word/numbering.xml",contentType:Os});if(!J.ok)return {ok:false,reason:"merge-refused"};i=chunkCB6RQ3GD_cjs.uc(i,"/word/numbering.xml",J.part.root,Os);let me=chunkCB6RQ3GD_cjs.tc(chunkCB6RQ3GD_cjs.sc(i,i.mainDocumentPart),i.mainDocumentPart,Xn,"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 M=i.parts.get(b.name),C=M.root.children.findIndex(J=>re(J,"num")),_=c.map(J=>Tt(J,{styleIds:m,numIds:l})),W=Yn(i,M,_,C===-1?void 0:C);if(!W)return {ok:false,reason:"merge-refused"};if(i=W,W=Yn(i,i.parts.get(b.name),d),!W)return {ok:false,reason:"merge-refused"};i=W;}let Ut=[...fo(a,u,P)].map($t).map(b=>Tt(b,{styleIds:m,numIds:l,relIds:B.relIdMap,footnoteIds:ie,endnoteIds:be,bookmarkIds:cn,sdtIds:Ue,revisionIds:we,docPrIds:yt}));return {ok:true,pkg:i,blocks:Ut}}var ws=16*1024*1024;function Sc(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>chunkCB6RQ3GD_cjs.Ni)return false;let r=0,o=(a,i,s)=>{if(i>s||(r+=1,r>chunkCB6RQ3GD_cjs.Pi))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,chunkCB6RQ3GD_cjs.Oi))return false;for(let[a,i]of e.parts)if(a!==e.mainDocumentPart&&/\/(styles|numbering|footnotes|endnotes)\.xml$/.test(a)&&!o(i.root,1,chunkCB6RQ3GD_cjs.Oi*4))return false;return true}function Po(e,t,n){if(n.fragmentBytes.byteLength>ws)return {ok:false,reason:"invalidArgs",detail:"fragment-too-large"};let r=chunkCB6RQ3GD_cjs.jc(n.fragmentBytes);if(!r.ok)return {ok:false,reason:"invalidArgs",detail:`fragment-read:${r.reason}`};let o=r.package;if(!Sc(o))return {ok:false,reason:"invalidArgs",detail:"fragment-over-budget"};let a=e.resolveStory(t);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let{store:i,story:s}=a;if(i.compositionActive||e.compositionSessionOpen())return {ok:false,reason:"invalidArgs",detail:"ime-composition-active"};let l=e.currentPackage(),d=i.checkpoint(),c=0,u="";return chunkCB6RQ3GD_cjs.Ca(e,()=>{let p=i.transact(m=>{for(let k of n.priorOps??[])if(!m.apply(k))return;let h=null,g=m.applyPackage(k=>(h=ko(k,o,s.partName),h.ok?h.pkg:k)),x=h;if(!x||!x.ok){u=`fragment-merge:${x?x.reason:"no-merge"}`,m.apply({op:"insertText",paragraphId:"\0fragment-abort",offset:0,text:"x"});return}g&&(c=x.blocks.length,m.apply({op:"insertFragment",paragraphId:n.paragraphId,offset:n.offset,blocks:x.blocks,lastMarkCovered:n.lastMarkCovered}));},{story:s,...n.actorId?{actorId:n.actorId}:{}});return u.length>0?{ok:false,reason:"invalidArgs",detail:u}:p.ok?p.change?{ok:true,change:e.promoteStoryTransactionToPackageUnit(l,i,d),blockCount:c}:{ok:true,change:null,blockCount:c}:{ok:false,reason:p.reason,...p.detail?{detail:p.detail}:{}}},p=>chunkCB6RQ3GD_cjs.Da(p))}function Es(){let e=null;return (t,n,r)=>{let o=e;if(e=null,!chunkCB6RQ3GD_cjs.ni(n)||!("paragraphId"in r)||!chunkCB6RQ3GD_cjs.pi(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=chunkCB6RQ3GD_cjs.Ha(t,r.paragraphId);if(a?.kind!=="paragraph")return r;let i=chunkCB6RQ3GD_cjs.ui(t,chunkCB6RQ3GD_cjs.ti(r));if(i.unprotected.length)return r;let s=chunkCB6RQ3GD_cjs.Ze(a);for(let l of i.touches){let d=s.spanOf(l.control);d&&d.start<=r.start&&d.end>=r.end&&(e={partName:t.name,paragraphId:r.paragraphId,offset:r.start,controlId:l.control.id});}return r}}var Ts=new WeakSet;function Nc(e){return Ts.add(e),e}function Cs(e){return Ts.has(e)}function en(e){return {...e,applyPackage:t=>e.applyPackage(Nc(t))}}var wc=new Set(["insertText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertDrawing","deleteText"]),Ms=new Set(["insertDrawing"]);function Ec(e){if(!(e===null||e.start!==e.end))return e}var Ct={"text-local":0,"paragraph-local":1,"flow-structural":2,global:3};function Tc(e){return Object.freeze({parts:new Map([[e.name,e]]),partBytes:new Map,relationships:new Map,externalTargets:[],contentTypes:{defaults:new Map,overrides:new Map([[e.name.toLowerCase(),e.contentType]])},mainDocumentPart:e.name})}var mt=class{current;storyPartName;rev=0;commitCounter=0;undoStack=[];redoStack=[];subscribers=new Set;historyLimit;settingsPartOverride;storyRef=null;composition=null;constructor(t,n,r={}){let o="root"in t,a=typeof n=="string"?n:void 0,i=typeof n=="object"&&n!==null?n:r;this.current=o?Tc(t):t,this.storyPartName=a??(o?t.name:t.mainDocumentPart),this.historyLimit=i.historyLimit??200,this.settingsPartOverride=i.settingsPart;}setStoryRef(t){this.storyRef=t;}get part(){let t=this.current.parts.get(this.storyPartName);if(!t)throw new Error(`story part missing: ${this.storyPartName}`);return t}get package(){return this.current}get revision(){return this.rev}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}get historyDepth(){return this.undoStack.length}get compositionActive(){return this.composition!==null}graftPackage(t){this.current=t(this.current);}replacePart(t){let n=this.current.parts.get(t.name);t!==n&&(this.current=chunkCB6RQ3GD_cjs.lc(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 chunkCB6RQ3GD_cjs.Sb(n.actorId,()=>this.commitTransaction(t,n))}commitTransaction(t,n){let r=n.origin??chunkCB6RQ3GD_cjs.b.mutationHuman,o=n.recordsHistory??(r!==chunkCB6RQ3GD_cjs.b.projection&&r!==chunkCB6RQ3GD_cjs.b.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,d=null,c=0,u=new Set,p=new Set,P=new Set,m=new Set,h=new Set,g=[],x=n.minimumImpact??"text-local",k=null,f=false,v=null,O=null,R=new Map,y=new Map,T=$=>{let U=y.get($.name);U||(U={mint:null,written:new Set},y.set($.name,U));let Y=U;return {mint:()=>(Y.mint??=chunkCB6RQ3GD_cjs.hg($))(),wrote:N=>{Y.written.add(N);},wroteUnder:N=>Y.written.has(N)}},w=()=>{for(let $ of y.values())$.mint=null;},j=($,U)=>{let Y=chunkCB6RQ3GD_cjs.Qh.get($.op);if(Y===void 0)return R.clear(),null;let N=`${U.name}\0${Y}`,I=R.get(N);I||(I={id:null},R.set(N,I));let A=I;return ()=>A.id??=T(U).mint()},z=($,U)=>{let Y=wc.has($.op);return !Y&&chunkCB6RQ3GD_cjs.Qh.get($.op)!==void 0?null:((!Y||Ms.has($.op))&&w(),Y?T(U):null)},ee=Es(),X=null,F=($,U)=>{if(d)return false;let Y=l.parts.get($);if(!Y)return d={reason:"unknown-part",detail:$},false;U=ee(Y,this.settingsPartOverride?.()??chunkCB6RQ3GD_cjs.Qf(l),U);let N=chunkCB6RQ3GD_cjs.mi(this.settingsPartOverride?.()??chunkCB6RQ3GD_cjs.Qf(l),U)??chunkCB6RQ3GD_cjs.vi(Y,this.settingsPartOverride?.()??chunkCB6RQ3GD_cjs.Qf(l),U,X?.partName===$&&"paragraphId"in U&&X.paragraphId===U.paragraphId?X.fieldNodeId:void 0);if(N)return d={reason:N},false;let I=j(U,Y),A=z(U,Y),K=this.settingsPartOverride?.()??chunkCB6RQ3GD_cjs.Qf(l),te=chunkCB6RQ3GD_cjs.ni(K)&&"paragraphId"in U&&chunkCB6RQ3GD_cjs.pi(Y,U.paragraphId)?chunkCB6RQ3GD_cjs.uh(Y,U,X?.partName===$&&X.paragraphId===U.paragraphId?X.fieldNodeId:void 0):null;X=te&&"paragraphId"in U?{partName:$,paragraphId:U.paragraphId,fieldNodeId:te.fieldNodeId}:null;let se={deferValidation:true,...I?{revisionIds:I}:{},...A?{trackedRevisionIds:A}:{}},G=te?chunkCB6RQ3GD_cjs.Ah(Y,U,te,se):chunkCB6RQ3GD_cjs.Ti(Y,U,se);if(!G.ok)return d={reason:G.reason,...G.detail?{detail:G.detail}:{}},false;if(Ms.has(U.op)&&w(),l=chunkCB6RQ3GD_cjs.lc(l,G.part),G.part===Y&&G.effect.dirty.length===0&&G.effect.created.length===0&&G.effect.deleted.length===0&&G.effect.split===void 0&&(G.effect.splits===void 0||G.effect.splits.length===0)&&G.effect.join===void 0&&G.effect.caret===void 0)return true;u.add($),c+=1;for(let ge of G.effect.dirty)p.add(ge);for(let ge of G.effect.created)P.add(ge);for(let ge of G.effect.deleted)m.add(ge);for(let ge of G.effect.dependencyKeys)h.add(ge);G.effect.split&&g.push({split:G.effect.split});for(let ge of G.effect.splits??[])g.push({split:ge});return G.effect.join&&g.push({join:G.effect.join}),Ct[G.effect.impact]>Ct[x]&&(x=G.effect.impact),G.effect.caret&&(O={paragraphId:G.effect.caret.paragraphId,start:0,end:0}),true};if(t({apply:$=>F(this.storyPartName,$),applyTo:($,U)=>F($,U),applyPackage:$=>{if(d)return false;let U=this.settingsPartOverride?.()??chunkCB6RQ3GD_cjs.Qf(l),Y=Cs($)?chunkCB6RQ3GD_cjs.li(U,{op:"comment"}):chunkCB6RQ3GD_cjs.mi(U);if(Y)return d={reason:Y},false;R.clear(),w();let N=$(l);if(N===l)return true;for(let[I,A]of N.parts)l.parts.get(I)!==A&&u.add(I);return l=N,c+=1,Ct["flow-structural"]>Ct[x]&&(x="flow-structural"),true},selectionBefore:$=>{k=$;},selectionAfter:$=>{f=true,v=$;}}),d){let $=d;return {ok:false,reason:$.reason,...$.detail?{detail:$.detail}:{}}}if(c===0)return {ok:true,change:null};let B=f?v:O,ie=f?Ec(v):O??void 0;for(let $ of u){let U=i.parts.get($),Y=l.parts.get($);if(Y===void 0)continue;let N=U?chunkCB6RQ3GD_cjs.va(U,Y):chunkCB6RQ3GD_cjs.va(Y,Y);if(!N.ok)return {ok:false,reason:"tree-invariant",detail:JSON.stringify(N.issues)}}let be=chunkCB6RQ3GD_cjs.vc(l);if(!be.ok)return {ok:false,reason:"package-invariant",detail:JSON.stringify(be.issues)};if(o)if(this.composition)chunkCB6RQ3GD_cjs.bj(n.historyGroup,"split","composition"),this.composition.committed=true,this.composition={...this.composition,entry:{...this.composition.entry,selectionAfter:B}};else {let $=n.historyGroup,U=this.undoStack[this.undoStack.length-1];$!==void 0&&U!==void 0&&U.group===$?this.undoStack[this.undoStack.length-1]={...U,selectionAfter:B??U.selectionAfter}:this.pushUndo({pkg:i,revision:s,selectionBefore:k,selectionAfter:B,group:$}),chunkCB6RQ3GD_cjs.bj($,U?.group===$?"extended":"started"),this.redoStack.length=0;}return this.current=l,this.rev+=1,n.story&&(this.storyRef=n.story),n.minimumImpact&&Ct[n.minimumImpact]>Ct[x]&&(x=n.minimumImpact),{ok:true,change:this.publish(r,s,{dirty:p,created:P,deleted:m,dependencyKeys:h,splitJoin:g,impact:x,caret:ie},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=t.pkg,this.rev+=1,this.publish(chunkCB6RQ3GD_cjs.b.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=t.pkg,this.rev+=1,this.publish(chunkCB6RQ3GD_cjs.b.mutationRedo,n,null,this.storyRef??void 0)}selectionForUndo(){return this.undoStack[this.undoStack.length-1]?.selectionBefore??null}selectionForRedo(){return this.redoStack[this.redoStack.length-1]?.selectionAfter??null}pushUndo(t){this.undoStack.push(t),this.undoStack.length>this.historyLimit&&this.undoStack.shift();}publish(t,n,r,o,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}:{}};for(let l of this.subscribers)l(s);return s}};function Ro(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 As(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 vo(e,t){return [...e.values()].map(n=>n.part).filter(n=>t.parts.has(n.name))}function Ds(e,t){return vo(e,t).map(n=>n.name).sort().join(",")}function Fs(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 qn="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Cc="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function Mt(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===qn&&n.localName===t)return n;return null}function Jn(e,t){return e.attributes.find(n=>n.namespaceUri===qn&&n.localName===t)?.value}function Mc(e){let t=Jn(e,"val");return t===void 0||t==="1"||t==="true"||t==="on"}function Ls(e,t){return e.kind==="textValue"?Object.freeze({...e,id:t()}):Object.freeze({...e,id:t(),children:e.children.map(n=>Ls(n,t))})}function Ac(e){let t=chunkCB6RQ3GD_cjs.xa(`<w:styles xmlns:w="${qn}"><w:style w:type="paragraph" w:styleId="ListParagraph"><w:pPr><w:contextualSpacing/></w:pPr></w:style></w:styles>`,{name:e.name,contentType:Cc});if(!t.ok)return null;let n=Mt(t.part.root,"style"),r=n?Mt(n,"pPr"):null;return r?Ls(r,chunkCB6RQ3GD_cjs.Fa(e)):null}var _s=["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 Dc(e,t){let n=_s.indexOf(t),r=0;return e.forEach((o,a)=>{if(o.kind==="textValue")return;let i=_s.indexOf(o.localName);i!==-1&&i<=n&&(r=a+1);}),r}function $s(e,t){let n=chunkCB6RQ3GD_cjs.sf(e);if(!n)return null;let r=null;for(let d of n.root.children)if(d.kind!=="textValue"&&d.namespaceUri===qn&&d.localName==="style"&&Jn(d,"type")==="paragraph"&&Jn(d,"styleId")===t){r=d;break}if(!r)return null;let o=Mt(r,"name");if(o&&Jn(o,"val")?.trim().toLowerCase()!=="list paragraph"&&t!=="ListParagraph")return null;let a=Ac(n);if(!a)return null;let i=Mt(a,"contextualSpacing");if(!i)return null;let s=Mt(r,"pPr"),l;if(s){let d=Mt(s,"contextualSpacing");if(d&&Mc(d))return e;l=d?chunkCB6RQ3GD_cjs.Ma(n,d.id,i):chunkCB6RQ3GD_cjs.La(n,s.id,Dc(s.children,"contextualSpacing"),[i]);}else {let d=r.children.findIndex(c=>c.kind!=="textValue"&&["rPr","tblPr","tcPr","tblStylePr"].includes(c.localName));l=chunkCB6RQ3GD_cjs.La(n,r.id,d===-1?r.children.length:d,[a]);}return l.ok?Object.freeze({...e,parts:new Map([...e.parts,[n.name,l.part]])}):null}var Hs="http://schemas.openxmlformats.org/package/2006/relationships",Vs="application/vnd.openxmlformats-package.relationships+xml",Lc="http://schemas.openxmlformats.org/package/2006/content-types",Us="/[Content_Types].xml",ut="/word/numbering.xml",Bs="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",tn="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",$c=`<Override PartName="${ut}" ContentType="${tn}"/>`;function Qn(e){return `${e.ownerPart}\0${e.id}`}function Ws(e,t,n){let r=new Set(t.externalTargets.filter(s=>s.type===chunkCB6RQ3GD_cjs.bb).map(Qn)),o=n.externalTargets.filter(s=>s.type===chunkCB6RQ3GD_cjs.bb&&!r.has(Qn(s)));if(o.length===0)return e;let a=new Set(e.map(Qn)),i=o.filter(s=>!a.has(Qn(s)));return i.length===0?e:Object.freeze([...e,...i])}function zs(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 Ks(e,t,n=[],r=false){if(e===t)return e;let o=Uc(e,t,r);return o=jc(o,t,n),o}function Gs(e,t){let n=new Set;for(let o of e.externalTargets)o.type===chunkCB6RQ3GD_cjs.bb&&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=zc(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=Kc(r,o);return r}function Uc(e,t,n){let r=t.parts.get(ut);if(!r)return e;let o=e.parts.get(ut),a=n&&o?Bc(o,r):r,i=chunkCB6RQ3GD_cjs.lc(e,a),s=(t.relationships.get(t.mainDocumentPart)??[]).find(d=>d.type===Bs),l=i.relationships.get(i.mainDocumentPart)??[];if(s&&!l.some(d=>d.type===Bs)&&!l.some(d=>d.id===s.id)){let d=Vc(i,{...s,ownerPart:i.mainDocumentPart});d&&(i=d);}if(i.contentTypes.overrides.get(chunkCB6RQ3GD_cjs.u(ut))!==tn){let d=Gc(i);d&&(i=d);}return i}function Bc(e,t){let n="http://schemas.openxmlformats.org/wordprocessingml/2006/main",r=l=>{if(l.kind==="textValue"||l.namespaceUri!==n)return null;let d=l.localName==="abstractNum"?"abstractNumId":l.localName==="num"?"numId":l.localName==="numPicBullet"?"numPicBulletId":null;if(!d)return null;let c=l.attributes.find(u=>u.namespaceUri===n&&u.localName===d)?.value;return c===void 0?null:`${l.localName}:${c}`},o=new Set(e.root.children.map(r).filter(Boolean)),a=chunkCB6RQ3GD_cjs.Fa(e),i=["numPicBullet","abstractNum","num","numIdMacAtCleanup"],s=e;for(let l of t.root.children){let d=r(l);if(!d||o.has(d)||l.kind==="textValue")continue;let c=i.indexOf(l.localName),u=s.root.children.findIndex(P=>P.kind!=="textValue"&&P.namespaceUri===n&&i.indexOf(P.localName)>c),p=chunkCB6RQ3GD_cjs.La(s,s.root.id,u<0?s.root.children.length:u,[Oo(l,a)]);p.ok&&(s=p.part,o.add(d));}return s}function jc(e,t,n){let r=n.filter(a=>a.type===chunkCB6RQ3GD_cjs.bb);if(r.length===0)return e;let o=e;for(let a of r){let i=Hc(e,t,a.ownerPart);if(!i||o.externalTargets.some(d=>d.ownerPart===i&&d.id===a.id)||new Set((o.relationships.get(i)??[]).map(d=>d.id)).has(a.id))continue;let l=Wc(o,{ownerPart:i,id:a.id,type:chunkCB6RQ3GD_cjs.bb,rawTarget:a.rawTarget,sinkSafe:a.sinkSafe},i);l&&(o=l);}return o}function Hc(e,t,n){return n===t.mainDocumentPart?e.mainDocumentPart:typeof n!="string"||n.length===0?null:n}function Vc(e,t){let n=e.mainDocumentPart,r=Io(n),o=e.parts.get(r),a=chunkCB6RQ3GD_cjs.xa(`<Relationships xmlns="${Hs}"><Relationship Id="${chunkCB6RQ3GD_cjs.P(t.id,"relationship id")}" Type="${chunkCB6RQ3GD_cjs.P(t.type,"relationship type")}" Target="${chunkCB6RQ3GD_cjs.P(t.rawTarget,"relationship target")}"/></Relationships>`,{name:r,contentType:Vs});if(!a.ok)return null;let i=e.relationships.get(n)??[];if(i.some(d=>d.id===t.id))return null;let s={...t,ownerPart:n,order:i.reduce((d,c)=>Math.max(d,c.order),-1)+1},l=new Map([...e.relationships,[n,[...i,s]]]);return o?Xs(e,o,a.part.root.children[0],l):Object.freeze({...e,parts:new Map([...e.parts,[r,a.part]]),relationships:l})}function Wc(e,t,n=e.mainDocumentPart){let r=n;if(typeof r!="string"||r.length===0)return null;let o=Io(r),a=e.parts.get(o),i=chunkCB6RQ3GD_cjs.xa(`<Relationships xmlns="${Hs}"><Relationship Id="${chunkCB6RQ3GD_cjs.P(t.id,"relationship id")}" Type="${chunkCB6RQ3GD_cjs.bb}" Target="${chunkCB6RQ3GD_cjs.P(t.rawTarget,"relationship target")}" TargetMode="External"/></Relationships>`,{name:o,contentType:Vs});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=Xs(e,a,i.part.root.children[0],e.relationships);return l?Object.freeze({...l,externalTargets:s}):null}function Xs(e,t,n,r){if(!n)return null;let o=chunkCB6RQ3GD_cjs.Fa(t),a=chunkCB6RQ3GD_cjs.La(t,t.root.id,t.root.children.length,[Oo(n,o)]);return a.ok?Object.freeze({...e,parts:new Map([...e.parts,[t.name,a.part]]),relationships:r}):null}function Oo(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>Oo(n,t))}}function Io(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function zc(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 Kc(e,t){let n=Io(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 Gc(e){let t=e.contentTypes.overrides.get(chunkCB6RQ3GD_cjs.u(ut));if(t===tn)return e;if(t!==void 0)return null;let n=e.partBytes.get(Us);if(!n)return null;let r=fflate.strFromU8(n),o=js(r);if(!o)return null;let a=r.lastIndexOf(`</${o.rootName}>`);if(a===-1)return null;let i=r.slice(0,a)+$c+r.slice(a),s=js(i);if(!s||s.rootName!==o.rootName)return null;let l=[...o.children,Ys("Override",{PartName:ut,ContentType:tn})];return s.children.length!==l.length||s.children.some((d,c)=>d!==l[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[Us,fflate.strToU8(i)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunkCB6RQ3GD_cjs.u(ut),tn]])})})}function js(e){let t=chunkCB6RQ3GD_cjs.X(e);if(!t.ok)return null;let n=t.nodes.filter(s=>s.type==="element");if(n.length!==1)return null;let r=n[0],o=r.name.indexOf(":"),a=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[a?`xmlns:${a}`:"xmlns"]!==Lc)return null;let i=[];for(let s of r.children)s.type==="element"&&i.push(Ys(s.name,s.attributes));return {rootName:r.name,children:i}}function Ys(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}var Js=4e3,qs=64;function Qs(e){return chunkCB6RQ3GD_cjs.$f(e,"footnote")!==null||chunkCB6RQ3GD_cjs.$f(e,"endnote")!==null}function Zs(e,t,n,r){if(!Qs(e))return false;if(r.has(n.paragraphId))return true;r.add(n.paragraphId);let o=chunkCB6RQ3GD_cjs.Ha(t,n.paragraphId);return !o||o.kind!=="paragraph"?true:chunkCB6RQ3GD_cjs.Xe(o).some(a=>a.node.kind==="noteReference"&&a.start<n.end&&a.end>n.start)}function el(e,t,n,r){if(!Qs(e))return false;if(r.has(n.blockId))return true;r.add(n.blockId);let o=chunkCB6RQ3GD_cjs.Ha(t,n.blockId);if(!o||o.kind==="textValue")return true;let a=0,i=(s,l)=>{if(a>=Js||l>qs)return true;if(a+=1,s.kind==="textValue")return false;if(s.kind==="paragraph")return chunkCB6RQ3GD_cjs.Xe(s).some(d=>d.node.kind==="noteReference");for(let d of s.children)if(i(d,l+1))return true;return false};return i(o,0)}function tl(e,t,n){if(n.count>=Js||t>qs)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(tl(r,t+1,n))return true;return false}function nl(e,t,n,r){if(!chunkCB6RQ3GD_cjs.Fg(e))return false;let o=n.op==="deleteText"?n.paragraphId:n.blockId;if(r.has(o))return true;r.add(o);let a=chunkCB6RQ3GD_cjs.Ha(t,o);return !a||a.kind==="textValue"?true:tl(a,0,{count:0})}var bo="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",So="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function rl(e,t){let r=(e.relationships.get(e.mainDocumentPart)??[]).find(o=>o.id===t);return r?r.type!==bo&&r.type!==So?{ok:false,reason:"wrong-relationship-type",detail:r.type}:Xc(e,r):{ok:false,reason:"dangling-relationship",detail:t}}function Xc(e,t){let n=chunkCB6RQ3GD_cjs.E(t);if(n.mode==="External")return {ok:false,reason:"external-relationship",detail:t.id};if(!n.target.ok)return {ok:false,reason:"bad-relationship-target",detail:n.target.reason};let r=e.parts.get(n.target.partName);if(!r)return {ok:false,reason:"missing-part",detail:n.target.partName};let o=r.root.localName;return o!=="hdr"&&o!=="ftr"?{ok:false,reason:"not-a-story-part",detail:o||r.name}:{ok:true,partName:r.name,part:r}}function pt(e,t){return t.compositionActive||e.compositionSessionOpen()?{ok:false,reason:"invalidArgs",detail:"ime-composition-active"}:null}function ol(e,t){let n=chunkCB6RQ3GD_cjs.Ha(e,t);return !n||n.kind!=="drawing"?null:n.children.find(o=>o.kind==="inlineDrawing"||o.kind==="anchoredDrawing")??null}function al(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=chunkCB6RQ3GD_cjs.Ha(r,n);return !o||o.kind!=="drawing"?null:chunkCB6RQ3GD_cjs.rb(o,{ownerPartName:t,supportedMcRequires:chunkCB6RQ3GD_cjs.kb,limits:chunkCB6RQ3GD_cjs.jb,resolveRelationship:chunkCB6RQ3GD_cjs.mb(e,t)})}function il(e,t,n){let r=chunkCB6RQ3GD_cjs.F(e.relationships.get(t)??[],t,n);return r.mode==="internal"?r.partName:null}function At(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=pt(e,o.store);if(a)return a;let{store:i,story:s}=o;return chunkCB6RQ3GD_cjs.Ca(e,()=>Yc(e,i,s,n,r),l=>chunkCB6RQ3GD_cjs.Da(l))}function Yc(e,t,n,r,o){let a=n.partName,i=e.currentPackage(),s=t.checkpoint(),l=null,d=false,c=false,u=t.transact(m=>{if(o?.commitGuard?.()===false){c=true;return}if(o?.expectedPackageRevision!==void 0&&e.packageRevision!==o.expectedPackageRevision){d=true;return}let h=r(m,a);if(h===null){m.apply({op:"insertText",paragraphId:"\0task12-abort",offset:0,text:"x"});return}l=h;},{story:n,...o?.actorId?{actorId:o.actorId}:{},...n.kind==="headerFooter"||n.kind==="notesPart"?{minimumImpact:"global"}:{}});if(c)return {ok:false,reason:"invalidArgs",detail:"stale drawing selection"};if(d)return {ok:false,reason:"invalidArgs",detail:"stale-package-epoch"};if(!u.ok)return {ok:false,reason:u.reason,...u.detail?{detail:u.detail}:{}};if(!u.change)return {ok:true,change:null};let p=u.change.created.find(m=>{let h=t.part;return chunkCB6RQ3GD_cjs.Ha(h,m)?.kind==="drawing"});return p&&(l=p),{ok:true,change:e.promoteStoryTransactionToPackageUnit(i,t,s),...l?{drawingNodeId:l}:{}}}function sl(e,t,n){let r=e.parts.get(t);if(!r)return null;let o=ol(r,n);return o?chunkCB6RQ3GD_cjs.Ji(o):null}function No(e,t,n,r){let o=false;return e.applyPackage(a=>{let i=a.parts.get(t);if(!i)return a;let s=chunkCB6RQ3GD_cjs.Ha(i,n);if(!s||s.kind!=="drawing")return a;let l=ol(i,n);if(!l)return a;let d=chunkCB6RQ3GD_cjs.Ki(l,r),c=Jc(s,d),u=chunkCB6RQ3GD_cjs.Ma(i,s.id,c,{deferValidation:true});return u.ok?(o=true,chunkCB6RQ3GD_cjs.lc(a,u.part)):a}),o}function Jc(e,t){return {...e,children:e.children.map(n=>n.id===t.id?t:n)}}async function ll(e,t,n){let r=chunkCB6RQ3GD_cjs.dc(n.widthPoints),o=chunkCB6RQ3GD_cjs.dc(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=pt(e,a.store);if(i)return i;let s=a.story.partName,l=await chunkCB6RQ3GD_cjs._b(n.decodePort,n.bytes,n.mime);if(!l.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let d=l.bytes,c=chunkCB6RQ3GD_cjs.ac(e.currentPackage(),s,{bytes:d,mime:n.mime});if(!c.ok)return {ok:false,reason:"invalidArgs",detail:c.reason==="invalid-image"?"invalid-image":c.reason};let u=c.partName,p=At(e,t,(P,m)=>{let h=e.currentPackage(),g=chunkCB6RQ3GD_cjs.ac(h,m,{bytes:d,mime:n.mime});if(!g.ok)return null;h=g.pkg,u=g.partName;let x;if(n.hyperlink){let f=chunkCB6RQ3GD_cjs.Ef(h,n.hyperlink,m);if(!f)return null;h=f.pkg,x=f.relationshipId;}if(!P.applyPackage(()=>h))return null;let k=chunkCB6RQ3GD_cjs.ec({docPrId:g.docPrId,relationshipId:g.relationshipId,extentEmu:{cx:r,cy:o},...n.title!==void 0?{title:n.title}:{},...n.description!==void 0?{description:n.description}:{},...x?{hyperlinkRelationshipId:x}:{}});return P.apply({op:"insertDrawing",paragraphId:n.paragraphId,offset:n.offset,drawing:k,...n.revision?{revision:n.revision}:{}})?k.id:null},{expectedPackageRevision:n.expectedPackageRevision,...n.commitGuard?{commitGuard:n.commitGuard}:{},...n.actorId?{actorId:n.actorId}:{}});return p.ok?p.change?{...p,mediaPartName:u}:{ok:true,change:null,mediaPartName:u}:p}async function wo(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=pt(e,s.store);if(l)return l;let d=s.story.partName,c=await chunkCB6RQ3GD_cjs._b(a,r,o);if(!c.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let u=c.bytes,p=chunkCB6RQ3GD_cjs.ac(e.currentPackage(),d,{bytes:u,mime:o});return p.ok?At(e,t,(P,m)=>{let h=e.currentPackage(),g=al(h,d,n),x=g?.picture?.embeddedRelationshipId??null,k=g?.picture?.linkedRelationshipId??null,f=x??k;if(!f)return null;let v=x!==null?il(h,d,x):null,O=h,R=chunkCB6RQ3GD_cjs.ac(O,m,{bytes:u,mime:o});return !R.ok||(O=R.pkg,!P.applyPackage(()=>O))||!P.apply({op:"replaceDrawingResource",drawingNodeId:n,relationshipId:R.relationshipId})?null:(P.applyPackage(y=>chunkCB6RQ3GD_cjs.gc(y,m,v,f)),n)},{expectedPackageRevision:i.expectedPackageRevision,...i.commitGuard?{commitGuard:i.commitGuard}:{},...i.actorId?{actorId:i.actorId}:{}}):{ok:false,reason:"invalidArgs",detail:p.reason==="invalid-image"?"invalid-image":p.reason}}function dl(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=pt(e,r.store);if(o)return o;let a=r.story.partName,i=e.currentPackage(),s=al(i,a,n);if(!s)return {ok:false,reason:"unknown-drawing"};let l=s.picture?.embeddedRelationshipId??null,d=s.picture?.linkedRelationshipId??null,c=l??d,u=l!==null?il(i,a,l):null;return At(e,t,(p,P)=>p.apply({op:"deleteDrawing",drawingNodeId:n})?(p.applyPackage(m=>chunkCB6RQ3GD_cjs.gc(m,P,u,c)),n):null)}function qc(e,t){let n=null,r=a=>{let i=false,s=false,l=(d,c)=>{if(i||d.kind==="textValue")return;if(d.id===t){i=true,s=c;return}let u=c||d.kind==="revisionDelete"||d.kind==="revisionMoveFrom";for(let p of d.children)l(p,u);};return l(a,false),s},o=a=>{if(!(n!==null||a.kind==="textValue")){if(a.kind==="paragraph"){let i=chunkCB6RQ3GD_cjs.Ze(a).spanOf(t);if(i!==null&&i.end>i.start){let s=chunkCB6RQ3GD_cjs.Ha(e,t);if(!s||s.kind!=="drawing"&&!chunkCB6RQ3GD_cjs.nb(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 cl(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=pt(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=qc(i,n);return s?s.alreadyDeleted?{ok:true,change:null}:At(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 ml(e,t,n,r,o,a,i,s){let l=await chunkCB6RQ3GD_cjs.hc(o,r,a,void 0,i);return l.ok?wo(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 ul(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=pt(e,i.store);return s||At(e,t,(l,d)=>{let c=sl(e.currentPackage(),d,n),u=null;if(a!==null){let P=chunkCB6RQ3GD_cjs.Ef(e.currentPackage(),a,d);if(!P||!l.applyPackage(()=>P.pkg))return null;u=P.relationshipId;}if(!l.apply({op:"setDrawingMetadata",drawingNodeId:n,title:r,description:o,...a===null?{hyperlink:null}:{}}))return null;if(a!==null&&u!==null){if(!No(l,d,n,u))return null}else if(a===null&&!No(l,d,n,null))return null;let p=false;return l.applyPackage(P=>{let m=chunkCB6RQ3GD_cjs.Gf(P,d,c);return m===null?(p=true,P):m}),p?null:n})}function pl(e,t,n){let r=e.resolveStory(t);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let o=pt(e,r.store);return o||At(e,t,(a,i)=>{let s=sl(e.currentPackage(),i,n.drawingNodeId),l=null;if(n.hyperlink!==null){let c=chunkCB6RQ3GD_cjs.Ef(e.currentPackage(),n.hyperlink,i);if(!c||!a.applyPackage(()=>c.pkg))return null;l=c.relationshipId;}for(let c of n.ops)if(!a.apply(c))return null;if(!No(a,i,n.drawingNodeId,n.hyperlink===null?null:l))return null;let d=false;return a.applyPackage(c=>{let u=chunkCB6RQ3GD_cjs.Gf(c,i,s);return u===null?(d=true,c):u}),d?null:n.drawingNodeId})}function Qc(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 fl(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 Zc(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 em(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)=>!Zc(a,o[i])))return false}return true}function tm(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 nm(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||!Qc(r,o))return false}return true}function rm(e,t){return e.contentTypes===t.contentTypes||fl(e.contentTypes.defaults,t.contentTypes.defaults)&&fl(e.contentTypes.overrides,t.contentTypes.overrides)}var Zn=Object.freeze({equal:true,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"}),er=Object.freeze({equal:false,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"});function gl(e){for(let[t,n]of e)if(!chunkCB6RQ3GD_cjs.sa(t,n))return er;return Zn}function om(e,t){if(e===t)return Zn;if(e.mainDocumentPart!==t.mainDocumentPart||e.parts.size!==t.parts.size||!nm(e.partBytes,t.partBytes)||!em(e.relationships,t.relationships)||!tm(e.externalTargets,t.externalTargets)||!rm(e,t))return er;let n=[];for(let[i,s]of e.parts){let l=t.parts.get(i);if(!l)return er;s!==l&&n.push([s,l]);}if(n.length===0)return Zn;let[r,o]=n[0];if(n.length>1||r.name!==e.mainDocumentPart)return gl(n);let a=chunkCB6RQ3GD_cjs.ta(o.root,r.root);return a.undecided?gl(n):a.equal?Zn:!a.idsPreserved||a.reach==="outside-paragraph"||a.paragraphIds.length===0?er:{equal:false,dirty:a.paragraphIds,dependencyKeys:[chunkCB6RQ3GD_cjs.g.story],impact:a.reach==="paragraph-text"?"text-local":"flow-structural"}}function Eo(e){return {ok:false,reason:"package-invariant",detail:e}}function am(e,t){if(!e.parts.get(e.mainDocumentPart))return Eo("no-main-document");for(let[r,o]of e.parts){let a=t?.parts.get(r);if(a===o)continue;let i=a?chunkCB6RQ3GD_cjs.va(a,o):chunkCB6RQ3GD_cjs.ua(o);if(!i.ok)return Eo(`invalid-part:${r}:${i.issues[0]?.code??"invalid"}`)}let n=chunkCB6RQ3GD_cjs.vc(e);return n.ok?null:Eo(n.issues[0]?.code??"package-invariant")}function hl(e,t,n){let r=e.currentPackage(),o=om(t,r);if(o.equal)return {ok:true,change:null};let a=am(t,r);if(a)return a;let i=e.bodyStore().part.name,s=o.impact!=="global"&&t.mainDocumentPart===i;return chunkCB6RQ3GD_cjs.Ca(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 kl(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)yl(i,o,a);for(let i of r)yl(i,o,a);return a}function Pl(e,t,n,r,o){let a=new Set(e);a.add(t),a.add(n);for(let i of r)xl(i,a);for(let i of o)xl(i,a);return a}function yl(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 xl(e,t){if(e.kind==="story"){t.add(e.partName);return}for(let n of e.before.parts.keys())t.add(n);for(let n of e.after.parts.keys())t.add(n);}var Rl=new Set(["acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions"]),vl=new Set(["authorTable","deleteTableRow","deleteTableColumn","removeContentControl","removeRepeatingSectionItem"]),Ol=64,nn=class{pkg;packageRev=0;body;stories=new Map;rIdToPartName=new Map;undoOrder=[];redoOrder=[];subscribers=new Set;historyLimit;maxEditableStoryParts;cascadeNoteReferences;lastChange=null;shellHyperlinks=Object.freeze([]);compositionSession=null;commitCounter=0;currentPackageMemo=null;constructor(t,n,r={}){this.pkg=chunkCB6RQ3GD_cjs.lc(t,n),this.historyLimit=r.historyLimit??200,this.maxEditableStoryParts=r.maxEditableStoryParts??Ol,this.cascadeNoteReferences=r.cascadeDeletedNoteReferences??chunkCB6RQ3GD_cjs.sg,this.body=new mt(this.pkg,n.name,{historyLimit:this.historyLimit,settingsPart:()=>chunkCB6RQ3GD_cjs.Qf(this.pkg)}),this.body.setStoryRef({kind:"body",partName:n.name});}get packageRevision(){return this.packageRev}get canUndo(){return this.undoOrder.length>0}get canRedo(){return this.redoOrder.length>0}get lastModelChange(){return this.lastChange}bodyStore(){return this.body}currentPackage(){let t=this.currentPackageMemo;if(t&&t.pkg===this.pkg&&t.bodyPart===this.body.part){let o=0,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=chunkCB6RQ3GD_cjs.lc(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=chunkCB6RQ3GD_cjs.lc(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 chunkCB6RQ3GD_cjs.Ca(this,()=>this.commitStoryTransaction(t,n,r),chunkCB6RQ3GD_cjs.Da,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.historyDepth,d=a.compositionActive,c=a.checkpoint(),u=false,p=new Set,P=false,m=new Set,h=false,g,x=false,k;a.graftPackage(()=>this.currentPackage());let f=a.transact(R=>{k=As(R),n({...R,applyTo:(y,T)=>{let w=R.applyTo(y,T);return w&&y!==i.partName&&(x=true),w},applyPackage:y=>R.applyPackage(T=>{let w=y(T);return w!==T&&!x&&(x=Fs(T,w,i.partName)),w}),apply:y=>(y.op==="setListNumbering"&&y.numId!==null&&(h=true),y.op==="setParagraphProperties"&&(g??=y.properties.find(T=>T.localName==="pStyle")?.attributes?.val),u||(y.op==="deleteText"&&Zs(this.pkg,a.part,y,p)||y.op==="deleteBlock"&&el(this.pkg,a.part,y,p)||Rl.has(y.op)||vl.has(y.op))&&(u=true),P||(y.op==="deleteText"||y.op==="deleteBlock"?P=nl(this.pkg,a.part,y,m):(Rl.has(y.op)||vl.has(y.op))&&(P=true)),R.apply(y)),...k.context});},{...r,story:i,...i.kind==="headerFooter"||i.kind==="notesPart"?{minimumImpact:"global"}:{}});if(!f.ok)return {ok:false,reason:f.reason,...f.detail?{detail:f.detail}:{}};this.syncPackageFromStore(a);let v=false;if(f.change&&x&&(this.installPackageSnapshotInternal(a.package,false),d?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(c),v=true),h&&g){let R=$s(this.pkg,g);R&&this.replacePackageShell(R);}let O=false;if(f.change&&u){let R=this.currentPackage(),y=this.cascadeNoteReferences(s,R);if(y===null)return a.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"note-cascade-failed"};y!==R&&(this.installPackageSnapshotInternal(y),d?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(c),O=true);}if(f.change&&P){let R=this.currentPackage(),y=chunkCB6RQ3GD_cjs.Jg(s,R,{storyPartName:i.partName});if(y===null)return a.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"comment-cascade-failed"};y!==R&&(this.installPackageSnapshotInternal(y),d?this.compositionSession&&(this.compositionSession.packageWideEffects=true):a.restoreHistoryStacks(c),O=true);}if(f.change){this.packageRev+=1;let R=O||v;R&&chunkCB6RQ3GD_cjs.bj(r.historyGroup,"split","package-unit"),!d&&r.recordsHistory!==false&&(a.historyDepth>l||R)&&(R?this.pushUndoPointer({kind:"package",before:s,after:this.currentPackage(),...k?.snapshot(f.change.caret)}):this.pushUndoPointer({kind:"story",partName:i.partName,story:i}));let y=R?this.publishSynthetic(f.change.origin,"global",i,f.change.created):f.change;return R||this.publish(y),{ok:true,change:y}}return {ok:true,change:f.change}}compositionSessionOpen(){return this.compositionSession!==null}beginComposition(t,n=null){let r=this.resolveStory(t);return !r.ok||this.compositionSession&&this.compositionSession.partName!==r.story.partName&&(this.endComposition(),r=this.resolveStory(t),!r.ok)?false:(this.compositionSession||(this.compositionSession={partName:r.story.partName,beforePackage:this.currentPackage(),storyCheckpoint:r.store.checkpoint(),packageWideEffects:false}),r.store.beginComposition(n),true)}endComposition(){let t=this.compositionSession;if(this.compositionSession=null,!t){this.body.endComposition();return}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return;let r=n.historyDepth;if(n.endComposition(),t.packageWideEffects){n.restoreHistoryStacks(t.storyCheckpoint),this.syncPackageFromStore(n),this.pushUndoPointer({kind:"package",before:t.beforePackage,after:this.currentPackage()});return}if(n.historyDepth>r){let o=t.partName===this.body.part.name?{kind:"body",partName:t.partName}:this.storyRefForPart(t.partName);o&&this.pushUndoPointer({kind:"story",partName:t.partName,story:o});}this.syncPackageFromStore(n);}cancelComposition(){let t=this.compositionSession;if(this.compositionSession=null,!t){this.body.cancelComposition();return}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(t.packageWideEffects){n&&n.restoreCheckpoint(t.storyCheckpoint),this.installPackageSnapshotInternal(t.beforePackage),this.packageRev+=1;let r=t.partName===this.body.part.name?{kind:"body",partName:t.partName}:this.storyRefForPart(t.partName);this.publishSynthetic(chunkCB6RQ3GD_cjs.b.mutationHuman,"global",r??{kind:"body",partName:this.body.part.name},[]);return}n?.cancelComposition();}applyLifecycleOp(t){return chunkCB6RQ3GD_cjs.Ca(this,()=>this.commitLifecycleOp(t),chunkCB6RQ3GD_cjs.Da)}commitLifecycleOp(t){let n=this.currentPackage(),r=chunkCB6RQ3GD_cjs.li(chunkCB6RQ3GD_cjs.Qf(n),t);if(r)return {ok:false,reason:r};if(chunkCB6RQ3GD_cjs.qg(t)){let s=chunkCB6RQ3GD_cjs.rg(n,t);if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};if(s.package===n)return {ok:true,change:null};this.installPackageSnapshotInternal(s.package),this.pushUndoPointer({kind:"package",before:n,after:s.package}),this.packageRev+=1;let l={kind:"body",partName:this.body.part.name},d=this.publishSynthetic(chunkCB6RQ3GD_cjs.b.mutationHuman,s.impact,l,s.createdPartName?[s.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:d}}if(!chunkCB6RQ3GD_cjs.Jf(t))return {ok:false,reason:"invalidArgs",detail:"not-lifecycle-op"};let o=chunkCB6RQ3GD_cjs.Kf(n,t);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};this.installPackageSnapshotInternal(o.package),this.pushUndoPointer({kind:"package",before:n,after:o.package}),this.packageRev+=1;let a={kind:"body",partName:this.body.part.name},i=this.publishSynthetic(chunkCB6RQ3GD_cjs.b.mutationHuman,o.impact,a,o.createdPartName?[o.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:i}}undo(){let t=this.undoOrder.pop();if(!t)return null;if(chunkCB6RQ3GD_cjs.$i(this.body,this.stories,null),t.kind==="package"){this.installPackageSnapshotInternal(t.before,true,t.restoreNumbering),this.redoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkCB6RQ3GD_cjs.b.mutationUndo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),o}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return null;let r=n.undo();return r?(this.redoOrder.push(t),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}redo(){let t=this.redoOrder.pop();if(!t)return null;if(chunkCB6RQ3GD_cjs.$i(this.body,this.stories,null),t.kind==="package"){this.installPackageSnapshotInternal(t.after,true,t.restoreNumbering),this.undoOrder.push(t),this.packageRev+=1;let o=this.publishSynthetic(chunkCB6RQ3GD_cjs.b.mutationRedo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),o}let n=t.partName===this.body.part.name?this.body:this.stories.get(t.partName);if(!n)return null;let r=n.redo();return r?(this.undoOrder.push(t),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}selectionForUndo(){return Ro(this.undoOrder.at(-1),this.body,this.stories,"undo")}selectionForRedo(){return Ro(this.redoOrder.at(-1),this.body,this.stories,"redo")}openStoryParts(){return vo(this.stories,this.pkg)}openedStoryCount(){return 1+this.stories.size}openStoryToken(){return Ds(this.stories,this.pkg)}insertImage(t,n){return ll(this,t,n)}applyFragmentPaste(t,n){return Po(this,t,n)}replaceImage(t,n,r,o,a,i){return wo(this,t,n,r,o,a,i)}deleteImage(t,n){return dl(this,t,n)}deleteImageTracked(t,n,r){return cl(this,t,n,r)}embedExternalImage(t,n,r,o,a,i,s){return ml(this,t,n,r,o,a,i,s)}setDrawingMetadataWithHyperlink(t,n,r,o,a){return ul(this,t,n,r,o,a)}applyImageProperties(t,n){return pl(this,t,n)}promoteStoryTransactionToPackageUnit(t,n,r,o){this.installPackageSnapshotInternal(n.package),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(chunkCB6RQ3GD_cjs.b.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){let n=this.currentPackage();t!==n&&this.pushUndoPointer({kind:"package",before:t,after:n});}installPackageSnapshot(t){this.installPackageSnapshotInternal(t);}installAuthoritativePackageSnapshot(t){this.installPackageSnapshotInternal(t,false);}publishRemotePackage(t,n){return hl(this,t,n)}replacePackageShell(t){this.shellHyperlinks=Ws(this.shellHyperlinks,this.pkg,t);let n=t;n=chunkCB6RQ3GD_cjs.lc(n,this.body.part);for(let r of this.stories.values())t.parts.has(r.part.name)&&(n=chunkCB6RQ3GD_cjs.lc(n,r.part));this.pkg=n;}installPackageSnapshotInternal(t,n=true,r=false){let o=n?Ks(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 d=o.parts.get(s);d&&l.replacePart(d);}this.rIdToPartName.clear();let i=o.relationships.get(o.mainDocumentPart)??[];for(let s of i){if(s.type!==bo&&s.type!==So)continue;let l=chunkCB6RQ3GD_cjs.E(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=chunkCB6RQ3GD_cjs.lc(this.pkg,this.body.part);for(let s of this.stories.values())this.pkg.parts.has(s.part.name)&&(this.pkg=chunkCB6RQ3GD_cjs.lc(this.pkg,s.part));}openNotesPartStore(t){let n=chunkCB6RQ3GD_cjs.$f(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=chunkCB6RQ3GD_cjs.Qb(n),a=new mt(o,{historyLimit:this.historyLimit,settingsPart:()=>chunkCB6RQ3GD_cjs.Qf(this.pkg)}),i={kind:"notesPart",partName:o.name,noteKind:t};return a.setStoryRef(i),this.stories.set(o.name,a),o!==n&&(this.pkg=chunkCB6RQ3GD_cjs.lc(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=rl(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=chunkCB6RQ3GD_cjs.Qb(r.part),i=new mt(a,{historyLimit:this.historyLimit,settingsPart:()=>chunkCB6RQ3GD_cjs.Qf(this.pkg)}),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=chunkCB6RQ3GD_cjs.lc(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=chunkCB6RQ3GD_cjs.lc(this.pkg,t.part);}pushUndoPointer(t){chunkCB6RQ3GD_cjs.$i(this.body,this.stories,t),t.kind==="package"&&t.before.parts.get("/word/numbering.xml")!==t.after.parts.get("/word/numbering.xml")&&(t={...t,restoreNumbering:true}),this.undoOrder.push(t),this.redoOrder.length=0,this.undoOrder.length>this.historyLimit&&this.undoOrder.shift(),this.evictUnreachableStories();}evictUnreachableStories(){let t=kl(this.pkg,this.stories.keys(),this.undoOrder,this.redoOrder);for(let[o]of [...this.stories])if(!t.has(o)){this.stories.delete(o);for(let[a,i]of [...this.rIdToPartName])i===o&&this.rIdToPartName.delete(a);}let n=Pl(t,this.pkg.mainDocumentPart,this.body.part.name,this.undoOrder,this.redoOrder),r=Gs(this.pkg,n);r!==this.pkg&&(this.pkg=r),this.shellHyperlinks=zs(this.shellHyperlinks,n,this.pkg.mainDocumentPart);}publish(t){this.lastChange=t;for(let n of this.subscribers)n(t);}publishSynthetic(t,n,r,o){this.commitCounter+=1;let a=this.packageRev-1,i={change:"model-change",fromRevision:a<0?0:a,toRevision:this.packageRev,commitId:`pkg-commit-${this.commitCounter}`,origin:t,dirty:[],created:[...o],deleted:[],splitJoin:[],dependencyKeys:[],impact:n,story:r};return this.publish(i),i}};var im=256,sm=65535,Il=64;function tr(e,t){return e.length>t}function bl(e){return typeof e!="string"||e.trim().length===0?"invalid-author":tr(e,im)?"resource-limit":chunkCB6RQ3GD_cjs.O(e)?null:"invalid-author"}function Sl(e){return typeof e!="string"||e.length===0?"invalid-text":tr(e,sm)?"resource-limit":chunkCB6RQ3GD_cjs.O(e)?null:"invalid-text"}function To(e){if(typeof e!="string")return {ok:false,rejection:"invalid-date"};let t=e.trim();if(tr(t,Il))return {ok:false,rejection:"resource-limit"};if(!chunkCB6RQ3GD_cjs.O(t))return {ok:false,rejection:"invalid-date"};let n=chunkCB6RQ3GD_cjs.Qe(t);return n===null?{ok:false,rejection:"invalid-date"}:tr(n,Il)?{ok:false,rejection:"resource-limit"}:{ok:true,value:n}}function kh(e){if(e===void 0)return null;let t=To(e);return t.ok?null:t.rejection}function Co(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 lm(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Mo(e,t){if(!e){let i=chunkCB6RQ3GD_cjs.Tb(t);return i?chunkCB6RQ3GD_cjs.Ub(new Set,i,chunkCB6RQ3GD_cjs.Rb):"0"}let n=-1,r=new Set,o=i=>{if(i.kind!=="textValue"){if(i.kind==="comment"){let s=lm(i,chunkCB6RQ3GD_cjs.da,"id");if(s!==void 0&&/^\d{1,10}$/.test(s)){let l=Number(s);Number.isSafeInteger(l)&&l<=chunkCB6RQ3GD_cjs.Rb&&(r.add(String(l)),l>n&&(n=l));}}for(let s of i.children)o(s);}};o(e.root);let a=chunkCB6RQ3GD_cjs.Tb(t);return a?chunkCB6RQ3GD_cjs.Ub(r,a,chunkCB6RQ3GD_cjs.Rb):String(n+1)}function Nl(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=Nl(a,t);i!==a&&(r=true),o.push(i);}return r?{...e,children:o}:e}function mm(e,t,n){let r=Nl(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:chunkCB6RQ3GD_cjs.ga}]};return chunkCB6RQ3GD_cjs.Ma(e,e.root.id,o,{deferValidation:true})}function wl(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=chunkCB6RQ3GD_cjs.Ob(s.root),d=l??"w14",c=new Map;for(let p of i.values())c.set(p.paragraph.id,n(p.paragraph,p.paraId,d));let u=mm(s,c,l===null?d:null);if(!u.ok)return null;o=chunkCB6RQ3GD_cjs.lc(o,u.part);}return o}function El(e,t,n){let r=e.root.children.map(o=>o.kind==="textValue"?o:t.get(o.id)??o);return chunkCB6RQ3GD_cjs.Ka(e,e.root.id,[...r,...n],{deferValidation:true})}var Ml="/word/comments.xml",Al="/word/commentsExtended.xml",Lo="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",$o="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",um=[$o,"application/vnd.ms-word.commentsExtended+xml"],Dl="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Uo="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Ze="http://schemas.microsoft.com/office/word/2012/wordml";function on(e,t,n){for(let r of e.attributes)if(r.localName===n&&r.namespaceUri===t)return r.value}function Dt(e,t){return {kind:"genericExtension",namespaceUri:chunkCB6RQ3GD_cjs.da,localName:e,prefix:"w",value:t}}function Xe(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 Fl(e,t,n,r,o){let a=t===e.mainDocumentPart?[t]:[t,e.mainDocumentPart];for(let i of a)for(let s of chunkCB6RQ3GD_cjs.nc(e,i)){if(s.type!==n)continue;let l=chunkCB6RQ3GD_cjs.w(i,s.rawTarget);if(!l.ok)continue;if(!e.parts.has(l.partName))return l.partName;let d=chunkCB6RQ3GD_cjs.oc(e,l.partName);if(d!==null&&(typeof r=="string"?d===r:r.includes(d)))return l.partName}return o}function Ao(e,t,n){let r=e.mainDocumentPart;for(let a of chunkCB6RQ3GD_cjs.nc(e,r)){if(a.type!==t)continue;let i=chunkCB6RQ3GD_cjs.w(r,a.rawTarget);if(i.ok&&i.partName===n)return e}let o=chunkCB6RQ3GD_cjs.sc(e,r);return chunkCB6RQ3GD_cjs.tc(o,r,t,chunkCB6RQ3GD_cjs.Wg(r,n)).pkg}function Bo(e,t){return Fl(e,t,Dl,Lo,Ml)}function _l(e,t){let n=chunkCB6RQ3GD_cjs.vg(e,t),r=chunkCB6RQ3GD_cjs.wg(e,t,n).extended;return r!==null?r:Fl(e,t,Uo,um,Al)}function Tl(e){let t=new Set;for(let n of e.parts.values())for(let r of chunkCB6RQ3GD_cjs.Nb(n.root))t.add(r);return t}function pm(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&on(o,chunkCB6RQ3GD_cjs.da,"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=on(i,chunkCB6RQ3GD_cjs.ga,"paraId");s!==void 0&&chunkCB6RQ3GD_cjs.Jb(s)&&(n=s.toUpperCase());return}return}for(let a of o.children)r(a);}};return r(e.root),n}function fm(e,t){if(!e)return null;let n=null,r=o=>{if(!(n!==null||o.kind==="textValue")){if(o.kind==="comment"&&on(o,chunkCB6RQ3GD_cjs.da,"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 Ll(e){let t=chunkCB6RQ3GD_cjs.Ob(e.root);if(t!==null)return {part:e,prefix:t};let n={...e.root,namespaceBindings:[...e.root.namespaceBindings,{prefix:"w14",namespaceUri:chunkCB6RQ3GD_cjs.ga}]},r=chunkCB6RQ3GD_cjs.Ma(e,e.root.id,n,{deferValidation:true});return r.ok?{part:r.part,prefix:"w14"}:(chunkCB6RQ3GD_cjs.Ja(e.root,n),{part:{...e,root:n},prefix:"w14"})}function $l(e,t,n){return Xe(e.id,"paragraph",e.namespaceUri,e.prefix??"w",e.localName,[...e.attributes.filter(r=>!(r.namespaceUri===chunkCB6RQ3GD_cjs.ga&&r.localName==="paraId")),{kind:"genericExtension",namespaceUri:chunkCB6RQ3GD_cjs.ga,localName:"paraId",prefix:n,value:t}],e.children,e.namespaceBindings)}function gm(e,t,n,r){let o=e.parts.get(t);if(!o)return e;let a=Ll(o),i=chunkCB6RQ3GD_cjs.Ha(a.part,n);if(!i||i.kind!=="paragraph")return chunkCB6RQ3GD_cjs.lc(e,a.part);let s=chunkCB6RQ3GD_cjs.Ma(a.part,i.id,$l(i,r,a.prefix),{deferValidation:true});return chunkCB6RQ3GD_cjs.lc(e,s.ok?s.part:a.part)}function hm(e,t,n,r){let o=`${Ml}#comment-${e}`,a=n.text!==n.text.trim(),i=Xe(`${o}.t`,"text",chunkCB6RQ3GD_cjs.da,"w","t",a?[{kind:"xmlSpace",namespaceUri:chunkCB6RQ3GD_cjs.ea,localName:"space",prefix:"xml",value:"preserve"}]:[],[{id:`${o}.tv`,kind:"textValue",value:n.text}]),s=Xe(`${o}.rPr`,"runProperties",chunkCB6RQ3GD_cjs.da,"w","rPr",[],[Xe(`${o}.rStyle`,"generic",chunkCB6RQ3GD_cjs.da,"w","rStyle",[Dt("val","CommentReference")],[])]),l=Xe(`${o}.r`,"run",chunkCB6RQ3GD_cjs.da,"w","r",[],[s,i]),d=Xe(`${o}.pPr`,"paragraphProperties",chunkCB6RQ3GD_cjs.da,"w","pPr",[],[Xe(`${o}.pStyle`,"generic",chunkCB6RQ3GD_cjs.da,"w","pStyle",[Dt("val","CommentText")],[])]),c=Xe(`${o}.p`,"paragraph",chunkCB6RQ3GD_cjs.da,"w","p",[{kind:"genericExtension",namespaceUri:chunkCB6RQ3GD_cjs.ga,localName:"paraId",prefix:r,value:t}],[d,l]);return Xe(o,"comment",chunkCB6RQ3GD_cjs.da,"w","comment",[Dt("id",e),Dt("author",n.author),...n.initials===void 0?[]:[Dt("initials",n.initials)],...n.date===void 0?[]:[Dt("date",n.date)]],[c])}function Do(e,t){let n=chunkCB6RQ3GD_cjs.xa(t,{name:e,contentType:"application/xml"});return n.ok?n.part.root:null}function jo(e,t){for(let x of [bl(t.author),Sl(t.text)])if(x)return {ok:false,reason:Co(x)};let n;if(t.date!==void 0){let x=To(t.date);if(!x.ok)return {ok:false,reason:Co(x.rejection)};n=x.value;}let r={...t,...n===void 0?{}:{date:n}},o=e.package,a=e.part.name,i=Bo(o,a),s=_l(o,a),l=o.parts.get(i),d=Mo(l,r.actorId),c=chunkCB6RQ3GD_cjs.Mb(`${i}#${d}`,Tl(o)),u=t.replyToCommentId===void 0?null:pm(l,t.replyToCommentId),p=t.replyToCommentId!==void 0&&u===null?fm(l,t.replyToCommentId):null;if(t.replyToCommentId!==void 0&&u===null&&!p)return {ok:false,reason:"unknown-revision"};let P=p?chunkCB6RQ3GD_cjs.Mb(`${i}#parent-${t.replyToCommentId}`,new Set([...Tl(o),c])):null,m=u??P,h=t.anchor.endParagraphId??t.anchor.paragraphId,g=e.transact(x=>{let k=en(x);k.applyPackage(f=>{let v=f.parts.has(i)?f:(()=>{let O=Do(i,`<w:comments xmlns:w="${chunkCB6RQ3GD_cjs.da}"/>`);return O?chunkCB6RQ3GD_cjs.uc(f,i,O,Lo):null})();return v===null?f:Ao(v,Dl,i)}),p&&P&&k.applyPackage(f=>gm(f,i,p.id,P)),k.applyPackage(f=>{let v=f.parts.get(i);if(!v)return f;let O=Ll(v),R=chunkCB6RQ3GD_cjs.La(O.part,O.part.root.id,O.part.root.children.length,[hm(d,c,r,O.prefix)],{deferValidation:true});return R.ok?chunkCB6RQ3GD_cjs.lc(f,R.part):f}),m!==null&&(k.applyPackage(f=>{let v=f.parts.has(s)?f:(()=>{let O=Do(s,`<w15:commentsEx xmlns:w15="${Ze}"/>`);return O?chunkCB6RQ3GD_cjs.uc(f,s,O,$o):null})();return v===null?f:Ao(v,Uo,s)}),k.applyPackage(f=>{let v=f.parts.get(s);if(!v)return f;let R=[...ym(v).has(m.toUpperCase())?[]:[_o(`${s}#ex-${m}`,m,void 0,false)],_o(`${s}#ex-${c}`,c,m,false)],y=chunkCB6RQ3GD_cjs.La(v,v.root.id,v.root.children.length,R,{deferValidation:true});return y.ok?chunkCB6RQ3GD_cjs.lc(f,y.part):f})),k.applyTo(a,{op:"insertCommentMarker",paragraphId:h,offset:t.anchor.end,commentId:d,marker:"reference"}),k.applyTo(a,{op:"insertCommentMarker",paragraphId:h,offset:t.anchor.end,commentId:d,marker:"end"}),k.applyTo(a,{op:"insertCommentMarker",paragraphId:t.anchor.paragraphId,offset:t.anchor.start,commentId:d,marker:"start"});},r.actorId===void 0?{}:{actorId:r.actorId});return g.ok?{ok:true,commentId:d,change:g.change}:{ok:false,reason:g.reason}}function Fo(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 Cl(e){let t=Fo(e);if(!t)return null;let n=on(t,chunkCB6RQ3GD_cjs.ga,"paraId");return n!==void 0&&chunkCB6RQ3GD_cjs.Jb(n)?n.toUpperCase():null}function ym(e){let t=new Map;if(!e)return t;let n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===Ze&&r.localName==="commentEx"){let o=on(r,Ze,"paraId");o!==void 0&&chunkCB6RQ3GD_cjs.Jb(o)&&t.set(o.toUpperCase(),r);}for(let o of r.children)n(o);}};return n(e.root),t}function rn(e,t){return {kind:"genericExtension",namespaceUri:Ze,localName:e,prefix:"w15",value:t}}function xm(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 km(e,t,n){let r=[],o=false,a=false;for(let i of e.attributes){if(i.namespaceUri===Ze&&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===Ze&&i.localName==="paraIdParent"&&(a=true),r.push(i);}return !a&&t!==void 0&&r.push(rn("paraIdParent",t)),o||r.push(rn("done",n?"1":"0")),xm(e,r)}function _o(e,t,n,r){return {id:e,kind:"generic",namespaceUri:Ze,localName:"commentEx",prefix:"w15",namespaceBindings:[],attributes:[rn("paraId",t),...n===void 0?[]:[rn("paraIdParent",n)],rn("done",r?"1":"0")],children:[]}}function Ho(e,t,n){return Pm(e,t,n,chunkCB6RQ3GD_cjs.ug())}function Pm(e,t,n,r){let o=e.package,a=e.part.name;if(chunkCB6RQ3GD_cjs.vg(o,a)===null)return {ok:false,reason:"unknown-comment"};let s=chunkCB6RQ3GD_cjs.yg(o,t,{storyPartName:a},r);if(!s.ok)return {ok:false,reason:"unknown-comment"};let l=chunkCB6RQ3GD_cjs.xg(o,r);if(l.truncated||r.truncated)return {ok:false,reason:"unknown-comment"};let d=l.used,c=new Map,u=[];for(let h of s.ids){let g=s.records.get(h);if(!g)return {ok:false,reason:"unknown-comment"};if(!Fo(g.node))return {ok:false,reason:"unknown-comment"};let k=Cl(g.node),f=k??chunkCB6RQ3GD_cjs.Mb(`${g.partName}#done-${h}`,d);k===null&&d.add(f),c.set(h,f);}for(let h of s.ids){let g=s.records.get(h),x=Fo(g.node),k=c.get(h),f=Cl(g.node),v=s.parentCommentIdByChildId.get(h),O=s.parentParaIdByCommentId.get(h)??(v===void 0?void 0:c.get(v)),R=s.commentExByParaId.get(k);u.push({paraId:k,stampParagraph:f===null?x:null,commentsPartName:g.partName,parentParaId:O,existing:R?.node,existingParentParaId:R?.parentParaId,existingDone:R?.done??false});}if(u.length===0)return {ok:false,reason:"unknown-comment"};if(u.every(h=>h.existingDone===n))return {ok:true,changed:false,change:null};let p=s.extendedPartName??Al,P=s.extendedPartName===null,m=e.transact(h=>{en(h).applyPackage(x=>{let k=wl(x,u,$l);if(k===null)return x;let f=k;if(!f.parts.has(p)){let T=Do(p,`<w15:commentsEx xmlns:w15="${Ze}"/>`);if(!T)return x;let w=chunkCB6RQ3GD_cjs.uc(f,p,T,$o);f=P?Ao(w,Uo,p):w;}let v=f.parts.get(p);if(!v)return x;let O=new Map,R=[];for(let T of u){let w=T.existingParentParaId??T.parentParaId;T.existing?O.set(T.existing.id,km(T.existing,w,n)):R.push(_o(`${p}#done-${T.paraId}`,T.paraId,w,n));}let y=El(v,O,R);return y.ok?chunkCB6RQ3GD_cjs.lc(f,y.part):x});});return m.ok?{ok:true,changed:true,change:m.change}:{ok:false,reason:m.reason}}function Rm(e,t){let n=Bo(e,t);return e.parts.has(n)&&chunkCB6RQ3GD_cjs.oc(e,n)===Lo}function vm(e,t){return Bo(e,t)}function Om(e,t){return _l(e,t)}var Ul={kind:"body"};function Im(e,t,n=Ul){let r=n.kind==="body"?null:e.resolveStory(n),o=r?.ok?r.store:e.bodyStore(),a=e.currentPackage(),i=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunkCB6RQ3GD_cjs.Ca(e,()=>{let s=jo(o,t);return s.ok&&(o.restoreHistoryStacks(i),e.replacePackageShell(o.package),e.adoptPackageUnit(a),e.publishStoryWrite(s.change)),s},s=>chunkCB6RQ3GD_cjs.Da(s))}function bm(e,t,n){let r=e.bodyStore(),o=e.currentPackage(),a=chunkCB6RQ3GD_cjs.li(chunkCB6RQ3GD_cjs.Qf(o),{op:"setCommentResolved"});if(a)return {ok:false,reason:a};let i=r.checkpoint();return r.graftPackage(()=>e.currentPackage()),chunkCB6RQ3GD_cjs.Ca(e,()=>{let s=Ho(r,t,n);return !s.ok||!s.changed||(r.restoreHistoryStacks(i),e.replacePackageShell(r.package),e.adoptPackageUnit(o),e.publishStoryWrite(s.change)),s},s=>s.ok&&s.changed)}function Sm(e,t,n=Ul,r){if(t.length===0||chunkCB6RQ3GD_cjs.li(chunkCB6RQ3GD_cjs.Qf(e.currentPackage()),{op:"deleteComments"}))return false;let o=n.kind==="body"?e.bodyStore().part:e.partFor(n);if(!o)return false;let a={storyPartName:o.name,...r===void 0?{}:{noteId:r}},i=e.bodyStore(),s=e.currentPackage(),l=i.checkpoint();return i.graftPackage(()=>e.currentPackage()),chunkCB6RQ3GD_cjs.Ca(e,()=>{let d=false,c=false,u=i.transact(p=>{en(p).applyPackage(m=>{let h=m;for(let g of t){let x=g.parentCommentId===void 0?chunkCB6RQ3GD_cjs.Hg(h,g.commentId,a):chunkCB6RQ3GD_cjs.Ig(h,g.commentId,g.parentCommentId,a);if(x===null)return d=true,m;c||=x!==h,h=x;}return h});});return d||!u.ok||!c?false:(i.restoreHistoryStacks(l),e.installPackageSnapshot(i.package),e.adoptPackageUnit(s),e.publishStoryWrite(u.change),true)},d=>d)}var jl=256*1024,Hl=4096;function Vo(e,t,n){let r=t.payload,o=e.part.name,a=n??o;if(r){if(r.data.length>jl)return {ok:false,reason:"payload-too-large",detail:"data"};if(r.label.length>Hl)return {ok:false,reason:"payload-too-large",detail:"label"}}let i=new Set(chunkCB6RQ3GD_cjs.Qc(e.part.root).map(p=>p.node.id)),s=t.replaceControlId===void 0?[]:Vl(e,o,t.replaceControlId),l=null,d,c=e.transact(p=>{if(t.replaceControlId!==void 0){p.apply({op:"removeContentControl",controlId:t.replaceControlId,keepContent:false});for(let h of s)p.applyPackage(g=>chunkCB6RQ3GD_cjs.ch(g,h.partName,h.nodeId));}let P=t.replaceUntil;if(P!==void 0&&P<=t.offset){l="invalid-range",d="replaceUntil must be past offset";return}if(P!==void 0&&p.apply({op:"deleteText",paragraphId:t.paragraphId,start:t.offset,end:P}),!r){p.apply({op:"insertInlineContentControl",paragraphId:t.paragraphId,offset:t.offset,tag:t.tag,text:t.text,...t.alias===void 0?{}:{alias:t.alias},...t.lock===void 0?{}:{lock:t.lock}});return}let m=null;p.applyPackage(h=>{let g=chunkCB6RQ3GD_cjs.Zg(h,a,r.namespaceUri,r.rootLocalName);if(!g.part)return l="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})`,h;if(m=chunkCB6RQ3GD_cjs.hh(g.part,r.rootLocalName,r.nodeId),!m)return l="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`,h;let x=chunkCB6RQ3GD_cjs.bh(g.pkg,g.part.partName,{id:r.nodeId,label:r.label,data:r.data});return chunkCB6RQ3GD_cjs.ah(x,g.part.partName,r.nodeId)?x:(l="store-not-authored",d="the payload node could not be written into the store",h)}),!(l!==null||!m)&&p.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:m});});if(l!==null)return {ok:false,reason:l,...d===void 0?{}:{detail:d}};if(!c.ok)return {ok:false,reason:c.reason,...c.detail===void 0?{}:{detail:c.detail}};let u=Nm(e,i);return {ok:true,change:c.change,...u===void 0?{}:{nodeId:u}}}function Nm(e,t){for(let n of chunkCB6RQ3GD_cjs.Qc(e.part.root))if(!t.has(n.node.id))return n.node.id}function Vl(e,t,n){let r=chunkCB6RQ3GD_cjs.Qc(e.part.root).find(a=>a.node.id===n);if(!r)return [];let o=[];for(let a of chunkCB6RQ3GD_cjs.Xg(e.package,t)){let i=chunkCB6RQ3GD_cjs.kh(r.node,a.itemId);i!==null&&o.push({partName:a.partName,nodeId:i});}return o}function Wo(e,t){let n=e.part.name,r=Vl(e,n,t),o=e.transact(a=>{a.apply({op:"removeContentControl",controlId:t,keepContent:false});for(let i of r)a.applyPackage(s=>chunkCB6RQ3GD_cjs.ch(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 wm(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=chunkCB6RQ3GD_cjs.Yg(r,t,a);if(!i)continue;let s=chunkCB6RQ3GD_cjs.jh(r,i.itemId),l=chunkCB6RQ3GD_cjs.dh(r,i.partName,s);if(l.pkg===r&&chunkCB6RQ3GD_cjs.$g(r,i.partName).some(d=>!s.has(d.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 Bl=new WeakMap;function Em(e,t){let n=Bl.get(e);n||(n=new Map,Bl.set(e,n));let r=n.get(t);if(r)return r;let o=chunkCB6RQ3GD_cjs.Xg(e,t).map(a=>({itemId:a.itemId,nodes:new Map(chunkCB6RQ3GD_cjs.$g(e,a.partName).map(i=>[i.id,i]))}));return n.set(t,o),o}function Tm(e,t,n=t){let r=new Map,o=e.parts.get(t);if(!o)return r;let a=Em(e,n);if(a.length===0)return r;for(let i of chunkCB6RQ3GD_cjs.Qc(o.root))for(let s of a){let l=chunkCB6RQ3GD_cjs.kh(i.node,s.itemId);if(l===null)continue;let d=s.nodes.get(l);if(d){r.set(i.node.id,{nodeId:l,label:d.label,data:d.data});break}}return r}function Cm(e,t,n){let r=new Map,o=chunkCB6RQ3GD_cjs.Yg(e,t,n);if(!o)return r;for(let a of chunkCB6RQ3GD_cjs.$g(e,o.partName))r.set(a.id,{label:a.label,data:a.data});return r}var Wl={kind:"body"};function zl(e,t,n){let r=t.kind==="body"?null:e.resolveStory(t),o=r?.ok?r.store:e.bodyStore(),a=e.currentPackage(),i=o.checkpoint();return o.graftPackage(()=>e.currentPackage()),chunkCB6RQ3GD_cjs.Ca(e,()=>{let s=n(o);return s.ok&&(o.restoreHistoryStacks(i),e.replacePackageShell(o.package),e.adoptPackageUnit(a),e.publishStoryWrite(s.change)),s},s=>chunkCB6RQ3GD_cjs.Da(s))}function Mm(e,t,n=Wl){return zl(e,n,r=>Vo(r,t,e.bodyStore().part.name))}function Am(e,t,n=Wl){return zl(e,n,r=>Wo(r,t))}var ft="proposed";function Dm(e,t){switch(e){case "revisionInsert":case "revisionMoveTo":return t!=="original";case "revisionDelete":case "revisionMoveFrom":return t!=="proposed";default:return false}}function zo(e,t=ft,n){let r=[];return an(e.children,t,n,0,r),r}function Ko(e,t,n,r,o=ft,a){let i=[];for(let s of zo(e,o,a)){let l=t.get(s.id);if(!l||l.end<=l.start)continue;let d=Math.max(l.start,n),c=Math.min(l.end,r);d>=c||i.push({run:s,start:d,end:c});}return i}function an(e,t,n,r,o){if(!(r>=chunkCB6RQ3GD_cjs.la)){for(let a of e)if(!(a.kind==="textValue"||a.kind==="paragraphProperties")){if(a.kind==="run"){o.push(a);continue}if(chunkCB6RQ3GD_cjs.na(a)&&!chunkCB6RQ3GD_cjs.ka(a.kind)){an(a.children,t,n,r+1,o);continue}if(chunkCB6RQ3GD_cjs.ka(a.kind)){let i=chunkCB6RQ3GD_cjs.Ne(a,"author")??"",s=n?.includesNode?.(a.id,i)??!n?.hiddenAuthors.has(i),l=n&&!s?n.excludedNodeMode?.(a.id,i)??"proposed":t;if(!Dm(a.kind,l))continue;an(a.children,t,n,r+1,o);continue}if(chunkCB6RQ3GD_cjs.ke(a)){an(a.children,t,n,r+1,o);continue}if(chunkCB6RQ3GD_cjs.Ke(a)){let i=chunkCB6RQ3GD_cjs.Me(a);i&&an(i.children,t,n,r+1,o);continue}}}}var Kl=new Set(chunkCB6RQ3GD_cjs.pg),rr=new Set(chunkCB6RQ3GD_cjs.og);function Fm(e){return rr.has(e)}function sn(e,t,n){return !e||e.kind==="textValue"?void 0:e.children.find(o=>o.kind===t||o.kind==="generic"&&o.localName===n&&o.namespaceUri===chunkCB6RQ3GD_cjs.da)}function or(e,t){if(!e||e.kind==="textValue")return [];let n=[];for(let r of e.children){if(r.kind==="textValue"||!t.has(r.localName))continue;let o=chunkCB6RQ3GD_cjs.J();for(let a of r.attributes)o[a.localName]=a.value;n.push(Object.keys(o).length>0?{localName:r.localName,attributes:o}:{localName:r.localName});}return n}function _m(e,t){let n=chunkCB6RQ3GD_cjs.Ha(e,t);return or(sn(n,"paragraphProperties","pPr"),Kl)}function Gl(e,t){let n=chunkCB6RQ3GD_cjs.Ha(e,t),r=sn(n,"paragraphProperties","pPr");return or(sn(r,"runProperties","rPr"),rr)}function Go(e,t){let n=Array.isArray(t)?t:[t],r=new Set(n.map(a=>a.localName));return [...e.filter(a=>!r.has(a.localName)),...n]}var Lm=new Map([["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","cstheme"]]);function Xl(e,t){let n=e.find(o=>o.localName==="rFonts")?.attributes;if(!n)return t;let r={...n,...t.attributes??{}};for(let o of Object.keys(t.attributes??{})){let a=Lm.get(o);a&&delete r[a];}return {localName:"rFonts",attributes:r}}function ar(e){let t=new Map;for(let n of chunkCB6RQ3GD_cjs.Xe(e)){let r=n.formatRunIds&&n.formatRunIds.length>0?n.formatRunIds:n.runId?[n.runId]:[];for(let o of r){let a=t.get(o);a?(a.start=Math.min(a.start,n.start),a.end=Math.max(a.end,n.end)):t.set(o,{start:n.start,end:n.end});}}return t}function Yl(e){let t=new Set;for(let n of chunkCB6RQ3GD_cjs.Xe(e))if(n.formatRunIds)for(let r of n.formatRunIds)t.add(r);return t}function nr(e,t){if(t.localName==="rFonts")return Xl(e,t);if(t.localName!=="u")return t;let n=e.find(r=>r.localName==="u")?.attributes;return n?{localName:"u",attributes:{...n,...t.attributes??{}}}:t}function $m(e,t,n){let r=Gl(e,t),o=Array.isArray(n)?n:[n];return Go(r,o.map(a=>nr(r,a)))}function Um(e,t){return Array.isArray(t)?t.map(n=>nr(e,n)):nr(e,t)}function Bm(e,t,n,r,o,a=ft,i){let s=chunkCB6RQ3GD_cjs.Ha(e,t);if(!s||s.kind!=="paragraph")return [];let l=[],d=Yl(s);for(let c of Ko(s,ar(s),n,r,a,i)){let u=or(sn(c.run,"runProperties","rPr"),rr);l.push({start:c.start,end:c.end,properties:Go(u,Um(u,o)),...d.has(c.run.id)?{targetRunIds:[c.run.id]}:{}});}return l}function jm(e,t,n,r,o=ft,a){let i=chunkCB6RQ3GD_cjs.Ha(e,t);if(!i||i.kind!=="paragraph"||r<=n)return [];let s=[];for(let l of Ko(i,ar(i),n,r,o,a)){let d=s[s.length-1];d&&l.start<=d.end?d.end=Math.max(d.end,l.end):s.push({start:l.start,end:l.end});}return s}function Hm(e,t,n,r,o=ft,a){let i=chunkCB6RQ3GD_cjs.Ha(e,t);if(!i||i.kind!=="paragraph")return [];let s=ar(i),l=[];for(let d of zo(i,o,a)){let c=s.get(d.id);if(!c||c.end<=c.start)continue;(r>n?Math.max(c.start,n)<Math.min(c.end,r):c.start<=n&&n<c.end)&&l.push(d);}return l}var ql=new WeakMap;function Ie(e,t){return ql.set(e,t),e}function Z(e){return ql.get(e)??[]}function ln(e){return `${e.kind}-${e.id}`}function Xo(e){return e.kind==="revision"?e.ranges:e.range?[e.range]:[]}function Ql(e){return Xo(e)[0]??null}function Ft(e,t){let n=Ql(e);if(!n)return Number.MAX_SAFE_INTEGER;let r=t.get(n.start.paragraphId);return r===void 0?Number.MAX_SAFE_INTEGER:r*1e6+Math.min(n.start.offset,999999)}function Vm(e,t){let n=t.get(e.start.paragraphId),r=t.get(e.end.paragraphId);return n===void 0||r===void 0?Number.MAX_SAFE_INTEGER:(r-n)*1e6+(e.end.offset-e.start.offset)}var Wm=0,zm=1,Km=2;function Gm(e,t,n){let r=n.get(t.paragraphId),o=n.get(e.start.paragraphId),a=n.get(e.end.paragraphId);return r===void 0||o===void 0||a===void 0||r<o||r>a||r===o&&t.offset<e.start.offset||r===a&&t.offset>e.end.offset?null:o===a&&e.start.offset===e.end.offset?Wm:r===a&&t.offset===e.end.offset?Km:zm}function Xm(e,t,n){let r=null;for(let o of Xo(e)){let a=Gm(o,t,n);if(a===null)continue;let i=Vm(o,n);(r===null||a<r.grip||a===r.grip&&i<r.width)&&(r={grip:a,width:i});}return r}var Jl={comment:0,custom:1,revision:2};function Ym(e,t,n){let r=[];for(let o of e){let a=Xm(o,t,n);a!==null&&r.push({item:o,grip:a.grip,width:a.width});}return r.sort((o,a)=>o.grip!==a.grip?o.grip-a.grip:o.width!==a.width?o.width-a.width:o.item.kind!==a.item.kind?Jl[o.item.kind]-Jl[a.item.kind]:o.item.kind==="revision"&&a.item.kind==="revision"?a.item.nesting-o.item.nesting:0).map(o=>o.item)}function ky(e,t,n){let o=Ym(e,t,n).filter(a=>!(a.kind==="comment"&&a.resolved))[0];return o?o.kind==="comment"?Zl(e,o):o:null}function Py(e,t){return Zl(e,t)}function Zl(e,t){let n=new Map,r=new Map;for(let i of e)i.kind==="comment"?n.set(i.id,i):i.kind==="revision"&&r.set(i.id,i);let o=new Set([t.id]),a=t;for(;a.parentId!==void 0;){let i=n.get(a.parentId);if(!i||o.has(i.id))break;o.add(i.id),a=i;}if(a.parentRevisionId!==void 0){let i=r.get(a.parentRevisionId);if(i)return i}return a}function ed(e){let t=[],n=r=>{if(r.kind==="textValue"){t.push(r.value);return}for(let o of r.children)n(o);};for(let r of e.blocks)n(r);return t.join("")}function td(e){if(e.initials&&e.initials.trim().length>0)return e.initials.trim();let t=e.author.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function gt(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return chunkCB6RQ3GD_cjs.ae(e);if(chunkCB6RQ3GD_cjs.ie(e))return "";let t="";for(let n of e.children)t+=gt(n);return t}var _t=(e,t)=>e.kind!=="textValue"&&e.namespaceUri===chunkCB6RQ3GD_cjs.da&&e.localName===t;function nd(e,t,n){let r=new Set(["tcPrChange","trPrChange","tblPrExChange","tblGridChange","tblPrChange"]),o=new Map(n.filter(h=>h.propertyChange&&r.has(h.node.localName)).map(h=>[h.node.id,h]));if(!o.size)return [...t];let a=chunkCB6RQ3GD_cjs.Lh(e,n).tableHistories,i=[],s=new Map,l=h=>h.node.attributes.find(g=>g.namespaceUri===chunkCB6RQ3GD_cjs.da&&g.localName==="author")?.value??"",d=(h,g)=>{if(h.kind==="textValue"||_t(h,"tbl"))return;let x=o.get(h.id);x&&g.push(x);for(let k of h.children)d(k,g);},c=h=>{if(h.kind!=="textValue"){if(_t(h,"tbl")){let g,x=[],k=[],f=[],v=false;for(let R of h.children){if(_t(R,"tblGrid")&&d(R,k),_t(R,"tblPr")&&d(R,f),!_t(R,"tr"))continue;let y=[];if(d(R,y),v||=y.some(w=>w.refused),!y.length||y.some(w=>w.refused)){g=void 0;continue}let T=l(y[y.length-1]);(!g||g.author!==T)&&(g={ids:new Set,author:T,tableId:h.id},i.push(g),x.push(g));for(let w of y)g.ids.add(w.node.id);}let O=x.at(-1);if(O&&!v&&k.every(R=>!R.refused)){for(let R of k)O.ids.add(R.node.id);if(x.length===1&&k.length>0)for(let R of f){let y=R.node.children.find(T=>_t(T,"tblPr"));!R.refused&&R.parent?.kind==="tableProperties"&&y&&l(R)===O.author&&(a.has(R.node.id)||chunkCB6RQ3GD_cjs.sa({...R.parent,children:R.parent.children.filter(T=>T.id!==R.node.id)},y))&&O.ids.add(R.node.id);}}}for(let g of h.children)c(g);}};c(e.root);for(let h of i)for(let g of h.ids)s.set(g,h);let u=new Set;for(let h of t){let x=Z(h).map(k=>s.get(k));if(x.some(k=>k!==x[0]))for(let k of x)k&&u.add(k.tableId);}for(let h of i)if(u.has(h.tableId))for(let g of h.ids)o.get(g)?.node.localName==="tblGridChange"&&(h.ids.delete(g),s.delete(g));let p=new Map;for(let h of t){let g=Z(h),x=g.length?s.get(g[0]):void 0;if(!x||h.readOnly||h.revisionKind!=="format"||!g.every(f=>s.get(f)===x))continue;let k=p.get(x)??[];k.push(h),p.set(x,k);}let P=new Map,m=new Set;for(let h of i){let g=p.get(h)??[],x=g.find(y=>!["tblGridChange","tblPrChange"].includes(y.formattingKind??""))??g[0],k=x?[x,...g.filter(y=>y!==x)]:[],f=k.flatMap(Z),v=new Set(f);if(!x||k.length<2||![...h.ids].every(y=>v.has(y)))continue;let O=[...new Map(k.flatMap(y=>y.addresses).map(y=>[JSON.stringify([y.id,y.author,y.date??null]),y])).values()],R=[...new Map(k.filter(y=>!["tblGridChange","tblPrChange"].includes(y.formattingKind??"")).flatMap(y=>y.ranges).map(y=>[JSON.stringify(y),y])).values()];P.set(x,Ie({...x,author:h.author,addresses:O,ranges:R,text:[...new Set(k.map(y=>y.text).filter(Boolean))].join(`
2
+ `)},f));for(let y of k.slice(1))m.add(y);}return t.filter(h=>!m.has(h)).map(h=>P.get(h)??h)}var od=e=>e.kind==="textValue"?e.value:[e.namespaceUri,e.localName,e.attributes.map(t=>[t.namespaceUri,t.localName,t.value]).sort((t,n)=>JSON.stringify(t).localeCompare(JSON.stringify(n))),e.children.map(od)],rd=e=>new Map(e.children.filter(t=>t.kind!=="textValue"&&!(t.namespaceUri===chunkCB6RQ3GD_cjs.da&&t.localName==="rPrChange")).map(t=>t.kind==="textValue"?["",""]:[JSON.stringify([t.namespaceUri,t.localName]),JSON.stringify(od(t))]));function Jm(e){if(e.node.localName!=="rPrChange"||!e.parent||e.paragraphMark||e.refused)return;let t=e.node.children.find(a=>a.kind!=="textValue"&&a.namespaceUri===chunkCB6RQ3GD_cjs.da&&a.localName==="rPr");if(!t||t.kind==="textValue")return;let n=rd(t),r=rd(e.parent),o=[...new Set([...n.keys(),...r.keys()])].sort().filter(a=>n.get(a)!==r.get(a)).map(a=>[a,r.get(a)??null]);return o.length?JSON.stringify(o):void 0}function ad(e,t){let n=new Map(t.map(s=>[s.node.id,Jm(s)])),r=new Map;for(let s of e){if(s.revisionKind!=="format"||s.formattingKind!=="rPrChange"||s.readOnly||s.ranges.length!==1)continue;let l=s.ranges[0];if(l.start.paragraphId!==l.end.paragraphId||l.start.offset===l.end.offset)continue;let d=Z(s),c=d.length?n.get(d[0]):void 0;if(!c||!d.every(P=>n.get(P)===c))continue;let u=JSON.stringify([s.author,l.partName,l.start.paragraphId,c]),p=r.get(u)??[];p.push(s),r.set(u,p);}let o=new Set,a=new Map,i=s=>{if(s.length<2)return;let l=s[0],d=[...new Map(s.flatMap(c=>c.addresses).map(c=>[JSON.stringify([c.id,c.author,c.date??null]),c])).values()];a.set(l,Ie({...l,addresses:d,ranges:s.flatMap(c=>c.ranges),text:s.map(c=>c.text).join("")},s.flatMap(Z)));for(let c of s.slice(1))o.add(c);};for(let s of r.values()){s.sort((d,c)=>d.ranges[0].start.offset-c.ranges[0].start.offset);let l=[];for(let d of s)l.length&&l[l.length-1].ranges[0].end.offset!==d.ranges[0].start.offset&&(i(l),l=[]),l.push(d);i(l);}return e.filter(s=>!o.has(s)).map(s=>a.get(s)??s)}var pe=(e,t)=>e.kind!=="textValue"&&e.namespaceUri===chunkCB6RQ3GD_cjs.da&&e.localName===t,dn=(e,t)=>e.attributes.find(n=>n.namespaceUri===chunkCB6RQ3GD_cjs.da&&n.localName===t)?.value;function qm(e,t,n){let r=e.children.filter(o=>pe(o,"tc"));return r.length>0&&r.every(o=>{if(o.kind==="textValue")return false;let a=o.children.filter(i=>i.kind==="paragraph");return a.length>0&&a.every(i=>{if(i.kind==="textValue")return false;let s=i.children.find(u=>pe(u,"pPr")),l=s?.kind!=="textValue"?s?.children.find(u=>pe(u,"rPr")):void 0,d=l?.kind!=="textValue"?l?.children.filter(u=>pe(u,"ins")||pe(u,"del")):void 0,c=d?.length===1?d[0]:void 0;return !!c&&c.kind!=="textValue"&&c.localName===t&&dn(c,"author")===n})})}function Qm(e,t,n,r){let o=new Map(n.filter(f=>f.parent?.localName==="trPr"&&(f.node.localName==="ins"||f.node.localName==="del")).map(f=>[f.node.id,f]));if(o.size===0)return [...t];let a=new Map(n.map(f=>[f.node.id,f])),i=new Map;for(let f of r.values())i.set(f.paragraphId,Math.max(i.get(f.paragraphId)??0,f.end));let s=[],l=new Map,d=new Set,c=new Map,u=(f,v)=>{if(f.kind==="textValue"||pe(f,"tbl"))return;let O=a.get(f.id),R=o.has(f.id);O&&!O.propertyChange&&f.localName===v.direction&&!O.refused&&(R?dn(f,"author")===v.author:O.paragraphMark||f.kind==="revisionInsert"||f.kind==="revisionDelete")&&(c.set(f.id,v),R&&v.markerIds.add(f.id));for(let y of f.children)u(y,v);},p=(f,v=0)=>{if(f.kind!=="textValue"){if(pe(f,"tr")&&v>1){let O=f.children.find(R=>pe(R,"trPr"));if(O&&O.kind!=="textValue")for(let R of O.children)o.has(R.id)&&l.set(R.id,f);}if(pe(f,"tbl")){let O;for(let R of f.children){if(R.kind==="textValue"||!pe(R,"tr")){O=void 0;continue}let y=R.children.find(ee=>pe(ee,"trPr")),T=y?.kind!=="textValue"?y?.children.filter(ee=>o.has(ee.id))??[]:[],w=T.length===1?T[0]:void 0,j=w&&w.kind!=="textValue"?dn(w,"author"):void 0;if(!w||w.kind==="textValue"||j===void 0||o.get(w.id)?.refused){O=void 0;continue}let z=w.localName;if(v>0){if(!qm(R,z,j)){O=void 0;continue}d.add(R.id);}(!O||O.author!==j||O.direction!==z)&&(O={markerIds:new Set,rows:[],author:j,direction:z,followingText:[]},s.push(O)),O.rows.push(R),O.markerIds.add(w.id),u(R,O);}}for(let O of f.children)p(O,v+(pe(f,"tbl")?1:0));}};p(e.root);let P,m=new Set(s.flatMap(f=>f.rows.map(v=>v.id))),h=(f,v=0,O=false)=>{if(f.kind==="textValue")return;d.has(f.id)&&(P=void 0);let R=v+(pe(f,"tbl")?1:0),y=O||m.has(f.id);if(f.kind==="run"&&!y&&(P=void 0),P&&(f.kind==="revisionInsert"||f.kind==="revisionDelete")){let T=P;P=void 0;let w=a.get(f.id),j=dn(T.marker,"author");if(w&&!w.refused&&j!==void 0&&f.localName===T.marker.localName&&dn(f,"author")===j&&(c.get(f.id)?.author??j)===j){let z=c.get(f.id);z||(z={markerIds:new Set,rows:[T.row],author:j,direction:T.marker.localName,followingText:[gt(f)],rowEndOnly:true},s.push(z),c.set(f.id,z)),z.markerIds.add(T.marker.id),c.set(T.marker.id,z);}}for(let T of f.children)h(T,R,y);if((pe(f,"tc")||f.kind==="paragraph"&&!y)&&(P=void 0),pe(f,"tr")&&(P=void 0,R>1&&!d.has(f.id))){let T=f.children.find(z=>pe(z,"trPr")),w=T&&T.kind!=="textValue"?T.children.filter(z=>o.has(z.id)):[],j=w.length===1?w[0]:void 0;j&&j.kind!=="textValue"&&!o.get(j.id)?.refused&&(P={marker:j,row:f});}};h(e.root),t=t.map(f=>{let v=Z(f);if(f.revisionKind!=="structural"||!v.length||!v.every(R=>l.has(R)))return f;let O=[];for(let R of v){let y,T=w=>{if(!(w.kind==="textValue"||pe(w,"tbl")))if(w.kind==="paragraph")y=w;else for(let j of w.children)T(j);};if(T(l.get(R)),y){let w={paragraphId:y.id,offset:i.get(y.id)??0};O.push({partName:e.name,start:w,end:w});}}return O.length?Ie({...f,ranges:O},v):f});let g=new Map;for(let f of t){let v=Z(f),O=v.length?c.get(v[0]):void 0;if(!O||f.readOnly||!v.every(y=>c.get(y)===O))continue;let R=g.get(O)??[];R.push(f),g.set(O,R);}let x=new Set,k=new Map;for(let f of s){let v=g.get(f)??[],O=v.find(F=>Z(F).some(B=>f.markerIds.has(B))),R=new Set(v.flatMap(Z));if(!O||![...f.markerIds].every(F=>R.has(F)))continue;let y=[O,...v.filter(F=>F!==O)],T=y.flatMap(F=>F.addresses),w=[],j=[],z=F=>{if(!(F.kind==="textValue"||pe(F,"tbl"))){if(F.kind==="paragraph"){w.push({partName:e.name,start:{paragraphId:F.id,offset:0},end:{paragraphId:F.id,offset:i.get(F.id)??0}}),j.push(gt(F));return}for(let B of F.children)z(B);}};for(let F of f.rows)z(F);if(f.rowEndOnly&&w.length){let F=w[w.length-1];w.splice(0,w.length,{...F,start:F.end});}let ee=new Set(w.map(F=>F.start.paragraphId));for(let F of y)if(!(F.revisionKind==="structural"&&Z(F).some(B=>!l.has(B))))for(let B of F.ranges)ee.has(B.start.paragraphId)||w.push(B);j.push(...f.followingText);let X=Ie({...O,addresses:[...new Map(T.map(F=>[JSON.stringify([F.id,F.author,F.date??null]),F])).values()],ranges:w.length?w:y.flatMap(F=>F.ranges),text:j.join(`
3
+ `),nesting:y.reduce((F,B)=>Math.min(F,B.nesting),O.nesting)},y.flatMap(Z));k.set(O,X);for(let F of v)F!==O&&x.add(F);}return t.filter(f=>!x.has(f)).map(f=>k.get(f)??f)}function id(e,t,n,r,o){let a=ad(nd(e,Qm(e,t,n,r),n),n),i=new Set(n.filter(s=>s.node.kind==="moveFromRangeStart"||s.node.kind==="moveToRangeStart").map(s=>s.node.id));return i.size>0||n.some(s=>s.parent?.localName==="trPr"&&["ins","del"].includes(s.node.localName))?a.sort((s,l)=>Ft(s,o)-Ft(l,o)||Number(Z(l).some(d=>i.has(d)))-Number(Z(s).some(d=>i.has(d)))):a}function sd(e){if(e.parent?.localName==="trPr"){if(e.node.localName==="ins")return "rowInsert";if(e.node.localName==="del")return "rowDelete"}if(e.parent?.localName==="tcPr"){if(e.node.localName==="cellIns")return "cellInsert";if(e.node.localName==="cellDel")return "cellDelete";if(e.node.localName==="cellMerge")return "cellMerge"}if(e.parent?.localName==="numPr"&&e.node.localName==="ins")return "numberingInsert"}function ld(e,t,n,r){if(!e.some(m=>m.revisionKind==="paragraphMark"))return e;let o=new Map,a=(m,h)=>{if(!(m.kind==="textValue"||h>64))for(let g=0;g<m.children.length;g+=1){let x=m.children[g],k=m.children[g+1];x.kind==="paragraph"&&k?.kind==="paragraph"&&o.set(x.id,k.id),a(x,h+1);}};a(t.root,0);let i=e.map((m,h)=>h),s=m=>{for(;i[m]!==m;)i[m]=i[i[m]],m=i[m];return m},l=new Map,d=new Map,c=(m,h,g)=>JSON.stringify([m.revisionKind==="paragraphMark"?m.markDirection:m.revisionKind,m.author,m.nesting,h,g]),u=(m,h,g)=>{let x=m.get(h);x?x.push(g):m.set(h,[g]);};e.forEach((m,h)=>{if(!(m.readOnly||!["insert","delete","paragraphMark"].includes(m.revisionKind)))for(let g of m.ranges)u(l,c(m,g.start.paragraphId,g.start.offset),h),u(d,c(m,g.end.paragraphId,g.end.offset),h);});let p=(m,h)=>{for(let g of h){let x=e[m].date,k=e[g].date;x!==void 0&&k!==void 0&&!chunkCB6RQ3GD_cjs.lg(x,k)||(i[s(g)]=s(m));}};e.forEach((m,h)=>{if(!(m.readOnly||m.revisionKind!=="paragraphMark"||!["insert","delete"].includes(m.markDirection??"")))for(let g of m.ranges){p(h,d.get(c(m,g.start.paragraphId,g.start.offset))??[]);let x=o.get(g.end.paragraphId);x&&p(h,l.get(c(m,x,0))??[]);}});let P=new Map;return e.forEach((m,h)=>{let g=s(h),x=P.get(g);x?x.push(m):P.set(g,[m]);}),[...P.values()].map(m=>{if(m.length===1)return m[0];let h=m.flatMap(v=>v.ranges).sort((v,O)=>n.get(v.start.paragraphId)-n.get(O.start.paragraphId)||v.start.offset-O.start.offset),g=m.flatMap(v=>Z(v)).flatMap(v=>{let O=r.get(v);return O?[O]:[]}).sort((v,O)=>n.get(v.range.start.paragraphId)-n.get(O.range.start.paragraphId)||v.range.start.offset-O.range.start.offset),x=m[0],k=m.find(v=>v.revisionKind!=="paragraphMark"),f=[...new Map(m.flatMap(v=>v.addresses).map(v=>[JSON.stringify(v),v])).values()];return Ie({...x,id:m.map(v=>v.id).join("+"),revisionKind:k?.revisionKind??"paragraphMark",...k?{markDirection:void 0}:{},addresses:f,ranges:h,text:k?g.map(v=>v.text).join(""):""},m.flatMap(v=>Z(v)))})}function Yo(e){if(!e.propertyChange||!e.parent)return [];let t=(o,a)=>{let i=o?.children.find(s=>s.kind!=="textValue"&&s.namespaceUri===chunkCB6RQ3GD_cjs.da&&s.localName==="lang");return i&&i.kind!=="textValue"?i.attributes.find(s=>s.namespaceUri===chunkCB6RQ3GD_cjs.da&&s.localName===a)?.value:void 0},n=e.node.children.find(o=>o.kind!=="textValue"&&o.localName===e.parent.localName),r=[];for(let o of ["val","eastAsia","bidi"]){let a=t(e.parent,o),i=t(n?.kind!=="textValue"?n:void 0,o);a&&a!==i&&!r.includes(a)&&r.push(a);}return r}var Zm=[{property:"bold",element:"b",attribute:"val",kind:"toggle"},{property:"italic",element:"i",attribute:"val",kind:"toggle"},{property:"underline",element:"u",attribute:"val"},{property:"strike",element:"strike",attribute:"val",kind:"toggle"},{property:"fontFamily",element:"rFonts",attribute:"ascii"},{property:"fontSize",element:"sz",attribute:"val",kind:"halfPoints"},{property:"color",element:"color",attribute:"val"},{property:"alignment",element:"jc",attribute:"val"},{property:"leftIndent",element:"ind",attribute:"left",kind:"twips"},{property:"rightIndent",element:"ind",attribute:"right",kind:"twips"},{property:"firstLineIndent",element:"ind",attribute:"firstLine",kind:"twips"},{property:"hangingIndent",element:"ind",attribute:"hanging",kind:"twips"},{property:"spaceBefore",element:"spacing",attribute:"before",kind:"twips"},{property:"spaceAfter",element:"spacing",attribute:"after",kind:"twips"}];function Jo(e){if(!e.propertyChange||!e.parent)return [];let t=e.node.children.find(r=>r.kind!=="textValue"&&r.namespaceUri===chunkCB6RQ3GD_cjs.da&&r.localName===e.parent.localName),n=[];for(let r of Zm){let o=i=>{let s=i?.children.find(d=>d.kind!=="textValue"&&d.namespaceUri===chunkCB6RQ3GD_cjs.da&&d.localName===r.element);if(!s||s.kind==="textValue")return null;let l=s.attributes.find(d=>d.namespaceUri===chunkCB6RQ3GD_cjs.da&&d.localName===r.attribute)?.value;if(r.kind==="toggle")return l==="0"||l==="false"||l==="off"?"false":"true";if(l===void 0)return null;if(r.kind==="halfPoints"||r.kind==="twips"){let d=Number(l);return Number.isFinite(d)?String(d/(r.kind==="halfPoints"?2:20)):l}return l},a=o(e.parent);a!==o(t?.kind!=="textValue"?t:void 0)&&n.push({property:r.property,value:a});}return n}function sr(e){return ud(e,true)}function Gy(e){return ud(e,false)}function ud(e,t){let n=t?cd.get(e.root):void 0;if(n)return n;let r=new Map,o=s=>{let l=t?dd.get(s):void 0;if(l){for(let[c,u]of l)r.set(c,u);return}let d=new Map;tu(s,d,t),t&&dd.set(s,d);for(let[c,u]of d)r.set(c,u);},a=(s,l)=>{if(!(s.kind==="textValue"||l>64)){if(s.kind==="paragraph"){o(s);return}for(let d of s.children)a(d,l+1);}};a(e.root,0);let i=(s,l)=>{if(!(s.kind==="textValue"||l>64)){if(s.kind==="paragraph"){let d=t?md.get(s):void 0;if(!d){let c=[];pd(s,0,c,t),d=c,t&&md.set(s,d);}for(let[c,u]of d)r.set(c,u);return}if(s.kind==="table"||s.kind==="tableRow"||s.kind==="tableCell"){let d=t?ir.get(s):void 0;d||(d=fd(s),t&&ir.set(s,d));for(let[c,u]of d)r.set(c,u);}for(let d of s.children)i(d,l+1);}};return i(e.root,0),t&&cd.set(e.root,r),r}function pd(e,t,n,r){if(!(e.kind==="textValue"||t>64)){if(e.kind==="table"||e.kind==="tableRow"||e.kind==="tableCell"){let o=r?ir.get(e):void 0;o||(o=fd(e),r&&ir.set(e,o));for(let a of o)n.push(a);}for(let o of e.children)pd(o,t+1,n,r);}}function fd(e){let t=null,n=(a,i)=>{if(!(t||a.kind==="textValue"||i>64)){if(a.kind==="paragraph"){t=a;return}for(let s of a.children)n(s,i+1);}};if(n(e,0),!t)return eu;let r={paragraphId:t.id,start:0,end:0},o=[];if(e.kind==="textValue")return o;for(let a of e.children)if(!(a.kind==="textValue"||!["tblPr","tblGrid","tblPrEx","trPr","tcPr"].includes(a.localName)))for(let i of a.children){if(i.kind==="textValue")continue;(i.localName===`${a.localName}Change`||a.localName==="trPr"&&["ins","del"].includes(i.localName)||a.localName==="tcPr"&&["cellIns","cellDel","cellMerge"].includes(i.localName))&&o.push([i.id,r]);}return o}var eu=[],dd=new WeakMap,cd=chunkCB6RQ3GD_cjs.zg(8),ir=new WeakMap,md=new WeakMap;function tu(e,t,n){let r=n?chunkCB6RQ3GD_cjs.Ze(e):chunkCB6RQ3GD_cjs.$e(e),o=(s,l,d,c)=>{if(!(s.kind==="textValue"||c>64)){t.set(s.id,{paragraphId:e.id,start:l,end:d});for(let u of s.children)o(u,l,d,c+1);}},a=(s,l)=>{if(s.kind==="textValue"||l>64)return;let d=r.spanOf(s);if(s.kind==="fldSimple"&&d){o(s,d.start,d.end,l);return}if(s.kind==="run"){if(!d)return;t.set(s.id,{paragraphId:e.id,start:d.start,end:d.end});for(let c of s.children)c.kind==="runProperties"&&o(c,d.start,d.end,l+1);return}d&&t.set(s.id,{paragraphId:e.id,start:d.start,end:d.end});for(let c of s.children)a(c,l+1);};for(let s of e.children)s.kind!=="paragraphProperties"&&a(s,0);let i=e.children.find(s=>s.kind==="paragraphProperties");i&&o(i,r.length,r.length,0);}var ru={ins:"insert",del:"delete",moveFrom:"moveFrom",moveTo:"moveTo"};function lr(e,t){for(let n of e.attributes)if(n.localName===t&&n.namespaceUri===chunkCB6RQ3GD_cjs.da)return n.value}function qo(e){return `${e.id}\0${e.author}\0${e.date??""}`}var ou={revisionInsert:"insert",revisionDelete:"delete",revisionMoveFrom:"moveFrom",revisionMoveTo:"moveTo",moveFromRangeStart:"moveFrom",moveToRangeStart:"moveTo"},yd={retainRevisionItems:true,revisionSites:chunkCB6RQ3GD_cjs.Yh,locations:sr,commentAnchors:chunkCB6RQ3GD_cjs.Bg,deepOrder:chunkCB6RQ3GD_cjs.ki};function dr(e){return xd(e,yd)}function xd(e,t){let n=e.root.kind!=="paragraph";if(n&&t.retainRevisionItems){let o=gd.get(e.root);if(o&&o.name===e.name)return o.items}let r=au(e,t);return n&&t.retainRevisionItems&&gd.set(e.root,{name:e.name,items:r}),r}var gd=chunkCB6RQ3GD_cjs.zg(8);function au(e,t){let n=t.revisionSites(e);if(n.length===0)return [];let r=t.locations(e),o=new Map(chunkCB6RQ3GD_cjs.Mh(e.root).map(m=>[m.start.id,m])),a=chunkCB6RQ3GD_cjs.Oh(e.root),i=n.some(m=>m.paragraphMark),s=new Map,l=new Map,d=chunkCB6RQ3GD_cjs.Kh(e,n);for(let m of n){if(d.has(m.node.id))continue;let h=o.get(m.node.id),g=h?h.content.map(gt).join(""):gt(m.node),x=lr(m.node,"id"),k=x??`missing-${m.node.id}`,f=lr(m.node,"author")??"",v=lr(m.node,"author")===void 0&&m.node.localName!=="tblGridChange",O=lr(m.node,"date"),R=O===void 0?{id:k,author:f}:{id:k,author:f,date:O},y=a.has(m.node.id)?"insert":m.propertyChange?"format":m.paragraphMark?"paragraphMark":ou[m.node.kind]??"structural",T=m.paragraphMark?ru[m.node.localName]:void 0,w=y==="structural"?sd(m):void 0,j=r.get(m.node.id),z=h?.end&&r.get(h.end.id),ee=j&&z&&j.paragraphId===z.paragraphId?{...j,end:z.end}:j,X=ee?{partName:e.name,start:{paragraphId:ee.paragraphId,offset:ee.start},end:{paragraphId:ee.paragraphId,offset:ee.end}}:null;i&&X&&(y==="paragraphMark"||y==="insert"||y==="delete")&&s.set(m.node.id,{range:X,text:y==="paragraphMark"?`
4
+ `:g});let F=y==="structural"?`structural\0${qo(R)}`:`${y}\0${m.node.localName}\0${qo(R)}`,B=l.get(F);if(B){B.siteNodeIds.push(m.node.id),w&&!B.structuralChanges?.includes(w)&&(B.structuralChanges??=[]).push(w),m.propertyChange&&(B.formattingLanguages=[...new Set([...B.formattingLanguages??[],...Yo(m)])],B.formattingChanges=[...new Map([...B.formattingChanges??[],...Jo(m)].map(ie=>[JSON.stringify(ie),ie])).values()]),X&&!B.ranges.some(ie=>ie.partName===X.partName&&ie.start.paragraphId===X.start.paragraphId&&ie.start.offset===X.start.offset&&ie.end.paragraphId===X.end.paragraphId&&ie.end.offset===X.end.offset)&&B.ranges.push(X),y!=="structural"&&B.revisionKind==="structural"&&(B.revisionKind=y),(y==="insert"&&B.revisionKind==="delete"||y==="delete"&&B.revisionKind==="insert"||B.revisionKind==="replace")&&(B.revisionKind="replace"),B.readOnly||=m.refused||v,m.nesting>B.nesting&&(B.nesting=m.nesting),y==="delete"||y==="moveFrom"?B.deletedText+=g:y!=="format"&&y!=="paragraphMark"&&(B.text+=g);continue}l.set(F,{address:R,localName:m.node.localName,...w?{structuralChanges:[w]}:{},...m.propertyChange?{formattingLanguages:Yo(m),formattingChanges:Jo(m)}:{},revisionKind:y,...T?{markDirection:T}:{},author:f,...O===void 0?{}:{date:O},text:y==="format"||y==="paragraphMark"||y==="delete"||y==="moveFrom"?"":g,deletedText:y==="delete"||y==="moveFrom"?g:"",ranges:X?[X]:[],siteNodeIds:[m.node.id],nesting:m.nesting,readOnly:m.refused||v||x===void 0});}let c=[...l.values()].map(m=>Ie({kind:"revision",id:`${m.revisionKind}${m.revisionKind==="format"||m.revisionKind==="paragraphMark"?`-${m.localName}`:""}-${e.name}\0${qo(m.address)}`,address:m.address,addresses:[m.address],revisionKind:m.revisionKind,...m.revisionKind==="format"?{formattingKind:m.localName}:{},...m.structuralChanges?.length?{structuralChanges:m.structuralChanges}:{},...m.formattingChanges?.length?{formattingChanges:m.formattingChanges}:{},...m.formattingLanguages?.length?{formattingLanguages:m.formattingLanguages}:{},...m.markDirection?{markDirection:m.markDirection}:{},author:m.author,...m.date===void 0?{}:{date:m.date},text:m.revisionKind==="replace"?m.text:m.text||m.deletedText,replacedText:m.revisionKind==="replace"?m.deletedText:"",ranges:m.ranges,nesting:m.nesting,readOnly:m.readOnly,replyIds:[]},m.siteNodeIds)),u=t.deepOrder(e),p=id(e,c,n,r,u),P=kd(p,u);return iu(ld(P,e,u,s),u)}function iu(e,t){let n=kd(e,t),r=n.filter(l=>(l.revisionKind==="insert"||l.revisionKind==="delete")&&!l.readOnly&&l.ranges.length>0),o=new Set,a=new Map,i=new Map;for(let l of r){if(l.revisionKind!=="insert")continue;let d=l.ranges[0].start,c=`${d.paragraphId}\0${d.offset}`,u=i.get(c);u?u.push(l):i.set(c,[l]);}for(let l of r){if(l.revisionKind!=="delete"||o.has(l.id))continue;let d=l.ranges[l.ranges.length-1].end,c=i.get(`${d.paragraphId}\0${d.offset}`)??[],u=c.length>1?[...c].sort((p,P)=>(p.text.length>0?0:1)-(P.text.length>0?0:1)):c;for(let p of u){if(o.has(p.id)||p.author!==l.author)continue;o.add(l.id),o.add(p.id);let P=uu(l.ranges[0],p.ranges[0],t)?l:p,m=mu(l.date,p.date);a.set(l.id,Ie({...P,id:`replace-${l.id}-${p.id}`,revisionKind:"replace",...m===void 0?{}:{date:m},addresses:cu([...l.addresses,...p.addresses]),text:p.text,replacedText:l.text,ranges:[...l.ranges,...p.ranges],replacedRangeCount:l.ranges.length,readOnly:l.readOnly||p.readOnly},[...Z(l),...Z(p)]));break}}let s=[];for(let l of n){let d=a.get(l.id);if(d){s.push(d);continue}o.has(l.id)||s.push(l);}return s}function kd(e,t){let n=e.filter(d=>(d.revisionKind==="insert"||d.revisionKind==="delete")&&!d.readOnly&&d.ranges.length>0);if(n.length<2)return e;let r=d=>`${d.paragraphId}\0${d.offset}`,o=new Map;for(let d of n){let c=`${d.revisionKind}\0${d.author}`,u=o.get(c);u?u.push(d):o.set(c,[d]);}let a=(d,c)=>{let u=d.ranges[0].start,p=c.ranges[0].start,P=(t.get(u.paragraphId)??0)-(t.get(p.paragraphId)??0);return P!==0?P:u.offset-p.offset};for(let d of o.values()){let c=true;for(let u=1;u<d.length&&c;u+=1)c=a(d[u-1],d[u])<=0;c||d.sort(a);}let i=new Set,s=new Map;for(let d of o.values()){let c=[],u="",p=()=>{if(c.length>1){s.set(c[0].id,lu(c));for(let P=1;P<c.length;P+=1)i.add(c[P].id);}c=[];};for(let P of d){let m=r(P.ranges[0].start);c.length>0&&m!==u&&p();let h=c.length===0;c.push(P),(h||su(P))&&(u=r(P.ranges[P.ranges.length-1].end));}p();}if(s.size===0)return e;let l=[];for(let d of e)i.has(d.id)||l.push(s.get(d.id)??d);return l}function su(e){return e.ranges.some(t=>t.start.paragraphId!==t.end.paragraphId||t.start.offset!==t.end.offset)}function lu(e){let t=e[0],n=[...t.addresses],r=[...t.ranges],o=[...Z(t)],a=t.text,i=t.date;for(let s of e.slice(1)){for(let l of s.addresses)n.some(d=>Pd(d,l))||n.push(l);for(let l of s.ranges)r.push(l);for(let l of Z(s))o.push(l);a+=s.text,i=du(i,s.date);}return Ie({...t,id:e.map(s=>s.id).join("+"),addresses:n,ranges:r,text:a,...i===void 0?{}:{date:i}},o)}function du(e,t){if(e===void 0)return t;if(t===void 0)return e;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?e:r>n?t:e}function cu(e){let t=[];for(let n of e)t.some(r=>Pd(r,n))||t.push(n);return t}function Pd(e,t){return e.id===t.id&&e.author===t.author&&(e.date??"")===(t.date??"")}function mu(e,t){if(t===void 0)return e;if(e===void 0)return t;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t:n>r?e:t}function uu(e,t,n){let r=n.get(e.start.paragraphId)??0,o=n.get(t.start.paragraphId)??0;return r!==o?r<o:e.start.offset<=t.start.offset}function Rd(e,t,n){let r=new Map(t.map(c=>[c.commentId,c])),o=new Map,a=new Map;for(let c of e)c.paraId&&o.set(c.paraId.toUpperCase(),c),a.set(c.id,c);let i=new Map,s=new Map;for(let c of e){let u=r.get(c.id);if(!u||u.orphaned||u.start.paragraphId===u.end.paragraphId&&u.start.offset===u.end.offset)continue;let p=`${u.start.paragraphId}:${u.start.offset}|${u.end.paragraphId}:${u.end.offset}`;i.has(p)?s.set(c.id,i.get(p)):i.set(p,c.id);}let l=new Map;for(let c of e){let u=c.paraId?n.get(c.paraId.toUpperCase()):void 0,p=u?.parentParaId?o.get(u.parentParaId):void 0,P=c.parentCommentId?a.get(c.parentCommentId):void 0,m=u===void 0?s.get(c.id):void 0,h=m?a.get(m):void 0,g=p??P??h;g&&g.id!==c.id&&l.set(c.id,g.id);}for(let c of [...l.keys()]){let u=new Set([c]),p=l.get(c);for(;p!==void 0;){if(u.has(p)){l.delete(c);break}u.add(p),p=l.get(p);}}let d=new Map;for(let[c,u]of l){let p=d.get(u);p?p.push(c):d.set(u,[c]);}return e.map(c=>{let u=r.get(c.id),p=c.paraId?n.get(c.paraId.toUpperCase()):void 0,P=l.get(c.id);return {kind:"comment",id:c.id,comment:c,range:u?{partName:u.partName,start:u.start,end:u.end}:null,resolved:p?.done??false,...P===void 0?{}:{parentId:P},replyIds:d.get(c.id)??[],orphaned:u===void 0||u.orphaned}})}function pu(e){return fu(e,yd)}function fu(e,t){let n=[e.storyPart],r=new Set([e.storyPart.name]);for(let c of [...e.furnitureParts??[],...e.stylesPart?[e.stylesPart]:[]])r.has(c.name)||(r.add(c.name),n.push(c));let o=e.commentsPart?chunkCB6RQ3GD_cjs.Dg(e.commentsPart):[],a=e.commentsExtendedPart?chunkCB6RQ3GD_cjs.Eg(e.commentsExtendedPart):new Map,i=[],s=[],l=n.length===1?t.deepOrder(n[0]):new Map;for(let c of n){for(let P of xd(c,t))i.push(P);for(let P of t.commentAnchors(c))s.push(P);if(n.length===1)continue;let u=l,p=u.size;for(let[P,m]of t.deepOrder(c))u.has(P)||u.set(P,p+m);}return vd([...i,...Rd(o,s,a)]).sort((c,u)=>Ft(c,l)-Ft(u,l))}function gu(e,t){if(e.kind!=="comment")return e;let n=e.replyIds??[],r=n.filter(a=>t.has(a)),o=e.parentId!==void 0&&!t.has(e.parentId);if(!o&&r.length===n.length)return e;if(o){let{parentId:a,parentRevisionId:i,...s}=e;return r.length===n.length?s:{...s,replyIds:r}}return {...e,replyIds:r}}function hd(e){return `${e.partName}\0${e.start.paragraphId}:${e.start.offset}|${e.end.paragraphId}:${e.end.offset}`}function vd(e){let t=new Set;for(let l of e)l.kind==="comment"&&t.add(l.id);let n=e.map(l=>gu(l,t)),r=new Map;for(let l of n)if(l.kind==="revision")for(let d of l.ranges??[]){if(d.start.paragraphId===d.end.paragraphId&&d.start.offset===d.end.offset)continue;let c=hd(d),u=l.nesting??0,p=r.get(c);(p===void 0||u>p.nesting)&&r.set(c,{id:l.id,nesting:u});}let o=new Map;for(let l of n)l.kind==="comment"&&l.replyIds&&l.replyIds.length>0&&o.set(l.id,l.replyIds);let a=l=>{let d=[],c=new Set([l]),u=[...o.get(l)??[]];for(;u.length>0;){let p=u.shift();c.has(p)||(c.add(p),d.push(p),u.push(...o.get(p)??[]));}return d},i=new Map,s=new Map;for(let l of n){if(l.kind!=="comment"||l.parentId!==void 0||l.orphaned||!l.range)continue;let d=r.get(hd(l.range))?.id;if(d===void 0)continue;let c=[l.id,...a(l.id)];for(let p of c)s.set(p,d);let u=i.get(d);u?u.push(...c):i.set(d,c);}return n.map(l=>{if(l.kind==="revision"){let d=i.get(l.id)??[];return d.length===0&&(l.replyIds??[]).length===0?l:Ie({...l,replyIds:d},Z(l))}if(l.kind==="comment"){let d=s.get(l.id);if(d===void 0){if(l.parentRevisionId===void 0)return l;let{parentRevisionId:c,...u}=l;return u}return l.parentRevisionId===d?l:{...l,parentRevisionId:d}}return l})}var hu=256,yu=2e3,Od=/[\p{L}\p{N}_]/u;function Qo(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 Id(e,t,n){let r=t>0?e[t-1]:void 0,o=n<e.length?e[n]:void 0;return !(r!==void 0&&Od.test(r)||o!==void 0&&Od.test(o))}function bd(e){return typeof e=="string"&&e.length>0&&e.length<=256}function xu(e,t,n,r={}){let o={matches:[],truncated:false};if(!bd(t)||e.length===0||n<=0)return o;let a=r.matchCase===true,i=r.wholeWord===true,s=a?t:Qo(t),l=a?e:Qo(e),d=Math.max(0,r.from??0),c=Math.min(e.length,r.to??e.length),u=[],p=l.indexOf(s,d);for(;p>=0;){let P=p+s.length;if(P>c)return {matches:u,truncated:false};if(!i||Id(e,p,P)){if(u.length>=n)return {matches:u,truncated:true};u.push({start:p,length:s.length});}p=l.indexOf(s,P);}return {matches:u,truncated:false}}var ku=new Set(["plainText","richText","date","dropDownList","comboBox","docPartList"]),Pu=96;function Zo(e,t){return e.kind!=="textValue"&&e.namespaceUri===chunkCB6RQ3GD_cjs.da&&e.localName===t}function Ru(e){return e.kind==="textValue"&&e.value.trim()===""}function vu(e){let t=[],n=(r,o,a)=>{if(r.kind==="textValue"||a>Pu)return;if(chunkCB6RQ3GD_cjs.Ke(r)){let s=chunkCB6RQ3GD_cjs.Me(r),l=chunkCB6RQ3GD_cjs.Oc(r);if(s&&l&&s.children.every(Ru)&&ku.has(l.type)){t.push({control:r,content:s,kind:l.type,docPart:l.placeholderDocPart,inline:o});return}}let i=o||r.kind==="paragraph"||Zo(r,"p");for(let s of r.children)n(s,i,a+1);};return n(e,false,0),t}function Ou(e){return chunkCB6RQ3GD_cjs.wi(e,"rPr",{kind:"runProperties",children:[chunkCB6RQ3GD_cjs.wi(e,"rStyle",{attributes:[["val","PlaceholderText"]]})]})}function Iu(e){let t=e.find(r=>r.kind==="paragraph"||Zo(r,"p"));if(!t||t.kind==="textValue")return null;let n=t.children.filter(r=>r.kind!=="paragraphProperties"&&!Zo(r,"pPr"));return n.length>0?n:null}function ea(e,t){let n=vu(t.root);if(n.length===0)return t;let r=null,o=d=>{if(d!==void 0)return r??=chunkCB6RQ3GD_cjs.Af(e),r.find(c=>c.name===d)},a=chunkCB6RQ3GD_cjs.Fa(t,"paste"),i=new Set(chunkCB6RQ3GD_cjs.Nb(t.root)),s={value:0},l=t;for(let[d,c]of n.entries()){let u=o(c.docPart),p=null;if(u){let x=u.blocks.map((k,f)=>chunkCB6RQ3GD_cjs.Qi(chunkCB6RQ3GD_cjs.Se(k,a),i,`${c.control.id}:placeholder:${d}:${f}`,s));p=c.inline?Iu(x):x;}if(!p){let x=chunkCB6RQ3GD_cjs.xi(a,chunkCB6RQ3GD_cjs.ri(c.kind),Ou(a));p=c.inline?[x]:[chunkCB6RQ3GD_cjs.wi(a,"p",{kind:"paragraph",children:[x]})];}let P=chunkCB6RQ3GD_cjs.yi(chunkCB6RQ3GD_cjs.Le(c.control),{showingPlaceholder:true},a),m={...c.content,children:p},h=c.control.children.map(x=>x.id===c.content.id?m:x.kind!=="textValue"&&x.localName==="sdtPr"?P:x),g=chunkCB6RQ3GD_cjs.Ka(l,c.control.id,h);g.ok&&(l=g.part);}return l}function Sd(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=chunkCB6RQ3GD_cjs.Ia(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&&chunkCB6RQ3GD_cjs.Ia(e,i.parent.id),l=s&&o.get(s.id);l?.some(d=>n.has(d))&&l.some(d=>!n.has(d))&&a.add(i.node.id);}return a}function bu(e,t,n,r){let o=r??e.root,a=o.kind==="textValue"?e:{...e,root:o},i=dr(a),s=n===void 0?[...chunkCB6RQ3GD_cjs.Kh(a,chunkCB6RQ3GD_cjs.Yh(a))]:[],l=s.length?[{op:"acceptAllRevisions",siteNodeIds:s,...r?{scopeRootId:r.id}:{}}]:[];if(n?.length===0||i.length===0)return {ops:l,result:{resolved:[],skipped:[...new Set(n??[])].map(N=>({key:N,reason:"unknown-revision"})),remaining:i.length}};let d=new Set(n??i.map(ln)),c=new Map(i.map(N=>[ln(N),N])),u=new Set;for(let N of d){let I=c.get(N);if(I)for(let A of Z(I))u.add(A);}let p=chunkCB6RQ3GD_cjs.Yh(a),P=chunkCB6RQ3GD_cjs.Nh(o,p,u,t);for(let N of P.selected)u.add(N);for(let N of i){let I=Z(N);I.length&&I.every(A=>u.has(A))&&d.add(ln(N));}let m=chunkCB6RQ3GD_cjs.$h(o,p),h=new Map(p.map((N,I)=>[N.node.id,I])),g=p.map((N,I)=>I),x=N=>{for(;g[N]!==N;)g[N]=g[g[N]],N=g[N];return N},k=(N,I)=>{g[x(I)]=x(N);};for(let N of P.dependencies){let I=N.flatMap(A=>h.has(A)?[h.get(A)]:[]);for(let A of I)k(I[0],A);}let f=new Map;for(let N of i){let I=Z(N).flatMap(A=>{let K=h.get(A);return K===void 0?[]:[K]});for(let A of I)k(I[0],A);}let v=p.filter(N=>u.has(N.node.id)),O=new Set(chunkCB6RQ3GD_cjs.Sh(e,v,t).keys()),R=new Map;for(let[N,I]of p.entries()){if(t==="reject"&&I.propertyChange&&I.parent&&u.has(I.node.id))for(let K of I.parent.children)chunkCB6RQ3GD_cjs.Ph(I.node.localName,K)||f.set(K.id,N);let A=t==="accept"?I.node.localName==="del"||I.node.localName==="moveFrom":I.node.localName==="ins"||I.node.localName==="moveTo";if(I.paragraphMark&&I.parent&&A&&!m.has(I.node.id)&&u.has(I.node.id)){let K=chunkCB6RQ3GD_cjs.Ia(e,I.parent.id),te=K&&chunkCB6RQ3GD_cjs.Ia(e,K.id),se=te&&chunkCB6RQ3GD_cjs.Ia(e,te.id);if(K&&te&&se){let G=R.get(se.id);G||(G=chunkCB6RQ3GD_cjs.Wh(se.children,O),R.set(se.id,G)),G.has(te.id)&&f.set(K.id,N);}}if(u.has(I.node.id)&&chunkCB6RQ3GD_cjs.Th(e,I,t)){let K=chunkCB6RQ3GD_cjs.Th(e,I,t);K&&!I.refused&&f.set(K.id,N);}}for(let[N,I]of chunkCB6RQ3GD_cjs.Uh(e,v,t)){let A=chunkCB6RQ3GD_cjs.Ha(e,N),K=h.get(I[0]);if(!(A?.kind!=="tableCell"||K===void 0))for(let te of A.children)te.localName==="tcPr"&&f.set(te.id,K);}let y=(N,I)=>{let A=h.get(N.id),K=f.get(N.id);A!==void 0&&K!==void 0&&k(K,A);let te=A??K;te!==void 0&&I!==void 0&&k(I,te);let se=te??I;if(N.kind!=="textValue")for(let G of N.children)y(G,se);};y(o);for(let N of chunkCB6RQ3GD_cjs._h(o).values()){let I=N.wrappers.flatMap(A=>{let K=h.get(A.id);return K===void 0?[]:[K]});for(let A of I)k(I[0],A);}for(let N of p.some(I=>I.node.localName==="cellMerge")?chunkCB6RQ3GD_cjs.Vh(a):[]){let I=N.flatMap(A=>{let K=h.get(A);return K===void 0?[]:[K]});for(let A of I)k(I[0],A);}let T=new Map;for(let[N,I]of p.entries()){let A=x(N),K=T.get(A)??[];K.push(I),T.set(A,K);}let w=new Map;for(let[N,I]of T)I.some(A=>A.refused||t==="reject"&&A.propertyChange&&chunkCB6RQ3GD_cjs.Rh(A.node)===null)?w.set(N,"unsupported-revision"):I.some(A=>!u.has(A.node.id))&&w.set(N,"incomplete-group");for(let N of i)if(N.readOnly)for(let I of Z(N)){let A=h.get(I);A!==void 0&&w.set(x(A),"unsupported-revision");}let j=p.filter((N,I)=>u.has(N.node.id)&&!w.has(x(I))),z=false,ee=chunkCB6RQ3GD_cjs.Sh(e,j,t);for(let[N,I]of ee){if(f.has(N))continue;let A=h.get(I[0]);A!==void 0&&(f.set(N,A),z=true);}if(z){y(o);for(let[N,I]of [...w]){let A=x(N);w.get(A)!=="unsupported-revision"&&w.set(A,I);}}let X=[],F=[],B=new Set,ie=new Set(chunkCB6RQ3GD_cjs.Jh(e,p,t));for(let N of ie){let I=chunkCB6RQ3GD_cjs.Ia(e,N);for(;I;){if(ee.has(I.id)){ie.delete(N);break}I=chunkCB6RQ3GD_cjs.Ia(e,I.id);}}for(let N of d){let I=c.get(N);if(!I){F.push({key:N,reason:"unknown-revision"});continue}let A={key:N,author:I.author,partName:e.name,revisionKind:I.revisionKind},K=Z(I),te;for(let se of K){let G=h.get(se);if(te=G===void 0?"incomplete-group":w.get(x(G)),te)break}if(K.length||(te="unsupported-revision"),te)F.push({key:N,reason:te,revision:A});else {K.some(se=>ie.has(se))?F.push({key:N,reason:"retained-structure",revision:A}):X.push(A);for(let se of K)ie.has(se)||B.add(se);}}let be=Sd(e,p,B),$=new Set;for(let N of i){let I=Z(N);if(N.formattingKind!=="tblGridChange"&&I.length>1)for(let A of I)be.has(A)&&$.add(A);}let U=[...B].filter(N=>!P.implicit.has(N)&&!$.has(N)),Y=i.length-X.length;if(Y>0&&U.length){let N={...e,root:{...e.root}},I=chunkCB6RQ3GD_cjs.ai(N,t,void 0,{siteNodeIds:U,...r?{scopeRootId:r.id}:{}});if(I.ok&&I.part){let A=r?chunkCB6RQ3GD_cjs.Ha(I.part,r.id):I.part.root;Y=A&&A.kind!=="textValue"?dr({...I.part,root:A}).length:0;}}return {ops:B.size?[...l,{op:t==="accept"?"acceptAllRevisions":"rejectAllRevisions",siteNodeIds:U,...r?{scopeRootId:r.id}:{}}]:l,result:{resolved:X,skipped:F,remaining:Y}}}function ta(e){return e.kind!=="textValue"}function cr(e,t){for(let n of e.children)if(ta(n)&&n.localName===t)return n;return null}function Su(e,t){let n=[e];for(;n.length>0;){let r=n.pop();if(ta(r)){if(r.localName===t)return r;for(let o=r.children.length-1;o>=0;o-=1)n.push(r.children[o]);}}return null}var Td=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Lt(e,t,n){let r=cr(e,t),a=(r?cr(r,n):null)?.attributes.find(i=>i.localName==="typeface")?.value;return a!==void 0&&Td.test(a)?a:null}var Nd=new WeakMap;function Nu(e){let t=e?Nd.get(e):void 0;if(t)return t;let n=e?Su(e,"fontScheme"):null;if(!n)return Cd;let r=Object.freeze({major:Lt(n,"majorFont","latin"),minor:Lt(n,"minorFont","latin"),majorEastAsia:Lt(n,"majorFont","ea"),minorEastAsia:Lt(n,"minorFont","ea"),majorBidi:Lt(n,"majorFont","cs"),minorBidi:Lt(n,"minorFont","cs"),...Cu(n)});return e&&Nd.set(e,r),r}var wd=new WeakMap,Cd=Object.freeze({major:null,minor:null,majorEastAsia:null,minorEastAsia:null});function na(e,t=null){let n=e?Nu(e):Cd,r=t?cr(t,"themeFontLang"):null;if(!r||!t)return n;let o=wd.get(t);o||wd.set(t,o=new WeakMap);let a=o.get(n);if(a)return a;let i=P=>r.attributes.find(m=>m.localName===P)?.value,s=Ed(i("val")),l=Ed(i("bidi")),d=i("eastAsia"),c=mr(d),u=(P,m,h)=>m&&(P?n.majorSupplemental:n.minorSupplemental)?.[m]||h||null,p=Object.freeze({major:u(true,s,n.major),minor:u(false,s,n.minor),majorEastAsia:u(true,c,n.majorEastAsia),minorEastAsia:u(false,c,n.minorEastAsia),majorBidi:u(true,l,n.majorBidi),minorBidi:u(false,l,n.minorBidi),...d===void 0?{majorSupplemental:n.majorSupplemental,minorSupplemental:n.minorSupplemental}:{}});return o.set(n,p),p}var wu=new Map([["minorAscii",e=>e.minor],["minorHAnsi",e=>e.minor],["majorAscii",e=>e.major],["majorHAnsi",e=>e.major],["minorEastAsia",e=>e.minorEastAsia??null],["majorEastAsia",e=>e.majorEastAsia??null],["minorBidi",e=>e.minorBidi??null],["majorBidi",e=>e.majorBidi??null]]);function Ek(e,t,n){if(e===void 0)return null;let r=wu.get(e)?.(t)??null;if(r!==null)return r;let o=mr(n);return o?(e==="majorEastAsia"?t.majorSupplemental:e==="minorEastAsia"?t.minorSupplemental:void 0)?.[o]??null:null}function mr(e){if(!e||e.length>85)return null;let t=e.toLowerCase().split("-");return t[0]==="ja"?"Jpan":t[0]==="ko"?"Hang":t[0]!=="zh"?null:t.includes("hant")?"Hant":t.includes("hans")?"Hans":t.some(n=>["tw","hk","mo"].includes(n))?"Hant":"Hans"}var Eu=new Map([["ar","Arab"],["fa","Arab"],["ur","Arab"],["ps","Arab"],["he","Hebr"],["yi","Hebr"],["dv","Thaa"],["syr","Syrc"]]);function Ed(e){if(!e||e.length>85)return null;let t=e.toLowerCase().split("-");return t[1]&&/^[a-z]{4}$/.test(t[1])?t[1][0].toUpperCase()+t[1].slice(1):mr(e)??Eu.get(t[0])??null}var Tu=new Map([["Hans","SimSun"],["Hant","PMingLiU"],["Jpan","MS Mincho"],["Hang","Batang"]]);function Tk(e){return Tu.get(mr(e)??"")??null}function Cu(e){let t={};for(let[n,r]of [["majorFont","majorSupplemental"],["minorFont","minorSupplemental"]]){let o=Object.create(null);for(let a of cr(e,n)?.children??[]){if(!ta(a)||a.localName!=="font")continue;let i=a.attributes.find(l=>l.localName==="script")?.value,s=a.attributes.find(l=>l.localName==="typeface")?.value;i&&/^[A-Z][a-z]{3}$/.test(i)&&s&&Td.test(s)&&(o[i]=s);}Object.keys(o).length&&(t[r]=Object.freeze(o));}return t}var ht=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",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"});function ra(e,t,n,r){let o=(e.relationships.get(t)??[]).find(a=>a.type===n);if(o){let a=chunkCB6RQ3GD_cjs.E(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 jk(e){let t=chunkCB6RQ3GD_cjs.jc(e);if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let n=t.package.parts.get(t.package.mainDocumentPart);if(!n)return {ok:false,reason:"no-main-document-tree",detail:t.package.mainDocumentPart};let r=new nn(t.package,ea(t.package,chunkCB6RQ3GD_cjs.Qb(n)));return {ok:true,view:Mu(r)}}function Mu(e){let t=()=>e.currentPackage(),n=()=>e.bodyStore().part,r=(d,c)=>ra(t(),t().mainDocumentPart,d,c)?.root??null,o=Object.freeze(na(null)),a=null,i=chunkCB6RQ3GD_cjs.Og,s=null;return Object.freeze({part:n,currentPackage:t,packageRevision:()=>e.packageRevision,stylesRoot:()=>r(ht.styles,"/word/styles.xml"),numberingRoot:()=>r(ht.numbering,"/word/numbering.xml"),settingsRoot:()=>r(ht.settings,"/word/settings.xml"),documentThemeFonts(){let d=t();return a!==d&&(o=Object.freeze(na(r(ht.theme,"/word/theme/theme1.xml"),r(ht.settings,"/word/settings.xml"))),a=d),o},documentProperties(){let d=t();if(s!==d){let c=ra(d,"/",ht.coreProperties,"/docProps/core.xml"),u=ra(d,"/",ht.extendedProperties,"/docProps/app.xml");i=chunkCB6RQ3GD_cjs.Pg(c?.root??null,u?.root??null),s=d;}return i},headerFooterPartsBySection:()=>chunkCB6RQ3GD_cjs.Vd(t()),headerFooterResolutionBySection:()=>chunkCB6RQ3GD_cjs.Ud(t()),relationshipTarget:d=>chunkCB6RQ3GD_cjs.Ff(t(),n().name,d)})}
5
+ exports.$=bm;exports.$a=bu;exports.A=Yt;exports.Aa=Bm;exports.B=Jr;exports.Ba=jm;exports.C=zd;exports.Ca=Hm;exports.D=qr;exports.Da=Z;exports.E=Qr;exports.Ea=ln;exports.F=Zr;exports.Fa=Xo;exports.G=eo;exports.Ga=Ql;exports.H=Xd;exports.Ha=Ft;exports.I=Ki;exports.Ia=Ym;exports.J=fc;exports.Ja=ky;exports.K=ko;exports.Ka=Py;exports.L=ws;exports.La=ed;exports.M=Po;exports.Ma=td;exports.N=mt;exports.Na=sr;exports.O=Ol;exports.Oa=Gy;exports.P=nn;exports.Pa=dr;exports.Q=bl;exports.Qa=Rd;exports.R=Sl;exports.Ra=pu;exports.S=To;exports.Sa=fu;exports.T=kh;exports.Ta=vd;exports.U=Mo;exports.Ua=hu;exports.V=jo;exports.Va=yu;exports.W=Ho;exports.Wa=Qo;exports.X=Rm;exports.Xa=Id;exports.Y=vm;exports.Ya=bd;exports.Z=Om;exports.Za=xu;exports._=Im;exports._a=ea;exports.a=na;exports.aa=Sm;exports.ab=jk;exports.b=Ek;exports.ba=jl;exports.bb=Mu;exports.c=Tk;exports.ca=Hl;exports.d=Ad;exports.da=Vo;exports.e=Bi;exports.ea=Wo;exports.f=Fn;exports.fa=wm;exports.g=st;exports.ga=Tm;exports.h=_n;exports.ha=Cm;exports.i=Ln;exports.ia=Mm;exports.j=ye;exports.ja=Am;exports.k=Ld;exports.ka=ft;exports.l=lt;exports.la=zo;exports.m=Gt;exports.ma=Ko;exports.n=$n;exports.na=Kl;exports.o=Xt;exports.oa=rr;exports.p=Un;exports.pa=Fm;exports.q=zr;exports.qa=sn;exports.r=Kr;exports.ra=or;exports.s=Gr;exports.sa=_m;exports.t=jd;exports.ta=Gl;exports.u=Hd;exports.ua=Go;exports.v=Yr;exports.va=Xl;exports.w=Hi;exports.wa=ar;exports.x=Vd;exports.xa=Yl;exports.y=Xr;exports.ya=nr;exports.z=Wd;exports.za=$m;
@@ -1 +1 @@
1
- import {b}from'./chunk-WZX4UGRQ.js';import {da}from'./chunk-NG6IQ4SI.js';var z=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,J=128,Q=/[\u0000-\u001F\u007F-\u009F]/,G=16,nn=2,en=3276;function V(e){return e.kind!=="textValue"}function P(e,n){for(let t of e.children)if(V(t)&&t.localName===n)return t}function O(e,n){return e.attributes.find(t=>t.localName===n)?.value}function D(e){return e===void 0||e.length===0||e.length>J||Q.test(e)?null:e}function v(e,n){let t=b(O(e,"asciiTheme"),n)??b(O(e,"hAnsiTheme"),n);if(t!==null)return t;let l=O(e,"ascii")??O(e,"hAnsi");return l===void 0?null:z.test(l)?l:null}function C(e,n){let t=b(O(e,"eastAsiaTheme"),n);if(t!==null)return t;let l=O(e,"eastAsia");return l===void 0?null:z.test(l)?l:null}function tn(e){return e!==void 0&&z.test(e)?e:null}function On(e){return tn(e)}function ln(e){return e!==void 0&&["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(n=>!!O(e,n))}function Y(e,n){if(!e)return {fontFamily:null,fontSizeHalfPoints:null,hasLatinFontReference:false};let t=P(e,"rFonts"),l=P(e,"sz"),i=l?O(l,"val"):void 0,r=i!==void 0&&/^\d{1,4}$/.test(i)?Number(i):null;return {fontFamily:t?v(t,n):null,hasLatinFontReference:ln(t),fontSizeHalfPoints:r!==null&&r>=nn&&r<=en?r:null}}function Sn(e,n){let t=new Map,l={fontFamily:null,fontSizeHalfPoints:null,hasLatinFontReference:false};if(e){let a=P(e,"docDefaults"),s=a?P(a,"rPrDefault"):void 0;l=Y(s?P(s,"rPr"):void 0,n);for(let u of e.children){if(!V(u)||u.localName!=="style")continue;let o=D(O(u,"styleId"));if(o===null||t.has(o))continue;let f=P(u,"basedOn");t.set(o,{basedOn:D(f?O(f,"val"):void 0),own:Y(P(u,"rPr"),n)});}}let i=new Map,r=a=>{let s=a??"",u=i.get(s);if(u)return u;let o=null,f=null,m=l.hasLatinFontReference,b=new Set,y=a;for(let I=0;y!==null&&I<G&&!b.has(y);I+=1){b.add(y);let E=t.get(y);if(!E)break;o??=E.own.fontFamily,m||=E.own.hasLatinFontReference,f??=E.own.fontSizeHalfPoints,y=E.basedOn;}let g={hasLatinFontReference:m,fontFamily:o??l.fontFamily,fontSizeHalfPoints:f??l.fontSizeHalfPoints};return i.set(s,g),g};return (a,s)=>{let u=r(a),o=s?.find(b=>b.localName==="rFonts"),f=o?b(o.attributes?.asciiTheme,n)??b(o.attributes?.hAnsiTheme,n):null,m=["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(b=>!!o?.attributes?.[b]);return {fontFamily:f??u.fontFamily??(!u.hasLatinFontReference&&!m?n.minor:null),fontSizeHalfPoints:u.fontSizeHalfPoints}}}var an=16,on=16,rn=32,sn=4096;function x(e){return e.kind!=="textValue"}function c(e,n){for(let t of e.children)if(x(t)&&t.localName===n)return t}function M(e,n){return e.attributes.find(t=>t.localName===n)?.value}function un(e){return e==="1"||e==="true"||e==="on"}function H(){return {families:new Map,styleIds:new Set,anyText:false,bareParagraph:false,bareRun:false,bareTable:false}}function _(e,n){for(let[t,l]of n.families)e.families.has(t)||e.families.set(t,l);for(let t of n.styleIds)e.styleIds.add(t);e.anyText||=n.anyText,e.bareParagraph||=n.bareParagraph,e.bareRun||=n.bareRun,e.bareTable||=n.bareTable;}function T(e,n){if(n===null)return;let t=n.toLowerCase();e.has(t)||e.set(t,n);}var fn=new Set(["tab","noBreakHyphen","softHyphen","footnoteRef","endnoteRef","footnoteReference","endnoteReference"]),dn=128;function cn(e){for(let n of e.attributes)if(n.localName==="font"&&!(n.namespaceUri!==da&&n.namespaceUri!==""))return n.value.length>0&&n.value.length<=dn;return false}function $(e,n){if(n?.has(e.id))return true;for(let t of e.children)if(!(!x(t)||t.namespaceUri!==da)){if(fn.has(t.localName))return true;if(t.localName==="sym"){if(!cn(t))return true;continue}if(!(t.localName!=="t"&&t.localName!=="delText")){for(let l of t.children)if(!x(l)&&l.value.length>0)return true}}return false}function mn(e){for(let n of e.children)if(!(!x(n)||n.namespaceUri!==da)&&!(n.localName!=="t"&&n.localName!=="delText")){for(let t of n.children)if(!x(t))for(let l of t.value){let i=l.codePointAt(0);if(i>=4352&&i<=4607||i>=11904&&i<=40959||i>=43360&&i<=43391||i>=44032&&i<=55295||i>=63744&&i<=64255||i>=65072&&i<=65103||i>=65280&&i<=65519||i>=131072&&i<=262143)return true}}return false}function K(e,n){let t=[e];for(;t.length>0;){let l=t.pop();if(x(l)){if(n?.has(l.id))return true;if(l.localName==="r"&&l.namespaceUri===da){if($(l,n))return true;continue}for(let i of l.children)t.push(i);}}return false}function yn(e,n,t,l){if(!$(e,l))return;n.anyText=true;let i=c(e,"rPr"),r=i?c(i,"rFonts"):void 0;r&&(T(n.families,v(r,t)),mn(e)&&T(n.families,C(r,t)));let a=i?c(i,"rStyle"):void 0,s=D(a?M(a,"val"):void 0);s!==null?n.styleIds.add(s):n.bareRun=true;}function gn(e,n,t){if(!t)return;n.anyText=true;let l=e.localName==="tbl",i=c(e,l?"tblPr":"pPr"),r=i?c(i,l?"tblStyle":"pStyle"):void 0,a=D(r?M(r,"val"):void 0);a!==null?n.styleIds.add(a):l?n.bareTable=true:n.bareParagraph=true;}function X(e){return (e.localName==="p"||e.localName==="tbl")&&e.namespaceUri===da}function U(e,n,t,l,i){e.namespaceUri===da&&(i?.has(e.id)&&e.localName==="fldSimple"&&(n.anyText=true,n.bareRun=true),e.localName==="r"?yn(e,n,t,i):X(e)&&gn(e,n,l));}var W=new WeakMap;function q(e,n,t){let l=W.get(e);if(l&&l.major===n.major&&l.minor===n.minor&&l.majorEastAsia===n.majorEastAsia&&l.minorEastAsia===n.minorEastAsia&&l.majorBidi===n.majorBidi&&l.minorBidi===n.minorBidi)return l.summary;let i=H();if(e.children.length>=on&&t<rn){for(let r of e.children)x(r)&&_(i,q(r,n,t+1));U(e,i,n,i.anyText);}else {let r=[e];for(;r.length>0;){let a=r.pop();if(!x(a))continue;let s=X(a)&&K(a);U(a,i,n,s);for(let u=a.children.length-1;u>=0;u-=1)r.push(a.children[u]);}}return W.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,majorBidi:n.majorBidi,minorBidi:n.minorBidi,summary:i}),i}var xn={docDefaultFamilies:[],defaultParagraph:null,defaultCharacter:null,defaultTable:null,chainFamilies:()=>[]},Z=new WeakMap;function w(e,n){let t=c(e,"rPr"),l=t?c(t,"rFonts"):void 0;return l?v(l,n):null}function k(e,n){let t=c(e,"rPr"),l=t?c(t,"rFonts"):void 0;return l?C(l,n):null}function hn(e,n){let t=new Map,l=null,i=null,r=null,a=null,s=null,u=c(e,"docDefaults"),o=u?c(u,"rPrDefault"):void 0;o&&(l=w(o,n),i=k(o,n));let f=o?c(o,"rPr"):void 0,m=f?c(f,"rFonts"):void 0;m&&["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(d=>!!M(m,d))||(l??=n.minor);let y=0;for(let d of e.children){if(!x(d)||d.localName!=="style")continue;if(y>=sn)break;y+=1;let h=D(M(d,"styleId"));if(h===null)continue;let S=c(d,"basedOn"),F=[];for(let p of d.children){if(!x(p)||p.localName!=="tblStylePr")continue;let L=w(p,n);L!==null&&F.push(L);let R=k(p,n);R!==null&&F.push(R);}t.set(h,{basedOn:D(S?M(S,"val"):void 0),family:w(d,n),eastAsiaFamily:k(d,n),conditionalFamilies:F});let A=un(M(d,"default")),j=M(d,"type");j==="paragraph"?A?r=h:r===h&&(r=null):j==="character"?A?a=h:a===h&&(a=null):j==="table"&&(A?s=h:s===h&&(s=null));}let g=new Map,I=d=>{if(d===null)return [];let h=g.get(d);if(h)return h;let S=[],F=null,A=null,j=new Set,p=d;for(let L=0;p!==null&&L<an&&!j.has(p);L+=1){j.add(p);let R=t.get(p);if(!R)break;F??=R.family,A??=R.eastAsiaFamily,S.push(...R.conditionalFamilies),p=R.basedOn;}return F!==null&&S.unshift(F),A!==null&&S.unshift(A),g.set(d,S),S};return {docDefaultFamilies:[l,i].filter(d=>d!==null),defaultParagraph:r,defaultCharacter:a,defaultTable:s,chainFamilies:I}}function bn(e,n){if(!e)return {...xn,docDefaultFamilies:n.minor?[n.minor]:[]};let t=Z.get(e);if(t&&t.major===n.major&&t.minor===n.minor&&t.majorEastAsia===n.majorEastAsia&&t.minorEastAsia===n.minorEastAsia&&t.majorBidi===n.majorBidi&&t.minorBidi===n.minorBidi)return t.index;let l=hn(e,n);return Z.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,majorBidi:n.majorBidi,minorBidi:n.minorBidi,index:l}),l}function En(e,n,t,l){let i=H(),r=new Map;for(let o of e){let f=H();for(let m of o.children){if(!x(m))continue;if(!l||l.size===0){_(f,q(m,t,0));continue}let b=H(),y=[m];for(;y.length>0;){let g=y.pop();if(!x(g))continue;let I=X(g)&&K(g,l);U(g,b,t,I,l);for(let E=g.children.length-1;E>=0;E-=1)y.push(g.children[E]);}_(f,b);}_(i,f);for(let m of f.families.values())T(r,m);}let a=bn(n,t),s=new Map;for(let o of i.styleIds)for(let f of a.chainFamilies(o))T(s,f);if(i.bareParagraph)for(let o of a.chainFamilies(a.defaultParagraph))T(s,o);if(i.bareRun)for(let o of a.chainFamilies(a.defaultCharacter))T(s,o);if(i.bareTable)for(let o of a.chainFamilies(a.defaultTable))T(s,o);if(i.anyText)for(let o of a.docDefaultFamilies)T(s,o);for(let o of r.keys())s.delete(o);let u=[...s.values()].sort((o,f)=>o<f?-1:o>f?1:0);return Object.freeze({direct:Object.freeze([...r.values()]),inherited:Object.freeze(u)})}function An(e,n,t){let l=En(e,n,t),i=[...l.direct,...l.inherited];return i.sort((r,a)=>r<a?-1:r>a?1:0),i}export{tn as a,On as b,Sn as c,En as d,An as e};
1
+ import {b}from'./chunk-GG4IAKFI.js';import {da}from'./chunk-UOQONZVQ.js';var z=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,J=128,Q=/[\u0000-\u001F\u007F-\u009F]/,G=16,nn=2,en=3276;function V(e){return e.kind!=="textValue"}function P(e,n){for(let t of e.children)if(V(t)&&t.localName===n)return t}function O(e,n){return e.attributes.find(t=>t.localName===n)?.value}function D(e){return e===void 0||e.length===0||e.length>J||Q.test(e)?null:e}function v(e,n){let t=b(O(e,"asciiTheme"),n)??b(O(e,"hAnsiTheme"),n);if(t!==null)return t;let l=O(e,"ascii")??O(e,"hAnsi");return l===void 0?null:z.test(l)?l:null}function C(e,n){let t=b(O(e,"eastAsiaTheme"),n);if(t!==null)return t;let l=O(e,"eastAsia");return l===void 0?null:z.test(l)?l:null}function tn(e){return e!==void 0&&z.test(e)?e:null}function On(e){return tn(e)}function ln(e){return e!==void 0&&["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(n=>!!O(e,n))}function Y(e,n){if(!e)return {fontFamily:null,fontSizeHalfPoints:null,hasLatinFontReference:false};let t=P(e,"rFonts"),l=P(e,"sz"),i=l?O(l,"val"):void 0,r=i!==void 0&&/^\d{1,4}$/.test(i)?Number(i):null;return {fontFamily:t?v(t,n):null,hasLatinFontReference:ln(t),fontSizeHalfPoints:r!==null&&r>=nn&&r<=en?r:null}}function Sn(e,n){let t=new Map,l={fontFamily:null,fontSizeHalfPoints:null,hasLatinFontReference:false};if(e){let a=P(e,"docDefaults"),s=a?P(a,"rPrDefault"):void 0;l=Y(s?P(s,"rPr"):void 0,n);for(let u of e.children){if(!V(u)||u.localName!=="style")continue;let o=D(O(u,"styleId"));if(o===null||t.has(o))continue;let f=P(u,"basedOn");t.set(o,{basedOn:D(f?O(f,"val"):void 0),own:Y(P(u,"rPr"),n)});}}let i=new Map,r=a=>{let s=a??"",u=i.get(s);if(u)return u;let o=null,f=null,m=l.hasLatinFontReference,b=new Set,y=a;for(let I=0;y!==null&&I<G&&!b.has(y);I+=1){b.add(y);let E=t.get(y);if(!E)break;o??=E.own.fontFamily,m||=E.own.hasLatinFontReference,f??=E.own.fontSizeHalfPoints,y=E.basedOn;}let g={hasLatinFontReference:m,fontFamily:o??l.fontFamily,fontSizeHalfPoints:f??l.fontSizeHalfPoints};return i.set(s,g),g};return (a,s)=>{let u=r(a),o=s?.find(b=>b.localName==="rFonts"),f=o?b(o.attributes?.asciiTheme,n)??b(o.attributes?.hAnsiTheme,n):null,m=["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(b=>!!o?.attributes?.[b]);return {fontFamily:f??u.fontFamily??(!u.hasLatinFontReference&&!m?n.minor:null),fontSizeHalfPoints:u.fontSizeHalfPoints}}}var an=16,on=16,rn=32,sn=4096;function x(e){return e.kind!=="textValue"}function c(e,n){for(let t of e.children)if(x(t)&&t.localName===n)return t}function M(e,n){return e.attributes.find(t=>t.localName===n)?.value}function un(e){return e==="1"||e==="true"||e==="on"}function H(){return {families:new Map,styleIds:new Set,anyText:false,bareParagraph:false,bareRun:false,bareTable:false}}function _(e,n){for(let[t,l]of n.families)e.families.has(t)||e.families.set(t,l);for(let t of n.styleIds)e.styleIds.add(t);e.anyText||=n.anyText,e.bareParagraph||=n.bareParagraph,e.bareRun||=n.bareRun,e.bareTable||=n.bareTable;}function T(e,n){if(n===null)return;let t=n.toLowerCase();e.has(t)||e.set(t,n);}var fn=new Set(["tab","noBreakHyphen","softHyphen","footnoteRef","endnoteRef","footnoteReference","endnoteReference"]),dn=128;function cn(e){for(let n of e.attributes)if(n.localName==="font"&&!(n.namespaceUri!==da&&n.namespaceUri!==""))return n.value.length>0&&n.value.length<=dn;return false}function $(e,n){if(n?.has(e.id))return true;for(let t of e.children)if(!(!x(t)||t.namespaceUri!==da)){if(fn.has(t.localName))return true;if(t.localName==="sym"){if(!cn(t))return true;continue}if(!(t.localName!=="t"&&t.localName!=="delText")){for(let l of t.children)if(!x(l)&&l.value.length>0)return true}}return false}function mn(e){for(let n of e.children)if(!(!x(n)||n.namespaceUri!==da)&&!(n.localName!=="t"&&n.localName!=="delText")){for(let t of n.children)if(!x(t))for(let l of t.value){let i=l.codePointAt(0);if(i>=4352&&i<=4607||i>=11904&&i<=40959||i>=43360&&i<=43391||i>=44032&&i<=55295||i>=63744&&i<=64255||i>=65072&&i<=65103||i>=65280&&i<=65519||i>=131072&&i<=262143)return true}}return false}function K(e,n){let t=[e];for(;t.length>0;){let l=t.pop();if(x(l)){if(n?.has(l.id))return true;if(l.localName==="r"&&l.namespaceUri===da){if($(l,n))return true;continue}for(let i of l.children)t.push(i);}}return false}function yn(e,n,t,l){if(!$(e,l))return;n.anyText=true;let i=c(e,"rPr"),r=i?c(i,"rFonts"):void 0;r&&(T(n.families,v(r,t)),mn(e)&&T(n.families,C(r,t)));let a=i?c(i,"rStyle"):void 0,s=D(a?M(a,"val"):void 0);s!==null?n.styleIds.add(s):n.bareRun=true;}function gn(e,n,t){if(!t)return;n.anyText=true;let l=e.localName==="tbl",i=c(e,l?"tblPr":"pPr"),r=i?c(i,l?"tblStyle":"pStyle"):void 0,a=D(r?M(r,"val"):void 0);a!==null?n.styleIds.add(a):l?n.bareTable=true:n.bareParagraph=true;}function X(e){return (e.localName==="p"||e.localName==="tbl")&&e.namespaceUri===da}function U(e,n,t,l,i){e.namespaceUri===da&&(i?.has(e.id)&&e.localName==="fldSimple"&&(n.anyText=true,n.bareRun=true),e.localName==="r"?yn(e,n,t,i):X(e)&&gn(e,n,l));}var W=new WeakMap;function q(e,n,t){let l=W.get(e);if(l&&l.major===n.major&&l.minor===n.minor&&l.majorEastAsia===n.majorEastAsia&&l.minorEastAsia===n.minorEastAsia&&l.majorBidi===n.majorBidi&&l.minorBidi===n.minorBidi)return l.summary;let i=H();if(e.children.length>=on&&t<rn){for(let r of e.children)x(r)&&_(i,q(r,n,t+1));U(e,i,n,i.anyText);}else {let r=[e];for(;r.length>0;){let a=r.pop();if(!x(a))continue;let s=X(a)&&K(a);U(a,i,n,s);for(let u=a.children.length-1;u>=0;u-=1)r.push(a.children[u]);}}return W.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,majorBidi:n.majorBidi,minorBidi:n.minorBidi,summary:i}),i}var xn={docDefaultFamilies:[],defaultParagraph:null,defaultCharacter:null,defaultTable:null,chainFamilies:()=>[]},Z=new WeakMap;function w(e,n){let t=c(e,"rPr"),l=t?c(t,"rFonts"):void 0;return l?v(l,n):null}function k(e,n){let t=c(e,"rPr"),l=t?c(t,"rFonts"):void 0;return l?C(l,n):null}function hn(e,n){let t=new Map,l=null,i=null,r=null,a=null,s=null,u=c(e,"docDefaults"),o=u?c(u,"rPrDefault"):void 0;o&&(l=w(o,n),i=k(o,n));let f=o?c(o,"rPr"):void 0,m=f?c(f,"rFonts"):void 0;m&&["ascii","hAnsi","asciiTheme","hAnsiTheme"].some(d=>!!M(m,d))||(l??=n.minor);let y=0;for(let d of e.children){if(!x(d)||d.localName!=="style")continue;if(y>=sn)break;y+=1;let h=D(M(d,"styleId"));if(h===null)continue;let S=c(d,"basedOn"),F=[];for(let p of d.children){if(!x(p)||p.localName!=="tblStylePr")continue;let L=w(p,n);L!==null&&F.push(L);let R=k(p,n);R!==null&&F.push(R);}t.set(h,{basedOn:D(S?M(S,"val"):void 0),family:w(d,n),eastAsiaFamily:k(d,n),conditionalFamilies:F});let A=un(M(d,"default")),j=M(d,"type");j==="paragraph"?A?r=h:r===h&&(r=null):j==="character"?A?a=h:a===h&&(a=null):j==="table"&&(A?s=h:s===h&&(s=null));}let g=new Map,I=d=>{if(d===null)return [];let h=g.get(d);if(h)return h;let S=[],F=null,A=null,j=new Set,p=d;for(let L=0;p!==null&&L<an&&!j.has(p);L+=1){j.add(p);let R=t.get(p);if(!R)break;F??=R.family,A??=R.eastAsiaFamily,S.push(...R.conditionalFamilies),p=R.basedOn;}return F!==null&&S.unshift(F),A!==null&&S.unshift(A),g.set(d,S),S};return {docDefaultFamilies:[l,i].filter(d=>d!==null),defaultParagraph:r,defaultCharacter:a,defaultTable:s,chainFamilies:I}}function bn(e,n){if(!e)return {...xn,docDefaultFamilies:n.minor?[n.minor]:[]};let t=Z.get(e);if(t&&t.major===n.major&&t.minor===n.minor&&t.majorEastAsia===n.majorEastAsia&&t.minorEastAsia===n.minorEastAsia&&t.majorBidi===n.majorBidi&&t.minorBidi===n.minorBidi)return t.index;let l=hn(e,n);return Z.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,majorBidi:n.majorBidi,minorBidi:n.minorBidi,index:l}),l}function En(e,n,t,l){let i=H(),r=new Map;for(let o of e){let f=H();for(let m of o.children){if(!x(m))continue;if(!l||l.size===0){_(f,q(m,t,0));continue}let b=H(),y=[m];for(;y.length>0;){let g=y.pop();if(!x(g))continue;let I=X(g)&&K(g,l);U(g,b,t,I,l);for(let E=g.children.length-1;E>=0;E-=1)y.push(g.children[E]);}_(f,b);}_(i,f);for(let m of f.families.values())T(r,m);}let a=bn(n,t),s=new Map;for(let o of i.styleIds)for(let f of a.chainFamilies(o))T(s,f);if(i.bareParagraph)for(let o of a.chainFamilies(a.defaultParagraph))T(s,o);if(i.bareRun)for(let o of a.chainFamilies(a.defaultCharacter))T(s,o);if(i.bareTable)for(let o of a.chainFamilies(a.defaultTable))T(s,o);if(i.anyText)for(let o of a.docDefaultFamilies)T(s,o);for(let o of r.keys())s.delete(o);let u=[...s.values()].sort((o,f)=>o<f?-1:o>f?1:0);return Object.freeze({direct:Object.freeze([...r.values()]),inherited:Object.freeze(u)})}function An(e,n,t){let l=En(e,n,t),i=[...l.direct,...l.inherited];return i.sort((r,a)=>r<a?-1:r>a?1:0),i}export{tn as a,On as b,Sn as c,En as d,An as e};