@docx-editor.dev/core 2.0.1 → 2.1.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 (107) hide show
  1. package/README.md +32 -33
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.cts +2 -2
  4. package/dist/automation.d.ts +2 -2
  5. package/dist/automation.js +1 -1
  6. package/dist/binding.cjs +1 -1
  7. package/dist/binding.d.cts +14 -8
  8. package/dist/binding.d.ts +14 -8
  9. package/dist/binding.js +1 -1
  10. package/dist/chunk-2DTQDAN7.js +2 -0
  11. package/dist/chunk-3JKQE4QJ.cjs +2 -0
  12. package/dist/chunk-4WWEDTTE.js +2 -0
  13. package/dist/chunk-6WIIHJFY.js +1 -0
  14. package/dist/chunk-7VQ7YLW3.cjs +1 -0
  15. package/dist/chunk-BS554B6D.cjs +2 -0
  16. package/dist/chunk-BZK64YU3.cjs +10 -0
  17. package/dist/chunk-CZFUMACF.cjs +12 -0
  18. package/dist/chunk-GQQOL4PV.js +1 -0
  19. package/dist/chunk-JQFDLZXQ.cjs +2 -0
  20. package/dist/chunk-O2WQY7IT.cjs +5 -0
  21. package/dist/chunk-PC76F2HR.cjs +1 -0
  22. package/dist/chunk-QRAUDDVY.js +2 -0
  23. package/dist/chunk-STCITBJK.js +12 -0
  24. package/dist/chunk-TBBXCC7D.js +5 -0
  25. package/dist/chunk-TSXT537P.cjs +12 -0
  26. package/dist/chunk-WOGYVM3W.js +12 -0
  27. package/dist/chunk-Y7TA7TPF.js +10 -0
  28. package/dist/contracts/editor.d.cts +6 -6
  29. package/dist/contracts/editor.d.ts +6 -6
  30. package/dist/contracts/interaction.d.cts +6 -6
  31. package/dist/contracts/interaction.d.ts +6 -6
  32. package/dist/contracts/modules.cjs +1 -1
  33. package/dist/contracts/modules.d.cts +30 -3
  34. package/dist/contracts/modules.d.ts +30 -3
  35. package/dist/contracts/modules.js +1 -1
  36. package/dist/{tree-package-store-DOKMtCnh.d.cts → custom-node-writes-YqISlSRl.d.cts} +181 -4
  37. package/dist/{tree-package-store-D5S7VKs5.d.ts → custom-node-writes-ttKuYd0M.d.ts} +181 -4
  38. package/dist/{editor-D0UDock4.d.cts → editor-B93PggnR.d.cts} +24 -5
  39. package/dist/{editor-C1QRi1v4.d.ts → editor-CFsSrxGR.d.ts} +24 -5
  40. package/dist/editor.cjs +1 -1
  41. package/dist/editor.css +1368 -279
  42. package/dist/editor.d.cts +19 -19
  43. package/dist/editor.d.ts +19 -19
  44. package/dist/editor.js +1 -1
  45. package/dist/{image-resources-BJnTpG66.d.ts → image-resources-C_YnqPhn.d.ts} +19 -11
  46. package/dist/{image-resources-BpIydXtU.d.cts → image-resources-DwpNnTg3.d.cts} +19 -11
  47. package/dist/{index-CrW-IxXt.d.cts → index-BjZelfWL.d.cts} +28 -11
  48. package/dist/{index-ZqBEOrTV.d.ts → index-DP1yJJ3R.d.ts} +28 -11
  49. package/dist/index.cjs +1 -1
  50. package/dist/index.d.cts +13 -13
  51. package/dist/index.d.ts +13 -13
  52. package/dist/index.js +1 -1
  53. package/dist/layout.cjs +1 -1
  54. package/dist/layout.d.cts +869 -819
  55. package/dist/layout.d.ts +869 -819
  56. package/dist/layout.js +1 -1
  57. package/dist/output.cjs +1 -1
  58. package/dist/output.d.cts +4 -4
  59. package/dist/output.d.ts +4 -4
  60. package/dist/output.js +1 -1
  61. package/dist/{protocol-oxHaWmt4.d.ts → protocol-BWVA3Q1p.d.ts} +56 -2
  62. package/dist/{protocol-CAkOBBGE.d.cts → protocol-FAz_nPm_.d.cts} +56 -2
  63. package/dist/review-reads-CsoXSvUg.d.ts +401 -0
  64. package/dist/review-reads-qW0jvdF1.d.cts +401 -0
  65. package/dist/{review-support-DS8DYX2a.d.cts → review-support-D64Wu236.d.cts} +37 -5
  66. package/dist/{review-support-Fy3vdIea.d.ts → review-support-nsLXC9jf.d.ts} +37 -5
  67. package/dist/{semantic-cell-selection-DsmHmLJ5.d.ts → semantic-cell-selection-D_8RbPII.d.ts} +2 -2
  68. package/dist/{semantic-cell-selection-CZjBSmMv.d.cts → semantic-cell-selection-DwLB71fF.d.cts} +2 -2
  69. package/dist/{semantic-interaction-Dy-dCUFF.d.ts → semantic-interaction-CXH2wFqi.d.ts} +1 -1
  70. package/dist/{semantic-interaction-D-Dszxrn.d.cts → semantic-interaction-DqcEonqD.d.cts} +1 -1
  71. package/dist/{semantic-paint-drawings-BA3z9jl8.d.ts → semantic-paint-drawings-B5Wk2so5.d.ts} +1 -1
  72. package/dist/{semantic-paint-drawings-D7qbB0E2.d.cts → semantic-paint-drawings-x8g44lD_.d.cts} +1 -1
  73. package/dist/{semantic-records-CJR3BvHs.d.cts → semantic-records-COVFW5aS.d.cts} +77 -4
  74. package/dist/{semantic-records-CWodBJsz.d.ts → semantic-records-zTC0_1zi.d.ts} +77 -4
  75. package/dist/{shaped-measurer-CNIT_svZ.d.cts → shaped-measurer-AFnFxoot.d.cts} +1 -1
  76. package/dist/{shaped-measurer-B-TAtcQU.d.ts → shaped-measurer-CZXL-a6v.d.ts} +1 -1
  77. package/dist/store.cjs +1 -1
  78. package/dist/store.d.cts +223 -317
  79. package/dist/store.d.ts +223 -317
  80. package/dist/store.js +1 -1
  81. package/dist/{tree-op-types-CwOeiaQ8.d.ts → tree-op-types-DWLCllG7.d.ts} +80 -25
  82. package/dist/{tree-op-types-DMiW6nIH.d.cts → tree-op-types-UOXlRUqQ.d.cts} +80 -25
  83. package/dist/{tree-session-CiUel5Kz.d.ts → tree-session-BtVFXsF6.d.ts} +45 -7
  84. package/dist/{tree-session-D47_imvR.d.cts → tree-session-DxIOHUOD.d.cts} +45 -7
  85. package/dist/{tree-store-CxifqwIv.d.cts → tree-store-B1lEkdXc.d.cts} +1 -1
  86. package/dist/{tree-store-hLtjeyWE.d.ts → tree-store-BscFPB7x.d.ts} +1 -1
  87. package/package.json +10 -5
  88. package/dist/chunk-5KSCB2OZ.js +0 -2
  89. package/dist/chunk-BSC44TIT.js +0 -5
  90. package/dist/chunk-DLPL5DAG.js +0 -12
  91. package/dist/chunk-DOEIARE2.js +0 -2
  92. package/dist/chunk-G7YCQBZE.cjs +0 -5
  93. package/dist/chunk-HR7K3W6A.js +0 -1
  94. package/dist/chunk-HVAV2JSN.js +0 -11
  95. package/dist/chunk-MYH2HCUJ.cjs +0 -2
  96. package/dist/chunk-NSM75TN6.cjs +0 -1
  97. package/dist/chunk-PHDVKUWZ.js +0 -1
  98. package/dist/chunk-QADYGK5L.cjs +0 -12
  99. package/dist/chunk-RNBHTPW7.js +0 -10
  100. package/dist/chunk-UD2ZXLFI.cjs +0 -2
  101. package/dist/chunk-VYAVK2AH.cjs +0 -1
  102. package/dist/chunk-YUK46A2N.cjs +0 -11
  103. package/dist/chunk-ZMIX42J7.cjs +0 -10
  104. package/dist/chunk-ZT55Q52J.cjs +0 -2
  105. package/dist/chunk-ZUALAR4M.js +0 -2
  106. package/dist/note-properties-CnmCoory.d.cts +0 -68
  107. package/dist/note-properties-m75hmP70.d.ts +0 -68
