@betteroffice/docx 0.0.1

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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
  4. package/dist/agent/index.d.mts +531 -0
  5. package/dist/agent/index.mjs +1 -0
  6. package/dist/chunk-34K66SY4.mjs +1 -0
  7. package/dist/chunk-3UBMCDME.mjs +1 -0
  8. package/dist/chunk-4RCISPPE.mjs +1 -0
  9. package/dist/chunk-4UD54UM5.mjs +1 -0
  10. package/dist/chunk-52GB3Y42.mjs +1 -0
  11. package/dist/chunk-6NEKRDXF.mjs +1 -0
  12. package/dist/chunk-6PW4CWUG.mjs +1 -0
  13. package/dist/chunk-7DEIW7FL.mjs +1 -0
  14. package/dist/chunk-7PCO5I2O.mjs +1 -0
  15. package/dist/chunk-BI3B33LI.mjs +1 -0
  16. package/dist/chunk-BIQWVK5P.mjs +2 -0
  17. package/dist/chunk-CIRN3LZA.mjs +1 -0
  18. package/dist/chunk-DXKG3HQ5.mjs +16 -0
  19. package/dist/chunk-EUUIJVM6.mjs +0 -0
  20. package/dist/chunk-FPZBTOD6.mjs +1 -0
  21. package/dist/chunk-FZIA7OFY.mjs +1 -0
  22. package/dist/chunk-GWKJ2Y4Y.mjs +1 -0
  23. package/dist/chunk-H3JCIGWK.mjs +1 -0
  24. package/dist/chunk-HJGAQIU7.mjs +2 -0
  25. package/dist/chunk-I6KKMUUC.mjs +1 -0
  26. package/dist/chunk-IL5JZJT7.mjs +1 -0
  27. package/dist/chunk-JY6ILTNS.mjs +1 -0
  28. package/dist/chunk-KEE52TT5.mjs +1 -0
  29. package/dist/chunk-KVKLLTDP.mjs +58 -0
  30. package/dist/chunk-KXNZFTTK.mjs +1 -0
  31. package/dist/chunk-L5ISVQ3W.mjs +1 -0
  32. package/dist/chunk-LDUWIM7M.mjs +1 -0
  33. package/dist/chunk-N5Q3YN64.mjs +1 -0
  34. package/dist/chunk-NEWOMDTX.mjs +1 -0
  35. package/dist/chunk-O2QSE2I7.mjs +1 -0
  36. package/dist/chunk-OBQGPMPQ.mjs +1 -0
  37. package/dist/chunk-OJOHXQNQ.mjs +1 -0
  38. package/dist/chunk-OMR3TWCD.mjs +2 -0
  39. package/dist/chunk-P3KDV4M2.mjs +1 -0
  40. package/dist/chunk-Q7PO7V73.mjs +1 -0
  41. package/dist/chunk-QOUFE3VX.mjs +1 -0
  42. package/dist/chunk-SINEY6ZF.mjs +1 -0
  43. package/dist/chunk-T4EZMUXM.mjs +1 -0
  44. package/dist/chunk-TTRUPDAB.mjs +1 -0
  45. package/dist/chunk-TYHI7RAD.mjs +1 -0
  46. package/dist/chunk-UIEJWORW.mjs +1 -0
  47. package/dist/chunk-VAOUFAUH.mjs +1 -0
  48. package/dist/chunk-VBOTMRXV.mjs +1 -0
  49. package/dist/chunk-VCER63GQ.mjs +1 -0
  50. package/dist/chunk-WAUF2UC7.mjs +2 -0
  51. package/dist/chunk-WRWRCBLK.mjs +1 -0
  52. package/dist/chunk-X4XDO3LZ.mjs +1 -0
  53. package/dist/chunk-XQBCCJBO.mjs +9 -0
  54. package/dist/chunk-XWUOLYRQ.mjs +2 -0
  55. package/dist/chunk-XYH6XWP3.mjs +10 -0
  56. package/dist/chunk-YBIM6UJV.mjs +8 -0
  57. package/dist/chunk-YCIH2Q3E.mjs +1 -0
  58. package/dist/chunk-YUOKI2HB.mjs +1 -0
  59. package/dist/chunk-ZOV5KL7C.mjs +1 -0
  60. package/dist/colorResolver-n0o7H7ep.d.mts +290 -0
  61. package/dist/content-sSHuWw49.d.mts +2202 -0
  62. package/dist/core-plugins.d.mts +37 -0
  63. package/dist/core-plugins.mjs +1 -0
  64. package/dist/core.d.mts +451 -0
  65. package/dist/core.mjs +1 -0
  66. package/dist/displayListQueries-p-ijSzdh.d.mts +222 -0
  67. package/dist/docx/index.d.mts +618 -0
  68. package/dist/docx/index.mjs +2 -0
  69. package/dist/docx/parser.d.mts +41 -0
  70. package/dist/docx/parser.mjs +1 -0
  71. package/dist/docx/rezip.d.mts +148 -0
  72. package/dist/docx/rezip.mjs +1 -0
  73. package/dist/docx/serializer/index.d.mts +42 -0
  74. package/dist/docx/serializer/index.mjs +1 -0
  75. package/dist/docx/wrapTypes.d.mts +19 -0
  76. package/dist/docx/wrapTypes.mjs +1 -0
  77. package/dist/docxInput-DTbCa48g.d.mts +21 -0
  78. package/dist/editor/index.d.mts +170 -0
  79. package/dist/editor/index.mjs +1 -0
  80. package/dist/editorTree-DO5PyDK8.d.mts +37 -0
  81. package/dist/executor-7O2RBJ2B.mjs +1 -0
  82. package/dist/fontLoader-Bx6DK6-2.d.mts +327 -0
  83. package/dist/formatting-DoL7KBSL.d.mts +823 -0
  84. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  85. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  86. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  87. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  88. package/dist/headerFooterLayout-0zPT64Qc.d.mts +316 -0
  89. package/dist/headless.d.mts +69 -0
  90. package/dist/headless.mjs +1 -0
  91. package/dist/layout/flow/index.d.mts +149 -0
  92. package/dist/layout/flow/index.mjs +1 -0
  93. package/dist/layout/index.d.mts +307 -0
  94. package/dist/layout/index.mjs +1 -0
  95. package/dist/layout/measure/index.d.mts +324 -0
  96. package/dist/layout/measure/index.mjs +1 -0
  97. package/dist/layout/pagination/index.d.mts +60 -0
  98. package/dist/layout/pagination/index.mjs +1 -0
  99. package/dist/layout/pagination/types.d.mts +4 -0
  100. package/dist/layout/pagination/types.mjs +1 -0
  101. package/dist/layout/render/index.d.mts +733 -0
  102. package/dist/layout/render/index.mjs +1 -0
  103. package/dist/loadWasmAsset-CMvnVkfA.d.mts +3 -0
  104. package/dist/managers/AutoSaveManager.d.mts +81 -0
  105. package/dist/managers/AutoSaveManager.mjs +1 -0
  106. package/dist/managers/TableSelectionManager.d.mts +74 -0
  107. package/dist/managers/TableSelectionManager.mjs +1 -0
  108. package/dist/managers/types.d.mts +113 -0
  109. package/dist/managers/types.mjs +0 -0
  110. package/dist/mcp-cli.mjs +142 -0
  111. package/dist/mcp.d.mts +162 -0
  112. package/dist/mcp.mjs +16 -0
  113. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +109 -0
  114. package/dist/measuredBlock-DZwz8zhD.d.mts +26 -0
  115. package/dist/plugin-api/RenderedDomContext.d.mts +114 -0
  116. package/dist/plugin-api/RenderedDomContext.mjs +1 -0
  117. package/dist/plugin-api/index.d.mts +7 -0
  118. package/dist/plugin-api/index.mjs +0 -0
  119. package/dist/plugin-api/resolveItemPositions.d.mts +39 -0
  120. package/dist/plugin-api/resolveItemPositions.mjs +1 -0
  121. package/dist/plugin-api/types.d.mts +193 -0
  122. package/dist/plugin-api/types.mjs +0 -0
  123. package/dist/processTemplate-HDUIZFJ5.mjs +1 -0
  124. package/dist/registry-DMM5VTdT.d.mts +165 -0
  125. package/dist/rustDisplayList-dqunvwxH.d.mts +1036 -0
  126. package/dist/rustPagination-Bj2hq013.d.mts +106 -0
  127. package/dist/sectionConfigs-DW3J8q0X.d.mts +55 -0
  128. package/dist/selectionContext-Buc9BCU1.d.mts +570 -0
  129. package/dist/selectiveSave-oFBJ1n71.d.mts +16 -0
  130. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
  131. package/dist/settingsParser-CcGvtmCK.d.mts +33 -0
  132. package/dist/styles/index.d.mts +162 -0
  133. package/dist/styles/index.mjs +1 -0
  134. package/dist/styles-VxNcXLdi.d.mts +189 -0
  135. package/dist/types/agentApi.d.mts +456 -0
  136. package/dist/types/agentApi.mjs +1 -0
  137. package/dist/types/content.d.mts +3 -0
  138. package/dist/types/content.mjs +1 -0
  139. package/dist/types/document.d.mts +117 -0
  140. package/dist/types/document.mjs +1 -0
  141. package/dist/types-DNrYr6yQ.d.mts +1754 -0
  142. package/dist/types-dYdjUZMo.d.mts +311 -0
  143. package/dist/units-O5Y02RKQ.d.mts +34 -0
  144. package/dist/utils/autoScroll.d.mts +24 -0
  145. package/dist/utils/autoScroll.mjs +1 -0
  146. package/dist/utils/cardStyles.d.mts +22 -0
  147. package/dist/utils/cardStyles.mjs +1 -0
  148. package/dist/utils/comments.d.mts +120 -0
  149. package/dist/utils/comments.mjs +4 -0
  150. package/dist/utils/findReplace.d.mts +114 -0
  151. package/dist/utils/findReplace.mjs +2 -0
  152. package/dist/utils/findVerticalScrollParent.d.mts +25 -0
  153. package/dist/utils/findVerticalScrollParent.mjs +1 -0
  154. package/dist/utils/fontOptions.d.mts +21 -0
  155. package/dist/utils/fontOptions.mjs +1 -0
  156. package/dist/utils/headingCollector.d.mts +28 -0
  157. package/dist/utils/headingCollector.mjs +1 -0
  158. package/dist/utils/highlightColors.d.mts +14 -0
  159. package/dist/utils/highlightColors.mjs +1 -0
  160. package/dist/utils/index.d.mts +956 -0
  161. package/dist/utils/index.mjs +84 -0
  162. package/dist/utils/listState.d.mts +27 -0
  163. package/dist/utils/listState.mjs +1 -0
  164. package/dist/utils/reportIssue.d.mts +23 -0
  165. package/dist/utils/reportIssue.mjs +2 -0
  166. package/dist/utils/sidebarConstants.d.mts +10 -0
  167. package/dist/utils/sidebarConstants.mjs +1 -0
  168. package/dist/utils/stylePreview.d.mts +70 -0
  169. package/dist/utils/stylePreview.mjs +1 -0
  170. package/dist/utils/textSelection.d.mts +92 -0
  171. package/dist/utils/textSelection.mjs +1 -0
  172. package/dist/utils/units.d.mts +78 -0
  173. package/dist/utils/units.mjs +1 -0
  174. package/dist/variableDetector-Borj29SF.d.mts +115 -0
  175. package/dist/wasm-FZQ5XB2Y.mjs +1 -0
  176. package/dist/wasm-SA237OSP.mjs +1 -0
  177. package/dist/wasm-edit.d.mts +473 -0
  178. package/dist/wasm-edit.mjs +1 -0
  179. package/dist/wasm-layout.d.mts +112 -0
  180. package/dist/wasm-layout.mjs +1 -0
  181. package/dist/wasm-opc.d.mts +16 -0
  182. package/dist/wasm-opc.mjs +1 -0
  183. package/dist/wasm-parse.d.mts +18 -0
  184. package/dist/wasm-parse.mjs +1 -0
  185. package/dist/watermarkApi-DCxjutkg.d.mts +38 -0
  186. package/dist/yrs/index.d.mts +882 -0
  187. package/dist/yrs/index.mjs +1 -0
  188. package/dist/yrs/residentEngineWorker.d.mts +2 -0
  189. package/dist/yrs/residentEngineWorker.mjs +1 -0
  190. package/package.json +365 -0
