@docx-editor.dev/core 2.17.0 → 2.19.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 +1 -1
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/dist/automation.cjs +1 -1
  4. package/dist/automation.d.ts +35 -8
  5. package/dist/automation.js +1 -1
  6. package/dist/binding.cjs +1 -1
  7. package/dist/binding.d.ts +9 -11
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-2ZEU42EA.js +2 -0
  10. package/dist/chunk-4DB7ZFQN.js +1 -0
  11. package/dist/chunk-4KMSEFIG.js +3 -0
  12. package/dist/chunk-72BDQFHY.js +18 -0
  13. package/dist/chunk-77DD4EBC.cjs +11 -0
  14. package/dist/chunk-BEOPUDAB.js +5 -0
  15. package/dist/chunk-CG7CP632.cjs +1 -0
  16. package/dist/chunk-CJCFEXTA.js +11 -0
  17. package/dist/chunk-DQS4KZUX.js +4 -0
  18. package/dist/chunk-FZ2BIMCY.cjs +2 -0
  19. package/dist/chunk-GUPITGJQ.cjs +2 -0
  20. package/dist/chunk-KDYD5TAW.cjs +1 -0
  21. package/dist/chunk-LQ6XWTKQ.cjs +18 -0
  22. package/dist/chunk-MDP5SNK4.cjs +3 -0
  23. package/dist/chunk-MRPPCGCX.cjs +20 -0
  24. package/dist/chunk-MSIFK7TJ.js +1 -0
  25. package/dist/chunk-NJONXJJY.cjs +4 -0
  26. package/dist/chunk-OODFC5R2.js +1 -0
  27. package/dist/chunk-P6VGDI57.js +2 -0
  28. package/dist/{chunk-UIB2MDE3.cjs → chunk-PBM6WERF.cjs} +1 -1
  29. package/dist/chunk-QBMAXYN7.js +20 -0
  30. package/dist/chunk-SUEX3CL7.cjs +5 -0
  31. package/dist/{chunk-UXAWPVH6.js → chunk-THCGTV53.js} +1 -1
  32. package/dist/{chunk-NO7U62I2.cjs → chunk-YVYEJBLL.cjs} +1 -1
  33. package/dist/chunk-ZKQX2PNF.cjs +1 -0
  34. package/dist/{chunk-XXLS6O6B.js → chunk-ZMM5RNM6.js} +1 -1
  35. package/dist/collaboration/replication.cjs +1 -1
  36. package/dist/collaboration/replication.d.ts +2 -4
  37. package/dist/collaboration/replication.js +1 -1
  38. package/dist/collaboration.cjs +1 -1
  39. package/dist/collaboration.d.ts +4 -6
  40. package/dist/collaboration.js +1 -1
  41. package/dist/contracts/editor.d.ts +9 -8
  42. package/dist/contracts/modules.d.ts +7 -9
  43. package/dist/{custom-node-writes-ClTkWM7s.d.ts → custom-node-writes-BqIv94ei.d.ts} +14 -2
  44. package/dist/document-protection-BL5zp8cU.d.ts +19 -0
  45. package/dist/{editor-BlerWPyk.d.ts → editor-WXbTSXx1.d.ts} +14 -7
  46. package/dist/editor.cjs +1 -1
  47. package/dist/editor.css +1 -1
  48. package/dist/editor.d.ts +271 -30
  49. package/dist/editor.js +1 -1
  50. package/dist/export.cjs +2 -2
  51. package/dist/export.d.ts +15 -12
  52. package/dist/export.js +2 -2
  53. package/dist/{failure-BnGjoXf0.d.ts → failure-DNNmwsgD.d.ts} +1 -1
  54. package/dist/{font-resolver-DtADJcLL.d.ts → font-resolver-BSrKnTeR.d.ts} +5 -3
  55. package/dist/harfbuzz.wasm +0 -0
  56. package/dist/{headless-document-view-BDSeMGoK.d.ts → headless-document-view-C4ttQJ5H.d.ts} +11 -3
  57. package/dist/{index-D51bUVBE.d.ts → index-C3As-Xxp.d.ts} +133 -19
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.d.ts +18 -19
  60. package/dist/index.js +1 -1
  61. package/dist/{layout-shaping-rTElghj2.d.ts → layout-shaping-Dqu3JW3p.d.ts} +1 -1
  62. package/dist/layout.cjs +1 -1
  63. package/dist/layout.d.ts +23 -20
  64. package/dist/layout.js +1 -1
  65. package/dist/{note-properties-D5_fXW9K.d.ts → note-properties-RjYgbmXe.d.ts} +2 -2
  66. package/dist/{omml-equation-C9AJfWy5.d.ts → omml-equation-hcP9AUFX.d.ts} +1 -1
  67. package/dist/output.cjs +1 -1
  68. package/dist/output.d.ts +16 -6
  69. package/dist/output.js +1 -1
  70. package/dist/{protocol-K-Djpjjw.d.ts → protocol-OdRd17KZ.d.ts} +172 -7
  71. package/dist/{review-items-CiliAz8H.d.ts → review-items-CJz-kAW8.d.ts} +2 -2
  72. package/dist/{review-paragraph-order-BlSnyg9a.d.ts → review-paragraph-order--jLHXIcd.d.ts} +3 -3
  73. package/dist/{revision-projection-JiDclAFU.d.ts → revision-projection-BIHO_qvw.d.ts} +1 -1
  74. package/dist/{semantic-cell-selection-C-VsxNee.d.ts → semantic-cell-selection-lCYAVCCF.d.ts} +6 -24
  75. package/dist/{semantic-interaction-2vPh96Ey.d.ts → semantic-interaction-0vQXcMZk.d.ts} +2 -19
  76. package/dist/{semantic-paint-BEjYcsPK.d.ts → semantic-paint-BSan4pBk.d.ts} +10 -2
  77. package/dist/{semantic-records-Bc-MGXbM.d.ts → semantic-records-ZcYuB4-H.d.ts} +59 -13
  78. package/dist/store.cjs +1 -1
  79. package/dist/store.d.ts +49 -42
  80. package/dist/store.js +1 -1
  81. package/dist/{tree-op-types-C71G7rIv.d.ts → tree-op-types-DbdM7fJV.d.ts} +84 -4
  82. package/dist/{tree-package-fragment-DRJkmfTW.d.ts → tree-package-fragment-1pdDnhZ_.d.ts} +491 -23
  83. package/dist/{tree-session-contract-Cp5W25RC.d.ts → tree-session-contract-Cgn6fQ-M.d.ts} +34 -9
  84. package/package.json +4 -4
  85. package/dist/chunk-27YEILW4.cjs +0 -20
  86. package/dist/chunk-4RDCLCLB.js +0 -2
  87. package/dist/chunk-7QG5FJ4X.js +0 -1
  88. package/dist/chunk-BML3CNUT.js +0 -2
  89. package/dist/chunk-CHRMIA3I.js +0 -20
  90. package/dist/chunk-FRRMJK2G.js +0 -5
  91. package/dist/chunk-G5GLQ4SX.cjs +0 -1
  92. package/dist/chunk-JP253KIZ.cjs +0 -2
  93. package/dist/chunk-JROG4U3Z.cjs +0 -21
  94. package/dist/chunk-MBXGQN6J.js +0 -1
  95. package/dist/chunk-MDMM3XVQ.js +0 -11
  96. package/dist/chunk-NPZX5O23.cjs +0 -2
  97. package/dist/chunk-OISZDVXT.cjs +0 -5
  98. package/dist/chunk-PRNYSOQL.cjs +0 -1
  99. package/dist/chunk-RXPOTTQQ.js +0 -21
  100. package/dist/chunk-T7JERNXT.cjs +0 -2
  101. package/dist/chunk-TDMGSCCL.cjs +0 -1
  102. package/dist/chunk-VYQTZIYH.js +0 -1
  103. package/dist/chunk-W7GY2IJC.js +0 -2
  104. package/dist/chunk-ZFBNCHRP.cjs +0 -11
  105. package/dist/hf-references-kSSFMq9X.d.ts +0 -70
  106. package/dist/tree-store-BRfhZceK.d.ts +0 -416
  107. /package/dist/{dist-OSUJGKTK.js → dist-PKZR6RSH.js} +0 -0
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkJROG4U3Z_cjs=require('./chunk-JROG4U3Z.cjs');var L=8,Re={color:"painted",background:"painted",spanClassName:"painted",avatarUrl:"card-only"},we=Object.keys(Re),mt=we.filter(t=>Re[t]==="painted"),vt=new Set(["http","https","data","blob"]),St=/^([a-zA-Z][a-zA-Z0-9+.-]*):/;function Rt(t){let e=t.replace(/[\u0000-\u0020\u007f]/g,"");if(e.length===0)return;let n=St.exec(e);if(n)return !vt.has(n[1].toLowerCase())||/^data:/i.test(e)&&!/^data:image\/(?!svg)/i.test(e)?void 0:e;let o=r=>e[r]==="/"||e[r]==="\\";return o(0)&&o(1)?void 0:e}function wt(t){if(typeof t=="string")return t.length>0?{color:t}:null;if(t===null||typeof t!="object")return null;let e={},n=Object.prototype.hasOwnProperty;for(let o of we){if(!n.call(t,o))continue;let r=t[o];if(!(typeof r!="string"||r.length===0)){if(o==="avatarUrl"){let a=Rt(r);a!==void 0&&(e.avatarUrl=a);continue}e[o]=r;}}return Object.keys(e).length>0?e:null}function j(t){return `var(--doc-review-author-${t%L})`}function ke(t){let e=new Map;if(t===void 0||t==="kind"||t==="author")return e;for(let[n,o]of Object.entries(t.authors)){let r=wt(o);r&&e.set(n,r);}return e}function Un(t,e){let n=ke(e);return [...t].map(([o,r])=>{let a=n.get(o);return {author:o,slot:r,color:a?.color??j(r),...a?{style:a}:{}}})}var kt=128;function _(t,e,n=kt){let o=e.length<n?e.length:n,r=t;for(let a=0;a<o;a+=1)r=Math.imul(r^e.charCodeAt(a),16777619);return Math.imul(r^e.length,16777619)}function At(t,e,n){let o=_(2166136261,n);for(let r of t.keys())o=_(o,r);for(let[r,a]of e){o=_(o,r);for(let i of mt)o=_(o,a[i]??"",1/0);}return `${t.size}.${e.size}.${(o>>>0).toString(36)}`}function Ae(t){return t===null?"kind":t.key}var Y=new WeakMap;function Ee(t,e,n){if(t==="kind")return null;let o=Y.get(e);if(o&&o.option===t&&o.authorSlots===n)return o.context;let r=ke(t),a=t===void 0||t==="author"?"author":t.others??"author";if(r.size===0&&a==="kind")return Y.set(e,{option:t,authorSlots:n,context:null}),null;let i=n??Pt(e),s=new Map;for(let[d,c]of r){if(!c.spanClassName)continue;let y=c.spanClassName.split(/\s+/).filter(u=>u.length>0);y.length>0&&s.set(d,y);}let l={authorSlots:i,styles:r,classTokens:s,others:a,key:At(i,r,a)};return Y.set(e,{option:t,authorSlots:n,context:l}),l}var ve=new WeakMap;function Et(t){let e=ve.get(t);if(e)return e;let n=[],o=new Set,r=a=>{a===""||o.has(a)||(o.add(a),n.push(a));};for(let a of chunkJROG4U3Z_cjs.Aa(t)){for(let s of a.lines)for(let l of s.spans){let d=l.revisions;if(d!==void 0)for(let c=0;c<d.length;c+=1)r(d[c].author);for(let c of l.props){if(c.localName!=="rPrChange"&&c.localName!=="pPrChange")continue;let y=c.attributes?.author;r(y??"");break}}for(let s of a.lines){let l=s.drawings;if(l!==void 0)for(let d=0;d<l.length;d+=1){let c=l[d].revisions;if(c!==void 0)for(let y=0;y<c.length;y+=1)r(c[y].author);}}let i=a.markRevisions;if(i)for(let s=0;s<i.length;s+=1)r(i[s].author);}return ve.set(t,n),n}var Se=new WeakMap;function Pt(t){let e=Se.get(t);if(e)return e;let n=new Map,o=r=>{for(let a of Et(r))n.has(a)||n.set(a,n.size);};for(let r of t.pages){o(r.fragments),r.header&&o(r.header.fragments),r.footer&&o(r.footer.fragments);for(let a of [r.footnotes,r.endnotes])if(a){a.separator&&o(a.separator.fragments);for(let i of a.notes)o(i.fragments);}for(let a of [r.anchoredDrawings,r.header?.anchoredDrawings,r.footer?.anchoredDrawings])if(a)for(let i of a){let s=i.revisions;if(s!==void 0)for(let l=0;l<s.length;l+=1){let d=s[l].author;d!==""&&!n.has(d)&&n.set(d,n.size);}i.textboxStory&&o(i.textboxStory.fragments);}}return Se.set(t,n),n}function Lt(t,e){let n=null;for(let o of e)o===""||t.has(o)||(n===null&&(n=new Map(t)),n.has(o)||n.set(o,n.size));return n??t}function _n(){let t=new Map,e=0;return {resolve(n,o){let r=Lt(n,o);for(let a of r.keys())t.has(a)||(t.set(a,e),e+=1);return new Map([...r.keys()].map(a=>[a,t.get(a)]).sort((a,i)=>a[1]-i[1]))}}}function C(t,e,n){if(t===void 0||t.length===0)return null;let o=t[t.length-1],r=t.some(s=>s.kind==="delete"||s.kind==="moveFrom"),a=o.kind,i=a==="delete"||a==="moveFrom"?"line-through":a==="insert"||a==="moveTo"?"underline":null;return {attribution:o,line:r&&i==="underline"?"line-through":i,decorationStyle:a==="moveFrom"||a==="moveTo"?"double":"solid",color:r?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",authorColor:n?.get(o.author)?.color??j(e?.get(o.author)??0),deleted:r}}function Pe(t,e,n,o){let r=t.createElement("span"),a=e.spans[e.spans.length-1];r.className="docx-line-break-mark",r.dataset.docxMarker="",r.setAttribute("aria-hidden","true"),r.contentEditable="false",r.textContent="\u21B5",r.style.position="absolute",r.style.pointerEvents="none",r.style.userSelect="none",r.style.left=`${((a?a.box.x+a.box.width:e.contentX)-e.contentX)*n}px`,r.style.top=`${e.leading*n}px`,r.style.marginLeft=`${2*n}px`,r.style.fontSize=`${(a?.style.fontSizePt??e.box.height)*n}px`,r.style.lineHeight=`${Math.max(0,e.box.height-e.leading-(e.trailingSpacing??0))*n}px`,r.style.color="var(--doc-revision-format)";let i=C(a?.revisions,o?.authorSlots,o?.styles);if(i){let{attribution:s}=i,l=o?.styles.get(s.author),d=o&&(l?.color!==void 0||o.others==="author");if(r.style.color=d?i.authorColor:i.color,r.dataset.revisionKind=s.kind,r.dataset.revisionId=s.id,r.dataset.reviewAuthor=s.author,o){r.dataset.reviewAuthorSlot=String((o.authorSlots.get(s.author)??0)%L);for(let c of o.classTokens.get(s.author)??[])r.classList.add(c);}i.line&&(r.style.textDecorationLine=i.line,r.style.textDecorationStyle=i.decorationStyle,r.style.textDecorationColor=r.style.color);}return r}function Le(t,e,n,o){let r=chunkJROG4U3Z_cjs.xb(e);if(!r){let d=t.createElement("span");return d.className="docx-paragraph-mark",d.setAttribute("aria-hidden","true"),d.contentEditable="false",d.textContent="\xB6",d.style.position="absolute",d.style.pointerEvents="none",d.style.marginLeft=`${2*n}px`,d.style.color="var(--doc-revision-format)",d}let a=t.createElement("span");a.className=`docx-paragraph-mark docx-revision-pmark docx-revision-pmark-${r.kind}`,a.setAttribute("aria-hidden","true"),a.contentEditable="false",a.dataset.revisionKind=r.kind,a.dataset.revisionId=r.id,r.author!==""&&(a.dataset.reviewAuthor=r.author),a.dataset.revisionIds=e.map(d=>d.id).join(" "),a.dataset.revisionKinds=e.map(d=>d.kind).join(" "),a.textContent="\xB6",a.style.position="absolute",a.style.pointerEvents="none",a.style.marginLeft=`${2*n}px`;let i=chunkJROG4U3Z_cjs.yb(r),s=o?.styles.get(r.author),l=o?(o.authorSlots.get(r.author)??0)%L:0;if(o){a.dataset.reviewAuthorSlot=String(l);let d=o.classTokens.get(r.author);if(d)for(let c=0;c<d.length;c+=1)a.classList.add(d[c]);}return a.style.color=s?.color??(o?.others==="author"?j(l):i?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)"),i&&(a.style.textDecorationLine="line-through"),a}function Z(t,e,n=false){let o=n?null:chunkJROG4U3Z_cjs.Ab(e.props.filter(a=>a.localName==="pPrChange")),r=o??e.markFormatRevision;r&&($t(t,r,o?"pPrChange":"rPrChange"),t.dataset.paragraphId=e.paragraphId,t.dataset.reviewStart=String(e.range.start),t.dataset.reviewEnd=String(e.range.end));}function $t(t,e,n){t.dataset.revisionKind="format",t.dataset.revisionId=e.id,t.dataset.formattingKind=n,e.author&&(t.dataset.reviewAuthor=e.author),e.date!==void 0&&(t.dataset.revisionDate=e.date);}function $e(t,e,n,o,r,a){for(let i of [n.footnotes,n.endnotes])i&&e.append(Mt(t,n,i,o,r,a));}function Mt(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 l=n.separator.ruleStyle;if(l||n.separator.synthetic||n.separator.fragments.length===0)Tt(s,t,l??"single",o.scale);else for(let d of n.separator.fragments)s.append(d.kind==="table"?a(t,d,o):r(t,d,o));i.append(s);}for(let s of n.notes){let l=t.createElement("div");l.className="docx-note",l.dataset.docxNote=s.noteKind,l.dataset.docxNoteId=String(s.noteId),l.dataset.docxNoteScope=s.scopeId,s.mark!==null&&(l.dataset.docxNoteMark=s.mark),s.continuation&&(l.dataset.docxNoteContinuation=""),l.setAttribute("role","doc-footnote"),l.style.position="absolute",l.style.left=`${(s.box.x-n.box.x)*o.scale}px`,l.style.top=`${(s.box.y-n.box.y)*o.scale}px`,l.style.width=`${s.box.width*o.scale}px`,l.style.height=`${s.box.height*o.scale}px`;for(let d of s.fragments)l.append(d.kind==="table"?a(t,d,o):r(t,d,o));i.append(l);}return i}function Tt(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);}}function G(t,e,n){return !!n.activeHeaderFooterRId&&!!t.rId&&n.activeHeaderFooterRId===t.rId&&(n.activeHeaderFooterPageIndex===void 0||n.activeHeaderFooterPageIndex===e)}function J(t,e,n){return n?t.kind==="footer"?Math.max(t.box.height,e.box.y+e.box.height-t.box.y):Math.max(t.box.height,e.contentBox.y-t.box.y):t.box.height}function Me(t,e){for(let{record:n,element:o,materialized:r}of t){if(!r)continue;let a=o.querySelector(":scope > .docx-page-content");a&&(e.activeHeaderFooterRId?a.setAttribute("contenteditable","false"):a.removeAttribute("contenteditable"));for(let i of o.querySelectorAll(":scope > .docx-hf:not(.docx-hf--placeholder)")){let s=Dt(n,i);if(!s)continue;let l=G(s,n.index,e);Ht(i,n,s,l,e.scale);}for(let i of o.querySelectorAll(":scope > [data-docx-hf-front]")){let s=Te(n,i.dataset.docxHfFront);De(i,!!s&&G(s,n.index,e));}}}function Dt(t,e){return Te(t,e.dataset.docxHf)}function Te(t,e){if(e==="header")return t.header;if(e==="footer")return t.footer}function Ht(t,e,n,o,r){o?(t.dataset.docxHfActive="",t.setAttribute("contenteditable","true")):(delete t.dataset.docxHfActive,t.setAttribute("contenteditable","false")),t.style.height=`${J(n,e,o)*r}px`,De(t,o);}function De(t,e){let n=t.querySelectorAll(t instanceof Element&&t.classList.contains("docx-drawing-layer")?":scope > *":":scope > .docx-drawing-layer > *");for(let o of n){o.style.pointerEvents=e?"auto":"none";for(let r of o.querySelectorAll(".docx-drawing"))r.style.pointerEvents=e?"auto":"none";}}var Ct=0;function He(t,e,n,o){if(o===void 0||!Number.isFinite(o)||o<0||o>1)return;let r="http://www.w3.org/2000/svg",a=(y,u)=>{let h=t.createElementNS(r,y);for(let[p,f]of Object.entries(u))h.setAttribute(p,f);return h},i=`docx-bilevel-${++Ct}`,s=a("svg",{width:"0",height:"0","aria-hidden":"true"});s.style.position="absolute",s.style.pointerEvents="none";let l=a("filter",{id:i,"color-interpolation-filters":"sRGB"});l.append(a("feColorMatrix",{type:"saturate",values:"0"}));let d=a("feComponentTransfer",{}),c=Array.from({length:256},(y,u)=>u/255>=o?1:0).join(" ");for(let y of ["R","G","B"])d.append(a(`feFunc${y}`,{type:"discrete",tableValues:c}));l.append(d),s.append(l),e.append(s),n.style.filter=`${n.style.filter} url(#${i})`.trim();}var It=new Map([["image/svg+xml","SVG"],["image/tiff","TIFF"],["image/x-emf","EMF"],["image/x-wmf","WMF"]]),Ft="Unknown",W=new WeakMap,ee=new WeakMap,Bt=256;function Fe(t,e){let n=W.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 l;try{l=e.create(a,i);}catch(d){if(d instanceof Error&&d.message.startsWith("PaintImageUrlSource:"))return null;throw d}return o.set(a.resourceKey,l),l},imageFor(a,i,s){let l=r.get(a);if(l&&l.resourceKey===i)return l.element;let d=s.createElement("img");return r.size<Bt&&r.set(a,{element:d,resourceKey:i,...l?.readyElement?{readyElement:l.readyElement}:{}}),d},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,l]of o)a.has(s)||(e.revoke(l),o.delete(s));for(let[s,l]of r)i.has(s)||(l.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();}}),W.set(t,n),n}function te(t,e){return `${e.paintInstance??""}|${t.drawingNodeId}`}function ro(t){W.get(t)?.revokeAll(),W.delete(t);}function w(t){return Number.isFinite(t)?String(t):"0"}function Be(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(`${w(r)}% ${w(a)}%`);}return `polygon(${n.join(", ")})`}function Ne(t){let e=t.geometry.contentBounds;return chunkJROG4U3Z_cjs.tc({transform:t.transform,contentWidth:e.width,contentHeight:e.height})}function Oe(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(${w(Math.max(0,o))})`);}if(e.contrast!==0&&Number.isFinite(e.contrast)){let o=1+e.contrast/100;Number.isFinite(o)&&n.push(`contrast(${w(Math.max(0,o))})`);}return n.length>0?n.join(" "):void 0}function Ke(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),l=Math.max(1e-4,1-r-i);return Object.freeze({width:`${w(1/s*100)}%`,height:`${w(1/l*100)}%`,left:`${w(-o/s*100)}%`,top:`${w(-r/l*100)}%`})}function Nt(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(It.get(n.mime)??Ft);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 O(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 Ot(t,e,n,o,r){let a=t.paintBounds,i=t.geometry.contentBounds,s=Ke(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,Be(t.geometry.clipPolygon??[],a)??"",Oe(t)??"",t.effects.bilevel??"",Ne(t)??"",s.width,s.height,s.left,s.top,n.inertLinks?"":t.hyperlinkHref??"",t.accessibility.label??""].join("|")}function N(t,e,n,o){let r=t.createElement("div");r.className="docx-drawing docx-drawing-placeholder",r.dataset.drawingNodeId=e.drawingNodeId,O(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=Nt(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 Kt(t,e,n,o,r,a){let i=e.resource;if(i.kind!=="ready")return N(t,e,n,a);let s=te(e,n),l=r?.readyElementFor?.(s)??t.createElement("div"),d=Ot(e,i,n,o,a);if(ee.get(l)===d)return l;l.className="docx-drawing docx-drawing-ready",l.style.cssText="",l.dataset.drawingNodeId=e.drawingNodeId,delete l.dataset.docxDrawingLink,delete l.dataset.docxDrawingLinkKind,delete l.dataset.docxDrawingLinkHref,l.removeAttribute("aria-hidden"),l.removeAttribute("aria-label"),l.removeAttribute("role"),l.removeAttribute("tabindex"),O(l,e.paintBounds,n.scale,a);let c=Be(e.geometry.clipPolygon??[],e.paintBounds);c&&(l.style.clipPath=c);let y=t.createElement("div");y.className="docx-drawing-image-frame",y.style.position="absolute";let u=e.geometry.contentBounds,h=e.paintBounds;y.style.left=`${(u.x-h.x)*n.scale}px`,y.style.top=`${(u.y-h.y)*n.scale}px`,y.style.width=`${u.width*n.scale}px`,y.style.height=`${u.height*n.scale}px`;let p=Oe(e);p&&(y.style.filter=p);let f=t.createElement("div");f.className="docx-drawing-transform-stage",f.style.position="relative",f.style.width="100%",f.style.height="100%";let k=Ne(e);k&&(f.style.transform=k,f.style.transformOrigin="0 0");let R=t.createElement("div");R.className="docx-drawing-crop-viewport",R.style.position="relative",R.style.width="100%",R.style.height="100%",R.style.overflow="hidden";let S=r?.imageFor?.(s,i.resourceKey,t)??t.createElement("img");S.className="docx-drawing-image",S.setAttribute("draggable","false"),S.getAttribute("src")!==o&&S.setAttribute("src",o),S.setAttribute("alt","");let P=Ke(e);return S.style.position="absolute",S.style.width=P.width,S.style.height=P.height,S.style.left=P.left,S.style.top=P.top,S.style.maxWidth="none",S.style.maxHeight="none",R.append(S),f.append(R),y.append(f),l.replaceChildren(y),He(t,l,y,e.effects.bilevel),e.hyperlinkHref&&!n.inertLinks?(l.dataset.docxDrawingLink=e.drawingNodeId,l.dataset.docxDrawingLinkKind="external",l.dataset.docxDrawingLinkHref=e.hyperlinkHref,l.setAttribute("tabindex","-1"),D(l,e,true)):D(l,e,false),r?.rememberReadyElement?.(s,l),ee.set(l,d),l}var Q="http://www.w3.org/2000/svg";function zt(t,e,n,o){let r=e.vectorShape,a=t.createElement("div");a.className="docx-drawing docx-drawing-shape",a.dataset.drawingNodeId=e.drawingNodeId,O(a,e.paintBounds,n.scale,o);let i=e.geometry.contentBounds,s=e.paintBounds,l=t.createElement("div");l.className="docx-drawing-image-frame",l.style.position="absolute",l.style.left=`${(i.x-s.x)*n.scale}px`,l.style.top=`${(i.y-s.y)*n.scale}px`,l.style.width=`${i.width*n.scale}px`,l.style.height=`${i.height*n.scale}px`;let d=t.createElementNS(Q,"svg");d.setAttribute("viewBox",`0 0 ${w(Math.max(1,r.extentEmu.cx))} ${w(Math.max(1,r.extentEmu.cy))}`),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.style.display="block",d.style.overflow="visible";for(let c of r.components){let y=t.createElementNS(Q,"path"),u=c.subpathsEmu.map((h,p)=>`M${h.map(f=>`${w(f.x)} ${w(f.y)}`).join("L")}${c.subpathsClosed?.[p]===false?"":"Z"}`).join("");if(y.setAttribute("d",u),y.setAttribute("fill",c.fillHex!==null?`#${c.fillHex}`:"none"),y.setAttribute("fill-rule","evenodd"),c.fillAlpha<1&&y.setAttribute("fill-opacity",w(Math.max(0,c.fillAlpha))),c.strokeHex!==null&&(y.setAttribute("stroke",`#${c.strokeHex}`),y.setAttribute("stroke-width",w(Math.max(1,c.strokeWidthEmu))),c.strokeAlpha<1&&y.setAttribute("stroke-opacity",w(Math.max(0,c.strokeAlpha)))),d.append(y),c.strokeHex!==null)for(let h of c.arrowheadsEmu??[]){let p=t.createElementNS(Q,"path");p.setAttribute("d",`M${h.map(f=>`${w(f.x)} ${w(f.y)}`).join("L")}Z`),p.setAttribute("fill",`#${c.strokeHex}`),p.setAttribute("fill-opacity",w(Math.max(0,Math.min(1,c.strokeAlpha)))),p.setAttribute("data-docx-line-end","triangle"),d.append(p);}}return l.append(d),a.append(l),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 Ut(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"),O(i,e.paintBounds,o.scale,r),i.style.overflow="hidden";let s=(e.x-e.paintBounds.x)*a,l=(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=`${l}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 d=t.createElement("div");d.className="docx-drawing-textbox-content",d.style.position="absolute",d.style.left=`${s+n.contentOffset.x*a}px`,d.style.top=`${l+n.contentOffset.y*a}px`,d.style.width=`${n.contentWidth*a}px`,d.style.height=`${Math.max(0,n.contentHeight)*a}px`,d.style.overflow="hidden";for(let c of n.fragments)d.append(o.paintStoryFragment(t,c));for(let c of d.querySelectorAll("[data-paragraph-id]"))delete c.dataset.paragraphId;return i.append(d),D(i,e,false),i}function _t(t,e,n){let o=n.revisionStyles,r=C(e.revisions,o?.authorSlots,o?.styles);if(!r){if(t.dataset.revisionKind===void 0)return;t.classList.remove("docx-drawing--revision","docx-drawing--revision-insertion","docx-drawing--revision-deletion"),delete t.dataset.revisionKind,delete t.dataset.revisionId,delete t.dataset.reviewAuthor,delete t.dataset.revisionDate,delete t.dataset.reviewAuthorSlot,t.style.outlineColor="";return}let{attribution:a}=r;t.classList.add("docx-drawing--revision",r.deleted?"docx-drawing--revision-deletion":"docx-drawing--revision-insertion"),t.classList.remove(r.deleted?"docx-drawing--revision-insertion":"docx-drawing--revision-deletion"),t.dataset.revisionKind=a.kind,t.dataset.revisionId=a.id,a.author!==""?t.dataset.reviewAuthor=a.author:delete t.dataset.reviewAuthor,a.date!==void 0?t.dataset.revisionDate=a.date:delete t.dataset.revisionDate;let i=o?.styles.get(a.author),s=o!==void 0&&(i?.color!==void 0||o.others==="author");o?t.dataset.reviewAuthorSlot=String((o.authorSlots.get(a.author)??0)%L):delete t.dataset.reviewAuthorSlot,t.style.outlineColor=s?r.authorColor:"";}function ze(t,e,n,o,r){let a=jt(t,e,n,o,r);return a&&_t(a,e,n),a}function jt(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 Ut(t,e,e.textboxStory,n,r);if(e.vectorShape&&e.vectorShape.subpathsEmu.length>0)return zt(t,e,n,r);let{resource:a}=e;if(a.kind==="ready"){if(!n.imageUrlPort||!o)return N(t,e,n,r);let i=o.urlForReady(a.validatedHandle,a.mime);return i?Kt(t,e,n,i,o,r):N(t,e,n,r)}if(a.kind==="pending"){let i=o?.readyElementFor?.(te(e,n))??o?.imageForPending?.(te(e,n))?.closest(".docx-drawing-ready");return i?(ee.delete(i),i.dataset.drawingNodeId=e.drawingNodeId,O(i,e.paintBounds,n.scale,r),i):N(t,e,n,r)}return N(t,e,n,r)}function Ue(t,e,n,o,r){let a=[];for(let i of e.drawings??[]){let s=ze(t,i,n,o,r);s&&a.push(s);}return Object.freeze(a)}function _e(t,e,n,o,r,a){let i=[];for(let s of e){if(chunkJROG4U3Z_cjs.uc(s)!==n)continue;let l=ze(t,s,o,r,a);l&&(l.dataset.drawingLayer=n,i.push(l));}return Object.freeze(i)}function Gt(t,e){chunkJROG4U3Z_cjs.Da(t,({host:n})=>chunkJROG4U3Z_cjs.Fa(n,e));}var Ce=new WeakMap;function Wt(t){let e=Ce.get(t);if(e)return e;let n=[],o=[];Gt(t,a=>{a.resource.kind==="ready"&&n.push(a.resource.resourceKey),o.push(`p${t.index}|${a.drawingNodeId}`);});let r=Object.freeze({resourceKeys:Object.freeze(n),elementKeys:Object.freeze(o)});return Ce.set(t,r),r}var Ie=new WeakMap;function je(t){let e=Ie.get(t);if(e)return e;let n=new Set,o=new Set;for(let a of t.pages){let i=Wt(a);for(let s of i.resourceKeys)n.add(s);for(let s of i.elementKeys)o.add(s);}let r=Object.freeze({resourceKeys:n,elementKeys:o});return Ie.set(t,r),r}function Ge(t){return je(t).resourceKeys}function We(t){return je(t).elementKeys}function Ve(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 ne=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 ao(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")})}function Vt(t,e,n){t.style.position="absolute",t.style.left=`${e.x*n}px`,t.style.top=`${e.y*n}px`,t.style.width=`${e.width*n}px`,t.style.height=`${e.height*n}px`;}function qe(t,e,n,o){let r=t.createElement("span");return r.className=e,r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.display="block",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.style.backgroundColor="currentColor",r.style.pointerEvents="none",r}function E(t,e,n,o,r=0,a=0,i=[]){let s=r+n.box.x,l=a+n.box.y,d=[...i,n.kind];switch(n.kind){case "text":case "fallback":{let c=t.createElement("span");c.className=["docx-equation-node",...d.map(y=>`docx-equation-${y}`)].join(" "),Vt(c,{x:s,y:l,width:n.box.width,height:n.box.height},o),c.textContent=n.text,c.style.display="block",c.style.fontSize=`${n.fontSizePt*o}px`,c.style.lineHeight=`${n.box.height*o}px`,c.style.whiteSpace="pre",e.append(c);break}case "row":for(let c of n.items)E(t,e,c,o,s,l,d);break;case "fraction":E(t,e,n.numerator,o,s,l,d),e.append(qe(t,"docx-equation-fraction-bar",{...n.bar,x:s+n.bar.x,y:l+n.bar.y},o)),E(t,e,n.denominator,o,s,l,d);break;case "radical":E(t,e,n.sign,o,s,l,d),n.degree&&E(t,e,n.degree,o,s,l,d),e.append(qe(t,"docx-equation-radical-bar",{...n.bar,x:s+n.bar.x,y:l+n.bar.y},o)),E(t,e,n.radicand,o,s,l,d);break;case "script":E(t,e,n.base,o,s,l,d),n.subscript&&E(t,e,n.subscript,o,s,l,d),n.superscript&&E(t,e,n.superscript,o,s,l,d);break;case "nary":E(t,e,n.operator,o,s,l,d),n.lowerLimit&&E(t,e,n.lowerLimit,o,s,l,d),n.upperLimit&&E(t,e,n.upperLimit,o,s,l,d),E(t,e,n.body,o,s,l,d);break}}function Xe(t,e,n,o){let r=n.geometry;e.className="layout-run docx-equation",e.dataset.docxEquation=n.sourceNodeId,e.setAttribute("contenteditable","false"),e.setAttribute("role","math"),n.fallbackText&&e.setAttribute("aria-label",n.fallbackText),e.style.position="relative",e.style.display="inline-block",e.style.width=`${r.box.width*o}px`,e.style.height=`${r.box.height*o}px`,e.style.lineHeight="0",e.style.pointerEvents="auto",e.style.userSelect="none",e.style.verticalAlign=`${-(r.box.height-r.baseline)*o}px`;let a=t.createDocumentFragment();E(t,a,r,o),e.append(a);}function Ye(t,e,n,o){let r=n.lineEndWhitespace===true;if((n.style.horizontalScalePercent!==100||n.text===" "||r)&&(e.style.width=`${n.box.width*o}px`),!r||(e.style.clipPath="inset(-1em 0)",n.style.horizontalScalePercent===100))return e;let a=t.createElement("span");return a.dataset.docxClippedFill="",a.style.display="inline-block",a.style.transform=e.style.transform,a.style.transformOrigin=e.style.transformOrigin,a.style.textDecorationLine=e.style.textDecorationLine,a.style.textDecorationStyle=e.style.textDecorationStyle,a.style.textDecorationColor=e.style.textDecorationColor,a.style.textDecorationThickness=e.style.textDecorationThickness,e.style.removeProperty("transform"),e.style.removeProperty("transform-origin"),e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration-style"),e.style.removeProperty("text-decoration-color"),e.style.removeProperty("text-decoration-thickness"),e.append(a),a}function Ze(t,e,n){let o=e.textOutline;if(!o||!Number.isFinite(n)||n<=0||!Number.isFinite(o.widthPt)||o.widthPt<=0||o.widthPt>1584||!/^[0-9a-f]{6}$/i.test(o.color))return;let r=o.widthPt*n;Number.isFinite(r)&&(t.setProperty("-webkit-text-stroke-width",`${r}px`),t.setProperty("-webkit-text-stroke-color",`#${o.color}`));}var qt=/^[0-9A-Fa-f]{6}$/;function Xt(t){switch(t){case "dashed":return "dashed";case "dotted":return "dotted";case "double":case "triple":return "solid";default:return "solid"}}function Je(t){return t&&qt.test(t)?t:"000000"}function oe(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 V(t,e,n,o){if(!n)return;let r=`#${Je(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`]=Xt(n.style);}function re(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=`#${Je(n.color)}`,n.cssStyle!=="solid"&&(a.dataset.cssStyle=n.cssStyle),e.append(a);}function Yt(t){let e=new Set;for(let n of t)e.add(`${n.side}\0${n.role}`);return e}function Zt(t,e,n,o){let r=Yt(n),a=u=>r.has(`${u}\0middle`),i=oe(t,"docx-table-border-double"),s=oe(t,"docx-table-border-triple"),l=oe(t,"docx-table-border-edge"),d=false,c=false,y=false;for(let u of n){if(u.role==="edge"){y=true,re(t,l,u,o,"docx-table-border-edge-stroke");continue}if(a(u.side)){c=true,re(t,s,u,o,"docx-table-border-triple-stroke");continue}(u.role==="outer"||u.role==="inner")&&(d=true,re(t,i,u,o,"docx-table-border-double-stroke"));}d&&e.append(i),c&&e.append(s),y&&e.append(l);}function Qe(t,e,n,o){V(e,"Top",n?.top,o),V(e,"Right",n?.right,o),V(e,"Bottom",n?.bottom,o),V(e,"Left",n?.left,o),n?.strokes&&n.strokes.length>0&&Zt(t,e,n.strokes,o);}function et(t,e,n,o){if(e.textDirection!=="btLr")return o;let r=t.createElement("div");return r.className="docx-table-cell-content-btlr",r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width=`${e.box.height*n}px`,r.style.height=`${e.box.width*n}px`,r.style.transformOrigin="0 0",r.style.transform=`translateY(${e.box.height*n}px) rotate(-90deg)`,o.append(r),r}var ae="when-selected",tt=new WeakMap,nt=0;function Jt(t){let e=tt.get(t);return e||(nt+=1,e=`alias${nt}`,tt.set(t,e)),e}function yt(t){return {...t,drawingStrings:t.drawingStrings??ne,urlRegistry:t.urlRegistry??null}}function Qt(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}:{},...t.revisionStyles?{revisionStyles:t.revisionStyles}:{},paintStoryFragment:(n,o)=>o.kind==="table"?F(n,o,e):I(n,o,e)})}function ut(t){return Object.freeze({ctx:Qt(t),urlRegistry:t.urlRegistry})}function ot(t,e,n,o,r,a){X(t,e,chunkJROG4U3Z_cjs.Ca(n),o,r,a);}function X(t,e,n,o,r,a,i=true,s){if(n.length===0)return;let l=ut(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",s&&(d.dataset.docxHfFront=s);for(let c of _e(t,n,a,l.ctx,l.urlRegistry,r)){if(c.style.pointerEvents=i?"auto":"none",!i)for(let y of c.querySelectorAll(".docx-drawing"))y.style.pointerEvents="none";d.append(c);}d.childElementCount>0&&e.append(d);}function pt(t){return t.horizontalFrame==="page"||t.verticalFrame==="page"}function ht(t,e,n){let o=e.paintBounds,r=chunkJROG4U3Z_cjs.ya(e,t.box,n),a=r.x-e.x,i=r.y-e.y,s=l=>Object.freeze({x:l.x+a,y:l.y+i,width:l.width,height:l.height});return Object.freeze({...e,x:e.x+a,y:e.y+i,paintBounds:s(o),hitBounds:s(e.hitBounds),geometry:Object.freeze({...e.geometry,contentBounds:s(e.geometry.contentBounds),paintBounds:s(e.geometry.paintBounds),...e.geometry.clipPolygon?{clipPolygon:Object.freeze(e.geometry.clipPolygon.map(l=>Object.freeze({x:l.x+a,y:l.y+i})))}:{}})})}function en(t,e,n,o,r,a){let i=o.map(l=>ht(n,l,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",X(t,s,i,r,a,"behind",false),s.childElementCount>0&&e.append(s);}function tn(t,e,n,o,r,a,i,s=false){let l=o.filter(pt).map(d=>ht(n,d,a));X(t,e,l,r,a,i,s,n.kind);}var B=/^[0-9A-Fa-f]{6}$/,rt=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,nn=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"})),on=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 rn(t){return t.doubleStrike?"double":t.strike?"single":"none"}function an(t){return t==="thick"||t.endsWith("Heavy")}function ft(t){if(!t.underline)return null;let e=t.underline.color&&B.test(t.underline.color)?t.underline.color:null;return {cssStyle:nn.get(t.underline.variant)??"solid",color:e,heavy:an(t.underline.variant)}}function gt(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 at(t,e,n){e!=="none"&&gt(t,"line-through",e==="double"?"double":"solid",{scale:n});}function it(t,e,n){gt(t,"underline",e.cssStyle,{color:e.color,heavy:e.heavy,scale:n});}function sn(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 q(t,e,n){let o=t.style,r=n.scale;Ze(o,e,r);let 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&&rt.test(e.fontFamily)?e.fontFamily:n.defaultFontFamily&&rt.test(n.defaultFontFamily)?n.defaultFontFamily:null;if(i){let d=n.fontAlias?.(i);o.fontFamily=d?`"${d}", "${i}", ${chunkJROG4U3Z_cjs.He}`:`"${i}", ${chunkJROG4U3Z_cjs.He}`;}e.color&&B.test(e.color)&&(o.color=`#${e.color}`);let s=e.highlight?on.get(e.highlight):void 0;s?(o.backgroundColor=s,t.dataset.highlight=e.highlight??""):e.shading&&B.test(e.shading)&&(o.backgroundColor=`#${e.shading}`),e.caps&&(o.textTransform="uppercase"),e.smallCaps&&(o.fontVariant="small-caps");let l=chunkJROG4U3Z_cjs.V(e);l!==0&&(o.position="relative",o.top=`${-l*r}px`),e.characterSpacingPt!==0&&(o.letterSpacing=`${e.characterSpacingPt*r}px`),e.horizontalScalePercent!==100&&(o.transformOrigin="left",o.transform=`scaleX(${e.horizontalScalePercent/100})`);}function xt(t,e,n,o,r){let a=n===" "?null:ft(o),i=rn(o),s=e;if(a&&i!=="none"){let l=t.createElement("span");l.dataset.docxDeco="underline",it(l.style,a,r);let d=t.createElement("span");d.dataset.docxDeco="strike",at(d.style,i,r),l.append(d),e.append(l),s=d;}else a?it(e.style,a,r):i!=="none"&&at(e.style,i,r);s.textContent=n;}function M(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 ln(t,e,n){let o=e.fieldAtom;!o||(t.dataset.fieldAtom=o.formField?"form":"field",!(o.formField?n.shadeFormFields!==false:(n.fieldShading??ae)!=="never"))||(t.classList.add("docx-field-atom"),(o.formField||(n.fieldShading??ae)==="always")&&t.classList.add("docx-field-atom--shaded"));}function st(t,e,n){let o=chunkJROG4U3Z_cjs.Ab(e.props),r=n.revisionStyles,a=C(e.revisions,r?.authorSlots,r?.styles);if(!(!a&&!o)){if(a){let{attribution:i}=a;t.classList.add("docx-revision",`docx-revision-${i.kind}`),t.dataset.revisionKind=i.kind,t.dataset.revisionId=i.id,i.author!==""&&(t.dataset.reviewAuthor=i.author),i.date!==void 0&&(t.dataset.revisionDate=i.date);let s=r?.styles.get(i.author);if(r){t.dataset.reviewAuthorSlot=String((r.authorSlots.get(i.author)??0)%L);let c=r.classTokens.get(i.author);if(c)for(let y=0;y<c.length;y+=1)t.classList.add(c[y]);}let d=r!==void 0&&(s?.color!==void 0||r.others==="author")?a.authorColor:a.color;t.style.color=d,t.style.backgroundColor=s?.background??(a.deleted?"var(--doc-revision-deletion-wash)":"var(--doc-revision-insertion-wash)"),a.line&&(t.style.textDecorationLine=a.line,i.kind==="insert"&&a.line==="underline"?(t.style.textDecorationStyle="var(--doc-revision-insertion-decoration-style)",t.style.textDecorationThickness="var(--doc-revision-insertion-decoration-thickness)",t.style.textUnderlineOffset="var(--doc-revision-insertion-underline-offset)"):t.style.textDecorationStyle=a.decorationStyle,t.style.textDecorationColor=d);return}if(t.classList.add("docx-revision","docx-revision-format"),t.dataset.revisionKind="format",t.dataset.formattingKind="rPrChange",t.dataset.revisionId=o.id,o.author!==""&&(t.dataset.reviewAuthor=o.author),o.date!==void 0&&(t.dataset.revisionDate=o.date),r){let i=r.styles.get(o.author);t.dataset.reviewAuthorSlot=String((r.authorSlots.get(o.author)??0)%L);let s=r.classTokens.get(o.author);if(s)for(let l=0;l<s.length;l+=1)t.classList.add(s[l]);i?.color!==void 0&&(t.style.color=i.color),i?.background!==void 0&&(t.style.backgroundColor=i.background);}}}function dn(t,e,n){let o=[],r=e.lines[e.lines.length-1];for(let i of e.lines){let s=[...i.spans.flatMap(u=>u.revisions??[]),...(i.drawings??[]).flatMap(u=>u.revisions??[]),...i.anchorRevisions??[],...i===r?e.markRevisions??[]:[]];if(s.length===0)continue;let l=s.some(u=>u.kind==="delete"||u.kind==="moveFrom"),d=i.box.y-e.box.y,c=d+i.box.height,y=o[o.length-1];if(y&&y.deleted===l&&d<=y.bottom+.5){y.bottom=Math.max(y.bottom,c);continue}o.push({top:d,bottom:c,deleted:l});}if(o.length===0)return null;let a=t.createElement("div");a.className="docx-change-bars",a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.inset="0",a.style.pointerEvents="none";for(let i of o){let s=t.createElement("div");s.className=`docx-change-bar docx-change-bar-${i.deleted?"deletion":"insertion"}`,s.style.position="absolute",s.style.top=`${i.top*n}px`,s.style.height=`${(i.bottom-i.top)*n}px`,s.style.left=`${(-e.box.x-cn)*n}px`,s.style.width=`${yn*n}px`,s.style.pointerEvents="none",s.style.backgroundColor=i.deleted?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",a.append(s);}return a}var cn=7.5,yn=1.5;function un(t,e,n,o,r){let a=t.createElement("span"),i=chunkJROG4U3Z_cjs.ga(e.style,e.fontSlot);if(e.equation)return a.dataset.paragraphId=e.range.paragraphId,a.dataset.start=String(e.range.start),a.dataset.end=String(e.range.end),q(a,i,n),Xe(t,a,e.equation,n.scale),st(a,e,n),a;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"),q(a,i,n),ln(a,e,n),st(a,e,n);let s=Ye(t,a,e,n.scale);if(e.text===" "){a.style.overflow="hidden",a.style.verticalAlign="top";let l=ft(e.style);l&&e.tabLeader!=="underscore"&&(a.dataset.docxTabUnderline="",sn(a.style,l,n.scale));}return xt(t,s,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 lt(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 pn(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=e.leading??0,i=Math.min(Math.max(a,...e.spans.map(v=>v.box.height+a),e.spans.length===0?e.box.height-(e.trailingSpacing??0):0),e.box.height),s=Math.max(0,e.box.height-i);r.style.boxSizing="border-box",r.style.paddingBottom=`${s*o}px`,r.style.lineHeight=`${(e.box.height-s)*o}px`;let l=null,d=null,c=null,y=new Map;for(let[v,b]of chunkJROG4U3Z_cjs.Oa(e).entries())y.set(b.paragraphId,v);let u=v=>y.get(v)??0,h=[...e.drawings??[]].sort((v,b)=>u(v.paragraphId)-u(b.paragraphId)||v.start-b.start),p=0,f=(v,b)=>{for(;p<h.length&&(u(h[p].paragraphId)<u(v)||u(h[p].paragraphId)===u(v)&&h[p].start<b);){let x=h[p],g=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=`${g*o}px`,m.style.height=`${x.baselineOffset*o}px`,m.style.lineHeight="0",m.style.pointerEvents="none",m.style.verticalAlign="baseline",r.append(m),p+=1,l=null,d=null;}},k=v=>{let b=v.wrapAdvanceBefore??0;if(b<=.001)return;let x=t.createElement("span");x.className="docx-wrap-advance",x.dataset.docxMarker="",x.setAttribute("contenteditable","false"),x.setAttribute("aria-hidden","true"),x.style.display="inline-block",x.style.width=`${b*o}px`,x.style.height="0",x.style.lineHeight="0",x.style.pointerEvents="none",x.style.verticalAlign="baseline",r.append(x),l=null,d=null;},R=0,S=false;for(let[v,b]of e.spans.entries()){f(b.range.paragraphId,b.range.start),k(b);let x=Math.min(b.box.height+a,e.box.height),g=un(t,b,n,x,a);R>0&&!S&&(g.style.marginLeft=`${R*o}px`);let m=e.spans[v+1],T=hn(e,v+1,u);S=T>0&&m!==void 0&&gn(b,m),S&&(g.style.wordSpacing=`${T*o}px`),R=T;let A=b.link;if(!A){l=null,d=null,c=null,r.append(g);continue}if(b.fieldAtom){l!==null&&d===A.id&&c===b.range.start||(l=lt(t,A,n),d=A.id,c=b.range.start,r.append(l)),l.append(g);continue}(!l||d!==A.id||c!==null)&&(l=lt(t,A,n),d=A.id,c=null,r.append(l)),l.append(g);}if(f(chunkJROG4U3Z_cjs.Oa(e)[chunkJROG4U3Z_cjs.Oa(e).length-1]?.paragraphId??e.range.paragraphId,Number.POSITIVE_INFINITY),e.spans.length===0){let v=t.createElement("br");v.style.lineHeight=`${e.box.height*o}px`,r.append(v);}let P=Object.freeze({x:e.contentX,y:e.box.y,width:e.box.width,height:e.box.height});n.showParagraphMarks&&e.manualBreakAfter&&r.append(Pe(t,e,o,n.revisionStyles));let $=ut(yt(n));if(e.drawings&&e.drawings.length>0)for(let v of Ue(t,e,$.ctx,$.urlRegistry,P))r.append(v);return r}function hn(t,e,n){if(e<=0||e>=t.spans.length)return 0;let o=t.spans[e-1],r=t.spans[e],a=n(o.range.paragraphId),i=n(r.range.paragraphId);if(t.drawings?.some(d=>{let c=n(d.paragraphId),y=c>a||c===a&&d.start>=o.range.start,u=c<i||c===i&&d.start<r.range.start;return y&&u}))return 0;let l=r.box.x-(o.box.x+o.box.width)-(r.wrapAdvanceBefore??0);return l>.001?l:0}var fn=/[\t\n\r \u00A0\u1361\u{10100}-\u{10102}\u{1039F}\u{1091F}]/u;function gn(t,e){return !t.text.endsWith(" ")||t.style.horizontalScalePercent!==100||!xn(t,e)||(e.wrapAdvanceBefore??0)>.001?false:!fn.test(t.text.slice(0,-1))}function xn(t,e){return !t.link&&!e.link?true:!t.link||!e.link||t.link.id!==e.link.id||!!t.fieldAtom!=!!e.fieldAtom?false:!t.fieldAtom||t.range.start===e.range.start}function I(t,e,n){let o=n.scale,r=M(t,"div",e.box,o);r.className="docx-paragraph-fragment layout-paragraph",e.clipToBox&&(r.style.overflow="hidden"),r.dataset.paragraphId=e.paragraphId,r.dataset.fragmentIndex=String(e.fragmentIndex),Z(r,e),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&&B.test(e.shading)&&e.shadingBox&&r.append(Sn(t,e,o)),e.marker&&r.append(bn(t,e,n));for(let i of e.lines)for(let s of i.spans){if(!s.tabLeader)continue;let l=vn(t,e,i,s,n);l&&r.append(l);}let a=dn(t,e,o);if(a&&r.append(a),n.showParagraphMarks&&e.paragraphEnd||e.markRevisions&&e.markRevisions.length>0){let i=Le(t,e.markRevisions??[],o,n.revisionStyles),s=e.lines[e.lines.length-1];if(s){let l=s.spans[s.spans.length-1];i.style.top=`${(s.box.y-e.box.y)*o}px`,i.style.left=`${((l?l.box.x+l.box.width:s.contentX)-e.box.x)*o}px`,r.append(i);}}for(let i of e.lines){let s=pn(t,i,n);e.markFormatRevision&&i===e.lines[e.lines.length-1]&&Z(s,e,true),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(dt(t,e,i,o));else e.bottomBorder&&r.append(dt(t,e,{side:"bottom",edge:e.bottomBorder.edge,box:e.bottomBorder.box},o));return r}function bn(t,e,n){let o=e.marker,r=n.scale,a=e.lines[0]?.leading??0,i=M(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],l=s?Math.max(a,...s.spans.map(u=>u.box.height+a),s.spans.length===0?s.box.height-(s.trailingSpacing??0):0):o.box.height,d=Math.min(l,o.box.height),c=Math.max(0,o.box.height-d);i.style.fontSize="0",i.style.boxSizing="border-box",i.style.paddingBottom=`${c*r}px`,i.style.lineHeight=`${d*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=`${d*r}px`,y.style.paddingTop=`${a*r}px`,y.style.lineHeight=`${(d-a)*r}px`,q(y,o.style,n),xt(t,y,o.text,o.style,r),i.append(y),i}var mn=512;function vn(t,e,n,o,r){let a=o.tabLeader?chunkJROG4U3Z_cjs.Pb.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",o.tabLeader==="underscore"&&(s.style.zIndex="1"),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 l=n.leading??0,d=Math.min(o.box.height+l,n.box.height),c=Math.max(0,n.box.height-d);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",q(y,o.style,r),y.style.boxSizing="border-box",y.style.height=`${d*i}px`,y.style.paddingTop=`${l*i}px`,y.style.lineHeight=`${(d-l)*i}px`,o.tabLeader==="heavy"&&(y.style.fontWeight="bold");let u=o.tabLeaderAdvancePt&&o.tabLeaderAdvancePt>0?o.tabLeaderAdvancePt:Math.max(.5,o.style.fontSizePt*.2),h=Math.min(mn,Math.max(1,Math.floor(o.box.width/u)+2));return y.textContent=a.repeat(h),y.style.letterSpacing="0",s.append(y),s}function Sn(t,e,n){let o=e.shadingBox,r=M(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 dt(t,e,n,o){let r=M(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",l=(s?n.box.width:n.box.height)*o,c=Rn(n.edge.val)?l:Math.max(1,l);r.style.left=`${n.side==="right"?a-(c-l):a}px`,r.style.top=`${n.side==="bottom"?i-(c-l):i}px`,s?r.style.width=`${c}px`:r.style.height=`${c}px`;let y=n.edge.color&&B.test(n.edge.color)?n.edge.color:"000000";return r.style.backgroundColor=`#${y}`,wn(r,n.edge.val,y,s,c,o),r}function Rn(t){return t==="double"||t==="triple"||t==="doubleWave"||t.startsWith("thinThick")||t.startsWith("thickThin")}function wn(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 kn(t,e,n,o){let r=o.scale,a=M(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",Qe(t,a,e.borders,r),e.shading&&B.test(e.shading)&&(a.style.backgroundColor=`#${e.shading}`);let i=et(t,e,r,a);for(let s of e.blocks){let l=s.kind==="table"?F(t,s,o):I(t,s,o);l.style.left=`${(s.box.x-e.box.x)*r}px`,l.style.top=`${(s.box.y-e.box.y)*r}px`,i.append(l);}return a}function F(t,e,n){let o=n.scale,r=M(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=M(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.reviewAuthor=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(kn(t,s,a.box,n));r.append(i);}return r}function An(t,e,n,o,r){let a={...n,paintInstance:`p${e.index}`},i=M(t,"div",e.box,a.scale);if(i.className="docx-page",i.style.fontFamily=chunkJROG4U3Z_cjs.He,i.dataset.pageIndex=String(e.index),a.ariaHidden&&(i.setAttribute("aria-hidden","true"),i.setAttribute("role","presentation")),i.dataset.materialized=String(o),!o)return i;let s=Object.freeze({x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height}),l=Object.freeze({x:-(e.contentBox.x-e.box.x),y:-(e.contentBox.y-e.box.y),width:e.box.width,height:e.box.height});ot(t,i,e,a,l,"behind");for(let y of [e.header,e.footer])y?.anchoredDrawings?.length&&en(t,i,y,y.anchoredDrawings,a,{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)*a.scale}px`,d.style.top=`${(e.contentBox.y-e.box.y)*a.scale}px`,d.style.width=`${e.contentBox.width*a.scale}px`,d.style.height=`${e.contentBox.height*a.scale}px`,a.activeHeaderFooterRId&&d.setAttribute("contenteditable","false");for(let y of e.columnSeparators??[]){let u=t.createElement("div");u.className="docx-column-separator",u.setAttribute("contenteditable","false"),u.style.position="absolute",u.style.left=`${y.x*a.scale}px`,u.style.top=`${y.y*a.scale}px`,u.style.width=`${y.width*a.scale}px`,u.style.height=`${y.height*a.scale}px`,u.style.backgroundColor="currentColor",u.style.pointerEvents="none",d.append(u);}let c=r?new Map:null;for(let y of e.fragments){let u=y.kind==="table"?F(t,y,a):I(t,y,a);c?.set(y,u),d.append(u);}r&&c&&(r.content=d,r.blocks=c),i.append(d),ot(t,i,e,a,l,"inFront"),$e(t,i,e,a,I,F);for(let y of ["header","footer"]){if(e[y])continue;let u=t.createElement("div");u.className="docx-hf docx-hf--placeholder",u.dataset.docxHf=y,u.setAttribute("contenteditable","false");let h=y==="header"?e.contentBox.y-e.box.y:e.box.y+e.box.height-(e.contentBox.y+e.contentBox.height),p=Math.min(h,En);if(p<=0)continue;let f=Math.max(0,Math.min(Pn,h-p)),k=y==="header"?f:e.box.height-f-p;u.style.position="absolute",u.style.left=`${(e.contentBox.x-e.box.x)*a.scale}px`,u.style.top=`${k*a.scale}px`,u.style.width=`${e.contentBox.width*a.scale}px`,u.style.height=`${p*a.scale}px`,i.append(u);}for(let y of [e.header,e.footer]){if(!y)continue;let u=y.anchoredDrawings??[],h=G(y,e.index,a),p=t.createElement("div");p.className="docx-hf",p.dataset.docxHf=y.kind,y.rId&&(p.dataset.docxRId=y.rId),h?(p.dataset.docxHfActive="",p.setAttribute("contenteditable","true")):p.setAttribute("contenteditable","false"),p.style.position="absolute",p.style.left=`${(y.box.x-e.box.x)*a.scale}px`,p.style.top=`${(y.box.y-e.box.y)*a.scale}px`,p.style.width=`${y.box.width*a.scale}px`;let f=J(y,e,h);p.style.height=`${f*a.scale}px`,p.style.overflow="visible";let k=(e.box.x-y.box.x)*a.scale,R=(e.box.y-y.box.y)*a.scale,S=k+e.box.width*a.scale,P=R+e.box.height*a.scale;p.style.clipPath=`polygon(${k}px ${R}px, ${S}px ${R}px, ${S}px ${P}px, ${k}px ${P}px)`;let $=Object.freeze({x:0,y:0,width:y.box.width,height:y.box.height}),v=u.filter(g=>!pt(g)),b={...a,inertLinks:true};for(let g of y.fragments)p.append(g.kind==="table"?F(t,g,b):I(t,g,b));X(t,p,v,yt(a),$,"inFront",h),i.append(p);let x=t.createElement("div");x.className="docx-hf-edit-hint",x.dataset.docxHfHint=y.kind,x.setAttribute("contenteditable","false"),x.style.position="absolute",x.style.left=p.style.left,x.style.width=p.style.width,x.style.top=y.kind==="header"?`${(y.box.y+y.box.height-e.box.y)*a.scale}px`:`${(y.box.y-e.box.y)*a.scale}px`,y.kind==="footer"&&(x.style.transform="translateY(-100%)"),i.append(x),tn(t,i,y,u,a,s,"inFront",h);}return Mn(t,i,e,a),i}var En=30,Pn=36,Ln=16,$n=new Set(["dropdown","comboBox","date","checkbox"]);function Mn(t,e,n,o){let r=o.contentControlChrome,a=r?.suppressedIds,i=(n.contentControls??[]).filter(u=>a?.has(u.id)!==true),s=[...i,...(r?.additionalBoundaries??[]).filter(u=>a?.has(u.id)!==true&&!i.some(h=>h.id===u.id))];if(s.length===0)return;let l=r?.showAll===true,d=r?.activeIds,c=r?.hoverIds,y=r?.tocControlIds;for(let u of s){let h=y?.has(u.id)===true,p=!h&&d?.has(u.id)===true,f=c?.has(u.id)===true;e.append(Tn(t,n,u,o.scale,p,f,l||p||h&&f,r?.checkedIds?.has(u.id),h,r?.readOnly===true));}}function Tn(t,e,n,o,r,a,i,s,l,d){let c=t.createElement("div");c.className="docx-content-control-chrome",c.dataset.docxContentControl=n.id,c.dataset.docxMarker="",c.dataset.controlType=n.controlType,c.dataset.lock=n.effectiveLock,n.bound&&(c.dataset.bound=""),n.placeholder&&(c.dataset.placeholder=""),l&&(c.dataset.docxToc=""),d&&(c.dataset.readOnly=""),r&&(c.dataset.active=""),a&&(c.dataset.hover=""),i&&(c.dataset.boundaryVisible=""),c.setAttribute("contenteditable","false"),c.setAttribute("role","group"),n.alias&&(c.dataset.alias=n.alias),n.tag&&(c.dataset.tag=n.tag),n.alias&&c.setAttribute("aria-label",n.alias),c.style.position="absolute",c.style.inset="0",c.style.pointerEvents="none",c.style.zIndex="2";let y=e.contentBox.x-e.box.x,u=e.contentBox.y-e.box.y;for(let p of n.fragments){if(p.pageIndex!==e.index)continue;let f=t.createElement("div");f.className="docx-content-control-boundary",f.dataset.docxMarker="",f.setAttribute("contenteditable","false"),f.setAttribute("aria-hidden","true"),f.style.position="absolute",f.style.left=`${(y+p.box.x)*o}px`,f.style.top=`${(u+p.box.y)*o}px`,f.style.width=`${Math.max(p.box.width,1)*o}px`,f.style.height=`${Math.max(p.box.height,1)*o}px`,f.style.pointerEvents="none",c.append(f);}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=`${(y+h.box.x)*o}px`,p.style.top=`${Math.max(0,(u+h.box.y)*o-Ln)}px`,p.style.pointerEvents="none",c.append(p);}if(h&&$n.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"));let f=n.effectiveLock==="contentLocked"||n.effectiveLock==="sdtContentLocked";(d||f||n.bound)&&(p.disabled=true,p.dataset.disabledReason=d?"readOnly":n.bound?"bound":"locked",p.setAttribute("aria-disabled","true")),p.style.position="absolute",p.style.left=`${(y+h.box.x+h.box.width)*o-18}px`,p.style.top=`${(u+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",c.append(p);}return c}var ie=new WeakMap;function To(t){ie.delete(t);}function Dn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Hn(t,e){let n=Object.keys(t);if(n.length!==Object.keys(e).length)return false;for(let o of n){let r=t[o],a=e[o];if(r!==a)return false}return true}function Cn(t,e){if(t.length!==e.length)return false;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return false;return true}function In(t,e){if(t===e)return false;let n=new Set([...Object.keys(t),...Object.keys(e)]);for(let o of n){if(o==="fragments")continue;let r=t[o],a=e[o];if(r!==a&&!(Array.isArray(r)&&Array.isArray(a)&&Cn(r,a))&&!(typeof r=="object"&&typeof a=="object"&&r!==null&&a!==null&&!Array.isArray(r)&&!Array.isArray(a)&&Hn(r,a)))return false}return true}var ct="docx-column-separator";function Fn(t,e,n,o){let r=e.content,a=e.blocks;if(!r||!a||r.parentElement!==e.element)return null;let i={...o,paintInstance:`p${n.index}`},s=new Map,l=[];for(let u of n.fragments){let h=a.get(u)??(u.kind==="table"?F(t,u,i):I(t,u,i));s.set(u,h),l.push(h);}let d=new Set(l),c=r.firstChild;for(;c;){let u=c.nextSibling,h=c;!d.has(h)&&h.classList?.contains(ct)!==true&&c.remove(),c=u;}let y=r.firstChild;for(;y&&y.classList?.contains(ct);)y=y.nextSibling;for(let u of l){if(u===y){y=y.nextSibling;continue}r.insertBefore(u,y);}return {record:n,materialized:true,element:e.element,content:r,blocks:s}}function Bn(t,e,n,o){let r=t.element;return !t.materialized&&Dn(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 Nn(t,e,n={}){On(t,e,n);}function On(t,e,n,o){t.classList.toggle("docx-show-paragraph-marks",n.showParagraphMarks??false);let r=n.contentControlChrome,a=r?`${r.showAll===true?"1":"0"}:${r.activeIds?[...r.activeIds].sort().join(","):""}:${r.checkedIds?[...r.checkedIds].sort().join(","):""}:${r.tocControlIds?[...r.tocControlIds].sort().join(","):""}:${r.suppressedIds?[...r.suppressedIds].sort().join(","):""}:${r.readOnly===true?"ro":""}`:"",i=n.drawingStrings??ne,s=n.imageUrlPort!==void 0?Fe(t,n.imageUrlPort):null,l=r?.additionalBoundaries?r.additionalBoundaries.flatMap(g=>g.fragments.map(m=>`${g.id}:${m.pageIndex}:${m.box.x}:${m.box.y}:${m.box.width}:${m.box.height}`)).sort().join(","):"",d=n.readOnlyParagraphIds?[...n.readOnlyParagraphIds].sort().join(","):"",c=n.emptyTocPlaceholderIds?[...n.emptyTocPlaceholderIds].sort().join(","):"",y=r?.tocControlIds?[...r.tocControlIds].sort().join(","):"",u=Ee(n.revisionStyles,e,o),h={scale:n.scale??96/72,ariaHidden:n.ariaHidden??true,drawingStrings:i,urlRegistry:s,...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.readOnlyParagraphIds?{readOnlyParagraphIds:n.readOnlyParagraphIds}:{},...n.emptyTocPlaceholderIds?{emptyTocPlaceholderIds:n.emptyTocPlaceholderIds}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},...n.fieldShading?{fieldShading:n.fieldShading}:{},showParagraphMarks:n.showParagraphMarks??false,...n.shadeFormFields!==void 0?{shadeFormFields:n.shadeFormFields}:{},...u?{revisionStyles:u}:{},...n.imageUrlPort?{imageUrlPort:n.imageUrlPort}:{},...n.activeHeaderFooterRId?{activeHeaderFooterRId:n.activeHeaderFooterRId}:{},...n.activeHeaderFooterPageIndex!==void 0?{activeHeaderFooterPageIndex:n.activeHeaderFooterPageIndex}:{},...r?{contentControlChrome:r}:{}},p=t.ownerDocument,f=`${h.scale}|${h.ariaHidden}|${h.fontAlias?Jt(h.fontAlias):""}|${h.defaultFontFamily??""}|cc:${a}:${l}|toc:${y}|ro:${d}|tocEmpty:${c}|${n.imageUrlPort?"url":""}|${Ve(i)}|rev:${Ae(u)}|marks:${n.showParagraphMarks??false}`,k=ie.get(t),R=k?.parameters===f,S=R?new Map(k.pages.map(g=>[g.record,g])):null,P=k?new Map(k.pages.map(g=>[g.record.index,g])):null,$=e.pages.map(g=>{let m=n.materialize?.has(g.index)??true,T=S?.get(g);if(T&&T.materialized===m)return T;let A=P?.get(g.index);if(!m&&A&&Bn(A,g,h.scale,h.ariaHidden))return {record:g,materialized:false,element:A.element};if(R&&m&&A?.materialized&&In(A.record,g)){let se=Fn(p,A,g,h);if(se)return se}let H={},bt=An(p,g,h,m,H);return {record:g,materialized:m,element:bt,...H.content?{content:H.content}:{},...H.blocks?{blocks:H.blocks}:{}}});ie.set(t,{parameters:f,pages:$}),t.dataset.revision=String(e.revision),s&&s.reconcile(Ge(e),We(e));let v=new Set($.map(g=>g.element)),b=t.firstChild;for(;b;){let g=b.nextSibling;v.has(b)||b.remove(),b=g;}let x=t.firstChild;for(let g of $){if(g.element===x){x=x.nextSibling;continue}t.insertBefore(g.element,x);}Me($,h);}function Kn(t,e,n,o){let r=t.ownerDocument,a=o.scale,i=[];for(let s of n){let l=e.pages[s.pageIndex];if(!l)continue;let d=r.createElement("div");d.className=s.className??o.className??"docx-cell-selection-rect",d.style.position="absolute";let c=o.pageOffsetX?.get(s.pageIndex)??0;d.style.left=`${(l.contentBox.x+s.x+c)*a}px`,d.style.top=`${(l.contentBox.y+s.y)*a}px`,d.style.width=`${s.width*a}px`,d.style.height=`${s.height*a}px`,s.reviewAuthor&&(d.dataset.reviewAuthor=s.reviewAuthor.author,d.dataset.reviewAuthorSlot=String(s.reviewAuthor.slot%L),d.style.setProperty("--doc-review-author-current",s.reviewAuthor.color)),i.push(d);}t.replaceChildren(...i);}
2
- exports.a=j;exports.b=ke;exports.c=Un;exports.d=Pt;exports.e=_n;exports.f=ro;exports.g=Ve;exports.h=ne;exports.i=ao;exports.j=ae;exports.k=on;exports.l=To;exports.m=Nn;exports.n=On;exports.o=Kn;
@@ -1 +0,0 @@
1
- 'use strict';var chunkNO7U62I2_cjs=require('./chunk-NO7U62I2.cjs'),chunkJP253KIZ_cjs=require('./chunk-JP253KIZ.cjs'),chunkZFBNCHRP_cjs=require('./chunk-ZFBNCHRP.cjs');var Rr=["getChangeTrackingMode","getDocument","getBody","getParagraphs","getSpanParagraphs","getText","getSpanText","getParagraphId","search","getFont","getParagraphFormat","getStyle","getSections","getPageSetup","getFurniture","getNotes","getNoteBody","getNoteText","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","getContentControlIsBound","getContentControlPlaceholderShown","getContentControlTemporary","getContentControlText","getContentControlParagraphs","getContentControlRange"],bo=["setChangeTrackingMode","proposeInsertion","proposeDeletion","proposeReplacement","insertText","replaceSpan","replaceStoryBlocks","insertParagraph","splitParagraph","deleteParagraph","selectSpan","selectBookmark","setFont","setParagraphFormat","setStyle","setPageSetup","deleteNote","setListLevel","insertListParagraph","setHyperlink","insertComment","setCommentResolved","replyToComment","deleteComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","setContentControlValue","setContentControlProperties","deleteContentControl","insertContentControlText","insertContentControl","insertCustomNode"],Io=["deleteNote","insertComment","setCommentResolved","replyToComment","insertCustomNode"],So=new Set(Io);function ce(n){return So.has(n.op)}var Ro=new Set(bo);function Lt(n){return Ro.has(n.op)}var Yt=Object.freeze(["default","first","even"]),yt=Object.freeze({kind:"body"});function K(n){switch(n.kind){case "body":return "body";case "note":return `note:${n.noteKind}:${String(n.noteId)}`;default:return `${n.kind}:${String(n.sectionIndex)}:${n.variant}`}}function hn(n){if(typeof n!="object"||n===null)return false;let e=n;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&&Yt.includes(e.variant)}function kn(n,e,r){let a=i=>({state:r,step:{ok:false,error:{code:"unsupported-capability",message:i,detail:"changeTrackingMode"}}});return n.op==="getChangeTrackingMode"||n.op==="setChangeTrackingMode"?e?n.op==="getChangeTrackingMode"?{state:r,step:{ok:true,kind:"query",value:{kind:"text",text:r.mode}}}:n.mode!=="Off"&&n.mode!=="TrackMineOnly"?a("TrackAll requires shared tracking enforcement for every peer and is not supported"):n.mode==="TrackMineOnly"&&(typeof n.author!="string"||!n.author.trim()||!chunkZFBNCHRP_cjs.O(n.author))?a("TrackMineOnly requires a non-empty XML-safe runtime author"):{state:{mode:n.mode,...n.mode==="TrackMineOnly"?{author:n.author.trim()}:{}},step:{ok:true,kind:"query",value:{kind:"applied"}}}:a("Office-shaped tracking mode is supported by server hosts only"):r.mode==="Off"||!Lt(n)||n.op==="insertText"||n.op==="replaceSpan"&&!("body"in n.span)||["insertComment","replyToComment","deleteComment","setCommentResolved","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","selectSpan","selectBookmark"].includes(n.op)?null:a(`${n.op} does not support TrackMineOnly; no permanent edit was applied`)}function Co(){let n=globalThis.crypto,e=n?.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 r=e.call(n,new Uint8Array(16)),a="";for(let i of r)a+=i.toString(16).padStart(2,"0");return a}function Oo(n){return typeof n=="object"&&n!==null&&"kind"in n&&"ref"in n}function An(){let n=new Map,e=new Map,r=new Map,a=new Map,i=Co(),l=null,f=(m,y)=>{let I=(a.get(m)??0)+1;a.set(m,I);let x=`${m}:${i}:${String(I)}`;return n.set(x,y),Object.freeze({kind:m,ref:x})},g=(m,y,I)=>{let x=`${m}\0${y}`,S=r.get(x);if(S)return Object.freeze({kind:m,ref:S});let k=f(m,I);return r.set(x,k.ref),k};return {document(){return l??=f("document",{kind:"document"}),l},body(m){return g("body",K(m),{kind:"body",story:m})},paragraph(m,y){let I=e.get(m);if(I)return Object.freeze({kind:"paragraph",ref:I});let x=f("paragraph",{kind:"paragraph",paragraphId:m,story:y});return e.set(m,x.ref),x},section(m){return g("section",String(m),{kind:"section",index:m})},note(m,y){return g("note",`${m}:${String(y)}`,{kind:"note",noteKind:m,noteId:y})},comment(m,y){return g("comment",`${K(y)}\0${m}`,{kind:"comment",commentId:m,story:y})},revision(m,y){return g("revision",`${K(y)}\0${m}`,{kind:"revision",revisionId:m,story:y})},bookmark(m,y){return g("bookmark",`${K(y)}\0${m}`,{kind:"bookmark",name:m,story:y})},list(m,y){return g("list",`${K(y)}\0${m}`,{kind:"list",numId:m,story:y})},contentControl(m,y){return g("contentControl",`${K(y)}\0${m}`,{kind:"contentControl",nodeId:m,story:y})},retarget(m,y){let I=e.get(m);if(!I||m===y)return;let x=n.get(I);!x||x.kind!=="paragraph"||(e.delete(m),n.set(I,{kind:"paragraph",paragraphId:y,story:x.story}),e.has(y)||e.set(y,I));},resolve(m,y){if(!Oo(m)||m.kind!==y||typeof m.ref!="string")return null;let I=n.get(m.ref);return !I||I.kind!==y?null:I}}}var Po=255,To=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false});function vn(n){let e=chunkZFBNCHRP_cjs.gf(n);if(!e)return To;let r=new Map,a=new Map,i=null;for(let l of chunkZFBNCHRP_cjs.ff(e).values())if(l.type==="paragraph"){if(r.set(l.styleId,l.name),l.name!==null){let f=l.name.trim().toLowerCase();a.has(f)||a.set(f,l.styleId);}l.isDefault&&i===null&&(i=l.styleId);}return Object.freeze({nameOf:l=>r.get(l)??null,idOf:l=>a.get(l.trim().toLowerCase())??null,defaultId:i,present:true})}function Gt(n,e,r){let a=chunkZFBNCHRP_cjs.Ga(n,e);if(!a||a.kind!=="paragraph")return null;let i=wo(chunkZFBNCHRP_cjs.Ke(chunkZFBNCHRP_cjs.Ie(a),"pStyle"));return i!==null?r.nameOf(i):r.defaultId===null?null:r.nameOf(r.defaultId)}function wo(n){if(!n)return null;for(let e of n.attributes)if(e.localName==="val")return e.value;return null}function Jt(n,e){if(typeof n!="string"||n.trim().length===0)return {ok:false,detail:"style: not a name"};if(n.length>Po)return {ok:false,detail:"style: name too long"};if(!chunkZFBNCHRP_cjs.O(n))return {ok:false,detail:"style: not valid XML text"};if(!e.present)return {ok:false,detail:"style: this document defines no styles"};let r=e.idOf(n);return r===null?{ok:false,detail:"style: this document defines no paragraph style with that name"}:{ok:true,styleId:r}}var No=31680,Ho=1999,Mo=Object.freeze({bold:null,italic:null,name:null,size:null,color:null});function Q(n,e){if(!n)return null;for(let r of n.attributes)if(r.localName===e)return r.value;return null}function pe(n){if(!n)return null;let e=Q(n,"val");if(e===null)return true;let r=e.trim().toLowerCase();return !(r==="0"||r==="false"||r==="off"||r==="none")}function Lo(n){if(n===null)return null;let e=n.trim();return /^[0-9a-fA-F]{6}$/.test(e)?`#${e.toUpperCase()}`:null}function Eo(n){if(n===null)return null;let e=Number(n.trim());return !Number.isFinite(e)||e<=0?null:e/2}function vt(n){if(n===null)return null;let e=Number(n.trim());return Number.isFinite(e)?chunkZFBNCHRP_cjs.Xe(chunkZFBNCHRP_cjs.Ve(e)):null}function Et(n){if(n.length===0)return null;let e=n[0];if(e===null)return null;for(let r of n)if(r!==e)return null;return e}function bn(n,e,r=chunkJP253KIZ_cjs.ba){let a=[];for(let i of e)for(let l of chunkJP253KIZ_cjs.ta(n,i.paragraphId,i.start,i.end,r))a.push(chunkZFBNCHRP_cjs.Je(l));return a.length===0?Mo:{bold:Et(a.map(i=>pe(chunkZFBNCHRP_cjs.Ke(i,"b")))),italic:Et(a.map(i=>pe(chunkZFBNCHRP_cjs.Ke(i,"i")))),name:Et(a.map(i=>{let l=chunkZFBNCHRP_cjs.Ke(i,"rFonts"),f=Q(l,"ascii");return f===null||f.length===0?null:f})),size:Et(a.map(i=>Eo(Q(chunkZFBNCHRP_cjs.Ke(i,"sz"),"val")))),color:Et(a.map(i=>Lo(Q(chunkZFBNCHRP_cjs.Ke(i,"color"),"val"))))}}var jo=Object.freeze({left:"Left",start:"Left",center:"Centered",right:"Right",end:"Right",both:"Justified",distribute:"Justified"}),Bo=Object.freeze({Left:"left",Centered:"center",Right:"right",Justified:"both"});function _o(n){let e=Q(chunkZFBNCHRP_cjs.Ke(n,"jc"),"val");return e===null?"Unknown":jo[e.trim().toLowerCase()]??"Unknown"}function In(n,e,r){let a=chunkZFBNCHRP_cjs.Ga(n,e);if(!a||a.kind!=="paragraph")return null;let i=chunkZFBNCHRP_cjs.Ie(a),l=chunkZFBNCHRP_cjs.Ke(i,"spacing"),f=chunkZFBNCHRP_cjs.Ke(i,"ind");return {alignment:_o(i),style:Gt(n,e,r),firstLineIndent:Fo(f),leftIndent:vt(Q(f,"left")??Q(f,"start")),rightIndent:vt(Q(f,"right")??Q(f,"end")),lineSpacing:vt(Q(l,"line")),spaceBefore:vt(Q(l,"before")),spaceAfter:vt(Q(l,"after")),widowControl:pe(chunkZFBNCHRP_cjs.Ke(i,"widowControl"))}}function Fo(n){let e=vt(Q(n,"hanging"));if(e!==null&&e>0)return -e;let r=vt(Q(n,"firstLine"));return r!==null?r:e===null?null:-e}function Qt(n,e){if(typeof n!="number"||!Number.isFinite(n))return {ok:false,detail:`${e}: not a measurement`};let r=chunkZFBNCHRP_cjs.Ye(chunkZFBNCHRP_cjs.We(n));return Math.abs(r)>No?{ok:false,detail:`${e}: out of range`}:{ok:true,value:r}}function Sn(n){let e=[];if(n.bold!==void 0){if(typeof n.bold!="boolean")return {ok:false,detail:"bold: not a boolean"};e.push({localName:"b",...n.bold?{}:{attributes:{val:"0"}}});}if(n.italic!==void 0){if(typeof n.italic!="boolean")return {ok:false,detail:"italic: not a boolean"};e.push({localName:"i",...n.italic?{}:{attributes:{val:"0"}}});}if(n.name!==void 0){let r=n.name;if(typeof r!="string"||r.length===0||r.length>128)return {ok:false,detail:"name: not a font name"};if(!chunkZFBNCHRP_cjs.O(r))return {ok:false,detail:"name: not valid XML text"};e.push({localName:"rFonts",attributes:{ascii:r,hAnsi:r}});}if(n.size!==void 0){let r=n.size;if(typeof r!="number"||!Number.isFinite(r)||r<=0)return {ok:false,detail:"size: not a positive number of points"};let a=Math.round(r*2);if(a<1||a>Ho)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(n.color!==void 0){let r=n.color;if(typeof r!="string"||!/^#[0-9a-fA-F]{6}$/.test(r.trim()))return {ok:false,detail:"color: not a #RRGGBB triplet"};e.push({localName:"color",attributes:{val:r.trim().slice(1).toUpperCase()}});}return e.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:e}}function Rn(n,e,r,a){let i=chunkZFBNCHRP_cjs.Ga(n,e);if(!i||i.kind!=="paragraph")return {ok:false,detail:"not a paragraph"};let l=chunkZFBNCHRP_cjs.Ie(i),f=[];if(r.style!==void 0){let k=Jt(r.style,a);if(!k.ok)return {ok:false,detail:k.detail};f.push({localName:"pStyle",attributes:{val:k.styleId}});}if(r.alignment!==void 0){let k=Bo[r.alignment];if(k===void 0)return {ok:false,detail:`alignment: ${String(r.alignment)}`};f.push({localName:"jc",attributes:{val:k}});}let g=chunkZFBNCHRP_cjs.Ke(l,"ind"),m=xn(g),y=false;if(r.firstLineIndent!==void 0){let k=Qt(r.firstLineIndent,"firstLineIndent");if(!k.ok)return k;delete m.firstLine,delete m.hanging,k.value<0?m.hanging=String(-k.value):m.firstLine=String(k.value),y=true;}for(let[k,A,b]of [["leftIndent","left","start"],["rightIndent","right","end"]]){let C=r[k];if(C===void 0)continue;let w=Qt(C,k);if(!w.ok)return w;delete m[b],m[A]=String(w.value),y=true;}y&&f.push({localName:"ind",attributes:m});let I=chunkZFBNCHRP_cjs.Ke(l,"spacing"),x=xn(I),S=false;for(let[k,A]of [["spaceBefore","before"],["spaceAfter","after"]]){let b=r[k];if(b===void 0)continue;let C=Qt(b,k);if(!C.ok)return C;if(C.value<0)return {ok:false,detail:`${k}: out of range`};x[A]=String(C.value),S=true;}if(r.lineSpacing!==void 0){let k=Qt(r.lineSpacing,"lineSpacing");if(!k.ok)return k;if(k.value<=0)return {ok:false,detail:"lineSpacing: out of range"};x.line=String(k.value),x.lineRule??="auto",S=true;}if(S&&f.push({localName:"spacing",attributes:x}),r.widowControl!==void 0){if(typeof r.widowControl!="boolean")return {ok:false,detail:"widowControl: not a boolean"};f.push({localName:"widowControl",...r.widowControl?{}:{attributes:{val:"0"}}});}return f.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:chunkJP253KIZ_cjs.la(chunkJP253KIZ_cjs.ja(n,e),f)}}function xn(n){let e=Object.create(null);if(!n)return e;for(let r of n.attributes)e[r.localName]=r.value;return e}function Cn(){let n=false,e=false,r=false;return {conflict(a){let i=Lt(a),l=ce(a),f=a.op==="deleteComment";return l&&n||e&&i?{message:"that command commits on its own and cannot share a batch",detail:a.op}:f&&n&&!r||r&&i&&!f?{message:"comment deletions may share a batch only with other comment deletions",detail:a.op}:null},note(a){Lt(a)&&(n=true,ce(a)&&(e=true),a.op==="deleteComment"&&(r=true));},get hasCommands(){return n}}}var Do=63360;function mt(n){return Math.round(chunkZFBNCHRP_cjs.Xe(chunkZFBNCHRP_cjs.Ve(n))*100)/100}function Ko(n,e){if(typeof n!="number"||!Number.isFinite(n))return null;let r=chunkZFBNCHRP_cjs.Ye(chunkZFBNCHRP_cjs.We(n));return r>Do||r<0||r===0&&!e?null:r}var Vo=[["pageWidth","pageWidthTwips",false],["pageHeight","pageHeightTwips",false],["topMargin","marginTopTwips",true],["rightMargin","marginRightTwips",true],["bottomMargin","marginBottomTwips",true],["leftMargin","marginLeftTwips",true]];function On(n){if(typeof n!="object"||n===null)return {ok:false,reason:"that is not a page setup",detail:"not-an-object"};let e=n,r={},a=0;for(let[l,f,g]of Vo){let m=e[l];if(m===void 0)continue;let y=Ko(m,g);if(y===null)return {ok:false,reason:`that is not a value for ${l}`,detail:String(m)};r[f]=y,a+=1;}let i=e.orientation;if(i!==void 0){if(i!=="portrait"&&i!=="landscape")return {ok:false,reason:"that is not an orientation",detail:String(i)};r.orientation=i,a+=1;}return a===0?{ok:false,reason:"that page setup names nothing to write",detail:"empty"}:{ok:true,value:r}}function Wo(n){let e=chunkZFBNCHRP_cjs.Ah(n),r=e.widthTwips>e.heightTwips?"landscape":"portrait";return Object.freeze({pageWidth:mt(e.widthTwips),pageHeight:mt(e.heightTwips),orientation:r,topMargin:mt(e.topTwips),rightMargin:mt(e.rightTwips),bottomMargin:mt(e.bottomTwips),leftMargin:mt(e.leftTwips),headerDistance:mt(e.headerTwips),footerDistance:mt(e.footerTwips),gutter:mt(e.gutterTwips)})}function zo(n,e){if(!e)return null;let r=null,a=(i,l,f)=>{if(r!==null||i.kind==="textValue"||f>64)return;let g=i.kind==="paragraph"?i.id:l;if(i.id===e.id){r=g;return}for(let m of i.children)a(m,g,f+1);};return a(n.root,null,0),r}function Pn(n,e,r){let a=chunkZFBNCHRP_cjs.Ld(e.root);return Object.freeze(a.map((i,l)=>{let f=r[l];return Object.freeze({index:l,markParagraphId:zo(e,i),pageSetup:Wo(i),titlePage:f?.titlePage??false,evenAndOddHeaders:f?.evenAndOddHeaders??false})}))}function Tn(n,e,r){return e>=r?null:{text:n.text.slice(e-n.rawStart,r-n.rawStart),rawStart:e,rawEnd:r}}function $o(n,e){let r=[],a=0;for(let i of n){for(;a<e.length&&e[a].end<=i.rawStart;)a+=1;let l=i.rawEnd-i.rawStart;if(i.text.length!==l){let m=e[a];(!m||m.start>=i.rawEnd)&&r.push(i);continue}let f=i.rawStart;for(;a<e.length;){let m=e[a];if(m.end<=f){a+=1;continue}if(m.start>=i.rawEnd)break;let y=Tn(i,f,Math.min(m.start,i.rawEnd));if(y&&r.push(y),f=Math.max(f,m.end),m.end<=i.rawEnd&&(a+=1),f>=i.rawEnd)break}let g=Tn(i,f,i.rawEnd);g&&r.push(g);}return r}function Zt(n,e,r){if(r==="model")return chunkNO7U62I2_cjs.b(e);let a=chunkNO7U62I2_cjs.c(n,e,r);if(r==="allMarkup")return chunkNO7U62I2_cjs.a(a);let i=Uo(n);if(i.length===0)return chunkNO7U62I2_cjs.a(a);let l=$o(a,i);return chunkNO7U62I2_cjs.a(l)}function Uo(n){let e=chunkZFBNCHRP_cjs.Ne(n),r=[],a=(l,f)=>{if(!(f>64||l.kind==="textValue")){if(l.kind==="revisionInsert"||l.kind==="revisionMoveTo"){let g=e.spanOf(l);g&&g.end>g.start&&r.push({start:g.start,end:g.end});return}for(let g of l.children)a(g,f+1);}};a(n,0),r.sort((l,f)=>l.start-f.start||f.end-l.end);let i=[];for(let l of r){let f=i[i.length-1];f&&l.start<=f.end?f.end=Math.max(f.end,l.end):i.push({...l});}return i}var fe="\r",Xo=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false}),Yo=Object.freeze([]),Go=Object.freeze([]),wn=Object.freeze([]),Jo=Object.freeze({package:null,body:null,story:()=>null,storyOf:()=>null,sections:()=>Go,furniture:()=>wn,noteIds:()=>({ok:true,ids:Hn}),styles:()=>Xo});function Qo(n){return n.kind==="textValue"?Yo:Object.freeze(n.children.filter(e=>e.kind!=="textValue").map(e=>{let r=[];chunkZFBNCHRP_cjs.Ad([e],r,0);let a=e.kind==="paragraph"?"paragraph":e.kind==="table"?"table":"other",i=e.kind==="paragraph"&&chunkZFBNCHRP_cjs.Ke(chunkZFBNCHRP_cjs.Ie(e),"sectPr")!==void 0;return Object.freeze({id:e.id,kind:a,paragraphIds:Object.freeze(r.map(l=>l.id)),removable:a!=="other"&&!i})}))}function me(n,e,r,a,i){let l=chunkZFBNCHRP_cjs.zd(a),f=Object.freeze(l.map(k=>k.id)),g=new Map,m=new Map;l.forEach((k,A)=>{g.set(k.id,A),m.set(k.id,k);});let y=new Map,I=k=>{if(!g.has(k))return null;let A=y.get(k);if(A!==void 0)return A;let b=chunkZFBNCHRP_cjs.Qh(e,k)??"";return y.set(k,b),b},x=new Map,S=(k,A="allMarkup")=>{let b=m.get(k);if(!b||b.kind!=="paragraph")return null;let C=`${k}:${A}`,w=x.get(C);if(w)return w;let L=Zt(b,I(k)??"",A);return x.set(C,L),L};return {story:n,part:e,root:a,scope:r,paragraphIds:f,blocks:Qo(a),has:k=>g.has(k),indexOf:k=>g.get(k)??-1,paragraph(k){let A=m.get(k);return A?{nodeId:k,paraId:chunkZFBNCHRP_cjs.Eb(A),text:S(k)?.text??""}:null},node:k=>m.get(k)??null,rawText:I,paragraphText:(k,A)=>S(k,A)?.text??null,projectedText:S,text:k=>f.map(A=>S(A,k)?.text??"").join(fe),styles:i}}function Nn(n){let e=n.parts.get(n.mainDocumentPart);if(!e)return Jo;let r,a=()=>r??=vn(n),i,l=()=>i??=chunkZFBNCHRP_cjs.Nd(n),f,g=new Map,m=new Map,y=A=>{let b=m.get(A);if(b)return b;let C=chunkZFBNCHRP_cjs.Jf(n,A);if(!C){let X={ok:true,ids:Hn};return m.set(A,X),X}let w=[],L=new Set,_=new Set,z=0,B=false;for(let X of C.root.children){if(chunkZFBNCHRP_cjs.fd(X)!==A)continue;if(z+=1,X.kind!=="note"){B=true;continue}if(!chunkZFBNCHRP_cjs.id(X))continue;let it=chunkZFBNCHRP_cjs.gd(X);if(it===null){B=true;continue}L.has(it)?_.add(it):(L.add(it),w.push(it));}let G=z>chunkZFBNCHRP_cjs.pd?{ok:false,reason:"truncated"}:B?{ok:false,reason:"malformed"}:_.size>0?{ok:false,reason:"duplicates",duplicateIds:Object.freeze([..._])}:{ok:true,ids:Object.freeze(w)};return m.set(A,G),G},I=A=>{let b=l()[A.sectionIndex];return b?(A.kind==="header"?b.headers:b.footers).get(A.variant)??null:null},x=A=>{if(A.kind==="body"){let C=chunkZFBNCHRP_cjs.yd(e);return C?me(A,e,{kind:"body"},C,a):null}if(A.kind==="note"){let C=y(A.noteKind);if(!C.ok||!C.ids.includes(A.noteId))return null;let w=chunkZFBNCHRP_cjs.Jf(n,A.noteKind);if(!w)return null;let L=chunkZFBNCHRP_cjs.td(w.root,A.noteId);return !L||!chunkZFBNCHRP_cjs.id(L)?null:me(A,w,{kind:"notesPart",noteKind:A.noteKind},L,a)}let b=I(A);return b?me(A,b.part,{kind:"headerFooter",rId:b.rId},b.part.root,a):null},S=A=>{let b=K(A);if(g.has(b))return g.get(b)??null;let C=x(A);return g.set(b,C),C};return {package:n,get body(){return S(yt)},story:S,storyOf:A=>{if(S(yt)?.has(A))return yt;for(let[C]of l().entries())for(let w of ["header","footer"])for(let L of Yt){let _={kind:w,sectionIndex:C,variant:L};if(S(_)?.has(A))return _}for(let C of ["footnote","endnote"]){let w=y(C);if(w.ok)for(let L of w.ids){let _={kind:"note",noteKind:C,noteId:L};if(S(_)?.has(A))return _}}return null},sections:()=>f??=Pn(n,e,l()),furniture(A){let b=l()[A];if(!b)return wn;let C=[];for(let w of ["header","footer"]){let L=w==="header"?b.headers:b.footers;for(let _ of Yt){let z=L.get(_);z&&C.push(Object.freeze({kind:w,variant:_,declared:!z.inherited}));}}return Object.freeze(C)},noteIds:y,styles:a}}var Hn=Object.freeze([]);function lt(n,e){return {ok:false,code:n,detail:e}}function ut(n){return {ok:true,value:n}}function U(n,e,r,a){let i=r.resolve(n,e);if(!i||i.kind!=="body"&&i.kind!=="paragraph")return lt("invalid-handle",`not-a-${e}-handle`);let l=a.story(i.story);return l?ut(l):lt("invalid-handle",`no-such-story:${K(i.story)}`)}function et(n,e,r){let a=e.resolve(n,"paragraph");if(!a||a.kind!=="paragraph")return lt("invalid-handle","not-a-paragraph-handle");let i=r.story(a.story);if(!i)return lt("invalid-handle",`no-such-story:${K(a.story)}`);let l=i.indexOf(a.paragraphId);return l<0?lt("invalid-handle","paragraph-not-in-body"):ut({story:a.story,paragraphId:a.paragraphId,index:l,offset:0})}function Zo(n,e,r){let a=et(n.paragraph,e,r);if(!a.ok)return a;let l=(r.story(a.value.story)?.rawText(a.value.paragraphId)??"").length,{offset:f}=n;return !Number.isInteger(f)||f<0||f>l?lt("invalid-offset",`offset ${String(f)} outside 0..${String(l)}`):ut({...a.value,offset:f})}function Ct(n,e,r){if("paragraph"in n){if(!("at"in n))return Zo(n,e,r);let g=et(n.paragraph,e,r);if(!g.ok||n.at==="start")return g;let y=(r.story(g.value.story)?.rawText(g.value.paragraphId)??"").length;return ut({...g.value,offset:y})}let a=U(n.body,"body",e,r);if(!a.ok)return a;let i=a.value.paragraphIds;if(i.length===0)return lt("invalid-offset","empty-story");if(n.at==="start")return ut({story:a.value.story,paragraphId:i[0],index:0,offset:0});let l=i.length-1,f=i[l];return ut({story:a.value.story,paragraphId:f,index:l,offset:(a.value.rawText(f)??"").length})}function qo(n,e){return n.index<e.index||n.index===e.index&&n.offset<=e.offset}function tr(n){let e=n.paragraphIds;if(e.length===0)return null;let r=e.length-1,a=e[r];return {start:{story:n.story,paragraphId:e[0],index:0,offset:0},end:{story:n.story,paragraphId:a,index:r,offset:(n.rawText(a)??"").length}}}function V(n,e,r){if("body"in n){let l=U(n.body,"body",e,r);return l.ok?ut(tr(l.value)):l}if("paragraph"in n){let l=et(n.paragraph,e,r);if(!l.ok)return l;let g=(r.story(l.value.story)?.rawText(l.value.paragraphId)??"").length;return ut({start:l.value,end:{...l.value,offset:g}})}let a=Ct(n.start,e,r);if(!a.ok)return a;let i=Ct(n.end,e,r);return i.ok?K(a.value.story)!==K(i.value.story)?lt("invalid-handle","span-crosses-stories"):qo(a.value,i.value)?ut({start:a.value,end:i.value}):lt("invalid-offset","span-start-after-end"):i}function q(n,e,r){if("body"in n)return U(n.body,"body",e,r);if("paragraph"in n)return U(n.paragraph,"paragraph",e,r);let a=n.start;return "paragraph"in a?U(a.paragraph,"paragraph",e,r):U(a.body,"body",e,r)}function qt(n,e,r){if("paragraph"in n)return et(n.paragraph,e,r);let a=U(n.body,"body",e,r);if(!a.ok)return a;let i=a.value.paragraphIds;if(i.length===0)return lt("invalid-offset","empty-story");let l=n.at==="first"?0:i.length-1;return ut({story:a.value.story,paragraphId:i[l],index:l,offset:0})}function at(n,e){return n?e.paragraphIds.slice(n.start.index,n.end.index+1):[]}function ye(n,e){if(!n)return [];let r=at(n,e),a=r.length-1;return r.map((i,l)=>{let f=(e.rawText(i)??"").length,g=l===0?n.start.offset:0,m=l===a?n.end.offset:f;return {paragraphId:i,start:g,end:m,whole:g===0&&m===f}})}function Mn(n,e,r,a="allMarkup"){if(!n)return "";let i=at(n,e);return i.length===1?e.projectedText(n.start.paragraphId,a)?.sliceRaw(n.start.offset,n.end.offset)??"":i.map((l,f)=>{let g=e.projectedText(l,a);if(!g)return "";let m=(e.rawText(l)??"").length;return f===0?g.sliceRaw(n.start.offset,m):f===i.length-1?g.sliceRaw(0,n.end.offset):g.text}).join(r)}function jt(n,e){return {start:{paragraph:e.paragraph(n.start.paragraphId,n.start.story),offset:n.start.offset},end:{paragraph:e.paragraph(n.end.paragraphId,n.end.story),offset:n.end.offset}}}var er=256,Ln=1e4;function ge(n,e){if(n.kind!=="textValue"){for(let r of n.attributes)if(r.namespaceUri===chunkZFBNCHRP_cjs.da&&r.localName===e)return r.value}}function nr(n){return n.startsWith("_")}function he(n){let e=new Map,r=[],a=new Set;for(let i of n.paragraphIds){let l=n.node(i);if(l?.kind!=="paragraph")continue;let f=chunkZFBNCHRP_cjs.Ne(l),g=m=>{if(m.kind!=="textValue"){if(m.kind==="bookmarkStart"){if(r.length>=Ln||e.size>=Ln)return;let y=ge(m,"id"),I=ge(m,"name");if(y===void 0||I===void 0||I.length===0||I.length>er||nr(I)||a.has(I)||e.has(y))return;let x=f.spanOf(m)?.start??0;e.set(y,{name:I,start:{paragraphId:i,offset:x}});return}if(m.kind==="bookmarkEnd"){let y=ge(m,"id");if(y===void 0)return;let I=e.get(y);if(!I)return;e.delete(y),a.add(I.name);let x=f.spanOf(m)?.start??0;r.push(Object.freeze({name:I.name,start:I.start,end:{paragraphId:i,offset:x}}));return}for(let y of m.children)g(y);}};for(let m of l.children)g(m);}return Object.freeze(r)}function ke(n,e){return he(n).find(r=>r.name===e)??null}function En(n,e){let r=n.node(e);if(r?.kind!=="paragraph")return Object.freeze([]);let a=chunkZFBNCHRP_cjs.Ne(r),i=[],l=(f,g)=>{if(!(f.kind==="textValue"||g>32)){if(chunkZFBNCHRP_cjs.Ya(f)){let m=a.spanOf(f);m&&i.push(Object.freeze({id:f.id,paragraphId:e,start:m.start,end:m.end}));return}for(let m of f.children)l(m,g+1);}};for(let f of r.children)l(f,0);return Object.freeze(i)}function jn(n,e,r){let a=chunkZFBNCHRP_cjs.$a(r,i=>chunkZFBNCHRP_cjs.pf(n,e,i));if(a.kind==="external")return a.href;if(a.kind==="internal"){let i=chunkZFBNCHRP_cjs.Za(r);return i===void 0||i.length===0?null:`#${i}`}return null}var Ot=8;function Bn(n){if(!n||n.kind==="textValue")return null;for(let e of n.attributes)if(e.namespaceUri===chunkZFBNCHRP_cjs.da&&e.localName==="val")return e.value;return null}function _n(n){let e=chunkZFBNCHRP_cjs.Ke(chunkZFBNCHRP_cjs.Ie(n),"numPr");if(!e)return null;let r=Bn(chunkZFBNCHRP_cjs.Ke(e,"numId"));if(r===null||!/^\d{1,10}$/.test(r)||r==="0")return null;let a=Bn(chunkZFBNCHRP_cjs.Ke(e,"ilvl")),i=a===null?0:Number(a);return !Number.isInteger(i)||i<0||i>Ot?null:{numId:r,level:i}}function te(n){let e=new Map;for(let r of n.paragraphIds){let a=n.node(r);if(!a)continue;let i=_n(a);if(!i)continue;let l=e.get(i.numId);l?l.push(r):e.set(i.numId,[r]);}return Object.freeze([...e].map(([r,a])=>Object.freeze({numId:r,paragraphIds:Object.freeze(a)})))}function Bt(n,e){let r=n.node(e);return r?_n(r):null}function Fn(n,e,r,a,i){let l=Math.min(i?.limit??2e3,2e3),f=[],g=at(e,n),m=g.length-1;for(let[y,I]of g.entries()){if(l<=0)break;let x=n.projectedText(I,i?.projection??"allMarkup");if(!x)continue;let S=x.findOccurrences(a,l,{matchCase:i?.matchCase===true,wholeWord:i?.matchWholeWord===true,...y===0&&e?{from:x.projectedOffset(e.start.offset)}:{},...y===m&&e?{to:x.projectedOffset(e.end.offset)}:{}});for(let k of S.matches){if(y===0&&e&&k.rawStart<e.start.offset||y===m&&e&&k.rawEnd>e.end.offset)continue;let A=r.paragraph(I,n.story);f.push({start:{paragraph:A,offset:k.rawStart},end:{paragraph:A,offset:k.rawEnd}}),l-=1;}}return {ok:true,spans:f}}var or={insert:"Insert",delete:"Delete",replace:"Replace",moveFrom:"MovedFrom",moveTo:"MovedTo",format:"Property",paragraphMark:"ParagraphProperty"};function rr(n){return n.kind==="note"}function ar(n,e){return e.length===0?!rr(n.story):e.every(r=>n.has(r.start.paragraphId))}function sr(n){return Object.freeze(chunkJP253KIZ_cjs.Ia(n.part).filter(e=>ar(n,e.ranges)))}function Ae(n){let e=[];for(let r of sr(n)){if(r.readOnly||r.revisionKind==="structural")continue;let a=or[r.revisionKind];a!==void 0&&e.push(Object.freeze({id:r.id,type:a,author:r.author,date:r.date??"",item:r}));}return Object.freeze(e)}function ir(n,e){let r=n;for(let a=0;r!==void 0&&a<=64;a+=1){if(r.parentId===void 0)return r.range!==null;r=e.get(r.parentId);}return false}var dr=Object.freeze({items:Object.freeze([]),roots:Object.freeze([]),byId:()=>null,textOf:()=>""});function Dn(n,e){let r=n.parts.get(chunkJP253KIZ_cjs.P(n,e.part.name));if(!r)return dr;let a=n.parts.get(chunkJP253KIZ_cjs.Q(n,e.part.name)),i=chunkZFBNCHRP_cjs.lg(r),l=a?chunkZFBNCHRP_cjs.mg(a):new Map,f=chunkZFBNCHRP_cjs.jg(e.part).filter(x=>e.has(x.start.paragraphId)),g=chunkJP253KIZ_cjs.Ja(i,f,l),m=new Map(g.map(x=>[x.id,x])),y=g.filter(x=>ir(x,m)),I=new Map(y.map(x=>[x.id,x]));return Object.freeze({items:Object.freeze(y),roots:Object.freeze(y.filter(x=>x.parentId===void 0)),byId:x=>I.get(x)??null,textOf:x=>{let S=I.get(x);return S?chunkJP253KIZ_cjs.ua(S.comment):""}})}var lr=/[\r\n\v\f\u2028\u2029]/;function ee(n,e,r){return {code:n,message:e,detail:r}}function Kn(n,e=false){if(typeof n.author!="string"||!n.author.trim()||!chunkZFBNCHRP_cjs.O(n.author))return ee("unsupported-content","proposals need a non-empty XML-safe author","author");let r=n.op==="proposeInsertion";return !(n.op==="proposeDeletion")&&(typeof n.text!="string"||!e&&!n.text.length||lr.test(n.text)||!chunkZFBNCHRP_cjs.O(n.text))?ee("unsupported-content","proposals need non-empty inline XML-safe text","text"):r&&n.where!=="Before"&&n.where!=="After"?ee("unsupported-content","insertion needs Before or After","where"):null}function Vn(n,e,r,a){let i=chunkJP253KIZ_cjs.Ia(n.part),l=new Set;if(i.some(g=>g.revisionKind==="structural"))for(let g=chunkZFBNCHRP_cjs.Ha(n.part,e);g!==null&&(l.add(g.id),g.id!==n.root.id);g=chunkZFBNCHRP_cjs.Ha(n.part,g.id));return i.some(g=>{if(g.revisionKind==="structural"){let m=chunkJP253KIZ_cjs.wa(g),y=0;for(let I of m){let x=chunkZFBNCHRP_cjs.Ha(n.part,I),S=x&&chunkZFBNCHRP_cjs.Ha(n.part,x.id),k=S?.kind==="tableRow"?"trPr":S?.kind==="tableCell"?"tcPr":null;if(!(!S||!k||chunkZFBNCHRP_cjs.Ke(S,k)?.id!==x?.id)){if(l.has(S.id))return true;y+=1;}}if(m.length>0&&y===m.length)return false}return g.ranges.some(m=>{let y=n.indexOf(m.start.paragraphId),I=n.indexOf(m.end.paragraphId),x=n.indexOf(e);if(y<0||I<0||x<y||x>I)return false;let S=x===y?m.start.offset:0,k=x===I?m.end.offset:1/0;return r<=k&&a>=S})})?ee("unsupported-revision","proposal touches or overlaps a pending revision","span"):null}function Wn(n,e,r,a,i){let l=(B,G,X)=>({ok:false,error:{code:B,message:G,...X===void 0?{}:{detail:X}}}),f=B=>jt(B,r),g=B=>({ok:true,kind:"query",value:B}),m=Kn(n,e);if(m)return {ok:false,error:m};let y=n.op==="proposeInsertion",I=n.op==="proposeDeletion",x=V(n.span,r,a);if(!x.ok)return l(x.code,"that span is not a place",x.detail);let S=x.value;if(!S||S.start.paragraphId!==S.end.paragraphId)return l("unsupported-content","proposals require a single paragraph range","span");if(!e&&!y&&S.start.offset===S.end.offset)return l("unsupported-content","deletion and replacement need a non-empty range","span");let k=q(n.span,r,a);if(!k.ok)return l(k.code,"that story is not a place",k.detail);let A=S.start.paragraphId,b=y&&n.where==="After"?S.end.offset:S.start.offset,C=y?b:S.end.offset;if(e&&!I&&b===C&&n.text==="")return g({kind:"span",span:f({start:S.start,end:S.start})});let w=Vn(k.value,A,b,C);if(w)return {ok:false,error:w};let L=i(k.value,A);if(L)return L;let _={author:n.author.trim(),date:new Date().toISOString()},z=[];return !y&&C>b&&z.push({op:"deleteText",paragraphId:A,start:b,end:C,revision:_}),!I&&n.text.length>0&&z.push({op:"insertText",paragraphId:A,offset:y?b:C,text:n.text,revision:_}),{ok:true,kind:"command",ops:z,story:k.value.story,answer:()=>{if(!e)return {kind:"applied"};let B={...S.start,offset:y?b:C};return {kind:"span",span:f({start:B,end:{...B,offset:B.offset+(I?0:n.text.length)}})}}}}function zn(n,e,r){if("body"in n){let a=U(n.body,"body",e,r);return a.ok?{ok:true,reads:a.value}:{ok:false,code:a.code,message:"that handle does not name a body",detail:a.detail}}return e.resolve(n.document,"document")?r.body?{ok:true,reads:r.body}:{ok:false,code:"document-unavailable",message:"this host holds no document"}:{ok:false,code:"invalid-handle",message:"that handle does not name a document",detail:"document"}}function $n(n,e){let r=n.op==="acceptAllRevisions",a=e.story.kind==="note"?{scopeRootId:e.root.id}:{};return [r?{op:"acceptAllRevisions",...a}:{op:"rejectAllRevisions",...a}]}var ur=/[\r\n\u2028\u2029]/u,Xn=Object.freeze({kind:"applied"});function Pt(n,e,r){return {ok:false,error:Object.freeze(r===void 0?{code:n,message:e}:{code:n,message:e,detail:r})}}function ve(n,e){return Pt("unsupported-content",n==="author"?"a comment records who wrote it":n==="date"?"a comment date must be a valid ISO-8601 instant":e==="reply"?"a reply says something":"a comment says something",n)}function xe(n){return chunkJP253KIZ_cjs.H(n.author)?ve("author",n.kind):chunkJP253KIZ_cjs.I(n.text)?ve("text",n.kind):typeof n.text=="string"&&ur.test(n.text)?Pt("unsupported-content",n.kind==="reply"?"a reply is one paragraph in this slice":"a comment is one paragraph in this slice","text"):chunkJP253KIZ_cjs.K(n.date)?ve("date",n.kind):null}function be(n){if(n===void 0)return;let e=chunkJP253KIZ_cjs.J(n);return e.ok?e.value:void 0}function Un(n,e){let r=chunkZFBNCHRP_cjs.Ga(n.part,e);for(;r;){if(r.kind==="tableCell"||r.kind!=="textValue"&&r.namespaceUri===chunkZFBNCHRP_cjs.da&&r.localName==="tc")return r.id;r=chunkZFBNCHRP_cjs.Ha(n.part,r.id);}return null}function Yn(n,e,r,a){let i=xe({author:n.author,text:n.text,date:n.date,kind:"comment"});if(i)return i;let l=V(n.span,e,r);if(!l.ok)return Pt(l.code,"that span is not a place",l.detail);if(l.value===null)return Pt("invalid-handle","an empty story has no comment anchor");let f=q(n.span,e,r);if(!f.ok)return Pt(f.code,"that span is not a place",f.detail);let g=l.value;if(Un(f.value,g.start.paragraphId)!==Un(f.value,g.end.paragraphId))return Pt("unsupported-content","a comment range cannot cross a table-cell boundary");let m=a(f.value);if(m)return m;let y=be(n.date);return {ok:true,kind:"commentWrite",write:{kind:"create",anchor:{paragraphId:g.start.paragraphId,start:g.start.offset,end:g.end.offset,...g.end.paragraphId===g.start.paragraphId?{}:{endParagraphId:g.end.paragraphId}},text:n.text,author:n.author,...y===void 0?{}:{date:y}},story:f.value.story,answer:(x,S)=>S===void 0?Xn:{kind:"handle",handle:e.comment(S,f.value.story)}}}function Gn(n,e,r){let a=r(e);if(a)return a;let i=e.story;return {ok:true,kind:"commentWrite",write:{kind:"delete",commentId:n.id,...n.parentId===void 0?{}:{parentCommentId:n.parentId},...i.kind==="note"?{noteId:i.noteId}:{}},story:i,answer:()=>Xn}}var cr=1e4;function Jn(n,e){let r=[],a=e.kind==="contentControl"?chunkZFBNCHRP_cjs.Fc(e):e;if(!a)return r;for(let i of chunkZFBNCHRP_cjs.Jc(a))if(!(i.ancestors.length>0)){if(r.length>=cr)break;r.push(eo(n,i.node));}return r}function Qn(n,e){for(let r of chunkZFBNCHRP_cjs.Jc(n.root))if(r.node.id===e)return eo(n,r.node);return null}function Zn(n,e){for(let r of chunkZFBNCHRP_cjs.Jc(n.root))if(r.node.id===e)return r.node;return null}function qn(n,e){for(let r of n.paragraphIds){let a=n.node(r);if(!(!a||a.kind!=="paragraph")&&chunkZFBNCHRP_cjs.Jc(a).some(i=>i.node.id===e))return a}return null}function ne(n,e){let r=no(e);if(r.length>0){let l=r[0],f=r[r.length-1],g=n.rawText(f);return g===null||!n.has(l)?null:{start:{paragraphId:l,offset:0},end:{paragraphId:f,offset:g.length}}}let a=qn(n,e.id);if(!a)return null;let i=chunkZFBNCHRP_cjs.Ne(a).spanOf(e);return i?{start:{paragraphId:a.id,offset:i.start},end:{paragraphId:a.id,offset:i.end}}:null}function pr(n,e,r){let a=qn(n,e.id),i=chunkZFBNCHRP_cjs.Fc(e);if(!a||!i)return null;let l={...a,children:i.children},f=chunkZFBNCHRP_cjs.Oh(l);return Zt(l,f,r).text}function to(n,e,r="allMarkup"){if(r==="allMarkup")return chunkZFBNCHRP_cjs.Lc(e);let a=pr(n,e,r);if(a!==null)return a;let i=ne(n,e);if(!i)return "";let l=n.indexOf(i.start.paragraphId),f=n.indexOf(i.end.paragraphId);if(l<0||f<l)return "";let g=[];for(let m=l;m<=f;m+=1){let y=n.paragraphIds[m],I=n.projectedText(y,r),x=n.rawText(y);if(!I||x===null)return "";g.push(I.sliceRaw(m===l?i.start.offset:0,m===f?i.end.offset:x.length));}return g.join("\r")}function eo(n,e){return {nodeId:e.id,properties:chunkZFBNCHRP_cjs.Hc(e),lock:chunkZFBNCHRP_cjs.oh(n.part,e.id),paragraphIds:no(e)}}function no(n){let e=chunkZFBNCHRP_cjs.Fc(n);if(!e)return [];let r=[];return chunkZFBNCHRP_cjs.Ad(e.children,r,0),r.map(a=>a.id)}function Ie(n){let e=n.kind==="contentControl"?chunkZFBNCHRP_cjs.Fc(n):n;return e?chunkZFBNCHRP_cjs.Jc(e).map(r=>r.node):[]}var oo=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),ro=new Set(["whole","content","start","end","before","after"]),ao=new Set(["richText","plainText","dropDownList","comboBox","date"]),mr=4096;function so(n){let e=(i,l)=>({ok:false,code:"unsupported-content",message:i,detail:l});if(typeof n!="object"||n===null||!("kind"in n))return e("a control value states its kind","value");let r=n,a=r.kind;if(a==="text"||a==="listItem"){let i=a==="text"?r.text:r.value;return typeof i!="string"?e("that value is not a string",String(a)):i.length>mr?e("that value is too long",String(i.length)):{ok:true,value:a==="text"?{kind:"text",text:i}:{kind:"listItem",value:i}}}if(a==="checkbox"){let i=r.checked;return typeof i!="boolean"?e("a checkbox is checked or not","checked"):{ok:true,value:{kind:"checkbox",checked:i}}}if(a==="date"){let i=r.iso;return typeof i!="string"?e("a date is an ISO-8601 string","iso"):i.length>64?e("that is not a date",String(i.length)):{ok:true,value:{kind:"date",iso:i}}}return e("that is not a value any control accepts",String(a))}var fr=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),yr=4096,io=64;function lo(n){if(n===void 0)return {ok:true,value:null};if(typeof n!="object"||n===null)return {ok:false,field:"payload"};let e=n;for(let r of ["namespaceUri","rootLocalName","nodeId"]){let a=e[r];if(typeof a!="string"||a.length===0||a.length>yr)return {ok:false,field:r}}return typeof e.label!="string"||e.label.length>chunkJP253KIZ_cjs.V?{ok:false,field:"label"}:typeof e.data!="string"||e.data.length===0||e.data.length>chunkJP253KIZ_cjs.U?{ok:false,field:"data"}:{ok:true,value:{namespaceUri:e.namespaceUri,rootLocalName:e.rootLocalName,nodeId:e.nodeId,label:e.label,data:e.data}}}function uo(n){let e=n.at!==void 0,r=n.span!==void 0;return e===r?{message:"a custom node goes at a position or over a span, not both",detail:e?"at+span":"no-place"}:typeof n.tag!="string"||n.tag.length===0?{message:"a custom node carries its identity in its tag",detail:"tag"}:n.tag.length>io?{message:`w:tag caps at ${String(io)} characters; a longer payload belongs in the store`,detail:"tag"}:typeof n.text!="string"||n.text.length===0?{message:"a custom node shows some text",detail:"text"}:n.lock!==void 0&&!fr.has(n.lock)?{message:"that is not a lock",detail:String(n.lock)}:null}function co(n,e,r,a){return {paragraphId:e.paragraphId,offset:e.offset,...r.offset>e.offset?{replaceUntil:r.offset}:{},tag:n.tag,text:n.text,...n.title===void 0?{}:{alias:n.title},...n.lock===void 0||n.lock==="unlocked"?{}:{lock:n.lock},...a===null?{}:{payload:a}}}function po(n,e,r){if(n.span){let i=V(n.span,e,r);return i.ok?i.value?i.value.start.paragraphId!==i.value.end.paragraphId?{code:"unsupported-content",message:"a custom node wraps text inside one paragraph",detail:"multi-paragraph"}:{range:i.value}:{code:"invalid-offset",message:"that story holds nothing to wrap",detail:"empty-story"}:{code:i.code,message:"that span is not a place",detail:i.detail}}let a=Ct(n.at,e,r);return a.ok?{range:{start:a.value,end:a.value}}:{code:a.code,message:"that is not a place",detail:a.detail}}var _t=/[\r\n\v\f\u2028\u2029]/,gr=16,hr=64,mo=/\s/;function kr(n,e,r){return Object.freeze(r===void 0?{code:n,message:e}:{code:n,message:e,detail:r})}function d(n,e,r){return {ok:false,error:kr(n,e,r)}}var D=Object.freeze({kind:"applied"});function O(n){return {ok:true,kind:"query",value:n}}function Ar(n,e){let r=[],a=0;for(;a<n.length;){let i=null;for(let l of e){let f=n.indexOf(l,a);f<0||(!i||f<i.start||f===i.start&&l.length>i.length)&&(i={start:f,length:l.length});}if(!i)break;r.push(i),a=i.start+i.length;}return r}function vr(n,e,r){let a=e[r]?.markParagraphId??null;if(a!==null)return a;let i=n.paragraphIds,l=i[i.length-1];return l===void 0||new Set(e.map(g=>g.markParagraphId).filter(g=>g!==null)).has(l)?null:l}function xr(n,e){for(let r of [n.start,n.end]){let a=e.rawText(r.paragraphId);if(a===null||r.offset>a.length)return false}return true}function br(n,e,r){let a=e,i=r;for(;a<i&&mo.test(n[a]);)a+=1;for(;i>a&&mo.test(n[i-1]);)i-=1;return [a,i]}function fo(n){let{handles:e,capabilities:r}=n,a=n.reads,i=new Map,l=o=>{let u=K(o.story),p=i.get(u);if(p)return p;let t=new Map,s=o.paragraphIds.map(h=>{let v={id:h};return t.set(h,v),v}),c={reads:o,order:s,slotById:t,created:[],restructured:new Set,touched:new Set,formatted:new Set,selected:new Set,retargets:[]};return i.set(u,c),c},f=[],g=Cn(),m=null,y=o=>m===null?(m=o,null):m===o?null:d("conflicting-operations","one batch writes into one story",`${K(m.reads.story)} then ${K(o.reads.story)}`),I=o=>y(l(o)),x=o=>{let u=a.package;return u===null?null:Dn(u,o)},S=o=>{let u=e.resolve(o,"comment");if(!u||u.kind!=="comment")return {ok:false,planned:d("invalid-handle","that handle does not name a comment","comment")};let p=a.story(u.story);if(!p)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let s=x(p)?.byId(u.commentId)??null;return s?{ok:true,reads:p,item:s}:{ok:false,planned:d("invalid-handle","this document no longer holds that comment",u.commentId)}},k=o=>{let u=e.resolve(o,"revision");if(!u||u.kind!=="revision")return {ok:false,planned:d("invalid-handle","that handle does not name a tracked change","revision")};let p=a.story(u.story);if(!p)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let t=Ae(p).find(s=>s.id===u.revisionId)??null;return t?{ok:true,reads:p,item:t}:{ok:false,planned:d("invalid-handle","this document no longer holds that tracked change",u.revisionId)}},A=(o,u)=>{let p=o.rawText(u.start.paragraphId),t=o.rawText(u.end.paragraphId);if(p===null||t===null)return null;let s={story:o.story,paragraphId:u.start.paragraphId,index:o.indexOf(u.start.paragraphId),offset:Math.min(u.start.offset,p.length)},c={story:o.story,paragraphId:u.end.paragraphId,index:o.indexOf(u.end.paragraphId),offset:Math.min(u.end.offset,t.length)};return B({start:s,end:c})},b=(o,u)=>o.order.indexOf(u),C=(o,u)=>o.selected.has(u)?d("conflicting-operations","this batch selects a paragraph it also edits",u):null,w=(o,u)=>{let p=C(o,u);return p||(o.restructured.has(u)||o.touched.has(u)?d("conflicting-operations","another operation in this batch already changes that paragraph",u):(o.restructured.add(u),o.touched.add(u),null))},L=(o,u)=>{let p=C(o,u);return p||(o.restructured.has(u)?d("conflicting-operations","another operation in this batch restructures that paragraph",u):(o.touched.add(u),null))},_=(o,u,p)=>{let t=`${p}:${u}`;if(o.formatted.has(t))return d("conflicting-operations","another operation in this batch already writes that formatting",u);let s=L(o,u);return s||(o.formatted.add(t),null)},z=(o,u)=>{let p={id:null};return o.order.splice(u,0,p),o.created.push(p),p},B=o=>jt(o,e),G=o=>o===null?null:a.story(o.start.story),X=o=>o===void 0||o==="allMarkup"||o==="original"||o==="model",it=(o,u,p,t)=>{if(!X(t?.projection))return d("unsupported-content","unknown text projection","projection");if(t?.matchWildcards===true)return d("unsupported-capability","wildcard search is not implemented","matchWildcards");if(t?.ignorePunct===true)return d("unsupported-capability","ignoring punctuation is not implemented","ignorePunct");if(t?.ignoreSpace===true)return d("unsupported-capability","ignoring whitespace is not implemented","ignoreSpace");if(!chunkJP253KIZ_cjs.Ra(p))return d("unsupported-content","that is not a query this host will scan for","text");let s=t?.limit;if(s!==void 0&&(!Number.isInteger(s)||s<0))return d("invalid-offset","limit must be a non-negative integer",String(s));let c=Fn(o,u,e,p,t);return O({kind:"spans",spans:c.spans})},xt=(o,u,p)=>{if(typeof p!="string")return d("unsupported-content","insertText needs text","text");if(_t.test(p))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let t=y(o);if(t)return t;let s=L(o,u.paragraphId);if(s)return s;let c=p.length===0?[]:[{op:"insertText",paragraphId:u.paragraphId,offset:u.offset,text:p}],h=()=>({kind:"span",span:B({start:u,end:{...u,offset:u.offset+p.length}})});return {ok:true,kind:"command",ops:c,story:o.reads.story,answer:h}},$=(o,u,p)=>{let t=o.reads;if(typeof p!="string")return d("unsupported-content","replaceSpan needs text","text");if(_t.test(p))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let s=at(u,t),c=u.start.paragraphId,h=[],v=y(o);if(v)return v;if(s.length===1){let j=L(o,c);if(j)return j;u.end.offset>u.start.offset&&h.push({op:"deleteText",paragraphId:c,start:u.start.offset,end:u.end.offset});}else {for(let E of s){let M=w(o,E);if(M)return M}let j=u.end.paragraphId,dt=(t.rawText(c)??"").length;u.start.offset<dt&&h.push({op:"deleteText",paragraphId:c,start:u.start.offset,end:dt}),u.end.offset>0&&h.push({op:"deleteText",paragraphId:j,start:0,end:u.end.offset});for(let E of s.slice(1,-1))h.push({op:"deleteBlock",blockId:E});h.push({op:"joinParagraphs",firstId:c,secondId:j});for(let E of s.slice(1)){let M=o.slotById.get(E);M&&o.order.splice(b(o,M),1);}}let R=s.length===1?u.end.offset:(t.rawText(c)??"").length,T=n.replacementLanding?.(c,u.start.offset,R)??u.start.offset;p.length>0&&h.push({op:"insertText",paragraphId:c,offset:T,text:p});let W={...u.start,paragraphId:c,offset:T},H=()=>({kind:"span",span:B({start:W,end:{...W,offset:W.offset+p.length}})});return {ok:true,kind:"command",ops:h,story:o.reads.story,answer:H}},bt=(o,u)=>{let p=o.reads;if(typeof u!="string")return d("unsupported-content","replaceSpan needs text","text");if(_t.test(u))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let t=p.blocks,s=t.filter(E=>E.removable),c=t.filter(E=>!E.removable).flatMap(E=>E.paragraphIds),h=c.length===0?s.find(E=>E.kind==="paragraph"):void 0;if(!h&&c.length===0)return d("invalid-offset","that story holds no paragraph this host can write into","no-top-level-paragraph");let v=y(o);if(v)return v;for(let E of p.paragraphIds){let M=w(o,E);if(M)return M}let R=[],P=(h?[h.id]:[...c]).sort((E,M)=>p.indexOf(E)-p.indexOf(M)),T=P[0],W=(p.rawText(T)??"").length;for(let E of P){let M=(p.rawText(E)??"").length;M>0&&R.push({op:"deleteText",paragraphId:E,start:0,end:M});}for(let E of s)E.id!==h?.id&&R.push({op:"deleteBlock",blockId:E.id});let H=n.replacementLanding?.(T,0,W)??0;u.length>0&&R.push({op:"insertText",paragraphId:T,offset:H,text:u});for(let E of s)if(E.id!==h?.id)for(let M of E.paragraphIds){let ot=o.slotById.get(M);ot&&o.order.splice(b(o,ot),1);}let j={story:p.story,paragraphId:T,index:p.indexOf(T),offset:H},dt=()=>({kind:"span",span:B({start:j,end:{...j,offset:H+u.length}})});return {ok:true,kind:"command",ops:R,story:p.story,answer:dt}},gt=(o,u)=>{if(!Array.isArray(u)||u.length<1||u.length>1e4||u.some(t=>typeof t!="string"||_t.test(t)||!chunkZFBNCHRP_cjs.O(t)))return d("unsupported-content","replaceStoryBlocks needs 1-10000 valid XML text strings without paragraph marks","paragraphs");let p=y(o);if(p)return p;for(let t of o.reads.paragraphIds){let s=w(o,t);if(s)return s}o.order.splice(0,o.order.length);for(let t=0;t<u.length;t+=1)z(o,t);return {ok:true,kind:"command",ops:[{op:"replaceStoryBlocks",storyRootId:o.reads.root.id,paragraphs:u}],story:o.reads.story,answer:()=>D}},Tt=(o,u,p,t)=>{let s=o.reads;if(typeof t!="string")return d("unsupported-content","insertParagraph needs text","text");if(_t.test(t))return d("unsupported-content","a paragraph mark inside a paragraph\u2019s text is not written by this host","paragraph-mark-in-text");let c=y(o);if(c)return c;let h=w(o,u.paragraphId);if(h)return h;let v=o.slotById.get(u.paragraphId);if(!v)return d("invalid-handle","that paragraph is not in the body");let R=(s.rawText(u.paragraphId)??"").length,P=[];p==="after"?(t.length>0&&P.push({op:"insertText",paragraphId:u.paragraphId,offset:R,text:t}),P.push({op:"splitParagraph",paragraphId:u.paragraphId,offset:R})):(t.length>0&&P.push({op:"insertText",paragraphId:u.paragraphId,offset:0,text:t}),P.push({op:"splitParagraph",paragraphId:u.paragraphId,offset:t.length}));let T=z(o,b(o,v)+1);p==="before"&&o.retargets.push({from:u.paragraphId,slot:T});let W=()=>{let H=p==="after"?T.id:u.paragraphId;return H===null?D:{kind:"handle",handle:e.paragraph(H,s.story)}};return {ok:true,kind:"command",ops:P,story:s.story,answer:W}},wt=(o,u,p,t,s)=>{let c=o.reads;if(!Array.isArray(p)||p.length===0)return d("unsupported-content","split needs at least one delimiter","delimiters");if(p.length>gr)return d("unsupported-content","too many delimiters",String(p.length));for(let M of p){if(typeof M!="string"||M.length===0)return d("unsupported-content","a delimiter must be a non-empty string","delimiters");if(M.length>hr)return d("unsupported-content","that delimiter is too long","delimiters")}let h=y(o);if(h)return h;let v=w(o,u.paragraphId);if(v)return v;let R=o.slotById.get(u.paragraphId);if(!R)return d("invalid-handle","that paragraph is not in the body");let P=c.rawText(u.paragraphId)??"",T=Ar(P,p),W=[],H=[],j=[];if(T.length===0)j.push(P);else if(t){for(let J of [...T].reverse())W.push({op:"deleteText",paragraphId:u.paragraphId,start:J.start,end:J.start+J.length});let M=0,ot=0;for(let J of T){let oe=J.start-M;H.push(oe),j.push(P.slice(ot,J.start)),ot=J.start+J.length,M+=J.length;}j.push(P.slice(ot));}else {let M=0;for(let ot of T){let J=ot.start+ot.length;H.push(J),j.push(P.slice(M,J)),M=J;}j.push(P.slice(M));}H.length>0&&W.push({op:"splitParagraphMany",paragraphId:u.paragraphId,offsets:H});let dt=[R];for(let M=0;M<H.length;M+=1)dt.push(z(o,b(o,R)+1+M));let E=M=>{let ot=M.story(c.story),J=[];return dt.forEach((oe,Ao)=>{let re=oe.id;if(re===null)return;let ae=ot?.rawText(re)??j[Ao]??"",[vo,xo]=s?br(ae,0,ae.length):[0,ae.length],Pe=e.paragraph(re,c.story);J.push({start:{paragraph:Pe,offset:vo},end:{paragraph:Pe,offset:xo}});}),{kind:"spans",spans:J}};return {ok:true,kind:"command",ops:W,story:c.story,answer:E}},Ft=(o,u)=>{let p=y(o);if(p)return p;let t=w(o,u.paragraphId);if(t)return t;let s=o.slotById.get(u.paragraphId);return s&&o.order.splice(b(o,s),1),{ok:true,kind:"command",ops:[{op:"deleteBlock",blockId:u.paragraphId}],story:o.reads.story,answer:()=>D}},Se=(o,u,p)=>{let t=o.reads,s=t.part,c=y(o);if(c)return c;let h=Sn(p??{});if(!h.ok)return d("unsupported-content","that is not formatting this host writes",h.detail);let v=[];for(let R of ye(u,t)){if(R.end<=R.start&&!R.whole)continue;let P=_(o,R.paragraphId,"runs");if(P)return P;for(let T of chunkJP253KIZ_cjs.ra(s,R.paragraphId,R.start,R.end,h.value,n.displayMode))v.push({op:"setRunProperties",paragraphId:R.paragraphId,start:T.start,end:T.end,properties:T.properties,...T.targetRunIds?{targetRunIds:T.targetRunIds}:{}});R.whole&&v.push({op:"setParagraphMarkProperties",paragraphId:R.paragraphId,properties:chunkJP253KIZ_cjs.qa(s,R.paragraphId,h.value)});}return v.length===0?d("invalid-offset","that range covers no characters to format","collapsed-range"):{ok:true,kind:"command",ops:v,story:t.story,answer:()=>D}},N=(o,u,p)=>{let t=o.reads,s=t.part,c=y(o);if(c)return c;let h=Jt(p,t.styles());if(!h.ok)return d("unsupported-content","that is not a style this document has",h.detail);let v={localName:"pStyle",attributes:{val:h.styleId}},R=[];for(let P of at(u,t)){let T=_(o,P,"paragraph");if(T)return T;R.push({op:"setParagraphProperties",paragraphId:P,properties:chunkJP253KIZ_cjs.la(chunkJP253KIZ_cjs.ja(s,P),v)});}return R.length===0?d("invalid-offset","that story holds no paragraph to style","empty-story"):{ok:true,kind:"command",ops:R,story:t.story,answer:()=>D}},It=(o,u,p)=>{let t=o.reads,s=t.part,c=y(o);if(c)return c;let h=Rn(s,u.paragraphId,p??{},t.styles());if(!h.ok)return d("unsupported-content","that is not paragraph formatting this host writes",h.detail);let v=_(o,u.paragraphId,"paragraph");return v||{ok:true,kind:"command",ops:[{op:"setParagraphProperties",paragraphId:u.paragraphId,properties:h.value}],story:t.story,answer:()=>D}},ft=(o,u)=>{let p=a.body;if(!p)return d("document-unavailable","this host holds no document right now");let t=a.sections();if(!t[o])return d("invalid-handle","that section is not in this document");let c=On(u);if(!c.ok)return d("unsupported-content",c.reason,c.detail);let h=vr(p,t,o);if(h===null)return d("unsupported-content","that section holds no paragraph to address it by","no-anchor");let v=l(p),R=y(v);return R||{ok:true,kind:"command",ops:[{op:"setSectionProperties",...c.value,anchorParagraphId:h}],story:yt,answer:()=>D}},Y=(o,u)=>({ok:true,kind:"command",ops:[{op:"deleteNote",noteKind:o,noteId:u}],story:yt,lifecycle:true,answer:()=>D}),nt=o=>{let u=e.resolve(o,"list");if(!u||u.kind!=="list")return d("invalid-handle","that handle does not name a list","list");let p=a.story(u.story);if(!p)return d("invalid-handle","that story is not in this document");let t=te(p).find(s=>s.numId===u.numId);return t?{ok:true,plan:l(p),list:t}:d("invalid-handle","this story numbers nothing with that list",u.numId)},Nt=o=>{if(typeof o!="object"||o===null)return d("invalid-handle","that is not a scope a control lives in","scope");let u=o;if("body"in o){let p=U(u.body,"body",e,a);return p.ok?{reads:p.value,node:p.value.root}:d(p.code,"that handle does not name a body",p.detail)}if("contentControl"in o){let p=Z(u.contentControl);return "control"in p?{reads:p.reads,node:p.node}:p}return d("invalid-handle","that is not a scope a control lives in","scope")},Z=o=>{let u=e.resolve(o,"contentControl");if(!u||u.kind!=="contentControl")return d("invalid-handle","that handle does not name a content control","contentControl");let p=a.story(u.story);if(!p)return d("invalid-handle","that story is not in this document");let t=Qn(p,u.nodeId),s=Zn(p,u.nodeId);return !t||!s?d("invalid-handle","this document no longer holds that content control"):{reads:p,control:t,node:s}},yo=(o,u,p)=>{if(!Number.isInteger(p)||p<0||p>Ot)return d("invalid-offset",`a list level is 0 to ${String(Ot)}`,String(p));if(!Bt(o.reads,u))return d("unsupported-content","that paragraph is not in a list",u);let t=y(o);if(t)return t;let s=_(o,u,"paragraph");return s||{ok:true,kind:"command",ops:[{op:"setListLevel",paragraphId:u,level:p}],story:o.reads.story,answer:()=>D}},go=(o,u,p,t)=>{if(p!=="start"&&p!=="end")return d("unknown-operation","a list takes an item at its start or its end",String(p));let s=o.reads,c=p==="start"?u.paragraphIds[0]:u.paragraphIds[u.paragraphIds.length-1];if(c===void 0)return d("invalid-handle","that list holds no paragraph");let h={story:s.story,paragraphId:c,index:s.indexOf(c)};return Tt(o,h,p==="start"?"before":"after",t)},Re=(o,u)=>{if(u.start.paragraphId!==u.end.paragraphId)return null;for(let p of En(o,u.start.paragraphId))if(p.start<=u.start.offset&&p.end>=u.end.offset)return p;return null},ho=(o,u,p)=>{if(typeof p!="string")return d("unsupported-content","a hyperlink target is a string","target");let t=o.reads,s=Re(t,u),c=u.start.paragraphId===u.end.paragraphId&&u.start.offset===u.end.offset;if(p.length===0){if(!s)return d("unsupported-content","that text is not a link","no-link");let H=y(o);if(H)return H;let j=L(o,s.paragraphId);return j||{ok:true,kind:"command",ops:[{op:"removeHyperlink",linkId:s.id}],story:t.story,answer:()=>D}}let h={},v=null;if(p.startsWith("#")){let H=p.slice(1);if(H.length===0||!ke(t,H))return d("unsupported-content","this document declares no such bookmark",p);h={anchor:H};}else {if(chunkZFBNCHRP_cjs.nf(p)===null)return d("unsupported-content","this engine will not author that target","target");v=p;}let R=y(o);if(R)return R;let P=H=>v===null?{ok:true,kind:"command",ops:[H(h)],story:t.story,answer:()=>D}:{ok:true,kind:"command",ops:[],relate:{url:v,ops:j=>[H({relationshipId:j})]},story:t.story,answer:()=>D};if(s){let H=L(o,s.paragraphId);return H||P(j=>({op:"setHyperlinkTarget",linkId:s.id,...j}))}if(c)return d("unsupported-content","a link with no text has nothing to click","collapsed");if(u.start.paragraphId!==u.end.paragraphId)return d("unsupported-content","a link lives inside one paragraph","crosses-paragraph-mark");let T=L(o,u.start.paragraphId);if(T)return T;let W=t.styles().idOf("hyperlink");return P(H=>({op:"insertHyperlink",paragraphId:u.start.paragraphId,start:u.start.offset,end:u.end.offset,...H,...W===null?{}:{styleId:W}}))},Ce=(o,u,p)=>{let t=o.reads;if(!r.selection||!n.select)return d("unsupported-capability","this host has no reader to move","selection");if(p!=="select"&&p!=="start"&&p!=="end")return d("unknown-operation","that is not a selection mode",String(p));let s=at(u,t);for(let c of s)if(o.touched.has(c))return d("conflicting-operations","this batch edits a paragraph the selection covers",c);for(let c of s)o.selected.add(c);return f.push({range:u,mode:p}),{ok:true,kind:"command",ops:[],story:t.story,answer:()=>D}},Oe=o=>{let u=e.resolve(o,"bookmark");if(!u||u.kind!=="bookmark")return d("invalid-handle","that handle does not name a bookmark","bookmark");let p=a.story(u.story);if(!p)return d("invalid-handle","that story is not in this document");let t=ke(p,u.name);if(!t)return d("invalid-handle","this document no longer declares that bookmark",u.name);let s=c=>({story:p.story,paragraphId:c.paragraphId,index:p.indexOf(c.paragraphId),offset:c.offset});return {reads:p,range:{start:s(t.start),end:s(t.end)}}},ko=(o,u)=>{let p=u!==void 0;switch(p&&o.op==="insertText"?o={op:"proposeInsertion",span:{start:o.at,end:o.at},text:o.text,where:"Before",author:u}:p&&o.op==="replaceSpan"&&(o={op:"proposeReplacement",span:o.span,text:o.text,author:u}),o.op){case "getDocument":return O({kind:"handle",handle:e.document()});case "getBody":return e.resolve(o.document,"document")?a.body?O({kind:"handle",handle:e.body(yt)}):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=U(o.body,"body",e,a);return t.ok?O({kind:"handles",handles:t.value.paragraphIds.map(s=>e.paragraph(s,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getSpanParagraphs":{let t=V(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.span,e,a);return s.ok?O({kind:"handles",handles:at(t.value,s.value).map(c=>e.paragraph(c,s.value.story))}):d(s.code,"that span is not a place",s.detail)}case "getText":{if(!X(o.projection))return d("unsupported-content","unknown text projection","projection");if(e.resolve(o.target,"body")){let h=U(o.target,"body",e,a);return h.ok?O({kind:"text",text:h.value.text(o.projection??"allMarkup")}):d(h.code,"that handle does not name a body",h.detail)}let s=et(o.target,e,a);if(!s.ok)return d(s.code,"that handle does not name a body or a paragraph",s.detail);let c=a.story(s.value.story);return O({kind:"text",text:c?.paragraphText(s.value.paragraphId,o.projection??"allMarkup")??""})}case "getSpanText":{if(!X(o.projection))return d("unsupported-content","unknown text projection","projection");let t=V(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.span,e,a);return s.ok?O({kind:"text",text:Mn(t.value,s.value,fe,o.projection??"allMarkup")}):d(s.code,"that span is not a place",s.detail)}case "getParagraphId":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let c=a.story(t.value.story)?.paragraph(t.value.paragraphId);return O({kind:"text",text:c?.paraId??""})}case "search":{let t=V(o.scope,e,a);if(!t.ok)return d(t.code,"that is not a scope to search",t.detail);let s=q(o.scope,e,a);return s.ok?it(s.value,t.value,o.text,o.options):d(s.code,"that is not a scope to search",s.detail)}case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":return Wn(o,p,e,a,(t,s)=>{let c=l(t);return y(c)??w(c,s)});case "insertText":{let t=Ct(o.at,e,a);if(!t.ok)return d(t.code,"that is not a place to insert at",t.detail);let s=a.story(t.value.story);return s?xt(l(s),t.value,o.text):d("invalid-handle","that story is not in this document")}case "replaceSpan":{if("body"in o.span){let c=U(o.span.body,"body",e,a);return c.ok?bt(l(c.value),o.text):d(c.code,"that handle does not name a body",c.detail)}let t=V(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 s=G(t.value);return s?$(l(s),t.value,o.text):d("invalid-handle","that story is not in this document")}case "replaceStoryBlocks":{let t=U(o.body,"body",e,a);return t.ok?gt(l(t.value),o.paragraphs):d(t.code,"that handle does not name a body",t.detail)}case "insertParagraph":{let t=qt(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 s=a.story(t.value.story);return s?Tt(l(s),t.value,o.where,o.text):d("invalid-handle","that story is not in this document")}case "splitParagraph":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let s=a.story(t.value.story);return s?wt(l(s),t.value,o.delimiters,o.trimDelimiters===true,o.trimSpacing===true):d("invalid-handle","that story is not in this document")}case "getFont":{let t=V(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.span,e,a);if(!s.ok)return d(s.code,"that span is not a place",s.detail);let c=ye(t.value,s.value);return O({kind:"font",font:bn(s.value.part,c,n.displayMode)})}case "setFont":{let t=V(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 s=G(t.value);return s?Se(l(s),t.value,o.font):d("invalid-handle","that story is not in this document")}case "getStyle":{let t=V(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.span,e,a);if(!s.ok)return d(s.code,"that span is not a place",s.detail);let c=s.value.part,h=s.value.styles(),v=at(t.value,s.value).map(P=>Gt(c,P,h)),R=v.length>0&&v.every(P=>P!==null&&P===v[0])?v[0]:null;return O({kind:"style",name:R})}case "setStyle":{let t=V(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 s=G(t.value);return s?N(l(s),t.value,o.name):d("invalid-handle","that story is not in this document")}case "getParagraphFormat":{let t=qt(o.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let s=a.story(t.value.story);if(!s)return d("document-unavailable","this host holds no document right now");let c=In(s.part,t.value.paragraphId,s.styles());return c?O({kind:"paragraphFormat",format:c}):d("invalid-handle","that handle does not name a paragraph")}case "setParagraphFormat":{let t=qt(o.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let s=a.story(t.value.story);return s?It(l(s),t.value,o.format):d("invalid-handle","that story is not in this document")}case "deleteParagraph":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let s=a.story(t.value.story);return s?Ft(l(s),t.value):d("invalid-handle","that story is not in this document")}case "getSections":return e.resolve(o.document,"document")?O({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 s=a.sections()[t.index];return s?O({kind:"pageSetup",setup:s.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"):ft(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 s={kind:o.kind,sectionIndex:t.index,variant:o.variant};return hn(s)?a.story(s)?O({kind:"handle",handle:e.body(s)}):d("invalid-handle","this document declares no such header or footer",K(s)):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,s=a.noteIds(t);return s.ok?O({kind:"handles",handles:s.ids.map(c=>e.note(t,c))}):d("ambiguous-document",`${t} identities are not completely and unambiguously enumerable`,s.reason==="duplicates"?s.duplicateIds.join(","):s.reason)}case "getNoteBody":case "getNoteText":{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 s=t,c=a.story(s);return c?o.op==="getNoteText"?O({kind:"text",text:c.text(o.projection)}):O({kind:"handle",handle:e.body(s)}):d("invalid-handle","that note is not in this document",K(s))}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"):O({kind:"text",text:t.noteKind})}case "deleteNote":{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 s=a.noteIds(t.noteKind);return s.ok?s.ids.includes(t.noteId)?Y(t.noteKind,t.noteId):d("invalid-handle","that note is not in this document"):d("ambiguous-document",`${t.noteKind} identities are not completely and unambiguously enumerable`,s.reason==="duplicates"?s.duplicateIds.join(","):s.reason)}case "getLists":{let t=U(o.body,"body",e,a);return t.ok?O({kind:"handles",handles:te(t.value).map(s=>e.list(s.numId,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getListId":{let t=nt(o.list);return "list"in t?O({kind:"number",value:Number(t.list.numId)}):t}case "getListById":{let t=U(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 s=String(o.id),c=te(t.value).find(h=>h.numId===s);return c?O({kind:"handle",handle:e.list(c.numId,t.value.story)}):d("invalid-handle","no list in that story carries that number",s)}case "getListParagraphs":{let t=nt(o.list);if(!("list"in t))return t;let s=o.level;if(s!==void 0&&(!Number.isInteger(s)||s<0||s>Ot))return d("invalid-offset",`a list level is 0 to ${String(Ot)}`,String(s));let c=t.plan.reads,h=s===void 0?t.list.paragraphIds:t.list.paragraphIds.filter(v=>Bt(c,v)?.level===s);return O({kind:"handles",handles:h.map(v=>e.paragraph(v,c.story))})}case "getParagraphList":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let s=a.story(t.value.story);if(!s)return d("invalid-handle","that story is not in this document");let c=Bt(s,t.value.paragraphId);return c?O({kind:"handle",handle:e.list(c.numId,s.story)}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "getListLevel":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let s=a.story(t.value.story);if(!s)return d("invalid-handle","that story is not in this document");let c=Bt(s,t.value.paragraphId);return c?O({kind:"number",value:c.level}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "setListLevel":{let t=et(o.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let s=a.story(t.value.story);return s?yo(l(s),t.value.paragraphId,o.level):d("invalid-handle","that story is not in this document")}case "insertListParagraph":{let t=nt(o.list);return "list"in t?go(t.plan,t.list,o.where,o.text):t}case "getHyperlink":{let t=V(o.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.span,e,a);if(!s.ok)return d(s.code,"that span is not a place",s.detail);let c=a.package;if(!c||!t.value)return O({kind:"text",text:""});let h=Re(s.value,t.value);if(!h)return O({kind:"text",text:""});let v=chunkZFBNCHRP_cjs.Ga(s.value.part,h.id),R=v?jn(c,s.value.part.name,v):null;return O({kind:"text",text:R??""})}case "setHyperlink":{let t=V(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 s=G(t.value);return s?ho(l(s),t.value,o.target):d("invalid-handle","that story is not in this document")}case "getBookmarks":{let t=V(o.scope,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let s=q(o.scope,e,a);if(!s.ok)return d(s.code,"that span is not a place",s.detail);let c=s.value,h=t.value,v=h===null?null:new Set(at(h,c)),R=he(c).filter(P=>{if(!v||!v.has(P.start.paragraphId)&&!v.has(P.end.paragraphId)||h===null)return false;let T=P.start.paragraphId===h.end.paragraphId&&P.start.offset>h.end.offset,W=P.end.paragraphId===h.start.paragraphId&&P.end.offset<h.start.offset;return !T&&!W});return O({kind:"handles",handles:R.map(P=>e.bookmark(P.name,c.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"):O({kind:"text",text:t.name})}case "getBookmarkRange":{let t=Oe(o.bookmark);return "reads"in t?O({kind:"span",span:B(t.range)}):t}case "getComments":{let t=V(o.scope,e,a);if(!t.ok)return d(t.code,"that scope is not a place",t.detail);let s=q(o.scope,e,a);if(!s.ok)return d(s.code,"that scope names no story",s.detail);let c=s.value,h=x(c);if(!h)return d("document-unavailable","this host holds no document");let v=t.value,R=h.roots.filter(P=>{if(!v)return true;let T=P.range;if(!T)return false;let W=c.indexOf(T.start.paragraphId),H=c.indexOf(T.end.paragraphId),j=c.indexOf(v.start.paragraphId),dt=c.indexOf(v.end.paragraphId);return H<j||W>dt?false:H===j&&W===j&&dt===j?T.end.offset>v.start.offset&&T.start.offset<v.end.offset:true});return O({kind:"handles",handles:R.map(P=>e.comment(P.id,c.story))})}case "getCommentReplies":{let t=S(o.comment);return t.ok?O({kind:"handles",handles:t.item.replyIds.map(s=>e.comment(s,t.reads.story))}):t.planned}case "getCommentId":{let t=S(o.comment);return t.ok?O({kind:"text",text:t.item.id}):t.planned}case "getCommentAuthor":{let t=S(o.comment);return t.ok?O({kind:"text",text:t.item.comment.author}):t.planned}case "getCommentDate":{let t=S(o.comment);return t.ok?O({kind:"text",text:t.item.comment.date??""}):t.planned}case "getCommentText":{let t=S(o.comment);if(!t.ok)return t.planned;let s=x(t.reads);return O({kind:"text",text:s?.textOf(t.item.id)??""})}case "getCommentRange":{let t=S(o.comment);if(!t.ok)return t.planned;let s=t.item.range;if(!s||t.item.orphaned)return d("invalid-handle","that comment has no range in this document");let c=A(t.reads,s);return c?O({kind:"span",span:c}):d("invalid-handle","that comment\u2019s range is no longer in the story")}case "getCommentResolved":{let t=S(o.comment);return t.ok?O({kind:"flag",value:t.item.resolved}):t.planned}case "insertComment":return Yn(o,e,a,I);case "setCommentResolved":{let t=S(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 s=y(l(t.reads));return s||{ok:true,kind:"commentWrite",write:{kind:"resolve",commentId:t.item.id,resolved:o.resolved},story:t.reads.story,answer:()=>D}}case "replyToComment":{let t=S(o.comment);if(!t.ok)return t.planned;let s=xe({author:o.author,text:o.text,date:o.date,kind:"reply"});if(s)return s;let c=t.item.range;if(!c||t.item.orphaned)return d("invalid-handle","that comment has no range to reply over");let h=y(l(t.reads));if(h)return h;let v=t.reads.story,R=be(o.date);return {ok:true,kind:"commentWrite",write:{kind:"reply",parentCommentId:t.item.id,anchor:{paragraphId:c.start.paragraphId,start:c.start.offset,end:c.end.offset,...c.end.paragraphId===c.start.paragraphId?{}:{endParagraphId:c.end.paragraphId}},text:o.text,author:o.author,...R===void 0?{}:{date:R}},story:t.reads.story,answer:(P,T)=>T===void 0?D:{kind:"handle",handle:e.comment(T,v)}}}case "deleteComment":{let t=S(o.comment);return t.ok?Gn(t.item,t.reads,s=>y(l(s))):t.planned}case "getRevisions":{let t=U(o.body,"body",e,a);if(!t.ok)return d(t.code,"that handle does not name a body",t.detail);let s=t.value;return O({kind:"handles",handles:Ae(s).map(c=>e.revision(c.id,s.story))})}case "getRevisionType":{let t=k(o.revision);return t.ok?O({kind:"text",text:t.item.type}):t.planned}case "getRevisionAuthor":{let t=k(o.revision);return t.ok?O({kind:"text",text:t.item.author}):t.planned}case "getRevisionDate":{let t=k(o.revision);return t.ok?O({kind:"text",text:t.item.date}):t.planned}case "getRevisionRange":{let t=k(o.revision);if(!t.ok)return t.planned;let[s]=t.item.item.ranges;if(!s)return d("invalid-handle","that change covers no characters");let c=A(t.reads,s);return c?O({kind:"span",span:c}):d("invalid-handle","that change\u2019s range is no longer in the story")}case "acceptRevision":case "rejectRevision":{let t=k(o.revision);if(!t.ok)return t.planned;let s=l(t.reads),c=y(s);if(c)return c;let h=o.op==="acceptRevision";return {ok:true,kind:"command",story:t.reads.story,ops:t.item.item.addresses.map(v=>h?{op:"acceptRevision",revision:v}:{op:"rejectRevision",revision:v}),answer:()=>D}}case "acceptAllRevisions":case "rejectAllRevisions":{let t=zn(o,e,a);if(!t.ok)return d(t.code,t.message,t.detail);let s=l(t.reads),c=y(s);if(c)return c;let h=$n(o,t.reads);return {ok:true,kind:"command",story:t.reads.story,ops:h,answer:()=>D}}case "selectSpan":{let t=V(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 s=G(t.value);return s?Ce(l(s),t.value,o.mode):d("invalid-handle","that story is not in this document")}case "selectBookmark":{let t=Oe(o.bookmark);return "reads"in t?Ce(l(t.reads),t.range,o.mode):t}case "getContentControls":{let t=Nt(o.scope);return "reads"in t?O({kind:"handles",handles:Jn(t.reads,t.node).map(s=>e.contentControl(s.nodeId,t.reads.story))}):t}case "getContentControlById":{let t=Nt(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 s=Ie(t.node).find(c=>chunkZFBNCHRP_cjs.Hc(c).id===o.id);return s?O({kind:"handle",handle:e.contentControl(s.id,t.reads.story)}):d("invalid-handle","no control in that scope carries that id",String(o.id))}case "getContentControlsByTag":case "getContentControlsByTitle":{let t=Nt(o.scope);if(!("reads"in t))return t;let s=o.op==="getContentControlsByTag"?o.tag:o.title;if(typeof s!="string"||s.length===0)return d("unsupported-content","a tag or title to match is required",o.op);let c=Ie(t.node).filter(h=>{let v=chunkZFBNCHRP_cjs.Hc(h);return o.op==="getContentControlsByTag"?v.tag===s:v.alias===s});return O({kind:"handles",handles:c.map(h=>e.contentControl(h.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 s=t.control.properties;if(o.op==="getContentControlLock")return O({kind:"text",text:t.control.lock});if(o.op==="getContentControlSubtype")return O({kind:"text",text:s.type});if(o.op==="getContentControlFileId")return O({kind:"text",text:s.id===void 0?"":String(s.id)});let c=o.op==="getContentControlTag"?s.tag:s.alias;return O({kind:"text",text:c??""})}case "getContentControlIsBound":case "getContentControlPlaceholderShown":case "getContentControlTemporary":{let t=Z(o.contentControl);if(!("control"in t))return t;let s=o.op==="getContentControlIsBound"?t.control.properties.dataBinding!==void 0:o.op==="getContentControlPlaceholderShown"?t.control.properties.showingPlaceholder:t.control.properties.temporary;return O({kind:"flag",value:s})}case "getContentControlText":{let t=Z(o.contentControl);return "control"in t?O({kind:"text",text:to(t.reads,t.node,o.projection)}):t}case "getContentControlParagraphs":{let t=Z(o.contentControl);return "control"in t?O({kind:"handles",handles:t.control.paragraphIds.map(s=>e.paragraph(s,t.reads.story))}):t}case "getContentControlRange":{let t=Z(o.contentControl);if(!("control"in t))return t;let s=o.location??"whole";if(!ro.has(s))return d("unsupported-content","that is not a place in a control",s);let c=ne(t.reads,t.node);if(!c)return d("unsupported-content","that control holds nothing addressable","empty");let h=s==="start"||s==="before"?c.start:c.end,v=s!=="whole"&&s!=="content",R=P=>({story:t.reads.story,paragraphId:P.paragraphId,index:t.reads.indexOf(P.paragraphId),offset:P.offset});return O({kind:"span",span:jt(v?{start:R(h),end:R(h)}:{start:R(c.start),end:R(c.end)},e)})}case "setContentControlValue":{let t=Z(o.contentControl);if(!("control"in t))return t;let s=so(o.value);if(!s.ok)return d(s.code,s.message,s.detail);let c=l(t.reads),h=y(c);return h||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:s.value}],answer:()=>D}}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&&!oo.has(o.lock))return d("unsupported-content","that is not a lock this schema declares",o.lock);let s=l(t.reads),c=y(s);return c||{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:()=>D}}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 s=l(t.reads),c=y(s);if(c)return c;let h=ne(t.reads,t.node);if(!h)return d("unsupported-content","that control holds nothing addressable","empty");let v=o.at==="end"?h.end:h.start,R=()=>({kind:"span",span:B({start:{story:t.reads.story,paragraphId:v.paragraphId,index:t.reads.indexOf(v.paragraphId),offset:v.offset},end:{story:t.reads.story,paragraphId:v.paragraphId,index:t.reads.indexOf(v.paragraphId),offset:v.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:R}:{ok:true,kind:"command",story:t.reads.story,ops:o.text.length===0?[]:[{op:"insertText",paragraphId:v.paragraphId,offset:v.offset,text:o.text,inside:t.node.id}],answer:R}}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 s=l(t.reads),c=y(s);return c||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"removeContentControl",controlId:t.control.nodeId,keepContent:o.keepContent}],answer:()=>D}}case "insertContentControl":{let t=V(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 s=G(t.value);if(!s)return d("invalid-handle","that story is not in this document");let c=t.value;if(c.start.paragraphId!==c.end.paragraphId)return d("unsupported-content","wrapping several paragraphs in one control is not supported here","multi-paragraph");if(!ao.has(o.subtype))return d("unsupported-content","that control type cannot be inserted",o.subtype);let h=l(s),v=y(h);return v||{ok:true,kind:"command",story:s.story,ops:[{op:"insertContentControl",paragraphId:c.start.paragraphId,start:c.start.offset,end:c.end.offset,type:o.subtype,...o.tag===void 0?{}:{tag:o.tag},...o.title===void 0?{}:{alias:o.title}}],answer:()=>D}}case "insertCustomNode":{let t=uo(o);if(t)return d("unsupported-content",t.message,t.detail);let s=lo(o.payload);if(!s.ok)return d("unsupported-content","that payload cannot be written",s.field);let c=po(o,e,a);if("code"in c)return d(c.code,c.message,c.detail);let{start:h,end:v}=c.range,R=G(c.range);if(!R)return d("invalid-handle","that story is not in this document");let P=y(l(R));return P||{ok:true,kind:"customNodeWrite",story:R.story,write:co(o,h,v,s.value),answer:()=>D}}default:return d("unknown-operation","this host does not implement that operation",String(o.op))}};return {plan(o,u){let p=g.conflict(o);if(p)return d("conflicting-operations",p.message,p.detail);let t=ko(o,u);return t.ok&&g.note(o),t},get hasCommands(){return g.hasCommands},get writeScope(){return m?.reads.scope??null},settle(o){let u=m;if(u){let p=o.story(u.reads.story);if(!p)return {ok:false,detail:`the story this batch wrote is gone: ${K(u.reads.story)}`};let t=new Set(u.reads.paragraphIds),s=p.paragraphIds.filter(h=>!t.has(h));if(s.length!==u.created.length)return {ok:false,detail:`planned ${String(u.created.length)} new paragraphs, the transaction made ${String(s.length)}`};u.order.filter(h=>h.id===null).forEach((h,v)=>{h.id=s[v]??null;});for(let h of u.retargets)h.slot.id&&e.retarget(h.from,h.slot.id);}for(let p of f){let t=o.story(p.range.start.story);!t||!xr(p.range,t)||n.select?.(p.range,p.mode);}return {ok:true}}}}var Ir=Object.freeze({status:"skipped"});function tt(n,e,r){return Object.freeze(r===void 0?{code:n,message:e}:{code:n,message:e,detail:r})}function Sr(n){let e=n==="unsupported-revision"||n.startsWith("unsupported-revision:");return tt(e?"unsupported-revision":"transaction-refused",e?"that story contains a tracked change this engine cannot resolve":"the document store refused the transaction",n)}function st(n,e,r,a){return {ok:false,results:n.map((i,l)=>l===e?{status:"error",error:r}:Ir),revision:a,changed:false}}function js(n){let{port:e}=n,r=Object.freeze({...n.capabilities}),a=An(),i=new Set,l=false,f={mode:"Off"},g=0,m=null,y=null,I=r.events?e.subscribe(()=>{if(l)return;let A=Object.freeze({revision:e.revision()});if(g>0)m=A;else for(let b of [...i])b(A);}):()=>{},x=A=>{if(y&&y.pkg===A)return y.value;let b=Nn(A);return y={pkg:A,value:b},b},S=A=>{let b=Array.isArray(A?.operations)?A.operations:[],C=e.revision();if(l)return st(b,0,tt("disposed","this host was disposed"),C);if(!r.document)return st(b,0,tt("unsupported-capability","this host has no document","document"),C);let w=e.currentPackage();if(!w)return st(b,0,tt("document-unavailable","this host holds no document right now"),C);if(A.expectedRevision!==void 0&&A.expectedRevision!==C)return st(b,0,tt("stale-revision","the document moved since that revision",`expected ${String(A.expectedRevision)}, at ${C}`),C);let L=fo({handles:a,reads:x(w),capabilities:r,...e.revisionDisplayMode?{displayMode:e.revisionDisplayMode()}:{},...e.replacementLanding?{replacementLanding:e.replacementLanding.bind(e)}:{},...e.select?{select:e.select.bind(e)}:{}}),_=[],z=[],B=null,G=[],X=null,it,xt=null,$=-1,bt=f;for(let N=0;N<b.length;N+=1){let It=b[N],ft=kn(It,e.localChangeTracking===true,bt),Y=ft?.step??L.plan(It,bt.author);if(ft&&(bt=ft.state),!Y.ok)return st(b,N,Y.error,C);if(_.push(Y),Y.kind==="command")if($<0&&($=N),Y.lifecycle)B=Y.ops[0]??null;else if(Y.relate){let nt=Y.relate;z.push(Nt=>{let Z=Nt(nt.url);return Z===null?null:nt.ops(Z)});}else {let{ops:nt}=Y;z.push(()=>nt);}else Y.kind==="commentWrite"?($<0&&($=N),G.push(Y.write),X=L.writeScope??{kind:"body"}):Y.kind==="customNodeWrite"&&($<0&&($=N),xt={write:Y.write,scope:L.writeScope??{kind:"body"}});}let gt=false;if(G.length>0){let N=e.applyCommentWrites(G,X??{kind:"body"});if(!N.ok)return st(b,$<0?0:$,tt("transaction-refused","the document store refused the comment write",N.reason),C);gt=N.changed,it=N.commentId;}if(xt){let N=e.applyCustomNodeWrite(xt.write,xt.scope);if(!N.ok)return st(b,$<0?0:$,tt("transaction-refused","the document store refused the custom-node write",N.reason),C);gt=N.changed;}if(B){let N=e.applyLifecycle(B);if(!N.ok)return st(b,$<0?0:$,tt("transaction-refused","the document store refused the transaction",N.reason),C);gt=N.changed;}if(z.length>0){let N=e.apply(It=>{let ft=[];for(let Y of z){let nt=Y(It);if(nt===null)return null;ft.push(...nt);}return ft},L.writeScope??{kind:"body"});if(!N.ok)return st(b,$<0?0:$,Sr(N.reason),C);gt=N.changed;}let Tt=e.currentPackage();if(!Tt)return st(b,0,tt("document-unavailable","this host holds no document right now"),C);let wt=x(Tt),Ft=L.settle(wt);return Ft.ok?(f=bt,{ok:true,results:_.map(N=>({status:"ok",value:N.kind==="query"?N.value:N.kind==="customNodeWrite"?N.answer(wt):N.answer(wt,it)})),revision:e.revision(),changed:gt}):st(b,$<0?0:$,tt("transaction-refused","the transaction did not produce the document the batch planned",Ft.detail),e.revision())};return {capabilities:r,revision:()=>e.revision(),execute:A=>{g+=1;try{return S(A)}finally{if(g-=1,g===0&&m){let b=m;m=null;for(let C of [...i])C(b);}}},save(){if(l)return {ok:false,error:tt("disposed","this host was disposed")};if(!r.save)return {ok:false,error:tt("unsupported-capability","this host cannot save","save")};let A=e.save();return A?{ok:true,bytes:A}:{ok:false,error:tt("document-unavailable","this host holds no document right now")}},subscribe(A){return l||!r.events?()=>{}:(i.add(A),()=>{i.delete(A);})},dispose(){l||(l=true,i.clear(),I(),e.dispose(),y=null);}}}exports.a=Rr;exports.b=bo;exports.c=Io;exports.d=ce;exports.e=Lt;exports.f=Yt;exports.g=js;
@@ -1 +0,0 @@
1
- import {b}from'./chunk-BML3CNUT.js';import {da}from'./chunk-MDMM3XVQ.js';var j=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,$=128,K=/[\u0000-\u001F\u007F-\u009F]/,q=16,J=2,Q=3276;function B(e){return e.kind!=="textValue"}function A(e,n){for(let t of e.children)if(B(t)&&t.localName===n)return t}function p(e,n){return e.attributes.find(t=>t.localName===n)?.value}function D(e){return e===void 0||e.length===0||e.length>$||K.test(e)?null:e}function v(e,n){let t=b(p(e,"asciiTheme"),n)??b(p(e,"hAnsiTheme"),n);if(t!==null)return t;let l=p(e,"ascii")??p(e,"hAnsi");return l===void 0?null:j.test(l)?l:null}function C(e,n){let t=b(p(e,"eastAsiaTheme"),n);if(t!==null)return t;let l=p(e,"eastAsia");return l===void 0?null:j.test(l)?l:null}function G(e){return e!==void 0&&j.test(e)?e:null}function xe(e){return G(e)}function U(e,n){if(!e)return {fontFamily:null,fontSizeHalfPoints:null};let t=A(e,"rFonts"),l=A(e,"sz"),a=l?p(l,"val"):void 0,r=a!==void 0&&/^\d{1,4}$/.test(a)?Number(a):null;return {fontFamily:t?v(t,n):null,fontSizeHalfPoints:r!==null&&r>=J&&r<=Q?r:null}}function he(e,n){let t=new Map,l={fontFamily:null,fontSizeHalfPoints:null};if(e){let o=A(e,"docDefaults"),u=o?A(o,"rPrDefault"):void 0;l=U(u?A(u,"rPr"):void 0,n);for(let d of e.children){if(!B(d)||d.localName!=="style")continue;let i=D(p(d,"styleId"));if(i===null||t.has(i))continue;let f=A(d,"basedOn");t.set(i,{basedOn:D(f?p(f,"val"):void 0),own:U(A(d,"rPr"),n)});}}let a=new Map,r=o=>{let u=o??"",d=a.get(u);if(d)return d;let i=null,f=null,m=new Set,h=o;for(let s=0;h!==null&&s<q&&!m.has(h);s+=1){m.add(h);let c=t.get(h);if(!c)break;i??=c.own.fontFamily,f??=c.own.fontSizeHalfPoints,h=c.basedOn;}let S={fontFamily:i??l.fontFamily,fontSizeHalfPoints:f??l.fontSizeHalfPoints};return a.set(u,S),S};return (o,u)=>{let d=r(o),i=u?.find(m=>m.localName==="rFonts"),f=i?b(i.attributes?.asciiTheme,n)??b(i.attributes?.hAnsiTheme,n):null;return f===null?d:{...d,fontFamily:f}}}var ee=16,ne=16,te=32,le=4096;function x(e){return e.kind!=="textValue"}function g(e,n){for(let t of e.children)if(x(t)&&t.localName===n)return t}function M(e,n){return e.attributes.find(t=>t.localName===n)?.value}function ae(e){return e==="1"||e==="true"||e==="on"}function _(){return {families:new Map,styleIds:new Set,anyText:false,bareParagraph:false,bareRun:false,bareTable:false}}function H(e,n){for(let[t,l]of n.families)e.families.has(t)||e.families.set(t,l);for(let t of n.styleIds)e.styleIds.add(t);e.anyText||=n.anyText,e.bareParagraph||=n.bareParagraph,e.bareRun||=n.bareRun,e.bareTable||=n.bareTable;}function O(e,n){if(n===null)return;let t=n.toLowerCase();e.has(t)||e.set(t,n);}var oe=new Set(["tab","noBreakHyphen","softHyphen","footnoteRef","endnoteRef","footnoteReference","endnoteReference"]),re=128;function ie(e){for(let n of e.attributes)if(n.localName==="font"&&!(n.namespaceUri!==da&&n.namespaceUri!==""))return n.value.length>0&&n.value.length<=re;return false}function V(e,n){if(n?.has(e.id))return true;for(let t of e.children)if(!(!x(t)||t.namespaceUri!==da)){if(oe.has(t.localName))return true;if(t.localName==="sym"){if(!ie(t))return true;continue}if(!(t.localName!=="t"&&t.localName!=="delText")){for(let l of t.children)if(!x(l)&&l.value.length>0)return true}}return false}function se(e){for(let n of e.children)if(!(!x(n)||n.namespaceUri!==da)&&!(n.localName!=="t"&&n.localName!=="delText")){for(let t of n.children)if(!x(t))for(let l of t.value){let a=l.codePointAt(0);if(a>=4352&&a<=4607||a>=11904&&a<=40959||a>=43360&&a<=43391||a>=44032&&a<=55295||a>=63744&&a<=64255||a>=65072&&a<=65103||a>=65280&&a<=65519||a>=131072&&a<=262143)return true}}return false}function W(e,n){let t=[e];for(;t.length>0;){let l=t.pop();if(x(l)){if(n?.has(l.id))return true;if(l.localName==="r"&&l.namespaceUri===da){if(V(l,n))return true;continue}for(let a of l.children)t.push(a);}}return false}function ue(e,n,t,l){if(!V(e,l))return;n.anyText=true;let a=g(e,"rPr"),r=a?g(a,"rFonts"):void 0;r&&(O(n.families,v(r,t)),se(e)&&O(n.families,C(r,t)));let o=a?g(a,"rStyle"):void 0,u=D(o?M(o,"val"):void 0);u!==null?n.styleIds.add(u):n.bareRun=true;}function fe(e,n,t){if(!t)return;n.anyText=true;let l=e.localName==="tbl",a=g(e,l?"tblPr":"pPr"),r=a?g(a,l?"tblStyle":"pStyle"):void 0,o=D(r?M(r,"val"):void 0);o!==null?n.styleIds.add(o):l?n.bareTable=true:n.bareParagraph=true;}function L(e){return (e.localName==="p"||e.localName==="tbl")&&e.namespaceUri===da}function z(e,n,t,l,a){e.namespaceUri===da&&(a?.has(e.id)&&e.localName==="fldSimple"&&(n.anyText=true,n.bareRun=true),e.localName==="r"?ue(e,n,t,a):L(e)&&fe(e,n,l));}var X=new WeakMap;function Z(e,n,t){let l=X.get(e);if(l&&l.major===n.major&&l.minor===n.minor&&l.majorEastAsia===n.majorEastAsia&&l.minorEastAsia===n.minorEastAsia)return l.summary;let a=_();if(e.children.length>=ne&&t<te){for(let r of e.children)x(r)&&H(a,Z(r,n,t+1));z(e,a,n,a.anyText);}else {let r=[e];for(;r.length>0;){let o=r.pop();if(!x(o))continue;let u=L(o)&&W(o);z(o,a,n,u);for(let d=o.children.length-1;d>=0;d-=1)r.push(o.children[d]);}}return X.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,summary:a}),a}var de={docDefaultFamilies:[],defaultParagraph:null,defaultCharacter:null,defaultTable:null,chainFamilies:()=>[]},Y=new WeakMap;function k(e,n){let t=g(e,"rPr"),l=t?g(t,"rFonts"):void 0;return l?v(l,n):null}function w(e,n){let t=g(e,"rPr"),l=t?g(t,"rFonts"):void 0;return l?C(l,n):null}function ce(e,n){let t=new Map,l=null,a=null,r=null,o=null,u=null,d=g(e,"docDefaults"),i=d?g(d,"rPrDefault"):void 0;i&&(l=k(i,n),a=w(i,n));let f=0;for(let s of e.children){if(!x(s)||s.localName!=="style")continue;if(f>=le)break;f+=1;let c=D(M(s,"styleId"));if(c===null)continue;let y=g(s,"basedOn"),F=[];for(let b of s.children){if(!x(b)||b.localName!=="tblStylePr")continue;let I=k(b,n);I!==null&&F.push(I);let E=w(b,n);E!==null&&F.push(E);}t.set(c,{basedOn:D(y?M(y,"val"):void 0),family:k(s,n),eastAsiaFamily:w(s,n),conditionalFamilies:F});let T=ae(M(s,"default")),P=M(s,"type");P==="paragraph"?T?r=c:r===c&&(r=null):P==="character"?T?o=c:o===c&&(o=null):P==="table"&&(T?u=c:u===c&&(u=null));}let m=new Map,h=s=>{if(s===null)return [];let c=m.get(s);if(c)return c;let y=[],F=null,T=null,P=new Set,b=s;for(let I=0;b!==null&&I<ee&&!P.has(b);I+=1){P.add(b);let E=t.get(b);if(!E)break;F??=E.family,T??=E.eastAsiaFamily,y.push(...E.conditionalFamilies),b=E.basedOn;}return F!==null&&y.unshift(F),T!==null&&y.unshift(T),m.set(s,y),y};return {docDefaultFamilies:[l,a].filter(s=>s!==null),defaultParagraph:r,defaultCharacter:o,defaultTable:u,chainFamilies:h}}function me(e,n){if(!e)return de;let t=Y.get(e);if(t&&t.major===n.major&&t.minor===n.minor&&t.majorEastAsia===n.majorEastAsia&&t.minorEastAsia===n.minorEastAsia)return t.index;let l=ce(e,n);return Y.set(e,{major:n.major,minor:n.minor,majorEastAsia:n.majorEastAsia,minorEastAsia:n.minorEastAsia,index:l}),l}function ye(e,n,t,l){let a=_(),r=new Map;for(let i of e){let f=_();for(let m of i.children){if(!x(m))continue;if(!l||l.size===0){H(f,Z(m,t,0));continue}let h=_(),S=[m];for(;S.length>0;){let s=S.pop();if(!x(s))continue;let c=L(s)&&W(s,l);z(s,h,t,c,l);for(let y=s.children.length-1;y>=0;y-=1)S.push(s.children[y]);}H(f,h);}H(a,f);for(let m of f.families.values())O(r,m);}let o=me(n,t),u=new Map;for(let i of a.styleIds)for(let f of o.chainFamilies(i))O(u,f);if(a.bareParagraph)for(let i of o.chainFamilies(o.defaultParagraph))O(u,i);if(a.bareRun)for(let i of o.chainFamilies(o.defaultCharacter))O(u,i);if(a.bareTable)for(let i of o.chainFamilies(o.defaultTable))O(u,i);if(a.anyText)for(let i of o.docDefaultFamilies)O(u,i);for(let i of r.keys())u.delete(i);let d=[...u.values()].sort((i,f)=>i<f?-1:i>f?1:0);return Object.freeze({direct:Object.freeze([...r.values()]),inherited:Object.freeze(d)})}function Oe(e,n,t){let l=ye(e,n,t),a=[...l.direct,...l.inherited];return a.sort((r,o)=>r<o?-1:r>o?1:0),a}export{G as a,xe as b,he as c,ye as d,Oe as e};