@@ -0,0 +1 @@
1
+ var d=Object.freeze({review:null,customNodes:Object.freeze([]),customNodePayloadNamespaces:Object.freeze([]),customNodeDiagnostics:Object.freeze([])});function a(o){if(!o||o.length===0)return d;let t=null,i=[],n=new Set,r=[];for(let e of o){e.review&&t===null&&(t=e.review),e.customNodes&&i.push(...e.customNodes);for(let s of e.customNodePayloadNamespaces??[])n.add(s);e.onCustomNodeDiagnostic&&r.push(e.onCustomNodeDiagnostic);}return {review:t,customNodes:i,customNodePayloadNamespaces:[...n],customNodeDiagnostics:r}}export{a};
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkBZK64YU3_cjs=require('./chunk-BZK64YU3.cjs'),fflate=require('fflate');var wt=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],_t=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,$t=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function et(e){return _t.test(e)||$t.test(e)}function W(e,t){if(!et(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 At=/^(\d+)\.(\d+)\.(\d+)$/;function k(e){let t=At.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 Y(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 J(e,t){let r=k(e),n=t.trim();if(n==="*")return true;if(n.startsWith("^")){let o=k(n.slice(1));return Y(r,o)<0?false:o.major>0?r.major===o.major:o.minor>0?r.major===0&&r.minor===o.minor:r.major===0&&r.minor===0}if(n.includes(" ")){let o=n.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let s=true;for(let a of o){let i=a.startsWith(">=")?">=":a.startsWith("<")?"<":null;if(!i)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let d=k(a.slice(i.length)),l=Y(r,d);i===">="?s=s&&l>=0:s=s&&l<0;}return s}return Y(r,k(n))===0}var h=class extends Error{constructor(r,n,o=[]){super(n);this.code=r;this.responsible=o;this.name="RegistryError";}code;responsible},Se=(e,t)=>`${e}:${t}`;function Dt(e,t={}){let r=new Map;for(let l of e){if(W(l.id,"extension"),tt(l.version,l.id),r.has(l.id))throw new h("duplicate-extension",`duplicate extension id ${l.id}`,[l.id]);r.set(l.id,l);for(let c of l.contributions)W(c.id,c.kind),tt(c.version,`${l.id} \u2192 ${c.id}`),c.replaces&&Mt(c.replaces.targetRange,`${l.id} \u2192 replaces ${c.replaces.targetId}`);}for(let l of e){for(let c of l.dependencies??[])if(!r.has(c))throw new h("missing-dependency",`${l.id} requires missing extension ${c}`,[l.id,c]);for(let c of l.conflicts??[])if(r.has(c)){let p=[l.id,c].sort();throw new h("conflict",`extensions ${p[0]} and ${p[1]} conflict`,p)}}Ft(r);let n=new Set(t.availablePorts??[]);for(let l of e)for(let c of l.contributions)c.kind==="runtimePort"&&n.add(c.id);for(let l of e)for(let c of l.requiredPorts??[])if(!n.has(c))throw new h("missing-port",`${l.id} requires unavailable port ${c}`,[l.id,c]);let o=new Map,s=new Map,a=new Map;for(let l of e)for(let c of l.contributions){let p=Se(c.kind,c.id);if(c.replaces){let u=Se(c.kind,c.replaces.targetId),m=a.get(u)??[];m.push({ext:l.id,c}),a.set(u,m);continue}if(s.has(p)){let u=[o.get(p),l.id].sort();throw new h("id-collision",`${c.kind} id ${c.id} registered by both ${u[0]} and ${u[1]}`,u)}s.set(p,c),o.set(p,l.id);}let i=new Map(s);for(let[l,c]of a){let p=s.get(l);if(!p){let f=c[0];throw new h("replacement-target-missing",`${f.ext} replaces missing target ${f.c.replaces.targetId}`,[f.ext,f.c.replaces.targetId])}let u=p.replaceable??{kind:"none"};for(let{ext:f,c:y}of c){if(!J(p.version,y.replaces.targetRange))throw new h("replacement-version-mismatch",`${f} replaces ${y.replaces.targetId}@${p.version} outside range ${y.replaces.targetRange}`,[f,y.replaces.targetId]);if(u.kind==="none")throw new h("unauthorized-replacement",`${y.replaces.targetId} does not authorize replacement (attempted by ${f})`,[f,y.replaces.targetId])}let m=Lt(p,c);i.set(l,m);}return {extensions:r,contributions:i,get:(l,c)=>i.get(Se(l,c))}}function Lt(e,t){let r=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(r.kind==="priority"){let o=[...t].sort((i,d)=>(d.c.replaces.priority??0)-(i.c.replaces.priority??0)),s=o[0].c.replaces.priority??0,a=o.filter(i=>(i.c.replaces.priority??0)===s);if(a.length>1){let i=a.map(d=>d.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${s}: ${i.join(", ")}`,i)}return o[0].c}let n=t.map(o=>o.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id}: ${n.join(", ")}`,n)}function Ft(e){let o=new Map,s=[],a=i=>{o.set(i,1),s.push(i);let d=[...e.get(i)?.dependencies??[]].sort();for(let l of d){let c=o.get(l)??0;if(c===1){let p=s.indexOf(l),u=[...s.slice(p),l];throw new h("dependency-cycle",`dependency cycle: ${u.join(" -> ")}`,u)}c===0&&a(l);}s.pop(),o.set(i,2);};for(let i of [...e.keys()].sort())(o.get(i)??0)===0&&a(i);}function tt(e,t){try{k(e);}catch{throw new h("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Mt(e,t){try{J("0.0.0",e);}catch{throw new h("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var v=class extends Error{constructor(t){super(t),this.name="BudgetError";}},F=class e{constructor(t,r){this.label=t;this.capacity=r;this.used=new chunkBZK64YU3_cjs.G(`${t}.budget`,r);}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 r=false,n=this;return {amount:t,get released(){return r},release(){r||(r=true,n.used.release(t),n.activeReservations-=1);}}}child(t,r){this.assertLive(),this.used.add(r);let n=new e(t,r);return n.parent=this,n.carveAmount=r,this.children.add(n),n}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new v(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new v(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let r=this.cleanups.length-1;r>=0;r--)try{this.cleanups[r]();}catch(n){t.push(n);}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 v(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new v(`${this.label}: budget already released`)}};var q=class extends Error{constructor(r,n){super(n?`cancelled: ${n}`:"cancelled");this.derivedOnly=r;this.name="CancellationError";}derivedOnly},M=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 q(t.derivedOnly,t._reason)}}}};var Q=class extends Error{constructor(r){super(`runtime port not available: ${r}`);this.portId=r;this.name="PortResolutionError";}portId},Te=class{ports=new Map;provide(t,r){return this.ports.set(t,r),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new Q(t);return this.ports.get(t)}missing(t){return t.filter(r=>!this.ports.has(r))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(chunkBZK64YU3_cjs.w.clock)}identity(){return this.resolve(chunkBZK64YU3_cjs.w.identity)}},we=class{constructor(t=0,r=1){this.step=r;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},_e=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Bt(e){let t=chunkBZK64YU3_cjs.B(e.limits),r=Object.freeze({...e.config??{}}),n=e.capacity??t.maxDecompressedBytes,o=e.id??"op",s={id:o,limits:t,config:r,ports:e.ports,budget:new F(`op:${o}`,n),cancellation:new M};return Object.freeze(s)}function Ht(e){e.budget.dispose();}var Ae=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"}}),rt=Object.keys(Ae);function Ut(e,t){return new chunkBZK64YU3_cjs.G(`${Ae[t].phase}:${t}`,e[t])}var $e=class{counter;current=0;peak=0;constructor(t){this.counter=new chunkBZK64YU3_cjs.G("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 Vt(){for(let e of rt){let t=chunkBZK64YU3_cjs.A[e],r=chunkBZK64YU3_cjs.z[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(r)||r<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>r)throw new Error(`default ${e} exceeds ceiling`)}}function B(e,t=new Set){let r=new WeakSet,n=o=>{if(o===null)return "null";let s=typeof o;if(s==="boolean")return o?"true":"false";if(s==="number"){let a=o;if(!Number.isFinite(a))throw new Error(`non-finite number is not comparable: ${a}`);return Object.is(a,-0)?"0":String(a)}if(s==="string")return JSON.stringify(o);if(s==="bigint")return `${o.toString()}n`;if(Array.isArray(o))return `[${o.map(n).join(",")}]`;if(s==="object"){let a=o;if(r.has(a))throw new Error("cannot canonicalize a cyclic structure");r.add(a);let d=Object.keys(a).filter(l=>!t.has(l)).sort().map(l=>`${JSON.stringify(l)}:${n(a[l])}`).join(",");return r.delete(a),`{${d}}`}throw new Error(`unsupported value type in comparator input: ${s}`)};return n(e)}function De(e,t){let r=B(e,t),n=0xcbf29ce484222325n,o=0x100000001b3n,s=0xffffffffffffffffn;for(let a=0;a<r.length;a++)n^=BigInt(r.charCodeAt(a)),n=n*o&s;return n.toString(16).padStart(16,"0")}var R="dev.docx-editor.core.comparator",Le={authoredState:{id:`${R}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${R}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${R}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${R}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${R}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${R}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${R}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${R}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${R}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${R}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Fe(e,t,r,n={}){let o=Le[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(n.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:nt(t,r,n.epsilon)}}case "exact":case "canonical-exact":{let s=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,a=B(t,s),i=B(r,s);return a===i?{equal:true}:{equal:false,left:a,right:i}}}}function Me(e,t){let r=Le[e];if(r.mode==="tolerance"||r.mode==="sync-optimization-only")throw new Error(`${r.id} has no canonical fingerprint (${r.mode})`);let n=r.mode==="canonical-exact"?new Set(r.ephemera):void 0;return De(t,n)}function nt(e,t,r){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=r:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,o)=>nt(n,t[o],r)):false}var it=new Set([...chunkBZK64YU3_cjs.t,...chunkBZK64YU3_cjs.u]),ot=/^[0-9a-f]{16}$/,Xt=/^[0-9a-f]*$/;function Be(e){let t=[],r=o=>t.push(o);e.formatVersion!==1&&r(`unsupported formatVersion ${e.formatVersion}`),e.documentId||r("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&r("docx source requires a 64-hex sha256");let n=-1;e.steps.forEach((o,s)=>{let a=`step[${s}]`;it.has(o.origin)||r(`${a}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&r(`${a}: baseRevision must be a non-negative integer`),o.baseRevision<n&&r(`${a}: baseRevision regressed below ${n}`);let i=o.expect;i.outcome==="applied"?(i.committedRevision===void 0?r(`${a}: applied step needs committedRevision`):i.committedRevision<=o.baseRevision?r(`${a}: committedRevision ${i.committedRevision} must exceed baseRevision ${o.baseRevision}`):n=i.committedRevision,i.modelChange&&jt(i.modelChange,a,r)):(i.committedRevision!==void 0&&r(`${a}: ${i.outcome} step must not commit a revision`),i.authoredStateHash!==void 0&&r(`${a}: ${i.outcome} step must not change authored state`)),i.authoredStateHash!==void 0&&!ot.test(i.authoredStateHash)&&r(`${a}: authoredStateHash must be 16-hex`),i.outputHash!==void 0&&!ot.test(i.outputHash)&&r(`${a}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&r(`envelope documentId ${o.documentId} != ${e.documentId}`),Xt.test(o.bytesHex)||r("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&r(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function jt(e,t,r){it.has(e.origin)||r(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&r(`${t}: modelChange revision must advance`);}function Kt(e,t){let r=Be(e);if(!r.valid)return {ok:false,mismatches:r.errors};let n=[];return t.init(e),e.steps.forEach((o,s)=>{let a=`step[${s}]`,i=t.applyStep(o),d=o.expect;if(i.outcome!==d.outcome){n.push(`${a}: outcome ${i.outcome} != expected ${d.outcome}`);return}if(d.outcome==="applied"&&(i.committedRevision!==d.committedRevision&&n.push(`${a}: revision ${i.committedRevision} != expected ${d.committedRevision}`),d.authoredStateHash!==void 0))if(i.authoredState===void 0)n.push(`${a}: store returned no authored state to hash`);else {Fe("authoredState",i.authoredState,i.authoredState).equal||n.push(`${a}: authored state is not self-consistent`);let c=at(i.authoredState);c!==d.authoredStateHash&&n.push(`${a}: authoredStateHash ${c} != expected ${d.authoredStateHash}`);}}),{ok:n.length===0,mismatches:n}}function at(e){return Me("authoredState",e)}var Gt=new Map([["embedRegular","regular"],["embedBold","bold"],["embedItalic","italic"],["embedBoldItalic","boldItalic"]]),zt=32;function ct(e,t){let r=t.replace(/[^0-9a-fA-F]/g,"");if(r.length!==32)return null;let n=new Uint8Array(16);for(let a=0;a<16;a+=1){let i=Number.parseInt(r.slice(a*2,a*2+2),16);if(Number.isNaN(i))return null;n[15-a]=i;}let o=new Uint8Array(e),s=Math.min(zt,o.length);for(let a=0;a<s;a+=1)o[a]=o[a]^n[a%16];return o}var He=(e,t)=>{if(!(e.kind==="textValue"||!("attributes"in e))){for(let r of e.attributes??[])if(r.localName===t)return r.value}},st=e=>e.kind==="textValue"?[]:e.children??[],lt=e=>e.kind==="textValue"||!("localName"in e)?"":e.localName;function Wt(e,t,r){for(let n of e.relationships.get(t)??[]){if(n.id!==r)continue;if(n.targetMode==="External")return null;let o=chunkBZK64YU3_cjs.q(t,n.rawTarget);return o.ok?o.partName:null}return null}function Yt(e,t,r={}){if(!t)return [];let n=r.maxFontBytes??16*1024*1024,o=r.maxFonts??64,s=[],a=new Map,i=d=>{if(!(s.length>=o)){if(lt(d)==="font"){let l=He(d,"name");if(l&&l.length<=128)for(let c of st(d)){if(s.length>=o)return;let p=Gt.get(lt(c));if(!p)continue;let u=He(c,"id"),m=He(c,"fontKey");if(!u||!m)continue;let f=Wt(e,t.name,u);if(!f)continue;let y=e.partBytes.get(f);if(!y||y.length===0||y.length>n)continue;let g=a.get(f);if(g){s.push({family:l,style:p,bytes:g,partName:f});continue}let O=ct(y,m);O&&(a.set(f,O),s.push({family:l,style:p,bytes:O,partName:f}));}}for(let l of st(d))i(l);}};return i(t.root),s}function dt(e){if(e.kind!=="textValue")for(let t of e.children){if(t.kind==="textValue")continue;if(t.kind==="hyperlink"){let n=chunkBZK64YU3_cjs.Ra(t);if(n!==void 0&&n.length>0)return n}let r=dt(t);if(r!==void 0)return r}}function Jt(e){let t="",r=false,n=o=>{if(!(r||o.kind==="textValue")){if(o.kind==="tab"||o.localName==="ptab"||o.localName==="tab"){r=true;return}if(o.kind==="text"||o.localName==="t"){for(let s of o.children)s.kind==="textValue"&&(t+=s.value);return}for(let s of o.children)n(s);}};return n(e),chunkBZK64YU3_cjs.Ac(t)}function qt(e,t,r,n){let o=r.filter(d=>{if(n.has(d.blockId))return false;let l=d.level+1;return l>=t.instruction.outlineStart&&l<=t.instruction.outlineEnd}),s=new Set(o.map(d=>d.blockId)),a=chunkBZK64YU3_cjs.vc(e),i=new Map;for(let d of o){let l=chunkBZK64YU3_cjs.Ac(d.text),c=i.get(l);c?c.push(d.blockId):i.set(l,[d.blockId]);}return t.resultParagraphIds.map(d=>{let l=chunkBZK64YU3_cjs.Ea(e,d);if(!l||l.kind==="textValue")return null;let c=dt(l),p=c===void 0?void 0:a.get(c);if(p&&s.has(p.paragraphId)){let f=i.get(chunkBZK64YU3_cjs.Ac(o.find(g=>g.blockId===p.paragraphId)?.text??"")),y=f?.indexOf(p.paragraphId)??-1;return f&&y>=0&&f.splice(y,1),p.paragraphId}let u=Jt(l);if(u.length===0)return null;let m=i.get(u);return !m||m.length===0?null:m.shift()??null})}function C(e){return e.namespaceUri===chunkBZK64YU3_cjs.la?e.localName:`{${e.namespaceUri}}${e.localName}`}function I(e){let t=[];for(let r of e.attributes)t.push(r.namespaceUri===""||r.namespaceUri===chunkBZK64YU3_cjs.la?`${r.localName}=${r.value}`:`{${r.namespaceUri}}${r.localName}=${r.value}`);return t.sort(),t}function ut(e,t){let r=I(e),n=r.length>0?`${C(e)}(${r.join(",")})`:C(e);if(t>=chunkBZK64YU3_cjs.ba)return n;let o=[];for(let s of e.children){if(s.kind==="textValue"){s.value!==""&&o.push(`#${s.value}`);continue}o.push(ut(s,t+1));}return o.sort(),o.length>0?`${n}[${o.join(",")}]`:n}function pt(e){if(!e)return [];let t=[];for(let r of e.children)r.namespaceUri===chunkBZK64YU3_cjs.la&&t.push(ut(r,1));return t.sort(),t}function Ue(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return chunkBZK64YU3_cjs.Yb(e);if(e.kind==="drawing")return chunkBZK64YU3_cjs.jc();if(e.kind==="runProperties"||e.kind==="paragraphProperties"||e.kind==="generic")return "";if(e.kind==="hyperlink"||chunkBZK64YU3_cjs.Jb(e)){let r="",n=e.kind==="hyperlink"?e.children:chunkBZK64YU3_cjs.Lb(e)??[];for(let o of n)r+=Ue(o);return r}let t="";for(let r of e.children)t+=Ue(r);return t}function x(e,t){let r=new Map(e);for(let n of t.namespaceBindings)r.set(n.prefix,n.namespaceUri);return r}function H(e,t){try{return chunkBZK64YU3_cjs.va(e,t)}catch(r){if(r instanceof chunkBZK64YU3_cjs.pa&&r.reason==="undeclared-prefix")return `generic-refusal:undeclared-prefix:{${e.namespaceUri}}${e.localName}`;throw r}}function Ve(e,t,r=chunkBZK64YU3_cjs.ua){if(e.kind==="textValue")return;if(e.kind==="runProperties"||e.kind==="paragraphProperties"){let o=x(r,e),s=[];for(let a of e.children)a.namespaceUri!==chunkBZK64YU3_cjs.la&&s.push(H(a,o));s.sort(),t.push(...s);return}if(e.kind==="generic"){t.push(H(e,r));return}if(chunkBZK64YU3_cjs.Jb(e)){t.push(chunkBZK64YU3_cjs.wa(e));return}if(e.kind==="bookmarkStart"||e.kind==="bookmarkEnd"){t.push(chunkBZK64YU3_cjs.va(e,r));return}if(e.kind==="drawing"){t.push(mt(e));return}if(chunkBZK64YU3_cjs.ka(e.kind))return;let n=x(r,e);for(let o of e.children)Ve(o,t,n);}function Qt(e){return `hyperlink(${e.attributes.map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(",")})`}function Zt(e){for(let t of e.children)if(t.kind==="pictureBlipFill")for(let r of t.children){if(r.kind!=="pictureBlip")continue;let n=r.attributes.find(s=>s.localName==="embed"&&s.namespaceUri===chunkBZK64YU3_cjs.oa)?.value,o=r.attributes.find(s=>s.localName==="link"&&s.namespaceUri===chunkBZK64YU3_cjs.oa)?.value;if(n!==void 0)return `embed=${n}`;if(o!==void 0)return `link=${o}`}}function Z(e,t,r){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunkBZK64YU3_cjs.ba)return C(e);let n=x(r,e);if(e.kind==="generic")return H(e,n);let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children)i.kind!=="textValue"&&a.push(Z(i,t+1,n));return a.sort(),a.length>0?`${s}[${a.join(",")}]`:s}function er(e,t,r){let n=x(r,e),o=[];for(let s of e.children)if(s.kind!=="textValue"){if(s.kind==="pictureBlipFill"){let a=s.children,i=a.find(l=>l.kind==="pictureBlip"),d=a.filter(l=>l.kind!=="pictureBlip").map(l=>Z(l,t+1,n));if(d.sort(),i&&i.kind==="pictureBlip"){let l=I(i),c=l.length>0?`pictureBlip(${l.join(",")})`:"pictureBlip";o.push(d.length>0?`${c}[${d.join(",")}]`:c);}else for(let l of a)o.push(Z(l,t+1,n));continue}o.push(Z(s,t+1,n));}return o.sort(),o}function Xe(e,t,r){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunkBZK64YU3_cjs.ba)return C(e);let n=x(r,e);if(e.kind==="drawingDocPr"){let i=I(e);return i.length>0?`docPr(${i.join(",")})`:"docPr"}if(e.kind==="picture"){let i=Zt(e),d=er(e,t+1,n),l=i===void 0?"picture":`picture(${i})`;return d.length>0?`${l}[${d.join(",")}]`:l}let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children){if(i.kind==="picture"){a.push(Xe(i,t+1,n));continue}if(i.kind==="generic"){a.push(H(i,n));continue}i.kind!=="textValue"&&a.push(Xe(i,t+1,n));}return a.length>0?`${s}[${a.join(",")}]`:s}function mt(e){let t=x(chunkBZK64YU3_cjs.ua,e),r=e.children.find(i=>i.kind==="inlineDrawing"||i.kind==="anchoredDrawing");if(!r||r.kind==="textValue")return `drawing(${I(e).join(",")})`;let n=x(t,r),o=I(r),s=o.length>0?`${r.kind}(${o.join(",")})`:r.kind,a=[];for(let i of r.children){if(i.kind==="generic"){a.push(H(i,n));continue}i.kind!=="textValue"&&a.push(Xe(i,1,n));}return a.length>0?`drawing[${s};${a.join(";")}]`:`drawing[${s}]`}function tr(e,t,r){let n=e.children.find(c=>c.kind==="paragraphProperties"),o=[],s="",a=[],i=x(chunkBZK64YU3_cjs.ua,e),d=(c,p)=>{if(c.kind==="run"){let u=x(p,c),m=c.children.find(f=>f.kind==="runProperties");o.push(pt(m)),s+=Ue(c);for(let f of c.children)Ve(f,a,u);return}if(c.kind==="drawing"){a.push(mt(c));return}if(c.kind==="hyperlink"){a.push(Qt(c));let u=x(p,c);for(let m of c.children)d(m,u);return}if(c.kind==="contentControl"){a.push(chunkBZK64YU3_cjs.wa({...c,children:c.children.filter(m=>m.kind!=="contentControlContent")}));let u=x(p,c);for(let m of c.children){if(m.kind!=="contentControlContent")continue;let f=x(u,m);for(let y of m.children)d(y,f);}return}Ve(c,a,p);};for(let c of e.children)d(c,i);let l=chunkBZK64YU3_cjs.Hc(e);return {ordinal:t,path:r,paraId:l===null?null:l.toUpperCase(),text:s,paragraphProperties:pt(n),runProperties:o,genericStructure:a}}function rr(e){if(e.localName==="hdr"||e.localName==="ftr"||e.kind==="body")return e;for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="body"||t.localName==="hdr"||t.localName==="ftr"))return t;return e}function ft(e,t,r,n,o,s){if(s>chunkBZK64YU3_cjs.ba)return;let a=0;for(let i of e.children){if(i.kind==="textValue"){i.value.trim()!==""&&o.push(`${t}/#text ${i.value}`);continue}let d=t===""?String(a):`${t}/${a}`;if(a+=1,i.kind==="paragraph"){r.push(i),n.push(d),o.push(`${d} p`);continue}let l=I(i);o.push(l.length>0?`${d} ${C(i)}(${l.join(",")})`:`${d} ${C(i)}`),ft(i,d,r,n,o,s+1);}}function yt(e){let t=rr(e.root),r=[],n=[],o=[];ft(t,"",r,n,o,0);let s=r.map((a,i)=>tr(a,i,n[i]));return {partName:e.name,paragraphs:s,structure:o}}function nr(e){let t=[];for(let r of e){let n=yt(r);n&&t.push(n);}return {stories:t}}function or(e,t){let r=[],n=(s,a,i)=>{r.push({path:s,before:JSON.stringify(a)??"undefined",after:JSON.stringify(i)??"undefined"});};e.stories.length!==t.stories.length&&n("stories.length",e.stories.length,t.stories.length);let o=Math.min(e.stories.length,t.stories.length);for(let s=0;s<o;s+=1){let a=e.stories[s],i=t.stories[s],d=p=>`${a.partName}${p}`;a.paragraphs.length!==i.paragraphs.length&&n(d(".paragraphs.length"),a.paragraphs.length,i.paragraphs.length);let l=Math.min(a.paragraphs.length,i.paragraphs.length);for(let p=0;p<l;p+=1){let u=a.paragraphs[p],m=i.paragraphs[p];u.text!==m.text&&n(d(`.p[${p}].text`),u.text,m.text),u.path!==m.path&&n(d(`.p[${p}].path`),u.path,m.path),u.paraId!==m.paraId&&n(d(`.p[${p}].paraId`),u.paraId,m.paraId),JSON.stringify(u.paragraphProperties)!==JSON.stringify(m.paragraphProperties)&&n(d(`.p[${p}].paragraphProperties`),u.paragraphProperties,m.paragraphProperties),JSON.stringify(u.runProperties)!==JSON.stringify(m.runProperties)&&n(d(`.p[${p}].runProperties`),u.runProperties,m.runProperties),JSON.stringify(u.genericStructure)!==JSON.stringify(m.genericStructure)&&n(d(`.p[${p}].genericStructure`),u.genericStructure,m.genericStructure);}a.structure.length!==i.structure.length&&n(d(".structure.length"),a.structure.length,i.structure.length);let c=Math.min(a.structure.length,i.structure.length);for(let p=0;p<c;p+=1)a.structure[p]!==i.structure[p]&&n(d(`.structure[${p}]`),a.structure[p],i.structure[p]);}return r}var U="http://schemas.openxmlformats.org/wordprocessingml/2006/main",sr="http://schemas.openxmlformats.org/package/2006/relationships",gt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",w="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",lr="application/vnd.openxmlformats-package.relationships+xml",cr="http://schemas.openxmlformats.org/package/2006/content-types",ht="/[Content_Types].xml",P="/word/numbering.xml",xt=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}],Nt=["decimal","lowerLetter","lowerRoman"],je=9;function Pt(e,t){let r=720*(t+1),n='<w:start w:val="1"/>';if(e==="bullet"){let a=xt[t%xt.length];return `<w:lvl w:ilvl="${t}">${n}<w:numFmt w:val="bullet"/><w:lvlText w:val="${a.text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${r}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=Nt[t%Nt.length],s=o==="lowerRoman";return `<w:lvl w:ilvl="${t}">${n}<w:numFmt w:val="${o}"/><w:lvlText w:val="%${t+1}."/><w:lvlJc w:val="${s?"right":"left"}"/><w:pPr><w:ind w:left="${r}" w:hanging="${s?180:360}"/></w:pPr></w:lvl>`}function dr(e,t){let r=Array.from({length:je},(n,o)=>Pt(e,o)).join("");return `<w:abstractNum w:abstractNumId="${t}"><w:multiLevelType w:val="${e==="bullet"?"hybridMultilevel":"multilevel"}"/>${r}</w:abstractNum>`}function pr(){let e=chunkBZK64YU3_cjs.Aa(`<w:numbering xmlns:w="${U}"></w:numbering>`,{name:P,contentType:w});return e.ok?e.part:null}var b=(e,t)=>{let r=[];for(let n of e.children)n.kind==="textValue"||n.localName!==t||n.namespaceUri===U&&r.push(n);return r},N=(e,t)=>e.attributes.find(r=>r.localName===t)?.value;function Et(e,t){let r=chunkBZK64YU3_cjs.Aa(`<w:numbering xmlns:w="${U}">${e}</w:numbering>`,{name:P,contentType:w});if(!r.ok)return null;let n=[];for(let o of r.part.root.children)o.kind!=="textValue"&&n.push(o);if(n.length!==t.length)return null;for(let o=0;o<t.length;o+=1){let s=n[o],a=t[o];if(s.namespaceUri!==U||s.localName!==a.localName||a.attribute&&N(s,a.attribute.localName)!==a.attribute.value)return null}return n}var Ot=["numPicBullet","abstractNum","num","numIdMacAtCleanup"];function Rt(e,t,r){let n=t.indexOf(r);if(n===-1)return e.length;let o=0;return e.forEach((s,a)=>{if(s.kind==="textValue")return;let i=t.indexOf(s.localName);i!==-1&&i<=n&&(o=a+1);}),o}function Ct(e,t){let r=0;for(let n of e){let o=N(n,t);!o||!/^\d{1,9}$/.test(o)||(r=Math.max(r,Number(o)));}return r+1}function ur(e,t){let r=e.parts.get(P),n=r??pr();if(!n)return null;let o=n.root,s=b(o,"abstractNum"),a=b(o,"num"),i=t==="bullet"?"bullet":"decimal";for(let O of a){let _=N(O,"numId"),ze=b(O,"abstractNumId")[0],We=ze?N(ze,"val"):void 0;if(!_||!We)continue;let Ye=s.find(V=>N(V,"abstractNumId")===We);if(!Ye)continue;let Je=b(Ye,"lvl").find(V=>N(V,"ilvl")==="0"||N(V,"ilvl")===void 0),qe=Je?b(Je,"numFmt")[0]:void 0;if(qe&&N(qe,"val")===i)return {pkg:e,numId:_}}let d=Ct(s,"abstractNumId"),l=Ct(a,"numId"),c=Et(dr(t,d)+`<w:num w:numId="${l}"><w:abstractNumId w:val="${d}"/></w:num>`,[{localName:"abstractNum",attribute:{localName:"abstractNumId",value:String(d)}},{localName:"num",attribute:{localName:"numId",value:String(l)}}]);if(!c)return null;let p=chunkBZK64YU3_cjs.Ca(n),[u,m]=c.map(O=>ee(O,p));if(!u||!m)return null;let f=chunkBZK64YU3_cjs.Ha(n,o.id,Rt(o.children,Ot,"abstractNum"),[u]);if(!f.ok)return null;let y=chunkBZK64YU3_cjs.Ha(f.part,o.id,Rt(f.part.root.children,Ot,"num"),[m]);if(!y.ok)return null;let g=Object.freeze({...e,parts:new Map([...e.parts,[P,y.part]])});if(!r){let O=gr(g);if(!O)return null;let _=Or(O);if(!_)return null;g=_;}return {pkg:g,numId:String(l)}}var mr=["nsid","multiLevelType","tmpl","name","styleLink","numStyleLink","lvl"];function It(e){let t=N(e,"ilvl");return t===void 0||!/^\d{1,9}$/.test(t)?null:Number(t)}function fr(e,t){let r=0;return e.forEach((n,o)=>{if(n.kind!=="textValue"){if(n.localName==="lvl"&&n.namespaceUri===U){(It(n)??0)<t&&(r=o+1);return}mr.includes(n.localName)&&(r=o+1);}}),r}function yr(e,t,r,n){if(!Number.isInteger(r)||r<0||r>=je||t.length===0||t.length>64)return null;let o=e.parts.get(P);if(!o)return null;let s=o.root,a=b(s,"num").find(f=>N(f,"numId")===t),i=a?b(a,"abstractNumId")[0]:void 0,d=i?N(i,"val"):void 0;if(!d)return null;let l=b(s,"abstractNum").find(f=>N(f,"abstractNumId")===d);if(!l||b(l,"numStyleLink").length>0)return null;let c=b(l,"lvl");if(c.some(f=>It(f)===r))return e;if(c.length>=je)return null;let p=Et(Pt(n,r),[{localName:"lvl",attribute:{localName:"ilvl",value:String(r)}}]);if(!p)return null;let u=chunkBZK64YU3_cjs.Ca(o),m=chunkBZK64YU3_cjs.Ha(o,l.id,fr(l.children,r),[ee(p[0],u)]);return m.ok?Object.freeze({...e,parts:new Map([...e.parts,[P,m.part]])}):null}function ee(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(r=>ee(r,t))}}function gr(e){let t=e.mainDocumentPart,r=hr(t),n=e.parts.get(r),o=xr(e),s=chunkBZK64YU3_cjs.Aa(`<Relationships xmlns="${sr}"><Relationship Id="${o}" Type="${gt}" Target="numbering.xml"/></Relationships>`,{name:r,contentType:lr});if(!s.ok)return null;let a=e.relationships.get(t)??[],i={ownerPart:t,id:o,type:gt,rawTarget:"numbering.xml",targetMode:"Internal",order:a.reduce((u,m)=>Math.max(u,m.order),-1)+1},d=new Map([...e.relationships,[t,[...a,i]]]);if(!n)return Object.freeze({...e,parts:new Map([...e.parts,[r,s.part]]),relationships:d});let l=chunkBZK64YU3_cjs.Ca(n),c=s.part.root.children[0];if(!c)return null;let p=chunkBZK64YU3_cjs.Ha(n,n.root.id,n.root.children.length,[ee(c,l)]);return p.ok?Object.freeze({...e,parts:new Map([...e.parts,[r,p.part]]),relationships:d}):null}function hr(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function xr(e){let t=0;for(let r of e.relationships.values())for(let n of r){let o=/^rId(\d{1,9})$/.exec(n.id);o&&(t=Math.max(t,Number(o[1])));}for(let r of e.externalTargets){let n=/^rId(\d{1,9})$/.exec(r.id);n&&(t=Math.max(t,Number(n[1])));}return `rId${t+1}`}var Nr=`<Override PartName="${P}" ContentType="${w}"/>`;function Or(e){let t=e.contentTypes.overrides.get(chunkBZK64YU3_cjs.o(P));if(t===w)return e;if(t!==void 0)return null;let r=e.partBytes.get(ht);if(!r)return null;let n=fflate.strFromU8(r),o=bt(n);if(!o)return null;let s=n.lastIndexOf(`</${o.rootName}>`);if(s===-1)return null;let a=n.slice(0,s)+Nr+n.slice(s),i=bt(a);if(!i||i.rootName!==o.rootName)return null;let d=[...o.children,kt("Override",{PartName:P,ContentType:w})];return i.children.length!==d.length||i.children.some((l,c)=>l!==d[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[ht,fflate.strToU8(a)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunkBZK64YU3_cjs.o(P),w]])})})}function bt(e){let t=chunkBZK64YU3_cjs.ca(e);if(!t.ok)return null;let r=t.nodes.filter(i=>i.type==="element");if(r.length!==1)return null;let n=r[0],o=n.name.indexOf(":"),s=o===-1?"":n.name.slice(0,o);if(n.name.slice(o+1)!=="Types"||n.attributes[s?`xmlns:${s}`:"xmlns"]!==cr)return null;let a=[];for(let i of n.children)i.type==="element"&&a.push(kt(i.name,i.attributes));return {rootName:n.name,children:a}}function kt(e,t){let r=Object.entries(t).map(([n,o])=>`${n}=${o}`).sort();return [e,...r].join("")}var vt=Object.freeze({trackRevisions:false,restrictedToTrackedChanges:false,doNotTrackMoves:false,doNotTrackFormatting:false});function Rr(e){return e!=null&&e.kind!=="textValue"}function St(e,t){for(let r of e.children)if(r.kind!=="textValue"&&r.namespaceUri===chunkBZK64YU3_cjs.la&&r.localName===t)return r;return null}function Ge(e,t){for(let r of e.attributes)if(r.namespaceUri===chunkBZK64YU3_cjs.la&&r.localName===t)return r.value}function Ke(e,t){let r=St(e,t);if(!r)return false;let n=Ge(r,"val");return n===void 0?true:n!=="0"&&n!=="false"&&n!=="off"}function Cr(e){if(!Rr(e))return vt;let t=St(e,"documentProtection"),r=t===null?void 0:Ge(t,"enforcement"),n=r!==void 0&&r!=="0"&&r!=="false"&&r!=="off";return {trackRevisions:Ke(e,"trackRevisions"),restrictedToTrackedChanges:n&&t!==null&&Ge(t,"edit")==="trackedChanges",doNotTrackMoves:Ke(e,"doNotTrackMoves"),doNotTrackFormatting:Ke(e,"doNotTrackFormatting")}}function br(e,t){let r=e.parts.get(t.storyPartName);if(!r)return {ok:false,reason:`no story part named ${t.storyPartName}`};let n=[];for(let d of chunkBZK64YU3_cjs.me(r.root)){let l=chunkBZK64YU3_cjs.ke(d.node).tag;if(l===void 0||l.length===0)continue;let c=t.decide(l);c!=="keep"&&n.push({nodeId:d.node.id,policy:c});}let o=r,s=0,a=0;for(let{nodeId:d,policy:l}of n){let c=chunkBZK64YU3_cjs.Fa(o,d);if(!c)continue;if(l==="remove"){let g=chunkBZK64YU3_cjs.Ja(o,d,{deferValidation:true});if(!g.ok)return {ok:false,reason:`a node could not be removed: ${Tt(g)}`};o=g.part,a+=1;continue}let p=c.children.find(g=>g.id===d);if(!p)continue;let u=chunkBZK64YU3_cjs.ie(p),m=u?u.children:[],f=c.children.flatMap(g=>g.id===d?m:[g]),y=chunkBZK64YU3_cjs.Ga(o,c.id,f,{deferValidation:true});if(!y.ok)return {ok:false,reason:`a node could not be unwrapped: ${Tt(y)}`};o=y.part,s+=1;}let i=o===r?e:chunkBZK64YU3_cjs.yb(e,o);if(!i.parts.has(t.storyPartName))return {ok:false,reason:"the story went missing during the export"};for(let d of t.namespaces)for(let l of Er(i,t.storyPartName,d)){let c=chunkBZK64YU3_cjs._e(i,l.itemId),p=chunkBZK64YU3_cjs.Ue(i,l.partName,c);if(p.pkg===i&&p.removed.length===0&&!Pr(i,l.partName,c))return {ok:false,reason:`the payloads in ${d} could not be removed`};if(i=p.pkg,c.size>0)continue;let u=Ir(i,l);if(!u.ok)return {ok:false,reason:`the payload store for ${d} could not be removed`};i=u.pkg;}return {ok:true,pkg:i,unwrapped:s,removed:a}}function Pr(e,t,r){return chunkBZK64YU3_cjs.Qe(e,t).every(n=>r.has(n.id))}function Tt(e){return e.issues.map(t=>t.code).join(", ")||"the edit was refused"}function Er(e,t,r){return chunkBZK64YU3_cjs.Me(e,t).filter(n=>n.namespaceUri===r)}function Ir(e,t){let r=chunkBZK64YU3_cjs.Eb(e,t.partName);if(!r.ok)return {pkg:e,ok:false};let n=chunkBZK64YU3_cjs.Eb(r.pkg,t.propsPartName);return n.ok?{pkg:n.pkg,ok:true}:{pkg:e,ok:false}}
2
+ exports.A=Fe;exports.B=Me;exports.C=Be;exports.D=Kt;exports.E=at;exports.F=ct;exports.G=Yt;exports.H=qt;exports.I=yt;exports.J=nr;exports.K=or;exports.L=ur;exports.M=yr;exports.N=vt;exports.O=Cr;exports.P=br;exports.a=wt;exports.b=et;exports.c=W;exports.d=k;exports.e=Y;exports.f=J;exports.g=h;exports.h=Dt;exports.i=v;exports.j=F;exports.k=q;exports.l=M;exports.m=Q;exports.n=Te;exports.o=we;exports.p=_e;exports.q=Bt;exports.r=Ht;exports.s=Ae;exports.t=rt;exports.u=Ut;exports.v=$e;exports.w=Vt;exports.x=B;exports.y=De;exports.z=Le;
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunkBS554B6D_cjs=require('./chunk-BS554B6D.cjs'),chunkJQFDLZXQ_cjs=require('./chunk-JQFDLZXQ.cjs'),chunkBZK64YU3_cjs=require('./chunk-BZK64YU3.cjs'),prosemirrorModel=require('prosemirror-model'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorKeymap=require('prosemirror-keymap'),prosemirrorCommands=require('prosemirror-commands');function B(t){return t.attributes?.val}function L(t){let e=B(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var mn=/^[0-9A-Fa-f]{6}$/,me=/^\d{1,6}$/,gn=/^-?\d{1,6}$/;function we(t){return t===void 0||t==="auto"?null:mn.test(t)?`#${t}`:null}var yn={single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"},hn={black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"};function kn(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function z(t,e=false){return t===void 0||!(e?gn:me).test(t)?null:`${Number(t)/20}pt`}function wt(t){let e=[],n=[],o=null,s=null;for(let a of t)switch(a.localName){case "b":e.push(`font-weight:${L(a)?"bold":"normal"}`);break;case "i":e.push(`font-style:${L(a)?"italic":"normal"}`);break;case "u":{let r=B(a)??"single";if(r==="none"||!L(a))break;n.push("underline"),o=yn[r]??"solid",s=we(a.attributes?.color);break}case "strike":L(a)&&n.push("line-through");break;case "dstrike":L(a)&&n.push("line-through");break;case "caps":L(a)&&e.push("text-transform:uppercase");break;case "smallCaps":L(a)&&e.push("font-variant:small-caps");break;case "vertAlign":{let r=B(a);r==="superscript"?e.push("vertical-align:super","font-size:0.75em"):r==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let r=we(B(a));r&&e.push(`color:${r}`);break}case "highlight":{let r=hn[B(a)??""];r&&e.push(`background-color:${r}`);break}case "sz":{let r=B(a);r!==void 0&&me.test(r)&&e.push(`font-size:${Number(r)/2}pt`);break}case "rFonts":{let r=kn(a.attributes?.ascii??a.attributes?.hAnsi);r&&e.push(`font-family:${r}`);break}case "spacing":{let r=z(B(a),true);r&&e.push(`letter-spacing:${r}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),o&&e.push(`text-decoration-style:${o}`),s&&e.push(`text-decoration-color:${s}`)),e.join(";")}var xn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Ft(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let o=xn[B(n)??""];o&&e.push(`text-align:${o}`);break}case "ind":{let o=z(n.attributes?.left??n.attributes?.start,true),s=z(n.attributes?.right??n.attributes?.end,true),a=z(n.attributes?.firstLine),r=z(n.attributes?.hanging);o&&e.push(`margin-left:${o}`),s&&e.push(`margin-right:${s}`),a?e.push(`text-indent:${a}`):r&&e.push(`text-indent:-${r}`);break}case "spacing":{let o=z(n.attributes?.before),s=z(n.attributes?.after);o&&e.push(`margin-top:${o}`),s&&e.push(`margin-bottom:${s}`);let a=n.attributes?.line,r=n.attributes?.lineRule;a!==void 0&&me.test(a)&&r!=="exact"&&r!=="atLeast"?e.push(`line-height:${(Number(a)/240).toFixed(3)}`):a!==void 0&&me.test(a)&&e.push(`line-height:${Number(a)/20}pt`);break}case "shd":{let o=we(n.attributes?.fill);o&&e.push(`background-color:${o}`);break}case "pageBreakBefore":L(n)&&e.push("break-before:page");break;}return e.join(";")}var E=new prosemirrorModel.Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Ft(t.attrs.props??[]);return ["p",{"data-node-id":String(t.attrs.nodeId??""),...e?{style:e}:{}},0]},parseDOM:[{tag:"p",getAttrs:t=>typeof t=="string"?null:{nodeId:t.getAttribute("data-node-id")||null,props:[]}}]},text:{group:"inline"},tab:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"tab",class:"docx-tab"},"\u2192"],parseDOM:[{tag:'span[data-token="tab"]'}]},hardBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["br"],parseDOM:[{tag:"br"}]},pageBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"page-break",class:"docx-page-break"}],parseDOM:[{tag:'span[data-token="page-break"]'}]},unknownInline:{inline:true,group:"inline",atom:true,selectable:false,draggable:false,attrs:{nodeId:{default:null},label:{default:""}},toDOM:t=>["span",{"data-token":"unknown","data-node-id":String(t.attrs.nodeId??""),contenteditable:"false",class:"docx-unknown-inline",title:String(t.attrs.label||"Content this editor cannot edit yet. It is preserved.")}],parseDOM:[{tag:'span[data-token="unknown"]',getAttrs:t=>typeof t=="string"?false:{nodeId:t.getAttribute("data-node-id")||null,label:""}}]}},marks:{runProps:{attrs:{props:{default:[]}},excludes:"runProps",toDOM:t=>{let e=t.attrs.props??[],n=wt(e);return ["span",{"data-run-props":On(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=Sn(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function On(t){return JSON.stringify(Array.isArray(t)?t:[])}function Sn(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let o of e){if(typeof o!="object"||o===null)return null;let s=o;if(typeof s.localName!="string"||s.attributes!==void 0&&(typeof s.attributes!="object"||s.attributes===null))return null;n.push(s.attributes===void 0?{localName:s.localName}:{localName:s.localName,attributes:s.attributes});}return n}catch{return null}}function Fe(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function ge(t,e){return JSON.stringify(ye(t))===JSON.stringify(ye(e))}function ye(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[o])=>n<o?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function Ae(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue")continue;let o={};for(let s of n.attributes)o[s.localName]=s.value;e.push(Object.keys(o).length>0?{localName:n.localName,attributes:o}:{localName:n.localName});}return e}function At(t){return t.kind==="textValue"?"":`${{drawing:"Picture",pict:"Picture",object:"Embedded object",fldSimple:"Field",hyperlink:"Hyperlink",sdt:"Content control",tbl:"Table"}[t.localName]??t.localName} \u2014 preserved, not editable yet`}function U(t){if(t.kind==="textValue")return [];let e=[],n=o=>{if(o.kind!=="run")return;let s=o.children.find(r=>r.kind==="runProperties"),a=Ae(s);for(let r of o.children)if(r.kind!=="runProperties"){if(r.kind==="tab"){e.push({kind:"tab"});continue}if(r.kind==="hardBreak"){e.push(chunkBZK64YU3_cjs.Xb(r)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(r.kind==="text"){let d="";for(let p of r.children)p.kind==="textValue"&&(d+=p.value);d.length>0&&e.push({kind:"text",text:d,props:a});continue}e.push({kind:"unknown",nodeId:r.id,label:At(r)});}};return chunkBZK64YU3_cjs.Qb(t.children,0,o=>{if(o.kind==="run"){n(o);return}e.push({kind:"unknown",nodeId:o.id,label:At(o)});}),e}function w(t){let e=[],n=o=>{if(o.kind!=="textValue"){if(o.kind==="body"){for(let s of o.children)s.kind==="paragraph"&&e.push(s);return}for(let s of o.children)n(s);}};return n(t.root),e}function H(t){let e=[];for(let n of chunkBZK64YU3_cjs.we(t))n.root.kind!=="textValue"&&chunkBZK64YU3_cjs.ze(n.root.children,e,0);return e}function W(t){let e=w(t).map(n=>{let o=n.kind==="textValue"?void 0:n.children.find(a=>a.kind==="paragraphProperties"),s=U(n).map(a=>{switch(a.kind){case "text":return E.text(a.text,a.props.length>0?[E.marks.runProps.create({props:a.props})]:[]);case "tab":return E.node("tab");case "hardBreak":return E.node("hardBreak");case "pageBreak":return E.node("pageBreak");default:return E.node("unknownInline",{nodeId:a.nodeId,label:a.label})}});return E.node("paragraph",{nodeId:n.id,props:Ae(o)},s)});return E.node("doc",null,e.length>0?e:[E.node("paragraph")])}function Z(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:Fe(n)});return}n.type.name==="tab"?e.push({kind:"tab"}):n.type.name==="hardBreak"?e.push({kind:"hardBreak"}):n.type.name==="pageBreak"?e.push({kind:"pageBreak"}):n.type.name==="unknownInline"&&e.push({kind:"unknown",nodeId:String(n.attrs.nodeId??""),label:String(n.attrs.label??"")});}),e}function D(t){let e="";for(let n of t)n.kind==="text"?e+=n.text:n.kind==="tab"?e+=" ":n.kind==="hardBreak"?e+=`
2
+ `:n.kind==="pageBreak"&&(e+=chunkBZK64YU3_cjs.Vb);return e}function Lt(t){let e=[],n=0;for(let o of t)o.kind==="text"?n+=o.text.length:o.kind==="tab"||o.kind==="hardBreak"||o.kind==="pageBreak"?n+=1:e.push(`${o.nodeId}@${n}`);return e}function Pn(t,e){if(t===e)return null;let n=0,o=Math.min(t.length,e.length);for(;n<o&&t[n]===e[n];)n+=1;let s=t.length,a=e.length;for(;s>n&&a>n&&t[s-1]===e[a-1];)s-=1,a-=1;return {start:n,endBefore:s,endAfter:a}}function Bt(t){let e=[];for(let n of t)if(n.kind==="text")for(let o=0;o<n.text.length;o+=1)e.push(n.props);else (n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak")&&e.push(e[e.length-1]??[]);return e}function vn(t,e,n,o,s){let a=[],r=Lt(e),d=Lt(n);if(JSON.stringify(r)!==JSON.stringify(d))return {ok:false,reason:"unknown-content-moved",detail:t};ge(o,s)||a.push({op:"setParagraphProperties",paragraphId:t,properties:ye(s)});let p=D(e),m=D(n),h=Pn(p,m);if(h&&(h.endBefore>h.start&&a.push({op:"deleteText",paragraphId:t,start:h.start,end:h.endBefore}),h.endAfter>h.start)){let b=m.slice(h.start,h.endAfter),g=h.start,i="",y=()=>{i.length!==0&&(a.push({op:"insertText",paragraphId:t,offset:g,text:i}),g+=i.length,i="");};for(let k of b)k===" "?(y(),a.push({op:"insertTab",paragraphId:t,offset:g}),g+=1):k===`
3
+ `?(y(),a.push({op:"insertHardBreak",paragraphId:t,offset:g}),g+=1):k===chunkBZK64YU3_cjs.Vb?(y(),a.push({op:"insertPageBreak",paragraphId:t,offset:g}),g+=1):i+=k;y();}if(!h){let b=Bt(e),g=Bt(n),i=0;for(;i<g.length;){if(ge(b[i]??[],g[i])){i+=1;continue}let y=i,k=g[i];for(;i<g.length&&ge(g[i],k)&&!ge(b[i]??[],g[i]);)i+=1;a.push({op:"setRunProperties",paragraphId:t,start:y,end:i,properties:ye(k)});}}return {ok:true,ops:a}}function Le(t,e){let n=w(t),o=[];if(e.forEach(a=>{a.type.name==="paragraph"&&o.push(a);}),o.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let s=o.length-n.length;if(s===0){let a=[];for(let[r,d]of o.entries()){let p=n[r];if(d.attrs.nodeId!==p.id)return {ok:false,reason:"paragraph-reordered",detail:String(d.attrs.nodeId)};let m=vn(p.id,U(p),Z(d),Ae(p.kind==="textValue"?void 0:p.children.find(h=>h.kind==="paragraphProperties")),d.attrs.props??[]);if(!m.ok)return m;a.push(...m.ops);}return {ok:true,ops:a}}return s===1?Rn(n,o):s===-1?In(n,o):{ok:false,reason:"paragraph-count-unexplained",detail:String(s)}}function Rn(t,e){for(let n=0;n<t.length;n+=1){let o=t[n],s=e[n],a=e[n+1];if(!s||!a||s.attrs.nodeId!==o.id)continue;let r=a.attrs.nodeId;if(r!==null&&r!==o.id)continue;let d=D(Z(s));if(d+D(Z(a))===D(U(o))&&Ht(t,e,n)&&jt(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:o.id,offset:d.length}]}}return {ok:false,reason:"split-not-clean"}}function In(t,e){for(let n=0;n+1<t.length;n+=1){let o=t[n],s=t[n+1],a=e[n];if(!a||a.attrs.nodeId!==o.id)continue;let r=D(U(o))+D(U(s));if(D(Z(a))===r&&Ht(t,e,n)&&jt(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:o.id,secondId:s.id}]}}return {ok:false,reason:"join-not-clean"}}function Ht(t,e,n){for(let o=0;o<n;o+=1){let s=e[o],a=t[o];if(!s||s.attrs.nodeId!==a.id||D(Z(s))!==D(U(a)))return false}return true}function jt(t,e,n,o){for(let s=0;n+s<t.length;s+=1){let a=t[n+s],r=e[o+s];if(!r||r.attrs.nodeId!==a.id||D(Z(r))!==D(U(a)))return false}return true}function Tn(t,e){return chunkBZK64YU3_cjs.Ea(t,e)!==null}function Be(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return W(e);let o=new Map;t.forEach(p=>{let m=p.attrs.nodeId;typeof m=="string"&&o.set(m,p);});let s=new Set(n.dirty),a=w(e);if(a.length!==t.childCount)return W(e);let r=W(e),d=[];for(let[p,m]of a.entries()){let h=o.get(m.id);d.push(h&&!s.has(m.id)?h:r.child(p));}return E.node("doc",null,d)}function Nn(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let o=e.get(n.start.paragraphId);return o===void 0?null:o}function _t(t,e,n){for(let s of e)if(s.ranges.length===0)return false;let o=new Set;for(let s of t)s.kind!=="revision"||s.ranges.length>0||zt(s,n)||o.add(chunkBS554B6D_cjs.b(s));for(let s of e)if(o.has(chunkBS554B6D_cjs.b(s)))return false;return true}function $t(t,e,n,o){let s=e.get(n);if(s===void 0)return [...t];let a=[],r=null;for(let d of t){if(d.kind==="revision"&&zt(d,n)){r===null&&(r=a.length);continue}if(r===null){let p=Nn(d,e);p!==null&&p>s&&(r=a.length);}a.push(d);}if(r===null&&(r=a.length),o.length>0){let d=o.length<2?[...o]:[...o].sort((p,m)=>chunkBS554B6D_cjs.g(p,e)-chunkBS554B6D_cjs.g(m,e));a.splice(r,0,...d);}return chunkBZK64YU3_cjs.eg(a)}function zt(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function En(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function Dn(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function Cn(t,e){return t.ranges.length===0||!t.ranges.some(o=>o.start.paragraphId===e||o.end.paragraphId===e)?false:!t.ranges.every(o=>o.start.paragraphId===e&&o.end.paragraphId===e)}function Wt(t,e,n,o,s,a,r){if(t.fromRevision!==e.bodyRevision||r!==e.packageRevision+1||t.story!==void 0&&t.story.kind!=="body"||t.impact!=="text-local"||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0||e.commentsPart!==s||e.commentsExtendedPart!==a)return null;let d=t.dirty[0],p=chunkBZK64YU3_cjs.Ea(o,d);if(!p||p.kind!=="paragraph")return null;for(let m of n){if(m.kind==="comment"){if(En(m,d))return null;continue}if(m.kind==="custom"){if(m.range?.start.paragraphId===d)return null;continue}if(Dn(m,d)||Cn(m,d))return null}return d}var Yt=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,Mn=["ascii","hAnsi","cs","eastAsia"],wn=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"];var Fn=/[\u0000-\u001F\u007F-\u009F]/;function he(t){return t.kind!=="textValue"}function Y(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Gt(t,e){let n=new Map,o=r=>{if(!r||!Yt.test(r))return;let d=r.toLowerCase();n.has(d)||n.set(d,r);},s=[...t].reverse();for(;s.length>0;){let r=s.pop();if(he(r)){if(r.localName==="rFonts"){for(let d of Mn)o(Y(r,d));if(e)for(let d of wn){let p=Y(r,d);p!==void 0&&(p.startsWith("major")?o(e.major):p.startsWith("minor")&&o(e.minor));}}for(let d=r.children.length-1;d>=0;d-=1)s.push(r.children[d]);}}let a=[...n.values()];return a.sort((r,d)=>r<d?-1:r>d?1:0),a}var An=new Set(["paragraph","character","table","numbering"]),Ln=/^[0-9A-Fa-f]{6}$/,Bn=16,Ut=new Map([["normal",0],["title",1],["subtitle",2],["heading 1",11],["heading 2",12],["heading 3",13],["heading 4",14],["heading 5",15],["heading 6",16],["heading 7",17],["heading 8",18],["heading 9",19]]);function Kt(t){return t.children}function He(t,e){for(let n of Kt(t))if(he(n)&&n.localName===e)return n}function Hn(t){return Ut.get(t.name.toLowerCase())??Ut.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function je(t){return t===void 0||t.length===0||t.length>128||Fn.test(t)?null:t}function Xt(t,e){if(!t)return [];let n=new Map;for(let a of t.children){if(!he(a)||a.localName!=="style")continue;let r=je(Y(a,"styleId"));r!==null&&!n.has(r)&&n.set(r,a);}let o=a=>{let r=false,d=false,p=null,m=false,h=false,b=new Set,g=a;for(let k=0;k<Bn&&g!==null&&!b.has(g);k+=1){b.add(g);let I=n.get(g);if(!I)break;let S=He(I,"rPr");for(let T of S?Kt(S):[]){if(!he(T))continue;let v=Y(T,"val"),F=v!=="0"&&v!=="false"&&v!=="off";T.localName==="b"&&!m?(r=F,m=true):T.localName==="i"&&!h?(d=F,h=true):T.localName==="color"&&p===null&&v&&Ln.test(v)&&(p=v);}let P=He(I,"basedOn");g=P?je(Y(P,"val")):null;}let i=e?.(a),y=i?.fontFamily??null;return {fontFamily:y!==null&&Yt.test(y)?y:null,fontSizePt:i?.fontSizeHalfPoints!=null&&i.fontSizeHalfPoints>0?i.fontSizeHalfPoints/2:null,bold:r,italic:d,color:p}},s=[];for(let[a,r]of n){let d=Y(r,"type");if(d===void 0||!An.has(d))continue;let p=He(r,"name"),m=je(p?Y(p,"val"):void 0);s.push({styleId:a,name:m??a,type:d,preview:o(a)});}return s.map((a,r)=>({entry:a,index:r,rank:Hn(a)})).sort((a,r)=>a.rank-r.rank||a.index-r.index).map(a=>a.entry)}var jn=128,_n=/[\u0000-\u001F\u007F-\u009F]/,$n=/[\u0000-\u001F\u007F-\u009F]/g,zn=200,Wn=/^heading ([1-9])$/i;function _e(t){return t.kind!=="textValue"}function re(t,e){for(let n of t.children)if(_e(n)&&n.localName===e)return n}function ne(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Un(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!_e(n)||n.localName!=="style"||ne(n,"type")!=="paragraph")continue;let o=ne(n,"styleId");if(o===void 0||o.length===0||o.length>jn||_n.test(o))continue;let s=re(n,"name"),a=s?ne(s,"val"):void 0,r=a!==void 0?Wn.exec(a):null;if(r){e.set(o,Number(r[1])-1);continue}let d=re(n,"pPr"),p=d?re(d,"outlineLvl"):void 0,m=p?ne(p,"val"):void 0;m!==void 0&&/^[0-8]$/.test(m)&&e.set(o,Number(m));}return e}function $e(t){let e=re(t,"pPr"),n=e?re(e,"pStyle"):void 0;return n?ne(n,"val"):void 0}function Jt(t,e){let n=Un(e);if(n.size===0)return [];let o=[];for(let s of w(t)){if(!_e(s))continue;let a=$e(s);if(a===void 0)continue;let r=n.get(a);if(r===void 0)continue;let p=(chunkBZK64YU3_cjs.vf(t,s.id)??"").replace($n," ").trim().slice(0,zn);p.length!==0&&o.push({text:p,level:r,blockId:s.id});}return o}var ke=48,Yn=/[\u0000-\u001F\u007F-\u009F]/g;function Zt(t){return t.kind!=="textValue"}function xe(t){if(t.kind==="textValue")return t.value.length;if(t.kind==="tab"||t.kind==="hardBreak")return 1;if(t.kind==="runProperties"||t.kind==="generic")return 0;if(t.kind==="hyperlink"||chunkBZK64YU3_cjs.Jb(t)){let n=0,o=t.kind==="hyperlink"?t.children:chunkBZK64YU3_cjs.Lb(t)??[];for(let s of o)n+=xe(s);return n}let e=0;for(let n of t.children)e+=xe(n);return e}function Gn(t){let e=[],n=0;return Zt(t)&&chunkBZK64YU3_cjs.Qb(t.children,0,o=>{if(o.kind==="run"){e.push(n),n+=xe(o);return}n+=xe(o);}),e}function Kn(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let o=t[n];if(e>=o)return {index:n,offset:e-o}}return {index:0,offset:e}}function ze(t,e){return t.replace(Yn," ").slice(0,e)}function Qt(t,e,n={}){let o={matches:[],truncated:false};if(!chunkBZK64YU3_cjs.ng(e))return o;let s=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,a={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},r=[],d=0;for(let p of w(t)){if(!Zt(p))continue;let m=d;d+=1;let h=chunkBZK64YU3_cjs.vf(t,p.id)??"";if(h.length===0)continue;let b=chunkBZK64YU3_cjs.og(h,e,s-r.length,a),g=null;for(let i of b.matches){let y=i.start+i.length;g??=Gn(p);let k=Kn(g,i.start);r.push({blockId:p.id,start:i.start,length:i.length,paragraphIndex:m,runIndex:k.index,runOffset:k.offset,text:ze(h.slice(i.start,y),256),contextBefore:ze(h.slice(Math.max(0,i.start-ke),i.start),ke),contextAfter:ze(h.slice(y,y+ke),ke)});}if(b.truncated)return {matches:r,truncated:true}}return {matches:r,truncated:false}}var Xn=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],Jn=/^[0-9A-Fa-f]{6}$/,qt={windowText:"000000",window:"FFFFFF"};function en(t){return t.kind!=="textValue"}function be(t,e){return t.attributes.find(n=>n.localName===e)?.value}function tn(t,e){let n=[t];for(;n.length>0;){let o=n.pop();if(en(o)){if(o.localName===e)return o;for(let s=o.children.length-1;s>=0;s-=1)n.push(o.children[s]);}}return null}function Oe(t,e){for(let n of t.children)if(en(n)&&(e===void 0||n.localName===e))return n;return null}function Zn(t){let e=Oe(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=be(e,"val");else if(e.localName==="sysClr"){let o=be(e,"val")??"";n=be(e,"lastClr")??(Object.prototype.hasOwnProperty.call(qt,o)?qt[o]:void 0);}return n===void 0||!Jn.test(n)?null:n.toUpperCase()}var Qn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Vt(t,e){let n=Oe(t,e),o=n?Oe(n,"latin"):null,s=o?be(o,"typeface"):void 0;return s!==void 0&&Qn.test(s)?s:null}function oe(t){if(!t)return {major:null,minor:null};let e=tn(t,"fontScheme");return e?{major:Vt(e,"majorFont"),minor:Vt(e,"minorFont")}:{major:null,minor:null}}function nn(t){if(!t)return [];let e=tn(t,"clrScheme");if(!e)return [];let n=[];for(let o of Xn){let s=Oe(e,o),a=s?Zn(s):null;if(a===null)return [];n.push({slot:o,hex:a});}return n}var qn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var Vn=/[\u0000-\u001F\u007F-\u009F]/;function an(t){return t.kind!=="textValue"}function G(t,e){for(let n of t.children)if(an(n)&&n.localName===e)return n}function K(t,e){return t.attributes.find(n=>n.localName===e)?.value}function rn(t){return t===void 0||t.length===0||t.length>128||Vn.test(t)?null:t}function Se(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function er(t,e){let n=Se(K(t,"asciiTheme"),e)??Se(K(t,"hAnsiTheme"),e);if(n!==null)return n;let o=K(t,"ascii")??K(t,"hAnsi");return o===void 0?null:qn.test(o)?o:null}function on(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=G(t,"rFonts"),o=G(t,"sz"),s=o?K(o,"val"):void 0,a=s!==void 0&&/^\d{1,4}$/.test(s)?Number(s):null;return {fontFamily:n?er(n,e):null,fontSizeHalfPoints:a!==null&&a>=2&&a<=3276?a:null}}function We(t,e){let n=new Map,o={fontFamily:null,fontSizeHalfPoints:null};if(t){let r=G(t,"docDefaults"),d=r?G(r,"rPrDefault"):void 0;o=on(d?G(d,"rPr"):void 0,e);for(let p of t.children){if(!an(p)||p.localName!=="style")continue;let m=rn(K(p,"styleId"));if(m===null||n.has(m))continue;let h=G(p,"basedOn");n.set(m,{basedOn:rn(h?K(h,"val"):void 0),own:on(G(p,"rPr"),e)});}}let s=new Map,a=r=>{let d=r??"",p=s.get(d);if(p)return p;let m=null,h=null,b=new Set,g=r;for(let y=0;g!==null&&y<16&&!b.has(g);y+=1){b.add(g);let k=n.get(g);if(!k)break;m??=k.own.fontFamily,h??=k.own.fontSizeHalfPoints,g=k.basedOn;}let i={fontFamily:m??o.fontFamily,fontSizeHalfPoints:h??o.fontSizeHalfPoints};return s.set(d,i),i};return (r,d)=>{let p=a(r),m=d?.find(b=>b.localName==="rFonts"),h=m?Se(m.attributes?.asciiTheme,e)??Se(m.attributes?.hAnsiTheme,e):null;return h===null?p:{...p,fontFamily:h}}}function ln(t){let e=new Map,n=new Map,o=new Map;return H(t).forEach((s,a)=>{o.set(s.id,a);let r=chunkBZK64YU3_cjs.Hc(s);if(r===null||!chunkBZK64YU3_cjs.Gc(r))return;e.set(s.id,r);let d=r.toUpperCase();n.has(d)||n.set(d,s.id);}),Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:o})}var tr=Object.freeze([]);function nr(t,e={}){let n=chunkBZK64YU3_cjs.wb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let o=n.package,s=o.parts.get(o.mainDocumentPart);if(!s)return {ok:false,reason:"no-main-document-tree",detail:o.mainDocumentPart};let a=chunkBZK64YU3_cjs.Nc(s),r=new chunkBZK64YU3_cjs.Af(o,a),d=null,p=null,m=null,h=null;r.subscribe(l=>{h=l;});let b=()=>r.bodyStore(),g=()=>r.currentPackage(),i=Object.freeze({kind:"body"}),y=(l,u)=>{let c=r.currentPackage(),f=l.checkpoint();l.graftPackage(()=>r.currentPackage());let x=u();return x.ok&&(l.restoreHistoryStacks(f),r.replacePackageShell(l.package),r.adoptPackageUnit(c),r.publishStoryWrite(x.change)),x},k=()=>{if(!d||d.packageRevision!==r.packageRevision){let l=chunkBZK64YU3_cjs.Sb(g());d={packageRevision:r.packageRevision,resolution:l,parts:chunkBZK64YU3_cjs.Tb(g())};}return d},I="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",S="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",P=false,T=null,v=()=>{if(P)return T;P=true;let l=g(),u=(l.relationships.get(l.mainDocumentPart)??[]).find(f=>f.type===I),c;if(u){let f=chunkBZK64YU3_cjs.N(u);f.mode==="Internal"&&f.target.ok&&(c=l.parts.get(f.target.partName));}return c??=l.parts.get("/word/styles.xml"),T=c?.root??null,T},F=false,j=null,ae=()=>{if(F)return j;F=true;let l=g(),u=(l.relationships.get(l.mainDocumentPart)??[]).find(f=>f.type===S),c;if(u){let f=chunkBZK64YU3_cjs.N(u);f.mode==="Internal"&&f.target.ok&&(c=l.parts.get(f.target.partName));}return c??=l.parts.get("/word/numbering.xml"),j=c?.root??null,j},Q="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",le=-1,Pe=null,Ue=()=>{if(le===r.packageRevision)return Pe;le=r.packageRevision;let l=g(),u=(l.relationships.get(l.mainDocumentPart)??[]).find(f=>f.type===Q),c;if(u){let f=chunkBZK64YU3_cjs.N(u);f.mode==="Internal"&&f.target.ok&&(c=l.parts.get(f.target.partName));}return c??=l.parts.get("/word/settings.xml"),Pe=c?.root??null,Pe},dn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Ye=false,ve=null,q=()=>{if(Ye)return ve;Ye=true;let l=g(),u=(l.relationships.get(l.mainDocumentPart)??[]).find(f=>f.type===dn),c;if(u){let f=chunkBZK64YU3_cjs.N(u);f.mode==="Internal"&&f.target.ok&&(c=l.parts.get(f.target.partName));}return c??=l.parts.get("/word/theme/theme1.xml"),ve=c?.root??null,ve},pn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",se=null,fn=()=>{if(se)return se;let l=g(),u=(l.relationships.get(l.mainDocumentPart)??[]).find(f=>f.type===pn),c;if(u){let f=chunkBZK64YU3_cjs.N(u);f.mode==="Internal"&&f.target.ok&&(c=l.parts.get(f.target.partName));}return c??=l.parts.get("/word/fontTable.xml"),se=Object.freeze(chunkJQFDLZXQ_cjs.G(l,c)),se},V=null,Ge=null,Ke=null,Xe=null,ie=null,ue=null,ee=null,te=null,ce=null,de=null,Re=()=>{let l=b();return (!ce||ce.revision!==l.revision)&&(ce={revision:l.revision,index:ln(l.part)}),ce.index};return {ok:true,session:{editable:H(b().part).length>0,paragraphIds:()=>H(b().part).map(l=>l.id),paragraphIdsIn(l=i){let u=r.partFor(l);return u?H(u).map(c=>c.id):[]},part:()=>b().part,partFor:l=>r.partFor(l),currentPackage:g,applyTreeOps(l,u,c,f=i){if(l.length===0)return {committed:false,rejected:false,opCount:0};let x=l.filter(R=>chunkBZK64YU3_cjs.Rc(R)||chunkBZK64YU3_cjs.Xd(R)).length;if(x>0){if(x!==l.length||l.length!==1)return {committed:false,rejected:true,opCount:l.length,reason:"invalidArgs"};let R=r.applyLifecycleOp(l[0]);return R.ok?{committed:true,rejected:false,opCount:1}:{committed:false,rejected:true,opCount:1,reason:R.detail??R.reason}}let O=r.transact(f,R=>{u!==void 0&&R.selectionBefore(u),c!==void 0&&R.selectionAfter(c);for(let N of l)R.apply(N);});return O.ok?{committed:true,rejected:false,opCount:l.length}:{committed:false,rejected:true,opCount:l.length,reason:O.reason}},projectDoc:()=>W(b().part),reconcile:l=>Be(l,b().part,h),lastCommitWasStructural:()=>h!==null&&(h.created.length>0||h.deleted.length>0||h.splitJoin.length>0||h.impact==="global"),applyPmDoc(l){let u=b(),c=Le(u.part,l);if(!c.ok)return {committed:false,rejected:true,opCount:0,reason:c.reason};if(c.ops.length===0)return {committed:false,rejected:false,opCount:0};let f=r.transact(i,x=>{for(let O of c.ops)x.apply(O);});return f.ok?{committed:true,rejected:false,opCount:c.ops.length}:{committed:false,rejected:true,opCount:c.ops.length,reason:f.reason}},bodyText:()=>rr(b().part),storyText(l){let u=r.partFor(l);return u?H(u).map(c=>chunkBZK64YU3_cjs.vf(u,c.id)??"").join(`
4
+ `):null},revision:()=>b().revision,revisionFor:l=>r.revisionFor(l),packageRevision:()=>r.packageRevision,canUndo:()=>r.canUndo,canRedo:()=>r.canRedo,undo:()=>{let l=r.selectionForUndo();return r.undo()===null?null:l},redo:()=>{let l=r.selectionForRedo();return r.redo()===null?null:l},beginComposition:(l=i)=>{r.beginComposition(l);},endComposition:()=>r.endComposition(),subscribe(l){return r.subscribe(l)},save(){return chunkBZK64YU3_cjs.xb(g())},headerFooterParts:()=>{let l=k().parts;return l[l.length-1]??chunkBZK64YU3_cjs.Ub(g())},headerFooterPartsBySection:()=>k().parts,headerFooterResolutionBySection:()=>k().resolution,documentFonts(){if(V&&V.revision===r.packageRevision)return V.fonts;let l=k().parts,u=[b().part.root],c=v();c&&u.push(c);let f=new Set;for(let x of l){for(let O of x.headers.values())f.has(O)||(f.add(O),u.push(O.root));for(let O of x.footers.values())f.has(O)||(f.add(O),u.push(O.root));}return V={revision:r.packageRevision,fonts:Gt(u,oe(q()))},V.fonts},documentStyles(){ie??=We(v(),oe(q()));let l=ie;return Ge??=Xt(v(),u=>l(u)),Ge},stylesRoot:()=>v(),documentThemeFonts(){return Xe??=oe(q()),Xe},numberingRoot:()=>ae(),settingsRoot:()=>Ue(),trackingSettings:()=>chunkJQFDLZXQ_cjs.O(Ue()),documentThemeColors(){return Ke??=nn(q()),Ke},effectiveRunDefaults(l,u){ie??=We(v(),oe(q()));let c=b();if(!ue||ue.revision!==c.revision){let f=new Map;for(let x of H(c.part))x.kind!=="textValue"&&f.set(x.id,$e(x)??null);ue={revision:c.revision,byId:f};}return ie(ue.byId.get(l)??null,u)},documentOutline(){let l=b();return ee&&ee.revision===l.revision||(ee={revision:l.revision,outline:Jt(l.part,v())}),ee.outline},findText(l,u){let c=b(),f=`${u?.matchCase===true?"c":""}${u?.wholeWord===true?"w":""}${u?.limit??""}\0${l}`;if(te&&te.revision===c.revision&&te.key===f)return te.result;let x=Qt(c.part,l,u??{});return te={revision:c.revision,key:f,result:x},x},embeddedFonts:fn,paragraphAnchors:Re,paraIdOf:l=>Re().paraIdByNode.get(l)??null,nodeIdOf:l=>Re().nodeByParaId.get(l.toUpperCase())??null,relationshipTarget:(l,u=i)=>{let c=g(),f=r.partFor(u);return f?chunkBZK64YU3_cjs.Qc(c,f.name,l):null},bookmarks:()=>{let l=b();return (!de||de.revision!==l.revision)&&(de={revision:l.revision,index:chunkBZK64YU3_cjs.vc(l.part)}),de.index},ensureHyperlinkRelationship(l,u=i){let c=r.partFor(u);if(!c)return null;let f=g(),x=chunkBZK64YU3_cjs.Pc(f,l,c.name);return x?(x.pkg!==f&&r.replacePackageShell(x.pkg),x.relationshipId):null},reviewItems(){let l=e.reviewModel;if(!l)return tr;let u=b(),c=`${r.packageRevision}:${u.revision}`;if(p&&p.revisionKey===c)return p.items;let f=g(),x=f.parts.get(chunkBZK64YU3_cjs.Ef(f,u.part.name)),O=f.parts.get(chunkBZK64YU3_cjs.Ff(f,u.part.name)),R=[],N=new Set;for(let _ of k().parts)for(let X of [_.headers,_.footers])for(let Ie of X.values())N.has(Ie)||(N.add(Ie),R.push(Ie));for(let _ of ["footnote","endnote"]){let X=chunkBZK64YU3_cjs.Rd(f,_);!X||N.has(X)||(N.add(X),R.push(X));}let C=p&&h?Wt(h,p,p.items,u.part,x,O,r.packageRevision):null,M,A;if(C&&p){let _=l.revisionItemsOfParagraph(u.part,C);_t(p.items,_,C)?(M=$t(p.items,p.paragraphOrder,C,_),A=p.paragraphOrder):(A=chunkBZK64YU3_cjs.fg(u.part),M=l.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:O,customNodePayloads:chunkBZK64YU3_cjs.Lf(g(),u.part.name)}));}else A=chunkBZK64YU3_cjs.fg(u.part),M=l.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:O,customNodePayloads:chunkBZK64YU3_cjs.Lf(g(),u.part.name)});return p={revisionKey:c,bodyRevision:u.revision,packageRevision:r.packageRevision,items:M,paragraphOrder:A,commentsPart:x,commentsExtendedPart:O},p.items},hasReviewContent(){let l=b();return (!m||m.revision!==l.revision)&&(m={revision:l.revision,present:chunkBZK64YU3_cjs.af(l.part).length>0||un(l.part.root)}),m.present},replyToComment(l,u,c,f,x,O=i){let R=O.kind==="body"?null:r.resolveStory(O),N=R?.ok?R.store:b(),C=r.currentPackage(),M=N.checkpoint();N.graftPackage(()=>r.currentPackage());let A=chunkBZK64YU3_cjs.Bf(N,{anchor:{paragraphId:u.paragraphId,start:u.start,end:u.end,...u.endParagraphId===void 0?{}:{endParagraphId:u.endParagraphId}},author:f,text:c,...x===void 0?{}:{date:x},...l===null?{}:{replyToCommentId:l}});return A.ok?(N.restoreHistoryStacks(M),r.replacePackageShell(N.package),r.adoptPackageUnit(C),r.publishStoryWrite(A.change),A.commentId):null},setCommentResolved(l,u){let c=b(),f=r.currentPackage(),x=c.checkpoint();c.graftPackage(()=>r.currentPackage());let O=chunkBZK64YU3_cjs.Cf(c,l,u);return O.ok?(c.restoreHistoryStacks(x),r.replacePackageShell(c.package),r.adoptPackageUnit(f),r.publishStoryWrite(O.change),true):false},deleteComment(l){let u=b(),c=r.currentPackage(),f=u.checkpoint();u.graftPackage(()=>r.currentPackage());let x=false,O=false,R=u.transact(N=>{N.applyPackage(C=>{let M=chunkBZK64YU3_cjs.Ee(C,l);return M===null?(x=true,C):(O=M!==C,M)});});return x||!R.ok||!O?false:(u.restoreHistoryStacks(f),r.installPackageSnapshot(u.package),r.adoptPackageUnit(c),r.publishStoryWrite(R.change),true)},insertCustomNode(l,u=i){let c=u.kind==="body"?null:r.resolveStory(u),f=c?.ok?c.store:b();return y(f,()=>chunkBZK64YU3_cjs.If(f,l,b().part.name))},removeCustomNode(l,u=i){let c=u.kind==="body"?null:r.resolveStory(u),f=c?.ok?c.store:b();return y(f,()=>chunkBZK64YU3_cjs.Jf(f,l))},sweepCustomNodePayloads(l){let u=b(),c=chunkBZK64YU3_cjs.Kf(r.currentPackage(),u.part.name,l);return c.ok?c.removed.length===0?{ok:true,removed:[]}:(r.replacePackageShell(c.pkg),{ok:true,removed:c.removed}):{ok:false,reason:c.reason}},ensureListDefinition(l){let u=chunkJQFDLZXQ_cjs.L(g(),l);return u?(r.replacePackageShell(u.pkg),F=false,j=null,u.numId):null},ensureNumberingLevel(l,u,c){let f=g(),x=chunkJQFDLZXQ_cjs.M(f,l,u,c);return x?(x!==f&&(r.replacePackageShell(x),F=false,j=null),true):false},insertImage(l,u){return r.insertImage(l,u)},replaceImage(l,u,c,f,x,O){return r.replaceImage(l,u,c,f,x,O)},deleteImage(l,u){return r.deleteImage(l,u)},applyImageProperties(l,u){return r.applyImageProperties(l,u)}}}}function rr(t){return w(t).map(e=>chunkBZK64YU3_cjs.vf(t,e.id)??"").join(`
5
+ `)}var sn=new WeakMap;function un(t,e=0){if(e>64)return false;let n=sn.get(t);if(n!==void 0)return n;let o=false;for(let s of t.children)if(s.kind!=="textValue"&&(s.kind==="commentRangeStart"||s.kind==="commentReference"||un(s,e+1))){o=true;break}return sn.set(t,o),o}var or=chunkBZK64YU3_cjs.s.projection;function gr(t,e,n){let o=t.filter(s=>s.localName!==e);return o.length!==t.length?o:[...o,n?{localName:e,attributes:n}:{localName:e}]}function yr(t,e,n={}){let o=null,s=false,a=()=>n.onChange?.(r()),r=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:o}),d=i=>{s=true;let y=m.state.tr.replaceWith(0,m.state.doc.content.size,i.content);y.setMeta("addToHistory",false),m.dispatch(y),s=false;},p=i=>()=>(i()&&(d(e.projectDoc()),a()),true),m=new prosemirrorView.EditorView(t,{state:prosemirrorState.EditorState.create({doc:e.projectDoc(),plugins:[prosemirrorKeymap.keymap({...prosemirrorCommands.baseKeymap,Home:prosemirrorCommands.selectTextblockStart,End:prosemirrorCommands.selectTextblockEnd,"Mod-z":p(()=>e.undo()!==null),"Mod-y":p(()=>e.redo()!==null),"Shift-Mod-z":p(()=>e.redo()!==null),"Mod-b":(i,y)=>g(i,y,"b"),"Mod-i":(i,y)=>g(i,y,"i"),"Mod-u":(i,y)=>g(i,y,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:i=>(h(i),false),beforeinput:(i,y)=>{let k=y;if(i.composing)return false;h(i);let I=k.inputType;if(I==="insertText"&&k.data!=null){k.preventDefault();let{from:S,to:P}=i.state.selection;return i.dispatch(i.state.tr.insertText(k.data,S,P)),true}if(I==="deleteContentBackward"){k.preventDefault();let{from:S,empty:P}=i.state.selection;return P?S>0?i.dispatch(i.state.tr.delete(S-1,S)):prosemirrorCommands.joinBackward(i.state,i.dispatch):prosemirrorCommands.deleteSelection(i.state,i.dispatch),true}if(I==="deleteContentForward"){k.preventDefault();let{from:S,to:P,empty:T}=i.state.selection;return T?P<i.state.doc.content.size?i.dispatch(i.state.tr.delete(S,S+1)):prosemirrorCommands.joinForward(i.state,i.dispatch):prosemirrorCommands.deleteSelection(i.state,i.dispatch),true}return I==="insertParagraph"?(k.preventDefault(),prosemirrorCommands.splitBlock(i.state,i.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),a(),false)},dispatchTransaction(i){let y=m.state.apply(i);if(s||!i.docChanged){m.updateState(y);return}let k=e.applyPmDoc(y.doc);if(k.rejected){o=String(k.reason??"rejected"),m.updateState(y),d(e.projectDoc()),a();return}o=null,m.updateState(k.committed&&e.lastCommitWasStructural()?b(y):y),a();}});function h(i){if(i.composing||s)return;let y=i.dom.ownerDocument.getSelection(),k=y?.anchorNode,I=y?.focusNode;if(!(!y||!k||!I)&&!(!i.dom.contains(k)||!i.dom.contains(I)))try{let S=i.posAtDOM(k,y.anchorOffset),P=i.posAtDOM(I,y.focusOffset),T=i.state.selection;if(T.anchor===S&&T.head===P)return;let v=prosemirrorState.TextSelection.create(i.state.doc,S,P);i.dispatch(i.state.tr.setSelection(v).setMeta("addToHistory",!1));}catch{}}function b(i){let y=e.paragraphIds(),k=i.tr,I=false,S=0;return i.doc.forEach((P,T)=>{let v=y[S];S+=1,!(P.type.name!=="paragraph"||v===void 0)&&P.attrs.nodeId!==v&&(k=k.setNodeMarkup(T,void 0,{...P.attrs,nodeId:v}),I=true);}),I?i.apply(k.setMeta("addToHistory",false)):i}function g(i,y,k,I){let S=E.marks.runProps;if(!y)return true;let{from:P,to:T,empty:v}=i.selection;if(v)return true;let j=i.doc.resolve(P).marks().find(le=>le.type===S)?.attrs.props??[],ae=gr(j,k,I),Q=i.tr;return Q.removeMark(P,T,S),ae.length>0&&Q.addMark(P,T,S.create({props:ae})),y(Q),true}return {view:m,state:r,undo:()=>p(()=>e.undo()!==null)(),redo:()=>p(()=>e.redo()!==null)(),toggleRunProperty(i,y){g(m.state,m.dispatch.bind(m),i,y);},destroy:()=>m.destroy()}}exports.a=E;exports.b=Fe;exports.c=w;exports.d=H;exports.e=W;exports.f=Le;exports.g=Tn;exports.h=Be;exports.i=$e;exports.j=nr;exports.k=or;exports.l=yr;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkBZK64YU3_cjs=require('./chunk-BZK64YU3.cjs');var Nt=Object.freeze(["default","first","even"]),it=Object.freeze({kind:"body"});function _(r){switch(r.kind){case "body":return "body";case "note":return `note:${r.noteKind}:${String(r.noteId)}`;default:return `${r.kind}:${String(r.sectionIndex)}:${r.variant}`}}function Ke(r){if(typeof r!="object"||r===null)return false;let e=r;return e.kind==="body"?true:e.kind==="note"?(e.noteKind==="footnote"||e.noteKind==="endnote")&&Number.isInteger(e.noteId):e.kind!=="header"&&e.kind!=="footer"?false:Number.isInteger(e.sectionIndex)&&e.sectionIndex>=0&&Nt.includes(e.variant)}var Fo=["getDocument","getBody","getParagraphs","getSpanParagraphs","getText","getSpanText","getParagraphId","search","getFont","getParagraphFormat","getStyle","getSections","getPageSetup","getFurniture","getNotes","getNoteBody","getNoteKind","getLists","getListId","getListById","getListParagraphs","getParagraphList","getListLevel","getHyperlink","getBookmarks","getBookmarkName","getBookmarkRange","getComments","getCommentReplies","getCommentId","getCommentAuthor","getCommentDate","getCommentText","getCommentRange","getCommentResolved","getRevisions","getRevisionType","getRevisionAuthor","getRevisionDate","getRevisionRange","getContentControls","getContentControlById","getContentControlsByTag","getContentControlsByTitle","getContentControlTag","getContentControlTitle","getContentControlFileId","getContentControlSubtype","getContentControlLock","getContentControlPlaceholderShown","getContentControlTemporary","getContentControlText","getContentControlParagraphs","getContentControlRange"],Mn=["insertText","replaceSpan","insertParagraph","splitParagraph","deleteParagraph","selectSpan","setFont","setParagraphFormat","setStyle","setPageSetup","deleteNote","setListLevel","insertListParagraph","setHyperlink","setCommentResolved","replyToComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","setContentControlValue","setContentControlProperties","deleteContentControl","insertContentControlText","insertContentControl","insertCustomNode"],En=["deleteNote","setCommentResolved","replyToComment","insertCustomNode"],_n=new Set(En);function We(r){return _n.has(r.op)}var Fn=new Set(Mn);function $t(r){return Fn.has(r.op)}function Bn(){let r=globalThis.crypto,e=r?.getRandomValues;if(typeof e!="function")throw new Error("automation: no secure random source. globalThis.crypto.getRandomValues is required to scope document handles to one host.");let s=e.call(r,new Uint8Array(16)),a="";for(let l of s)a+=l.toString(16).padStart(2,"0");return a}function jn(r){return typeof r=="object"&&r!==null&&"kind"in r&&"ref"in r}function ze(){let r=new Map,e=new Map,s=new Map,a=new Map,l=Bn(),u=null,h=(m,k)=>{let f=(a.get(m)??0)+1;a.set(m,f);let g=`${m}:${l}:${String(f)}`;return r.set(g,k),Object.freeze({kind:m,ref:g})},b=(m,k,f)=>{let g=`${m}\0${k}`,R=s.get(g);if(R)return Object.freeze({kind:m,ref:R});let A=h(m,f);return s.set(g,A.ref),A};return {document(){return u??=h("document",{kind:"document"}),u},body(m){return b("body",_(m),{kind:"body",story:m})},paragraph(m,k){let f=e.get(m);if(f)return Object.freeze({kind:"paragraph",ref:f});let g=h("paragraph",{kind:"paragraph",paragraphId:m,story:k});return e.set(m,g.ref),g},section(m){return b("section",String(m),{kind:"section",index:m})},note(m,k){return b("note",`${m}:${String(k)}`,{kind:"note",noteKind:m,noteId:k})},comment(m,k){return b("comment",`${_(k)}\0${m}`,{kind:"comment",commentId:m,story:k})},revision(m,k){return b("revision",`${_(k)}\0${m}`,{kind:"revision",revisionId:m,story:k})},bookmark(m,k){return b("bookmark",`${_(k)}\0${m}`,{kind:"bookmark",name:m,story:k})},list(m,k){return b("list",`${_(k)}\0${m}`,{kind:"list",numId:m,story:k})},contentControl(m,k){return b("contentControl",`${_(k)}\0${m}`,{kind:"contentControl",nodeId:m,story:k})},retarget(m,k){let f=e.get(m);if(!f||m===k)return;let g=r.get(f);!g||g.kind!=="paragraph"||(e.delete(m),r.set(f,{kind:"paragraph",paragraphId:k,story:g.story}),e.has(k)||e.set(k,f));},resolve(m,k){if(!jn(m)||m.kind!==k||typeof m.ref!="string")return null;let f=r.get(m.ref);return !f||f.kind!==k?null:f}}}var Kn=255,Wn=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false});function De(r){let e=chunkBZK64YU3_cjs.Ec(r);if(!e)return Wn;let s=new Map,a=new Map,l=null;for(let u of chunkBZK64YU3_cjs.Dc(e).values())if(u.type==="paragraph"){if(s.set(u.styleId,u.name),u.name!==null){let h=u.name.trim().toLowerCase();a.has(h)||a.set(h,u.styleId);}u.isDefault&&l===null&&(l=u.styleId);}return Object.freeze({nameOf:u=>s.get(u)??null,idOf:u=>a.get(u.trim().toLowerCase())??null,defaultId:l,present:true})}function Ht(r,e,s){let a=chunkBZK64YU3_cjs.Ea(r,e);if(!a||a.kind!=="paragraph")return null;let l=zn(chunkBZK64YU3_cjs.Jd(chunkBZK64YU3_cjs.Hd(a),"pStyle"));return l!==null?s.nameOf(l):s.defaultId===null?null:s.nameOf(s.defaultId)}function zn(r){if(!r)return null;for(let e of r.attributes)if(e.localName==="val")return e.value;return null}function Lt(r,e){if(typeof r!="string"||r.trim().length===0)return {ok:false,detail:"style: not a name"};if(r.length>Kn)return {ok:false,detail:"style: name too long"};if(!chunkBZK64YU3_cjs.W(r))return {ok:false,detail:"style: not valid XML text"};if(!e.present)return {ok:false,detail:"style: this document defines no styles"};let s=e.idOf(r);return s===null?{ok:false,detail:"style: this document defines no paragraph style with that name"}:{ok:true,styleId:s}}var $e=20,Dn=31680,Vn=1999,$n=Object.freeze({bold:null,italic:null,name:null,size:null,color:null});function U(r,e){if(!r)return null;for(let s of r.attributes)if(s.localName===e)return s.value;return null}function Ut(r){if(!r)return null;let e=U(r,"val");if(e===null)return true;let s=e.trim().toLowerCase();return !(s==="0"||s==="false"||s==="off"||s==="none")}function Un(r){if(r===null)return null;let e=r.trim();return /^[0-9a-fA-F]{6}$/.test(e)?`#${e.toUpperCase()}`:null}function Xn(r){if(r===null)return null;let e=Number(r.trim());return !Number.isFinite(e)||e<=0?null:e/2}function ct(r){if(r===null)return null;let e=Number(r.trim());return Number.isFinite(e)?e/$e:null}function bt(r){if(r.length===0)return null;let e=r[0];if(e===null)return null;for(let s of r)if(s!==e)return null;return e}function Ue(r,e){let s=[];for(let a of e)for(let l of chunkBZK64YU3_cjs.Yf(r,a.paragraphId,a.start,a.end))s.push(chunkBZK64YU3_cjs.Id(l));return s.length===0?$n:{bold:bt(s.map(a=>Ut(chunkBZK64YU3_cjs.Jd(a,"b")))),italic:bt(s.map(a=>Ut(chunkBZK64YU3_cjs.Jd(a,"i")))),name:bt(s.map(a=>{let l=chunkBZK64YU3_cjs.Jd(a,"rFonts"),u=U(l,"ascii");return u===null||u.length===0?null:u})),size:bt(s.map(a=>Xn(U(chunkBZK64YU3_cjs.Jd(a,"sz"),"val")))),color:bt(s.map(a=>Un(U(chunkBZK64YU3_cjs.Jd(a,"color"),"val"))))}}var Yn=Object.freeze({left:"Left",start:"Left",center:"Centered",right:"Right",end:"Right",both:"Justified",distribute:"Justified"}),Gn=Object.freeze({Left:"left",Centered:"center",Right:"right",Justified:"both"});function Jn(r){let e=U(chunkBZK64YU3_cjs.Jd(r,"jc"),"val");return e===null?"Unknown":Yn[e.trim().toLowerCase()]??"Unknown"}function Xe(r,e,s){let a=chunkBZK64YU3_cjs.Ea(r,e);if(!a||a.kind!=="paragraph")return null;let l=chunkBZK64YU3_cjs.Hd(a),u=chunkBZK64YU3_cjs.Jd(l,"spacing"),h=chunkBZK64YU3_cjs.Jd(l,"ind");return {alignment:Jn(l),style:Ht(r,e,s),firstLineIndent:Qn(h),leftIndent:ct(U(h,"left")??U(h,"start")),rightIndent:ct(U(h,"right")??U(h,"end")),lineSpacing:ct(U(u,"line")),spaceBefore:ct(U(u,"before")),spaceAfter:ct(U(u,"after")),widowControl:Ut(chunkBZK64YU3_cjs.Jd(l,"widowControl"))}}function Qn(r){let e=ct(U(r,"firstLine"));if(e!==null)return e;let s=ct(U(r,"hanging"));return s===null?null:-s}function Mt(r,e){if(typeof r!="number"||!Number.isFinite(r))return {ok:false,detail:`${e}: not a measurement`};let s=Math.round(r*$e);return Math.abs(s)>Dn?{ok:false,detail:`${e}: out of range`}:{ok:true,value:s}}function Ye(r){let e=[];if(r.bold!==void 0){if(typeof r.bold!="boolean")return {ok:false,detail:"bold: not a boolean"};e.push({localName:"b",...r.bold?{}:{attributes:{val:"0"}}});}if(r.italic!==void 0){if(typeof r.italic!="boolean")return {ok:false,detail:"italic: not a boolean"};e.push({localName:"i",...r.italic?{}:{attributes:{val:"0"}}});}if(r.name!==void 0){let s=r.name;if(typeof s!="string"||s.length===0||s.length>128)return {ok:false,detail:"name: not a font name"};if(!chunkBZK64YU3_cjs.W(s))return {ok:false,detail:"name: not valid XML text"};e.push({localName:"rFonts",attributes:{ascii:s,hAnsi:s,cs:s}});}if(r.size!==void 0){let s=r.size;if(typeof s!="number"||!Number.isFinite(s)||s<=0)return {ok:false,detail:"size: not a positive number of points"};let a=Math.round(s*2);if(a<1||a>Vn)return {ok:false,detail:"size: out of range"};e.push({localName:"sz",attributes:{val:String(a)}}),e.push({localName:"szCs",attributes:{val:String(a)}});}if(r.color!==void 0){let s=r.color;if(typeof s!="string"||!/^#[0-9a-fA-F]{6}$/.test(s.trim()))return {ok:false,detail:"color: not a #RRGGBB triplet"};e.push({localName:"color",attributes:{val:s.trim().slice(1).toUpperCase()}});}return e.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:e}}function Ge(r,e,s,a){let l=chunkBZK64YU3_cjs.Ea(r,e);if(!l||l.kind!=="paragraph")return {ok:false,detail:"not a paragraph"};let u=chunkBZK64YU3_cjs.Hd(l),h=[];if(s.style!==void 0){let A=Lt(s.style,a);if(!A.ok)return {ok:false,detail:A.detail};h.push({localName:"pStyle",attributes:{val:A.styleId}});}if(s.alignment!==void 0){let A=Gn[s.alignment];if(A===void 0)return {ok:false,detail:`alignment: ${String(s.alignment)}`};h.push({localName:"jc",attributes:{val:A}});}let b=chunkBZK64YU3_cjs.Jd(u,"ind"),m=Ve(b),k=false;if(s.firstLineIndent!==void 0){let A=Mt(s.firstLineIndent,"firstLineIndent");if(!A.ok)return A;delete m.firstLine,delete m.hanging,A.value<0?m.hanging=String(-A.value):m.firstLine=String(A.value),k=true;}for(let[A,T,O]of [["leftIndent","left","start"],["rightIndent","right","end"]]){let H=s[A];if(H===void 0)continue;let L=Mt(H,A);if(!L.ok)return L;delete m[O],m[T]=String(L.value),k=true;}k&&h.push({localName:"ind",attributes:m});let f=chunkBZK64YU3_cjs.Jd(u,"spacing"),g=Ve(f),R=false;for(let[A,T]of [["spaceBefore","before"],["spaceAfter","after"]]){let O=s[A];if(O===void 0)continue;let H=Mt(O,A);if(!H.ok)return H;if(H.value<0)return {ok:false,detail:`${A}: out of range`};g[T]=String(H.value),R=true;}if(s.lineSpacing!==void 0){let A=Mt(s.lineSpacing,"lineSpacing");if(!A.ok)return A;if(A.value<=0)return {ok:false,detail:"lineSpacing: out of range"};g.line=String(A.value),g.lineRule??="auto",R=true;}if(R&&h.push({localName:"spacing",attributes:g}),s.widowControl!==void 0){if(typeof s.widowControl!="boolean")return {ok:false,detail:"widowControl: not a boolean"};h.push({localName:"widowControl",...s.widowControl?{}:{attributes:{val:"0"}}});}return h.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:chunkBZK64YU3_cjs.Uf(chunkBZK64YU3_cjs.Sf(r,e),h)}}function Ve(r){let e=Object.create(null);if(!r)return e;for(let s of r.attributes)e[s.localName]=s.value;return e}var Je=20,Zn=63360;function rt(r){return Math.round(r/Je*100)/100}function qn(r,e){if(typeof r!="number"||!Number.isFinite(r))return null;let s=Math.round(r*Je);return s>Zn||s<0||s===0&&!e?null:s}var to=[["pageWidth","pageWidthTwips",false],["pageHeight","pageHeightTwips",false],["topMargin","marginTopTwips",true],["rightMargin","marginRightTwips",true],["bottomMargin","marginBottomTwips",true],["leftMargin","marginLeftTwips",true]];function Qe(r){if(typeof r!="object"||r===null)return {ok:false,reason:"that is not a page setup",detail:"not-an-object"};let e=r,s={},a=0;for(let[u,h,b]of to){let m=e[u];if(m===void 0)continue;let k=qn(m,b);if(k===null)return {ok:false,reason:`that is not a value for ${u}`,detail:String(m)};s[h]=k,a+=1;}let l=e.orientation;if(l!==void 0){if(l!=="portrait"&&l!=="landscape")return {ok:false,reason:"that is not an orientation",detail:String(l)};s.orientation=l,a+=1;}return a===0?{ok:false,reason:"that page setup names nothing to write",detail:"empty"}:{ok:true,value:s}}function eo(r){let e=chunkBZK64YU3_cjs.ef(r),s=e.widthTwips>e.heightTwips?"landscape":"portrait";return Object.freeze({pageWidth:rt(e.widthTwips),pageHeight:rt(e.heightTwips),orientation:s,topMargin:rt(e.topTwips),rightMargin:rt(e.rightTwips),bottomMargin:rt(e.bottomTwips),leftMargin:rt(e.leftTwips),headerDistance:rt(e.headerTwips),footerDistance:rt(e.footerTwips),gutter:rt(e.gutterTwips)})}function no(r,e){if(!e)return null;let s=null,a=(l,u,h)=>{if(s!==null||l.kind==="textValue"||h>64)return;let b=l.kind==="paragraph"?l.id:u;if(l.id===e.id){s=b;return}for(let m of l.children)a(m,b,h+1);};return a(r.root,null,0),s}function Ze(r,e,s){let a=chunkBZK64YU3_cjs.Rb(e.root);return Object.freeze(a.map((l,u)=>{let h=s[u];return Object.freeze({index:u,markParagraphId:no(e,l),pageSetup:eo(l),titlePage:h?.titlePage??false,evenAndOddHeaders:h?.evenAndOddHeaders??false})}))}var Yt="\r",oo=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false}),ro=Object.freeze([]),ao=Object.freeze([]),qe=Object.freeze([]),so=Object.freeze({package:null,body:null,story:()=>null,storyOf:()=>null,sections:()=>ao,furniture:()=>qe,noteIds:()=>Object.freeze([]),styles:()=>oo});function io(r){return r.kind==="textValue"?ro:Object.freeze(r.children.filter(e=>e.kind!=="textValue").map(e=>{let s=[];chunkBZK64YU3_cjs.ze([e],s,0);let a=e.kind==="paragraph"?"paragraph":e.kind==="table"?"table":"other",l=e.kind==="paragraph"&&chunkBZK64YU3_cjs.Jd(chunkBZK64YU3_cjs.Hd(e),"sectPr")!==void 0;return Object.freeze({id:e.id,kind:a,paragraphIds:Object.freeze(s.map(u=>u.id)),removable:a!=="other"&&!l})}))}function Xt(r,e,s,a,l){let u=chunkBZK64YU3_cjs.ye(a),h=Object.freeze(u.map(g=>g.id)),b=new Map,m=new Map;u.forEach((g,R)=>{b.set(g.id,R),m.set(g.id,g);});let k=new Map,f=g=>{if(!b.has(g))return null;let R=k.get(g);if(R!==void 0)return R;let A=chunkBZK64YU3_cjs.vf(e,g)??"";return k.set(g,A),A};return {story:r,part:e,root:a,scope:s,paragraphIds:h,blocks:io(a),has:g=>b.has(g),indexOf:g=>b.get(g)??-1,paragraph(g){let R=m.get(g);return R?{nodeId:g,paraId:chunkBZK64YU3_cjs.Hc(R),text:f(g)??""}:null},node:g=>m.get(g)??null,paragraphText:f,text:()=>h.map(g=>f(g)??"").join(Yt),styles:l}}function tn(r){let e=r.parts.get(r.mainDocumentPart);if(!e)return so;let s,a=()=>s??=De(r),l,u=()=>l??=chunkBZK64YU3_cjs.Sb(r),h,b=new Map,m=A=>{let T=u()[A.sectionIndex];return T?(A.kind==="header"?T.headers:T.footers).get(A.variant)??null:null},k=A=>{if(A.kind==="body"){let O=chunkBZK64YU3_cjs.xe(e);return O?Xt(A,e,{kind:"body"},O,a):null}if(A.kind==="note"){let O=chunkBZK64YU3_cjs.Rd(r,A.noteKind);if(!O)return null;let H=chunkBZK64YU3_cjs.td(O.root,A.noteId);return !H||!chunkBZK64YU3_cjs.jd(H)?null:Xt(A,O,{kind:"notesPart",noteKind:A.noteKind},H,a)}let T=m(A);return T?Xt(A,T.part,{kind:"headerFooter",rId:T.rId},T.part.root,a):null},f=A=>{let T=_(A);if(b.has(T))return b.get(T)??null;let O=k(A);return b.set(T,O),O},g=A=>{if(f(it)?.has(A))return it;for(let[O]of u().entries())for(let H of ["header","footer"])for(let L of Nt){let j={kind:H,sectionIndex:O,variant:L};if(f(j)?.has(A))return j}for(let O of ["footnote","endnote"])for(let H of R(O)){let L={kind:"note",noteKind:O,noteId:H};if(f(L)?.has(A))return L}return null},R=A=>{let T=chunkBZK64YU3_cjs.Rd(r,A);if(!T)return lo;let O=[];for(let H of chunkBZK64YU3_cjs.sd(T.root)){if(!chunkBZK64YU3_cjs.jd(H))continue;let L=chunkBZK64YU3_cjs.hd(H);L!==null&&O.push(L);}return Object.freeze(O)};return {package:r,get body(){return f(it)},story:f,storyOf:g,sections:()=>h??=Ze(r,e,u()),furniture(A){let T=u()[A];if(!T)return qe;let O=[];for(let H of ["header","footer"]){let L=H==="header"?T.headers:T.footers;for(let j of Nt){let Q=L.get(j);Q&&O.push(Object.freeze({kind:H,variant:j,declared:!Q.inherited}));}}return Object.freeze(O)},noteIds:R,styles:a}}var lo=Object.freeze([]);function q(r,e){return {ok:false,code:r,detail:e}}function tt(r){return {ok:true,value:r}}function $(r,e,s,a){let l=s.resolve(r,e);if(!l||l.kind!=="body"&&l.kind!=="paragraph")return q("invalid-handle",`not-a-${e}-handle`);let u=a.story(l.story);return u?tt(u):q("invalid-handle",`no-such-story:${_(l.story)}`)}function G(r,e,s){let a=e.resolve(r,"paragraph");if(!a||a.kind!=="paragraph")return q("invalid-handle","not-a-paragraph-handle");let l=s.story(a.story);if(!l)return q("invalid-handle",`no-such-story:${_(a.story)}`);let u=l.indexOf(a.paragraphId);return u<0?q("invalid-handle","paragraph-not-in-body"):tt({story:a.story,paragraphId:a.paragraphId,index:u,offset:0})}function uo(r,e,s){let a=G(r.paragraph,e,s);if(!a.ok)return a;let u=(s.story(a.value.story)?.paragraphText(a.value.paragraphId)??"").length,{offset:h}=r;return !Number.isInteger(h)||h<0||h>u?q("invalid-offset",`offset ${String(h)} outside 0..${String(u)}`):tt({...a.value,offset:h})}function mt(r,e,s){if("paragraph"in r){if(!("at"in r))return uo(r,e,s);let b=G(r.paragraph,e,s);if(!b.ok||r.at==="start")return b;let k=(s.story(b.value.story)?.paragraphText(b.value.paragraphId)??"").length;return tt({...b.value,offset:k})}let a=$(r.body,"body",e,s);if(!a.ok)return a;let l=a.value.paragraphIds;if(l.length===0)return q("invalid-offset","empty-story");if(r.at==="start")return tt({story:a.value.story,paragraphId:l[0],index:0,offset:0});let u=l.length-1,h=l[u];return tt({story:a.value.story,paragraphId:h,index:u,offset:(a.value.paragraphText(h)??"").length})}function co(r,e){return r.index<e.index||r.index===e.index&&r.offset<=e.offset}function po(r){let e=r.paragraphIds;if(e.length===0)return null;let s=e.length-1,a=e[s];return {start:{story:r.story,paragraphId:e[0],index:0,offset:0},end:{story:r.story,paragraphId:a,index:s,offset:(r.paragraphText(a)??"").length}}}function W(r,e,s){if("body"in r){let u=$(r.body,"body",e,s);return u.ok?tt(po(u.value)):u}if("paragraph"in r){let u=G(r.paragraph,e,s);if(!u.ok)return u;let b=(s.story(u.value.story)?.paragraphText(u.value.paragraphId)??"").length;return tt({start:u.value,end:{...u.value,offset:b}})}let a=mt(r.start,e,s);if(!a.ok)return a;let l=mt(r.end,e,s);return l.ok?_(a.value.story)!==_(l.value.story)?q("invalid-handle","span-crosses-stories"):co(a.value,l.value)?tt({start:a.value,end:l.value}):q("invalid-offset","span-start-after-end"):l}function at(r,e,s){if("body"in r)return $(r.body,"body",e,s);if("paragraph"in r)return $(r.paragraph,"paragraph",e,s);let a=r.start;return "paragraph"in a?$(a.paragraph,"paragraph",e,s):$(a.body,"body",e,s)}function Et(r,e,s){if("paragraph"in r)return G(r.paragraph,e,s);let a=$(r.body,"body",e,s);if(!a.ok)return a;let l=a.value.paragraphIds;if(l.length===0)return q("invalid-offset","empty-story");let u=r.at==="first"?0:l.length-1;return tt({story:a.value.story,paragraphId:l[u],index:u,offset:0})}function et(r,e){return r?e.paragraphIds.slice(r.start.index,r.end.index+1):[]}function Gt(r,e){if(!r)return [];let s=et(r,e),a=s.length-1;return s.map((l,u)=>{let h=(e.paragraphText(l)??"").length,b=u===0?r.start.offset:0,m=u===a?r.end.offset:h;return {paragraphId:l,start:b,end:m,whole:b===0&&m===h}})}function en(r,e,s){if(!r)return "";let a=et(r,e);return a.length===1?(e.paragraphText(r.start.paragraphId)??"").slice(r.start.offset,r.end.offset):a.map((l,u)=>{let h=e.paragraphText(l)??"";return u===0?h.slice(r.start.offset):u===a.length-1?h.slice(0,r.end.offset):h}).join(s)}function Jt(r,e){return {start:{paragraph:e.paragraph(r.start.paragraphId,r.start.story),offset:r.start.offset},end:{paragraph:e.paragraph(r.end.paragraphId,r.end.story),offset:r.end.offset}}}var mo=256,nn=1e4;function Qt(r,e){if(r.kind!=="textValue"){for(let s of r.attributes)if(s.namespaceUri===chunkBZK64YU3_cjs.la&&s.localName===e)return s.value}}function fo(r){return r.startsWith("_")}function Zt(r){let e=new Map,s=[],a=new Set;for(let l of r.paragraphIds){let u=r.node(l);if(u?.kind!=="paragraph")continue;let h=chunkBZK64YU3_cjs.Ld(u),b=m=>{if(m.kind!=="textValue"){if(m.kind==="bookmarkStart"){if(s.length>=nn||e.size>=nn)return;let k=Qt(m,"id"),f=Qt(m,"name");if(k===void 0||f===void 0||f.length===0||f.length>mo||fo(f)||a.has(f)||e.has(k))return;let g=h.spanOf(m)?.start??0;e.set(k,{name:f,start:{paragraphId:l,offset:g}});return}if(m.kind==="bookmarkEnd"){let k=Qt(m,"id");if(k===void 0)return;let f=e.get(k);if(!f)return;e.delete(k),a.add(f.name);let g=h.spanOf(m)?.start??0;s.push(Object.freeze({name:f.name,start:f.start,end:{paragraphId:l,offset:g}}));return}for(let k of m.children)b(k);}};for(let m of u.children)b(m);}return Object.freeze(s)}function qt(r,e){return Zt(r).find(s=>s.name===e)??null}function on(r,e){let s=r.node(e);if(s?.kind!=="paragraph")return Object.freeze([]);let a=chunkBZK64YU3_cjs.Ld(s),l=[],u=(h,b)=>{if(!(h.kind==="textValue"||b>32)){if(chunkBZK64YU3_cjs.Qa(h)){let m=a.spanOf(h);m&&l.push(Object.freeze({id:h.id,paragraphId:e,start:m.start,end:m.end}));return}for(let m of h.children)u(m,b+1);}};for(let h of s.children)u(h,0);return Object.freeze(l)}function rn(r,e,s){let a=chunkBZK64YU3_cjs.Ta(s,l=>chunkBZK64YU3_cjs.Qc(r,e,l));if(a.kind==="external")return a.href;if(a.kind==="internal"){let l=chunkBZK64YU3_cjs.Ra(s);return l===void 0||l.length===0?null:`#${l}`}return null}var ft=8;function an(r){if(!r||r.kind==="textValue")return null;for(let e of r.attributes)if(e.namespaceUri===chunkBZK64YU3_cjs.la&&e.localName==="val")return e.value;return null}function sn(r){let e=chunkBZK64YU3_cjs.Jd(chunkBZK64YU3_cjs.Hd(r),"numPr");if(!e)return null;let s=an(chunkBZK64YU3_cjs.Jd(e,"numId"));if(s===null||!/^\d{1,10}$/.test(s)||s==="0")return null;let a=an(chunkBZK64YU3_cjs.Jd(e,"ilvl")),l=a===null?0:Number(a);return !Number.isInteger(l)||l<0||l>ft?null:{numId:s,level:l}}function _t(r){let e=new Map;for(let s of r.paragraphIds){let a=r.node(s);if(!a)continue;let l=sn(a);if(!l)continue;let u=e.get(l.numId);u?u.push(s):e.set(l.numId,[s]);}return Object.freeze([...e].map(([s,a])=>Object.freeze({numId:s,paragraphIds:Object.freeze(a)})))}function It(r,e){let s=r.node(e);return s?sn(s):null}var go={insert:"Insert",delete:"Delete",replace:"Replace",moveFrom:"MovedFrom",moveTo:"MovedTo",format:"Property",paragraphMark:"ParagraphProperty"};function yo(r){return r.kind==="note"}function ho(r,e){return e.length===0?!yo(r.story):e.every(s=>r.has(s.start.paragraphId))}function te(r){let e=[];for(let s of chunkBZK64YU3_cjs.bg(r.part)){if(s.readOnly||s.revisionKind==="structural"||!ho(r,s.ranges))continue;let a=go[s.revisionKind];a!==void 0&&e.push(Object.freeze({id:s.id,type:a,author:s.author,date:s.date??"",item:s}));}return Object.freeze(e)}function ko(r,e){let s=r;for(let a=0;s!==void 0&&a<=64;a+=1){if(s.parentId===void 0)return s.range!==null;s=e.get(s.parentId);}return false}var Ao=Object.freeze({items:Object.freeze([]),roots:Object.freeze([]),byId:()=>null,textOf:()=>""});function dn(r,e){let s=r.parts.get(chunkBZK64YU3_cjs.Ef(r,e.part.name));if(!s)return Ao;let a=r.parts.get(chunkBZK64YU3_cjs.Ff(r,e.part.name)),l=chunkBZK64YU3_cjs.Ce(s),u=a?chunkBZK64YU3_cjs.De(a):new Map,h=chunkBZK64YU3_cjs.Be(e.part).filter(g=>e.has(g.start.paragraphId)),b=chunkBZK64YU3_cjs.cg(l,h,u),m=new Map(b.map(g=>[g.id,g])),k=b.filter(g=>ko(g,m)),f=new Map(k.map(g=>[g.id,g]));return Object.freeze({items:Object.freeze(k),roots:Object.freeze(k.filter(g=>g.parentId===void 0)),byId:g=>f.get(g)??null,textOf:g=>{let R=f.get(g);return R?chunkBZK64YU3_cjs.$f(R.comment):""}})}var vo=1e4;function ln(r,e){let s=[],a=e.kind==="contentControl"?chunkBZK64YU3_cjs.ie(e):e;if(!a)return s;for(let l of chunkBZK64YU3_cjs.me(a))if(!(l.ancestors.length>0)){if(s.length>=vo)break;s.push(mn(r,l.node));}return s}function un(r,e){for(let s of chunkBZK64YU3_cjs.me(r.root))if(s.node.id===e)return mn(r,s.node);return null}function cn(r,e){for(let s of chunkBZK64YU3_cjs.me(r.root))if(s.node.id===e)return s.node;return null}function ee(r,e){let s=fn(e);if(s.length>0){let a=s[0],l=s[s.length-1],u=r.paragraphText(l);return u===null||!r.has(a)?null:{start:{paragraphId:a,offset:0},end:{paragraphId:l,offset:u.length}}}for(let a of r.paragraphIds){let l=r.node(a);if(!l||l.kind!=="paragraph"||!l.children.some(h=>h.id===e.id))continue;let u=chunkBZK64YU3_cjs.Ld(l).spanOf(e);return u?{start:{paragraphId:a,offset:u.start},end:{paragraphId:a,offset:u.end}}:null}return null}function pn(r){return chunkBZK64YU3_cjs.oe(r)}function mn(r,e){return {nodeId:e.id,properties:chunkBZK64YU3_cjs.ke(e),lock:chunkBZK64YU3_cjs.wf(r.part,e.id),paragraphIds:fn(e)}}function fn(r){let e=chunkBZK64YU3_cjs.ie(r);if(!e)return [];let s=[];return chunkBZK64YU3_cjs.ze(e.children,s,0),s.map(a=>a.id)}var bo=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),Io=4096,gn=64;function yn(r){if(r===void 0)return {ok:true,value:null};if(typeof r!="object"||r===null)return {ok:false,field:"payload"};let e=r;for(let s of ["namespaceUri","rootLocalName","nodeId"]){let a=e[s];if(typeof a!="string"||a.length===0||a.length>Io)return {ok:false,field:s}}return typeof e.label!="string"||e.label.length>chunkBZK64YU3_cjs.Hf?{ok:false,field:"label"}:typeof e.data!="string"||e.data.length===0||e.data.length>chunkBZK64YU3_cjs.Gf?{ok:false,field:"data"}:{ok:true,value:{namespaceUri:e.namespaceUri,rootLocalName:e.rootLocalName,nodeId:e.nodeId,label:e.label,data:e.data}}}function hn(r){let e=r.at!==void 0,s=r.span!==void 0;return e===s?{message:"a custom node goes at a position or over a span, not both",detail:e?"at+span":"no-place"}:typeof r.tag!="string"||r.tag.length===0?{message:"a custom node carries its identity in its tag",detail:"tag"}:r.tag.length>gn?{message:`w:tag caps at ${String(gn)} characters; a longer payload belongs in the store`,detail:"tag"}:typeof r.text!="string"||r.text.length===0?{message:"a custom node shows some text",detail:"text"}:r.lock!==void 0&&!bo.has(r.lock)?{message:"that is not a lock",detail:String(r.lock)}:null}function kn(r,e,s,a){return {paragraphId:e.paragraphId,offset:e.offset,...s.offset>e.offset?{replaceUntil:s.offset}:{},tag:r.tag,text:r.text,...r.title===void 0?{}:{alias:r.title},...r.lock===void 0||r.lock==="unlocked"?{}:{lock:r.lock},...a===null?{}:{payload:a}}}function An(r,e,s){if(r.span){let l=W(r.span,e,s);return l.ok?l.value?l.value.start.paragraphId!==l.value.end.paragraphId?{code:"unsupported-content",message:"a custom node wraps text inside one paragraph",detail:"multi-paragraph"}:{range:l.value}:{code:"invalid-offset",message:"that story holds nothing to wrap",detail:"empty-story"}:{code:l.code,message:"that span is not a place",detail:l.detail}}let a=mt(r.at,e,s);return a.ok?{range:{start:a.value,end:a.value}}:{code:a.code,message:"that is not a place",detail:a.detail}}var xt=/[\r\n\v\f\u2028\u2029]/,xo=16,So=64,vn=/\s/;function Ro(r,e,s){return Object.freeze(s===void 0?{code:r,message:e}:{code:r,message:e,detail:s})}function d(r,e,s){return {ok:false,error:Ro(r,e,s)}}var F=Object.freeze({kind:"applied"});function I(r){return {ok:true,kind:"query",value:r}}function bn(r){let e=r.kind==="contentControl"?chunkBZK64YU3_cjs.ie(r):r;return e?chunkBZK64YU3_cjs.me(e).map(s=>s.node):[]}var Co=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),Oo=new Set(["whole","content","start","end","before","after"]),Po=new Set(["richText","plainText","dropDownList","comboBox","date"]),wo=4096;function To(r){let e=(l,u)=>({ok:false,code:"unsupported-content",message:l,detail:u});if(typeof r!="object"||r===null||!("kind"in r))return e("a control value states its kind","value");let s=r,a=s.kind;if(a==="text"||a==="listItem"){let l=a==="text"?s.text:s.value;return typeof l!="string"?e("that value is not a string",String(a)):l.length>wo?e("that value is too long",String(l.length)):{ok:true,value:a==="text"?{kind:"text",text:l}:{kind:"listItem",value:l}}}if(a==="checkbox"){let l=s.checked;return typeof l!="boolean"?e("a checkbox is checked or not","checked"):{ok:true,value:{kind:"checkbox",checked:l}}}if(a==="date"){let l=s.iso;return typeof l!="string"?e("a date is an ISO-8601 string","iso"):l.length>64?e("that is not a date",String(l.length)):{ok:true,value:{kind:"date",iso:l}}}return e("that is not a value any control accepts",String(a))}function No(r,e){let s=[],a=0;for(;a<r.length;){let l=null;for(let u of e){let h=r.indexOf(u,a);h<0||(!l||h<l.start||h===l.start&&u.length>l.length)&&(l={start:h,length:u.length});}if(!l)break;s.push(l),a=l.start+l.length;}return s}function Ho(r,e,s){let a=e[s]?.markParagraphId??null;if(a!==null)return a;let l=r.paragraphIds,u=l[l.length-1];return u===void 0||new Set(e.map(b=>b.markParagraphId).filter(b=>b!==null)).has(u)?null:u}function Lo(r,e){for(let s of [r.start,r.end]){let a=e.paragraphText(s.paragraphId);if(a===null||s.offset>a.length)return false}return true}function Mo(r,e,s){let a=e,l=s;for(;a<l&&vn.test(r[a]);)a+=1;for(;l>a&&vn.test(r[l-1]);)l-=1;return [a,l]}function In(r){let{handles:e,capabilities:s}=r,a=r.reads,l=new Map,u=o=>{let t=_(o.story),n=l.get(t);if(n)return n;let i=new Map,c=o.paragraphIds.map(y=>{let v={id:y};return i.set(y,v),v}),p={reads:o,order:c,slotById:i,created:[],restructured:new Set,touched:new Set,formatted:new Set,selected:new Set,retargets:[]};return l.set(t,p),p},h=[],b=false,m=false,k=null,f=o=>k===null?(k=o,null):k===o?null:d("conflicting-operations","one batch writes into one story",`${_(k.reads.story)} then ${_(o.reads.story)}`),g=o=>{let t=a.package;return t===null?null:dn(t,o)},R=o=>{let t=e.resolve(o,"comment");if(!t||t.kind!=="comment")return {ok:false,planned:d("invalid-handle","that handle does not name a comment","comment")};let n=a.story(t.story);if(!n)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let c=g(n)?.byId(t.commentId)??null;return c?{ok:true,reads:n,item:c}:{ok:false,planned:d("invalid-handle","this document no longer holds that comment",t.commentId)}},A=o=>{let t=e.resolve(o,"revision");if(!t||t.kind!=="revision")return {ok:false,planned:d("invalid-handle","that handle does not name a tracked change","revision")};let n=a.story(t.story);if(!n)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let i=te(n).find(c=>c.id===t.revisionId)??null;return i?{ok:true,reads:n,item:i}:{ok:false,planned:d("invalid-handle","this document no longer holds that tracked change",t.revisionId)}},T=(o,t)=>{let n=o.paragraphText(t.start.paragraphId),i=o.paragraphText(t.end.paragraphId);if(n===null||i===null)return null;let c={story:o.story,paragraphId:t.start.paragraphId,index:o.indexOf(t.start.paragraphId),offset:Math.min(t.start.offset,n.length)},p={story:o.story,paragraphId:t.end.paragraphId,index:o.indexOf(t.end.paragraphId),offset:Math.min(t.end.offset,i.length)};return M({start:c,end:p})},O=(o,t)=>o.order.indexOf(t),H=(o,t)=>o.selected.has(t)?d("conflicting-operations","this batch selects a paragraph it also edits",t):null,L=(o,t)=>{let n=H(o,t);return n||(o.restructured.has(t)||o.touched.has(t)?d("conflicting-operations","another operation in this batch already changes that paragraph",t):(o.restructured.add(t),o.touched.add(t),null))},j=(o,t)=>{let n=H(o,t);return n||(o.restructured.has(t)?d("conflicting-operations","another operation in this batch restructures that paragraph",t):(o.touched.add(t),null))},Q=(o,t,n)=>{let i=`${n}:${t}`;if(o.formatted.has(i))return d("conflicting-operations","another operation in this batch already writes that formatting",t);let c=j(o,t);return c||(o.formatted.add(i),null)},dt=(o,t)=>{let n={id:null};return o.order.splice(t,0,n),o.created.push(n),n},M=o=>Jt(o,e),X=o=>o===null?null:a.story(o.start.story),St=(o,t,n,i)=>{if(i?.matchWildcards===true)return d("unsupported-capability","wildcard search is not implemented","matchWildcards");if(i?.ignorePunct===true)return d("unsupported-capability","ignoring punctuation is not implemented","ignorePunct");if(i?.ignoreSpace===true)return d("unsupported-capability","ignoring whitespace is not implemented","ignoreSpace");if(!chunkBZK64YU3_cjs.ng(n))return d("unsupported-content","that is not a query this host will scan for","text");let c=i?.limit;if(c!==void 0&&(!Number.isInteger(c)||c<0))return d("invalid-offset","limit must be a non-negative integer",String(c));let p=Math.min(c??2e3,2e3),y=[],v=et(t,o),x=v.length-1;for(let[P,w]of v.entries()){if(p<=0)break;let E=o.paragraphText(w)??"",C=chunkBZK64YU3_cjs.og(E,n,p,{matchCase:i?.matchCase===true,wholeWord:i?.matchWholeWord===true,...P===0&&t?{from:t.start.offset}:{},...P===x&&t?{to:t.end.offset}:{}});for(let S of C.matches){let V=e.paragraph(w,o.story);y.push({start:{paragraph:V,offset:S.start},end:{paragraph:V,offset:S.start+S.length}});}p-=C.matches.length;}return I({kind:"spans",spans:y})},gt=(o,t,n)=>{if(typeof n!="string")return d("unsupported-content","insertText needs text","text");if(xt.test(n))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let i=f(o);if(i)return i;let c=j(o,t.paragraphId);if(c)return c;let p=n.length===0?[]:[{op:"insertText",paragraphId:t.paragraphId,offset:t.offset,text:n}],y=()=>({kind:"span",span:M({start:t,end:{...t,offset:t.offset+n.length}})});return {ok:true,kind:"command",ops:p,story:o.reads.story,answer:y}},Rt=(o,t,n)=>{let i=o.reads;if(typeof n!="string")return d("unsupported-content","replaceSpan needs text","text");if(xt.test(n))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let c=et(t,i),p=t.start.paragraphId,y=[],v=f(o);if(v)return v;if(c.length===1){let w=j(o,p);if(w)return w;t.end.offset>t.start.offset&&y.push({op:"deleteText",paragraphId:p,start:t.start.offset,end:t.end.offset});}else {for(let C of c){let S=L(o,C);if(S)return S}let w=t.end.paragraphId,E=(i.paragraphText(p)??"").length;t.start.offset<E&&y.push({op:"deleteText",paragraphId:p,start:t.start.offset,end:E}),t.end.offset>0&&y.push({op:"deleteText",paragraphId:w,start:0,end:t.end.offset});for(let C of c.slice(1,-1))y.push({op:"deleteBlock",blockId:C});y.push({op:"joinParagraphs",firstId:p,secondId:w});for(let C of c.slice(1)){let S=o.slotById.get(C);S&&o.order.splice(O(o,S),1);}}n.length>0&&y.push({op:"insertText",paragraphId:p,offset:t.start.offset,text:n});let x={...t.start,paragraphId:p},P=()=>({kind:"span",span:M({start:x,end:{...x,offset:x.offset+n.length}})});return {ok:true,kind:"command",ops:y,story:o.reads.story,answer:P}},ne=(o,t)=>{let n=o.reads;if(typeof t!="string")return d("unsupported-content","replaceSpan needs text","text");if(xt.test(t))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let i=n.blocks,c=i.filter(S=>S.removable),p=i.filter(S=>!S.removable).flatMap(S=>S.paragraphIds),y=p.length===0?c.find(S=>S.kind==="paragraph"):void 0;if(!y&&p.length===0)return d("invalid-offset","that story holds no paragraph this host can write into","no-top-level-paragraph");let v=f(o);if(v)return v;for(let S of n.paragraphIds){let V=L(o,S);if(V)return V}let x=[],P=(y?[y.id]:[...p]).sort((S,V)=>n.indexOf(S)-n.indexOf(V)),w=P[0];for(let S of P){let V=(n.paragraphText(S)??"").length;V>0&&x.push({op:"deleteText",paragraphId:S,start:0,end:V});}for(let S of c)S.id!==y?.id&&x.push({op:"deleteBlock",blockId:S.id});t.length>0&&x.push({op:"insertText",paragraphId:w,offset:0,text:t});for(let S of c)if(S.id!==y?.id)for(let V of S.paragraphIds){let Ct=o.slotById.get(V);Ct&&o.order.splice(O(o,Ct),1);}let E={story:n.story,paragraphId:w,index:n.indexOf(w),offset:0},C=()=>({kind:"span",span:M({start:E,end:{...E,offset:t.length}})});return {ok:true,kind:"command",ops:x,story:n.story,answer:C}},N=(o,t,n,i)=>{let c=o.reads;if(typeof i!="string")return d("unsupported-content","insertParagraph needs text","text");if(xt.test(i))return d("unsupported-content","a paragraph mark inside a paragraph\u2019s text is not written by this host","paragraph-mark-in-text");let p=f(o);if(p)return p;let y=L(o,t.paragraphId);if(y)return y;let v=o.slotById.get(t.paragraphId);if(!v)return d("invalid-handle","that paragraph is not in the body");let x=(c.paragraphText(t.paragraphId)??"").length,P=[];n==="after"?(i.length>0&&P.push({op:"insertText",paragraphId:t.paragraphId,offset:x,text:i}),P.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:x})):(i.length>0&&P.push({op:"insertText",paragraphId:t.paragraphId,offset:0,text:i}),P.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:i.length}));let w=dt(o,O(o,v)+1);n==="before"&&o.retargets.push({from:t.paragraphId,slot:w});let E=()=>{let C=n==="after"?w.id:t.paragraphId;return C===null?F:{kind:"handle",handle:e.paragraph(C,c.story)}};return {ok:true,kind:"command",ops:P,story:c.story,answer:E}},K=(o,t,n,i,c)=>{let p=o.reads;if(!Array.isArray(n)||n.length===0)return d("unsupported-content","split needs at least one delimiter","delimiters");if(n.length>xo)return d("unsupported-content","too many delimiters",String(n.length));for(let z of n){if(typeof z!="string"||z.length===0)return d("unsupported-content","a delimiter must be a non-empty string","delimiters");if(z.length>So)return d("unsupported-content","that delimiter is too long","delimiters")}let y=f(o);if(y)return y;let v=L(o,t.paragraphId);if(v)return v;let x=o.slotById.get(t.paragraphId);if(!x)return d("invalid-handle","that paragraph is not in the body");let P=p.paragraphText(t.paragraphId)??"",w=No(P,n),E=[],C=[],S=[];if(w.length===0)S.push(P);else if(i){for(let D of [...w].reverse())E.push({op:"deleteText",paragraphId:t.paragraphId,start:D.start,end:D.start+D.length});let z=0,st=0;for(let D of w){let jt=D.start-z;C.push(jt),S.push(P.slice(st,D.start)),st=D.start+D.length,z+=D.length;}S.push(P.slice(st));}else {let z=0;for(let st of w){let D=st.start+st.length;C.push(D),S.push(P.slice(z,D)),z=D;}S.push(P.slice(z));}C.length>0&&E.push({op:"splitParagraphMany",paragraphId:t.paragraphId,offsets:C});let V=[x];for(let z=0;z<C.length;z+=1)V.push(dt(o,O(o,x)+1+z));let Ct=z=>{let st=z.story(p.story),D=[];return V.forEach((jt,Nn)=>{let Kt=jt.id;if(Kt===null)return;let Wt=st?.paragraphText(Kt)??S[Nn]??"",[Hn,Ln]=c?Mo(Wt,0,Wt.length):[0,Wt.length],re=e.paragraph(Kt,p.story);D.push({start:{paragraph:re,offset:Hn},end:{paragraph:re,offset:Ln}});}),{kind:"spans",spans:D}};return {ok:true,kind:"command",ops:E,story:p.story,answer:Ct}},nt=(o,t)=>{let n=f(o);if(n)return n;let i=L(o,t.paragraphId);if(i)return i;let c=o.slotById.get(t.paragraphId);return c&&o.order.splice(O(o,c),1),{ok:true,kind:"command",ops:[{op:"deleteBlock",blockId:t.paragraphId}],story:o.reads.story,answer:()=>F}},yt=(o,t,n)=>{let i=o.reads,c=i.part,p=f(o);if(p)return p;let y=Ye(n??{});if(!y.ok)return d("unsupported-content","that is not formatting this host writes",y.detail);let v=[];for(let x of Gt(t,i)){if(x.end<=x.start&&!x.whole)continue;let P=Q(o,x.paragraphId,"runs");if(P)return P;for(let w of chunkBZK64YU3_cjs.Xf(c,x.paragraphId,x.start,x.end,y.value))v.push({op:"setRunProperties",paragraphId:x.paragraphId,start:w.start,end:w.end,properties:w.properties,...w.targetRunIds?{targetRunIds:w.targetRunIds}:{}});x.whole&&v.push({op:"setParagraphMarkProperties",paragraphId:x.paragraphId,properties:chunkBZK64YU3_cjs.Uf(chunkBZK64YU3_cjs.Tf(c,x.paragraphId),y.value)});}return v.length===0?d("invalid-offset","that range covers no characters to format","collapsed-range"):{ok:true,kind:"command",ops:v,story:i.story,answer:()=>F}},lt=(o,t,n)=>{let i=o.reads,c=i.part,p=f(o);if(p)return p;let y=Lt(n,i.styles());if(!y.ok)return d("unsupported-content","that is not a style this document has",y.detail);let v={localName:"pStyle",attributes:{val:y.styleId}},x=[];for(let P of et(t,i)){let w=Q(o,P,"paragraph");if(w)return w;x.push({op:"setParagraphProperties",paragraphId:P,properties:chunkBZK64YU3_cjs.Uf(chunkBZK64YU3_cjs.Sf(c,P),v)});}return x.length===0?d("invalid-offset","that story holds no paragraph to style","empty-story"):{ok:true,kind:"command",ops:x,story:i.story,answer:()=>F}},xn=(o,t,n)=>{let i=o.reads,c=i.part,p=f(o);if(p)return p;let y=Ge(c,t.paragraphId,n??{},i.styles());if(!y.ok)return d("unsupported-content","that is not paragraph formatting this host writes",y.detail);let v=Q(o,t.paragraphId,"paragraph");return v||{ok:true,kind:"command",ops:[{op:"setParagraphProperties",paragraphId:t.paragraphId,properties:y.value}],story:i.story,answer:()=>F}},Sn=(o,t)=>{let n=a.body;if(!n)return d("document-unavailable","this host holds no document right now");let i=a.sections();if(!i[o])return d("invalid-handle","that section is not in this document");let p=Qe(t);if(!p.ok)return d("unsupported-content",p.reason,p.detail);let y=Ho(n,i,o);if(y===null)return d("unsupported-content","that section holds no paragraph to address it by","no-anchor");let v=u(n),x=f(v);return x||{ok:true,kind:"command",ops:[{op:"setSectionProperties",...p.value,anchorParagraphId:y}],story:it,answer:()=>F}},Rn=(o,t)=>({ok:true,kind:"command",ops:[{op:"deleteNote",noteKind:o,noteId:t}],story:it,lifecycle:true,answer:()=>F}),Ft=o=>{let t=e.resolve(o,"list");if(!t||t.kind!=="list")return d("invalid-handle","that handle does not name a list","list");let n=a.story(t.story);if(!n)return d("invalid-handle","that story is not in this document");let i=_t(n).find(c=>c.numId===t.numId);return i?{ok:true,plan:u(n),list:i}:d("invalid-handle","this story numbers nothing with that list",t.numId)},Bt=o=>{if(typeof o!="object"||o===null)return d("invalid-handle","that is not a scope a control lives in","scope");let t=o;if("body"in o){let n=$(t.body,"body",e,a);return n.ok?{reads:n.value,node:n.value.root}:d(n.code,"that handle does not name a body",n.detail)}if("contentControl"in o){let n=Z(t.contentControl);return "control"in n?{reads:n.reads,node:n.node}:n}return d("invalid-handle","that is not a scope a control lives in","scope")},Z=o=>{let t=e.resolve(o,"contentControl");if(!t||t.kind!=="contentControl")return d("invalid-handle","that handle does not name a content control","contentControl");let n=a.story(t.story);if(!n)return d("invalid-handle","that story is not in this document");let i=un(n,t.nodeId),c=cn(n,t.nodeId);return !i||!c?d("invalid-handle","this document no longer holds that content control"):{reads:n,control:i,node:c}},Cn=(o,t,n)=>{if(!Number.isInteger(n)||n<0||n>ft)return d("invalid-offset",`a list level is 0 to ${String(ft)}`,String(n));if(!It(o.reads,t))return d("unsupported-content","that paragraph is not in a list",t);let i=f(o);if(i)return i;let c=Q(o,t,"paragraph");return c||{ok:true,kind:"command",ops:[{op:"setListLevel",paragraphId:t,level:n}],story:o.reads.story,answer:()=>F}},On=(o,t,n,i)=>{if(n!=="start"&&n!=="end")return d("unknown-operation","a list takes an item at its start or its end",String(n));let c=o.reads,p=n==="start"?t.paragraphIds[0]:t.paragraphIds[t.paragraphIds.length-1];if(p===void 0)return d("invalid-handle","that list holds no paragraph");let y={story:c.story,paragraphId:p,index:c.indexOf(p)};return N(o,y,n==="start"?"before":"after",i)},oe=(o,t)=>{if(t.start.paragraphId!==t.end.paragraphId)return null;for(let n of on(o,t.start.paragraphId))if(n.start<=t.start.offset&&n.end>=t.end.offset)return n;return null},Pn=(o,t,n)=>{if(typeof n!="string")return d("unsupported-content","a hyperlink target is a string","target");let i=o.reads,c=oe(i,t),p=t.start.paragraphId===t.end.paragraphId&&t.start.offset===t.end.offset;if(n.length===0){if(!c)return d("unsupported-content","that text is not a link","no-link");let C=f(o);if(C)return C;let S=j(o,c.paragraphId);return S||{ok:true,kind:"command",ops:[{op:"removeHyperlink",linkId:c.id}],story:i.story,answer:()=>F}}let y={},v=null;if(n.startsWith("#")){let C=n.slice(1);if(C.length===0||!qt(i,C))return d("unsupported-content","this document declares no such bookmark",n);y={anchor:C};}else {if(chunkBZK64YU3_cjs.Oc(n)===null)return d("unsupported-content","this engine will not author that target","target");v=n;}let x=f(o);if(x)return x;let P=C=>v===null?{ok:true,kind:"command",ops:[C(y)],story:i.story,answer:()=>F}:{ok:true,kind:"command",ops:[],relate:{url:v,ops:S=>[C({relationshipId:S})]},story:i.story,answer:()=>F};if(c){let C=j(o,c.paragraphId);return C||P(S=>({op:"setHyperlinkTarget",linkId:c.id,...S}))}if(p)return d("unsupported-content","a link with no text has nothing to click","collapsed");if(t.start.paragraphId!==t.end.paragraphId)return d("unsupported-content","a link lives inside one paragraph","crosses-paragraph-mark");let w=j(o,t.start.paragraphId);if(w)return w;let E=i.styles().idOf("hyperlink");return P(C=>({op:"insertHyperlink",paragraphId:t.start.paragraphId,start:t.start.offset,end:t.end.offset,...C,...E===null?{}:{styleId:E}}))},wn=(o,t,n)=>{let i=o.reads;if(!s.selection||!r.select)return d("unsupported-capability","this host has no reader to move","selection");if(n!=="select"&&n!=="start"&&n!=="end")return d("unknown-operation","that is not a selection mode",String(n));let c=et(t,i);for(let p of c)if(o.touched.has(p))return d("conflicting-operations","this batch edits a paragraph the selection covers",p);for(let p of c)o.selected.add(p);return h.push({range:t,mode:n}),{ok:true,kind:"command",ops:[],story:i.story,answer:()=>F}},Tn=o=>{switch(o.op){case "getDocument":return I({kind:"handle",handle:e.document()});case "getBody":return e.resolve(o.document,"document")?a.body?I({kind:"handle",handle:e.body(it)}):d("document-unavailable","this host holds no document right now"):d("invalid-handle","that handle does not name a document","document");case "getParagraphs":{let t=$(o.body,"body",e,a);return t.ok?I({kind:"handles",handles:t.value.paragraphIds.map(n=>e.paragraph(n,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getSpanParagraphs":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.span,e,a);return n.ok?I({kind:"handles",handles:et(t.value,n.value).map(i=>e.paragraph(i,n.value.story))}):d(n.code,"that span is not a place",n.detail)}case "getText":{if(e.resolve(o.target,"body")){let c=$(o.target,"body",e,a);return c.ok?I({kind:"text",text:c.value.text()}):d(c.code,"that handle does not name a body",c.detail)}let n=G(o.target,e,a);if(!n.ok)return d(n.code,"that handle does not name a body or a paragraph",n.detail);let i=a.story(n.value.story);return I({kind:"text",text:i?.paragraphText(n.value.paragraphId)??""})}case "getSpanText":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.span,e,a);return n.ok?I({kind:"text",text:en(t.value,n.value,Yt)}):d(n.code,"that span is not a place",n.detail)}case "getParagraphId":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let i=a.story(t.value.story)?.paragraph(t.value.paragraphId);return I({kind:"text",text:i?.paraId??""})}case "search":{let t=W(o.scope,e,a);if(!t.ok)return d(t.code,"that is not a scope to search",t.detail);let n=at(o.scope,e,a);return n.ok?St(n.value,t.value,o.text,o.options):d(n.code,"that is not a scope to search",n.detail)}case "insertText":{let t=mt(o.at,e,a);if(!t.ok)return d(t.code,"that is not a place to insert at",t.detail);let n=a.story(t.value.story);return n?gt(u(n),t.value,o.text):d("invalid-handle","that story is not in this document")}case "replaceSpan":{if("body"in o.span){let i=$(o.span.body,"body",e,a);return i.ok?ne(u(i.value),o.text):d(i.code,"that handle does not name a body",i.detail)}let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to write into","empty-story");let n=X(t.value);return n?Rt(u(n),t.value,o.text):d("invalid-handle","that story is not in this document")}case "insertParagraph":{let t=Et(o.anchor,e,a);if(!t.ok)return d(t.code,"that is not a paragraph to insert beside",t.detail);if(o.where!=="before"&&o.where!=="after")return d("unknown-operation","that is not a place to insert",String(o.where));let n=a.story(t.value.story);return n?N(u(n),t.value,o.where,o.text):d("invalid-handle","that story is not in this document")}case "splitParagraph":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let n=a.story(t.value.story);return n?K(u(n),t.value,o.delimiters,o.trimDelimiters===true,o.trimSpacing===true):d("invalid-handle","that story is not in this document")}case "getFont":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.span,e,a);return n.ok?I({kind:"font",font:Ue(n.value.part,Gt(t.value,n.value))}):d(n.code,"that span is not a place",n.detail)}case "setFont":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to format","empty-story");let n=X(t.value);return n?yt(u(n),t.value,o.font):d("invalid-handle","that story is not in this document")}case "getStyle":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.span,e,a);if(!n.ok)return d(n.code,"that span is not a place",n.detail);let i=n.value.part,c=n.value.styles(),p=et(t.value,n.value).map(v=>Ht(i,v,c)),y=p.length>0&&p.every(v=>v!==null&&v===p[0])?p[0]:null;return I({kind:"style",name:y})}case "setStyle":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to style","empty-story");let n=X(t.value);return n?lt(u(n),t.value,o.name):d("invalid-handle","that story is not in this document")}case "getParagraphFormat":{let t=Et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let n=a.story(t.value.story);if(!n)return d("document-unavailable","this host holds no document right now");let i=Xe(n.part,t.value.paragraphId,n.styles());return i?I({kind:"paragraphFormat",format:i}):d("invalid-handle","that handle does not name a paragraph")}case "setParagraphFormat":{let t=Et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let n=a.story(t.value.story);return n?xn(u(n),t.value,o.format):d("invalid-handle","that story is not in this document")}case "deleteParagraph":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let n=a.story(t.value.story);return n?nt(u(n),t.value):d("invalid-handle","that story is not in this document")}case "getSections":return e.resolve(o.document,"document")?I({kind:"handles",handles:a.sections().map(t=>e.section(t.index))}):d("invalid-handle","that handle does not name a document","document");case "getPageSetup":{let t=e.resolve(o.section,"section");if(!t||t.kind!=="section")return d("invalid-handle","that handle does not name a section","section");let n=a.sections()[t.index];return n?I({kind:"pageSetup",setup:n.pageSetup}):d("invalid-handle","that section is not in this document")}case "setPageSetup":{let t=e.resolve(o.section,"section");return !t||t.kind!=="section"?d("invalid-handle","that handle does not name a section","section"):Sn(t.index,o.setup)}case "getFurniture":{let t=e.resolve(o.section,"section");if(!t||t.kind!=="section")return d("invalid-handle","that handle does not name a section","section");if(o.kind!=="header"&&o.kind!=="footer")return d("unknown-operation","that is not furniture",String(o.kind));let n={kind:o.kind,sectionIndex:t.index,variant:o.variant};return Ke(n)?a.story(n)?I({kind:"handle",handle:e.body(n)}):d("invalid-handle","this document declares no such header or footer",_(n)):d("unknown-operation","that is not a furniture variant",String(o.variant))}case "getNotes":{if(!e.resolve(o.document,"document"))return d("invalid-handle","that handle does not name a document","document");if(o.noteKind!=="footnote"&&o.noteKind!=="endnote")return d("unknown-operation","that is not a kind of note",String(o.noteKind));let t=o.noteKind;return I({kind:"handles",handles:a.noteIds(t).map(n=>e.note(t,n))})}case "getNoteBody":{let t=e.resolve(o.note,"note");if(!t||t.kind!=="note")return d("invalid-handle","that handle does not name a note","note");let n={kind:"note",noteKind:t.noteKind,noteId:t.noteId};return a.story(n)?I({kind:"handle",handle:e.body(n)}):d("invalid-handle","that note is not in this document",_(n))}case "getNoteKind":{let t=e.resolve(o.note,"note");return !t||t.kind!=="note"?d("invalid-handle","that handle does not name a note","note"):I({kind:"text",text:t.noteKind})}case "deleteNote":{let t=e.resolve(o.note,"note");return !t||t.kind!=="note"?d("invalid-handle","that handle does not name a note","note"):a.noteIds(t.noteKind).includes(t.noteId)?Rn(t.noteKind,t.noteId):d("invalid-handle","that note is not in this document")}case "getLists":{let t=$(o.body,"body",e,a);return t.ok?I({kind:"handles",handles:_t(t.value).map(n=>e.list(n.numId,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getListId":{let t=Ft(o.list);return "list"in t?I({kind:"number",value:Number(t.list.numId)}):t}case "getListById":{let t=$(o.body,"body",e,a);if(!t.ok)return d(t.code,"that handle does not name a body",t.detail);if(!Number.isInteger(o.id)||o.id<=0)return d("unsupported-content","a list is numbered from one",String(o.id));let n=String(o.id),i=_t(t.value).find(c=>c.numId===n);return i?I({kind:"handle",handle:e.list(i.numId,t.value.story)}):d("invalid-handle","no list in that story carries that number",n)}case "getListParagraphs":{let t=Ft(o.list);if(!("list"in t))return t;let n=o.level;if(n!==void 0&&(!Number.isInteger(n)||n<0||n>ft))return d("invalid-offset",`a list level is 0 to ${String(ft)}`,String(n));let i=t.plan.reads,c=n===void 0?t.list.paragraphIds:t.list.paragraphIds.filter(p=>It(i,p)?.level===n);return I({kind:"handles",handles:c.map(p=>e.paragraph(p,i.story))})}case "getParagraphList":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let n=a.story(t.value.story);if(!n)return d("invalid-handle","that story is not in this document");let i=It(n,t.value.paragraphId);return i?I({kind:"handle",handle:e.list(i.numId,n.story)}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "getListLevel":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let n=a.story(t.value.story);if(!n)return d("invalid-handle","that story is not in this document");let i=It(n,t.value.paragraphId);return i?I({kind:"number",value:i.level}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "setListLevel":{let t=G(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let n=a.story(t.value.story);return n?Cn(u(n),t.value.paragraphId,o.level):d("invalid-handle","that story is not in this document")}case "insertListParagraph":{let t=Ft(o.list);return "list"in t?On(t.plan,t.list,o.where,o.text):t}case "getHyperlink":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.span,e,a);if(!n.ok)return d(n.code,"that span is not a place",n.detail);let i=a.package;if(!i||!t.value)return I({kind:"text",text:""});let c=oe(n.value,t.value);if(!c)return I({kind:"text",text:""});let p=chunkBZK64YU3_cjs.Ea(n.value.part,c.id),y=p?rn(i,n.value.part.name,p):null;return I({kind:"text",text:y??""})}case "setHyperlink":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no text to link","empty-story");let n=X(t.value);return n?Pn(u(n),t.value,o.target):d("invalid-handle","that story is not in this document")}case "getBookmarks":{let t=W(o.scope,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let n=at(o.scope,e,a);if(!n.ok)return d(n.code,"that span is not a place",n.detail);let i=n.value,c=t.value,p=c===null?null:new Set(et(c,i)),y=Zt(i).filter(v=>{if(!p||!p.has(v.start.paragraphId)&&!p.has(v.end.paragraphId)||c===null)return false;let x=v.start.paragraphId===c.end.paragraphId&&v.start.offset>c.end.offset,P=v.end.paragraphId===c.start.paragraphId&&v.end.offset<c.start.offset;return !x&&!P});return I({kind:"handles",handles:y.map(v=>e.bookmark(v.name,i.story))})}case "getBookmarkName":{let t=e.resolve(o.bookmark,"bookmark");return !t||t.kind!=="bookmark"?d("invalid-handle","that handle does not name a bookmark","bookmark"):I({kind:"text",text:t.name})}case "getBookmarkRange":{let t=e.resolve(o.bookmark,"bookmark");if(!t||t.kind!=="bookmark")return d("invalid-handle","that handle does not name a bookmark","bookmark");let n=a.story(t.story);if(!n)return d("invalid-handle","that story is not in this document");let i=qt(n,t.name);if(!i)return d("invalid-handle","this document no longer declares that bookmark",t.name);let c={story:n.story,paragraphId:i.start.paragraphId,index:n.indexOf(i.start.paragraphId),offset:i.start.offset},p={story:n.story,paragraphId:i.end.paragraphId,index:n.indexOf(i.end.paragraphId),offset:i.end.offset};return I({kind:"span",span:M({start:c,end:p})})}case "getComments":{let t=W(o.scope,e,a);if(!t.ok)return d(t.code,"that scope is not a place",t.detail);let n=at(o.scope,e,a);if(!n.ok)return d(n.code,"that scope names no story",n.detail);let i=n.value,c=g(i);if(!c)return d("document-unavailable","this host holds no document");let p=t.value,y=c.roots.filter(v=>{if(!p)return true;let x=v.range;if(!x)return false;let P=i.indexOf(x.start.paragraphId),w=i.indexOf(x.end.paragraphId),E=i.indexOf(p.start.paragraphId),C=i.indexOf(p.end.paragraphId);return w<E||P>C?false:w===E&&P===E&&C===E?x.end.offset>p.start.offset&&x.start.offset<p.end.offset:true});return I({kind:"handles",handles:y.map(v=>e.comment(v.id,i.story))})}case "getCommentReplies":{let t=R(o.comment);return t.ok?I({kind:"handles",handles:t.item.replyIds.map(n=>e.comment(n,t.reads.story))}):t.planned}case "getCommentId":{let t=R(o.comment);return t.ok?I({kind:"text",text:t.item.id}):t.planned}case "getCommentAuthor":{let t=R(o.comment);return t.ok?I({kind:"text",text:t.item.comment.author}):t.planned}case "getCommentDate":{let t=R(o.comment);return t.ok?I({kind:"text",text:t.item.comment.date??""}):t.planned}case "getCommentText":{let t=R(o.comment);if(!t.ok)return t.planned;let n=g(t.reads);return I({kind:"text",text:n?.textOf(t.item.id)??""})}case "getCommentRange":{let t=R(o.comment);if(!t.ok)return t.planned;let n=t.item.range;if(!n||t.item.orphaned)return d("invalid-handle","that comment has no range in this document");let i=T(t.reads,n);return i?I({kind:"span",span:i}):d("invalid-handle","that comment\u2019s range is no longer in the story")}case "getCommentResolved":{let t=R(o.comment);return t.ok?I({kind:"flag",value:t.item.resolved}):t.planned}case "setCommentResolved":{let t=R(o.comment);if(!t.ok)return t.planned;if(typeof o.resolved!="boolean")return d("unsupported-content","resolved is a yes or a no",String(o.resolved));let n=f(u(t.reads));return n||{ok:true,kind:"commentWrite",write:{kind:"resolve",commentId:t.item.id,resolved:o.resolved},story:t.reads.story,answer:()=>F}}case "replyToComment":{let t=R(o.comment);if(!t.ok)return t.planned;if(typeof o.author!="string"||o.author.trim().length===0)return d("unsupported-content","a comment records who wrote it","author");if(typeof o.text!="string"||o.text.length===0)return d("unsupported-content","a reply says something","text");if(xt.test(o.text))return d("unsupported-content","a reply is one paragraph in this slice","text");let n=t.item.range;if(!n||t.item.orphaned)return d("invalid-handle","that comment has no range to reply over");let i=f(u(t.reads));if(i)return i;let c=t.reads.story;return {ok:true,kind:"commentWrite",write:{kind:"reply",parentCommentId:t.item.id,anchor:{paragraphId:n.start.paragraphId,start:n.start.offset,end:n.end.offset,...n.end.paragraphId===n.start.paragraphId?{}:{endParagraphId:n.end.paragraphId}},text:o.text,author:o.author,...typeof o.date=="string"?{date:o.date}:{}},story:t.reads.story,answer:(p,y)=>y===void 0?F:{kind:"handle",handle:e.comment(y,c)}}}case "getRevisions":{let t=$(o.body,"body",e,a);if(!t.ok)return d(t.code,"that handle does not name a body",t.detail);let n=t.value;return I({kind:"handles",handles:te(n).map(i=>e.revision(i.id,n.story))})}case "getRevisionType":{let t=A(o.revision);return t.ok?I({kind:"text",text:t.item.type}):t.planned}case "getRevisionAuthor":{let t=A(o.revision);return t.ok?I({kind:"text",text:t.item.author}):t.planned}case "getRevisionDate":{let t=A(o.revision);return t.ok?I({kind:"text",text:t.item.date}):t.planned}case "getRevisionRange":{let t=A(o.revision);if(!t.ok)return t.planned;let[n]=t.item.item.ranges;if(!n)return d("invalid-handle","that change covers no characters");let i=T(t.reads,n);return i?I({kind:"span",span:i}):d("invalid-handle","that change\u2019s range is no longer in the story")}case "acceptRevision":case "rejectRevision":{let t=A(o.revision);if(!t.ok)return t.planned;let n=u(t.reads),i=f(n);if(i)return i;let c=o.op==="acceptRevision";return {ok:true,kind:"command",story:t.reads.story,ops:t.item.item.addresses.map(p=>c?{op:"acceptRevision",revision:p}:{op:"rejectRevision",revision:p}),answer:()=>F}}case "acceptAllRevisions":case "rejectAllRevisions":{if(!e.resolve(o.document,"document"))return d("invalid-handle","that handle does not name a document","document");let t=a.body;if(!t)return d("document-unavailable","this host holds no document");let n=u(t),i=f(n);return i||{ok:true,kind:"command",story:t.story,ops:[o.op==="acceptAllRevisions"?{op:"acceptAllRevisions"}:{op:"rejectAllRevisions"}],answer:()=>F}}case "selectSpan":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to select","empty-story");let n=X(t.value);return n?wn(u(n),t.value,o.mode):d("invalid-handle","that story is not in this document")}case "getContentControls":{let t=Bt(o.scope);return "reads"in t?I({kind:"handles",handles:ln(t.reads,t.node).map(n=>e.contentControl(n.nodeId,t.reads.story))}):t}case "getContentControlById":{let t=Bt(o.scope);if(!("reads"in t))return t;if(!Number.isInteger(o.id))return d("unsupported-content","a control id is a whole number",String(o.id));let n=bn(t.node).find(i=>chunkBZK64YU3_cjs.ke(i).id===o.id);return n?I({kind:"handle",handle:e.contentControl(n.id,t.reads.story)}):d("invalid-handle","no control in that scope carries that id",String(o.id))}case "getContentControlsByTag":case "getContentControlsByTitle":{let t=Bt(o.scope);if(!("reads"in t))return t;let n=o.op==="getContentControlsByTag"?o.tag:o.title;if(typeof n!="string"||n.length===0)return d("unsupported-content","a tag or title to match is required",o.op);let i=bn(t.node).filter(c=>{let p=chunkBZK64YU3_cjs.ke(c);return o.op==="getContentControlsByTag"?p.tag===n:p.alias===n});return I({kind:"handles",handles:i.map(c=>e.contentControl(c.id,t.reads.story))})}case "getContentControlTag":case "getContentControlTitle":case "getContentControlFileId":case "getContentControlSubtype":case "getContentControlLock":{let t=Z(o.contentControl);if(!("control"in t))return t;let n=t.control.properties;if(o.op==="getContentControlLock")return I({kind:"text",text:t.control.lock});if(o.op==="getContentControlSubtype")return I({kind:"text",text:n.type});if(o.op==="getContentControlFileId")return I({kind:"text",text:n.id===void 0?"":String(n.id)});let i=o.op==="getContentControlTag"?n.tag:n.alias;return I({kind:"text",text:i??""})}case "getContentControlPlaceholderShown":case "getContentControlTemporary":{let t=Z(o.contentControl);return "control"in t?I({kind:"flag",value:o.op==="getContentControlPlaceholderShown"?t.control.properties.showingPlaceholder:t.control.properties.temporary}):t}case "getContentControlText":{let t=Z(o.contentControl);return "control"in t?I({kind:"text",text:pn(t.node)}):t}case "getContentControlParagraphs":{let t=Z(o.contentControl);return "control"in t?I({kind:"handles",handles:t.control.paragraphIds.map(n=>e.paragraph(n,t.reads.story))}):t}case "getContentControlRange":{let t=Z(o.contentControl);if(!("control"in t))return t;let n=o.location??"whole";if(!Oo.has(n))return d("unsupported-content","that is not a place in a control",n);let i=ee(t.reads,t.node);if(!i)return d("unsupported-content","that control holds nothing addressable","empty");let c=n==="start"||n==="before"?i.start:i.end,p=n!=="whole"&&n!=="content",y=v=>({story:t.reads.story,paragraphId:v.paragraphId,index:t.reads.indexOf(v.paragraphId),offset:v.offset});return I({kind:"span",span:Jt(p?{start:y(c),end:y(c)}:{start:y(i.start),end:y(i.end)},e)})}case "setContentControlValue":{let t=Z(o.contentControl);if(!("control"in t))return t;let n=To(o.value);if(!n.ok)return d(n.code,n.message,n.detail);let i=u(t.reads),c=f(i);return c||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:n.value}],answer:()=>F}}case "setContentControlProperties":{let t=Z(o.contentControl);if(!("control"in t))return t;if(o.tag===void 0&&o.title===void 0&&o.lock===void 0)return d("unsupported-content","nothing to write","no-properties");if(o.lock!==void 0&&!Co.has(o.lock))return d("unsupported-content","that is not a lock this schema declares",o.lock);let n=u(t.reads),i=f(n);return i||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlProperties",controlId:t.control.nodeId,...o.tag===void 0?{}:{tag:o.tag},...o.title===void 0?{}:{alias:o.title},...o.lock===void 0?{}:{lock:o.lock}}],answer:()=>F}}case "insertContentControlText":{let t=Z(o.contentControl);if(!("control"in t))return t;if(typeof o.text!="string")return d("unsupported-content","text is required","text");if(o.at!=="replace"&&o.at!=="start"&&o.at!=="end")return d("unsupported-content","that is not a place to insert at",String(o.at));let n=u(t.reads),i=f(n);if(i)return i;let c=ee(t.reads,t.node);if(!c)return d("unsupported-content","that control holds nothing addressable","empty");let p=o.at==="end"?c.end:c.start,y=()=>({kind:"span",span:M({start:{story:t.reads.story,paragraphId:p.paragraphId,index:t.reads.indexOf(p.paragraphId),offset:p.offset},end:{story:t.reads.story,paragraphId:p.paragraphId,index:t.reads.indexOf(p.paragraphId),offset:p.offset+o.text.length}})});return o.at==="replace"?{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:{kind:"text",text:o.text}}],answer:y}:{ok:true,kind:"command",story:t.reads.story,ops:o.text.length===0?[]:[{op:"insertText",paragraphId:p.paragraphId,offset:p.offset,text:o.text,inside:t.node.id}],answer:y}}case "deleteContentControl":{let t=Z(o.contentControl);if(!("control"in t))return t;if(typeof o.keepContent!="boolean")return d("unsupported-content","keepContent is required","keepContent");let n=u(t.reads),i=f(n);return i||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"removeContentControl",controlId:t.control.nodeId,keepContent:o.keepContent}],answer:()=>F}}case "insertContentControl":{let t=W(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds nothing to wrap","empty-story");let n=X(t.value);if(!n)return d("invalid-handle","that story is not in this document");let i=t.value;if(i.start.paragraphId!==i.end.paragraphId)return d("unsupported-content","wrapping several paragraphs in one control is not supported here","multi-paragraph");if(!Po.has(o.subtype))return d("unsupported-content","that control type cannot be inserted",o.subtype);let c=u(n),p=f(c);return p||{ok:true,kind:"command",story:n.story,ops:[{op:"insertContentControl",paragraphId:i.start.paragraphId,start:i.start.offset,end:i.end.offset,type:o.subtype,...o.tag===void 0?{}:{tag:o.tag},...o.title===void 0?{}:{alias:o.title}}],answer:()=>F}}case "insertCustomNode":{let t=hn(o);if(t)return d("unsupported-content",t.message,t.detail);let n=yn(o.payload);if(!n.ok)return d("unsupported-content","that payload cannot be written",n.field);let i=An(o,e,a);if("code"in i)return d(i.code,i.message,i.detail);let{start:c,end:p}=i.range,y=X(i.range);if(!y)return d("invalid-handle","that story is not in this document");let v=f(u(y));return v||{ok:true,kind:"customNodeWrite",story:y.story,write:kn(o,c,p,n.value),answer:()=>F}}default:return d("unknown-operation","this host does not implement that operation",String(o.op))}};return {plan(o){let t=We(o);if(t&&b||m&&$t(o))return d("conflicting-operations","that command commits on its own and cannot share a batch",o.op);let n=Tn(o);return n.ok&&$t(o)&&(b=true,t&&(m=true)),n},get hasCommands(){return b},get writeScope(){return k?.reads.scope??null},settle(o){let t=k;if(t){let n=o.story(t.reads.story);if(!n)return {ok:false,detail:`the story this batch wrote is gone: ${_(t.reads.story)}`};let i=new Set(t.reads.paragraphIds),c=n.paragraphIds.filter(y=>!i.has(y));if(c.length!==t.created.length)return {ok:false,detail:`planned ${String(t.created.length)} new paragraphs, the transaction made ${String(c.length)}`};t.order.filter(y=>y.id===null).forEach((y,v)=>{y.id=c[v]??null;});for(let y of t.retargets)y.slot.id&&e.retarget(y.from,y.slot.id);}for(let n of h){let i=o.story(n.range.start.story);!i||!Lo(n.range,i)||r.select?.(n.range,n.mode);}return {ok:true}}}}var Eo=Object.freeze({status:"skipped"});function Y(r,e,s){return Object.freeze(s===void 0?{code:r,message:e}:{code:r,message:e,detail:s})}function J(r,e,s,a){return {ok:false,results:r.map((l,u)=>u===e?{status:"error",error:s}:Eo),revision:a,changed:false}}function oa(r){let{port:e}=r,s=Object.freeze({...r.capabilities}),a=ze(),l=new Set,u=false,h=null,b=s.events?e.subscribe(()=>{if(u)return;let f=Object.freeze({revision:e.revision()});for(let g of [...l])g(f);}):()=>{},m=f=>{if(h&&h.pkg===f)return h.value;let g=tn(f);return h={pkg:f,value:g},g};return {capabilities:s,revision:()=>e.revision(),execute:f=>{let g=Array.isArray(f?.operations)?f.operations:[],R=e.revision();if(u)return J(g,0,Y("disposed","this host was disposed"),R);if(!s.document)return J(g,0,Y("unsupported-capability","this host has no document","document"),R);let A=e.currentPackage();if(!A)return J(g,0,Y("document-unavailable","this host holds no document right now"),R);if(f.expectedRevision!==void 0&&f.expectedRevision!==R)return J(g,0,Y("stale-revision","the document moved since that revision",`expected ${String(f.expectedRevision)}, at ${R}`),R);let T=In({handles:a,reads:m(A),capabilities:s,...e.select?{select:e.select.bind(e)}:{}}),O=[],H=[],L=null,j=null,Q,dt=null,M=-1;for(let N=0;N<g.length;N+=1){let K=T.plan(g[N]);if(!K.ok)return J(g,N,K.error,R);if(O.push(K),K.kind==="command")if(M<0&&(M=N),K.lifecycle)L=K.ops[0]??null;else if(K.relate){let nt=K.relate;H.push(yt=>{let lt=yt(nt.url);return lt===null?null:nt.ops(lt)});}else {let{ops:nt}=K;H.push(()=>nt);}else K.kind==="commentWrite"?(M<0&&(M=N),j={write:K.write,scope:T.writeScope??{kind:"body"}}):K.kind==="customNodeWrite"&&(M<0&&(M=N),dt={write:K.write,scope:T.writeScope??{kind:"body"}});}let X=false;if(j){let N=e.applyCommentWrite(j.write,j.scope);if(!N.ok)return J(g,M<0?0:M,Y("transaction-refused","the document store refused the comment write",N.reason),R);X=N.changed,Q=N.commentId;}if(dt){let N=e.applyCustomNodeWrite(dt.write,dt.scope);if(!N.ok)return J(g,M<0?0:M,Y("transaction-refused","the document store refused the custom-node write",N.reason),R);X=N.changed;}if(L){let N=e.applyLifecycle(L);if(!N.ok)return J(g,M<0?0:M,Y("transaction-refused","the document store refused the transaction",N.reason),R);X=N.changed;}if(H.length>0){let N=e.apply(K=>{let nt=[];for(let yt of H){let lt=yt(K);if(lt===null)return null;nt.push(...lt);}return nt},T.writeScope??{kind:"body"});if(!N.ok)return J(g,M<0?0:M,Y("transaction-refused","the document store refused the transaction",N.reason),R);X=N.changed;}let St=e.currentPackage();if(!St)return J(g,0,Y("document-unavailable","this host holds no document right now"),R);let gt=m(St),Rt=T.settle(gt);return Rt.ok?{ok:true,results:O.map(N=>({status:"ok",value:N.kind==="query"?N.value:N.kind==="customNodeWrite"?N.answer(gt):N.answer(gt,Q)})),revision:e.revision(),changed:X}:J(g,M<0?0:M,Y("transaction-refused","the transaction did not produce the document the batch planned",Rt.detail),e.revision())},save(){if(u)return {ok:false,error:Y("disposed","this host was disposed")};if(!s.save)return {ok:false,error:Y("unsupported-capability","this host cannot save","save")};let f=e.save();return f?{ok:true,bytes:f}:{ok:false,error:Y("document-unavailable","this host holds no document right now")}},subscribe(f){return u||!s.events?()=>{}:(l.add(f),()=>{l.delete(f);})},dispose(){u||(u=true,l.clear(),b(),e.dispose(),h=null);}}}exports.a=Nt;exports.b=Fo;exports.c=Mn;exports.d=En;exports.e=We;exports.f=$t;exports.g=oa;
@@ -0,0 +1,2 @@
1
+ import {T as T$1,gd,U as U$1,Da,mb,hb,ab,lb}from'./chunk-STCITBJK.js';var ke=8;function Z(t){let e=new Map;for(let n of T$1(t))for(let o of n.spans)for(let r of o.revisions??[])e.has(r.author)||e.set(r.author,e.size);return e}function J(t,e){if(t===void 0||t.length===0)return null;let n=t[t.length-1],o=t.some(i=>i.kind==="delete"||i.kind==="moveFrom"),r=n.kind,a=r==="delete"||r==="moveFrom"?"line-through":r==="insert"||r==="moveTo"?"underline":null;return {attribution:n,line:o&&a==="underline"?"line-through":a,decorationStyle:r==="moveFrom"||r==="moveTo"?"double":r==="insert"?"dashed":"solid",color:o?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",authorColor:`var(--doc-review-author-${(e?.get(n.author)??0)%ke})`,deleted:o}}function Q(t,e,n,o,r,a){for(let i of [n.footnotes,n.endnotes])i&&e.append(Ie(t,n,i,o,r,a));}function Ie(t,e,n,o,r,a){let i=t.createElement("div");if(i.className="docx-notes",i.dataset.docxNotes=n.kind,i.dataset.docxNotesPlacement=n.placement,i.style.position="absolute",i.style.left=`${(n.box.x-e.box.x)*o.scale}px`,i.style.top=`${(n.box.y-e.box.y)*o.scale}px`,i.style.width=`${n.box.width*o.scale}px`,i.style.height=`${n.box.height*o.scale}px`,n.separator){let s=t.createElement("div");s.className="docx-note-separator",s.dataset.docxNoteSeparator=n.separator.kind,s.setAttribute("contenteditable","false"),s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left=`${(n.separator.box.x-n.box.x)*o.scale}px`,s.style.top=`${(n.separator.box.y-n.box.y)*o.scale}px`,s.style.width=`${n.separator.box.width*o.scale}px`,s.style.height=`${Math.max(n.separator.box.height,.75)*o.scale}px`;let d=n.separator.ruleStyle;if(d||n.separator.synthetic||n.separator.fragments.length===0)Ae(s,t,d??"single",o.scale);else for(let l of n.separator.fragments)s.append(l.kind==="table"?a(t,l,o):r(t,l,o));i.append(s);}for(let s of n.notes){let d=t.createElement("div");d.className="docx-note",d.dataset.docxNote=s.noteKind,d.dataset.docxNoteId=String(s.noteId),d.dataset.docxNoteScope=s.scopeId,s.mark!==null&&(d.dataset.docxNoteMark=s.mark),s.continuation&&(d.dataset.docxNoteContinuation=""),d.setAttribute("role","doc-footnote"),d.style.position="absolute",d.style.left=`${(s.box.x-n.box.x)*o.scale}px`,d.style.top=`${(s.box.y-n.box.y)*o.scale}px`,d.style.width=`${s.box.width*o.scale}px`,d.style.height=`${s.box.height*o.scale}px`;for(let l of s.fragments)d.append(l.kind==="table"?a(t,l,o):r(t,l,o));i.append(d);}return i}function Ae(t,e,n,o){t.dataset.docxNoteRule=n;let r=Math.max(1,o*.75);if(n==="single"){t.style.borderTop=`${r}px solid currentColor`,t.style.opacity="0.85";return}t.style.opacity="0.85";let a=Math.max(1,o*1.25);for(let i of [0,r+a]){let s=e.createElement("div");s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top=`${i}px`,s.style.height="0",s.style.borderTop=`${r}px solid currentColor`,t.append(s);}}var ee=Object.freeze({"image/svg+xml":"SVG","image/tiff":"TIFF","image/x-emf":"EMF","image/x-wmf":"WMF",unknown:"Unknown"}),H=new WeakMap,B=new WeakMap,He=256;function ne(t,e){let n=H.get(t);if(n)return n;let o=new Map,r=new Map;return n=Object.freeze({urlForReady(a,i){let s=o.get(a.resourceKey);if(s)return s;let d=e.create(a,i);return o.set(a.resourceKey,d),d},imageFor(a,i,s){let d=r.get(a);if(d&&d.resourceKey===i)return d.element;let l=s.createElement("img");return r.size<He&&r.set(a,{element:l,resourceKey:i,...d?.readyElement?{readyElement:d.readyElement}:{}}),l},imageForPending(a){return r.get(a)?.element??null},readyElementFor(a){return r.get(a)?.readyElement??null},rememberReadyElement(a,i){let s=r.get(a);s&&r.set(a,{...s,readyElement:i});},reconcile(a,i){for(let[s,d]of o)a.has(s)||(e.revoke(d),o.delete(s));for(let[s,d]of r)i.has(s)||(d.element.removeAttribute("src"),r.delete(s));},revokeAll(){for(let a of o.values())e.revoke(a);o.clear();for(let a of r.values())a.element.removeAttribute("src");r.clear();}}),H.set(t,n),n}function O(t,e){return `${e.paintInstance??""}|${t.drawingNodeId}`}function kt(t){H.get(t)?.revokeAll(),H.delete(t);}function R(t){return Number.isFinite(t)?String(t):"0"}function oe(t,e){if(t.length<3||e.width<=0||e.height<=0)return null;let n=[];for(let o of t){if(!Number.isFinite(o.x)||!Number.isFinite(o.y))return null;let r=(o.x-e.x)/e.width*100,a=(o.y-e.y)/e.height*100;n.push(`${R(r)}% ${R(a)}%`);}return `polygon(${n.join(", ")})`}function re(t){let e=t.geometry.contentBounds;return lb({transform:t.transform,contentWidth:e.width,contentHeight:e.height})}function ae(t){let{effects:e}=t,n=[];if(e.grayscale&&n.push("grayscale(1)"),e.brightness!==0&&Number.isFinite(e.brightness)){let o=1+e.brightness/100;Number.isFinite(o)&&n.push(`brightness(${R(Math.max(0,o))})`);}if(e.contrast!==0&&Number.isFinite(e.contrast)){let o=1+e.contrast/100;Number.isFinite(o)&&n.push(`contrast(${R(Math.max(0,o))})`);}return n.length>0?n.join(" "):void 0}function ie(t,e){let{crop:n}=t,o=Math.max(0,Math.min(1,n.left)),r=Math.max(0,Math.min(1,n.top)),a=Math.max(0,Math.min(1,n.right)),i=Math.max(0,Math.min(1,n.bottom)),s=Math.max(1e-4,1-o-a),d=Math.max(1e-4,1-r-i);return Object.freeze({width:`${R(1/s*100)}%`,height:`${R(1/d*100)}%`,left:`${R(-o/s*100)}%`,top:`${R(-r/d*100)}%`})}function Me(t,e){let{resource:n}=t;switch(n.kind){case "external":return e.externalResource;case "missing":return e.missingResource;case "pending":return e.pendingResource;case "unrenderable":switch(n.reason){case "unsupported-format":return e.unsupportedFormat(ee[n.mime]??ee.unknown);case "non-picture-graphic":return e.nonPictureGraphic(t.placeholderGraphicKind??"graphic");case "signature-mismatch":return e.contentMismatch;case "decode-failed":return e.decodeFailed;case "resource-limit":return e.resourceLimit;default:return e.invalidResource}default:return e.invalidResource}}function D(t,e,n){let{accessibility:o}=e;o.hidden||(t.setAttribute("role",n?"link":"img"),o.label?t.setAttribute("aria-label",o.label):n||t.setAttribute("aria-hidden","true"));}function T(t,e,n,o){let r=o?.x??0,a=o?.y??0;t.style.position="absolute",t.style.left=`${(e.x-r)*n}px`,t.style.top=`${(e.y-a)*n}px`,t.style.width=`${e.width*n}px`,t.style.height=`${e.height*n}px`,t.style.boxSizing="border-box",t.style.overflow="hidden",t.style.pointerEvents="auto";}function Ce(t,e,n,o,r){let a=t.paintBounds,i=t.geometry.contentBounds,s=ie(t);return [o,n.scale,r?.x??0,r?.y??0,a.x,a.y,a.width,a.height,i.x,i.y,i.width,i.height,oe(t.geometry.clipPolygon??[],a)??"",ae(t)??"",re(t)??"",s.width,s.height,s.left,s.top,n.inertLinks?"":t.hyperlinkHref??"",t.accessibility.label??""].join("|")}function L(t,e,n,o){let r=t.createElement("div");r.className="docx-drawing docx-drawing-placeholder",r.dataset.drawingNodeId=e.drawingNodeId,T(r,e.paintBounds,n.scale,o);let a=t.createElement("div");a.className="docx-drawing-placeholder-card";let i=t.createElement("span");return i.className="docx-drawing-placeholder-label",i.textContent=Me(e,n.strings),a.append(i),r.append(a),e.hyperlinkHref&&!n.inertLinks?(r.dataset.docxDrawingLink=e.drawingNodeId,r.dataset.docxDrawingLinkKind="external",r.dataset.docxDrawingLinkHref=e.hyperlinkHref,r.setAttribute("tabindex","-1"),D(r,e,true)):D(r,e,false),r}function Fe(t,e,n,o,r,a){let i=e.resource;if(i.kind!=="ready")return L(t,e,n,a);let s=O(e,n),d=r?.readyElementFor?.(s)??t.createElement("div"),l=Ce(e,i,n,o,a);if(B.get(d)===l)return d;d.className="docx-drawing docx-drawing-ready",d.style.cssText="",d.dataset.drawingNodeId=e.drawingNodeId,delete d.dataset.docxDrawingLink,delete d.dataset.docxDrawingLinkKind,delete d.dataset.docxDrawingLinkHref,d.removeAttribute("aria-hidden"),d.removeAttribute("aria-label"),d.removeAttribute("role"),d.removeAttribute("tabindex"),T(d,e.paintBounds,n.scale,a);let c=oe(e.geometry.clipPolygon??[],e.paintBounds);c&&(d.style.clipPath=c);let y=t.createElement("div");y.className="docx-drawing-image-frame",y.style.position="absolute";let h=e.geometry.contentBounds,p=e.paintBounds;y.style.left=`${(h.x-p.x)*n.scale}px`,y.style.top=`${(h.y-p.y)*n.scale}px`,y.style.width=`${h.width*n.scale}px`,y.style.height=`${h.height*n.scale}px`;let u=ae(e);u&&(y.style.filter=u);let v=t.createElement("div");v.className="docx-drawing-transform-stage",v.style.position="relative",v.style.width="100%",v.style.height="100%";let S=re(e);S&&(v.style.transform=S,v.style.transformOrigin="0 0");let g=t.createElement("div");g.className="docx-drawing-crop-viewport",g.style.position="relative",g.style.width="100%",g.style.height="100%",g.style.overflow="hidden";let x=r?.imageFor?.(s,i.resourceKey,t)??t.createElement("img");x.className="docx-drawing-image",x.setAttribute("draggable","false"),x.getAttribute("src")!==o&&x.setAttribute("src",o),x.setAttribute("alt","");let b=ie(e);return x.style.position="absolute",x.style.width=b.width,x.style.height=b.height,x.style.left=b.left,x.style.top=b.top,x.style.maxWidth="none",x.style.maxHeight="none",g.append(x),v.append(g),y.append(v),d.replaceChildren(y),e.hyperlinkHref&&!n.inertLinks?(d.dataset.docxDrawingLink=e.drawingNodeId,d.dataset.docxDrawingLinkKind="external",d.dataset.docxDrawingLinkHref=e.hyperlinkHref,d.setAttribute("tabindex","-1"),D(d,e,true)):D(d,e,false),r?.rememberReadyElement?.(s,d),B.set(d,l),d}var te="http://www.w3.org/2000/svg";function Ne(t,e,n,o){let r=e.vectorShape,a=t.createElement("div");a.className="docx-drawing docx-drawing-shape",a.dataset.drawingNodeId=e.drawingNodeId,T(a,e.paintBounds,n.scale,o);let i=e.geometry.contentBounds,s=e.paintBounds,d=t.createElement("div");d.className="docx-drawing-image-frame",d.style.position="absolute",d.style.left=`${(i.x-s.x)*n.scale}px`,d.style.top=`${(i.y-s.y)*n.scale}px`,d.style.width=`${i.width*n.scale}px`,d.style.height=`${i.height*n.scale}px`;let l=t.createElementNS(te,"svg");l.setAttribute("viewBox",`0 0 ${R(Math.max(1,r.extentEmu.cx))} ${R(Math.max(1,r.extentEmu.cy))}`),l.setAttribute("preserveAspectRatio","none"),l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.style.display="block";let c=t.createElementNS(te,"path"),y=r.subpathsEmu.map(h=>`M${h.map(p=>`${R(p.x)} ${R(p.y)}`).join("L")}Z`).join("");return c.setAttribute("d",y),c.setAttribute("fill",r.fillHex!==null?`#${r.fillHex}`:"none"),c.setAttribute("fill-rule","evenodd"),r.strokeHex!==null&&(c.setAttribute("stroke",`#${r.strokeHex}`),c.setAttribute("stroke-width",R(Math.max(1,r.strokeWidthEmu)))),l.append(c),d.append(l),a.append(d),e.hyperlinkHref&&!n.inertLinks?(a.dataset.docxDrawingLink=e.drawingNodeId,a.dataset.docxDrawingLinkKind="external",a.dataset.docxDrawingLinkHref=e.hyperlinkHref,a.setAttribute("tabindex","-1"),D(a,e,true)):D(a,e,false),a}function Be(t,e,n,o,r){let a=o.scale,i=t.createElement("div");i.className="docx-drawing docx-drawing-textbox",i.dataset.drawingNodeId=e.drawingNodeId,i.setAttribute("contenteditable","false"),T(i,e.paintBounds,o.scale,r),i.style.overflow="hidden";let s=(e.x-e.paintBounds.x)*a,d=(e.y-e.paintBounds.y)*a;if(n.fillHex!==null||n.strokeHex!==null){let c=t.createElement("div");c.className="docx-drawing-textbox-box",c.style.position="absolute",c.style.left=`${s}px`,c.style.top=`${d}px`,c.style.width=`${e.width*a}px`,c.style.height=`${e.height*a}px`,c.style.boxSizing="border-box",n.fillHex!==null&&(c.style.backgroundColor=`#${n.fillHex}`),n.strokeHex!==null&&(c.style.border=`${Math.max(n.strokeWidthPt*a,.5)}px solid #${n.strokeHex}`),i.append(c);}let l=t.createElement("div");l.className="docx-drawing-textbox-content",l.style.position="absolute",l.style.left=`${s+n.contentOffset.x*a}px`,l.style.top=`${d+n.contentOffset.y*a}px`,l.style.width=`${n.contentWidth*a}px`,l.style.height=`${Math.max(0,n.contentHeight)*a}px`,l.style.overflow="hidden";for(let c of n.fragments)l.append(o.paintStoryFragment(t,c));for(let c of l.querySelectorAll("[data-paragraph-id]"))delete c.dataset.paragraphId;return i.append(l),D(i,e,false),i}function se(t,e,n,o,r){if(e.accessibility.hidden||e.paintBounds.width<=0||e.paintBounds.height<=0)return null;if(e.kind==="anchoredDrawing"&&e.textboxStory!==void 0&&n.paintStoryFragment!==void 0)return Be(t,e,e.textboxStory,n,r);if(e.vectorShape&&e.vectorShape.subpathsEmu.length>0)return Ne(t,e,n,r);let{resource:a}=e;if(a.kind==="ready"){if(!n.imageUrlPort||!o)return L(t,e,n,r);let i=o.urlForReady(a.validatedHandle,a.mime);return i?Fe(t,e,n,i,o,r):L(t,e,n,r)}if(a.kind==="pending"){let i=o?.readyElementFor?.(O(e,n))??o?.imageForPending?.(O(e,n))?.closest(".docx-drawing-ready");return i?(B.delete(i),i.dataset.drawingNodeId=e.drawingNodeId,T(i,e.paintBounds,n.scale,r),i):L(t,e,n,r)}return L(t,e,n,r)}function le(t,e,n,o,r){let a=[];for(let i of e.drawings??[]){let s=se(t,i,n,o,r);s&&a.push(s);}return Object.freeze(a)}function de(t,e,n,o,r,a){let i=[];for(let s of e){if(mb(s)!==n)continue;let d=se(t,s,o,r,a);d&&(d.dataset.drawingLayer=n,i.push(d));}return Object.freeze(i)}function ce(t){let e=new Set,n=i=>{i.resource.kind==="ready"&&e.add(i.resource.resourceKey);},o=i=>{for(let s of i.drawings??[])n(s);},r=i=>{for(let s of i.lines)o(s);},a=i=>{if(i.kind==="table"){for(let s of i.rows)for(let d of s.cells)for(let l of d.blocks)a(l);return}r(i);};for(let i of t.pages){for(let s of i.anchoredDrawings??[])n(s);for(let s of i.fragments)a(s);for(let s of [i.header,i.footer])if(s){for(let d of s.anchoredDrawings??[])n(d);for(let d of s.fragments)a(d);}}return e}function ye(t){let e=new Set,n=(r,a)=>{e.add(`p${r}|${a.drawingNodeId}`);},o=(r,a)=>{if(a.kind==="table"){for(let i of a.rows)for(let s of i.cells)for(let d of s.blocks)o(r,d);return}for(let i of a.lines)for(let s of i.drawings??[])n(r,s);};for(let r of t.pages){for(let a of r.anchoredDrawings??[])n(r.index,a);for(let a of r.fragments)o(r.index,a);for(let a of [r.header,r.footer])if(a){for(let i of a.anchoredDrawings??[])n(r.index,i);for(let i of a.fragments)o(r.index,i);}}return e}function pe(t){return [t.missingResource,t.externalResource,t.invalidResource,t.contentMismatch,t.decodeFailed,t.resourceLimit,t.pendingResource,t.unsupportedFormat("probe"),t.nonPictureGraphic("probe")].join("\0")}var U=Object.freeze({unsupportedFormat:t=>`Unsupported image format (${t})`,nonPictureGraphic:t=>`Unsupported graphic (${t})`,missingResource:"Image missing",externalResource:"External image not loaded",invalidResource:"Invalid image",contentMismatch:"Image content does not match its type",decodeFailed:"Image could not be decoded",resourceLimit:"Image exceeds size limits",pendingResource:"Loading image"});function It(t){return Object.freeze({unsupportedFormat:e=>t("image.unsupportedFormat",{format:e}),nonPictureGraphic:e=>t("image.nonPictureGraphic",{kind:e}),missingResource:t("image.missingResource"),externalResource:t("image.externalResource"),invalidResource:t("image.invalidResource"),contentMismatch:t("image.contentMismatch"),decodeFailed:t("image.decodeFailed"),resourceLimit:t("image.resourceLimit"),pendingResource:t("image.pendingResource")})}var Oe=/^[0-9A-Fa-f]{6}$/;function Ue(t){switch(t){case "dashed":return "dashed";case "dotted":return "dotted";case "double":case "triple":return "solid";default:return "solid"}}function he(t){return t&&Oe.test(t)?t:"000000"}function z(t,e){let n=t.createElement("div");return n.className=e,n.setAttribute("aria-hidden","true"),n.setAttribute("contenteditable","false"),n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.right="0",n.style.bottom="0",n.style.overflow="visible",n.style.pointerEvents="none",n.style.boxSizing="border-box",n}function M(t,e,n,o){if(!n)return;let r=`#${he(n.color)}`,a=`${Math.max(0,n.widthPt*o)}px`;if(t.style[`border${e}Width`]=a,t.style[`border${e}Color`]=r,n.style==="double"||n.style==="triple"){t.style[`border${e}Style`]="none";return}t.style[`border${e}Style`]=Ue(n.style);}function K(t,e,n,o,r){let a=t.createElement("div");a.className=r,a.dataset.edge=n.side,a.dataset.stroke=n.role,a.style.position="absolute",a.style.left=`${n.x*o}px`,a.style.top=`${n.y*o}px`,a.style.width=`${n.width*o}px`,a.style.height=`${n.height*o}px`,a.style.pointerEvents="none",a.style.backgroundColor=`#${he(n.color)}`,n.cssStyle!=="solid"&&(a.dataset.cssStyle=n.cssStyle),e.append(a);}function ze(t){let e=new Set;for(let n of t)e.add(`${n.side}\0${n.role}`);return e}function Ke(t,e,n,o){let r=ze(n),a=h=>r.has(`${h}\0middle`),i=z(t,"docx-table-border-double"),s=z(t,"docx-table-border-triple"),d=z(t,"docx-table-border-edge"),l=false,c=false,y=false;for(let h of n){if(h.role==="edge"){y=true,K(t,d,h,o,"docx-table-border-edge-stroke");continue}if(a(h.side)){c=true,K(t,s,h,o,"docx-table-border-triple-stroke");continue}(h.role==="outer"||h.role==="inner")&&(l=true,K(t,i,h,o,"docx-table-border-double-stroke"));}l&&e.append(i),c&&e.append(s),y&&e.append(d);}function ue(t,e,n,o){M(e,"Top",n?.top,o),M(e,"Right",n?.right,o),M(e,"Bottom",n?.bottom,o),M(e,"Left",n?.left,o),n?.strokes&&n.strokes.length>0&&Ke(t,e,n.strokes,o);}var ge=new WeakMap,xe=0;function _e(t){let e=ge.get(t);return e||(xe+=1,e=`alias${xe}`,ge.set(t,e)),e}function Se(t){return {...t,drawingStrings:t.drawingStrings??U,urlRegistry:t.urlRegistry??null}}function Ge(t){let e={...t,inertLinks:true};return Object.freeze({scale:t.scale,strings:t.drawingStrings,...t.imageUrlPort?{imageUrlPort:t.imageUrlPort}:{},...t.inertLinks?{inertLinks:true}:{},...t.paintInstance?{paintInstance:t.paintInstance}:{},paintStoryFragment:(n,o)=>o.kind==="table"?I(n,o,e):k(n,o,e)})}function $e(t){return Object.freeze({ctx:Ge(t),urlRegistry:t.urlRegistry})}function fe(t,e,n,o,r,a){C(t,e,U$1(n),o,r,a);}function C(t,e,n,o,r,a,i=true){if(n.length===0)return;let s=$e(o),d=t.createElement("div");d.className=a==="behind"?"docx-drawing-layer docx-drawing-layer-behind":"docx-drawing-layer docx-drawing-layer-front",d.style.position="absolute",d.style.inset="0",d.style.pointerEvents="none";for(let l of de(t,n,a,s.ctx,s.urlRegistry,r)){if(l.style.pointerEvents=i?"auto":"none",!i)for(let c of l.querySelectorAll(".docx-drawing"))c.style.pointerEvents="none";d.append(l);}d.childElementCount>0&&e.append(d);}function Pe(t){return t.horizontalFrame==="page"||t.verticalFrame==="page"}function De(t,e,n){let o=e.paintBounds,r=e.horizontalFrame==="page"?n.x+(o.x-e.horizontalFrameOrigin):t.box.x+o.x,a=e.verticalFrame==="page"?n.y+(o.y-e.verticalFrameOrigin):t.box.y+o.y,i=r-o.x,s=a-o.y,d=l=>Object.freeze({x:l.x+i,y:l.y+s,width:l.width,height:l.height});return Object.freeze({...e,x:e.x+i,y:e.y+s,paintBounds:d(o),hitBounds:d(e.hitBounds),geometry:Object.freeze({...e.geometry,contentBounds:d(e.geometry.contentBounds),paintBounds:d(e.geometry.paintBounds),...e.geometry.clipPolygon?{clipPolygon:Object.freeze(e.geometry.clipPolygon.map(l=>Object.freeze({x:l.x+i,y:l.y+s})))}:{}})})}function je(t,e,n,o,r,a){let i=o.map(d=>De(n,d,a)),s=t.createElement("div");s.className="docx-hf-behind-layer",s.dataset.docxHfBehind=n.kind,s.setAttribute("contenteditable","false"),s.style.position="absolute",s.style.inset="0",s.style.overflow="hidden",s.style.pointerEvents="none",C(t,s,i,r,a,"behind",false),s.childElementCount>0&&e.append(s);}function We(t,e,n,o,r,a,i,s=false){let d=o.filter(Pe).map(l=>De(n,l,a));C(t,e,d,r,a,i,s);}var E=/^[0-9A-Fa-f]{6}$/,be=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,Ve=new Map(Object.entries({single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"})),Xe=new Map(Object.entries({black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"}));function Ye(t){return t.doubleStrike?"double":t.strike?"single":"none"}function qe(t){return t==="thick"||t.endsWith("Heavy")}function Ee(t){if(!t.underline)return null;let e=t.underline.color&&E.test(t.underline.color)?t.underline.color:null;return {cssStyle:Ve.get(t.underline.variant)??"solid",color:e,heavy:qe(t.underline.variant)}}function Le(t,e,n,o){t.textDecorationLine=e,t.textDecorationStyle=n,o.color&&(t.textDecorationColor=`#${o.color}`),o.heavy&&(t.textDecorationThickness=`max(${2*o.scale}px, 0.12em)`);}function me(t,e,n){e!=="none"&&Le(t,"line-through",e==="double"?"double":"solid",{scale:n});}function ve(t,e,n){Le(t,"underline",e.cssStyle,{color:e.color,heavy:e.heavy,scale:n});}function Ze(t,e,n){let o=e.color?`#${e.color}`:"currentColor";t.borderBottomWidth=`${(e.heavy?2:1)*n}px`,t.borderBottomStyle=e.cssStyle==="wavy"?"solid":e.cssStyle,t.borderBottomColor=o;}function _(t,e,n){let o=t.style,r=n.scale,a=e.verticalAlign==="baseline"?1:.75;o.fontSize=`${e.fontSizePt*a*r}px`,e.bold&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let i=e.fontFamily&&be.test(e.fontFamily)?e.fontFamily:n.defaultFontFamily&&be.test(n.defaultFontFamily)?n.defaultFontFamily:null;if(i){let l=n.fontAlias?.(i);o.fontFamily=l?`"${l}", "${i}", ${gd}`:`"${i}", ${gd}`;}e.color&&E.test(e.color)&&(o.color=`#${e.color}`);let s=e.highlight?Xe.get(e.highlight):void 0;s?(o.backgroundColor=s,t.dataset.highlight=e.highlight??""):e.shading&&E.test(e.shading)&&(o.backgroundColor=`#${e.shading}`),e.caps&&(o.textTransform="uppercase"),e.smallCaps&&(o.fontVariant="small-caps");let d=hb(e);d!==0&&(o.position="relative",o.top=`${-d*r}px`),e.characterSpacingPt!==0&&(o.letterSpacing=`${e.characterSpacingPt*r}px`),e.horizontalScalePercent!==100&&(o.transformOrigin="left",o.transform=`scaleX(${e.horizontalScalePercent/100})`);}function Te(t,e,n,o,r){let a=n===" "?null:Ee(o),i=Ye(o),s=e;if(a&&i!=="none"){let d=t.createElement("span");d.dataset.docxDeco="underline",ve(d.style,a,r);let l=t.createElement("span");l.dataset.docxDeco="strike",me(l.style,i,r),d.append(l),e.append(d),s=l;}else a?ve(e.style,a,r):i!=="none"&&me(e.style,i,r);s.textContent=n;}function P(t,e,n,o){let r=t.createElement(e);return r.style.position="absolute",r.style.left=`${n.x*o}px`,r.style.top=`${n.y*o}px`,r.style.width=`${n.width*o}px`,r.style.height=`${n.height*o}px`,r}function Je(t,e,n){let o=ab(e.props),r=J(e.revisions,n.authorSlots);if(!(!r&&!o)){if(r){let{attribution:a}=r;t.classList.add("docx-revision",`docx-revision-${a.kind}`),t.dataset.revisionKind=a.kind,t.dataset.revisionId=a.id,t.dataset.revisionAuthor=a.author,a.date!==void 0&&(t.dataset.revisionDate=a.date),t.style.color=r.color,t.style.backgroundColor=r.deleted?"var(--doc-revision-deletion-wash)":"var(--doc-revision-insertion-wash)",r.line&&(t.style.textDecorationLine=r.line,t.style.textDecorationStyle=r.decorationStyle,t.style.textDecorationColor=r.color);return}t.classList.add("docx-revision","docx-revision-format"),t.dataset.revisionKind="format",t.dataset.revisionId=o.id,t.dataset.revisionAuthor=o.author,o.date!==void 0&&(t.dataset.revisionDate=o.date);}}function Qe(t,e,n){let o=t.createElement("span");return o.className=`docx-revision-pmark docx-revision-pmark-${e.kind}`,o.setAttribute("aria-hidden","true"),o.contentEditable="false",o.dataset.revisionKind=e.kind,o.dataset.revisionId=e.id,o.dataset.revisionAuthor=e.author,o.textContent="\xB6",o.style.position="absolute",o.style.pointerEvents="none",o.style.marginLeft=`${2*n}px`,o.style.color=e.kind==="delete"?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",e.kind==="delete"&&(o.style.textDecorationLine="line-through"),o}function et(t,e,n){let o=[];for(let a of e.lines){let i=a.spans.flatMap(y=>y.revisions??[]);if(i.length===0)continue;let s=i.some(y=>y.kind==="delete"||y.kind==="moveFrom"),d=a.box.y-e.box.y,l=d+a.box.height,c=o[o.length-1];if(c&&c.deleted===s&&d<=c.bottom+.5){c.bottom=Math.max(c.bottom,l);continue}o.push({top:d,bottom:l,deleted:s});}if(o.length===0)return null;let r=t.createElement("div");r.className="docx-change-bars",r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.inset="0",r.style.pointerEvents="none";for(let a of o){let i=t.createElement("div");i.className=`docx-change-bar docx-change-bar-${a.deleted?"deletion":"insertion"}`,i.style.position="absolute",i.style.top=`${a.top*n}px`,i.style.height=`${(a.bottom-a.top)*n}px`,i.style.left=`${(-e.box.x-tt)*n}px`,i.style.width=`${nt*n}px`,i.style.pointerEvents="none",i.style.backgroundColor=a.deleted?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",r.append(i);}return r}var tt=7.5,nt=1.5;function ot(t,e,n,o,r){let a=t.createElement("span");if(a.className="layout-run layout-run-text",a.style.display="inline-block",a.style.verticalAlign="baseline",a.style.boxSizing="border-box",a.style.height=`${o*n.scale}px`,a.style.paddingTop=`${r*n.scale}px`,a.style.lineHeight=`${(o-r)*n.scale}px`,e.range.end>e.range.start?(a.dataset.paragraphId=e.range.paragraphId,a.dataset.start=String(e.range.start),a.dataset.end=String(e.range.end)):(a.setAttribute("aria-hidden","true"),a.contentEditable="false"),_(a,e.style,n),Je(a,e,n),(e.style.horizontalScalePercent!==100||e.text===" ")&&(a.style.width=`${e.box.width*n.scale}px`),e.text===" "){a.style.overflow="hidden",a.style.verticalAlign="top";let i=Ee(e.style);i&&(a.dataset.docxTabUnderline="",Ze(a.style,i,n.scale));}return Te(t,a,e.text,e.style,n.scale),e.projected&&(a.dataset.docxField="",a.setAttribute("contenteditable","false"),e.noteNav?(a.style.userSelect="none",e.noteNav.direction==="to-note"?(a.dataset.docxNoteRef="",a.dataset.docxNoteScope=e.noteNav.scopeId,e.text.length>0&&a.setAttribute("aria-description",e.text)):(a.dataset.docxNoteMarkBack="",a.dataset.docxNoteScope=e.noteNav.scopeId)):(a.style.pointerEvents="none",a.style.userSelect="none")),a}function rt(t,e,n){let o=t.createElement("a");return o.className="docx-hyperlink",o.dataset.docxLink=e.id,o.dataset.docxLinkKind=e.kind,o.setAttribute("tabindex","-1"),!n.inertLinks&&e.href&&(o.setAttribute("href",e.href),e.kind==="external"&&o.setAttribute("rel","noopener noreferrer")),e.tooltip&&o.setAttribute("title",e.tooltip),o.style.display="inline-block",o.style.verticalAlign="baseline",o.style.textDecoration="none",o.style.color="inherit",o}function at(t,e,n){let o=n.scale,r=t.createElement("div");r.className="docx-line layout-line",r.dataset.lineId=e.id,r.dataset.paragraphId=e.range.paragraphId,r.style.position="absolute",r.style.top=`${e.box.y*o}px`,r.style.left=`${e.contentX*o}px`,r.style.height=`${e.box.height*o}px`,r.style.fontSize="0",r.style.whiteSpace="pre",r.style.overflow="visible";let a=it(e);a>0&&(r.style.wordSpacing=`${a*o}px`);let i=e.leading??0,s=Math.min(Math.max(i,...e.spans.map(g=>g.box.height+i),e.spans.length===0?e.box.height-(e.trailingSpacing??0):0),e.box.height),d=Math.max(0,e.box.height-s);r.style.boxSizing="border-box",r.style.paddingBottom=`${d*o}px`,r.style.lineHeight=`${(e.box.height-d)*o}px`;let l=null,c=null,y=[...e.drawings??[]].sort((g,x)=>g.start-x.start),h=0,p=g=>{for(;h<y.length&&y[h].start<g;){let x=y[h],b=Math.max(0,x.advanceEnd-x.advanceStart),m=t.createElement("span");m.className="docx-inline-drawing-advance",m.dataset.docxMarker="",m.setAttribute("contenteditable","false"),m.setAttribute("aria-hidden","true"),m.style.display="inline-block",m.style.width=`${b*o}px`,m.style.height=`${x.baselineOffset*o}px`,m.style.lineHeight="0",m.style.pointerEvents="none",m.style.verticalAlign="baseline",r.append(m),h+=1,l=null,c=null;}},u=g=>{let x=g.wrapAdvanceBefore??0;if(x<=.001)return;let b=t.createElement("span");b.className="docx-wrap-advance",b.dataset.docxMarker="",b.setAttribute("contenteditable","false"),b.setAttribute("aria-hidden","true"),b.style.display="inline-block",b.style.width=`${x*o}px`,b.style.height="0",b.style.lineHeight="0",b.style.pointerEvents="none",b.style.verticalAlign="baseline",r.append(b),l=null,c=null;};for(let g of e.spans){p(g.range.start),u(g);let x=Math.min(g.box.height+i,e.box.height),b=ot(t,g,n,x,i),m=g.link;if(!m){l=null,c=null,r.append(b);continue}(!l||c!==m.id)&&(l=rt(t,m,n),c=m.id,r.append(l)),l.append(b);}if(p(Number.POSITIVE_INFINITY),e.spans.length===0){let g=t.createElement("br");g.style.lineHeight=`${e.box.height*o}px`,r.append(g);}let v=Object.freeze({x:e.contentX,y:e.box.y,width:e.box.width,height:e.box.height}),S=$e(Se(n));if(e.drawings&&e.drawings.length>0)for(let g of le(t,e,S.ctx,S.urlRegistry,v))r.append(g);return r}function it(t){if(t.spans.length<2)return 0;let e=[];for(let n=1;n<t.spans.length;n+=1){let o=t.spans[n-1],r=t.spans[n];if(t.drawings?.some(s=>s.start>=o.range.end&&s.start<r.range.start))continue;let i=r.box.x-(o.box.x+o.box.width)-(r.wrapAdvanceBefore??0);i>.25&&e.push(i);}return e.length===0?0:e.reduce((n,o)=>n+o,0)/e.length}function k(t,e,n){let o=n.scale,r=P(t,"div",e.box,o);r.className="docx-paragraph-fragment layout-paragraph",r.dataset.paragraphId=e.paragraphId,r.dataset.fragmentIndex=String(e.fragmentIndex),n.readOnlyParagraphIds?.has(e.paragraphId)&&(r.classList.add("docx-generated-region"),r.dataset.docxReadOnly="",r.setAttribute("contenteditable","false"),r.setAttribute("aria-readonly","true")),n.emptyTocPlaceholderIds?.has(e.paragraphId)&&(r.classList.add("docx-toc-empty-placeholder"),r.dataset.docxTocEmpty=""),e.shading&&E.test(e.shading)&&e.shadingBox&&r.append(ct(t,e,o)),e.marker&&r.append(st(t,e,n));for(let i of e.lines)for(let s of i.spans){if(!s.tabLeader)continue;let d=dt(t,e,i,s,n);d&&r.append(d);}let a=et(t,e,o);if(a&&r.append(a),e.markRevision){let i=Qe(t,e.markRevision,o),s=e.lines[e.lines.length-1];if(s){let d=s.spans[s.spans.length-1];i.style.top=`${(s.box.y-e.box.y)*o}px`,i.style.left=`${((d?d.box.x+d.box.width:s.contentX)-e.box.x)*o}px`,r.append(i);}}for(let i of e.lines){let s=at(t,i,n);s.style.top=`${(i.box.y-e.box.y)*o}px`,s.style.left=`${(i.contentX-e.box.x)*o}px`,r.append(s);}if(e.borders)for(let i of e.borders)r.append(we(t,e,i,o));else e.bottomBorder&&r.append(we(t,e,{side:"bottom",edge:e.bottomBorder.edge,box:e.bottomBorder.box},o));return r}function st(t,e,n){let o=e.marker,r=n.scale,a=e.lines[0]?.leading??0,i=P(t,"span",o.box,r);i.className="docx-list-marker",i.dataset.docxMarker="",i.setAttribute("contenteditable","false"),i.setAttribute("aria-hidden","true"),i.style.left=`${(o.box.x-e.box.x)*r}px`,i.style.top=`${(o.box.y-e.box.y)*r}px`,i.style.display="block",i.style.overflow="visible",i.style.whiteSpace="pre";let s=e.lines[0],d=s?Math.max(a,...s.spans.map(h=>h.box.height+a),s.spans.length===0?s.box.height-(s.trailingSpacing??0):0):o.box.height,l=Math.min(d,o.box.height),c=Math.max(0,o.box.height-l);i.style.fontSize="0",i.style.boxSizing="border-box",i.style.paddingBottom=`${c*r}px`,i.style.lineHeight=`${l*r}px`;let y=t.createElement("span");return y.style.display="inline-block",y.style.verticalAlign="baseline",y.style.boxSizing="border-box",y.style.height=`${l*r}px`,y.style.paddingTop=`${a*r}px`,y.style.lineHeight=`${(l-a)*r}px`,_(y,o.style,n),Te(t,y,o.text,o.style,r),i.append(y),i}var lt=512;function dt(t,e,n,o,r){let a=o.tabLeader?Da.get(o.tabLeader):void 0;if(!a||o.box.width<=0)return null;let i=r.scale,s=t.createElement("div");s.className="docx-tab-leader",s.dataset.docxTabLeader="",s.setAttribute("contenteditable","false"),s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left=`${(o.box.x-e.box.x)*i}px`,s.style.top=`${(n.box.y-e.box.y)*i}px`,s.style.width=`${o.box.width*i}px`,s.style.height=`${n.box.height*i}px`,s.style.overflow="hidden",s.style.whiteSpace="pre",s.style.pointerEvents="none",s.style.userSelect="none";let d=n.leading??0,l=Math.min(o.box.height+d,n.box.height),c=Math.max(0,n.box.height-l);s.style.fontSize="0",s.style.boxSizing="border-box",s.style.paddingBottom=`${c*i}px`,s.style.lineHeight=`${(n.box.height-c)*i}px`;let y=t.createElement("span");y.style.display="inline-block",y.style.verticalAlign="baseline",_(y,o.style,r),y.style.boxSizing="border-box",y.style.height=`${l*i}px`,y.style.paddingTop=`${d*i}px`,y.style.lineHeight=`${(l-d)*i}px`,o.tabLeader==="heavy"&&(y.style.fontWeight="bold");let h=o.tabLeaderAdvancePt&&o.tabLeaderAdvancePt>0?o.tabLeaderAdvancePt:Math.max(.5,o.style.fontSizePt*.2),p=Math.min(lt,Math.max(1,Math.floor(o.box.width/h)+2));return y.textContent=a.repeat(p),y.style.letterSpacing="0",s.append(y),s}function ct(t,e,n){let o=e.shadingBox,r=P(t,"div",o,n);return r.className="docx-paragraph-shading",r.setAttribute("aria-hidden","true"),r.style.left=`${(o.x-e.box.x)*n}px`,r.style.top=`${(o.y-e.box.y)*n}px`,r.style.backgroundColor=`#${e.shading}`,r}function we(t,e,n,o){let r=P(t,"div",n.box,o);r.className=`docx-paragraph-border docx-paragraph-border-${n.side}`,r.setAttribute("aria-hidden","true");let a=(n.box.x-e.box.x)*o,i=(n.box.y-e.box.y)*o,s=n.side==="left"||n.side==="right"||n.side==="bar",d=(s?n.box.width:n.box.height)*o,c=yt(n.edge.val)?d:Math.max(1,d);r.style.left=`${n.side==="right"?a-(c-d):a}px`,r.style.top=`${n.side==="bottom"?i-(c-d):i}px`,s?r.style.width=`${c}px`:r.style.height=`${c}px`;let y=n.edge.color&&E.test(n.edge.color)?n.edge.color:"000000";return r.style.backgroundColor=`#${y}`,pt(r,n.edge.val,y,s,c,o),r}function yt(t){return t==="double"||t==="triple"||t==="doubleWave"||t.startsWith("thinThick")||t.startsWith("thickThin")}function pt(t,e,n,o,r,a){switch(e){case "dashed":case "dashSmallGap":case "dotDash":case "dotDotDash":case "dashDotStroked":{let i=Math.max(4,4*a);t.style.backgroundImage=`linear-gradient(to ${o?"bottom":"right"}, #${n} 60%, transparent 60%)`,t.style.backgroundSize=o?`100% ${i}px`:`${i}px 100%`;return}case "dotted":{let i=Math.max(3,3*a);t.style.backgroundImage=`linear-gradient(to ${o?"bottom":"right"}, #${n} 35%, transparent 35%)`,t.style.backgroundSize=o?`100% ${i}px`:`${i}px 100%`;return}case "double":case "doubleWave":case "triple":case "thinThickSmallGap":case "thickThinSmallGap":case "thinThickThinSmallGap":case "thinThickMediumGap":case "thickThinMediumGap":case "thinThickThinMediumGap":case "thinThickLargeGap":case "thickThinLargeGap":case "thinThickThinLargeGap":{let i=Math.max(1,r/3);t.style.backgroundColor="transparent",o?(t.style.borderLeft=`${i}px solid #${n}`,t.style.borderRight=`${i}px solid #${n}`):(t.style.borderTop=`${i}px solid #${n}`,t.style.borderBottom=`${i}px solid #${n}`),t.style.boxSizing="border-box";return}case "threeDEmboss":case "ridge":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px ridge #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "threeDEngrave":case "groove":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px groove #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "inset":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px inset #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "outset":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px outset #${n}`,o?t.style.width="0px":t.style.height="0px";return}default:return}}function ht(t,e,n,o){let r=o.scale,a=P(t,"div",e.box,r);if(a.className="docx-table-cell",a.style.left=`${(e.box.x-n.x)*r}px`,a.style.top=`${(e.box.y-n.y)*r}px`,a.style.boxSizing="border-box",a.style.overflow="visible",a.dataset.cellId=e.id,a.dataset.gridColumn=String(e.gridColumn),a.dataset.gridSpan=String(e.gridSpan),e.rowSpan&&e.rowSpan>1&&(a.dataset.rowSpan=String(e.rowSpan)),e.paintInert||e.vMergeContinue)return a.dataset.vMergeContinue="true",a.style.border="none",a.style.backgroundColor="transparent",a;a.style.border="none",ue(t,a,e.borders,r),e.shading&&E.test(e.shading)&&(a.style.backgroundColor=`#${e.shading}`);for(let i of e.blocks){let s=i.kind==="table"?I(t,i,o):k(t,i,o);s.style.left=`${(i.box.x-e.box.x)*r}px`,s.style.top=`${(i.box.y-e.box.y)*r}px`,a.append(s);}return a}function I(t,e,n){let o=n.scale,r=P(t,"div",e.box,o);r.className="docx-table-fragment layout-table",r.dataset.tableId=e.tableId,r.dataset.fragmentIndex=String(e.fragmentIndex),r.style.overflow="visible";for(let a of e.rows){let i=P(t,"div",a.box,o);i.className="docx-table-row",a.revisionKind&&(i.classList.add("docx-table-row--revision",a.revisionKind==="insert"?"layout-revision-ins":"layout-revision-del"),i.dataset.revisionKind=a.revisionKind,a.revisionId!==void 0&&(i.dataset.revisionId=a.revisionId),a.revisionAuthor!==void 0&&(i.dataset.revisionAuthor=a.revisionAuthor),a.revisionDate!==void 0&&(i.dataset.revisionDate=a.revisionDate)),i.dataset.rowId=a.id,a.isHeaderRepeat&&(i.dataset.headerRepeat="true"),i.style.left=`${(a.box.x-e.box.x)*o}px`,i.style.top=`${(a.box.y-e.box.y)*o}px`,i.style.overflow="visible";for(let s of a.cells)i.append(ht(t,s,a.box,n));r.append(i);}return r}function ut(t,e,n,o){let r={...n,paintInstance:`p${e.index}`},a=P(t,"div",e.box,r.scale);if(a.className="docx-page",a.style.fontFamily=gd,a.dataset.pageIndex=String(e.index),r.ariaHidden&&(a.setAttribute("aria-hidden","true"),a.setAttribute("role","presentation")),a.dataset.materialized=String(o),!o)return a;let i=Object.freeze({x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height}),s=Object.freeze({x:-(e.contentBox.x-e.box.x),y:-(e.contentBox.y-e.box.y),width:e.box.width,height:e.box.height});fe(t,a,e,r,s,"behind");for(let l of [e.header,e.footer])l?.anchoredDrawings?.length&&je(t,a,l,l.anchoredDrawings,r,{x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height});let d=t.createElement("div");d.className="docx-page-content",d.style.position="absolute",d.style.left=`${(e.contentBox.x-e.box.x)*r.scale}px`,d.style.top=`${(e.contentBox.y-e.box.y)*r.scale}px`,d.style.width=`${e.contentBox.width*r.scale}px`,d.style.height=`${e.contentBox.height*r.scale}px`,r.activeHeaderFooterRId&&d.setAttribute("contenteditable","false");for(let l of e.columnSeparators??[]){let c=t.createElement("div");c.className="docx-column-separator",c.setAttribute("contenteditable","false"),c.style.position="absolute",c.style.left=`${l.x*r.scale}px`,c.style.top=`${l.y*r.scale}px`,c.style.width=`${l.width*r.scale}px`,c.style.height=`${l.height*r.scale}px`,c.style.backgroundColor="currentColor",c.style.pointerEvents="none",d.append(c);}for(let l of e.fragments)d.append(l.kind==="table"?I(t,l,r):k(t,l,r));a.append(d),fe(t,a,e,r,s,"inFront"),Q(t,a,e,r,k,I);for(let l of ["header","footer"]){if(e[l])continue;let c=t.createElement("div");c.className="docx-hf docx-hf--placeholder",c.dataset.docxHf=l,c.setAttribute("contenteditable","false");let y=l==="header"?e.contentBox.y-e.box.y:e.box.y+e.box.height-(e.contentBox.y+e.contentBox.height),h=Math.min(y,gt);if(h<=0)continue;let p=Math.max(0,Math.min(xt,y-h)),u=l==="header"?p:e.box.height-p-h;c.style.position="absolute",c.style.left=`${(e.contentBox.x-e.box.x)*r.scale}px`,c.style.top=`${u*r.scale}px`,c.style.width=`${e.contentBox.width*r.scale}px`,c.style.height=`${h*r.scale}px`,a.append(c);}for(let l of [e.header,e.footer]){if(!l)continue;let c=l.anchoredDrawings??[],y=!!r.activeHeaderFooterRId&&!!l.rId&&r.activeHeaderFooterRId===l.rId&&(r.activeHeaderFooterPageIndex===void 0||r.activeHeaderFooterPageIndex===e.index),h=t.createElement("div");h.className="docx-hf",h.dataset.docxHf=l.kind,l.rId&&(h.dataset.docxRId=l.rId),y?(h.dataset.docxHfActive="",h.setAttribute("contenteditable","true")):h.setAttribute("contenteditable","false"),h.style.position="absolute",h.style.left=`${(l.box.x-e.box.x)*r.scale}px`,h.style.top=`${(l.box.y-e.box.y)*r.scale}px`,h.style.width=`${l.box.width*r.scale}px`;let p=y?l.kind==="footer"?Math.max(l.box.height,e.box.y+e.box.height-l.box.y):Math.max(l.box.height,e.contentBox.y-l.box.y):l.box.height;h.style.height=`${p*r.scale}px`,h.style.overflow="visible";let u=(e.box.x-l.box.x)*r.scale,v=(e.box.y-l.box.y)*r.scale,S=u+e.box.width*r.scale,g=v+e.box.height*r.scale;h.style.clipPath=`polygon(${u}px ${v}px, ${S}px ${v}px, ${S}px ${g}px, ${u}px ${g}px)`;let x=Object.freeze({x:0,y:0,width:l.box.width,height:l.box.height}),b=c.filter(f=>!Pe(f)),m={...r,inertLinks:true};for(let f of l.fragments)h.append(f.kind==="table"?I(t,f,m):k(t,f,m));C(t,h,b,Se(r),x,"inFront",y),a.append(h);let w=t.createElement("div");w.className="docx-hf-edit-hint",w.dataset.docxHfHint=l.kind,w.setAttribute("contenteditable","false"),w.style.position="absolute",w.style.left=h.style.left,w.style.width=h.style.width,w.style.top=l.kind==="header"?`${(l.box.y+l.box.height-e.box.y)*r.scale}px`:`${(l.box.y-e.box.y)*r.scale}px`,l.kind==="footer"&&(w.style.transform="translateY(-100%)"),a.append(w),We(t,a,l,c,r,i,"inFront",y);}return mt(t,a,e,r),a}var gt=30,xt=36,ft=16,bt=new Set(["dropdown","comboBox","date","checkbox"]);function mt(t,e,n,o){let r=o.contentControlChrome,a=r?.suppressedIds,i=(n.contentControls??[]).filter(h=>a?.has(h.id)!==true),s=[...i,...(r?.additionalBoundaries??[]).filter(h=>a?.has(h.id)!==true&&!i.some(p=>p.id===h.id))];if(s.length===0)return;let d=r?.showAll===true,l=r?.activeIds,c=r?.hoverIds,y=r?.tocControlIds;for(let h of s){let p=y?.has(h.id)===true,u=!p&&l?.has(h.id)===true,v=c?.has(h.id)===true;e.append(vt(t,n,h,o.scale,u,v,d||u||p&&v,r?.checkedIds?.has(h.id),p));}}function vt(t,e,n,o,r,a,i,s,d){let l=t.createElement("div");l.className="docx-content-control-chrome",l.dataset.docxContentControl=n.id,l.dataset.docxMarker="",l.dataset.controlType=n.controlType,l.dataset.lock=n.effectiveLock,n.bound&&(l.dataset.bound=""),n.placeholder&&(l.dataset.placeholder=""),d&&(l.dataset.docxToc=""),r&&(l.dataset.active=""),a&&(l.dataset.hover=""),i&&(l.dataset.boundaryVisible=""),l.setAttribute("contenteditable","false"),l.setAttribute("role","group"),n.alias&&(l.dataset.alias=n.alias),n.tag&&(l.dataset.tag=n.tag),n.alias&&l.setAttribute("aria-label",n.alias),l.style.position="absolute",l.style.inset="0",l.style.pointerEvents="none",l.style.zIndex="2";let c=e.contentBox.x-e.box.x,y=e.contentBox.y-e.box.y;for(let p of n.fragments){if(p.pageIndex!==e.index)continue;let u=t.createElement("div");u.className="docx-content-control-boundary",u.dataset.docxMarker="",u.setAttribute("contenteditable","false"),u.setAttribute("aria-hidden","true"),u.style.position="absolute",u.style.left=`${(c+p.box.x)*o}px`,u.style.top=`${(y+p.box.y)*o}px`,u.style.width=`${Math.max(p.box.width,1)*o}px`,u.style.height=`${Math.max(p.box.height,1)*o}px`,u.style.pointerEvents="none",l.append(u);}let h=n.fragments.find(p=>p.pageIndex===e.index);if(h&&n.alias){let p=t.createElement("div");p.className="docx-content-control-label",p.dataset.docxMarker="",p.setAttribute("contenteditable","false"),p.setAttribute("aria-hidden","true"),p.textContent=n.alias,p.style.position="absolute",p.style.left=`${(c+h.box.x)*o}px`,p.style.top=`${Math.max(0,(y+h.box.y)*o-ft)}px`,p.style.pointerEvents="none",l.append(p);}if(h&&bt.has(n.controlType)){let p=t.createElement("button");p.type="button",p.className="docx-content-control-widget",p.dataset.docxMarker="",p.dataset.docxCcWidget=n.controlType,p.dataset.docxCcId=n.id,p.setAttribute("contenteditable","false"),p.setAttribute("tabindex","-1"),n.controlType==="checkbox"?p.setAttribute("role","checkbox"):n.controlType==="dropdown"||n.controlType==="comboBox"?p.setAttribute("role","listbox"):n.controlType==="date"&&p.setAttribute("role","button"),n.alias&&(p.dataset.name=n.alias),n.alias&&p.setAttribute("aria-label",n.alias),n.controlType==="checkbox"&&(p.setAttribute("data-checked",s?"true":"false"),p.setAttribute("aria-checked",s?"true":"false")),(n.effectiveLock==="contentLocked"||n.effectiveLock==="sdtContentLocked"||n.bound)&&(p.disabled=true,p.dataset.disabledReason=n.bound?"bound":"locked",p.setAttribute("aria-disabled","true")),p.style.position="absolute",p.style.left=`${(c+h.box.x+h.box.width)*o-18}px`,p.style.top=`${(y+h.box.y)*o}px`,p.style.width="16px",p.style.height="16px",p.style.pointerEvents="auto",p.style.padding="0",p.style.margin="0",p.style.cursor=p.disabled?"not-allowed":"pointer",l.append(p);}return l}var Re=new WeakMap;function wt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Rt(t,e,n,o){let r=t.element;return !t.materialized&&wt(t.record.box,e.box)&&r.style.left===`${e.box.x*n}px`&&r.style.top===`${e.box.y*n}px`&&r.style.width===`${e.box.width*n}px`&&r.style.height===`${e.box.height*n}px`&&r.getAttribute("aria-hidden")===(o?"true":null)}function St(t,e,n={}){let o=n.contentControlChrome,r=o?`${o.showAll===true?"1":"0"}:${o.activeIds?[...o.activeIds].sort().join(","):""}:${o.checkedIds?[...o.checkedIds].sort().join(","):""}:${o.tocControlIds?[...o.tocControlIds].sort().join(","):""}:${o.suppressedIds?[...o.suppressedIds].sort().join(","):""}`:"",a=n.drawingStrings??U,i=n.imageUrlPort!==void 0?ne(t,n.imageUrlPort):null,s=o?.additionalBoundaries?o.additionalBoundaries.flatMap(f=>f.fragments.map($=>`${f.id}:${$.pageIndex}:${$.box.x}:${$.box.y}:${$.box.width}:${$.box.height}`)).sort().join(","):"",d=n.readOnlyParagraphIds?[...n.readOnlyParagraphIds].sort().join(","):"",l=n.emptyTocPlaceholderIds?[...n.emptyTocPlaceholderIds].sort().join(","):"",c=o?.tocControlIds?[...o.tocControlIds].sort().join(","):"",y={scale:n.scale??96/72,ariaHidden:n.ariaHidden??true,drawingStrings:a,urlRegistry:i,...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.readOnlyParagraphIds?{readOnlyParagraphIds:n.readOnlyParagraphIds}:{},...n.emptyTocPlaceholderIds?{emptyTocPlaceholderIds:n.emptyTocPlaceholderIds}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},authorSlots:Z(e),...n.imageUrlPort?{imageUrlPort:n.imageUrlPort}:{},...n.activeHeaderFooterRId?{activeHeaderFooterRId:n.activeHeaderFooterRId}:{},...n.activeHeaderFooterPageIndex!==void 0?{activeHeaderFooterPageIndex:n.activeHeaderFooterPageIndex}:{},...o?{contentControlChrome:o}:{}},h=t.ownerDocument,p=`${y.scale}|${y.ariaHidden}|${y.fontAlias?_e(y.fontAlias):""}|${y.defaultFontFamily??""}|${y.activeHeaderFooterRId??""}|${y.activeHeaderFooterPageIndex??""}|cc:${r}:${s}|toc:${c}|ro:${d}|tocEmpty:${l}|${n.imageUrlPort?"url":""}|${pe(a)}`,u=Re.get(t),S=u?.parameters===p?new Map(u.pages.map(f=>[f.record,f])):null,g=u?new Map(u.pages.map(f=>[f.record.index,f])):null,x=e.pages.map(f=>{let $=n.materialize?.has(f.index)??true,F=S?.get(f);if(F&&F.materialized===$)return F;let N=$?null:g?.get(f.index);return N&&Rt(N,f,y.scale,y.ariaHidden)?{record:f,materialized:false,element:N.element}:{record:f,materialized:$,element:ut(h,f,y,$)}});Re.set(t,{parameters:p,pages:x}),t.dataset.revision=String(e.revision),i&&i.reconcile(ce(e),ye(e));let b=new Set(x.map(f=>f.element)),m=t.firstChild;for(;m;){let f=m.nextSibling;b.has(m)||m.remove(),m=f;}let w=t.firstChild;for(let f of x){if(f.element===w){w=w.nextSibling;continue}t.insertBefore(f.element,w);}}function $t(t,e,n,o){let r=t.ownerDocument,a=o.scale,i=[];for(let s of n){let d=e.pages[s.pageIndex];if(!d)continue;let l=r.createElement("div");l.className=s.className??o.className??"docx-cell-selection-rect",l.style.position="absolute";let c=o.pageOffsetX?.get(s.pageIndex)??0;l.style.left=`${(d.contentBox.x+s.x+c)*a}px`,l.style.top=`${(d.contentBox.y+s.y)*a}px`,l.style.width=`${s.width*a}px`,l.style.height=`${s.height*a}px`,i.push(l);}t.replaceChildren(...i);}
2
+ export{kt as a,U as b,It as c,St as d,$t as e};