@@ -0,0 +1 @@
1
+ import {b as b$3,c as c$3}from'../chunk-GWKJ2Y4Y.mjs';import {h}from'../chunk-L5ISVQ3W.mjs';import'../chunk-I6KKMUUC.mjs';import'../chunk-ZOV5KL7C.mjs';import {c as c$2,d}from'../chunk-HJGAQIU7.mjs';import {e}from'../chunk-FZIA7OFY.mjs';import {b as b$2}from'../chunk-OBQGPMPQ.mjs';import {L}from'../chunk-YBIM6UJV.mjs';import {c,a}from'../chunk-KXNZFTTK.mjs';import'../chunk-BIQWVK5P.mjs';import {c as c$1,b as b$1}from'../chunk-3UBMCDME.mjs';import {b}from'../chunk-TTRUPDAB.mjs';function In(e,t){let n=0,r=t.map(o=>{let s={paraId:o.paraId,length:Math.max(0,Math.trunc(o.length)),displayStart:n};return n+=s.length+2,s});return {story:e,paragraphs:r}}function Ae(e,t){let n=e.paragraphs.find(r=>r.paraId===t.paraId);return !n||t.story!==e.story?e.paragraphs[0]?.displayStart??0:n.displayStart+1+Math.min(Math.max(0,t.offset),n.length)}function vn(e,t){if(e.paragraphs.length===0)return null;let n=Math.max(0,Math.trunc(t)),r=e.paragraphs[0];for(let o of e.paragraphs){if(o.displayStart>n)break;r=o;}return {story:e.story,paraId:r.paraId,offset:Math.min(Math.max(0,n-(r.displayStart+1)),r.length)}}function An(e,t,n){return Ae(e,t)-Ae(e,n)}var ie=class{constructor(){b(this,"worker");b(this,"pending",new Map);b(this,"nextId",1);b(this,"destroyed",false);b(this,"ready",false);b(this,"revision",0);this.worker=new Worker(new URL("./residentEngineWorker.mjs",import.meta.url),{type:"module",name:"openooxml-resident-engine"}),this.worker.onmessage=t=>{let n=t.data,r=this.pending.get(n.id);r&&(this.pending.delete(n.id),r.timeout&&clearTimeout(r.timeout),n.ok?r.resolve(n):r.reject(ft(n.error,n.residentUnavailable)));},this.worker.onerror=t=>{this.failAll(new Error(`Resident engine worker failed: ${t.message}`)),this.ready=false;},this.worker.onmessageerror=()=>{this.failAll(new Error("Resident engine worker returned an unreadable message")),this.ready=false;};}isReady(){return this.ready}layoutRevision(){return this.revision}async bootstrap(t,n){let r=await this.request({type:"bootstrap",snapshot:t,extras:n,expectedFrameEpoch:0},Fe(t),15e3),o=z(r);return this.ready=true,this.revision=o.layoutRevision,o}async sync(t,n,r){let o=await this.request({type:"sync",snapshot:t,extras:n,expectedFrameEpoch:r},Fe(t)),s=z(o);return this.ready=true,this.revision=s.layoutRevision,s}async buildFrame(t,n){return z(await this.request({type:"buildFrame",extras:t,expectedFrameEpoch:n}))}async applyInput(t,n,r,o=false){if(!this.ready)return {applied:false};try{return {applied:!0,...z(await this.request({type:"applyInput",text:t,selection:n,expectedFrameEpoch:r,profile:o}))}}catch(s){if(s instanceof H)return {applied:false};throw s}}async applyDelete(t,n,r,o=false){if(!this.ready)return {applied:false};try{return {applied:!0,...z(await this.request({type:"applyDelete",direction:t,selection:n,expectedFrameEpoch:r,profile:o}))}}catch(s){if(s instanceof H)return {applied:false};throw s}}invalidate(t,n){if(this.destroyed)return;this.ready=false;let r=t.slice(),s={id:this.nextId++,type:"applyUpdate",update:r,selection:n};this.worker.postMessage(s,[r.buffer]);}async attachCanvases(t,n,r,o){let s=t.map(l=>l.canvas);await this.request({type:"attachCanvases",pages:t,activePageIds:n,devicePixelRatio:r,zoom:o},s);}destroy(){if(this.destroyed)return;this.destroyed=true;let n={id:this.nextId++,type:"destroy"};this.worker.postMessage(n),this.worker.terminate(),this.failAll(new Error("Resident engine worker was destroyed")),this.ready=false;}request(t,n=[],r){if(this.destroyed)return Promise.reject(new Error("Resident engine worker was destroyed"));let o=this.nextId++;return new Promise((s,l)=>{let a=r?setTimeout(()=>{let d=this.pending.get(o);if(!d)return;this.pending.delete(o);let p=new Error(`Resident engine worker did not acknowledge ${t.type} within ${r}ms`);d.reject(p),this.failAll(p),this.ready=false,this.destroyed=true,this.worker.terminate();},r):null;this.pending.set(o,{resolve:s,reject:l,timeout:a}),this.worker.postMessage({...t,id:o},n);})}failAll(t){for(let n of this.pending.values())n.timeout&&clearTimeout(n.timeout),n.reject(t);this.pending.clear();}},H=class extends Error{};function ft(e,t=false){return t?new H(e):new Error(e)}function Fe(e){return [e.state.buffer,...e.fonts.map(t=>t.buffer)]}function z(e){if(!e.frame)throw new Error("Resident engine worker response omitted its FrameDelta");return {frame:new Uint8Array(e.frame),updates:(e.updates??[]).map(t=>new Uint8Array(t)),engineMs:e.engineMs??0,workerTotalMs:e.workerTotalMs??0,engineProfile:e.engineProfile,replayMs:e.replayMs??0,replayedPages:e.replayedPages??0,layoutRevision:e.layoutRevision??0}}function pt(){return typeof Worker<"u"}function le(e){return {sdtType:e.sdtType,id:e.id??null,alias:e.alias??null,tag:e.tag??null,lock:e.lock??null,placeholder:e.placeholder??null,showingPlaceholder:e.showingPlaceholder??false,dateFormat:e.dateFormat??null,listItems:e.listItems?JSON.stringify(e.listItems):null,checked:e.checked??null,dataBinding:e.dataBinding?JSON.stringify(e.dataBinding):null,rawPropertiesXml:e.rawPropertiesXml??null,rawEndPropertiesXml:e.rawEndPropertiesXml??null}}function se(e){let t={sdtType:e.sdtType??"richText"};if(typeof e.id=="number"&&(t.id=e.id),e.alias!=null&&(t.alias=String(e.alias)),e.tag!=null&&(t.tag=String(e.tag)),e.lock!=null&&(t.lock=e.lock),e.placeholder!=null&&(t.placeholder=String(e.placeholder)),e.showingPlaceholder&&(t.showingPlaceholder=true),e.dateFormat!=null&&(t.dateFormat=String(e.dateFormat)),typeof e.listItems=="string"&&e.listItems)try{t.listItems=JSON.parse(e.listItems);}catch{}if(e.checked!=null&&(t.checked=e.checked),typeof e.dataBinding=="string"&&e.dataBinding)try{t.dataBinding=JSON.parse(e.dataBinding);}catch{}return e.rawPropertiesXml!=null&&(t.rawPropertiesXml=String(e.rawPropertiesXml)),e.rawEndPropertiesXml!=null&&(t.rawEndPropertiesXml=String(e.rawEndPropertiesXml)),t}function ae(e,t){let n=e.shapeType||"rect",r=e.geometryPath?.length?e.geometryPath:d(n);if(!r)return null;let o=b$3(b$1(e.size?.width)||100,b$1(e.size?.height)||80,t);return {kind:"shape",id:c$3(),shapeType:n,geometryPath:r,fill:mt(e),stroke:ht(e),transform:yt(e),width:o.width,height:o.height,x:e.offset?b$1(e.offset.x):void 0,y:e.offset?b$1(e.offset.y):void 0,innerText:e.textBody?.content.map(bt),children:(e.children??[]).map(s=>ae(s,t)).filter(s=>s!=null),scene:e.scene,effects:e.effects,textBodyProperties:e.textBodyProperties}}function gt(e){if(e?.kind){if(e.kind==="pattern")return {type:"pattern",color:c$2(e.foregroundColor??e.color),patternPreset:e.patternPreset,foregroundColor:c$2(e.foregroundColor),backgroundColor:c$2(e.backgroundColor)};if(e.kind==="picture"){let t=e.picture?.src;return {type:"picture",color:c$2(e.color),pictureRelId:e.picture?.rId,pictureSrc:t&&(t.startsWith("data:")||t.startsWith("blob:"))?t:void 0,pictureSrcRect:e.srcRect,pictureFillMode:e.fillMode,pictureTile:e.tile,pictureStretchRect:e.stretchRect,pictureOpacity:e.pictureOpacity}}if(e.kind==="theme")return {type:"solid",color:c$2(e.color),themeRefIndex:e.themeRefIndex}}}function mt(e){let t=gt(e.fillPaint);if(t)return t;if(e.fill)return e.fill.type==="none"?{type:"none"}:e.fill.type==="gradient"?{type:"gradient",color:c$2(e.fill.color),gradientType:e.fill.gradient?.type,gradientAngle:e.fill.gradient?.angle,gradientStops:e.fill.gradient?.stops.map(n=>({position:n.position,color:c$2(n.color)??"#000000"}))}:{type:e.fill.type,color:c$2(e.fill.color)}}function ht(e){if(e.outline)return {color:c$2(e.outline.color),width:e.outline.width!=null?b$1(e.outline.width):void 0,dash:e.outline.style}}function yt(e){let t={};return e.transform?.rotation!=null&&(t.rotation=e.transform.rotation),e.transform?.flipH&&(t.flipH=true),e.transform?.flipV&&(t.flipV=true),Object.keys(t).length>0?t:void 0}function bt(e){let t=e.formatting?.alignment,n=t==="both"?"justify":t==="left"||t==="center"||t==="right"?t:void 0;return {kind:"paragraph",id:c$3(),paraId:e.paraId,runs:e.content.flatMap(kt),attrs:n?{alignment:n}:{}}}function kt(e){return e.type==="run"?Ye(e):e.type==="hyperlink"?e.children.flatMap(t=>t.type==="run"?Ye(t):[]):[]}function Ye(e){let t=St(e.formatting),n=[];for(let r of e.content)r.type==="text"&&r.text?n.push({kind:"text",text:r.text,...t}):r.type==="tab"?n.push({kind:"tab",...t}):r.type==="break"&&n.push({kind:"lineBreak"});return n}function St(e){let t={};if(!e)return t;e.bold&&(t.bold=true),e.boldCs!=null&&(t.boldCs=e.boldCs),e.italic&&(t.italic=true),e.italicCs!=null&&(t.italicCs=e.italicCs),e.underline&&(t.underline=true),e.strike&&(t.strike=true);let n=c$2(e.color);n&&(t.color=n),e.fontSize!=null&&(t.fontSize=e.fontSize/2),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs/2),e.fontFamily&&(t.fontSlots={...e.fontFamily});let r=e.fontFamily?.ascii??e.fontFamily?.hAnsi??e.fontFamily?.eastAsia??e.fontFamily?.cs;return r&&(t.fontFamily=r),e.cs!=null&&(t.complexScript=e.cs),e.language&&(t.language={...e.language}),t}function N(e){if(Array.isArray(e))return e.map(N);if(e!==null&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=N(r));return t}return e}var Rt={styleId:"pStyle",_sectionProperties:"sectPr"},Tt=new Set(["paraId","textId","renderedPageBreakBefore","numPrFromStyle"]);function Be(e){let t={};for(let[n,r]of Object.entries(e))Tt.has(n)||r===null||r===void 0||(t[Rt[n]??n]=N(r));return t}var xt=new Set(["columnWidths"]);function X(e,t=new Set){let n={};for(let[r,o]of Object.entries(e))t.has(r)||o===null||o===void 0||(n[r]=N(o));return n}function Me(e){return X(e,xt)}function _e(e){let t=e.columnWidths;return Array.isArray(t)?t.map(N):[]}function Ne(e){return X(e)}function Oe(e,t){let n=X(e);return t&&(n.header=true),n}function de(e,t,n,r){return `${e}:t${t}:r${n}c${r}`}function Ee(e,t){return `${e}:sdt${t}`}function Le(e){return X(e)}function G(e){return `hf:${e}`}function De(e){return `fn:${e}`}var Pt=new Set(["bold","italic","superscript","subscript","allCaps","smallCaps","emboss","imprint","textShadow","textOutline","hidden","rtl"]);function j(e){if(e==null)return "null";if(Array.isArray(e))return `[${e.map(j).join(",")}]`;if(typeof e=="object"){let t=e;return `{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${j(t[n])}`).join(",")}}`}return JSON.stringify(e)}function wt(e,t){if(!e||!t)return e;let n=t.resolveRunStyle(e.styleId);return n?a(n,e):e}function je(e){if(!e)return [];let t=[],n=(l,a={})=>t.push({name:l,attrs:a});e.bold&&n("bold"),e.italic&&n("italic"),e.underline&&e.underline.style!=="none"&&n("underline",{style:e.underline.style,color:e.underline.color??null}),(e.strike||e.doubleStrike)&&n("strike",{double:e.doubleStrike||false}),e.color&&!e.color.auto&&n("textColor",{rgb:e.color.rgb??null,themeColor:e.color.themeColor??null,themeTint:e.color.themeTint??null,themeShade:e.color.themeShade??null});let r=e.shading?.fill,o=(!e.shading?.pattern||e.shading.pattern==="clear")&&r?.rgb&&!r.auto?h(r.rgb):void 0,s=e.highlight&&e.highlight!=="none"?e.highlight:o;return s&&n("highlight",{color:s}),(e.fontSize!=null||e.fontSizeCs!=null)&&n("fontSize",{size:e.fontSize??null,sizeCs:e.fontSizeCs??null}),e.fontFamily&&n("fontFamily",{ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??null,eastAsia:e.fontFamily.eastAsia??null,cs:e.fontFamily.cs??null,asciiTheme:e.fontFamily.asciiTheme??null,hAnsiTheme:e.fontFamily.hAnsiTheme??null,eastAsiaTheme:e.fontFamily.eastAsiaTheme??null,csTheme:e.fontFamily.csTheme??null}),e.vertAlign==="superscript"?n("superscript"):e.vertAlign==="subscript"&&n("subscript"),e.allCaps&&n("allCaps"),e.smallCaps&&n("smallCaps"),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&n("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null}),e.emboss&&n("emboss"),e.imprint&&n("imprint"),e.shadow&&n("textShadow"),e.emphasisMark&&e.emphasisMark!=="none"&&n("emphasisMark",{type:e.emphasisMark}),e.outline&&n("textOutline"),e.hidden&&n("hidden"),e.rtl&&n("rtl"),e.effect&&e.effect!=="none"&&n("textEffect",{effect:e.effect}),e.modernEffects&&n("modernTextEffects",{effects:e.modernEffects}),e.styleId&&n("runStyle",{styleId:e.styleId}),t}function Ue(e){let t={};for(let n of e)n.name==="comment"||n.name==="footnoteRef"||(Pt.has(n.name)?t[n.name]=true:n.name==="highlight"?t.highlight=n.attrs.color:n.name==="insertion"||n.name==="deletion"?t[n.name==="insertion"?"ins":"del"]=N({id:n.attrs.revisionId,author:n.attrs.author,date:n.attrs.date}):t[n.name]=N(n.attrs));return t}function Ct(e){return e.filter(t=>t.name!=="hyperlink"&&t.name!=="comment").map(t=>`${t.name}:${JSON.stringify(t.attrs)}`).sort().join("|")}function It(e,t){return [...e.filter(n=>n.name!==t.name),t]}function $(e,t,n){return {kind:"text",text:e,attrs:Ue(t),pmSize:e.length,...n!==void 0?{commentId:n}:{},marks:[...t]}}function I(e,t,n=[],r,o=1){return {kind:"embed",embedKind:e,payload:t,attrs:Ue(n),pmSize:o,...r!==void 0?{commentId:r}:{},marks:[...n]}}function ze(e,t,n){let r=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0;return je(a(a(t,r),e.formatting))}function vt(e){let t=e.size?.width?b$1(e.size.width):void 0,n=e.size?.height?b$1(e.size.height):void 0,r=e.wrap.type,o=e.wrap.wrapText,s=e.position?.horizontal?.alignment,l;r==="inline"||r==="topAndBottom"?l="none":r==="square"||r==="tight"||r==="through"?o==="left"?l="right":o==="right"?l="left":s==="left"||s==="right"?l=s:l="none":l="none";let a=r==="inline"?"inline":r==="topAndBottom"?"block":b$2(r)||l&&l!=="none"?"float":"block",d=[];e.transform?.rotation&&d.push(`rotate(${e.transform.rotation}deg)`),e.transform?.flipH&&d.push("scaleX(-1)"),e.transform?.flipV&&d.push("scaleY(-1)");let p,c,f;if(e.outline?.width){p=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(c=`#${e.outline.color.rgb}`);let g={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};f=e.outline.style&&g[e.outline.style]||"solid";}return N({src:e.src||"",alt:e.alt??null,title:e.title??null,width:t??null,height:n??null,rId:e.rId??null,wrapType:r,displayMode:a,cssFloat:l??null,transform:d.length>0?d.join(" "):null,distTop:e.wrap.distT!=null?b$1(e.wrap.distT):null,distBottom:e.wrap.distB!=null?b$1(e.wrap.distB):null,distLeft:e.wrap.distL!=null?b$1(e.wrap.distL):null,distRight:e.wrap.distR!=null?b$1(e.wrap.distR):null,position:e.position?{horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0}:null,borderWidth:p??null,borderColor:c??null,borderStyle:f??null,wrapText:o??null,hlinkHref:e.hlinkHref??null,cropTop:e.crop?.top??null,cropRight:e.crop?.right??null,cropBottom:e.crop?.bottom??null,cropLeft:e.crop?.left??null,opacity:e.opacity??null,effectExtentTop:e.padding?.top?b$1(e.padding.top):null,effectExtentBottom:e.padding?.bottom?b$1(e.padding.bottom):null,effectExtentLeft:e.padding?.left?b$1(e.padding.left):null,effectExtentRight:e.padding?.right?b$1(e.padding.right):null,layoutInCell:e.layoutInCell??null,allowOverlap:e.allowOverlap??null})}function At(e){let t=e.size?.width?b$1(e.size.width):100,n=e.size?.height?b$1(e.size.height):80,r,o="solid",s,l,a;e.fill&&(o=e.fill.type,r=c$2(e.fill.color),e.fill.type==="gradient"&&e.fill.gradient&&(s=e.fill.gradient.type,l=e.fill.gradient.angle,a=JSON.stringify(e.fill.gradient.stops.map(c=>({position:c.position,color:c$2(c.color)??"#000000"})))));let d=[];e.transform?.rotation&&d.push(`rotate(${e.transform.rotation}deg)`),e.transform?.flipH&&d.push("scaleX(-1)"),e.transform?.flipV&&d.push("scaleY(-1)");let p=e.outline?.width?Math.round(e.outline.width/914400*96*100)/100:1;return N({layoutBlockJson:JSON.stringify(ae(e)),shapeType:e.shapeType||"rect",geometryPath:e.geometryPath??null,shapeId:e.id??null,children:e.children?.length?JSON.stringify(e.children):null,width:t,height:n,fillPaint:e.fillPaint??null,fillColor:r??null,fillType:o,gradientType:s??null,gradientAngle:l??null,gradientStops:a??null,outlineWidth:p,outlineColor:c$2(e.outline?.color)??"#000000",outlineStyle:e.outline?.style||"solid",transform:d.length>0?d.join(" "):null,rotation:e.transform?.rotation??null,flipH:e.transform?.flipH??false,flipV:e.transform?.flipV??false,displayMode:"inline",wrapType:"inline",behindDoc:false,decorative:false,hidden:false})}function Ft(e){return N({chartJson:JSON.stringify(e),chartType:e.chartType??null,title:e.title??null,width:e.size?.width?b$1(e.size.width):320,height:e.size?.height?b$1(e.size.height):220,rId:e.rId??null,path:e.path??null})}function ce(e,t){let n="",r,o=e.type==="simpleField"?e.content:e.fieldResult;for(let a of o)if(a.type==="run"){for(let d of a.content)d.type==="text"&&(n+=d.text);!r&&a.formatting&&(r=a.formatting);}let s=r??(e.type==="complexField"?e.formatting:void 0),l=e.fieldTree?.displayMode??"result";return {payload:{fieldType:e.fieldType,instruction:e.instruction,displayText:n,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false,displayMode:l,hasCachedResult:n.length>0,fieldData:JSON.stringify(e),modelKind:"field"},marks:je(a(t,s))}}function fe(e){return {display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""}}function Yt(e){return {name:"hyperlink",attrs:{href:e.href||(e.anchor?`#${e.anchor}`:""),tooltip:e.tooltip??null,rId:e.rId??null}}}function Je(e,t,n,r){let o={name:"footnoteRef",attrs:{id:String(e),noteType:t}},s=[...n,o];return I("noteRef",t==="endnote"?{endnoteRefId:e}:{footnoteRefId:e},s,r,String(e).length)}function He(e,t,n){switch(e.type){case "text":return e.text?[$(e.text,t,n)]:[];case "tab":return [$(" ",t,n)];case "break":return e.breakType===void 0||e.breakType==="textWrapping"?[I("break",{},t,n)]:[];case "softHyphen":return [$("\xAD",t,n)];case "noBreakHyphen":return [$("\u2011",t,n)];case "symbol":{let r=Number.parseInt(e.char,16);if(!Number.isInteger(r)||r<0||r>1114111)return [];let o={name:"fontFamily",attrs:{ascii:e.font||null,hAnsi:e.font||null,eastAsia:e.font||null,cs:e.font||null,asciiTheme:null,hAnsiTheme:null,eastAsiaTheme:null,csTheme:null}};return [$(String.fromCodePoint(r),It(t,o),n)]}case "commentReference":return [I("field",{fieldType:"COMMENT",instruction:"",displayText:"",fieldKind:"simple",fldLock:false,dirty:false,displayMode:"result",hasCachedResult:false,modelKind:"commentReference",...e.id!==void 0?{commentId:e.id}:{}})];case "drawing":return [I("image",vt(e.image))];case "shape":return e.shape.textBody?.content.length?[]:[I("shape",At(e.shape))];case "chart":return [I("chart",Ft(e.chart))];case "footnoteRef":return [Je(e.id,"footnote",t,n)];case "endnoteRef":return [Je(e.id,"endnote",t,n)];default:return []}}function Q(e,t,n,r,o=[]){let s=[...ze(e,t,n),...o];return e.content.flatMap(l=>He(l,s,r))}function pe(e,t,n,r=[]){let o=[],s=Yt(e);for(let l of e.structuredChildren??e.children)if(l.type==="run"){let a=[...ze(l,t,n),...r,s];for(let d of l.content)o.push(...He(d,a));}else if(l.type==="simpleField"||l.type==="complexField"){let a=ce(l,t);o.push(I("field",a.payload,[...a.marks,...r,s]));}else l.type==="mathEquation"&&o.push(I("math",fe(l),[...r,s]));return o}function Bt(e,t,n){return {name:t,attrs:{revisionId:e.id,author:e.author,date:e.date??null,isMovePair:n}}}function Mt(e,t,n,r){let o=e.type==="insertion"||e.type==="moveTo"?"insertion":"deletion",s=Bt(e.info,o,e.type==="moveFrom"||e.type==="moveTo"),l=[];for(let a of e.content)if(a.type==="run")l.push(...Q(a,t,n,r,[s]));else {let d=pe(a,t,n,[s]);for(let p of d)r!==void 0&&(p.commentId=r);l.push(...d);}return l}function $e(e,t,n){let r=[],o=s=>{if(s.kind==="text"){if((s.text===" "?"tab":"text")==="tab"){r.push({kind:"tab",attrs:s.attrs});return}let a=r[r.length-1];a&&"text"in a&&j(a.attrs)===j(s.attrs)?a.text+=s.text:r.push({kind:"text",text:s.text,attrs:s.attrs});return}r.push({kind:s.embedKind,payload:s.payload,attrs:s.attrs});};for(let s of e.content)if(s.type==="run")Q(s,t,n).forEach(o);else if(s.type==="hyperlink")pe(s,t,n).forEach(o);else if(s.type==="simpleField"||s.type==="complexField"){let l=ce(s,t);o(I("field",l.payload,l.marks));}else s.type==="inlineSdt"?o(I("sdt",$e(s,t,n))):s.type==="mathEquation"&&o(I("math",fe(s)));return N({...le(e.properties),propertiesJson:JSON.stringify(e.properties),content:r})}function _t(e,t,n){let r=t?t.resolveParagraphStyle(e.formatting?.styleId).runFormatting:void 0;return a(r,n)}function Nt(e,t,n){let r=Q(e,t,n);if(r.some(a=>a.kind!=="text"&&a.embedKind!=="noteRef"))return null;let o=r.map(a=>Ct(a.marks));if(o.some(a=>a!==o[0]))return null;let s=r.map(a=>{if(a.kind==="text")return a.text;let d=a.payload.footnoteRefId??a.payload.endnoteRefId;return String(d??"")}).join(""),l=o[0];return {text:s,...l!==void 0?{marksKey:l}:{},...e.formatting?{formatting:e.formatting}:{},...e.propertyChanges?{propertyChanges:e.propertyChanges}:{}}}function Ot(e,t,n,r){let o=e.formatting,s=o?.styleId,l={paraId:e.paraId??null,textId:e.textId??null,styleId:s??null,numPr:o?.numPr??null,numPrFromStyle:o?.numPrFromStyle??null,listNumFmt:e.listRendering?.numFmt??null,listIsBullet:e.listRendering?.isBullet??null,listMarker:e.listRendering?.marker??null,listMarkerHidden:e.listRendering?.markerHidden||null,listMarkerFontFamily:e.listRendering?.markerFontFamily||null,listMarkerFontSize:e.listRendering?.markerFontSize||null,listMarkerSuffix:e.listRendering?.markerSuffix||null,listLevelNumFmts:e.listRendering?.levelNumFmts||null,listAbstractNumId:e.listRendering?.abstractNumId??null,listStartOverride:e.listRendering?.startOverride??null,_originalFormatting:o??null};if(t){let c=t.resolveParagraphStyle(s),f=c.paragraphFormatting;l.alignment=o?.alignment??f?.alignment??null,l.spaceBefore=o?.spaceBefore??f?.spaceBefore??null,l.spaceAfter=o?.spaceAfter??f?.spaceAfter??null,l.lineSpacing=o?.lineSpacing??f?.lineSpacing??null,l.lineSpacingRule=o?.lineSpacingRule??f?.lineSpacingRule??null,l.spacingExplicit=o?.spacingExplicit||null,l.indentLeft=o?.indentLeft??f?.indentLeft??null,l.indentRight=o?.indentRight??f?.indentRight??null;let m=o?.numPr?.numId===0&&f?.numPr&&f.numPr.numId!==0?void 0:f;l.indentFirstLine=o?.indentFirstLine??m?.indentFirstLine??null,l.hangingIndent=o?.hangingIndent??m?.hangingIndent??false,l.borders=o?.borders??f?.borders??null,l.shading=o?.shading??f?.shading??null,l.tabs=o?.tabs??f?.tabs??null,l.pageBreakBefore=o?.pageBreakBefore??f?.pageBreakBefore??null,l.keepNext=o?.keepNext??f?.keepNext??null,l.keepLines=o?.keepLines??f?.keepLines??null,l.contextualSpacing=o?.contextualSpacing??f?.contextualSpacing??null,l.outlineLevel=o?.outlineLevel??f?.outlineLevel??null,l.bidi=o?.bidi??f?.bidi??null;let y=t.getDefaultCharacterStyle()?.rPr,k=y?a(c.runFormatting,y):c.runFormatting;l.defaultTextFormatting=a(k,wt(o?.runProperties,t))??null,!o?.numPr&&f?.numPr&&f.numPr.numId!==0&&(l.numPr=f.numPr,l.numPrFromStyle=f.numPr);}else l.alignment=o?.alignment??null,l.spaceBefore=o?.spaceBefore??null,l.spaceAfter=o?.spaceAfter??null,l.lineSpacing=o?.lineSpacing??null,l.lineSpacingRule=o?.lineSpacingRule??null,l.spacingExplicit=o?.spacingExplicit||null,l.indentLeft=o?.indentLeft??null,l.indentRight=o?.indentRight??null,l.indentFirstLine=o?.indentFirstLine??null,l.hangingIndent=o?.hangingIndent??false,l.borders=o?.borders??null,l.shading=o?.shading??null,l.tabs=o?.tabs??null,l.pageBreakBefore=o?.pageBreakBefore??null,l.keepNext=o?.keepNext??null,l.keepLines=o?.keepLines??null,l.outlineLevel=o?.outlineLevel??null,l.bidi=o?.bidi??null,l.defaultTextFormatting=o?.runProperties??null;if(e.sectionProperties){l._sectionProperties=e.sectionProperties;let c=e.sectionProperties.sectionStart;(c==="nextPage"||c==="continuous"||c==="oddPage"||c==="evenPage")&&(l.sectionBreakType=c);}e.renderedPageBreakBefore&&(l.renderedPageBreakBefore=true),Dt(e)&&(l.pageBreakBefore=true),e.pPrIns&&(l.pPrIns={revisionId:e.pPrIns.id,author:e.pPrIns.author,date:e.pPrIns.date??null}),e.pPrDel&&(l.pPrDel={revisionId:e.pPrDel.id,author:e.pPrDel.author,date:e.pPrDel.date??null}),e.propertyChanges?.length&&(l.pPrChange=e.propertyChanges);let a$1=[],d=0,p=0;for(let c of e.content)if(c.type==="bookmarkStart")a$1.push({id:c.id,name:c.name,kind:"start",offset:p,...c.colFirst!==void 0?{colFirst:c.colFirst}:{},...c.colLast!==void 0?{colLast:c.colLast}:{}});else if(c.type==="bookmarkEnd")a$1.push({id:c.id,kind:"end",offset:p});else {let f=Et(c);for(let g=0;g<f;g+=1)p+=n[d]?.pmSize??0,d+=1;}return a$1.length>0&&(l.bookmarks=a$1),r?.length&&(l._originalRunBoundaries=r),l}var Ke=new WeakMap;function Et(e){return Ke.get(e)??0}function Lt(e,t,n){let r=[],o=new Set,s=[],l=_t(e,t,n);for(let d of e.content){let p=r.length,c=o.values().next().value;if(d.type==="commentRangeStart")o.add(d.id);else if(d.type==="commentRangeEnd")o.delete(d.id);else if(d.type==="run"){let f=Nt(d,l,t);f&&s?s.push(f):s=void 0,r.push(...Q(d,l,t,c));}else if(d.type==="hyperlink")s=void 0,r.push(...pe(d,l,t));else if(d.type==="simpleField"||d.type==="complexField"){s=void 0;let f=ce(d,l);r.push(I("field",f.payload,f.marks));}else d.type==="inlineSdt"?(s=void 0,r.push(I("sdt",$e(d,l,t),[],void 0,2))):d.type==="insertion"||d.type==="deletion"||d.type==="moveFrom"||d.type==="moveTo"?(s=void 0,r.push(...Mt(d,l,t,c))):d.type==="mathEquation"?(s=void 0,r.push(I("math",fe(d)))):d.type!=="bookmarkStart"&&d.type!=="bookmarkEnd"&&(s=void 0);Ke.set(d,r.length-p);}let a=Ot(e,t,r,s);return {units:r,ppr:Be(a)}}function K(e,t){for(let n of e.content)n.type==="break"&&n.breakType==="page"?t.push("pageBreak"):(n.type!=="text"||n.text.length>0)&&t.push("visible");}function ge(e,t){for(let n of e)if(n.type==="run")K(n,t);else if(n.type==="hyperlink")for(let r of n.children)r.type==="run"&&K(r,t);else if(n.type==="simpleField")for(let r of n.content)r.type==="run"&&K(r,t);else if(n.type==="complexField")for(let r of [...n.fieldCode,...n.fieldResult])K(r,t);else if(n.type==="inlineSdt")ge(n.content,t);else if(n.type==="insertion"||n.type==="deletion"||n.type==="moveFrom"||n.type==="moveTo")for(let r of n.content)r.type==="run"&&K(r,t);else n.type==="mathEquation"&&t.push("visible");}function Dt(e){let t=[];return ge(e.content,t),t[0]==="pageBreak"}function Jt(e){let t=[];ge(e.content,t);let n=false,r=false;for(let o of t)if(o==="pageBreak"){if(r||n)return true;n=true;}else r=true;return false}function Wt(e){let t=new Map,n=new Map;return e.rows.forEach((r,o)=>{let s=0,l=r.cells.map(d=>{let p=s;return s+=d.formatting?.gridSpan??1,{column:p,vMerge:d.formatting?.vMerge,key:`${o}-${p}`}});if(l.length>0&&l.every(d=>d.vMerge==="continue"&&n.has(d.column))){for(let d of l)n.delete(d.column),t.set(d.key,{rowSpan:1,skip:false});return}for(let d of l)if(d.vMerge==="restart")n.set(d.column,o),t.set(d.key,{rowSpan:1,skip:false});else if(d.vMerge==="continue"){let p=n.get(d.column);if(p===void 0)t.set(d.key,{rowSpan:1,skip:false});else {let c=t.get(`${p}-${d.column}`);c&&(c.rowSpan+=1),t.set(d.key,{rowSpan:1,skip:true});}}else n.delete(d.column),t.set(d.key,{rowSpan:1,skip:false});}),t}function ue(e){return {revisionId:e.id,author:e.author,date:e.date??null}}function jt(e,t,n,r,o,s){let l=t?{top:n?t.top:t.insideH,bottom:r?t.bottom:t.insideH,left:o?t.left:t.insideV,right:s?t.right:t.insideV}:void 0;return l||e?.borders?{...l??{},...e?.borders??{}}:void 0}function We(e$1,t){let n=e$1.formatting,r=e(n?.shading?.fill,t.theme),o=n?.width?.value??t.gridWidth,s=n?.width?.type??(t.gridWidth!==void 0?"pct":null),l={colspan:n?.gridSpan??1,rowspan:t.rowspan,width:o??null,widthType:s,verticalAlign:n?.verticalAlign??null,backgroundColor:r??null,borders:jt(n,t.tableBorders,t.firstRow,t.lastRow,t.firstColumn,t.lastColumn)??null,margins:n?.margins?{top:n.margins.top?.value,bottom:n.margins.bottom?.value,left:n.margins.left?.value??(t.tableBidi?n.margins.end?.value:n.margins.start?.value),right:n.margins.right?.value??(t.tableBidi?n.margins.start?.value:n.margins.end?.value)}:t.defaultMargins??null,textDirection:n?.textDirection??null,noWrap:n?.noWrap??false,_originalFormatting:n??null,_originalResolvedFill:r??null};if(e$1.structuralChange){let a=e$1.structuralChange,d=ue(a.info);a.type==="tableCellInsertion"?l.cellMarker={kind:"ins",info:d}:a.type==="tableCellDeletion"?l.cellMarker={kind:"del",info:d}:a.type==="tableCellMerge"&&(l.cellMarker={kind:"merge",info:d,vMerge:a.vMerge??"cont",...a.vMergeOrig?{vMergeOrig:a.vMergeOrig}:{}});}return e$1.propertyChanges?.length&&(l.tcPrChange=e$1.propertyChanges),{attrs:Oe(l,t.isHeader),content:e$1.content.length>0?e$1.content:[{type:"paragraph",content:[]}]}}function Ut(e,t,n,r,o,s,l){let a={height:e.formatting?.height?.value??null,heightRule:e.formatting?.heightRule??null,isHeader:!!e.formatting?.header,_originalFormatting:e.formatting??null};e.structuralChange&&(e.structuralChange.type==="tableRowInsertion"?a.trIns=ue(e.structuralChange.info):e.structuralChange.type==="tableRowDeletion"&&(a.trDel=ue(e.structuralChange.info))),e.propertyChanges?.length&&(a.trPrChange=e.propertyChanges);let d=t.columnWidths,p=d?.reduce((m,y)=>m+y,0)??0,c=d?.length??Math.max(0,...t.rows.map(m=>m.cells.reduce((y,k)=>y+(k.formatting?.gridSpan??1),0))),f=0,g=[];return e.cells.forEach(m=>{let y=m.formatting?.gridSpan??1,k=f,T=r.get(`${n}-${k}`),b;if(d&&p>0){let v=0;for(let R=0;R<y&&k+R<d.length;R+=1)v+=d[k+R];b=Math.round(v/p*100);}f+=y,!T?.skip&&g.push(We(m,{isHeader:n===0&&!!t.formatting?.look?.firstRow,rowspan:T?.rowSpan??1,gridWidth:b,firstRow:n===0,lastRow:n===t.rows.length-1,firstColumn:k===0,lastColumn:f===c,tableBorders:o,defaultMargins:s,theme:l,tableBidi:!!t.formatting?.bidi}));}),g.length===0&&g.push(We({formatting:c>1?{gridSpan:c}:void 0,content:[{type:"paragraph",content:[]}]},{isHeader:n===0&&!!t.formatting?.look?.firstRow,rowspan:1,gridWidth:p>0?100:void 0,firstRow:n===0,lastRow:n===t.rows.length-1,firstColumn:true,lastColumn:true,tableBorders:o,defaultMargins:s,theme:l,tableBidi:!!t.formatting?.bidi})),{attrs:Ne(a),cells:g}}function zt(e,t,n){let r=t?.getDefaultTableStyle(),o=e.formatting?.styleId,s=o??r?.styleId,l=s?t?.getStyle(s):void 0,a=e.formatting?.borders??l?.tblPr?.borders??r?.tblPr?.borders,d=e.formatting?.cellMargins??l?.tblPr?.cellMargins??r?.tblPr?.cellMargins,p=e.formatting?.bidi?d?.end:d?.start,c=e.formatting?.bidi?d?.start:d?.end,f=d?{top:d.top?.value,bottom:d.bottom?.value,left:d.left?.value??p?.value,right:d.right?.value??c?.value}:void 0,g=[],m=new Set,y=l;for(;y?.basedOn&&g.length<32&&!m.has(y.basedOn);)m.add(y.basedOn),g.unshift(y.basedOn),y=t?.getStyle(y.basedOn);let k={...e.formatting??{},styleCascade:{...o?{selectedStyleId:o}:{},...r?.styleId?{defaultStyleId:r.styleId}:{},...g.length>0?{basedOnStyleIds:g}:{}}},T={styleId:o??null,width:e.formatting?.width?.value??null,widthType:e.formatting?.width?.type??null,justification:e.formatting?.justification??null,columnWidths:e.columnWidths??null,tableLayout:e.formatting?.layout??null,floating:e.formatting?.floating??null,cellMargins:f??null,look:e.formatting?.look??null,bidi:e.formatting?.bidi||null,_originalFormatting:k};e.propertyChanges?.length&&(T.tblPrChange=e.propertyChanges);let b=Wt(e);return {attrs:T,rows:e.rows.map((v,R)=>Ut(v,e,R,b,a,f,n))}}function Ht(e){return Le(le(e))}function $t(e){let t=0;for(let n of e.units){let r=n.kind==="text"?n.text.length:1;if(n.commentId!==void 0&&n.commentId!==0){let o=e.commentCoverage.get(n.commentId),s=o?.[o.length-1];s&&s[1]===t?s[1]=t+r:o?o.push([t,t+r]):e.commentCoverage.set(n.commentId,[[t,t+r]]);}t+=r;}}function W(e,t,n,r){let o={storyId:t,units:[],commentCoverage:new Map};e.plans.push(o);let s=n.length>0?[...n]:[{type:"paragraph",content:[]}],l=0,a=0,d=0,p=null;for(let c of s){if(c.type==="paragraph"){let m=Lt(c,e.styleResolver,r.extraRunFormatting);o.units.push(...m.units),o.units.push(I("pilcrow",{...m.ppr,paraId:c.paraId||`${t}:p${d}`})),d+=1,r.includePageBreaks&&Jt(c)&&o.units.push(I("pageBreak",{})),p="paragraph";continue}if(c.type==="table"){let m=l++,y=zt(c,e.styleResolver,e.theme),k=y.rows.map((T,b)=>({trPr:T.attrs,cells:T.cells.map((v,R)=>({tcPr:v.attrs,story:de(t,m,b,R)}))}));o.units.push(I("table",{tblPr:Me(y.attrs),grid:_e(y.attrs),rows:k})),y.rows.forEach((T,b)=>{T.cells.forEach((v,R)=>{W(e,de(t,m,b,R),v.content,{includePageBreaks:false,appendBodyTail:false,seedComments:false,extraRunFormatting:v.extraRunFormatting});});}),p="table";continue}let f=a++,g=Ee(t,f);o.units.push(I("blockSdt",{...Ht(c.properties),story:g})),W(e,g,c.content,{includePageBreaks:r.includePageBreaks,appendBodyTail:false,seedComments:false}),p="blockSdt";}r.appendBodyTail&&(p==="table"||p==="blockSdt")&&o.units.push(I("pilcrow",{hangingIndent:false,paraId:`${t}:p${d}`})),r.seedComments&&$t(o);}function Kt(e){let t=[{op:"delete",index:0,len:1}],n=0,r="",o={},s=j(o),l=()=>{r&&(t.push({op:"insert",index:n,text:r,attrs:o}),n+=r.length,r="");};for(let a of e)if(a.kind==="text"){let d=j(a.attrs);r&&d!==s&&l(),o=a.attrs,s=d,r+=a.text;}else l(),t.push({op:"insertEmbed",index:n,kind:a.embedKind,payload:a.payload,attrs:a.attrs}),n+=1;return l(),t}function Vt(e,t){e.applyRawOps(t.storyId,Kt(t.units));let n=[];for(let[r,o]of t.commentCoverage)n.push({op:"setComment",id:String(r),ranges:o,author:"",date:"",body:null});n.length>0&&e.applyRawOps(t.storyId,n);}function qt(e,t){let n={styleResolver:t.package.styles?c(t.package.styles):null,theme:t.package.theme??null,plans:[]};W(n,"body",t.package.document.content,{includePageBreaks:true,appendBodyTail:true,seedComments:true});for(let[r,o]of t.package.headers??[])W(n,G(r),o.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let[r,o]of t.package.footers??[])n.plans.some(s=>s.storyId===G(r))||W(n,G(r),o.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let r of t.package.footnotes??[])W(n,De(r.id),r.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let r of n.plans)e.createStory(r.storyId,"","Normal","left");for(let r of n.plans)Vt(e,r);}function Ve(e){return e.numPrFromStyle!=null&&e.numPr!=null&&JSON.stringify(e.numPr)===JSON.stringify(e.numPrFromStyle)}function Ge(e){if(e._originalFormatting){let n=e._originalFormatting,r={...n};return e.alignment!==(n.alignment||void 0)&&(r.alignment=e.alignment||void 0),Ve(e)?(delete r.numPr,delete r.numPrFromStyle):e.numPr!==n.numPr&&JSON.stringify(e.numPr)!==JSON.stringify(n.numPr)&&(r.numPr=e.numPr||void 0,delete r.numPrFromStyle),e.styleId!==(n.styleId||void 0)&&(r.styleId=e.styleId||void 0),e.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(r.pageBreakBefore=e.pageBreakBefore||void 0),e.bidi!==(n.bidi||void 0)&&(r.bidi=e.bidi||void 0),r}if(e.alignment||e.spaceBefore||e.spaceAfter||e.lineSpacing||e.indentLeft||e.indentRight||e.indentFirstLine||e.numPr||e.styleId||e.borders||e.shading||e.tabs||e.outlineLevel!=null||e.contextualSpacing||e.pageBreakBefore||e.bidi)return {alignment:e.alignment||void 0,spaceBefore:e.spaceBefore||void 0,spaceAfter:e.spaceAfter||void 0,lineSpacing:e.lineSpacing||void 0,lineSpacingRule:e.lineSpacingRule||void 0,indentLeft:e.indentLeft||void 0,indentRight:e.indentRight||void 0,indentFirstLine:e.indentFirstLine||void 0,hangingIndent:e.hangingIndent||void 0,numPr:Ve(e)?void 0:e.numPr||void 0,styleId:e.styleId||void 0,borders:e.borders||void 0,shading:e.shading||void 0,tabs:e.tabs||void 0,outlineLevel:e.outlineLevel??void 0,contextualSpacing:e.contextualSpacing||void 0,pageBreakBefore:e.pageBreakBefore||void 0,bidi:e.bidi||void 0}}function Qe(e){if(e._originalFormatting){let n=e._originalFormatting,r={...n};return e.styleId!==(n.styleId||void 0)&&(r.styleId=e.styleId||void 0),e.justification!==(n.justification||void 0)&&(r.justification=e.justification||void 0),e.floating!==(n.floating||void 0)&&(r.floating=e.floating||void 0),e.tableLayout!==(n.layout||void 0)&&(r.layout=e.tableLayout||void 0),e.look!==(n.look||void 0)&&(r.look=e.look||void 0),e.bidi!==(n.bidi||void 0)&&(r.bidi=e.bidi||void 0),(e.width!==n.width?.value||e.widthType!==n.width?.type)&&(r.width=e.width!=null||e.widthType?{value:e.width??0,type:e.widthType||"dxa"}:void 0),e.cellMargins&&(r.cellMargins=qe(e.cellMargins)),r}if(e.styleId||e.width!=null||e.widthType||e.justification||e.tableLayout||e.floating||e.cellMargins||e.look||e.bidi)return {styleId:e.styleId||void 0,width:e.width!=null||e.widthType?{value:e.width??0,type:e.widthType||"dxa"}:void 0,justification:e.justification||void 0,layout:e.tableLayout||void 0,floating:e.floating||void 0,cellMargins:e.cellMargins?qe(e.cellMargins):void 0,look:e.look||void 0,bidi:e.bidi||void 0}}function qe(e){return {top:e.top!=null?{value:e.top,type:"dxa"}:void 0,bottom:e.bottom!=null?{value:e.bottom,type:"dxa"}:void 0,left:e.left!=null?{value:e.left,type:"dxa"}:void 0,right:e.right!=null?{value:e.right,type:"dxa"}:void 0}}function Ze(e){if(e._originalFormatting){let t=e._originalFormatting,n={...t};return e.height!==(t.height?.value||void 0)&&(n.height=e.height?{value:e.height,type:"dxa"}:void 0),e.heightRule!==(t.heightRule||void 0)&&(n.heightRule=e.heightRule||void 0),e.isHeader!==(t.header||void 0)&&(n.header=e.isHeader||void 0),n}if(!(!e.height&&!e.isHeader))return {height:e.height?{value:e.height,type:"dxa"}:void 0,heightRule:e.heightRule||void 0,header:e.isHeader||void 0}}function et(e){if(e._originalFormatting){let n=e._originalFormatting,r={...n};return e.colspan>1&&(r.gridSpan=e.colspan),e.width!=null&&(r.width={value:e.width,type:e.widthType||"dxa"}),e.verticalAlign!==(n.verticalAlign||void 0)&&(r.verticalAlign=e.verticalAlign||void 0),e.backgroundColor?r.shading=e._originalResolvedFill===e.backgroundColor&&n.shading?n.shading:{fill:{rgb:e.backgroundColor}}:n.shading&&(r.shading=void 0),e.borders&&(r.borders=e.borders),e.margins&&(r.margins=Xe(e.margins)),e.textDirection!==(n.textDirection||void 0)&&(r.textDirection=e.textDirection||void 0),r}if(e.colspan>1||e.rowspan>1||e.width!=null||e.verticalAlign||e.backgroundColor||e.borders||e.margins||e.textDirection)return {gridSpan:e.colspan>1?e.colspan:void 0,width:e.width!=null?{value:e.width,type:e.widthType||"dxa"}:void 0,verticalAlign:e.verticalAlign||void 0,textDirection:e.textDirection||void 0,shading:e.backgroundColor?{fill:{rgb:e.backgroundColor}}:void 0,borders:e.borders,margins:e.margins?Xe(e.margins):void 0}}function Xe(e){let t={};return e.top!=null&&(t.top={value:e.top,type:"dxa"}),e.bottom!=null&&(t.bottom={value:e.bottom,type:"dxa"}),e.left!=null&&(t.left={value:e.left,type:"dxa"}),e.right!=null&&(t.right={value:e.right,type:"dxa"}),t}var Xt={paraId:null,textId:null,alignment:null,spaceBefore:null,spaceAfter:null,lineSpacing:null,lineSpacingRule:null,spacingExplicit:null,indentLeft:null,indentRight:null,indentFirstLine:null,hangingIndent:false,numPr:null,numPrFromStyle:null,listNumFmt:null,listIsBullet:null,listMarker:null,listMarkerHidden:null,listMarkerFontFamily:null,listMarkerFontSize:null,listMarkerSuffix:null,listLevelNumFmts:null,listAbstractNumId:null,listStartOverride:null,styleId:null,borders:null,shading:null,tabs:null,pageBreakBefore:null,renderedPageBreakBefore:null,keepNext:null,keepLines:null,contextualSpacing:null,defaultTextFormatting:null,sectionBreakType:null,bidi:null,outlineLevel:null,bookmarks:null,_originalFormatting:null,_originalRunBoundaries:null,_sectionProperties:null,pPrIns:null,pPrDel:null,pPrChange:null},Gt={styleId:null,width:null,widthType:null,justification:null,columnWidths:null,tableLayout:null,floating:null,cellMargins:null,look:null,bidi:null,_originalFormatting:null,tblPrChange:null},Qt={height:null,heightRule:null,isHeader:false,_originalFormatting:null,trIns:null,trDel:null,trPrChange:null},Zt={colspan:1,rowspan:1,colwidth:null,width:null,widthType:null,verticalAlign:null,backgroundColor:null,borders:null,margins:null,textDirection:null,noWrap:false,_originalFormatting:null,_originalResolvedFill:null,cellMarker:null,tcPrChange:null},en=new Set(["bold","italic","superscript","subscript","allCaps","smallCaps","emboss","imprint","textShadow","textOutline","hidden","rtl"]);function w(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Y(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function S(e){return typeof e=="string"?e:void 0}function ee(e){if(Array.isArray(e))return e.map(ee);let t=w(e);if(!t)return e;let n={};for(let[r,o]of Object.entries(t))o!=null&&(n[r]=ee(o));return n}function V(e){if(e==null)return "null";if(Array.isArray(e))return `[${e.map(V).join(",")}]`;let t=w(e);return t?`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${V(t[n])}`).join(",")}}`:JSON.stringify(e)}function q(e){let t={...e};return delete t.hyperlink,delete t.ins,delete t.del,t}function ne(e){let t={};e.bold&&(t.bold=true,t.boldCs=true),e.italic&&(t.italic=true,t.italicCs=true);let n=w(e.underline);n&&(t.underline={style:S(n.style)||"single",color:w(n.color)??null});let r=w(e.strike);r&&(r.double?t.doubleStrike=true:t.strike=true);let o=w(e.textColor);o&&(t.color={rgb:S(o.rgb)??null,themeColor:o.themeColor??null,themeTint:S(o.themeTint)??null,themeShade:S(o.themeShade)??null}),typeof e.highlight=="string"&&(t.highlight=e.highlight);let s=w(e.fontSize);if(s){let m=Y(s.size),y=Y(s.sizeCs)??m;m!==void 0&&(t.fontSize=m),y!==void 0&&(t.fontSizeCs=y);}let l=w(e.fontFamily);if(l){let m=S(l.ascii);t.fontFamily={ascii:m??null,hAnsi:S(l.hAnsi)??null,eastAsia:S(l.eastAsia),cs:S(l.cs)||m,asciiTheme:l.asciiTheme??null,hAnsiTheme:S(l.hAnsiTheme),eastAsiaTheme:S(l.eastAsiaTheme),csTheme:S(l.csTheme)};}e.superscript&&(t.vertAlign="superscript"),e.subscript&&(t.vertAlign="subscript"),e.allCaps&&(t.allCaps=true),e.smallCaps&&(t.smallCaps=true);let a=w(e.characterSpacing);if(a){let m=Y(a.spacing),y=Y(a.position),k=Y(a.scale),T=Y(a.kerning);m!==void 0&&(t.spacing=m),y!==void 0&&(t.position=y),k!==void 0&&(t.scale=k),T!==void 0&&(t.kerning=T);}e.emboss&&(t.emboss=true),e.imprint&&(t.imprint=true),e.textShadow&&(t.shadow=true);let d=w(e.emphasisMark);d&&(t.emphasisMark=S(d.type)||"dot"),e.textOutline&&(t.outline=true),e.hidden&&(t.hidden=true),e.rtl&&(t.rtl=true);let p=w(e.textEffect);p&&(t.effect=S(p.effect)||"blinkBackground");let c=w(e.modernTextEffects);c?.effects&&(t.modernEffects=c.effects);let f=w(e.runStyle),g=S(f?.styleId);return g&&(t.styleId=g),t}function ot(e,t){let n=[],r="",o=()=>{r&&(n.push({type:"text",text:r}),r="");},s=t.fontFamily?[t.fontFamily.ascii,t.fontFamily.hAnsi,t.fontFamily.eastAsia,t.fontFamily.cs].filter(a=>!!a):[],l=s.length>0&&s.every(a=>a===s[0])?s[0]:null;for(let a of e){let d=a.codePointAt(0)??0;a==="\xAD"?(o(),n.push({type:"softHyphen"})):a==="\u2011"?(o(),n.push({type:"noBreakHyphen"})):l&&d>=61440&&d<=63743?(o(),n.push({type:"symbol",font:l,char:d.toString(16).toUpperCase().padStart(4,"0")})):r+=a;}return o(),n}function ye(e,t){let n=ne(q(t));return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:ot(e,n)}}function tn(e,t){for(let n of t.content){let r=e.content[e.content.length-1];r?.type==="text"&&n.type==="text"?r.text+=n.text:e.content.push(n);}}function nn(e){let t=0xcbf29ce484222325n;for(let n of new TextEncoder().encode(e))t=(t^BigInt(n))*0x100000001b3n,t&=0xffffffffffffffffn;return Number(t&(1n<<53n)-1n)}function me(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t=Number(e);return Number.isFinite(t)?t:nn(e)}return 0}function U(e,t=false){let n=w(e);if(!n)return null;let r=S(n.author)||"Unknown",o=S(n.date);return {id:me(n.revisionId??n.id),author:r,...o?{date:o}:{}}}function rn(e){let t=w(e.hyperlink);if(!t)return null;let n=S(t.href)||"";return n.startsWith("#")?{type:"hyperlink",anchor:n.slice(1),tooltip:S(t.tooltip)||void 0,children:[]}:{type:"hyperlink",href:n,tooltip:S(t.tooltip)||void 0,rId:S(t.rId)||void 0,children:[]}}function on(e){let t=w(e.hyperlink);return t?S(t.href)||"":null}function it(e,t){let n=S(e.fieldData);if(n&&n.length<=2e6)try{let c=JSON.parse(n),f=c.type==="simpleField"?c.content:c.fieldResult;if((c.type==="simpleField"||c.type==="complexField")&&typeof c.instruction=="string"&&Array.isArray(f)){let g=S(e.displayMode);return c.fieldTree&&g&&(c.fieldTree.displayMode=g),c}}catch{}let r=ne(q(t)),o={type:"run",content:[{type:"text",text:S(e.displayText)||""}],...Object.keys(r).length>0?{formatting:r}:{}},s=S(e.instruction)||"",l=S(e.fieldType)||"UNKNOWN",a=e.fldLock===true||void 0,d=e.dirty===true||void 0,p=S(e.displayMode)||"result";return e.fieldKind==="complex"?{type:"complexField",instruction:s,fieldType:l,fieldCode:[],fieldResult:[o],fldLock:a,dirty:d,fieldTree:{version:1,displayMode:p}}:{type:"simpleField",instruction:s,fieldType:l,content:[o],fldLock:a,dirty:d,fieldTree:{version:1,displayMode:p}}}function lt(e){return {type:"mathEquation",display:S(e.display)||"inline",ommlXml:S(e.ommlXml)||"",plainText:S(e.plainText)||void 0}}function st(e){let t=e,n={type:S(t.wrapType)||"inline"};t.distTop!==void 0&&(n.distT=c$1(Number(t.distTop))),t.distBottom!==void 0&&(n.distB=c$1(Number(t.distBottom))),t.distLeft!==void 0&&(n.distL=c$1(Number(t.distLeft))),t.distRight!==void 0&&(n.distR=c$1(Number(t.distRight))),t.wrapText&&(n.wrapText=t.wrapText);let r={type:"image",rId:S(t.rId)||"",src:S(t.src)||"",alt:S(t.alt)||void 0,title:S(t.title)||void 0,size:{width:c$1(Number(t.width)||0),height:c$1(Number(t.height)||0)},wrap:n};if(t.transform){let l={},a=t.transform.match(/rotate\(([-\d.]+)deg\)/)?.[1];a&&(l.rotation=Number.parseFloat(a)),t.transform.includes("scaleX(-1)")&&(l.flipH=true),t.transform.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(r.transform=l);}if(t.position?.horizontal&&t.position.vertical&&(r.position={horizontal:{relativeTo:t.position.horizontal.relativeTo||"column",alignment:t.position.horizontal.align,posOffset:t.position.horizontal.posOffset},vertical:{relativeTo:t.position.vertical.relativeTo||"paragraph",alignment:t.position.vertical.align,posOffset:t.position.vertical.posOffset}}),t.borderWidth&&t.borderWidth>0){let l={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};r.outline={width:c$1(t.borderWidth),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&l[t.borderStyle]||"solid"};}t.hlinkHref&&(r.hlinkHref=t.hlinkHref);let o={};t.cropTop!=null&&(o.top=t.cropTop),t.cropRight!=null&&(o.right=t.cropRight),t.cropBottom!=null&&(o.bottom=t.cropBottom),t.cropLeft!=null&&(o.left=t.cropLeft),Object.keys(o).length>0&&(r.crop=o),t.opacity!=null&&t.opacity<1&&(r.opacity=t.opacity),t.layoutInCell!=null&&(r.layoutInCell=t.layoutInCell),t.allowOverlap!=null&&(r.allowOverlap=t.allowOverlap);let s={};return t.effectExtentTop&&(s.top=c$1(t.effectExtentTop)),t.effectExtentBottom&&(s.bottom=c$1(t.effectExtentBottom)),t.effectExtentLeft&&(s.left=c$1(t.effectExtentLeft)),t.effectExtentRight&&(s.right=c$1(t.effectExtentRight)),Object.keys(s).length>0&&(r.padding=s),{type:"run",content:[{type:"drawing",image:r}]}}function at(e){let t={type:"shape",shapeType:S(e.shapeType)||"rect",id:S(e.shapeId)||void 0,size:{width:e.width?c$1(Number(e.width)):0,height:e.height?c$1(Number(e.height)):0}};if(Array.isArray(e.geometryPath)&&e.geometryPath.length>0&&(t.geometryPath=e.geometryPath),e.fillType==="gradient"&&typeof e.gradientStops=="string")try{let r=JSON.parse(e.gradientStops);t.fill={type:"gradient",gradient:{type:S(e.gradientType)||"linear",angle:Y(e.gradientAngle)||void 0,stops:r.map(o=>({position:o.position,color:{rgb:o.color.replace("#","")}}))}};}catch{t.fill={type:"solid",color:{rgb:(S(e.fillColor)||"000000").replace("#","")}};}else typeof e.fillColor=="string"?t.fill={type:S(e.fillType)||"solid",color:{rgb:e.fillColor.replace("#","")}}:e.fillType==="none"&&(t.fill={type:"none"});if(typeof e.outlineWidth=="number"&&e.outlineWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash"},o=S(e.outlineStyle);t.outline={width:c$1(e.outlineWidth),color:typeof e.outlineColor=="string"?{rgb:e.outlineColor.replace("#","")}:void 0,style:o&&r[o]||"solid"};}let n={};if(typeof e.rotation=="number")n.rotation=e.rotation;else if(typeof e.transform=="string"){let r=e.transform.match(/rotate\(([-\d.]+)deg\)/)?.[1];r&&(n.rotation=Number.parseFloat(r));}return (e.flipH||String(e.transform||"").includes("scaleX(-1)"))&&(n.flipH=true),(e.flipV||String(e.transform||"").includes("scaleY(-1)"))&&(n.flipV=true),(n.rotation||n.flipH||n.flipV)&&(t.transform=n),{type:"run",content:[{type:"shape",shape:t}]}}function ln(e){let t=se(e),n=S(e.propertiesJson);if(n&&n.length<=1e6)try{let l=JSON.parse(n);l&&typeof l=="object"&&typeof l.sdtType=="string"&&(t=l);}catch{}let r=[];for(let l of Array.isArray(e.content)?e.content:[]){let a=w(l),d=S(a?.kind);if(!a||!d)continue;let p=w(a.attrs)??{};if(d==="text"){let c=S(a.text);c!==void 0&&r.push({kind:"text",text:c,attributes:p});continue}r.push({kind:"embed",embedKind:d,payload:w(a.payload)??{},attributes:p});}let o=tt(be(r)),s=dt(e.value);if(s)try{let l=L(t,s);t=l.properties;let a=l.content[0];o=tt(a?.type==="paragraph"?a.content:[]);}catch{}return {type:"inlineSdt",properties:t,content:o}}function tt(e){return e.filter(t=>t.type==="run"||t.type==="hyperlink"||t.type==="simpleField"||t.type==="complexField"||t.type==="inlineSdt"||t.type==="mathEquation")}function dt(e){let t=w(e);return t?.kind==="checkbox"&&typeof t.checked=="boolean"?{kind:"checkbox",checked:t.checked}:t?.kind==="dropdown"&&typeof t.value=="string"?{kind:"dropdown",value:t.value}:t?.kind==="date"&&typeof t.date=="string"?{kind:"date",date:t.date}:null}function ut(e){if(e.modelKind!=="commentReference")return null;let t=Y(e.commentId);return {type:"run",content:[{type:"commentReference",...t!==void 0?{id:t}:{}}]}}function nt(e){if(e.kind==="text")return ye(e.text,e.attributes);switch(e.embedKind){case "break":return {type:"run",content:[{type:"break",breakType:"textWrapping"}]};case "tab":return {type:"run",content:[{type:"tab"}]};case "image":return st(e.payload);case "shape":return at(e.payload);case "field":return ut(e.payload)??it(e.payload,e.attributes);case "math":return lt(e.payload);case "sdt":return ln(e.payload);case "noteRef":{let t=e.payload.footnoteRefId,n=e.payload.endnoteRefId;return {type:"run",content:[t!==void 0?{type:"footnoteRef",id:me(t)}:{type:"endnoteRef",id:me(n)}]}}default:return null}}function sn(e,t){let n;if(e.kind==="embed"&&e.embedKind==="image")n=st(e.payload);else if(e.kind==="embed"&&e.embedKind==="shape")n=at(e.payload);else if(e.kind==="text"){let s=ne(q(e.attributes));n={type:"run",content:[{type:"text",text:e.text}],...Object.keys(s).length>0?{formatting:s}:{}};}else n={type:"run",content:[]};let o=(w(e.attributes.ins)??w(e.attributes.del))?.isMovePair===true;return e.attributes.ins?o?{type:"moveTo",info:t,content:[n]}:{type:"insertion",info:t,content:[n]}:o?{type:"moveFrom",info:t,content:[n]}:{type:"deletion",info:t,content:[n]}}function an(e,t){if(t.kind==="text"){e.children.push(ye(t.text,t.attributes));return}if(t.embedKind==="break")e.children.push({type:"run",content:[{type:"break",breakType:"textWrapping"}]});else if(t.embedKind==="tab")e.children.push({type:"run",content:[{type:"tab"}]});else if(t.embedKind==="field"){let n=ut(t.payload)??it(t.payload,t.attributes);n.type==="run"?e.children.push(n):(e.structuredChildren??(e.structuredChildren=[...e.children])).push(n);}else t.embedKind==="math"&&(e.structuredChildren??(e.structuredChildren=[...e.children])).push(lt(t.payload));}function be(e){let t=[],n=null,r=null,o=null,s=()=>{n&&t.push(n),n=null,r=null;},l=()=>{o&&t.push(o),o=null;};for(let a of e){if(a.kind==="embed"&&a.embedKind==="noteRef"){s(),l();let f=nt(a);f&&t.push(f);continue}let d=U(a.attributes.ins??a.attributes.del);if(d){s(),l(),t.push(sn(a,d));continue}let p=on(a.attributes);if(p!==null){s();let f=o?o.href||(o.anchor?`#${o.anchor}`:""):null;(!o||f!==p)&&(l(),o=rn(a.attributes)),o&&an(o,a);continue}if(l(),a.kind==="text"){let f=V(q(a.attributes)),g=ye(a.text,a.attributes);n&&r===f?tn(n,g):(s(),n=g,r=f);continue}s();let c=nt(a);c&&t.push(c);}return s(),l(),t}function dn(e){if(!e)return {};let t={};for(let n of e.split("|")){let r=n.indexOf(":");if(r<=0)return null;let o=n.slice(0,r),s;try{s=JSON.parse(n.slice(r+1));}catch{return null}o==="comment"||o==="footnoteRef"||(en.has(o)?t[o]=true:o==="highlight"?t.highlight=s.color:o==="insertion"||o==="deletion"?t[o==="insertion"?"ins":"del"]=ee({id:s.revisionId,author:s.author,date:s.date,isMovePair:s.isMovePair}):t[o]=ee(s));}return t}function un(e,t,n){if(!n?.length||!e.every(a=>a.type==="run"&&a.content.every(d=>d.type==="text"))||t.some(a=>a.kind!=="text"||a.attributes.hyperlink)||t.map(a=>a.kind==="text"?a.text:"").join("")!==n.map(a=>a.text).join(""))return e;let o=0,s=0,l=[];for(let a of n){let d=dn(a.marksKey);if(!d)return e;l.push(d);let p=a.text.length;for(;p>0;){let c=t[o];if(!c||V(q(c.attributes))!==V(d))return e;let f=c.text.length-s,g=Math.min(p,f);p-=g,s+=g,s===c.text.length&&(o+=1,s=0);}}return n.map((a,d)=>{let p=a.text.length===0?a.formatting:ne(l[d]),c={type:"run",content:ot(a.text,p??{})};return p&&Object.keys(p).length>0&&(c.formatting=p),a.propertyChanges?.length&&(c.propertyChanges=a.propertyChanges),c})}function Z(e){return e.content.reduce((t,n)=>n.type==="text"||n.type==="instrText"?t+n.text.length:n.type==="symbol"?t+n.char.length:n.type==="tab"||n.type==="softHyphen"||n.type==="noBreakHyphen"?t+1:t,0)}function te(e){switch(e.type){case "run":return Z(e);case "hyperlink":return e.children.reduce((t,n)=>t+(n.type==="run"?Z(n):0),0);case "simpleField":return e.content.reduce((t,n)=>t+te(n),0);case "complexField":return e.fieldResult.reduce((t,n)=>t+Z(n),0);case "inlineSdt":return e.content.reduce((t,n)=>t+te(n),0);case "insertion":case "deletion":case "moveFrom":case "moveTo":return e.content.reduce((t,n)=>t+(n.type==="run"?Z(n):0),0);case "mathEquation":return e.plainText?.length??0;default:return 0}}function cn(e,t){if(!e.content.every(o=>o.type==="text"))return [e,null];let n=e.content.map(o=>o.type==="text"?o.text:"").join(""),r=o=>o?{type:"run",...e.formatting?{formatting:e.formatting}:{},...e.propertyChanges?{propertyChanges:e.propertyChanges}:{},content:[{type:"text",text:o}]}:null;return [r(n.slice(0,t)),r(n.slice(t))]}function rt(e,t,n=r=>r.kind==="start"?{type:"commentRangeStart",id:r.id}:{type:"commentRangeEnd",id:r.id}){if(t.length===0)return e;let r=[...t].sort((d,p)=>d.offset-p.offset||(d.kind===p.kind?d.id-p.id:d.kind==="end"?-1:1)),o=[],s=0,l=0,a=d=>{for(;l<r.length&&r[l].offset===d;){let p=r[l++];o.push(n(p));}};a(0);for(let d of e){let p=te(d),c=r.slice(l).map(f=>f.offset).filter(f=>f>s&&f<s+p);if(d.type==="run"&&d.content.every(f=>f.type==="text")){let f=d,g=0;for(let m of c){if(!f)break;let[y,k]=cn(f,m-s-g);y&&o.push(y),a(m),f=k,g=m-s;}f&&o.push(f);}else o.push(d);s+=p,a(s);}return a(s),o}function fn(e){if(!Array.isArray(e.bookmarks))return [];let t=[];for(let n of e.bookmarks){let r=w(n),o=Y(r?.id);if(!r||o===void 0)continue;let s=Y(r.offset)??0,l={name:S(r.name),colFirst:Y(r.colFirst),colLast:Y(r.colLast)};r.kind==="start"?t.push({id:o,kind:"start",offset:s,...l}):r.kind==="end"?t.push({id:o,kind:"end",offset:s,...l}):(t.push({id:o,kind:"start",offset:0,...l}),t.push({id:o,kind:"end",offset:Number.MAX_SAFE_INTEGER,...l}));}return t}function pn(e){let t={...Xt,...e};return t.styleId=e.pStyle??null,t._sectionProperties=e.sectPr??null,delete t.pStyle,delete t.sectPr,t}function gn(e,t,n,r,o){let s=pn(t),l=be(n);l=un(l,n,Array.isArray(s._originalRunBoundaries)?s._originalRunBoundaries:void 0),l=rt(l,r);let a=fn(t).map(f=>({...f,offset:f.offset===Number.MAX_SAFE_INTEGER?l.reduce((g,m)=>g+te(m),0):f.offset}));a.length>0&&(l=rt(l,a,f=>{let g=f;return g.kind==="start"?{type:"bookmarkStart",id:g.id,name:g.name||"",...g.colFirst!==void 0?{colFirst:g.colFirst}:{},...g.colLast!==void 0?{colLast:g.colLast}:{},position:{offset:g.offset}}:{type:"bookmarkEnd",id:g.id,position:{offset:g.offset}}}));let d={type:"paragraph",paraId:e||void 0,textId:o?.textId,formatting:Ge(s),content:l};o?.renderedPageBreakBefore&&(d.renderedPageBreakBefore=true);let p=U(t.pPrIns,true),c=U(t.pPrDel,true);return p&&(d.pPrIns=p),c&&(d.pPrDel=c),Array.isArray(t.pPrChange)&&t.pPrChange.length>0&&(d.propertyChanges=t.pPrChange),t.sectPr?d.sectionProperties=t.sectPr:t.sectionBreakType&&(d.sectionProperties={sectionStart:t.sectionBreakType}),d}function mn(e){for(let t of e)for(let n of t.cells){let r=n.formatting?.borders;if(!r)continue;let o=r.top||r.left||r.right||r.bottom||r.insideH||r.insideV;return o?{top:r.top??o,bottom:r.bottom??o,left:r.left??o,right:r.right??o,insideH:r.insideH??r.bottom??o,insideV:r.insideV??r.right??o}:void 0}}function hn(e){let t=new Map;e.forEach((r,o)=>{let s=0;for(let l of r.cells){let a=s;if(s+=l.formatting?.gridSpan??1,l.formatting?.vMerge){let d=t.get(a)??[];d.push({rowIndex:o,cell:l}),t.set(a,d);}}});let n=r=>{r.formatting&&(delete r.formatting.vMerge,Object.keys(r.formatting).length===0&&(r.formatting=void 0));};for(let r of t.values()){let o=null,s=0,l=-1,a=()=>{o&&s<2&&n(o),o=null,s=0;};for(let d of r){let p=d.cell.formatting?.vMerge;p==="restart"?(a(),o=d.cell,s=1,l=d.rowIndex):p==="continue"&&(o&&d.rowIndex===l+1?(s+=1,l=d.rowIndex):(a(),n(d.cell)));}a();}}function yn(e,t){let n={...Zt,...t.tcPr??{}},r=t.story&&e.storyIds.has(t.story)?e.storyToBlocks(t.story).filter(l=>l.type==="paragraph"||l.type==="table"):[],o={type:"tableCell",formatting:et(n),content:r},s=n.cellMarker;if(s){let l=U(s.info,true)??{id:0,author:"Unknown"};s.kind==="ins"?o.structuralChange={type:"tableCellInsertion",info:l}:s.kind==="del"?o.structuralChange={type:"tableCellDeletion",info:l}:o.structuralChange={type:"tableCellMerge",info:l,...s.vMerge?{vMerge:s.vMerge}:{},...s.vMergeOrig?{vMergeOrig:s.vMergeOrig}:{}};}return Array.isArray(n.tcPrChange)&&n.tcPrChange.length>0&&(o.propertyChanges=n.tcPrChange),o}function bn(e,t){let n=Array.isArray(t.rows)?t.rows:[],r=[],o=[],s=0;n.forEach((m,y)=>{let k=0;for(let T of Array.isArray(m.cells)?m.cells:[]){for(;r[y]?.[k];)k+=1;let b=T.tcPr??{},v=Y(b.rowspan)||1,R=Y(b.colspan)||1;o.push({row:y,col:k,rowspan:v,colspan:R,cell:yn(e,T)});for(let x=y;x<y+v;x+=1){r[x]??(r[x]=[]);for(let B=k;B<k+R;B+=1)r[x][B]=true;}k+=R,s=Math.max(s,k);}});let l=new Map(o.map(m=>[`${m.row}-${m.col}`,m])),a=new Map;for(let m of o)for(let y=m.row;y<m.row+m.rowspan;y+=1)for(let k=m.col;k<m.col+m.colspan;k+=1)a.set(`${y}-${k}`,m);let d=n.map((m,y)=>{let k=[];for(let x=0;x<s;){let B=l.get(`${y}-${x}`);if(B){let i={...B.cell.formatting??{}};B.colspan>1?i.gridSpan=B.colspan:delete i.gridSpan,B.rowspan>1?i.vMerge="restart":i.vMerge!=="restart"&&i.vMerge!=="continue"&&delete i.vMerge,k.push({...B.cell,formatting:Object.keys(i).length>0?i:void 0}),x+=B.colspan;continue}let O=a.get(`${y}-${x}`);if(!O){x+=1;continue}let J={...O.cell.formatting??{}};O.colspan>1?J.gridSpan=O.colspan:delete J.gridSpan,J.vMerge="continue",k.push({...O.cell,content:[],formatting:J}),x+=O.colspan;}let T={...Qt,...m.trPr??{}},b={type:"tableRow",formatting:Ze(T),cells:k},v=U(T.trIns,true),R=U(T.trDel,true);return v?b.structuralChange={type:"tableRowInsertion",info:v}:R&&(b.structuralChange={type:"tableRowDeletion",info:R}),Array.isArray(T.trPrChange)&&T.trPrChange.length>0&&(b.propertyChanges=T.trPrChange),b});hn(d);let p=Array.isArray(t.grid)?t.grid.filter(m=>typeof m=="number"):[],c={...Gt,...t.tblPr??{},columnWidths:p.length>0?p:void 0},f=Qe(c);if(!f?.borders){let m=mn(d);m&&(f={...f??{},borders:m});}let g={type:"table",columnWidths:c.columnWidths||void 0,formatting:f,rows:d};return Array.isArray(c.tblPrChange)&&c.tblPrChange.length>0&&(g.propertyChanges=c.tblPrChange),g}function kn(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function Sn(e){let t=new Map,n=r=>{for(let o of r)if(o.type==="paragraph")o.paraId&&!t.has(o.paraId)&&t.set(o.paraId,o);else if(o.type==="table")for(let s of o.rows)for(let l of s.cells)n(l.content);else n(o.content);};n(e.package.document.content);for(let r of e.package.headers?.values()??[])n(r.content);for(let r of e.package.footers?.values()??[])n(r.content);for(let r of e.package.footnotes??[])n(r.content);for(let r of e.package.endnotes??[])n(r.content);return t}function Rn(e){let t=new Map,n=(r,o)=>{t.set(r,o);let s=0;for(let l of o){if(l.type!=="table")continue;let a=s++;l.rows.forEach((d,p)=>{d.cells.forEach((c,f)=>{n(`${r}:t${a}:r${p}c${f}`,c.content);});});}};n("body",e.package.document.content);for(let[r,o]of e.package.headers??[])n(`hf:${r}`,o.content);for(let[r,o]of e.package.footers??[])n(`hf:${r}`,o.content);for(let r of e.package.footnotes??[])n(`fn:${r.id}`,r.content);return t}function Tn(e,t){let n=new Map;for(let r of t??[]){let o;try{o=e.resolveComment(String(r.id));}catch{continue}let s=new Map;for(let l of o){let a=s.get(l.story)??[];a.push(l),s.set(l.story,a);}for(let[l,a]of s){if(a.length===0)continue;let d=Math.min(...a.map(f=>f.start)),p=Math.max(...a.map(f=>f.end)),c=n.get(l)??[];c.push({id:r.id,start:d,end:p}),n.set(l,c);}}return n}var he=class{constructor(t,n){b(this,"session",t);b(this,"storyIds");b(this,"baseParagraphs");b(this,"baseStories");b(this,"comments");this.storyIds=new Set(t.storyIds()),this.baseParagraphs=Sn(n),this.baseStories=Rn(n),this.comments=Tn(t,n.package.document.comments);}storyToBlocks(t){let n=[],r=this.baseStories.get(t),o=this.session.storySegments(t),s=this.comments.get(t)??[],l=[],a=0,d=0,p=0,c=g=>{let m=[];for(let y of s)y.start>=a&&y.start<=g&&m.push({id:y.id,kind:"start",offset:y.start-a}),y.end>=a&&y.end<=g&&m.push({id:y.id,kind:"end",offset:y.end-a});return m},f=(g,m)=>{let y=0;for(let k=0;k<g.length;k+=1)g[k]===" "&&(k>y&&l.push({kind:"text",text:g.slice(y,k),attributes:m}),l.push({kind:"embed",embedKind:"tab",payload:{},attributes:m}),y=k+1);y<g.length&&l.push({kind:"text",text:g.slice(y),attributes:m});};for(let g of o){if(g.kind==="text"){f(g.text,g.attributes),p+=g.text.length;continue}if(g.kind==="pilcrow"){let m=`${t}:p${d}`,y=g.paraId===m&&!this.baseParagraphs.has(g.paraId)?"":g.paraId;n.push(gn(y,g.properties,l,c(p),this.baseParagraphs.get(g.paraId))),l=[],d+=1,p+=1,a=p;continue}if(g.embedKind==="table")n.push(bn(this,g.payload));else if(g.embedKind==="blockSdt"){let m=S(g.payload.story),y=se(g.payload),k=m&&this.storyIds.has(m)?this.storyToBlocks(m):[],T=dt(g.payload.value);if(T)try{let b=L(y,T);y=b.properties,k=b.content;}catch{}n.push({type:"blockSdt",properties:y,content:k});}else if(g.embedKind==="opaque"){let m=w(g.payload.blob);if(m?.type==="pageBreak")n.push(kn());else {let y=r?.[n.length];m?.type==="blockSdt"&&y?.type==="blockSdt"&&n.push(y);}}else l.push(g);p+=1;}return l.length>0&&n.push({type:"paragraph",content:be(l)}),n}};function xn(e,t,n={}){let r=new he(e,t),o=c=>n.storyIds===void 0||n.storyIds.has(c),s=r.storyIds.has("body")&&o("body")?r.storyToBlocks("body"):t.package.document.content,l=t.package.headers;l&&(n.storyIds===void 0||[...l.keys()].some(c=>o(`hf:${c}`)))&&(l=new Map([...l].map(([c,f])=>{let g=`hf:${c}`;return [c,r.storyIds.has(g)&&o(g)?{...f,content:r.storyToBlocks(g)}:f]})));let a=t.package.footers;a&&(n.storyIds===void 0||[...a.keys()].some(c=>o(`hf:${c}`)))&&(a=new Map([...a].map(([c,f])=>{let g=`hf:${c}`;return [c,r.storyIds.has(g)&&o(g)?{...f,content:r.storyToBlocks(g)}:f]})));let p=n.storyIds===void 0||t.package.footnotes?.some(c=>o(`fn:${c.id}`))?t.package.footnotes?.map(c=>{let f=`fn:${c.id}`;return r.storyIds.has(f)&&o(f)?{...c,content:r.storyToBlocks(f),verbatimXml:void 0}:c}):t.package.footnotes;return {...t,package:{...t.package,document:{...t.package.document,content:s},...l?{headers:l}:{},...a?{footers:a}:{},...p?{footnotes:p}:{}}}}function Te(){return globalThis.__perfTrace}function ke(){return Te()?performance.now():0}function Se(e){return Te()?new TextEncoder().encode(e).byteLength:0}function Re(e,t,n){t!==0&&Te()?.record(e,performance.now()-t,n);}function Pn(){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]}return Math.floor(Math.random()*4294967295)}function ct(e){return JSON.stringify("revisionId"in e?{revisionId:e.revisionId}:{story:e.story,startPara:e.start.paraId,startOffset:e.start.offset,endPara:e.end.paraId,endOffset:e.end.offset})}function wn(e){return JSON.stringify(e.map(t=>({story:t.story,startPara:t.start.paraId,startOffset:t.start.offset,endPara:t.end.paraId,endOffset:t.end.offset})))}function Cn(e,t){let n=new Set,r=false,o=false,s=null,l,a=null,d=new Map,p=new Map,c=[],f=new Map,g=new Map,m=null,y=0,k=false,T=()=>{l=void 0,a=null;},b=i=>(T(),i()),v=i=>i?{anchor:{...i.anchor},head:{...i.head}}:null,R=i=>{s!==i&&(e.track_undo(i),s=i);},x=i=>{let u=`table:${i}`;s!==u&&(e.track_table_undo(i),s=u);},B=i=>{let u=h=>typeof h=="string"&&h===i||typeof h=="number"&&Number.isFinite(h)&&String(h)===i;for(let h of e.story_ids())if(JSON.parse(e.story_segments(h)).some(_=>_.kind==="embed"&&(u(_.payload.embedId)||u(_.payload.id)||u(_.payload.rId))))return h;return null},O=i=>{let u=B(i);u&&R(u);},J=()=>{r||(e.set_update_observer(i=>{for(let u of [...n])u(i);}),r=true);};return {clientId:t,registerFont:i=>{k||(e.clear_measure_fonts(),k=true);let u=e.register_measure_font(i);return c.push(i.slice()),u},clearFonts:()=>{e.clear_measure_fonts(),c.length=0,g.clear(),k=true;},measureParagraphJson:i=>{let u=e.measure_paragraph_json(i);return g.set(i,i),u},layoutDocumentJson:i=>{let u=e.layout_document_json(i);return m=i,y+=1,u},buildDisplayListJson:i=>e.build_display_list_json(i),buildDisplayListFrame:(i,u)=>e.build_display_list_frame(i,u),applyInput:(i,u)=>{let h=l?.head.story??"body";return R(h),b(()=>e.apply_input(i,u))},applyDelete:(i,u)=>{let h=l?.head.story??"body";return R(h),b(()=>e.apply_delete(i,u))},applyInputProfiled:(i,u)=>{let h=l?.head.story??"body";R(h);let P=b(()=>e.apply_input_profiled(i,u)),_=JSON.parse(e.apply_input_profile_json());return {frame:P,profile:_}},applyDeleteProfiled:(i,u)=>{let h=l?.head.story??"body";R(h);let P=b(()=>e.apply_delete_profiled(i,u)),_=JSON.parse(e.apply_input_profile_json());return {frame:P,profile:_}},residentWorkerSnapshot:()=>{if(!m||f.size===0)return null;let i=e.selection();return {clientId:t,state:e.encode_state(),selection:JSON.parse(i),fonts:c.map(u=>u.slice()),renderInputs:[...f].map(([u,h])=>({story:u,env:structuredClone(h)})),measureInputs:[...g.values()],layoutInput:m,layoutRevision:y}},displayHitTestRegionsJson:(i,u,h)=>e.display_hit_test_regions_json(i,u,h),displayRangeRectsJson:(i,u)=>e.display_range_rects_json(i,u),displayRangeRectsRegionJson:(i,u,h,P)=>e.display_range_rects_region_json(i,u,h,P),outlineGlyphJson:(i,u)=>e.outline_glyph_json(i,u),loadState:i=>b(()=>e.load(i)),loadStories:i=>b(()=>JSON.parse(e.load_json(JSON.stringify(i)))),encodeState:()=>e.encode_state(),applyUpdate:i=>b(()=>e.apply_update(i)),applyLocalUpdate:(i,u)=>{R(u),b(()=>e.apply_local_update(i));},onUpdate:i=>(n.add(i),J(),()=>{n.delete(i);}),setSelection:(i,u=i)=>{if(i.story!==u.story)throw new Error("yrs selection must stay inside one story");e.set_selection(i.story,i.paraId,i.offset,u.paraId,u.offset),l={anchor:{...i},head:{...u}};},selection:()=>{if(l!==void 0)return v(l);let i=ke(),u=e.selection();return l=JSON.parse(u),Re("selectionReads",i,{bytes:Se(u),calls:1,detail:"stickySelectionMiss"}),v(l)},setCellSelection:i=>e.set_cell_selection(JSON.stringify(i)),cellSelection:()=>JSON.parse(e.cell_selection()),beginUndoCapture:(i,u=false)=>u?x(i):R(i),markUndoGroup:i=>{let u=e.undo_depth(),h=Math.max(0,u-i);h>1&&d.set(u,h),p.clear();},undo:()=>b(()=>{let i=e.undo_depth(),u=d.get(i)??1,h=false;for(let P=0;P<u;P+=1)h=e.undo()||h;return h&&u>1&&(d.delete(i),p.set(e.redo_depth(),u)),h}),redo:()=>b(()=>{let i=e.redo_depth(),u=p.get(i)??1,h=false;for(let P=0;P<u;P+=1)h=e.redo()||h;return h&&u>1&&(p.delete(i),d.set(e.undo_depth(),u)),h}),canUndo:()=>e.can_undo(),canRedo:()=>e.can_redo(),undoDepth:()=>e.undo_depth(),redoDepth:()=>e.redo_depth(),createStory:(i,u,h="Normal",P="left")=>b(()=>JSON.parse(e.create_story(i,u,h,P))),deleteStory:i=>b(()=>e.delete_story(i)),insertTable:(i,u,h,P)=>(x(i.story),b(()=>JSON.parse(e.insert_table(i.story,i.paraId,i.offset,u,h,P?.name,P?.date)))),insertRow:(i,u,h)=>(x(i.story),b(()=>JSON.parse(e.insert_row(JSON.stringify(i),u==="below",h?.name,h?.date)))),insertColumn:(i,u)=>(x(i.story),b(()=>JSON.parse(e.insert_column(JSON.stringify(i),u==="right")))),deleteRow:(i,u)=>(x(i.anchor.story),b(()=>JSON.parse(e.delete_row(JSON.stringify(i),u?.name,u?.date)))),deleteColumn:i=>(x(i.anchor.story),b(()=>JSON.parse(e.delete_column(JSON.stringify(i))))),deleteTable:i=>(x(i.story),b(()=>JSON.parse(e.delete_table(JSON.stringify(i))))),mergeCells:i=>(x(i.anchor.story),b(()=>JSON.parse(e.merge_cells(JSON.stringify(i))))),splitCell:(i,u,h)=>(x(i.story),b(()=>JSON.parse(e.split_cell(JSON.stringify(i),u,h)))),setCellShading:(i,u)=>(x(i.anchor.story),b(()=>JSON.parse(e.set_cell_shading(JSON.stringify(i),u??void 0)))),setCellTextFormat:(i,u)=>(x(i.anchor.story),b(()=>JSON.parse(e.set_cell_text_format(JSON.stringify(i),JSON.stringify(u))))),setCellBorders:(i,u)=>(x(i.anchor.story),b(()=>JSON.parse(e.set_cell_borders(JSON.stringify(i),JSON.stringify(u))))),setColumnWidth:(i,u)=>(x(i.story),b(()=>JSON.parse(e.set_column_width(JSON.stringify(i),u)))),setTableWidth:(i,u)=>(x(i.story),b(()=>JSON.parse(e.set_table_width(JSON.stringify(i),u)))),insertText:(i,u,h)=>(R(i.story),b(()=>JSON.parse(e.insert_text(i.story,i.paraId,i.offset,u,h?.name,h?.date)))),deleteRange:(i,u)=>(R(i.story),b(()=>JSON.parse(e.delete_range(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,u?.name,u?.date)))),replaceRange:(i,u,h)=>(R(i.story),b(()=>JSON.parse(e.replace_range(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,u,h?.name,h?.date)))),splitParagraph:(i,u)=>(R(i.story),b(()=>JSON.parse(e.split_paragraph(i.story,i.paraId,i.offset,u?.name,u?.date)))),mergeParagraphs:(i,u,h)=>(R(i),b(()=>JSON.parse(e.merge_paragraphs(i,u,h?.name,h?.date)))),toggleMark:(i,u)=>{R(i.story),b(()=>e.toggle_mark(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,JSON.stringify(u)));},formatRange:(i,u)=>{R(i.story),b(()=>e.format_range(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,JSON.stringify(u)));},setHyperlink:(i,u)=>{R(i.story),b(()=>e.set_hyperlink(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,JSON.stringify(u)));},clearFormatting:i=>{R(i.story),b(()=>e.clear_formatting(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset));},applyParagraphStyle:(i,u,h)=>{R(i.story),b(()=>e.apply_paragraph_style(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,u,h?.name,h?.date));},setParagraphAttrs:(i,u,h)=>{R(i.story),b(()=>e.set_paragraph_attrs(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset,JSON.stringify(u),h?.name,h?.date));},insertImage:(i,u,h)=>(R(i.story),b(()=>JSON.parse(e.insert_image(i.story,i.paraId,i.offset,JSON.stringify(u),h?.name,h?.date)))),setContentControlValue:(i,u)=>{O(i),b(()=>e.set_content_control_value(i,JSON.stringify(u)));},setContentControlValueAt:(i,u)=>{R(i.story),b(()=>e.set_content_control_value_at(i.story,i.paraId,i.offset,JSON.stringify(u)));},clearContentControlValue:i=>{O(i),b(()=>e.clear_content_control_value(i));},setImageGeometry:(i,u)=>{O(i),b(()=>e.set_image_geometry(i,JSON.stringify(u)));},insertPageBreak:i=>{R(i.story),b(()=>e.insert_page_break(i.story,i.paraId,i.offset));},insertSectionBreak:(i,u)=>{R(i.story),b(()=>e.insert_section_break(i.story,i.paraId,i.offset,u));},insertWatermark:(i,u)=>{R(i.story),b(()=>e.insert_watermark(i.story,i.paraId,i.offset,JSON.stringify(u)));},applyRawOps:(i,u)=>b(()=>e.apply_raw_ops(i,JSON.stringify(u))),setParagraphAttr:(i,u,h)=>b(()=>e.set_paragraph_attr(i,u,JSON.stringify(h??null))),addComment:(i,u,h,P)=>b(()=>JSON.parse(e.add_comment(wn(i),u,h,JSON.stringify(P??null)))),acceptChange:i=>b(()=>JSON.parse(e.accept_change(ct(i)))),rejectChange:i=>b(()=>JSON.parse(e.reject_change(ct(i)))),selectionContext:i=>{let u=JSON.stringify(i);if(a?.key===u)return JSON.parse(a.json);let h=ke(),P=e.selection_context(i.story,i.start.paraId,i.start.offset,i.end.paraId,i.end.offset),_=JSON.parse(P);return a={key:u,json:P},Re("selectionContext",h,{bytes:Se(P),calls:1}),_},listRevisions:()=>JSON.parse(e.list_revisions()),resolveComment:i=>JSON.parse(e.resolve_comment(i)),storyIds:()=>e.story_ids(),storyLength:i=>e.story_len(i),storyChecksum:i=>BigInt(e.story_checksum(i)),yrsBlocksForStory:(i,u={})=>{let h=ke(),P=e.yrs_blocks_for_story(i,JSON.stringify(u)),_=JSON.parse(P);return f.set(i,structuredClone(u)),Re("storyBlocks",h,{bytes:Se(P),calls:1,detail:i}),_},paragraphs:i=>JSON.parse(e.paragraphs(i)),paragraphSpans:i=>JSON.parse(e.paragraph_spans(i)),storySegments:i=>JSON.parse(e.story_segments(i)),locateParagraph:(i,u)=>JSON.parse(e.locate_paragraph(i,u)),destroy:()=>{o||(o=true,n.clear(),r&&e.clear_update_observer(),e.free());}}}async function cr(e){let t=e?.clientId??Pn(),n=await import('../wasm-FZQ5XB2Y.mjs');return await n.preloadEditWasm(),Cn(n.createEditSession(t),t)}export{ie as ResidentEngineWorkerClient,pt as canUseResidentEngineWorker,An as compareYrsLocs,In as createYrsInputPositionMap,cr as createYrsSession,vn as displayPositionToYrsLoc,qt as documentToYrs,Ae as yrsLocToDisplayPosition,xn as yrsToDocument};
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1 @@
1
+ import'../chunk-EUUIJVM6.mjs';import {a as a$1,b as b$1}from'../chunk-NEWOMDTX.mjs';import {t as t$1,r,a,g as g$1,i}from'../chunk-6NEKRDXF.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';async function D(){await a$1();let e=b$1(j()),o=new Set,r=false,a=false,s=null,f=null,d=n=>{s!==n&&(e.track_undo(n),s=n);},c=()=>{r||(e.set_update_observer(n=>{for(let i of [...o])i(n);}),r=true);};return {registerFont:n=>e.register_measure_font(n),clearFonts:()=>e.clear_measure_fonts(),measureParagraphJson:n=>e.measure_paragraph_json(n),layoutDocumentJson:n=>e.layout_document_json(n),buildDisplayListFrame:(n,i)=>e.build_display_list_frame(n,i),applyInput:(n,i)=>(d(f?.story??"body"),e.apply_input(n,i)),applyDelete:(n,i)=>(d(f?.story??"body"),e.apply_delete(n,i)),applyInputProfiled:(n,i)=>{d(f?.story??"body");let y=e.apply_input_profiled(n,i),u=JSON.parse(e.apply_input_profile_json());return {frame:y,profile:u}},applyDeleteProfiled:(n,i)=>{d(f?.story??"body");let y=e.apply_delete_profiled(n,i),u=JSON.parse(e.apply_input_profile_json());return {frame:y,profile:u}},outlineGlyphJson:(n,i)=>e.outline_glyph_json(n,i),loadState:n=>e.load(n),applyUpdate:n=>e.apply_update(n),onUpdate:n=>(o.add(n),c(),()=>o.delete(n)),setSelection:(n,i=n)=>{if(n.story!==i.story)throw new Error("yrs selection must stay inside one story");e.set_selection(n.story,n.paraId,n.offset,i.paraId,i.offset),f={...i};},yrsBlocksForStory:(n,i={})=>JSON.parse(e.yrs_blocks_for_story(n,JSON.stringify(i))),destroy:()=>{a||(a=true,o.clear(),r&&e.clear_update_observer(),e.free());}}}function j(){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]}return Math.floor(Math.random()*4294967295)}var C=self,t=null,g=null,l=[],_=0,U=Promise.resolve(),p=null,h=null,m=new Map,S=new Map,v=new Set,L=1,W=1;C.onmessage=e=>{U=U.then(()=>z(e.data)).catch(o=>{b({id:e.data.id,ok:false,error:o instanceof Error?o.message:String(o)});});};async function z(e){if(e.type==="destroy"){B();return}if(e.type==="bootstrap"){B(),t=await D(),O(e.snapshot),A();let r=performance.now(),a=t.buildDisplayListFrame(e.extras,e.expectedFrameEpoch);await w(e.id,a,performance.now()-r,l,void 0,r);return}if(!t)throw new Error("Resident engine worker is not initialized");if(e.type==="sync"){g?.(),g=null,O(e.snapshot),A();let r=performance.now(),a=t.buildDisplayListFrame(e.extras,e.expectedFrameEpoch);await w(e.id,a,performance.now()-r,l,void 0,r);return}if(e.type==="buildFrame"){l=[];let r=performance.now(),a=t.buildDisplayListFrame(e.extras,e.expectedFrameEpoch);await w(e.id,a,performance.now()-r,l,void 0,r);return}if(e.type==="applyUpdate"){t.applyUpdate(e.update),e.selection&&t.setSelection(e.selection.anchor,e.selection.head);return}if(e.type==="attachCanvases"){for(let{pageId:r,canvas:a}of e.pages)m.set(r,a);v=new Set(e.activePageIds),L=e.devicePixelRatio,W=e.zoom;for(let r of m.keys())v.has(r)||(m.delete(r),S.delete(r));await Y(true),b({id:e.id,ok:true});return}t.setSelection(e.selection.anchor,e.selection.head),l=[];let o=performance.now();try{let r=e.type==="applyDelete"?e.profile?t.applyDeleteProfiled(e.direction,e.expectedFrameEpoch):{frame:t.applyDelete(e.direction,e.expectedFrameEpoch),profile:void 0}:e.profile?t.applyInputProfiled(e.text,e.expectedFrameEpoch):{frame:t.applyInput(e.text,e.expectedFrameEpoch),profile:void 0};await w(e.id,r.frame,performance.now()-o,l,r.profile,o);}catch(r){let a=r instanceof Error?r.message:String(r);b({id:e.id,ok:false,error:a,residentUnavailable:a.includes("resident input state is not ready")});}finally{l=[];}}function O(e){if(!t)throw new Error("Resident engine worker is not initialized");t.loadState(e.state),t.clearFonts();for(let o of e.fonts)t.registerFont(o);for(let{story:o,env:r}of e.renderInputs)t.yrsBlocksForStory(o,r);for(let o of e.measureInputs)t.measureParagraphJson(o);t.layoutDocumentJson(e.layoutInput),e.selection&&t.setSelection(e.selection.anchor,e.selection.head),_=e.layoutRevision,l=[];}function A(){t&&(g=t.onUpdate(e=>l.push(e.slice())));}function B(){g?.(),g=null,t?.destroy(),t=null,l=[],_=0,p=null,h=null,m.clear(),S.clear(),v.clear();}async function w(e,o,r$1,a=l,s,f=performance.now()){p=t$1(p,r(o)),p={...p,pages:p.pages.map(u=>({...u,primitiveIds:u.primitiveIds.slice()}))};let d=performance.now(),c=await Y(false),n=performance.now()-d,i=J(o),y=a.map(J);b({id:e,ok:true,frame:i,updates:y,engineMs:r$1,workerTotalMs:performance.now()-f,engineProfile:s,replayMs:n,replayedPages:c,layoutRevision:_},[i,...y]);}async function Y(e){if(!p||m.size===0)return 0;!h&&t&&(h=new a({provider:(a,s)=>t.outlineGlyphJson(a,s)}));let o=[];for(let a=0;a<p.pages.length;a+=1){let s=p.pages[a];if(!e&&!p.damagedPageIds.has(s.pageId))continue;let f=m.get(s.pageId.toString()),d=p.displayList.pages[a];if(!f||!d)continue;let c=s.pageId.toString(),n=S.get(c);n||(n=new OffscreenCanvas(1,1),S.set(c,n)),o.push(g$1(n,d,{glyphCache:h??void 0},L,W).then(()=>({canvas:f,buffer:n,page:d})));}let r=await Promise.all(o);for(let{canvas:a,buffer:s}of r)i(a,s);return r.length}function J(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}function b(e,o=[]){C.postMessage(e,o);}
package/package.json ADDED
@@ -0,0 +1,365 @@
1
+ {
2
+ "name": "@betteroffice/docx",
3
+ "version": "0.0.1",
4
+ "sideEffects": [
5
+ "**/residentEngineWorker.*"
6
+ ],
7
+ "description": "Framework-agnostic core for DOCX parsing, editing, and rendering",
8
+ "main": "./dist/core.mjs",
9
+ "module": "./dist/core.mjs",
10
+ "types": "./dist/core.d.mts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/core.d.mts",
14
+ "import": "./dist/core.mjs"
15
+ },
16
+ "./headless": {
17
+ "types": "./dist/headless.d.mts",
18
+ "import": "./dist/headless.mjs"
19
+ },
20
+ "./core-plugins": {
21
+ "types": "./dist/core-plugins.d.mts",
22
+ "import": "./dist/core-plugins.mjs"
23
+ },
24
+ "./mcp": {
25
+ "types": "./dist/mcp.d.mts",
26
+ "import": "./dist/mcp.mjs"
27
+ },
28
+ "./docx": {
29
+ "types": "./dist/docx/index.d.mts",
30
+ "import": "./dist/docx/index.mjs"
31
+ },
32
+ "./docx/wrapTypes": {
33
+ "types": "./dist/docx/wrapTypes.d.mts",
34
+ "import": "./dist/docx/wrapTypes.mjs"
35
+ },
36
+ "./docx/serializer": {
37
+ "types": "./dist/docx/serializer/index.d.mts",
38
+ "import": "./dist/docx/serializer/index.mjs"
39
+ },
40
+ "./agent": {
41
+ "types": "./dist/agent/index.d.mts",
42
+ "import": "./dist/agent/index.mjs"
43
+ },
44
+ "./styles": {
45
+ "types": "./dist/styles/index.d.mts",
46
+ "import": "./dist/styles/index.mjs"
47
+ },
48
+ "./layout/pagination": {
49
+ "types": "./dist/layout/pagination/index.d.mts",
50
+ "import": "./dist/layout/pagination/index.mjs"
51
+ },
52
+ "./layout/render": {
53
+ "types": "./dist/layout/render/index.d.mts",
54
+ "import": "./dist/layout/render/index.mjs"
55
+ },
56
+ "./layout": {
57
+ "types": "./dist/layout/index.d.mts",
58
+ "import": "./dist/layout/index.mjs"
59
+ },
60
+ "./plugin-api": {
61
+ "types": "./dist/plugin-api/index.d.mts",
62
+ "import": "./dist/plugin-api/index.mjs"
63
+ },
64
+ "./plugin-api/RenderedDomContext": {
65
+ "types": "./dist/plugin-api/RenderedDomContext.d.mts",
66
+ "import": "./dist/plugin-api/RenderedDomContext.mjs"
67
+ },
68
+ "./plugin-api/resolveItemPositions": {
69
+ "types": "./dist/plugin-api/resolveItemPositions.d.mts",
70
+ "import": "./dist/plugin-api/resolveItemPositions.mjs"
71
+ },
72
+ "./plugin-api/types": {
73
+ "types": "./dist/plugin-api/types.d.mts",
74
+ "import": "./dist/plugin-api/types.mjs"
75
+ },
76
+ "./types/document": {
77
+ "types": "./dist/types/document.d.mts",
78
+ "import": "./dist/types/document.mjs"
79
+ },
80
+ "./types/content": {
81
+ "types": "./dist/types/content.d.mts",
82
+ "import": "./dist/types/content.mjs"
83
+ },
84
+ "./types/agentApi": {
85
+ "types": "./dist/types/agentApi.d.mts",
86
+ "import": "./dist/types/agentApi.mjs"
87
+ },
88
+ "./utils": {
89
+ "types": "./dist/utils/index.d.mts",
90
+ "import": "./dist/utils/index.mjs"
91
+ },
92
+ "./utils/cardStyles": {
93
+ "types": "./dist/utils/cardStyles.d.mts",
94
+ "import": "./dist/utils/cardStyles.mjs"
95
+ },
96
+ "./utils/comments": {
97
+ "types": "./dist/utils/comments.d.mts",
98
+ "import": "./dist/utils/comments.mjs"
99
+ },
100
+ "./utils/stylePreview": {
101
+ "types": "./dist/utils/stylePreview.d.mts",
102
+ "import": "./dist/utils/stylePreview.mjs"
103
+ },
104
+ "./utils/findReplace": {
105
+ "types": "./dist/utils/findReplace.d.mts",
106
+ "import": "./dist/utils/findReplace.mjs"
107
+ },
108
+ "./utils/findVerticalScrollParent": {
109
+ "types": "./dist/utils/findVerticalScrollParent.d.mts",
110
+ "import": "./dist/utils/findVerticalScrollParent.mjs"
111
+ },
112
+ "./utils/fontOptions": {
113
+ "types": "./dist/utils/fontOptions.d.mts",
114
+ "import": "./dist/utils/fontOptions.mjs"
115
+ },
116
+ "./utils/headingCollector": {
117
+ "types": "./dist/utils/headingCollector.d.mts",
118
+ "import": "./dist/utils/headingCollector.mjs"
119
+ },
120
+ "./utils/highlightColors": {
121
+ "types": "./dist/utils/highlightColors.d.mts",
122
+ "import": "./dist/utils/highlightColors.mjs"
123
+ },
124
+ "./utils/listState": {
125
+ "types": "./dist/utils/listState.d.mts",
126
+ "import": "./dist/utils/listState.mjs"
127
+ },
128
+ "./utils/reportIssue": {
129
+ "types": "./dist/utils/reportIssue.d.mts",
130
+ "import": "./dist/utils/reportIssue.mjs"
131
+ },
132
+ "./utils/sidebarConstants": {
133
+ "types": "./dist/utils/sidebarConstants.d.mts",
134
+ "import": "./dist/utils/sidebarConstants.mjs"
135
+ },
136
+ "./utils/textSelection": {
137
+ "types": "./dist/utils/textSelection.d.mts",
138
+ "import": "./dist/utils/textSelection.mjs"
139
+ },
140
+ "./utils/units": {
141
+ "types": "./dist/utils/units.d.mts",
142
+ "import": "./dist/utils/units.mjs"
143
+ },
144
+ "./utils/autoScroll": {
145
+ "types": "./dist/utils/autoScroll.d.mts",
146
+ "import": "./dist/utils/autoScroll.mjs"
147
+ },
148
+ "./yrs": {
149
+ "types": "./dist/yrs/index.d.mts",
150
+ "import": "./dist/yrs/index.mjs"
151
+ },
152
+ "./docx/parser": {
153
+ "types": "./dist/docx/parser.d.mts",
154
+ "import": "./dist/docx/parser.mjs"
155
+ },
156
+ "./docx/rezip": {
157
+ "types": "./dist/docx/rezip.d.mts",
158
+ "import": "./dist/docx/rezip.mjs"
159
+ },
160
+ "./layout/measure": {
161
+ "types": "./dist/layout/measure/index.d.mts",
162
+ "import": "./dist/layout/measure/index.mjs"
163
+ },
164
+ "./layout/flow": {
165
+ "types": "./dist/layout/flow/index.d.mts",
166
+ "import": "./dist/layout/flow/index.mjs"
167
+ },
168
+ "./layout/pagination/types": {
169
+ "types": "./dist/layout/pagination/types.d.mts",
170
+ "import": "./dist/layout/pagination/types.mjs"
171
+ },
172
+ "./managers/AutoSaveManager": {
173
+ "types": "./dist/managers/AutoSaveManager.d.mts",
174
+ "import": "./dist/managers/AutoSaveManager.mjs"
175
+ },
176
+ "./managers/TableSelectionManager": {
177
+ "types": "./dist/managers/TableSelectionManager.d.mts",
178
+ "import": "./dist/managers/TableSelectionManager.mjs"
179
+ },
180
+ "./managers/types": {
181
+ "types": "./dist/managers/types.d.mts",
182
+ "import": "./dist/managers/types.mjs"
183
+ },
184
+ "./editor": {
185
+ "types": "./dist/editor/index.d.mts",
186
+ "import": "./dist/editor/index.mjs"
187
+ }
188
+ },
189
+ "typesVersions": {
190
+ "*": {
191
+ "headless": [
192
+ "./dist/headless.d.mts"
193
+ ],
194
+ "core-plugins": [
195
+ "./dist/core-plugins.d.mts"
196
+ ],
197
+ "mcp": [
198
+ "./dist/mcp.d.mts"
199
+ ],
200
+ "docx": [
201
+ "./dist/docx/index.d.mts"
202
+ ],
203
+ "docx/wrapTypes": [
204
+ "./dist/docx/wrapTypes.d.mts"
205
+ ],
206
+ "docx/serializer": [
207
+ "./dist/docx/serializer/index.d.mts"
208
+ ],
209
+ "agent": [
210
+ "./dist/agent/index.d.mts"
211
+ ],
212
+ "styles": [
213
+ "./dist/styles/index.d.mts"
214
+ ],
215
+ "layout/pagination": [
216
+ "./dist/layout/pagination/index.d.mts"
217
+ ],
218
+ "layout/render": [
219
+ "./dist/layout/render/index.d.mts"
220
+ ],
221
+ "layout": [
222
+ "./dist/layout/index.d.mts"
223
+ ],
224
+ "plugin-api": [
225
+ "./dist/plugin-api/index.d.mts"
226
+ ],
227
+ "plugin-api/RenderedDomContext": [
228
+ "./dist/plugin-api/RenderedDomContext.d.mts"
229
+ ],
230
+ "plugin-api/resolveItemPositions": [
231
+ "./dist/plugin-api/resolveItemPositions.d.mts"
232
+ ],
233
+ "plugin-api/types": [
234
+ "./dist/plugin-api/types.d.mts"
235
+ ],
236
+ "types/document": [
237
+ "./dist/types/document.d.mts"
238
+ ],
239
+ "types/content": [
240
+ "./dist/types/content.d.mts"
241
+ ],
242
+ "types/agentApi": [
243
+ "./dist/types/agentApi.d.mts"
244
+ ],
245
+ "utils": [
246
+ "./dist/utils/index.d.mts"
247
+ ],
248
+ "utils/cardStyles": [
249
+ "./dist/utils/cardStyles.d.mts"
250
+ ],
251
+ "utils/comments": [
252
+ "./dist/utils/comments.d.mts"
253
+ ],
254
+ "utils/stylePreview": [
255
+ "./dist/utils/stylePreview.d.mts"
256
+ ],
257
+ "utils/findReplace": [
258
+ "./dist/utils/findReplace.d.mts"
259
+ ],
260
+ "utils/findVerticalScrollParent": [
261
+ "./dist/utils/findVerticalScrollParent.d.mts"
262
+ ],
263
+ "utils/fontOptions": [
264
+ "./dist/utils/fontOptions.d.mts"
265
+ ],
266
+ "utils/headingCollector": [
267
+ "./dist/utils/headingCollector.d.mts"
268
+ ],
269
+ "utils/highlightColors": [
270
+ "./dist/utils/highlightColors.d.mts"
271
+ ],
272
+ "utils/listState": [
273
+ "./dist/utils/listState.d.mts"
274
+ ],
275
+ "utils/reportIssue": [
276
+ "./dist/utils/reportIssue.d.mts"
277
+ ],
278
+ "utils/sidebarConstants": [
279
+ "./dist/utils/sidebarConstants.d.mts"
280
+ ],
281
+ "utils/textSelection": [
282
+ "./dist/utils/textSelection.d.mts"
283
+ ],
284
+ "utils/units": [
285
+ "./dist/utils/units.d.mts"
286
+ ],
287
+ "utils/autoScroll": [
288
+ "./dist/utils/autoScroll.d.mts"
289
+ ],
290
+ "docx/parser": [
291
+ "./dist/docx/parser.d.mts"
292
+ ],
293
+ "docx/rezip": [
294
+ "./dist/docx/rezip.d.mts"
295
+ ],
296
+ "layout/measure": [
297
+ "./dist/layout/measure/index.d.mts"
298
+ ],
299
+ "layout/flow": [
300
+ "./dist/layout/flow/index.d.mts"
301
+ ],
302
+ "layout/pagination/types": [
303
+ "./dist/layout/pagination/types.d.mts"
304
+ ],
305
+ "yrs": [
306
+ "./dist/yrs/index.d.mts"
307
+ ],
308
+ "managers/AutoSaveManager": [
309
+ "./dist/managers/AutoSaveManager.d.mts"
310
+ ],
311
+ "managers/TableSelectionManager": [
312
+ "./dist/managers/TableSelectionManager.d.mts"
313
+ ],
314
+ "managers/types": [
315
+ "./dist/managers/types.d.mts"
316
+ ],
317
+ "editor": [
318
+ "./dist/editor/index.d.mts"
319
+ ]
320
+ }
321
+ },
322
+ "bin": {
323
+ "docx-editor-mcp": "./dist/mcp-cli.mjs"
324
+ },
325
+ "files": [
326
+ "dist"
327
+ ],
328
+ "scripts": {
329
+ "build": "bun ../../scripts/build-docx-wasm.ts && NODE_OPTIONS=--max-old-space-size=8192 tsup && bun scripts/copy-assets.ts",
330
+ "typecheck": "tsc --noEmit",
331
+ "build:wasm": "bun ../../scripts/build-docx-wasm.ts"
332
+ },
333
+ "dependencies": {
334
+ "docxtemplater": "^3.50.0",
335
+ "dompurify": "^3.2.0",
336
+ "pizzip": "^3.1.7",
337
+ "xml-js": "^1.6.11"
338
+ },
339
+ "devDependencies": {
340
+ "@betteroffice/drawingml": "workspace:*",
341
+ "jszip": "^3.10.1",
342
+ "tsup": "^8.0.1",
343
+ "typescript": "^6.0.3",
344
+ "@types/bun": "^1.0.0",
345
+ "@types/node": "^26.0.0"
346
+ },
347
+ "keywords": [
348
+ "docx",
349
+ "editor",
350
+ "template",
351
+ "word",
352
+ "document"
353
+ ],
354
+ "author": "OpenOOXML",
355
+ "license": "Apache-2.0",
356
+ "homepage": "https://betteroffice.dev/",
357
+ "repository": {
358
+ "type": "git",
359
+ "url": "https://github.com/openooxml/betteroffice.git",
360
+ "directory": "packages/docx"
361
+ },
362
+ "publishConfig": {
363
+ "access": "public"
364
+ }
365
+ }