@betteroffice/docx 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -598
  3. package/dist/chunk-25WGDXBF.mjs +1 -0
  4. package/dist/chunk-2CCPNW44.mjs +1 -0
  5. package/dist/chunk-32A4I3T4.mjs +1 -0
  6. package/dist/chunk-4LO3PSLZ.mjs +2 -0
  7. package/dist/chunk-67MGRMP3.mjs +1 -0
  8. package/dist/chunk-6AUR4AA2.mjs +1 -0
  9. package/dist/chunk-6WT6HKAY.mjs +1 -0
  10. package/dist/chunk-77ZWGQZN.mjs +1 -0
  11. package/dist/chunk-7C3Y7LIH.mjs +1 -0
  12. package/dist/chunk-7WIUNGQW.mjs +1 -0
  13. package/dist/chunk-7WWFGMMF.mjs +1 -0
  14. package/dist/chunk-AK2NG7PT.mjs +1 -0
  15. package/dist/chunk-BR5BFOHF.mjs +1 -0
  16. package/dist/chunk-CDNWHQH2.mjs +1 -0
  17. package/dist/chunk-CRTTEHZN.mjs +1 -0
  18. package/dist/chunk-ETDMQ5GE.mjs +1 -0
  19. package/dist/{wasm-KSZTTO3B.mjs → chunk-GBOHQ3CJ.mjs} +1 -1
  20. package/dist/chunk-H7K4SJKK.mjs +1 -0
  21. package/dist/chunk-ICJH7QUY.mjs +1 -0
  22. package/dist/chunk-IHETKRDA.mjs +1 -0
  23. package/dist/chunk-ISBZLVIF.mjs +1 -0
  24. package/dist/chunk-JSYH6HNV.mjs +2 -0
  25. package/dist/chunk-KICHSQFN.mjs +1 -0
  26. package/dist/chunk-KXIGXLFA.mjs +5 -0
  27. package/dist/chunk-KXLTK7AT.mjs +57 -0
  28. package/dist/chunk-L3JRNJ34.mjs +1 -0
  29. package/dist/chunk-LKDHP22R.mjs +1 -0
  30. package/dist/chunk-LPOEM5WH.mjs +1 -0
  31. package/dist/chunk-M44BABH2.mjs +1 -0
  32. package/dist/chunk-MAYPJU23.mjs +1 -0
  33. package/dist/chunk-N5RE2S3U.mjs +2 -0
  34. package/dist/chunk-NLYHFVF5.mjs +1 -0
  35. package/dist/chunk-ONYCW7VV.mjs +4 -0
  36. package/dist/chunk-QGZ2AB3M.mjs +1 -0
  37. package/dist/chunk-QWHU7YIW.mjs +2 -0
  38. package/dist/{chunk-VH7P4734.mjs → chunk-QX2CDKPG.mjs} +1 -1
  39. package/dist/chunk-RGDE6YQB.mjs +1 -0
  40. package/dist/chunk-TE3AU2JK.mjs +1 -0
  41. package/dist/chunk-UDVEZ722.mjs +1 -0
  42. package/dist/chunk-UQSVFDRV.mjs +2 -0
  43. package/dist/chunk-VHOOSS4D.mjs +1 -0
  44. package/dist/chunk-WIDM4EMT.mjs +1 -0
  45. package/dist/chunk-YITJ4QAO.mjs +1 -0
  46. package/dist/collaboration/index.d.mts +111 -11
  47. package/dist/collaboration/index.mjs +1 -1
  48. package/dist/{content-DSb-6a9T.d.mts → content-DVT06V_6.d.mts} +24 -3
  49. package/dist/core.d.mts +9 -9
  50. package/dist/core.mjs +1 -1
  51. package/dist/displayListQueries-6XjS7B5e.d.mts +1473 -0
  52. package/dist/docx/index.d.mts +8 -7
  53. package/dist/docx/index.mjs +1 -2
  54. package/dist/docxWorker.mjs +1 -0
  55. package/dist/editor/index.d.mts +14 -12
  56. package/dist/editor/index.mjs +1 -1
  57. package/dist/{fontLoader-BNSs0E8K.d.mts → fontLoader-CBkmh4ps.d.mts} +1 -1
  58. package/dist/{formatting-gqLFeJ9X.d.mts → formatting-p5MneNuy.d.mts} +32 -1
  59. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  60. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  61. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  62. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  63. package/dist/index-C-KKULi5.d.mts +5596 -0
  64. package/dist/layout/index.d.mts +4 -4
  65. package/dist/layout/index.mjs +1 -1
  66. package/dist/layout/pagination/index.d.mts +4 -4
  67. package/dist/layout/render/index.d.mts +37 -53
  68. package/dist/layout/render/index.mjs +3 -1
  69. package/dist/{pagedExport-BmSlEhoP.d.mts → pagedExport-DDgA5O7E.d.mts} +92 -9
  70. package/dist/plugin-api/RenderedDomContext.d.mts +5 -7
  71. package/dist/plugin-api/index.d.mts +3 -3
  72. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  73. package/dist/{rezip-Bxiq4Z_R.d.mts → rezip-CfwAYdV4.d.mts} +7 -1
  74. package/dist/styles/index.d.mts +3 -3
  75. package/dist/styles/index.mjs +1 -1
  76. package/dist/{styles-AryxLAhx.d.mts → styles-DZZz2oRy.d.mts} +2 -2
  77. package/dist/types/content.d.mts +2 -2
  78. package/dist/types/document.d.mts +6 -6
  79. package/dist/{types-Cz7S77Ut.d.mts → types-bvPg3KsF.d.mts} +16 -3
  80. package/dist/utils/comments.d.mts +2 -2
  81. package/dist/utils/findReplace.mjs +1 -2
  82. package/dist/utils/index.d.mts +5 -5
  83. package/dist/utils/index.mjs +1 -1
  84. package/dist/utils/listState.d.mts +2 -5
  85. package/dist/utils/stylePreview.d.mts +2 -2
  86. package/dist/utils/stylePreview.mjs +1 -1
  87. package/dist/wasm-edit.d.mts +233 -48
  88. package/dist/wasm-edit.mjs +1 -1
  89. package/dist/wasm-layout.d.mts +7 -1
  90. package/dist/wasm-layout.mjs +1 -1
  91. package/dist/wasm-opc.mjs +1 -1
  92. package/dist/wasm-parse.d.mts +7 -1
  93. package/dist/wasm-parse.mjs +1 -1
  94. package/dist/worker.d.mts +60 -0
  95. package/dist/worker.mjs +1 -0
  96. package/dist/yrs/docxWorker.d.mts +20 -0
  97. package/dist/yrs/docxWorker.mjs +3 -0
  98. package/dist/yrs/index.d.mts +12 -7
  99. package/dist/yrs/index.mjs +1 -1
  100. package/package.json +14 -4
  101. package/dist/chunk-3RPZ44TT.mjs +0 -1
  102. package/dist/chunk-47Q2FMFF.mjs +0 -1
  103. package/dist/chunk-5Z22FORG.mjs +0 -1
  104. package/dist/chunk-7ZV6P6NZ.mjs +0 -57
  105. package/dist/chunk-AXFMDV66.mjs +0 -1
  106. package/dist/chunk-EBYC3CX7.mjs +0 -1
  107. package/dist/chunk-FK7X7557.mjs +0 -1
  108. package/dist/chunk-GKWXOZZH.mjs +0 -1
  109. package/dist/chunk-LIOWZSE7.mjs +0 -1
  110. package/dist/chunk-ML6E23W2.mjs +0 -1
  111. package/dist/chunk-MLEMGJP7.mjs +0 -1
  112. package/dist/chunk-QBMNRD5V.mjs +0 -2
  113. package/dist/chunk-SHVHVJUB.mjs +0 -1
  114. package/dist/compareDocx-URPCPAQT.mjs +0 -1
  115. package/dist/computeLayout-ZTO6TBWX.mjs +0 -1
  116. package/dist/displayListQueries-BVBDVXoP.d.mts +0 -306
  117. package/dist/frameDelta-CLeO7K5z.d.mts +0 -807
  118. package/dist/index-DzZVJC8-.d.mts +0 -2467
  119. package/dist/parseWasm-BESKFFA3.mjs +0 -1
  120. package/dist/rustDisplayList-B7uPoItK.d.mts +0 -315
  121. package/dist/wasm-JPDPN2B2.mjs +0 -1
  122. package/dist/wasm-QI7MWC5D.mjs +0 -1
  123. package/dist/yrs/residentEngineWorker.d.mts +0 -2
  124. package/dist/yrs/residentEngineWorker.mjs +0 -1
@@ -1,11 +1,16 @@
1
- import '../formatting-gqLFeJ9X.mjs';
1
+ export { aI as AnchorGeometryTarget, aJ as AnchorReader, aK as AnchorResolution, aL as AnchorResolutionFailure, aM as ClipboardPasteEngine, aN as ClipboardSliceTarget, aO as ClipboardTableReader, aP as ClipboardTableRect, aQ as CreateYrsSessionOptions, aR as DOCX_CLIPBOARD_FRAGMENT_VERSION, aS as DirtyProjectionStories, aT as DocxClipboardFragment, aU as DocxClipboardInline, aV as DocxClipboardParagraph, aW as DocxClipboardSlice, e as DocxCommandConnection, n as DocxCommandEchoContext, h as DocxCommandFrame, d as DocxCommandInitReply, v as DocxCommandKind, x as DocxCommandPageIdentity, z as DocxCommandPayloads, H as DocxCommandSelection, aX as DocxCommentPatch, aY as DocxDisplayRange, aZ as DocxDisplaySelectionInfo, a_ as DocxDisplaySelectionText, a$ as DocxDocumentRead, b0 as DocxDocumentReadValues, P as DocxEchoGlyphLine, i as DocxEchoGlyphSet, R as DocxEchoRect, T as DocxEchoTransform, U as DocxEditState, b1 as DocxEngineWorkerHostModule, b2 as DocxEngineWorkerRequest, b3 as DocxEngineWorkerResponse, W as DocxEngineWorkerSourceOpened, b4 as DocxFindDisplayMatch, b5 as DocxFindParagraphsOptions, b6 as DocxFontEnvironment, b7 as DocxFontEnvironmentEvent, b8 as DocxFontEnvironmentSnapshot, b9 as DocxFontFace, ba as DocxFragmentSegment, X as DocxFrameReservations, $ as DocxNavigationIntent, bb as DocxOccurrence, bc as DocxOutlineHeading, bd as DocxParagraphAnchor, be as DocxParagraphAnchorResult, bf as DocxParagraphIdAssignment, bg as DocxParagraphIdDiagnostic, bh as DocxParagraphIdOrigin, bi as DocxParagraphIdRefusal, bj as DocxParagraphIdentity, bk as DocxParagraphIdentityReceipt, bl as DocxParagraphIdentitySnapshot, bm as DocxParagraphMatch, bn as DocxParagraphOrigin, bo as DocxParagraphRef, bp as DocxParagraphSavePlan, bq as DocxPersistedParagraphAnchor, br as DocxPresenceGeometry, bs as DocxPresencePeer, bt as DocxProposalFailure, bu as DocxProposalInput, bv as DocxProposalRecord, bw as DocxProposalRegistryState, bx as DocxProposalRequest, by as DocxProposalResult, bz as DocxProposalSnapshot, bA as DocxProposalState, bB as DocxProposalStateRequest, bC as DocxProposalWithdrawRequest, bD as DocxRangeHighlights, bE as DocxReservation, bF as DocxReservationAnchor, bG as DocxReservationParagraph, bH as DocxReservationsPayload, bI as DocxResolvedPointPosition, bJ as DocxResolvedReservation, bK as DocxResolvedReservations, bL as DocxReviewSnapshot, bM as DocxReviewTarget, bN as DocxReviewTargetRanges, bO as DocxSavedDocument, bP as DocxSavedParagraph, a2 as DocxSelectionPointIntent, bQ as DocxSelectionUnit, bR as DocxSessionParagraphAnchor, bS as DocxSessionSave, bT as DocxSidebarAnchorPoints, bU as DocxSidebarRead, bV as DocxSidebarReader, bW as DocxSourceOpenRequest, bX as DocxSourceParagraphAnchor, bY as DocxSourcePreviewOptions, bZ as DocxSourceStory, b_ as DocxTableFragment, b$ as DocxTableFragmentCell, c0 as DocxTableFragmentRow, c1 as DocxToolbarMetadata, g as DocxWorkerEditSession, c2 as DocxWorkerSaveUnavailableError, c3 as EditorDirtyStories, c4 as EditorSaveRecord, c5 as LAYOUT_META_VERSION, L as LayoutMetaV1, c6 as MAX_TABLE_COLUMNS, c7 as OPAQUE_SEED_BUDGET_BYTES, c8 as OpaqueSeedBudgetError, c9 as PeerMetadataError, ca as PlainTextReader, cb as ProposalDisplayTarget, cc as ProposalGeometryMirror, cd as ProposalGeometryReader, ce as ProposalGeometryRevision, cf as ProposalGeometryTarget, cg as RawAnchorRange, ch as ResidentCaretPaintStyle, ci as ResidentEngineOffscreenPage, cj as ResidentEngineWorkerApplyResult, ck as ResidentEngineWorkerClient, cl as ResidentEngineWorkerFrame, cm as ResidentEngineWorkerOpened, cn as ResidentProposalReply, co as ResidentWorkerFailureError, cp as ResidentWorkerOutOfMemoryError, cq as RetainedLayoutMeta, cr as TableCellAnchor, cs as TablePayload, ct as TablePayloadRow, cu as YrsAuthor, cv as YrsCellBorder, cw as YrsCellBorders, cx as YrsCellLoc, cy as YrsChangeTarget, cz as YrsCommentInfo, cA as YrsCommentReceipt, cB as YrsContentControlValue, cC as YrsDocxHost, cD as YrsEngineApplyProfile, cE as YrsHyperlinkAttrs, cF as YrsImageGeometry, cG as YrsInlineFormatDelta, cH as YrsInputParagraphSeed, cI as YrsInputParagraphSpan, cJ as YrsInputPositionMap, cK as YrsLoc, cL as YrsLocProjection, cM as YrsMediaSource, cN as YrsNumberingProperties, cO as YrsOpeningOptions, cP as YrsParaOffset, cQ as YrsParagraph, cR as YrsParagraphAttrs, cS as YrsParagraphLength, cT as YrsParagraphReceipt, cU as YrsParagraphSeed, cV as YrsParagraphSpan, cW as YrsParagraphTabStop, cX as YrsPointerProjectionTarget, cY as YrsPositionOutline, cZ as YrsPositionProjection, c_ as YrsProjectedCell, c$ as YrsProjectedNode, d0 as YrsProjectedTable, d1 as YrsRawOp, d2 as YrsRegionLayoutProgress, a as YrsRenderEnv, d3 as YrsReplaceReceipt, d4 as YrsResidentCaretRect, d5 as YrsResidentCaretSnapshot, d6 as YrsResidentFontRegistration, d7 as YrsResidentWorkerSnapshot, d8 as YrsResidentWorkerSyncOptions, d9 as YrsResolveReceipt, da as YrsResolvedCommentAnchor, aD as YrsRevisionInfo, db as YrsRevisionReceipt, dc as YrsRunInheritance, dd as YrsRunMark, ar as YrsSelection, de as YrsSelectionContext, df as YrsSelectionText, Y as YrsSession, dg as YrsSplitReceipt, dh as YrsStickyPosition, di as YrsStoryRange, dj as YrsStorySeed, dk as YrsStorySegment, dl as YrsStorySegmentSource, dm as YrsTableFragmentReceipt, dn as YrsTableInheritance, dp as YrsTableLoc, dq as YrsTablePropertiesPatch, dr as YrsTableRange, ds as YrsTableReceipt, dt as YrsTargetEditResult, du as YrsTextColor, dv as YrsTextMatch, dw as YrsTextSearchOptions, dx as YrsTriState, dy as YrsUndoCaptureMode, dz as YrsWatermark, dA as YrsWorkerDocumentMirror, dB as anchorDisplayRoot, dC as anchorFailure, dD as applyClipboardFragment, dE as assertOpaqueSeedBudget, dF as breakRefusedWhileSuggesting, dG as canUseResidentEngineWorker, dH as captureSessionSave, dI as clipboardFragmentHasPictures, dJ as clipboardTablePayload, dK as compareYrsLocs, dL as computeAnchorTargetGeometry, dM as computeProposalGeometryMirror, dN as createYrsInputPositionMap, dO as createYrsLocProjectionFromOutline, dP as createYrsPositionProjection, dQ as createYrsSession, dR as decodeDocxHostJson, dS as dirtyProjectionStory, dT as displayPositionToYrsLoc, dU as documentToYrs, dV as editorSaveKeys, dW as embedPlainText, dX as findBodyMatches, dY as findParagraphs, dZ as headerFooterDisplayRIds, d_ as headerFooterStory, d$ as hiddenRanges, e0 as hiddenRangesForPreview, e1 as hostSaveMetadata, e2 as isBodyStory, e3 as isLayoutMetaV1, e4 as layoutMetaSummary, e5 as mergeDocxHostMetadata, e6 as normalizeSeedError, e7 as ownProjectedParagraphs, e8 as paragraphInlineStart, e9 as peerMetadataTags, ea as preloadDocxEngine, eb as preloadResidentEngineWorker, ec as prepareDocxBytes, ed as preparedDocxDigest, ee as projectYrsDisplayPosition, ef as proposalProjectionStories, eg as proposalRevisionPreview, eh as proposalSetIdentity, ei as readClipboardSlice, ej as readOutlineHeadings, ek as readRetainedLayoutMeta, el as readSidebar, em as readTableFragment, en as residentCaretDeviceRect, eo as residentCaretSnapshotForFrame, ep as resolveAnchorTarget, eq as resolveMirroredNavigationTarget, er as resolveNavigationTarget, es as resolveReservations, et as resolvedTargetGeometry, eu as retainPreloadedResidentEngineWorker, ev as retainReservationOwners, ew as sameYrsSelection, ex as saveEditorDocument, ey as saveYrsDocx, ez as serialWorkerSaves, eA as sessionSourcePackage, eB as storyOffsetForLoc, eC as storyPlainText, eD as tableAnchors, eE as tableBoundaryDeleteTarget, eF as tablePlainText, eG as tableRowGrid, eH as takePreloadedResidentEngineWorker, eI as textRangeToRaw, eJ as validClipboardFragment, eK as validReservationsPayload, eL as writeSessionSave, eM as yrsLocToDisplayPosition, eN as yrsLocToProjectedDisplayPosition, eO as yrsToDocument } from '../index-C-KKULi5.mjs';
2
+ import '../formatting-p5MneNuy.mjs';
3
+ export { o as DocxAnchor, p as DocxAnchorScope, aj as DocxAtomKind, q as DocxCachedResult, r as DocxCommentMetadata, s as DocxContentControl, t as DocxContentControlDiagnostic, l as DocxContentControlQuery, k as DocxContentControlReadFailure, u as DocxContentControlSelector, v as DocxContentControlValue, m as DocxContentControlsOptions, w as DocxContentControlsResult, n as DocxContentControlsSnapshot, x as DocxControlMetadata, a1 as DocxEditFailure, a2 as DocxEditFailureCode, ak as DocxEditFailureReason, al as DocxEditGuard, am as DocxEditHistory, an as DocxEditOperation, ao as DocxEditPreview, ap as DocxEditReceipt, ai as DocxEditRefusal, a7 as DocxEditRequest, a8 as DocxEditResult, aq as DocxEditSource, ar as DocxEditStep, a0 as DocxEditSuggestion, as as DocxEditTarget, y as DocxExportBlock, z as DocxExportCell, A as DocxExportDiagnostic, B as DocxExportDiagnosticCode, D as DocxExportFailure, C as DocxExportFailureCode, E as DocxExportInline, a as DocxExportOptions, F as DocxExportPage, G as DocxExportRefusal, H as DocxExportResult, I as DocxExportStory, J as DocxExportTable, a3 as DocxFindTextRequest, a4 as DocxFindTextResult, K as DocxFormattingMark, L as DocxFragmentGeometry, M as DocxHeadingInfo, N as DocxHeadlessFont, e as DocxHeadlessLayoutOptions, O as DocxInlineRevision, i as DocxLayoutMap, P as DocxLayoutProvenance, Q as DocxListInfo, ac as DocxListStoriesResult, b as DocxMarkdownContent, h as DocxMarkdownOptions, R as DocxPageDiagnostic, d as DocxPageExportOptions, S as DocxPageFragment, T as DocxPageMapContent, j as DocxPageMarkdownOptions, f as DocxPagedStructuredContent, U as DocxParagraphData, V as DocxParagraphHeading, at as DocxParagraphInput, au as DocxParagraphTarget, av as DocxParagraphText, a5 as DocxReadParagraphsRequest, a6 as DocxReadParagraphsResult, aa as DocxReadStoriesRequest, ad as DocxReadStoriesResult, aw as DocxResolvedControl, W as DocxRevisionView, ax as DocxSearchScope, ay as DocxSectionError, az as DocxSetContentControlTextStep, g as DocxSnapshotLayoutMap, X as DocxSnapshotLayoutProvenance, aA as DocxStoryInfo, aB as DocxStoryInfoKind, Y as DocxStoryKind, Z as DocxStoryOccurrence, _ as DocxStorySelection, aC as DocxStoryText, aD as DocxStoryUse, c as DocxStructuredContent, aE as DocxTextAtom, aF as DocxTextMatch, aG as DocxTextPosition, a9 as DocxTextRange, ah as DocxTextTarget, aH as DocxTextView, $ as DocxUnlocatedReason, ab as DocxValidationResult, aI as EditSuccess, aJ as OperationFailure, aK as OperationRefusal, ag as SectionInfo, af as SectionPropertyPatch, ae as SectionStartKind, aL as ValidationSuccess } from '../pagedExport-DDgA5O7E.mjs';
2
4
  import '../types/document.mjs';
3
- export { A as AnchorGeometryTarget, x as AnchorReader, y as AnchorResolutionFailure, z as CreateYrsSessionOptions, D as DocxOccurrence, B as DocxParagraphAnchor, E as DocxParagraphAnchorResult, F as DocxParagraphIdAssignment, G as DocxParagraphIdDiagnostic, H as DocxParagraphIdOrigin, I as DocxParagraphIdRefusal, J as DocxParagraphIdentity, K as DocxParagraphIdentityReceipt, L as DocxParagraphIdentitySnapshot, M as DocxParagraphOrigin, N as DocxParagraphRef, O as DocxParagraphSavePlan, P as DocxPersistedParagraphAnchor, Q as DocxProposalFailure, R as DocxProposalInput, S as DocxProposalRecord, T as DocxProposalRegistryState, U as DocxProposalRequest, V as DocxProposalResult, W as DocxProposalSnapshot, X as DocxProposalState, Z as DocxProposalStateRequest, _ as DocxProposalWithdrawRequest, $ as DocxSavedDocument, a0 as DocxSavedParagraph, a1 as DocxSessionParagraphAnchor, a2 as DocxSessionSave, a3 as DocxSourceParagraphAnchor, a4 as DocxSourceStory, a5 as ProposalDisplayTarget, a6 as ProposalGeometryMirror, a7 as ProposalGeometryReader, a8 as ProposalGeometryRevision, a9 as ProposalGeometryTarget, aa as RawAnchorRange, ab as ResidentCaretPaintStyle, ac as ResidentEngineOffscreenPage, ad as ResidentEngineWorkerApplyResult, ae as ResidentEngineWorkerClient, af as ResidentEngineWorkerFrame, ag as ResidentEngineWorkerOpened, ah as ResidentProposalReply, ai as ResidentWorkerFailureError, aj as ResidentWorkerOutOfMemoryError, ak as YrsAuthor, al as YrsCellBorder, am as YrsCellBorders, an as YrsCellLoc, ao as YrsChangeTarget, ap as YrsCommentInfo, aq as YrsCommentReceipt, ar as YrsContentControlValue, as as YrsDocxHost, at as YrsEngineApplyProfile, au as YrsHyperlinkAttrs, av as YrsImageGeometry, aw as YrsInlineFormatDelta, ax as YrsInputParagraphSeed, ay as YrsInputParagraphSpan, az as YrsInputPositionMap, u as YrsLoc, aA as YrsLocProjection, aB as YrsMediaSource, aC as YrsNumberingProperties, aD as YrsOpeningOptions, aE as YrsParaOffset, aF as YrsParagraph, aG as YrsParagraphAttrs, aH as YrsParagraphLength, aI as YrsParagraphReceipt, aJ as YrsParagraphSeed, aK as YrsParagraphSpan, aL as YrsParagraphTabStop, aM as YrsPointerProjectionTarget, aN as YrsPositionOutline, aO as YrsPositionProjection, aP as YrsProjectedCell, aQ as YrsProjectedNode, aR as YrsProjectedTable, aS as YrsRawOp, aT as YrsRegionLayoutProgress, a as YrsRenderEnv, aU as YrsReplaceReceipt, aV as YrsResidentCaretRect, aW as YrsResidentCaretSnapshot, aX as YrsResidentFontRegistration, aY as YrsResidentWorkerSnapshot, aZ as YrsResidentWorkerSyncOptions, a_ as YrsResolveReceipt, a$ as YrsResolvedCommentAnchor, w as YrsRevisionInfo, b0 as YrsRevisionReceipt, b1 as YrsRunMark, j as YrsSelection, b2 as YrsSelectionContext, b3 as YrsSelectionText, Y as YrsSession, b4 as YrsSplitReceipt, b5 as YrsStickyPosition, b6 as YrsStoryRange, b7 as YrsStorySeed, v as YrsStorySegment, b8 as YrsStorySegmentSource, b9 as YrsTableLoc, ba as YrsTableRange, bb as YrsTableReceipt, bc as YrsTargetEditResult, bd as YrsTextColor, be as YrsTextMatch, bf as YrsTextSearchOptions, bg as YrsTriState, bh as YrsUndoCaptureMode, bi as YrsWatermark, bj as YrsWorkerDocumentMirror, bk as anchorFailure, bl as canUseResidentEngineWorker, bm as captureSessionSave, bn as compareYrsLocs, bo as computeProposalGeometryMirror, bp as createYrsInputPositionMap, bq as createYrsLocProjectionFromOutline, br as createYrsPositionProjection, bs as createYrsSession, bt as decodeDocxHostJson, bu as displayPositionToYrsLoc, bv as documentToYrs, bw as editorSaveKeys, bx as hiddenRanges, by as isBodyStory, bz as ownProjectedParagraphs, bA as preloadDocxEngine, bB as preloadResidentEngineWorker, bC as prepareDocxBytes, bD as preparedDocxDigest, bE as projectYrsDisplayPosition, bF as proposalRevisionPreview, bG as proposalSetIdentity, bH as residentCaretDeviceRect, bI as residentCaretSnapshotForFrame, bJ as resolveAnchorTarget, bK as resolveMirroredNavigationTarget, bL as resolveNavigationTarget, bM as retainPreloadedResidentEngineWorker, bN as sameYrsSelection, bO as saveYrsDocx, bP as sessionSourcePackage, bQ as takePreloadedResidentEngineWorker, bR as textRangeToRaw, bS as writeSessionSave, bT as yrsLocToDisplayPosition, bU as yrsLocToProjectedDisplayPosition, bV as yrsToDocument } from '../index-DzZVJC8-.mjs';
4
- export { o as DocxAnchor, p as DocxAnchorScope, ad as DocxAtomKind, q as DocxCachedResult, r as DocxCommentMetadata, s as DocxContentControl, t as DocxContentControlDiagnostic, l as DocxContentControlQuery, k as DocxContentControlReadFailure, u as DocxContentControlSelector, v as DocxContentControlValue, m as DocxContentControlsOptions, w as DocxContentControlsResult, n as DocxContentControlsSnapshot, x as DocxControlMetadata, a1 as DocxEditFailure, a2 as DocxEditFailureCode, ae as DocxEditFailureReason, af as DocxEditGuard, ag as DocxEditHistory, ah as DocxEditOperation, ai as DocxEditPreview, aj as DocxEditReceipt, ac as DocxEditRefusal, a8 as DocxEditRequest, aa as DocxEditResult, ak as DocxEditSource, al as DocxEditStep, a0 as DocxEditSuggestion, am as DocxEditTarget, y as DocxExportBlock, z as DocxExportCell, A as DocxExportDiagnostic, B as DocxExportDiagnosticCode, D as DocxExportFailure, C as DocxExportFailureCode, E as DocxExportInline, a as DocxExportOptions, F as DocxExportPage, G as DocxExportRefusal, H as DocxExportResult, I as DocxExportStory, J as DocxExportTable, a6 as DocxFindTextRequest, a7 as DocxFindTextResult, K as DocxFormattingMark, L as DocxFragmentGeometry, M as DocxHeadingInfo, N as DocxHeadlessFont, e as DocxHeadlessLayoutOptions, O as DocxInlineRevision, i as DocxLayoutMap, P as DocxLayoutProvenance, Q as DocxListInfo, b as DocxMarkdownContent, h as DocxMarkdownOptions, R as DocxPageDiagnostic, d as DocxPageExportOptions, S as DocxPageFragment, T as DocxPageMapContent, j as DocxPageMarkdownOptions, f as DocxPagedStructuredContent, U as DocxParagraphData, V as DocxParagraphHeading, an as DocxParagraphInput, ao as DocxParagraphTarget, ap as DocxParagraphText, a4 as DocxReadParagraphsRequest, a5 as DocxReadParagraphsResult, aq as DocxResolvedControl, W as DocxRevisionView, ar as DocxSearchScope, as as DocxSetContentControlTextStep, g as DocxSnapshotLayoutMap, X as DocxSnapshotLayoutProvenance, Y as DocxStoryKind, Z as DocxStoryOccurrence, _ as DocxStorySelection, c as DocxStructuredContent, at as DocxTextAtom, au as DocxTextMatch, av as DocxTextPosition, a3 as DocxTextRange, ab as DocxTextTarget, aw as DocxTextView, $ as DocxUnlocatedReason, a9 as DocxValidationResult, ax as EditSuccess, ay as OperationFailure, az as OperationRefusal, aA as ValidationSuccess } from '../pagedExport-BmSlEhoP.mjs';
5
5
  export { b as WASM32_MEMORY_LIMIT_BYTES, c as WasmHeapStats, a as WasmModuleMemory, w as wasmModuleMemories } from '../loadWasmAsset-Cr95TImt.mjs';
6
- import '../content-DSb-6a9T.mjs';
6
+ import '../content-DVT06V_6.mjs';
7
+ import '../types-bvPg3KsF.mjs';
8
+ import '../displayListQueries-6XjS7B5e.mjs';
9
+ import '../layout/pagination/index.mjs';
7
10
  import '../docx/wrapTypes.mjs';
8
- import '../styles-AryxLAhx.mjs';
9
- import '../frameDelta-CLeO7K5z.mjs';
11
+ import '../styles-DZZz2oRy.mjs';
10
12
  import '../plugin-api/index.mjs';
11
- import '../rezip-Bxiq4Z_R.mjs';
13
+ import '../utils/comments.mjs';
14
+ import '../utils/findReplace.mjs';
15
+ import '../utils/stylePreview.mjs';
16
+ import '../rezip-CfwAYdV4.mjs';
@@ -1 +1 @@
1
- import {h,i,d as d$2,b as b$3,e,f}from'../chunk-ML6E23W2.mjs';export{g as ownProjectedParagraphs,a as sessionSourcePackage,i as yrsToDocument}from'../chunk-ML6E23W2.mjs';import {d as d$3,a}from'../chunk-5Z22FORG.mjs';export{n as YrsPositionProjection,p as anchorFailure,h as compareYrsLocs,v as computeProposalGeometryMirror,e as createYrsInputPositionMap,k as createYrsLocProjectionFromOutline,l as createYrsPositionProjection,g as displayPositionToYrsLoc,s as hiddenRanges,q as isBodyStory,m as projectYrsDisplayPosition,c as proposalRevisionPreview,u as proposalSetIdentity,i as residentCaretDeviceRect,j as residentCaretSnapshotForFrame,t as resolveAnchorTarget,w as resolveMirroredNavigationTarget,x as resolveNavigationTarget,r as textRangeToRaw,f as yrsLocToDisplayPosition,o as yrsLocToProjectedDisplayPosition}from'../chunk-5Z22FORG.mjs';import'../chunk-EUUIJVM6.mjs';import {b as b$1}from'../chunk-SHVHVJUB.mjs';import'../chunk-LIOWZSE7.mjs';import {d as d$1}from'../chunk-QBMNRD5V.mjs';import {b as b$8}from'../chunk-OBQGPMPQ.mjs';import {d,a as a$1,b as b$6}from'../chunk-47Q2FMFF.mjs';import {b as b$5,p}from'../chunk-LTVVQMHB.mjs';import {b as b$7}from'../chunk-CTBUQRYQ.mjs';import {c,b as b$2}from'../chunk-EBYC3CX7.mjs';import {b as b$4}from'../chunk-UBUTIWXN.mjs';import'../chunk-LT2GCWZ3.mjs';import'../chunk-HPZFJGGM.mjs';import'../chunk-AXFMDV66.mjs';import'../chunk-GKWXOZZH.mjs';export{a as WASM32_MEMORY_LIMIT_BYTES,b as wasmModuleMemories}from'../chunk-HGKSOBXK.mjs';import {b}from'../chunk-TTRUPDAB.mjs';function ve(e,r){let n=c=>{let{content:u,...m}=c;return m},o=c=>[...c??[]].map(([u,m])=>[u,n(m)]),i=c=>(c??[]).map(u=>{let{verbatimXml:m,sourceOrdinal:h,...R}=n(u);return R}),{package:s}=e,a={finalSectionProperties:s.document.finalSectionProperties,sections:s.document.sections?.map(n),headers:o(s.headers),footers:o(s.footers),footnotes:i(s.footnotes),endnotes:i(s.endnotes),relationships:[...s.relationships??[]]},d=c=>JSON.stringify(c,(u,m)=>m instanceof Map?[...m]:m),p=r??s.document.comments??[];return {metadata:d(a),comments:d(p),commentIds:p.map(c=>c.id)}}var jt=new Set(["bootstrap","sync","buildFrame","releasePages","applyInput","applyDelete","proposal","documentRead"]),Ce=6e4;function Ht(){return new Worker(new URL("./residentEngineWorker.mjs",import.meta.url),{type:"module",name:"openooxml-resident-engine"})}var fe=class{constructor(r=Ht()){b(this,"worker",r);b(this,"pending",new Map);b(this,"watchdog",null);b(this,"nextId",1);b(this,"terminalError",null);b(this,"ready",false);b(this,"revision",0);b(this,"remoteVector",null);b(this,"appliedFontsRevision",null);b(this,"bootstrapped",false);b(this,"openedHeapLimit",null);b(this,"bootstraps",0);b(this,"fontRead",null);b(this,"lastSnapshotId",0);b(this,"keepSurfaces",false);b(this,"bootstrapWaiters",[]);b(this,"lastMemory",null);b(this,"answeredFrameEpoch",0);b(this,"retainBuiltPages",false);b(this,"failureListener",null);this.worker.onmessage=n=>{let o=n.data;if(o.memory&&(this.lastMemory=o.memory),o.ok&&o.caret&&(this.answeredFrameEpoch=Math.max(this.answeredFrameEpoch,o.caret.frameEpoch)),o.ok&&o.id>=this.lastSnapshotId){let s=o.proposal?.stateVector??o.stateVector;s&&(this.remoteVector=new Uint8Array(s));}if(!o.ok&&o.terminal){this.fail(o.outOfMemory?new re(o.error,o.memory??[]):new K(o.error));return}this.pending.size>0&&this.armWatchdog();let i=this.pending.get(o.id);i&&(this.pending.delete(o.id),this.pending.size===0&&this.disarmWatchdog(),o.ok?i.resolve(o):i.reject(qt(o.error,o.residentUnavailable)));},this.worker.onerror=n=>{this.fail(new _(`Resident engine worker failed: ${n.message}`));},this.worker.onmessageerror=()=>{this.fail(new _("Resident engine worker returned an unreadable message"));};}isReady(){return this.ready}hasFailed(){return this.terminalError!==null}memory(){return this.lastMemory}layoutRevision(){return this.revision}answeredFrame(){return this.answeredFrameEpoch}setRetainBuiltPages(r){this.retainBuiltPages=r;}onFailure(r){this.failureListener=r;}frameRequestPending(){for(let{type:r}of this.pending.values())if(jt.has(r))return true;return false}remoteStateVector(){return this.remoteVector}syncedFontsRevision(){return this.appliedFontsRevision}bootstrapSent(){return this.bootstrapped}whenBootstrapSent(){return this.bootstrapped?Promise.resolve():new Promise(r=>this.bootstrapWaiters.push(r))}rebootstrap(){this.bootstrapped=false,this.remoteVector=null,this.appliedFontsRevision=null,this.lastSnapshotId=0,this.revision=0,this.keepSurfaces=true,this.openedHeapLimit=null;}async open(r,n={}){if(this.openedHeapLimit||this.bootstrapped)throw new _("Resident engine worker already holds a document");let o={bytes:n.heapLimitBytes};this.openedHeapLimit=o;let i;try{let s=new Uint8Array(r);i=await this.request({type:"open",bytes:s.buffer,...n.digest!==void 0?{digest:n.digest}:{},...n.generation!==void 0?{generation:n.generation}:{},...n.heapLimitBytes!==void 0?{heapLimitBytes:n.heapLimitBytes}:{}},[s.buffer]);}catch(s){throw this.openedHeapLimit===o&&(this.openedHeapLimit=null),s}if(i.hostJson===void 0||!i.stateVector)throw new _("Resident engine worker omitted the opened document");return {hostJson:i.hostJson,stateVector:new Uint8Array(i.stateVector)}}async openPreview(r,n,o={}){if(this.openedHeapLimit||this.bootstrapped)throw new _("Resident engine worker already holds a document");let i={bytes:o.heapLimitBytes};this.openedHeapLimit=i;let s;try{let a=new Uint8Array(r);s=await this.request({type:"open",bytes:a.buffer,previewBlocks:n,...o.heapLimitBytes!==void 0?{heapLimitBytes:o.heapLimitBytes}:{}},[a.buffer]);}catch(a){throw this.openedHeapLimit===i&&(this.openedHeapLimit=null),a}if(s.previewRefused)return this.openedHeapLimit===i&&(this.openedHeapLimit=null),null;if(s.hostJson===void 0||!s.stateVector)throw new _("Resident engine worker omitted the opened preview");return {hostJson:s.hostJson,stateVector:new Uint8Array(s.stateVector)}}fontRequirements(r){let n=this.fontRead;if(n&&n.layoutInput===r&&n.id===this.nextId-1)return n.reply;let o=this.request({type:"fontRequirements",layoutInput:r}).then(a=>{if(a.requirementsJson===void 0)throw new _("Resident engine worker omitted the font requirements");return a.requirementsJson}),i={layoutInput:r,id:this.nextId-1,reply:o};this.fontRead=i;let s=()=>{this.fontRead===i&&(this.fontRead=null);};return o.then(s,s),o}async proposal(r){if(!this.bootstrapped)throw new _("Resident engine worker has not laid out its document");let n=await this.request({type:"proposal",operation:r});if(!n.proposal)throw new _("Resident engine worker omitted the proposal result");return {...n.proposal,updates:n.proposal.updates.map(o=>new Uint8Array(o)),stateVector:new Uint8Array(n.proposal.stateVector)}}async documentRead(r){let n=await this.request({type:"documentRead",read:r});if(!n.read)throw new _("Resident engine worker omitted the document read");return n.read}async handOver(){let r=await this.request({type:"encodeState"});if(!r.state||r.version===void 0||!r.proposals)throw new _("Resident engine worker omitted its document handoff");return {state:new Uint8Array(r.state),version:r.version,proposals:r.proposals}}async encodeState(){let r=await this.request({type:"encodeState"});if(!r.state)throw new _("Resident engine worker omitted its state");return new Uint8Array(r.state)}async revisionCount(){let r=await this.request({type:"revisionCount"});if(typeof r.revisionCount!="number"||!Number.isInteger(r.revisionCount)||r.revisionCount<0)throw new _("Resident engine worker omitted a valid revision count");return r.revisionCount}async warm(){let r=this.request({type:"warm",hostModule:true}),n=o=>{if(!this.terminalError)try{this.worker.postMessage({type:"editModule",module:o});}catch{try{this.worker.postMessage({type:"editModule",module:null});}catch{}}};b$1().then(n,()=>n(null)),await r;}async bootstrap(r,n,o={}){if(o.opened&&!this.openedHeapLimit)throw new _("Resident engine worker has no opened document");if(o.opened&&o.heapLimitBytes!==void 0&&o.heapLimitBytes!==this.openedHeapLimit?.bytes)throw new _("Resident engine worker opened its document under another heap limit");let i=r.fontsRevision;this.bootstrapped=true;for(let u of this.bootstrapWaiters.splice(0))u();let s=this.keepSurfaces;this.keepSurfaces=false;let a=++this.bootstraps,d=this.request({type:"bootstrap",snapshot:r,extras:n,expectedFrameEpoch:o.frameEpoch??0,...o.layoutExtras!==void 0?{layoutExtras:o.layoutExtras}:{},...o.displayWindow?{displayWindow:o.displayWindow,...this.retainBuiltPages?{retainBuiltPages:true}:{}}:{},...o.provisionalPages!==void 0?{provisionalPages:o.provisionalPages}:{},...s?{keepSurfaces:true}:{},...o.opened?{opened:true}:{},...o.heapLimitBytes!==void 0?{heapLimitBytes:o.heapLimitBytes}:{}},lt(r));this.recordSent(o.stateVector,i);let p;try{p=await d;}catch(u){throw o.opened&&!this.openedHeapLimit&&a===this.bootstraps&&(this.bootstrapped=false,this.remoteVector=null,this.appliedFontsRevision=null),u}let c=U(p);return this.recordSync(p,i),this.ready=true,this.revision=c.layoutRevision,c}async sync(r,n,o,i=false,s={}){let a=r.fontsRevision,d=this.request({type:"sync",snapshot:r,extras:n,expectedFrameEpoch:o,paintCaret:i,...s.layoutExtras!==void 0?{layoutExtras:s.layoutExtras}:{},...s.provisionalPages!==void 0?{provisionalPages:s.provisionalPages}:{},...s.displayWindow?{displayWindow:s.displayWindow,...this.retainBuiltPages?{retainBuiltPages:true}:{}}:{}},lt(r));this.recordSent(s.stateVector,a);let p=await d,c=U(p);return this.recordSync(p,a),this.ready=true,this.revision=c.layoutRevision,c}async completeLayout(r,n=false,o){let i=await this.request({type:"completeLayout",expectedFrameEpoch:r,paintCaret:n,...o?{sliceBlocks:o}:{}});return i.frame?U(i):null}async buildFrame(r,n,o=false,i){return U(await this.request({type:"buildFrame",extras:r,expectedFrameEpoch:n,paintCaret:o,...i?{displayWindow:i,...this.retainBuiltPages?{retainBuiltPages:true}:{}}:{}}))}async buildPages(r,n,o=false,i=false){let s=await this.request({type:"buildPages",pages:r,expectedFrameEpoch:n,paintCaret:o,...i?{background:true}:{}});return i&&s.pageBuildSuperseded?null:U(s)}async releasePages(r,n,o=false){let i=await this.request({type:"releasePages",pages:r,expectedFrameEpoch:n,paintCaret:o});return i.superseded?{superseded:true}:U(i)}async applyInput(r,n,o,i=false,s=false,a){if(!this.ready)return {applied:false};try{return {applied:!0,...U(await this.request({type:"applyInput",text:r,selection:n,expectedFrameEpoch:o,profile:i,paintCaret:s,...a?{displayWindow:a,...this.retainBuiltPages?{retainBuiltPages:!0}:{}}:{}}))}}catch(d){if(at(d))return {applied:false};throw d}}async applyDelete(r,n,o,i=false,s=false,a=1,d){if(!this.ready)return {applied:false};try{return {applied:!0,...U(await this.request({type:"applyDelete",direction:r,count:a,selection:n,expectedFrameEpoch:o,profile:i,paintCaret:s,...d?{displayWindow:d,...this.retainBuiltPages?{retainBuiltPages:!0}:{}}:{}}))}}catch(p){if(at(p))return {applied:false};throw p}}eraseCaret(){if(this.terminalError)return;let n={id:this.nextId++,type:"eraseCaret"};this.worker.postMessage(n);}invalidate(r,n){if(this.terminalError)return;this.ready=false;let o=r.slice(),s={id:this.nextId++,type:"applyUpdate",update:o,selection:n};this.worker.postMessage(s,[o.buffer]);}async attachCanvases(r,n,o,i,s){let a=r.map(d=>d.canvas);await this.request({type:"attachCanvases",pages:r,activePageIds:n,devicePixelRatio:o,zoom:i,caretStyle:s},a);}destroy(){if(this.terminalError)return;let n={id:this.nextId++,type:"destroy"};this.worker.postMessage(n),this.fail(new _("Resident engine worker was destroyed"),false);}request(r,n=[]){if(this.terminalError)return Promise.reject(this.terminalError);let o=this.nextId++;return new Promise((i,s)=>{this.pending.size===0&&this.armWatchdog(),this.pending.set(o,{type:r.type,resolve:i,reject:s}),this.worker.postMessage({...r,id:o},n);})}recordSent(r,n){this.terminalError||(this.lastSnapshotId=this.nextId-1,r&&(this.remoteVector=r.slice()),this.appliedFontsRevision=n);}armWatchdog(){this.disarmWatchdog(),this.watchdog=setTimeout(()=>{this.watchdog=null;let r=this.pending.values().next().value?.type??"a request";this.fail(new _(`Resident engine worker did not answer ${r} within ${Ce}ms`));},Ce);}disarmWatchdog(){this.watchdog!==null&&(clearTimeout(this.watchdog),this.watchdog=null);}recordSync(r,n){r.id>=this.lastSnapshotId&&(this.appliedFontsRevision=n);}fail(r,n=true){let o=this.terminalError===null;this.terminalError=r,this.ready=false,this.disarmWatchdog(),this.worker.terminate();for(let i of this.pending.values())i.reject(r);this.pending.clear();for(let i of this.bootstrapWaiters.splice(0))i();n&&o&&this.failureListener?.(r);}},K=class extends Error{},_=class extends Error{},re=class extends K{constructor(n,o){super(n);b(this,"memory",o);}};function at(e){return e instanceof K&&!(e instanceof re)}function qt(e,r=false){return r?new K(e):new Error(e)}function lt(e){return [e.state.buffer,...e.fonts.flatMap(r=>r instanceof Uint8Array?[r.buffer]:[])]}function U(e){if(!e.frame)throw new _("Resident engine worker response omitted its FrameDelta");if(!e.caret)throw new _("Resident engine worker response omitted its caret snapshot");if(e.selection===void 0)throw new _("Resident engine worker response omitted its selection");return {frame:new Uint8Array(e.frame),...e.pageFrames?{pageFrames:e.pageFrames.map(r=>new Uint8Array(r))}:{},updates:(e.updates??[]).map(r=>new Uint8Array(r)),engineMs:e.engineMs??0,workerTotalMs:e.workerTotalMs??0,engineProfile:e.engineProfile,caret:e.caret,selection:e.selection,caretPainted:e.caretPainted??false,replayMs:e.replayMs??0,replayedPages:e.replayedPages??0,layoutRevision:e.layoutRevision??0,deletedUnits:e.deletedUnits??0,...e.layoutJson!==void 0?{layoutJson:e.layoutJson}:{},...e.layoutProvisional?{layoutProvisional:true}:{}}}function Te(){return typeof Worker<"u"}var E=null;function me(e){e.idleTimer!==null&&clearTimeout(e.idleTimer),e.releaseTimer!==null&&clearTimeout(e.releaseTimer),e.idleTimer=null,e.releaseTimer=null;}function te(e){E===e&&(E=null,me(e),e.client.destroy());}function Ie(){if(!Te())return Promise.resolve();E&&(E.factory!==Worker||E.client.hasFailed())&&te(E),E||(E={client:new fe,factory:Worker,ready:null,owners:0,idleTimer:null,releaseTimer:null});let e=E;return e.ready||(e.ready=e.client.warm().catch(r=>{throw e.client.hasFailed()?te(e):e.ready=null,r})),me(e),e.owners===0&&(e.idleTimer=setTimeout(()=>te(e),Ce)),e.ready}function Vt(){let e=E;if(!e)return ()=>{};me(e),e.owners+=1;let r=false;return ()=>{r||(r=true,e.owners-=1,e.owners===0&&E===e&&(e.releaseTimer=setTimeout(()=>te(e),0)));}}function zt(){let e=E;return e?!Te()||e.factory!==Worker||e.client.hasFailed()?(te(e),null):(E=null,me(e),e.client):null}async function $t(){let e=[import('../wasm-KSZTTO3B.mjs').then(n=>n.preloadEditWasm()),import('../wasm-QI7MWC5D.mjs').then(n=>n.preloadOpcWasm()),import('../parseWasm-BESKFFA3.mjs').then(n=>n.preloadParseWasm()),import('../wasm-JPDPN2B2.mjs').then(n=>n.preloadLayoutWasm())],r;try{r=Ie();}catch(n){r=Promise.reject(n);}await Promise.all([...e,r]);}function De(e,r,n,o,i,s){let a=r?.pPr;if(!r?.tblStylePr?.some(C=>C.pPr))return a;let d=e.formatting?.look??r.tblPr?.look,p=(C,A)=>d?.[C]??(Number.parseInt(d?.value??(d?"0":"04A0"),16)&A)!==0,c=p("firstRow",32),u=p("lastRow",64),m=p("firstColumn",128),h=p("lastColumn",256),R=e.rows[n].formatting?.gridBefore??0;o+=R,i+=R;let b=!!c&&n===0,g=!!u&&n===e.rows.length-1,S=!!m&&o===0,k=!!h&&i===s,I=e.formatting?.styleRowBandSize??r.tblPr?.styleRowBandSize??1,x=e.formatting?.styleColBandSize??r.tblPr?.styleColBandSize??1,v=[];!p("noHBand",512)&&!b&&!g&&I>0&&v.push(Math.floor((n-+!!c)/I)%2===0?"band1Horz":"band2Horz"),!p("noVBand",1024)&&!S&&!k&&x>0&&v.push(Math.floor((o-+!!m)/x)%2===0?"band1Vert":"band2Vert");for(let[C,A]of [["firstCol",S],["lastCol",k],["firstRow",b],["lastRow",g],["nwCell",b&&S],["neCell",b&&k],["swCell",g&&S],["seCell",g&&k]])A&&v.push(C);for(let C of v)a=b$6(a,r.tblStylePr.find(A=>A.type===C)?.pPr);return a}function dt(e){return Math.max(e.columnWidths?.length??0,...e.rows.map(r=>r.cells.reduce((n,o)=>n+(o.formatting?.gridSpan??1),(r.formatting?.gridBefore??0)+(r.formatting?.gridAfter??0))))}function N(e){if(Array.isArray(e))return e.map(N);if(e!==null&&typeof e=="object"){let r={};for(let[n,o]of Object.entries(e))o!=null&&(r[n]=N(o));return r}return e}var Kt={styleId:"pStyle",_sectionProperties:"sectPr"},Gt=new Set(["paraId","textId","renderedPageBreakBefore","numPrFromStyle"]);function ut(e){let r={};for(let[n,o]of Object.entries(e))Gt.has(n)||o===null||o===void 0||(r[Kt[n]??n]=N(o));return r}var Xt=new Set(["columnWidths"]);function ge(e,r=new Set){let n={};for(let[o,i]of Object.entries(e))r.has(o)||i===null||i===void 0||(n[o]=N(i));return n}function pt(e){return ge(e,Xt)}function ct(e){let r=e.columnWidths;return Array.isArray(r)?r.map(N):[]}function ft(e){return ge(e)}function mt(e,r){let n=ge(e);return r&&(n.header=true),n}function _e(e,r,n,o){return `${e}:t${r}:r${n}c${o}`}function gt(e,r){return `${e}:sdt${r}`}function yt(e){return ge(e)}function ye(e){return `hf:${e}`}function ht(e){return `fn:${e}`}function bt(e){return `en:${e}`}function Qt(e){let r=e.package.settings?.compatibilityFlags?.compatibilityMode;return typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):12}var Zt=new Set(["bold","italic","superscript","subscript","allCaps","smallCaps","emboss","imprint","textShadow","textOutline","hidden","rtl"]);function X(e){if(e==null)return "null";if(Array.isArray(e))return `[${e.map(X).join(",")}]`;if(typeof e=="object"){let r=e;return `{${Object.keys(r).sort().map(n=>`${JSON.stringify(n)}:${X(r[n])}`).join(",")}}`}return JSON.stringify(e)}function er(e,r){if(!e||!r)return e;let n=r.resolveRunStyle(e.styleId);return n?a$1(n,e):e}function xt(e){if(!e)return [];let r=[],n=(a,d={})=>r.push({name:a,attrs:d});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 o=e.shading?.fill,i=(!e.shading?.pattern||e.shading.pattern==="clear")&&o?.rgb&&!o.auto?p(o.rgb):void 0,s=e.highlight&&e.highlight!=="none"?e.highlight:i;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.snapToGrid===false&&r.push({name:"snapToGrid",attrs:{}}),e.effect&&e.effect!=="none"&&n("textEffect",{effect:e.effect}),e.modernEffects&&n("modernTextEffects",{effects:e.modernEffects}),e.styleId&&n("runStyle",{styleId:e.styleId}),r}function Fe(e){let r={};for(let n of e)n.name==="comment"||n.name==="footnoteRef"||(Zt.has(n.name)?r[n.name]=true:n.name==="snapToGrid"?r.snapToGrid=false:n.name==="highlight"?r.highlight=n.attrs.color:n.name==="insertion"||n.name==="deletion"?r[n.name==="insertion"?"ins":"del"]=N({id:n.attrs.revisionId,author:n.attrs.author,date:n.attrs.date}):r[n.name]=N(n.attrs));return r}function tr(e){return e.filter(r=>r.name!=="hyperlink"&&r.name!=="comment").map(r=>`${r.name}:${JSON.stringify(r.attrs)}`).sort().join("|")}function rr(e,r){return [...e.filter(n=>n.name!==r.name),r]}function ne(e,r){return {kind:"text",text:e,attrs:Fe(r),pmSize:e.length,marks:[...r]}}function D(e,r,n=[],o=1){return {kind:"embed",embedKind:e,payload:r,attrs:Fe(n),pmSize:o,marks:[...n]}}function Pt(e,r,n){let o=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=xt(a$1(a$1(r,o),e.formatting)),s=e.formatting?.styleId,a=s?n?.getStyle(s)?.name:void 0;if([s,a].some(d=>/^(?:Followed)?Hyperlink$/i.test(d??""))){for(let[d,p]of [["color","textColor"],["underline","underline"]])if(e.formatting?.[d]===void 0&&o?.[d]!==void 0){let c=i.find(u=>u.name===p);c&&(c.attrs.inheritedHyperlink=true);}}return i}function nr(e){let r=e.size?.width?b$7(e.size.width):void 0,n=e.size?.height?b$7(e.size.height):void 0,o=e.wrap.type,i=e.wrap.wrapText,s=e.position?.horizontal?.alignment,a;o==="inline"||o==="topAndBottom"?a="none":o==="square"||o==="tight"||o==="through"?i==="left"?a="right":i==="right"?a="left":s==="left"||s==="right"?a=s:a="none":a="none";let d=o==="inline"?"inline":o==="topAndBottom"?"block":b$8(o)||a&&a!=="none"?"float":"block",p=[];e.transform?.rotation&&p.push(`rotate(${e.transform.rotation}deg)`),e.transform?.flipH&&p.push("scaleX(-1)"),e.transform?.flipV&&p.push("scaleY(-1)");let c,u,m;if(e.outline?.width){c=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`);let h={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};m=e.outline.style&&h[e.outline.style]||"solid";}return N({src:e.src||"",alt:e.alt??null,title:e.title??null,width:r??null,height:n??null,rId:e.rId??null,wrapType:o,displayMode:d,cssFloat:a??null,transform:p.length>0?p.join(" "):null,distTop:e.wrap.distT!=null?b$7(e.wrap.distT):null,distBottom:e.wrap.distB!=null?b$7(e.wrap.distB):null,distLeft:e.wrap.distL!=null?b$7(e.wrap.distL):null,distRight:e.wrap.distR!=null?b$7(e.wrap.distR):null,position:e.position?{relativeHeight:e.position.relativeHeight,behindDoc:e.position.behindDoc,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:c??null,borderColor:u??null,borderColorValue:e.outline?.color??null,borderStyle:m??null,wrapText:i??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,shapeType:e.shapeType??null,opacity:e.opacity??null,effectExtentTop:e.padding?.top!=null?b$7(e.padding.top):null,effectExtentBottom:e.padding?.bottom!=null?b$7(e.padding.bottom):null,effectExtentLeft:e.padding?.left!=null?b$7(e.padding.left):null,effectExtentRight:e.padding?.right!=null?b$7(e.padding.right):null,layoutInCell:e.layoutInCell??null,allowOverlap:e.allowOverlap??null})}function or(e){return {shapeJson:JSON.stringify(e)}}function sr(e){return N({chartJson:JSON.stringify(e),chartType:e.chartType??null,title:e.title??null,width:e.size?.width?b$7(e.size.width):320,height:e.size?.height?b$7(e.size.height):220,rId:e.rId??null,path:e.path??null})}function G(e,r){let n="",o,i=e.type==="simpleField"?e.content:e.fieldResult;for(let d of i)if(d.type==="run"){for(let p of d.content)p.type==="text"&&(n+=p.text);!o&&d.formatting&&(o=d.formatting);}let s=o??(e.type==="complexField"?e.formatting:void 0),a=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:a,hasCachedResult:n.length>0,fieldData:JSON.stringify(e),modelKind:"field"},marks:xt(a$1(r,s))}}function z(e){let r=new Set,n=[[e,false]];for(;n.length>0;){let[o,i]=n.pop();if(Array.isArray(o))for(let s=o.length-1;s>=0;s--)n.push([o[s],i]);else if(o!==null&&typeof o=="object"){let s=o;if(o!==e&&(s.type==="complexField"||s.type==="simpleField")&&typeof s.instruction=="string"){let d=he(s.instruction);d!==void 0&&r.add(d);}if(s.type==="hyperlink"&&!i)for(let d of Q(o))r.add(d);let a=i||s.type==="hyperlink";for(let d of Object.keys(s).sort().reverse())n.push([s[d],a]);}}return [...r]}function Q(e){let r=[e],n=[],o=[],i=s=>{if(Array.isArray(s))for(let a=s.length-1;a>=0;a--)r.push(s[a]);};for(;r.length>0;){let s=r.pop();if(s){if((s.type==="simpleField"||s.type==="complexField")&&typeof s.instruction=="string"){let a=he(s.instruction);a!==void 0&&o.push(a);}switch(s.type){case "hyperlink":i(s.structuredChildren??s.children);break;case "inlineSdt":case "insertion":case "deletion":case "moveFrom":case "moveTo":i(s.content);break;case "simpleField":i(s.structuredResult?.inline??s.fieldTree?.result?.inline??s.content);break;case "complexField":i(s.structuredResult?.inline??s.fieldTree?.result?.inline??s.fieldResult),i(s.structuredCode?.inline??s.fieldTree?.code?.inline??s.fieldCode);break;case "run":if(!Array.isArray(s.content))break;for(let a of s.content){if(!a)continue;let d;if(a.type==="fieldChar")a.charType==="begin"?n.push(""):a.charType==="separate"&&n.length>0?(d=n[n.length-1],n[n.length-1]=void 0):a.charType==="end"&&(d=n.pop());else if(a.type==="instrText"){let c=n.length-1;n[c]!==void 0&&(n[c]+=typeof a.text=="string"?a.text:"");}let p=d===void 0?void 0:he(d);p!==void 0&&o.push(p);}break}}}return o}function he(e){let r=e.matchAll(/"([^"]*)(?:"|$)|([^\p{White_Space}]+)/gu),n=r.next().value,o=r.next().value,i=n?.[1]??n?.[2],s=o?.[1]??o?.[2];if(!(!i||!/^[sS][eE][qQ]$/.test(i)||s===void 0||s.startsWith("\\")))return s.toLowerCase()}function be(e){return {display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""}}function ir(e){return {name:"hyperlink",attrs:{href:e.href||(e.anchor?`#${e.anchor}`:""),tooltip:e.tooltip??null,rId:e.rId??null}}}function ar(e,r,n,o,i){let s=e.structuredResult?.inline??[],d=[...(e.type==="complexField"?e.structuredCode?.inline??[]:[]).map((h,R)=>({child:h,index:-R-1})),...s.map((h,R)=>({child:h,index:R}))];if(e.type!=="complexField"||!d.some(({child:h})=>h.type==="hyperlink"||h.type==="simpleField")){i.push(...z(e));let h=G(e,r);return [D("field",h.payload,h.marks)]}let p=[],c=[];d.forEach(({child:h,index:R})=>{if(h.type!=="hyperlink"&&h.type!=="simpleField")return;i.push(...h.type==="hyperlink"?Q(h):z(h));let b=h.type==="simpleField"?G(h,r):null,g=h.type==="hyperlink"?ie(h,r,n,i):[D("field",b.payload,b.marks)];c.push({index:R,items:g.map(S=>S.kind==="text"?{kind:"text",text:S.text,attributes:S.attrs}:{kind:"embed",embedKind:S.embedKind,payload:S.payload,attributes:S.attrs})});for(let S of g)S.attrs={...S.attrs,fieldResult:{id:o,index:R}};p.push(...g);});let u={...e,fieldResult:s.filter(h=>h.type==="run")},m=G(u,r);return i.push(...z(he(e.instruction??"")===void 0?u:e)),m.payload.fieldData=JSON.stringify(e),m.payload.resultProjection={id:o,children:c},p.push(D("field",m.payload,m.marks)),p}function St(e,r,n){let o={name:"footnoteRef",attrs:{id:String(e),noteType:r}},i=[...n,o];return D("noteRef",r==="endnote"?{endnoteRefId:e}:{footnoteRefId:e},i)}function Ye(e){return e.filter(r=>r.name==="insertion"||r.name==="deletion")}function Oe(e,r,n){if((e.type==="drawing"||e.type==="shape"||e.type==="chart")&&r.some(o=>o.name==="hidden")){let o=e.type==="drawing"?e.image:e.type==="shape"?e.shape:e.chart;n.push(...z(o));}switch(e.type){case "text":return e.text?[ne(e.text,r)]:[];case "tab":return [ne(" ",r)];case "break":return e.breakType===void 0||e.breakType==="textWrapping"?[D("break",{},r)]:[];case "softHyphen":return [ne("\xAD",r)];case "noBreakHyphen":return [ne("\u2011",r)];case "symbol":{let o=Number.parseInt(e.char,16);if(!Number.isInteger(o)||o<0||o>1114111)return [];let i={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 [ne(String.fromCodePoint(o),rr(r,i))]}case "commentReference":return [D("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 [D("image",nr(e.image),Ye(r))];case "horizontalRule":return [D("horizontalRule",{rule:e.rule},r)];case "shape":return [D("shape",or(e.shape),Ye(r))];case "chart":return [D("chart",sr(e.chart),Ye(r))];case "footnoteRef":return [St(e.id,"footnote",r)];case "endnoteRef":return [St(e.id,"endnote",r)];default:return []}}function se(e,r,n,o,i=[]){let s=[...Pt(e,r,n),...i];return e.content.flatMap(a=>Oe(a,s,o))}function ie(e,r,n,o,i=[]){let s=[],a=ir(e);for(let d of e.structuredChildren??e.children)if(d.type==="run"){let p=[...Pt(d,r,n),...i,a];for(let c of d.content)s.push(...Oe(c,p,o));}else if(d.type==="simpleField"||d.type==="complexField"){o.push(...z(d));let p=G(d,r);s.push(D("field",p.payload,[...p.marks,...i,a]));}else d.type==="mathEquation"?s.push(D("math",be(d),[...i,a])):d.type==="inlineSdt"&&(i.some(p=>p.name==="insertion"||p.name==="deletion")||b$4(d))&&s.push(D("sdt",Se(d,r,n,o),[...i,a],2));return s}function lr(e,r,n){return {name:r,attrs:{revisionId:e.id,author:e.author,date:e.date??null,isMovePair:n}}}function Ee(e,r,n,o,i=false){let s=e.type==="insertion"||e.type==="moveTo"?"insertion":"deletion",a=lr(e.info,s,e.type==="moveFrom"||e.type==="moveTo"),d=[];for(let p of e.content)if(p.type==="run")d.push(...se(p,r,n,o,[a]));else if(p.type==="hyperlink"){o.push(...Q(p));let c=ie(p,r,n,o,[a]);d.push(...c);}else if(i||p.type==="inlineSdt"||b$4(p)){let c=dr(p,r,n,o,i),u=Fe([a]);d.push(...c.map(m=>({...m,attrs:{...u,...m.attrs},marks:m.marks.some(h=>h.name===a.name)?m.marks:[...m.marks,a]})));}return d}function dr(e,r,n,o,i){if(e.type==="run")return se(e,r,n,o);if(e.type==="hyperlink")return o.push(...Q(e)),ie(e,r,n,o);if(e.type==="simpleField"||e.type==="complexField"){o.push(...z(e));let s=G(e,r);return [D("field",s.payload,s.marks)]}return e.type==="inlineSdt"?[D("sdt",Se(e,r,n,o),[],2)]:e.type==="mathEquation"?[D("math",be(e))]:Ee(e,r,n,o,i)}function Se(e$1,r,n,o){let i=[],s=a=>{if(a.kind==="text"){if((a.text===" "?"tab":"text")==="tab"){i.push({kind:"tab",attrs:a.attrs});return}let p=i[i.length-1];p&&"text"in p&&X(p.attrs)===X(a.attrs)?p.text+=a.text:i.push({kind:"text",text:a.text,attrs:a.attrs});return}i.push({kind:a.embedKind,payload:a.payload,attrs:a.attrs});};for(let a of e$1.content)if(a.type==="run")se(a,r,n,o).forEach(s);else if(a.type==="hyperlink")o.push(...Q(a)),ie(a,r,n,o).forEach(s);else if(a.type==="simpleField"||a.type==="complexField"){o.push(...z(a));let d=G(a,r);s(D("field",d.payload,d.marks));}else a.type==="inlineSdt"?s(D("sdt",Se(a,r,n,o))):a.type==="mathEquation"?s(D("math",be(a))):Ee(a,r,n,o,true).forEach(s);return N({...e(e$1.properties),propertiesJson:JSON.stringify(e$1.properties),content:i})}function ur(e,r,n){let o=r?r.resolveParagraphStyle(e.formatting?.styleId).runFormatting:void 0;return a$1(o,n)}function pr(e){let r=[];for(let n of e.content)n.type==="footnoteRefMark"?r.push("footnote"):n.type==="endnoteRefMark"&&r.push("endnote");return r}function wt(e){return e.map(r=>{if(r.kind==="text")return r.text;let n=r.payload.footnoteRefId??r.payload.endnoteRefId;return String(n??"")}).join("")}function Rt(e){return e.type!=="break"?null:e.breakType==="page"||e.breakType==="column"?e.breakType:null}function cr(e){if(!e.content.some(o=>Rt(o)!==null))return [];let r=[],n=0;for(let o of e.content){let i=Rt(o);if(i!==null){r.push({offset:n,type:i});continue}n+=wt(Oe(o,[],[])).length;}return r}function fr(e,r,n){let o=se(e,r,n,[]);if(o.some(p=>p.kind!=="text"&&p.embedKind!=="noteRef"))return null;let i=o.map(p=>tr(p.marks));if(i.some(p=>p!==i[0]))return null;let s=pr(e),a=cr(e),d=i[0];return {text:wt(o),...s.length>0?{noteMarks:s}:{},...a.length>0?{breaks:a}:{},...d!==void 0?{marksKey:d}:{},...e.formatting?{formatting:e.formatting}:{},...e.propertyChanges?{propertyChanges:e.propertyChanges}:{}}}function mr(e,r,n,o,i){let s=e.formatting,a=s?.styleId,d=s?.indentFirstLine===0?void 0:s?.indentFirstLine,p=d??e.listRendering?.indentFirstLine??s?.indentFirstLine,c=d===void 0&&e.listRendering?.indentFirstLine!==void 0?e.listRendering.hangingIndent:s?.hangingIndent??e.listRendering?.hangingIndent,u={paraId:e.paraId??null,textId:e.textId??null,styleId:a??null,numPr:s?.numPr??null,numPrFromStyle:s?.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,listMarkerBold:e.listRendering?.markerBold??null,listMarkerItalic:e.listRendering?.markerItalic??null,listMarkerColor:e.listRendering?.markerColor??null,listMarkerSuffix:e.listRendering?.markerSuffix||null,listLevelNumFmts:e.listRendering?.levelNumFmts||null,listAbstractNumId:e.listRendering?.abstractNumId??null,listStartOverride:e.listRendering?.startOverride??null,_originalFormatting:s??null};if(r){let b=r.resolveParagraphStyle(a,i),g=b.paragraphFormatting;u.alignment=s?.alignment??g?.alignment??null,u.spaceBefore=s?.spaceBefore??g?.spaceBefore??null,u.spaceAfter=s?.spaceAfter??g?.spaceAfter??null,u.spaceBeforeLines=s?.spaceBeforeLines??g?.spaceBeforeLines??null,u.spaceAfterLines=s?.spaceAfterLines??g?.spaceAfterLines??null,u.beforeAutospacing=s?.beforeAutospacing??g?.beforeAutospacing??null,u.afterAutospacing=s?.afterAutospacing??g?.afterAutospacing??null,u.lineSpacing=s?.lineSpacing??g?.lineSpacing??null,u.lineSpacingRule=s?.lineSpacingRule??g?.lineSpacingRule??null,u.spacingExplicit=s?.spacingExplicit||null,u.indentLeft=s?.indentLeft??e.listRendering?.indentLeft??g?.indentLeft??null,u.indentRight=s?.indentRight??g?.indentRight??null;let k=s?.numPr?.numId===0&&g?.numPr&&g.numPr.numId!==0?void 0:g;u.indentFirstLine=p??k?.indentFirstLine??null,u.hangingIndent=c??k?.hangingIndent??false,u.borders=s?.borders??g?.borders??null,u.shading=s?.shading??g?.shading??null,u.tabs=s?.tabs??g?.tabs??null,u.pageBreakBefore=s?.pageBreakBefore??g?.pageBreakBefore??null,u.keepNext=s?.keepNext??g?.keepNext??null,u.keepLines=s?.keepLines??g?.keepLines??null,u.widowControl=s?.widowControl??g?.widowControl??null,u.contextualSpacing=s?.contextualSpacing??g?.contextualSpacing??null,u.snapToGrid=s?.snapToGrid??g?.snapToGrid??null,u.autoSpaceDE=s?.autoSpaceDE??g?.autoSpaceDE??null,u.autoSpaceDN=s?.autoSpaceDN??g?.autoSpaceDN??null,u.outlineLevel=s?.outlineLevel??g?.outlineLevel??null,u.bidi=s?.bidi??g?.bidi??null;let I=r.getDefaultCharacterStyle()?.rPr,x=I?a$1(b.runFormatting,I):b.runFormatting;u.defaultTextFormatting=a$1(x,er(s?.runProperties,r))??null,!s?.numPr&&g?.numPr&&g.numPr.numId!==0&&(u.numPr=g.numPr,u.numPrFromStyle=g.numPr);}else u.alignment=s?.alignment??null,u.spaceBefore=s?.spaceBefore??null,u.spaceAfter=s?.spaceAfter??null,u.spaceBeforeLines=s?.spaceBeforeLines??null,u.spaceAfterLines=s?.spaceAfterLines??null,u.beforeAutospacing=s?.beforeAutospacing??null,u.afterAutospacing=s?.afterAutospacing??null,u.lineSpacing=s?.lineSpacing??null,u.lineSpacingRule=s?.lineSpacingRule??null,u.spacingExplicit=s?.spacingExplicit||null,u.indentLeft=s?.indentLeft??e.listRendering?.indentLeft??null,u.indentRight=s?.indentRight??null,u.indentFirstLine=p??null,u.hangingIndent=c??false,u.borders=s?.borders??null,u.shading=s?.shading??null,u.tabs=s?.tabs??null,u.pageBreakBefore=s?.pageBreakBefore??null,u.keepNext=s?.keepNext??null,u.keepLines=s?.keepLines??null,u.widowControl=s?.widowControl??null,u.snapToGrid=s?.snapToGrid??null,u.autoSpaceDE=s?.autoSpaceDE??null,u.autoSpaceDN=s?.autoSpaceDN??null,u.outlineLevel=s?.outlineLevel??null,u.bidi=s?.bidi??null,u.defaultTextFormatting=s?.runProperties??null;if(e.sectionProperties){u._sectionProperties=e.sectionProperties;let b=e.sectionProperties.sectionStart;(b==="nextPage"||b==="continuous"||b==="oddPage"||b==="evenPage"||b==="nextColumn")&&(u.sectionBreakType=b);}e.renderedPageBreakBefore&&(u.renderedPageBreakBefore=true),hr(e)&&(u.pageBreakBeforeRun=true),e.pPrIns&&(u.pPrIns={revisionId:e.pPrIns.id,author:e.pPrIns.author,date:e.pPrIns.date??null}),e.pPrDel&&(u.pPrDel={revisionId:e.pPrDel.id,author:e.pPrDel.author,date:e.pPrDel.date??null}),e.propertyChanges?.length&&(u.pPrChange=e.propertyChanges);let m=[],h=0,R=0;for(let b of e.content)if(b.type==="bookmarkStart")m.push({id:b.id,name:b.name,kind:"start",offset:R,...b.colFirst!==void 0?{colFirst:b.colFirst}:{},...b.colLast!==void 0?{colLast:b.colLast}:{}});else if(b.type==="bookmarkEnd")m.push({id:b.id,kind:"end",offset:R});else {let g=gr(b);for(let S=0;S<g;S+=1)R+=n[h]?.pmSize??0,h+=1;}return m.length>0&&(u.bookmarks=m),o?.length&&(u._originalRunBoundaries=o),u}var vt=new WeakMap;function gr(e){return vt.get(e)??0}function yr(e,r,n,o){let i=[],s=[],a=[],d=[],p=ur(e,r,n);for(let[u,m]of e.content.entries()){let h=i.length;if(m.type==="commentRangeStart"||m.type==="commentRangeEnd")a.push({unit:h,start:m.type==="commentRangeStart",id:m.id});else if(m.type==="run"){let R=fr(m,p,r);R&&d?d.push(R):d=void 0,i.push(...se(m,p,r,s));}else if(m.type==="hyperlink"){d=void 0,s.push(...Q(m));let R=ie(m,p,r,s);i.push(...R);}else m.type==="simpleField"||m.type==="complexField"?(d=void 0,i.push(...ar(m,p,r,u,s))):m.type==="inlineSdt"?(d=void 0,i.push(D("sdt",Se(m,p,r,s),[],2))):m.type==="insertion"||m.type==="deletion"||m.type==="moveFrom"||m.type==="moveTo"?(d=void 0,i.push(...Ee(m,p,r,s))):m.type==="mathEquation"?(d=void 0,i.push(D("math",be(m)))):m.type!=="bookmarkStart"&&m.type!=="bookmarkEnd"&&m.type!=="rawXml"&&(d=void 0);vt.set(m,i.length-h);}let c=mr(e,r,i,d,o);return {units:i,commentMarks:a,ppr:ut(c),opaqueSequences:s}}function oe(e,r){for(let n of e.content)n.type==="break"&&n.breakType==="page"?r.push("pageBreak"):(n.type!=="text"||n.text.length>0)&&r.push("visible");}function Me(e,r){for(let n of e)if(n.type==="run")oe(n,r);else if(n.type==="hyperlink")for(let o of n.children)o.type==="run"&&oe(o,r);else if(n.type==="simpleField")for(let o of n.content)o.type==="run"&&oe(o,r);else if(n.type==="complexField")for(let o of [...n.fieldCode,...n.fieldResult])oe(o,r);else if(n.type==="inlineSdt")Me(n.content,r);else if(n.type==="insertion"||n.type==="deletion"||n.type==="moveFrom"||n.type==="moveTo")for(let o of n.content)o.type==="run"&&oe(o,r);else n.type==="mathEquation"&&r.push("visible");}function hr(e){let r=[];return Me(e.content,r),r[0]==="pageBreak"}function br(e){let r=[];Me(e.content,r);let n=false,o=false;for(let i of r)if(i==="pageBreak"){if(o||n)return true;n=true;}else o=true;return false}function Sr(e){let r=new Map,n=new Map;return e.rows.forEach((o,i)=>{let s=0,a=o.cells.map(p=>{let c=s;return s+=p.formatting?.gridSpan??1,{column:c,vMerge:p.formatting?.vMerge,key:`${i}-${c}`}});if(a.length>0&&a.every(p=>p.vMerge==="continue"&&n.has(p.column))){for(let p of a)n.delete(p.column),r.set(p.key,{rowSpan:1,skip:false});return}for(let p of a)if(p.vMerge==="restart")n.set(p.column,i),r.set(p.key,{rowSpan:1,skip:false});else if(p.vMerge==="continue"){let c=n.get(p.column);if(c===void 0)r.set(p.key,{rowSpan:1,skip:false});else {let u=r.get(`${c}-${p.column}`);u&&(u.rowSpan+=1),r.set(p.key,{rowSpan:1,skip:true});}}else n.delete(p.column),r.set(p.key,{rowSpan:1,skip:false});}),r}function Ae(e){return {revisionId:e.id,author:e.author,date:e.date??null}}function Rr(e,r,n,o,i,s){let a=r?{top:n?r.top:r.insideH,bottom:o?r.bottom:r.insideH,left:i?r.left:r.insideV,right:s?r.right:r.insideV}:void 0;return a||e?.borders?{...a??{},...e?.borders??{}}:void 0}function kt(e,r){let n=e.formatting,o=b$5(n?.shading?.fill,r.theme),i=n?.width?.value??r.gridWidth,s=n?.width?.type??(r.gridWidth!==void 0?"pct":null),a={colspan:n?.gridSpan??1,rowspan:r.rowspan,width:i??null,widthType:s,verticalAlign:n?.verticalAlign??null,backgroundColor:o??null,borders:Rr(n,r.tableBorders,r.firstRow,r.lastRow,r.firstColumn,r.lastColumn)??null,margins:n?.margins?{top:n.margins.top?.value,bottom:n.margins.bottom?.value,left:n.margins.left?.value??(r.tableBidi?n.margins.end?.value:n.margins.start?.value),right:n.margins.right?.value??(r.tableBidi?n.margins.start?.value:n.margins.end?.value)}:r.defaultMargins??null,textDirection:n?.textDirection??null,noWrap:n?.noWrap??false,_originalFormatting:n??null,_originalResolvedFill:o??null};if(e.structuralChange){let d=e.structuralChange,p=Ae(d.info);d.type==="tableCellInsertion"?a.cellMarker={kind:"ins",info:p}:d.type==="tableCellDeletion"?a.cellMarker={kind:"del",info:p}:d.type==="tableCellMerge"&&(a.cellMarker={kind:"merge",info:p,vMerge:d.vMerge??"cont",...d.vMergeOrig?{vMergeOrig:d.vMergeOrig}:{}});}return e.propertyChanges?.length&&(a.tcPrChange=e.propertyChanges),{attrs:mt(a,r.isHeader),content:e.content.length>0?e.content:[{type:"paragraph",content:[]}]}}function kr(e,r,n,o,i,s,a,d,p){let c={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"?c.trIns=Ae(e.structuralChange.info):e.structuralChange.type==="tableRowDeletion"&&(c.trDel=Ae(e.structuralChange.info))),e.propertyChanges?.length&&(c.trPrChange=e.propertyChanges);let u=r.columnWidths,m=u?.reduce((g,S)=>g+S,0)??0,h=u?.length??Math.max(0,...r.rows.map(g=>g.cells.reduce((S,k)=>S+(k.formatting?.gridSpan??1),0))),R=0,b=[];return e.cells.forEach(g=>{let S=g.formatting?.gridSpan??1,k=R,I=o.get(`${n}-${k}`),x;if(u&&m>0){let v=0;for(let C=0;C<S&&k+C<u.length;C+=1)v+=u[k+C];x=Math.round(v/m*100);}R+=S,!I?.skip&&b.push({paragraphFormatting:De(r,d,n,k,R,p),...kt(g,{isHeader:n===0&&!!r.formatting?.look?.firstRow,rowspan:I?.rowSpan??1,gridWidth:x,firstRow:n===0,lastRow:n===r.rows.length-1,firstColumn:k===0,lastColumn:R===h,tableBorders:i,defaultMargins:s,theme:a,tableBidi:!!r.formatting?.bidi})});}),b.length===0&&b.push({paragraphFormatting:De(r,d,n,0,h,p),...kt({formatting:h>1?{gridSpan:h}:void 0,content:[{type:"paragraph",content:[]}]},{isHeader:n===0&&!!r.formatting?.look?.firstRow,rowspan:1,gridWidth:m>0?100:void 0,firstRow:n===0,lastRow:n===r.rows.length-1,firstColumn:true,lastColumn:true,tableBorders:i,defaultMargins:s,theme:a,tableBidi:!!r.formatting?.bidi})}),{attrs:ft(c),cells:b}}function xr(e,r,n,o){let i=r?.getDefaultTableStyle(),s=e.formatting?.styleId,a=s??i?.styleId,d=a?r?.getStyle(a):void 0,p=e.formatting?.borders??d?.tblPr?.borders??i?.tblPr?.borders,c=[e.formatting?.cellMargins,d?.tblPr?.cellMargins??i?.tblPr?.cellMargins].filter(C=>C!=null),u=(...C)=>{for(let A of c)for(let J of C){let ae=A[J]?.value;if(ae!=null)return ae}},[m,h]=e.formatting?.bidi?["end","start"]:["start","end"],R=c.length>0?{top:u("top"),bottom:u("bottom"),left:u("left",m),right:u("right",h)}:void 0,b=[],g=new Set,S=d;for(;S?.basedOn&&b.length<32&&!g.has(S.basedOn);)g.add(S.basedOn),b.unshift(S.basedOn),S=r?.getStyle(S.basedOn);let k={...e.formatting??{},styleCascade:{...s?{selectedStyleId:s}:{},...i?.styleId?{defaultStyleId:i.styleId}:{},...b.length>0?{basedOnStyleIds:b}:{}}},I={styleId:s??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:R??null,look:e.formatting?.look??null,bidi:e.formatting?.bidi||null,compatibilityMode:o===12?null:o,_originalFormatting:k};e.propertyChanges?.length&&(I.tblPrChange=e.propertyChanges);let x=Sr(e),v=dt(e);return {attrs:I,rows:e.rows.map((C,A)=>kr(C,e,A,x,p,R,n,d??i,v))}}function Pr(e$1){return yt(e(e$1))}function wr(e){let r=(s,a,d)=>{if(d<=a)return;let p=e.commentCoverage.get(s),c=p[p.length-1];c&&c[1]===a?c[1]=d:p.push([a,d]);},n=[],o=0,i=0;for(let s=0;s<=e.units.length;s+=1){for(;e.commentMarks[i]?.unit===s;){let d=e.commentMarks[i++];if(d.start){if(n.some(p=>p.id===d.id))continue;e.commentCoverage.has(d.id)||e.commentCoverage.set(d.id,[]),n.push({id:d.id,start:o});}else {let p=n.findIndex(c=>c.id===d.id);if(p!==-1){let[c]=n.splice(p,1);r(c.id,c.start,o);}}}let a=e.units[s];if(a){if(a.kind==="embed"&&a.embedKind==="pilcrow")for(let d of n)d.paragraphEnd??(d.paragraphEnd=o);o+=a.kind==="text"?a.text.length:1;}}for(let s of n)r(s.id,s.start,s.paragraphEnd??o);for(let[s,a]of e.commentCoverage)a.length===0&&e.commentCoverage.delete(s);}function Ne(e,r,n){if(d$2(n))return null;if(n.type==="paragraph"){let o=e.paragraph++;return !n.repeatedParaId&&n.paraId||`${r}:p${o}`}return n.type==="table"?`${r}:t${e.table++}`:gt(r,e.sdt++)}function vr(e){return /^\d+$/.test(e.trim())}function Cr(e){let r=e.structuredResult?.blocks??[],n=r[r.length-1];return !n||n.type!=="paragraph"||(n.content?.length??0)>0?null:r.length}function Tr(e,r,n,o,i,s){for(let a of e){if(a.kind!=="embed"||a.embedKind!=="field")continue;let d=a.payload.instruction;if(typeof d!="string"||!vr(d))continue;let p=a.payload.fieldData;if(typeof p!="string")continue;let c;try{c=JSON.parse(p);}catch{continue}let u=Cr(c);if(u===null||o+1+u>n.length)continue;let m={...i},h=[];for(let R=0;R<u;R+=1){let b=n[o+1+R],g=Ne(m,r,b);g!==null&&(b.type==="table"&&s.set(o+1+R,g),h.push(g));}h.length>0&&(a.payload.fieldResultBlocks=h);}}function Ir(e){return !d$2(e)&&e.type==="paragraph"&&(e.content?.some(r=>r.type==="run"&&r.content.some(n=>n.type==="fieldChar"&&n.charType==="separate"))??false)}function Dr(e,r,n,o,i){for(let s of e){if(s.kind!=="embed"||s.embedKind!=="field")continue;let a=s.payload.fieldData;if(typeof a!="string"||!a.includes('"blocks"'))continue;let d;try{d=JSON.parse(a);}catch{continue}if(!d||typeof d!="object")continue;let p=d.structuredCode?.blocks,c=d.structuredResult?.blocks,u=Array.isArray(p)?p.length:0,m=Array.isArray(c)&&c.length>0,h;if(u===0){let k=n[o+1];if(!m||!k||!Ir(k))continue;h=0;}else h=m?u:u-1;if(o+1+h+1>n.length)continue;let R=n.slice(o+1,o+1+h+1);if(R.some(k=>d$2(k)||k.type!=="paragraph"))continue;let b={...i},g=[];for(let k of R){let I=Ne(b,r,k);I!==null&&g.push(I);}let S=g.pop();S!==void 0&&(s.payload.fieldCodeMarks=g,s.payload.fieldCodeTarget=S);}}function V(e,r,n,o){let i={storyId:r,units:[],commentMarks:[],commentCoverage:new Map};e.plans.push(i);let s=n.length>0,a=s?[...n]:[{type:"paragraph",content:[]}],d={paragraph:0,table:0,sdt:0},p=new Map,c=null;for(let[u,m]of a.entries()){if(d$2(m))continue;let h=d.table,R=Ne(d,r,m);if(R===null)continue;if(m.type==="paragraph"){let g=yr(m,e.styleResolver,o.extraRunFormatting,o.tableParagraphFormatting);e.opaqueSequences.push(...g.opaqueSequences),Tr(g.units,r,a,u,d,p),Dr(g.units,r,a,u,d);let S=i.units.length;i.commentMarks.push(...g.commentMarks.map(k=>({...k,unit:S+k.unit}))),i.units.push(...g.units),i.units.push(D("pilcrow",{...g.ppr,...s&&m.paraId?{sourceParaId:m.paraId}:{},...s?{}:{paraOrigin:"synthetic"},paraId:R})),o.includePageBreaks&&br(m)&&i.units.push(D("pageBreak",{})),c="paragraph";continue}if(m.type==="table"){let g=xr(m,e.styleResolver,e.theme,e.compatibilityMode),S=g.rows.map((I,x)=>({trPr:I.attrs,cells:I.cells.map((v,C)=>({tcPr:v.attrs,story:_e(r,h,x,C)}))})),k=p.get(u);i.units.push(D("table",{tblPr:pt(g.attrs),grid:ct(g.attrs),rows:S,...k===void 0?{}:{blockId:k}})),g.rows.forEach((I,x)=>{I.cells.forEach((v,C)=>{V(e,_e(r,h,x,C),v.content,{includePageBreaks:false,appendBodyTail:false,seedComments:o.seedComments,extraRunFormatting:v.extraRunFormatting,tableParagraphFormatting:v.paragraphFormatting});});}),c="table";continue}let b=R;i.units.push(D("blockSdt",{...Pr(m.properties),story:b})),V(e,b,m.content,{includePageBreaks:o.includePageBreaks,appendBodyTail:false,seedComments:o.seedComments,tableParagraphFormatting:o.tableParagraphFormatting}),c="blockSdt";}o.appendBodyTail&&(c==="table"||c==="blockSdt")&&i.units.push(D("pilcrow",{hangingIndent:false,paraId:`${r}:p${d.paragraph}`,paraOrigin:"synthetic"})),o.seedComments&&wr(i);}function _r(e){let r=[{op:"delete",index:0,len:1}],n=0,o="",i={},s=X(i),a=()=>{o&&(r.push({op:"insert",index:n,text:o,attrs:i}),n+=o.length,o="");};for(let d of e)if(d.kind==="text"){let p=X(d.attrs);o&&p!==s&&a(),i=d.attrs,s=p,o+=d.text;}else a(),r.push({op:"insertEmbed",index:n,kind:d.embedKind,payload:d.payload,attrs:d.attrs}),n+=1;return a(),r}function Yr(e,r){let n=_r(r.units);for(let[o,i]of r.commentCoverage)n.push({op:"setComment",id:String(o),ranges:i,author:"",date:"",body:null});e.applySeedRawOps(r.storyId,n);}function Ar(e,r,n={}){h(e,"all");let o={styleResolver:r.package.styles?d(r.package.styles):null,theme:r.package.theme??null,plans:[],compatibilityMode:Qt(r),opaqueSequences:[]};V(o,"body",r.package.document.content,{includePageBreaks:true,appendBodyTail:true,seedComments:true});for(let[i,s]of r.package.headers??[])V(o,ye(i),s.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let[i,s]of r.package.footers??[])o.plans.some(a=>a.storyId===ye(i))||V(o,ye(i),s.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let i of r.package.footnotes??[])V(o,ht(i.id),i.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let i of r.package.endnotes??[])V(o,bt(i.id),i.content,{includePageBreaks:false,appendBodyTail:false,seedComments:true});for(let i of o.plans)e.createStory(i.storyId,"","Normal","left");for(let i of o.plans)Yr(e,i);e.seedOpaqueSequences(o.opaqueSequences),e.beginOpening(n.generation);}function Fr(e){let r=e.package;return [r.document.content,...[...r.headers?.values()??[]].map(n=>n.content),...[...r.footers?.values()??[]].map(n=>n.content),...(r.footnotes??[]).map(n=>n.content),...(r.endnotes??[]).map(n=>n.content)]}var Or="word/comments.xml";function Ct(e){if(Array.isArray(e)&&e.length>0&&e.every(n=>n?.type==="paragraph"))return e;let r=typeof e=="string"?e:"";return [{type:"paragraph",formatting:{},content:r?[{type:"run",formatting:{},content:[{type:"text",text:r}]}]:[]}]}function Er(e,r){let n=r.package.document.comments??[],o=new Map(e.listComments().map(c=>[c.id,c])),i=false,s=n.map(c=>{let u=o.get(String(c.id));return o.delete(String(c.id)),!u||!u.author&&!u.date&&u.body==null?c:(i=true,{...c,...u.author?{author:u.author}:{},...u.date?{date:u.date}:{},...u.body==null?{}:{content:Ct(u.body)}})}),a=new Set(n.map(c=>c.id)),d=new Map,p=Math.max(0,...a)+1;for(let c of o.values()){i=true;let u=/^\d+$/.test(c.id)?Number(c.id):Number.NaN;if(!Number.isSafeInteger(u)||a.has(u)){for(;a.has(p);)p+=1;u=p;}a.add(u),String(u)!==c.id&&d.set(u,c.id),s.push({id:u,author:c.author,...c.date?{date:c.date}:{},content:Ct(c.body)});}return {comments:s,sessionIds:d,changed:i}}function Mr(e,r){let n=new Map(r.paragraphs.flatMap(s=>s.session?[[s.session.paraId,s]]:[])),o=[],i=s=>{for(let a of s)if(a.type==="table")for(let d of a.rows)for(let p of d.cells)i(p.content);else if(a.type==="blockSdt")i(a.content);else if(a.type==="paragraph"&&a.paraId){let d=f(a),p=d===void 0?void 0:n.get(d);if(!p?.session||!p.persisted)continue;o.push({session:p.session,persisted:{...p.persisted,paraId:a.paraId}});}};for(let s of Fr(e))i(s);return o}function Be(e,r){let n=[],o=false;for(let i of e){let s=i;if(i.type==="paragraph")s=r(i);else if(i.type==="table"){let a=i.rows.map(d=>{let p=d.cells.map(c=>{let u=Be(c.content,r);return u===c.content?c:{...c,content:u}});return p.every((c,u)=>c===d.cells[u])?d:{...d,cells:p}});a.some((d,p)=>d!==i.rows[p])&&(s={...i,rows:a});}else if(i.type==="blockSdt"){let a=Be(i.content,r);a!==i.content&&(s={...i,content:a});}o||(o=s!==i),s&&n.push(s);}return o?n:e}function Tt(e,r){let n=s=>{let a=Be(s.content,r);return a===s.content?s:{...s,content:a}},o=e.package,i=s=>s&&new Map([...s].map(([a,d])=>[a,n(d)]));return {...e,package:{...o,document:n(o.document),headers:i(o.headers),footers:i(o.footers),footnotes:o.footnotes?.map(n),endnotes:o.endnotes?.map(n)}}}function Nr(e,r){let n=new Set(r.paragraphs.flatMap(({origin:o,session:i})=>o==="synthetic"&&i?[i.paraId]:[]));return n.size===0?e:Tt(e,o=>{let i=f(o);return o.content.length===0&&i!==void 0&&n.has(i)?null:o})}function Br(e,r){let n=new Map(r.flatMap(({paragraphs:o})=>o.map(([i,s])=>[s,i])));return n.size===0?e:Tt(e,o=>{let i=f(o),s=i===void 0?void 0:n.get(i);return s===void 0||o.sourceOrdinal===s?o:{...o,sourceOrdinal:s}})}function It(e){return {identities:e.paragraphIdentities(),plan:e.paragraphSavePlan()}}async function Dt(e,r,n,o,i={},s=()=>true,a=false,d=s){let p=(n.plan.splicedParts??[]).filter(({part:x})=>d(x)),c={assignments:n.plan.assignments,patchedParts:n.plan.patchedParts.filter(({part:x})=>s(x)),...p.length===0?{}:{splicedParts:p.map(({part:x,sha256:v,paragraphs:C,changed:A})=>({part:x,sha256:v,paragraphs:C.map(([J])=>J),changed:A}))}},u=Nr(r,n.identities),m=Mr(u,n.identities),{buffer:h}=await d$1(Br(u,p),o,i,void 0,void 0,c,a),R=new Uint8Array(h),b=e.writtenParagraphIds(R),g=(x,v)=>b[x]?.includes(v.toUpperCase())??false,S=m.filter(({persisted:x})=>g(x.story.partUri,x.paraId)),k=new Set(e.recordSavedParagraphIds([...S.map(({session:x,persisted:v})=>[x.paraId,v.paraId]),...c.assignments.filter(({part:x,paraId:v})=>g(`/${x}`,v)).map(({part:x,ordinal:v,paraId:C})=>[`/${x}#${v}`,C])]).map(([x,v])=>`${x}\0${v}`)),I=({session:x,persisted:v})=>k.has(`${x.paraId}\0${v.paraId}`);return {bytes:R,paragraphs:S.filter(x=>!I(x)),conflicts:S.filter(I)}}async function Wr(e,r={}){let n=e.materializeDocx();if(!n?.originalBuffer)throw new Error("saveYrsDocx requires a session opened from DOCX bytes");let o=It(e),i$1=Er(e,n),s=i(e,i$1.changed?{...n,package:{...n.package,document:{...n.package.document,comments:i$1.comments}}}:n,{commentIds:i$1.sessionIds});return Dt(e,s,o,n.originalBuffer,r,a=>!i$1.changed||a!==Or)}var Le=new WeakMap;async function qn(e){let r=new Uint8Array(e),n=globalThis.crypto?.subtle;if(!n)return r;try{let o=new Uint8Array(await n.digest("SHA-256",r));Le.set(r,Array.from(o,i=>i.toString(16).padStart(2,"0")).join(""));}catch{}return r}function Vn(e){return Le.get(e)}function zn(e,r){return !e||!r?e===r:e.anchor.story===r.anchor.story&&e.anchor.paraId===r.anchor.paraId&&e.anchor.offset===r.anchor.offset&&e.head.story===r.head.story&&e.head.paraId===r.head.paraId&&e.head.offset===r.head.offset}function Jr(){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 _t(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 Yt(e){return JSON.stringify(e.map(r=>({story:r.story,startPara:r.start.paraId,startOffset:r.start.offset,endPara:r.end.paraId,endOffset:r.end.offset})))}function At(e){return e.kind==="search"?e.within.story:e.story}function We(e){return e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function $n(e,r){return Je(e,r)}function Je(e,r){let n=JSON.parse(e);if(typeof n!="object"||n===null||Array.isArray(n))throw new TypeError("DOCX host metadata must be an object");let o=n;if(!Array.isArray(o.referencedFonts)||!o.referencedFonts.every(a=>typeof a=="string"))throw new TypeError("DOCX host referencedFonts must be a string array");let i=o.unusedScriptFonts??[];if(!Array.isArray(i)||!i.every(a=>typeof a=="string"))throw new TypeError("DOCX host unusedScriptFonts must be a string array");let s=c(o.envelope,We(r));return {document:s.document,referencedFonts:o.referencedFonts,unusedScriptFonts:i,...o.wholeBody===true?{wholeBody:true}:{},embeddedFonts:s.embeddedFonts,...s.fontTableRelationshipsXml===void 0?{}:{fontTableRelationshipsXml:s.fontTableRelationshipsXml}}}var Lr=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;function Ur(e,r){let n=new Map,o=[],i=false,s=false,a$1=0,d=0,p=false,c=false,u,m=null,h$1=[],R=new Map,b=new Map,g=null,S=false,k=0,I=false,x=null,v=t=>(t.layoutJson!==void 0&&x!==null&&(g=x,S=true,k+=1,I=false,x=null),t),C=0,A=null,J=null,ae=()=>{u=void 0,m=null;},Ue=()=>{if(!(s||p||d!==0)){p=true;try{for(;!s&&o.length>0;){let t=o.shift();if(!t)break;for(let[l,f]of [...n]){if(s)return;if(n.get(l)===f)try{f(t.update.slice(),t.origin);}catch{}}}}finally{p=false,s&&(o.length=0);}}},le=false,Z=false,y=t=>{if(le)throw new Error("A document preview is display-only");return je(t)},je=t=>{ae(),d+=1;try{return t()}finally{d-=1,d===0&&Ue();}},He=t=>t?{anchor:{...t.anchor},head:{...t.head}}:null,P=t=>{c||(e.track_undo(),c=true),t!==void 0&&(e.select_story(t),w(t));},w=t=>{h(B,t);},F=t=>(w(t.createdStoryIds),w(t.deletedStoryIds),w(t.changedStoryIds),t),de=()=>(u!==void 0?u:JSON.parse(e.selection()))?.head.story??"all",Ft=()=>{i||(e.set_update_observer((t,l)=>{l!==0&&l!==1||(o.push({update:t.slice(),origin:l===0?"local":"remote"}),Ue());}),i=true);},Ot=()=>{!i||n.size>0||s||(o.length=0,e.clear_update_observer(),i=false);},Re=new Map,qe=0,ke=()=>{Re.clear(),qe+=1;},Ve=(t,l,f={})=>{let T=t.slice();w("all"),ke();let W=y(()=>{e.set_media_tokens(f.mediaTokens===true);let j=e.open_docx(T,l,f.generation,Le.get(t));return M.reset(),j}),$=$e(Je(W,T));return A=T,J=ve($.document),Z=false,$},ze=t=>{if(s||!t.startsWith("media:"))return null;let l=Re.get(t);return l===void 0&&(l=e.media_data_url(t)??null,Re.set(t,l)),l},$e=t=>(a(t.document.package.document.comments,ze),t),ue=null,M=d$3({version:()=>e.version(),resolveParagraphAnchor:t=>B.resolveParagraphAnchor(t),findText:t=>B.findText(t),readParagraphs:t=>B.readParagraphs(t),applyEdits:t=>B.applyEdits(t),listRevisions:()=>B.listRevisions(),revisionStamps:t=>JSON.parse(e.revision_stamps_json(JSON.stringify(t))),settleRevisions:(t,l)=>{let f=B.storiesChangedSince(Number.MAX_SAFE_INTEGER).revision;e.settle_revisions_json(JSON.stringify({accept:t,reject:l})),w(B.storiesChangedSince(f).stories);},...typeof e.begin_shared_reads=="function"&&typeof e.end_shared_reads=="function"?{sharedReads:t=>{e.begin_shared_reads();try{return t()}finally{e.end_shared_reads();}}}:{}}),B={clientId:r,openDocxPreview:(t,l)=>{w("all"),ke();let f=je(()=>e.open_docx_preview(t,l));return f===void 0?null:(le=true,Z=true,$e(Je(f,t)))},isDisplayOnly:()=>le,markDisplayOnly:()=>{le=true,Z=true;},setPartialDocument:t=>{Z=t,e.set_partial_document(t);},layoutDocumentWithRegionsPrefixRetainedJson:(t,l)=>{let f=e.layout_document_with_regions_prefix_retained_json(t,l);return g=t,S=true,k+=1,I=false,f},registerFont:t=>{let l=e.register_measure_font(t);return h$1.push(t.slice()),C+=1,l},registerSubstituteFont:(t,l)=>{let f=e.register_substitute_measure_font(t,l);return f===t||(h$1.push({substituteOf:t,family:l}),C+=1),f},clearFonts:()=>{e.clear_measure_fonts(),h$1.length=0,b.clear(),C+=1;},measureParagraphJson:t=>{let l=e.measure_paragraph_json(t);return b.set(t,t),l},layoutDocumentJson:t=>{let l=e.layout_document_json(t);return g=t,S=false,k+=1,I=false,l},layoutFontRequirementsJson:t=>e.layout_font_requirements_json(t),layoutDocumentWithRegionsJson:t=>{let l=e.layout_document_with_regions_json(t);return g=t,S=true,k+=1,I=false,l},layoutDocumentWithRegionsRetainedJson:t=>{let l=e.layout_document_with_regions_retained_json(t);return g=t,S=true,k+=1,I=false,l},beginRegionLayout:t=>(x=t,v(JSON.parse(e.begin_region_layout(t)))),resumeRegionLayout:t=>v(JSON.parse(e.resume_region_layout(t))),adoptResidentWorkerLayout:t=>(g=t,S=true,k+=1,I=true,k),residentLayoutInWorker:()=>I,retainedKernelInputsJson:t=>{if(I)throw new Error("the retained layout was computed in the resident worker");if(t!==k)throw new Error(`retained layout revision mismatch: expected ${t}, current ${k}`);return e.retained_kernel_inputs_json()},buildDisplayListJson:t=>e.build_display_list_json(t),resetFrameBase:()=>{s||e.reset_frame_base();},buildDisplayListFrame:(t,l)=>e.build_display_list_frame(t,l),setDisplayWindow:(t,l)=>e.set_display_window(t,l),setDisplayRetainBuiltPages:t=>e.set_display_retain_built_pages(t),setWindowedIncrementalBuilds:t=>e.set_windowed_incremental_builds(t),buildDisplayPagesFrame:(t,l)=>e.build_display_pages_frame(Uint32Array.from(t),l),releaseDisplayPagesFrame:(t,l)=>{let f=e.release_display_pages_frame(Uint32Array.from(t),l);return f.length===0?null:f},residentCaretSnapshot:()=>JSON.parse(e.resident_caret_snapshot_json()),applyInput:(t,l)=>(P(),w(de()),y(()=>e.apply_input(t,l))),applyDelete:(t,l,f=1)=>(P(),w(de()),y(()=>e.apply_delete(t,l,f))),residentDeletedUnits:()=>e.resident_deleted_units(),applyInputProfiled:(t,l)=>{P(),w(de());let f=y(()=>e.apply_input_profiled(t,l)),T=JSON.parse(e.apply_input_profile_json());return {frame:f,profile:T}},applyDeleteProfiled:(t,l,f=1)=>{P(),w(de());let T=y(()=>e.apply_delete_profiled(t,l,f)),W=JSON.parse(e.apply_input_profile_json());return {frame:T,profile:W}},residentWorkerSnapshot:t=>{if(!g||!S&&R.size===0)return null;let l=ue!==null,f=l?"null":e.selection(),T=l?void 0:e.media_sources_json(),W=t?.knownFontsRevision===C,$=null;if(!l&&t?.knownStateVector)try{$=e.encode_diff(t.knownStateVector.slice());}catch{$=null;}return {clientId:r,...l?{workerAuthoritative:true}:{},state:l?new Uint8Array(0):$??e.encode_state(),selection:JSON.parse(f),fonts:W?[]:h$1.map(j=>j instanceof Uint8Array?j.slice():{...j}),fontsRevision:C,renderInputs:[...R].map(([j,Et])=>({story:j,env:structuredClone(Et)})),measureInputs:[...b.values()],layoutInput:g,layoutWithRegions:S,layoutRevision:k,...Z?{partialDocument:true}:{},...T?{mediaSources:T}:{}}},residentWorkerProbe:()=>!g||!S&&R.size===0?null:{layoutRevision:k},displayHitTestRegionsJson:(t,l,f)=>e.display_hit_test_regions_json(t,l,f),displayVerticalMoveJson:(t,l,f)=>e.display_vertical_move_json(t,l,f),displayRangeRectsJson:(t,l)=>e.display_range_rects_json(t,l),displayRangeRectsRegionJson:(t,l,f,T)=>e.display_range_rects_region_json(t,l,f,T),outlineGlyphJson:(t,l)=>e.outline_glyph_json(t,l),loadState:t=>{w("all"),y(()=>{e.load(t),M.reset();});},seedFromDocx:(t,l)=>Ve(t,true,l),openDocx:Ve,beginOpening:t=>{y(()=>{e.begin_opening(t),M.reset();});},seedOpaqueSequences:t=>{w("all"),y(()=>e.seed_opaque_sequences(JSON.stringify(t)));},mediaSource:t=>{if(s||!t.startsWith("media:"))return null;let l=e.media_bytes(t),f=l&&e.media_type(t);return l&&f?{bytes:l,mimeType:f}:null},loadMediaSources:t=>e.load_media_sources(t),mediaDataUrl:ze,mediaScope:()=>qe,materializeDocx:()=>{let t=A,l=e.materialize_docx();return !t||l===void 0?null:b$2(l,We(t)).document},loadStories:t=>(w(t.map(l=>l.storyId)),y(()=>JSON.parse(e.load_json(JSON.stringify(t))))),encodeState:()=>e.encode_state(),encodeStateVector:()=>e.encode_state_vector(),encodeStateAsUpdate:t=>t===void 0?e.encode_state():e.encode_diff(t.slice()),applyUpdate:t=>(w("all"),y(()=>JSON.parse(e.apply_update_with_inference(t)))),applyLocalUpdate:t=>{P(),w("all"),y(()=>e.apply_local_update(t));},applyHostUpdate:(t,l)=>{w(l??"all"),y(()=>e.apply_host_update(t));},onUpdate:t=>{if(s)throw new Error("yrs session is destroyed");if(typeof t!="function")throw new TypeError("update listener must be a function");let l=a$1++;n.set(l,t),Ft();let f=true;return ()=>{f&&(f=false,n.delete(l),Ot());}},encodeStickyPosition:t=>({story:t.story,encoded:e.encode_sticky_position(t.story,t.paraId,t.offset)}),resolveStickyPosition:t=>{try{return JSON.parse(e.resolve_sticky_position(t.story,t.encoded))}catch{return null}},setSelection:(t,l=t)=>{if(t.story!==l.story)throw new Error("yrs selection must stay inside one story");e.set_selection(t.story,t.paraId,t.offset,l.paraId,l.offset),u={anchor:{...t},head:{...l}};},selection:()=>(u!==void 0||(u=JSON.parse(e.selection())),He(u)),encodeSelection:()=>{let t=JSON.parse(e.encoded_selection());return t?{story:t.story,anchor:Uint8Array.from(t.anchor),head:Uint8Array.from(t.head)}:null},resolveSelection:t=>{try{return JSON.parse(e.resolve_encoded_selection(t.story,t.anchor,t.head))}catch{return null}},setCellSelection:t=>e.set_cell_selection(JSON.stringify(t)),cellSelection:()=>JSON.parse(e.cell_selection()),beginUndoCapture:P,addUndoBoundary:()=>e.add_undo_boundary(),setUndoCaptureMode:t=>e.set_undo_capture_mode(t),undoCaptureMode:()=>e.undo_capture_mode(),historyStories:()=>e.history_stories(),undo:()=>y(()=>{let t=e.undo();return t&&w(e.history_stories()),t}),redo:()=>y(()=>{let t=e.redo();return t&&w(e.history_stories()),t}),canUndo:()=>e.can_undo(),canRedo:()=>e.can_redo(),createStory:(t,l,f="Normal",T="left")=>(w(t),y(()=>JSON.parse(e.create_story(t,l,f,T)))),deleteStory:t=>(w(t),y(()=>e.delete_story(t))),insertTable:(t,l,f,T)=>(P(t.story),y(()=>F(JSON.parse(e.insert_table(t.story,t.paraId,t.offset,l,f,T?.name,T?.date))))),insertRow:(t,l,f)=>(P(t.story),y(()=>F(JSON.parse(e.insert_row(JSON.stringify(t),l==="below",f?.name,f?.date))))),insertColumn:(t,l)=>(P(t.story),y(()=>F(JSON.parse(e.insert_column(JSON.stringify(t),l==="right"))))),deleteRow:(t,l)=>(P(t.anchor.story),y(()=>F(JSON.parse(e.delete_row(JSON.stringify(t),l?.name,l?.date))))),deleteColumn:t=>(P(t.anchor.story),y(()=>F(JSON.parse(e.delete_column(JSON.stringify(t)))))),deleteTable:t=>(P(t.story),y(()=>F(JSON.parse(e.delete_table(JSON.stringify(t)))))),mergeCells:t=>(P(t.anchor.story),y(()=>F(JSON.parse(e.merge_cells(JSON.stringify(t)))))),splitCell:(t,l,f)=>(P(t.story),y(()=>F(JSON.parse(e.split_cell(JSON.stringify(t),l,f))))),setCellShading:(t,l)=>(P(t.anchor.story),y(()=>F(JSON.parse(e.set_cell_shading(JSON.stringify(t),l??void 0))))),setCellTextFormat:(t,l)=>(P(t.anchor.story),y(()=>F(JSON.parse(e.set_cell_text_format(JSON.stringify(t),JSON.stringify(l)))))),setCellBorders:(t,l)=>(P(t.anchor.story),y(()=>F(JSON.parse(e.set_cell_borders(JSON.stringify(t),JSON.stringify(l)))))),setColumnWidth:(t,l)=>(P(t.story),y(()=>F(JSON.parse(e.set_column_width(JSON.stringify(t),l))))),setTableWidth:(t,l)=>(P(t.story),y(()=>F(JSON.parse(e.set_table_width(JSON.stringify(t),l))))),insertText:(t,l,f)=>(P(t.story),y(()=>JSON.parse(e.insert_text(t.story,t.paraId,t.offset,l,f?.name,f?.date)))),deleteRange:(t,l)=>(P(t.story),y(()=>JSON.parse(e.delete_range(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,l?.name,l?.date)))),replaceRange:(t,l,f)=>(P(t.story),y(()=>JSON.parse(e.replace_range(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,l,f?.name,f?.date)))),splitParagraph:(t,l)=>(P(t.story),y(()=>JSON.parse(e.split_paragraph(t.story,t.paraId,t.offset,l?.name,l?.date)))),mergeParagraphs:(t,l,f)=>(P(t),y(()=>JSON.parse(e.merge_paragraphs(t,l,f?.name,f?.date)))),toggleMark:(t,l)=>{P(t.story),y(()=>e.toggle_mark(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,JSON.stringify(l)));},formatRange:(t,l)=>{P(t.story),y(()=>e.format_range(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,JSON.stringify(l)));},setHyperlink:(t,l)=>{P(t.story),y(()=>e.set_hyperlink(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,JSON.stringify(l)));},clearFormatting:t=>{P(t.story),y(()=>e.clear_formatting(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset));},applyParagraphStyle:(t,l,f)=>{P(t.story),y(()=>e.apply_paragraph_style(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,l,f?.name,f?.date));},setParagraphAttrs:(t,l,f)=>{P(t.story),y(()=>e.set_paragraph_attrs(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset,JSON.stringify(l),f?.name,f?.date));},insertImage:(t,l,f)=>(P(t.story),y(()=>JSON.parse(e.insert_image(t.story,t.paraId,t.offset,JSON.stringify(l),f?.name,f?.date)))),setContentControlValue:(t,l)=>{P(),w("all"),y(()=>e.set_content_control_value(t,JSON.stringify(l)));},setContentControlValueAt:(t,l)=>{P(t.story),typeof l=="string"&&w("all"),y(()=>e.set_content_control_value_at(t.story,t.paraId,t.offset,JSON.stringify(l)));},clearContentControlValue:t=>{P(),w("all"),y(()=>e.clear_content_control_value(t));},setImageGeometry:(t,l)=>{P(),w("all"),y(()=>e.set_image_geometry(t,JSON.stringify(l)));},setImageGeometryAt:(t,l)=>{P(t.story),y(()=>e.set_image_geometry_at(t.story,t.paraId,t.offset,JSON.stringify(l)));},insertPageBreak:t=>{P(t.story),y(()=>e.insert_page_break(t.story,t.paraId,t.offset));},insertSectionBreak:(t,l)=>{P(t.story),y(()=>e.insert_section_break(t.story,t.paraId,t.offset,l));},insertWatermark:(t,l)=>{P(t.story),y(()=>e.insert_watermark(t.story,t.paraId,t.offset,JSON.stringify(l)));},applyRawOps:(t,l)=>{let f=l.some(T=>T.op==="insertEmbed"&&T.kind==="pilcrow"||T.op==="setEmbedAttr"&&T.key==="paraId");w(f?"all":t),y(()=>e.apply_raw_ops(t,JSON.stringify(l)));},applySeedRawOps:(t,l)=>{w(t),y(()=>e.apply_seed_raw_ops(t,JSON.stringify(l)));},setParagraphAttr:(t,l,f)=>{w("all"),y(()=>e.set_paragraph_attr(t,l,JSON.stringify(f??null)));},addComment:(t,l,f,T)=>(w(t.map(W=>W.story)),y(()=>JSON.parse(e.add_comment(Yt(t),l,f,JSON.stringify(T??null))))),setCommentRanges:(t,l)=>{P(),y(()=>{e.set_comment_ranges(t,Yt(l)),w("all");});},acceptChange:t=>(w("all"),y(()=>JSON.parse(e.accept_change(_t(t))))),rejectChange:t=>(w("all"),y(()=>JSON.parse(e.reject_change(_t(t))))),selectionContext:t=>{let l=JSON.stringify(t);if(m?.key===l)return JSON.parse(m.json);let f=e.selection_context(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset),T=JSON.parse(f);return m={key:l,json:f},T},listRevisions:()=>JSON.parse(e.list_revisions()),resolveComment:t=>JSON.parse(e.resolve_comment(t)),listComments:()=>JSON.parse(e.list_comments()),storyIds:()=>e.story_ids(),hasStory:t=>!Lr.test(t)&&e.has_story(t),storyLength:t=>e.story_len(t),storyChecksum:t=>BigInt(e.story_checksum(t)),yrsBlocksForStory:(t,l={})=>{let f=e.yrs_blocks_for_story(t,JSON.stringify(l)),T=JSON.parse(f);return R.set(t,structuredClone(l)),T},paragraphs:t=>JSON.parse(e.paragraphs(t)),searchText:(t,l={})=>{if(!t)return [];let f=l.limit??Number.POSITIVE_INFINITY;if(!Number.isSafeInteger(f)&&f!==Number.POSITIVE_INFINITY||f<0)throw new RangeError("search limit must be a non-negative safe integer");return JSON.parse(e.search_text(t,l.caseSensitive??false,Number.isFinite(f)?Math.min(f,4294967295):void 0))},paragraphSpans:t=>JSON.parse(e.paragraph_spans(t)),storySegments:t=>JSON.parse(e.story_segments(t)),storiesChangedSince:t=>JSON.parse(e.stories_changed_since(t)),storySegmentUnitDigests:t=>JSON.parse(e.story_segment_unit_digests(t)),storySegmentUnits:(t,l)=>JSON.parse(e.story_segment_units(t,Uint32Array.from(l))),tablePayload:(t,l)=>{if(!Number.isInteger(l)||l<0||l>4294967295)return e.story_len(t),null;let f=e.table_payload(t,l);return f===void 0?null:JSON.parse(f)},locateParagraph:(t,l)=>JSON.parse(e.locate_paragraph(t,l)),paragraphIdCount:(t,l)=>e.paragraph_id_count(t,l),paragraphIdentities:()=>JSON.parse(e.paragraph_identities()),persistParagraphIds:()=>(w("all"),y(()=>JSON.parse(e.persist_paragraph_ids()))),resolveParagraphAnchor:t=>JSON.parse(e.resolve_paragraph_anchor(JSON.stringify(t))),storyParagraphIds:t=>JSON.parse(e.story_paragraph_ids(t)),paragraphSavePlan:()=>JSON.parse(e.paragraph_save_plan()),recordSavedParagraphIds:t=>y(()=>JSON.parse(e.record_saved_paragraph_ids(JSON.stringify(t)))),writtenParagraphIds:t=>JSON.parse(e.written_paragraph_ids(t)),exportStructured:t=>JSON.parse(e.export_structured_json(JSON.stringify(t))),exportMarkdown:t=>JSON.parse(e.export_markdown_json(JSON.stringify(t))),exportStructuredWithPages:t=>JSON.parse(e.export_structured_with_pages_json(JSON.stringify(t),void 0)),exportStructuredWithPagesFor:(t,l)=>JSON.parse(e.export_structured_with_pages_json(JSON.stringify(t),l)),exportSnapshotWithPrivateFonts:(t,l,f,T)=>JSON.parse(e.export_snapshot_with_private_fonts_json(t,l,f,JSON.stringify(T))),headings:t=>JSON.parse(e.headings_json(t)),listContentControls:(t={})=>JSON.parse(e.list_content_controls_json(JSON.stringify(t))),findContentControls:(t,l={})=>JSON.parse(e.find_content_controls_json(JSON.stringify(t),JSON.stringify(l))),version:()=>ue??e.version(),readParagraphs:t=>JSON.parse(e.read_paragraphs_json(JSON.stringify(t))),findText:t=>JSON.parse(e.find_text_json(JSON.stringify(t))),validateEdits:t=>JSON.parse(e.validate_edits_json(JSON.stringify(t))),applyEdits:t=>y(()=>{let l=JSON.parse(e.apply_edits_json(JSON.stringify(t)));return l.ok&&l.applied&&w(l.changedStories),l}),proposeChanges:t=>y(()=>M.propose(t)),setProposalStates:t=>M.setStates(t),withdrawProposals:t=>y(()=>M.withdraw(t)),getProposals:()=>M.snapshot(),mirrorWorkerDocument:t=>{ue=t?.version??null,M.mirror(t);},workerDocumentMirrored:()=>ue!==null,onProposalChange:t=>{if(s)throw new Error("yrs session is destroyed");return M.subscribe(t)},formatTextTarget:(t,l)=>(P(At(t)),y(()=>JSON.parse(e.format_text_target_json(JSON.stringify(t),JSON.stringify(l))))),commentTextTarget:(t,l)=>(w(At(t)),y(()=>JSON.parse(e.comment_text_target_json(JSON.stringify(t),JSON.stringify({...l,body:l.body??null}))))),selectionText:t=>JSON.parse(e.selection_text_json(t.story,t.start.paraId,t.start.offset,t.end.paraId,t.end.offset)),destroy:()=>{s||(s=true,ke(),n.clear(),M.destroy(),o.length=0,i&&e.clear_update_observer(),e.free());}};return b$3(B,{sourcePackage:()=>A&&J?{buffer:We(A),keys:J}:null,compareDocx:(t,l,f)=>{w("all");let T=y(()=>{let W=e.compare_docx_json(t,l,f);return M.reset(),W});return A=t.slice(),J=null,T},finishComparedDocx:t=>e.finish_compared_docx_json(t),failComparedDocx:t=>e.fail_compared_docx_json(t)}),B}async function Kn(e){let r=e?.clientId??Jr(),n=await import('../wasm-KSZTTO3B.mjs');return await n.preloadEditWasm(),Ur(n.createEditSession(r),r)}export{fe as ResidentEngineWorkerClient,_ as ResidentWorkerFailureError,re as ResidentWorkerOutOfMemoryError,Te as canUseResidentEngineWorker,It as captureSessionSave,Kn as createYrsSession,$n as decodeDocxHostJson,Ar as documentToYrs,ve as editorSaveKeys,$t as preloadDocxEngine,Ie as preloadResidentEngineWorker,qn as prepareDocxBytes,Vn as preparedDocxDigest,Vt as retainPreloadedResidentEngineWorker,zn as sameYrsSelection,Wr as saveYrsDocx,zt as takePreloadedResidentEngineWorker,Dt as writeSessionSave};
1
+ export{a as captureSessionSave,e as hostSaveMetadata,d as mergeDocxHostMetadata,f as saveEditorDocument,c as saveYrsDocx,b as writeSessionSave}from'../chunk-4LO3PSLZ.mjs';export{h as DOCX_CLIPBOARD_FRAGMENT_VERSION,w as YrsPositionProjection,A as anchorDisplayRoot,y as anchorFailure,n as applyClipboardFragment,i as clipboardFragmentHasPictures,k as clipboardTablePayload,f as compareYrsLocs,I as computeAnchorTargetGeometry,H as computeProposalGeometryMirror,c as createYrsInputPositionMap,t as createYrsLocProjectionFromOutline,u as createYrsPositionProjection,e as displayPositionToYrsLoc,b as findBodyMatches,a as findParagraphs,D as hiddenRanges,E as hiddenRangesForPreview,z as isBodyStory,B as paragraphInlineStart,v as projectYrsDisplayPosition,G as proposalSetIdentity,m as readClipboardSlice,q as readOutlineHeadings,o as readSidebar,l as readTableFragment,r as residentCaretDeviceRect,s as residentCaretSnapshotForFrame,F as resolveAnchorTarget,K as resolveMirroredNavigationTarget,L as resolveNavigationTarget,O as resolveReservations,J as resolvedTargetGeometry,M as retainReservationOwners,g as tableBoundaryDeleteTarget,C as textRangeToRaw,j as validClipboardFragment,N as validReservationsPayload,d as yrsLocToDisplayPosition,x as yrsLocToProjectedDisplayPosition}from'../chunk-ONYCW7VV.mjs';import {o,p,s}from'../chunk-BR5BFOHF.mjs';export{a as OPAQUE_SEED_BUDGET_BYTES,b as OpaqueSeedBudgetError,k as PeerMetadataError,d as assertOpaqueSeedBudget,i as breakRefusedWhileSuggesting,q as decodeDocxHostJson,e as documentToYrs,c as normalizeSeedError,j as peerMetadataTags,m as proposalRevisionPreview}from'../chunk-BR5BFOHF.mjs';export{i as DirtyProjectionStories,j as EditorDirtyStories,h as dirtyProjectionStory,c as editorSaveKeys,l as proposalProjectionStories,k as serialWorkerSaves}from'../chunk-TE3AU2JK.mjs';export{a as DocxSectionError,e as MAX_TABLE_COLUMNS,f as embedPlainText,m as ownProjectedParagraphs,k as storyOffsetForLoc,h as storyPlainText,j as tableAnchors,g as tablePlainText,i as tableRowGrid,o as yrsToDocument}from'../chunk-KXIGXLFA.mjs';export{a as LAYOUT_META_VERSION,b as isLayoutMetaV1,d as layoutMetaSummary,c as readRetainedLayoutMeta}from'../chunk-CDNWHQH2.mjs';import {l}from'../chunk-VHOOSS4D.mjs';import'../chunk-N5RE2S3U.mjs';import'../chunk-ETDMQ5GE.mjs';export{f as headerFooterDisplayRIds,e as headerFooterStory,a as sessionSourcePackage}from'../chunk-IHETKRDA.mjs';import {g}from'../chunk-RGDE6YQB.mjs';export{c as DocxWorkerSaveUnavailableError,a as ResidentEngineWorkerClient,b as ResidentWorkerFailureError,e as ResidentWorkerOutOfMemoryError,f as canUseResidentEngineWorker,g as preloadResidentEngineWorker,h as retainPreloadedResidentEngineWorker,i as takePreloadedResidentEngineWorker}from'../chunk-RGDE6YQB.mjs';import'../chunk-6WT6HKAY.mjs';import'../chunk-EUUIJVM6.mjs';import'../chunk-LPOEM5WH.mjs';import'../chunk-CRTTEHZN.mjs';import'../chunk-25WGDXBF.mjs';import'../chunk-7C3Y7LIH.mjs';import'../chunk-KXLTK7AT.mjs';import'../chunk-UQSVFDRV.mjs';import'../chunk-QWHU7YIW.mjs';import'../chunk-MAYPJU23.mjs';import'../chunk-OBQGPMPQ.mjs';import'../chunk-ISBZLVIF.mjs';import'../chunk-LTVVQMHB.mjs';import'../chunk-CTBUQRYQ.mjs';import'../chunk-HPZFJGGM.mjs';import'../chunk-QGZ2AB3M.mjs';import'../chunk-LT2GCWZ3.mjs';import'../chunk-YITJ4QAO.mjs';import'../chunk-UBUTIWXN.mjs';import'../chunk-7WIUNGQW.mjs';export{a as WASM32_MEMORY_LIMIT_BYTES,b as wasmModuleMemories}from'../chunk-HGKSOBXK.mjs';import'../chunk-TTRUPDAB.mjs';async function re(){let r=[import('../chunk-GBOHQ3CJ.mjs').then(t=>t.preloadEditWasm()),import('../chunk-NLYHFVF5.mjs').then(t=>t.preloadOpcWasm()),import('../chunk-6AUR4AA2.mjs').then(t=>t.preloadParseWasm()),import('../chunk-77ZWGQZN.mjs').then(t=>t.preloadLayoutWasm())],e;try{e=g();}catch(t){e=Promise.reject(t);}await Promise.all([...r,e]);}async function Ze(r){let e=new Uint8Array(r),t=globalThis.crypto?.subtle;if(!t)return e;try{let l=new Uint8Array(await t.digest("SHA-256",e));o.set(e,Array.from(l,p=>p.toString(16).padStart(2,"0")).join(""));}catch{}return e}function $e(r){return o.get(r)}function er(r,e){return !r||!e?r===e:r.anchor.story===e.anchor.story&&r.anchor.paraId===e.anchor.paraId&&r.anchor.offset===e.anchor.offset&&r.head.story===e.head.story&&r.head.paraId===e.head.paraId&&r.head.offset===e.head.offset}async function rr(r){let e=l(r?.clientId??p()),t=await import('../chunk-GBOHQ3CJ.mjs');return await t.preloadEditWasm(),s(t.createEditSession(e),e)}export{rr as createYrsSession,re as preloadDocxEngine,Ze as prepareDocxBytes,$e as preparedDocxDigest,er as sameYrsSelection};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@betteroffice/docx",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "sideEffects": [
5
- "**/residentEngineWorker.*"
5
+ "**/docxWorker.*"
6
6
  ],
7
- "description": "Word-faithful DOCX editor and viewer core — full OOXML fidelity, real-time human + AI agent collaboration. Framework-agnostic (Rust/Wasm).",
7
+ "description": "Word-faithful DOCX editor and viewer core: full OOXML fidelity, real-time human + AI agent collaboration. Framework-free (Rust/Wasm).",
8
8
  "main": "./dist/core.mjs",
9
9
  "module": "./dist/core.mjs",
10
10
  "types": "./dist/core.d.mts",
@@ -116,6 +116,10 @@
116
116
  "./editor": {
117
117
  "types": "./dist/editor/index.d.mts",
118
118
  "import": "./dist/editor/index.mjs"
119
+ },
120
+ "./worker": {
121
+ "types": "./dist/worker.d.mts",
122
+ "import": "./dist/worker.mjs"
119
123
  }
120
124
  },
121
125
  "typesVersions": {
@@ -197,6 +201,9 @@
197
201
  ],
198
202
  "editor": [
199
203
  "./dist/editor/index.d.mts"
204
+ ],
205
+ "worker": [
206
+ "./dist/worker.d.mts"
200
207
  ]
201
208
  }
202
209
  },
@@ -217,7 +224,7 @@
217
224
  }
218
225
  },
219
226
  "devDependencies": {
220
- "@betteroffice/fonts": "0.4.0",
227
+ "@betteroffice/fonts": "0.4.1",
221
228
  "tsup": "^8.0.1",
222
229
  "typescript": "^6.0.3",
223
230
  "@types/bun": "^1.0.0",
@@ -252,6 +259,9 @@
252
259
  "url": "https://github.com/openooxml/betteroffice.git",
253
260
  "directory": "packages/docx"
254
261
  },
262
+ "bugs": {
263
+ "url": "https://github.com/openooxml/betteroffice/issues"
264
+ },
255
265
  "publishConfig": {
256
266
  "access": "public"
257
267
  }
@@ -1 +0,0 @@
1
- import {c as c$1}from'./chunk-HGKSOBXK.mjs';import {a}from'./chunk-TTRUPDAB.mjs';var U={};a(U,{build_display_list_json:()=>A,clear_measure_fonts:()=>D,close_display_list:()=>X,default:()=>J,hit_test_json:()=>z,hit_test_regions_by_handle:()=>N,hit_test_regions_json:()=>M,initSync:()=>S,install_panic_hook:()=>Y,layout_document_json:()=>T,measure_paragraph_json:()=>W,open_display_list:()=>K,outline_glyph_json:()=>O,range_rects_by_handle:()=>Q,range_rects_json:()=>B,range_rects_region_by_handle:()=>Z,range_rects_region_json:()=>$,register_measure_font:()=>I,register_substitute_measure_font:()=>H,update_display_list:()=>ee,vertical_move_by_handle:()=>ne,vertical_move_json:()=>te});function A(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.build_display_list_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,f(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function D(){let e=o.clear_measure_fonts();if(e[1])throw f(e[0])}function X(e){o.close_display_list(e);}function z(e,n,t,r){let s,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.hit_test_json(l,b,n,t,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,f(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function N(e,n,t,r){let s,_;try{let l=o.hit_test_regions_by_handle(e,n,t,r);var a=l[0],i=l[1];if(l[3])throw a=0,i=0,f(l[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function M(e,n,t,r){let s,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.hit_test_regions_json(l,b,n,t,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,f(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function Y(){o.install_panic_hook();}function T(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.layout_document_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,f(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function W(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.measure_paragraph_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,f(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function K(e){let n=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,r=o.open_display_list(n,t);if(r[2])throw f(r[1]);return r[0]>>>0}function O(e,n){let t,r;try{let a=o.outline_glyph_json(e,n);var s=a[0],_=a[1];if(a[3])throw s=0,_=0,f(a[2]);return t=s,r=_,p(s,_)}finally{o.__wbindgen_free(t,r,1);}}function Q(e,n,t){let r,s;try{let i=o.range_rects_by_handle(e,n,t);var _=i[0],a=i[1];if(i[3])throw _=0,a=0,f(i[2]);return r=_,s=a,p(_,a)}finally{o.__wbindgen_free(r,s,1);}}function B(e,n,t){let r,s;try{let i=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=u,b=o.range_rects_json(i,l,n,t);var _=b[0],a=b[1];if(b[3])throw _=0,a=0,f(b[2]);return r=_,s=a,p(_,a)}finally{o.__wbindgen_free(r,s,1);}}function Z(e,n,t,r,s){let _,a;try{let b=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),d=u,h=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),m=u,w=o.range_rects_region_by_handle(e,b,d,h,m,r,s);var i=w[0],l=w[1];if(w[3])throw i=0,l=0,f(w[2]);return _=i,a=l,p(i,l)}finally{o.__wbindgen_free(_,a,1);}}function $(e,n,t,r,s){let _,a;try{let b=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),d=u,h=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),m=u,w=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),G=u,E=o.range_rects_region_json(b,d,h,m,w,G,r,s);var i=E[0],l=E[1];if(E[3])throw i=0,l=0,f(E[2]);return _=i,a=l,p(i,l)}finally{o.__wbindgen_free(_,a,1);}}function I(e){let n=re(e,o.__wbindgen_malloc),t=u,r=o.register_measure_font(n,t);if(r[2])throw f(r[1]);return r[0]>>>0}function H(e,n){let t=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,s=o.register_substitute_measure_font(e,t,r);if(s[2])throw f(s[1]);return s[0]>>>0}function ee(e,n){let t=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,s=o.update_display_list(e,t,r);if(s[1])throw f(s[0])}function ne(e,n,t,r){let s,_;try{let l=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.vertical_move_by_handle(e,n,l,b,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,f(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function te(e,n,t,r){let s,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),h=u,m=o.vertical_move_json(l,b,n,d,h,r);var a=m[0],i=m[1];if(m[3])throw a=0,i=0,f(m[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function q(){return {__proto__:null,"./docx_layout_bg.js":{__proto__:null,__wbg_error_4eac1b0e2b29f5ef:function(n,t){console.error(p(n,t));},__wbindgen_cast_0000000000000001:function(n,t){return p(n,t)},__wbindgen_init_externref_table:function(){let n=o.__wbindgen_externrefs,t=n.grow(4);n.set(0,void 0),n.set(t+0,void 0),n.set(t+1,null),n.set(t+2,true),n.set(t+3,false);}}}}function p(e,n){return se(e>>>0,n)}var x=null;function v(){return (x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function re(e,n){let t=n(e.length*1,1)>>>0;return v().set(e,t/1),u=e.length,t}function g(e,n,t){if(t===void 0){let i=R.encode(e),l=n(i.length,1)>>>0;return v().subarray(l,l+i.length).set(i),u=i.length,l}let r=e.length,s=n(r,1)>>>0,_=v(),a=0;for(;a<r;a++){let i=e.charCodeAt(a);if(i>127)break;_[s+a]=i;}if(a!==r){a!==0&&(e=e.slice(a)),s=t(s,r,r=a+e.length*3,1)>>>0;let i=v().subarray(s+a,s+r),l=R.encodeInto(e,i);a+=l.written,s=t(s,r,a,1)>>>0;}return u=a,s}function f(e){let n=o.__wbindgen_externrefs.get(e);return o.__externref_table_dealloc(e),n}var j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});j.decode();var oe=2146435072,L=0;function se(e,n){return L+=n,L>=oe&&(j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),j.decode(),L=n),j.decode(v().subarray(e,e+n))}var R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(e,n){let t=R.encode(e);return n.set(t),{read:e.length,written:t.length}});var u=0,o;function F(e,n){return o=e.exports,x=null,o.__wbindgen_start(),o}async function _e(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(s){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else {let r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function S(e){if(o!==void 0)return o;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=q();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return F(t)}async function J(e){if(o!==void 0)return o;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("docx-layout requires an explicit module or URL");let n=q();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await _e(await e,n);return F(t)}var c=c$1({label:"docx-layout",preloadName:"preloadLayoutWasm",assetUrl:()=>new URL("./generated/layout/docx_layout_bg.wasm",import.meta.url),initAsync:J,initSync:S});function fe(e){return c.preload(e)}function ge(e,n,t,r){return c.ensure(),M(e,n,t,r)}function be(e,n,t){return c.ensure(),B(e,n,t)}function y(e){let n=U[e];return typeof n=="function"?n:void 0}function pe(){return c.ensure(),y("open_display_list")!==void 0}function ye(){return c.ensure(),y("range_rects_region_json")!==void 0}function me(e){c.ensure();let n=y("open_display_list");if(!n)throw new Error("open_display_list is not available in the embedded layout wasm yet");return n(e)}function we(e){c.ensure(),y("close_display_list")?.(e);}function he(e,n){c.ensure();let t=y("update_display_list");if(!t)throw new Error("update_display_list is not available in the embedded layout wasm yet");t(e,n);}function xe(){return c.ensure(),y("update_display_list")!==void 0}function ve(e,n,t,r){c.ensure();let s=y("hit_test_regions_by_handle");if(!s)throw new Error("hit_test_regions_by_handle is not available in the embedded layout wasm yet");return s(e,n,t,r)}function Re(e,n,t,r){c.ensure();let s=y("vertical_move_json");if(!s)throw new Error("vertical_move_json is not available in the embedded layout wasm");return s(e,n,t,r)}function Ee(e,n,t,r){c.ensure();let s=y("vertical_move_by_handle");if(!s)throw new Error("vertical_move_by_handle is not available in the embedded layout wasm");return s(e,n,t,r)}function je(e,n,t){c.ensure();let r=y("range_rects_by_handle");if(!r)throw new Error("range_rects_by_handle is not available in the embedded layout wasm yet");return r(e,n,t)}function Le(e,n,t,r,s){c.ensure();let _=y("range_rects_region_json");if(!_)throw new Error("range_rects_region_json is not available in the embedded layout wasm yet");return _(e,n,t,r,s)}function Ae(e,n,t,r,s){c.ensure();let _=y("range_rects_region_by_handle");if(!_)throw new Error("range_rects_region_by_handle is not available in the embedded layout wasm yet");return _(e,n,t,r,s)}function De(e){return c.ensure(),A(e)}function Me(e){return c.ensure(),T(e)}function Te(e){return c.ensure(),I(e)}function We(e,n){return c.ensure(),H(e,n)}function Oe(){c.ensure(),D();}function Be(e){return c.ensure(),W(e)}function le(){let e=O;return typeof e=="function"?e:void 0}function Ie(e,n){c.ensure();let t=le();if(!t)throw new Error("outline_glyph_json is not available in the embedded layout wasm yet");return t(e,n)}export{fe as a,ge as b,be as c,pe as d,ye as e,me as f,we as g,he as h,xe as i,ve as j,Re as k,Ee as l,je as m,Le as n,Ae as o,De as p,Me as q,Te as r,We as s,Oe as t,Be as u,Ie as v};
@@ -1 +0,0 @@
1
- import {b}from'./chunk-TTRUPDAB.mjs';function p(i,t){let e=i?{...i}:{},r=t,n=[["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","csTheme"]],a=new Set;for(let[o,s]of n)a.add(o),a.add(s),(r[o]!==void 0||r[s]!==void 0)&&(delete e[o],delete e[s],r[o]!==void 0&&(e[o]=r[o]),r[s]!==void 0&&(e[s]=r[s]));for(let o of Object.keys(r))!a.has(o)&&r[o]!==void 0&&(e[o]=r[o]);return e}function f(i,t){if(!t&&!i)return;if(!t)return i;if(!i)return {...t};let e={...i};for(let r of Object.keys(t)){let n=t[r];if(n!==void 0){if(r==="fontFamily"&&typeof n=="object"&&n!==null){e.fontFamily=p(i.fontFamily,n);continue}if(r==="color"&&typeof n=="object"&&n!==null){let a=n,o=!!(a.rgb||a.themeColor||a.themeTint||a.themeShade);(!a.auto||o)&&(e.color=a);continue}if(typeof n=="object"&&n!==null&&!Array.isArray(n)){e[r]={...i[r]??{},...n};continue}e[r]=n;}}return e}function g(i,t){if(!t)return i;if(!i)return t?{...t}:void 0;let e={...i};for(let r of Object.keys(t)){let n=t[r];if(n!==void 0)if(r==="runProperties")e.runProperties=f(e.runProperties,t.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let a=e[r],o=n;e[r]={...a||{},...o||{}};}else r==="tabs"&&Array.isArray(n)?e.tabs=[...n]:e[r]=n;}return e}var m={styleId:"Normal",type:"paragraph",name:"Normal",default:true,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},y=class{constructor(t){b(this,"stylesById");b(this,"docDefaults");b(this,"defaultParagraphStyle");b(this,"defaultTableStyle");b(this,"defaultCharacterStyle");if(this.stylesById=new Map,this.docDefaults=t?.docDefaults,t?.styles)for(let e of t.styles)e.styleId&&this.stylesById.set(e.styleId,e);this.defaultParagraphStyle=this.findDefaultStyle("paragraph"),this.defaultTableStyle=this.findDefaultStyle("table"),this.defaultCharacterStyle=this.findDefaultStyle("character");}getStyle(t){return this.stylesById.get(t)}getParagraphStyles(){let t=[];for(let e of this.stylesById.values())e.type==="paragraph"&&!e.hidden&&!e.semiHidden&&t.push(e);return t.sort((e,r)=>{let n=e.uiPriority??99,a=r.uiPriority??99;return n!==a?n-a:(e.name??e.styleId).localeCompare(r.name??r.styleId)})}hasParagraphStyle(t){return this.stylesById.get(t)?.type==="paragraph"}resolveParagraphStyle(t,e){let r={};this.docDefaults?.pPr&&(r.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(r.runFormatting={...this.docDefaults.rPr});let n=(t?this.stylesById.get(t):void 0)??this.defaultParagraphStyle;return n===m&&this.mergeStyleIntoResult(r,n),e&&(r.paragraphFormatting=g(r.paragraphFormatting,e)),n&&n!==m&&this.mergeStyleIntoResult(r,n),r}getNextStyleId(t){if(!t)return null;let e=this.stylesById.get(t)?.next;return e&&e!==t?e:null}getTableStyles(){let t=[];for(let e of this.stylesById.values())e.type==="table"&&!e.hidden&&!e.semiHidden&&t.push(e);return t.sort((e,r)=>{let n=e.uiPriority??99,a=r.uiPriority??99;return n!==a?n-a:(e.name??e.styleId).localeCompare(r.name??r.styleId)})}resolveRunStyle(t){let e={};if(this.docDefaults?.rPr&&(e={...this.docDefaults.rPr}),this.defaultCharacterStyle?.rPr&&(e=this.mergeTextFormatting(e,this.defaultCharacterStyle.rPr)??e),!t)return Object.keys(e).length>0?e:void 0;let r=this.stylesById.get(t);if(!r?.rPr)return Object.keys(e).length>0?e:void 0;let n=this.mergeTextFormatting(e,r.rPr);return n&&Object.keys(n).length>0?n:void 0}getRunStyleOwnProperties(t){if(!t)return;let e=this.stylesById.get(t);if(e?.rPr)return Object.keys(e.rPr).length>0?{...e.rPr}:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}getDefaultTableStyle(){return this.defaultTableStyle}getDefaultCharacterStyle(){return this.defaultCharacterStyle}hasStyle(t){return this.stylesById.has(t)}findDefaultStyle(t){for(let e of this.stylesById.values())if(e.type===t&&e.default)return e;if(t==="paragraph")return this.stylesById.get("Normal")??(this.docDefaults?void 0:m)}mergeStyleIntoResult(t,e){e.pPr&&(t.paragraphFormatting=g(t.paragraphFormatting,e.pPr)),e.rPr&&(t.runFormatting=this.mergeTextFormatting(t.runFormatting,e.rPr));}mergeTextFormatting(t,e){return f(t,e)}};function h(i){return new y(i)}export{f as a,g as b,y as c,h as d};
@@ -1 +0,0 @@
1
- import {c}from'./chunk-LIOWZSE7.mjs';import {b}from'./chunk-TTRUPDAB.mjs';function O(r,e){if(Array.isArray(r))for(let t of r)O(t,e);else if(r&&typeof r=="object"){let t=r;for(let[o,s]of Object.entries(t))o==="src"&&typeof s=="string"?t[o]=e(s)??s:O(s,e);}}function ge(r,e){if(!r.includes('"media:'))return r;let t=JSON.parse(r),o=t.envelope?.document?.package?.document?.comments;return o===void 0?r:(O(o,e),JSON.stringify(t))}function V(r){let e=new Map;for(let t of r.proposals)if(t.state!=="proposed")for(let o of t.revisionIds)e.set(o,t.state);if(e.size!==0)return Object.fromEntries([...e].sort(([t],[o])=>t<o?-1:t>o?1:0))}function $(r){return Array.isArray(r)?r.map($):r===null||typeof r!="object"?r:Object.fromEntries(Object.keys(r).sort().filter(e=>r[e]!==void 0).map(e=>[e,$(r[e])]))}function re(r){let e=r.op==="replaceText"?{op:r.op,search:r.search,replaceWith:r.replaceWith,occurrence:r.occurrence===void 0||r.occurrence===1?"first":r.occurrence}:{op:r.op,at:r.at,text:r.text};return JSON.stringify($({paragraph:r.paragraph,...e}))}function te(r){if(!r||typeof r!="object")throw new TypeError("a proposal must be an object");let e={...r},t=o=>{if(typeof e[o]!="string")throw new TypeError(`proposal ${o} must be a string`)};if(t("id"),!r.paragraph||typeof r.paragraph!="object")throw new TypeError("proposal paragraph must be a paragraph anchor");if(!r.suggest||typeof r.suggest!="object")throw new TypeError("proposal suggest must carry author and date");if(r.op==="replaceText")t("search"),t("replaceWith");else if(r.op==="insertText")t("text");else throw new TypeError(`unknown proposal op ${JSON.stringify(r.op)}`)}function oe(r){let e=[],t=-1;for(let o of r)o.range.start.offset<t||(e.push(o),t=o.range.end.offset);return e}function ne(r,e,t){let o=r.flatMap((s,p)=>s.op==="replaceText"&&s.target.kind==="range"&&!t[p]?[{index:p,range:s.target}]:[]);for(let s of o)for(let p of o)if(e[s.index]!==e[p.index]&&s.range.story===p.range.story&&s.range.start.paraId===p.range.start.paraId&&s.range.end.offset===p.range.start.offset)return s.index<p.index?[s.index,p.index]:[p.index,s.index];return null}function se(r,e,t){let o=(a,n=r.version())=>({ok:false,failure:a,version:n});if(t!==r.version())return o({code:"stale-version",message:"the document changed since the expected version was read"});let s=a=>{let n=(l,c)=>({failure:{code:l,message:c,proposalId:a.id}}),i=r.resolveParagraphAnchor(a.paragraph);switch(i.status){case "found":return i.anchor.kind==="session"?{anchor:i.anchor}:n("unsupported",`proposal ${a.id} targets a paragraph outside the editable stories`);case "missing":return n("missing-target",`proposal ${a.id} targets a paragraph that was not found`);case "ambiguous":return n("ambiguous-target",`proposal ${a.id} targets a paragraph id that ${i.candidates.length} paragraphs carry`);default:return n("unsupported",`proposal ${a.id} targets an anchor this session cannot resolve (${i.reason})`)}},p=(a,n)=>{let i=(w,I)=>({failure:{code:w,message:I,proposalId:a.id}}),{story:l,paraId:c}=n,h={author:a.suggest.author,date:a.suggest.date};if(a.op==="insertText"){if(typeof a.at=="string")return a.at!=="start"&&a.at!=="end"?i("invalid-step",`proposal ${a.id} inserts at an unknown boundary`):{steps:[{op:"insertText",target:{kind:"paragraph",story:l,paraId:c},at:a.at,text:a.text,suggest:h}]};let w=a.at?.offset;if(!Number.isInteger(w)||w<0||w>4294967295)return i("invalid-step",`proposal ${a.id} inserts at an offset that is not a non-negative integer`);let I={paraId:c,offset:w};return {steps:[{op:"insertText",target:{kind:"range",story:l,start:I,end:I,view:"accepted"},at:"start",text:a.text,suggest:h}]}}let x=a.occurrence??"first";if(x!=="first"&&x!=="all"&&!(Number.isSafeInteger(x)&&x>=1))return i("invalid-step",`proposal ${a.id} names occurrence ${String(x)}; use 'first', 'all' or a number from 1`);if(a.search==="")return d(a,n,x);let v=r.findText({text:a.search,within:{kind:"paragraph",story:l,paraId:c},view:"accepted",limit:1e4});if(!v.ok)return {failure:{...v.failure,proposalId:a.id}};let R=oe(v.matches),D=x==="all"?R:R.slice(x==="first"?0:x-1).slice(0,1);return v.truncated?i("limit-exceeded",`proposal ${a.id} matches more than 10000 times`):D.length===0?i("missing-target",R.length===0?`proposal ${a.id}: ${JSON.stringify(a.search)} was not found in its paragraph`:`proposal ${a.id}: occurrence ${x} of ${JSON.stringify(a.search)} was not found; its paragraph has ${R.length}`):{steps:D.map(w=>({op:"replaceText",target:{kind:"range",...w.range},text:a.replaceWith,suggest:h}))}},d=(a,{story:n,paraId:i},l)=>{let c=r.readParagraphs({story:n,paraIds:[i],view:"accepted"});if(!c.ok)return {failure:{...c.failure,proposalId:a.id}};let h=c.paragraphs.length===1&&c.paragraphs[0].text==="";if(!h||typeof l=="number"&&l>1)return {failure:{code:"missing-target",message:h?`proposal ${a.id}: occurrence ${l} of empty text was not found; its paragraph has 1`:`proposal ${a.id} fills a paragraph that is not empty`,proposalId:a.id}};let x={paraId:i,offset:0};return {steps:[{op:"replaceText",target:{kind:"range",story:n,start:x,end:x,view:"accepted"},text:a.replaceWith,suggest:{author:a.suggest.author,date:a.suggest.date}}]}},y=[],f=[],u=[],m=[];for(let[a,n]of e.entries()){let i=s(n);if("failure"in i)return o(i.failure);let l=p(n,i.anchor);if("failure"in l)return o(l.failure);m.push({anchor:i.anchor,first:y.length,count:l.steps.length});for(let c of l.steps)y.push(c),f.push(a),u.push(n.op==="replaceText"&&n.replaceWith===n.search);}let b=ne(y,f,u);if(b){let[a,n]=b.map(i=>e[f[i]].id);return o({code:"overlapping-steps",message:`proposal ${n} adjoins proposal ${a}; adjacent suggestions would share one revision`,proposalId:n})}let g=r.applyEdits({expectVersion:t,history:"none",steps:y});if(!g.ok){let{stepIndex:a,conflictingStepIndex:n,...i}=g.failure,l=a===void 0?void 0:e[f[a]]?.id,c=n===void 0?void 0:e[f[n]]?.id;return o({...i,...c!==void 0&&c!==l?{message:`proposal ${l} overlaps proposal ${c}`}:l!==void 0?{message:`proposal ${l}: ${i.message}`}:{},...l!==void 0?{proposalId:l}:{}},g.version)}return {ok:true,planned:m,receipts:g.receipts,changedStories:g.changedStories}}function ae(r,{owned:e,accept:t,reject:o,proposalIds:s,suggested:p,expectVersion:d}){if(d!==void 0&&d!==r.version())return {ok:false,failure:{code:"stale-version",message:"the document changed since the expected version was read"}};let y=new Set(e),f=r.listRevisions().find(({revisionId:u,kind:m})=>y.has(u)&&m!=="insertion"&&m!=="deletion");if(f){let u=s?.[f.revisionId];return {ok:false,failure:{code:"tracked-revision-conflict",message:u===void 0?`revision ${f.revisionId} also marks a ${f.kind} change made outside the proposals`:`proposal ${u} shares revision ${f.revisionId} with a ${f.kind} change made outside the proposals`,...u===void 0?{}:{proposalId:u}}}}if(r.revisionStamps){let u=r.revisionStamps(e);for(let m of e){let b=p[m];if(b&&u[m]?.some(({author:g,date:a})=>g!==b.author||a!==b.date)){let g=s?.[m];return {ok:false,failure:{code:"tracked-revision-conflict",message:g===void 0?`revision ${m} holds changes made outside the proposals`:`proposal ${g} shares revision ${m} with changes made outside the proposals`,...g===void 0?{}:{proposalId:g}}}}}}return (t.length>0||o.length>0)&&r.settleRevisions(t,o),{ok:true}}function me(r){let e=new Map,t=new Set,o=0,s=null,p=false,d=false,y=()=>({version:s?.version??r.version(),previewVersion:s?.proposals.previewVersion??o,proposals:(s?.proposals.entries??[...e.values()]).map(({record:n})=>({...n,paragraph:{...n.paragraph},revisionIds:[...n.revisionIds]}))}),f=()=>{if(d=true,!p){p=true;try{for(;d;){if(d=!1,t.size===0)return;let n=y();for(let i of [...t]){try{i(n);}catch(l){console.error("[yrs] a proposal listener threw",l);}if(d)break}}}finally{p=false,d=false;}}},u=(n,i=r.version())=>({ok:false,version:i,failure:n}),m=()=>{if(s)throw new Error("proposals are held by the resident worker")},b=n=>{if(m(),!n||typeof n!="object"||!Array.isArray(n.proposals))throw new TypeError("a proposal request needs a proposals array");let i=[],l=new Map;for(let h of n.proposals){if(te(h),h.id==="")return u({code:"invalid-step",message:"a proposal id must not be empty",proposalId:""});let x=re(h),v=e.get(h.id)?.key??l.get(h.id);if(v!==void 0){if(v===x)continue;return u({code:"proposal-id-conflict",message:`proposal id ${h.id} already names a different change`,proposalId:h.id})}l.set(h.id,x),i.push({input:h,key:x});}if(i.length===0)return {ok:true,snapshot:y()};if(n.expectVersion!==r.version())return u({code:"stale-version",message:"the document changed since the expected version was read"});let c=se(r,i.map(({input:h})=>h),n.expectVersion);if(!c.ok)return u(c.failure,c.version);for(let[h,{input:x,key:v}]of i.entries()){let{anchor:R,first:D,count:w}=c.planned[h],I=c.receipts.slice(D,D+w);e.set(x.id,{key:v,suggest:{author:x.suggest.author,date:x.suggest.date},record:{id:x.id,state:"proposed",paragraph:{kind:"session",sessionId:R.sessionId,story:R.story,paraId:R.paraId},revisionIds:[...new Set(I.flatMap(P=>P.revisionIds))],changed:I.some(P=>P.changed)}});}return f(),{ok:true,snapshot:y()}};return {propose(n){let i=()=>b(n);return r.sharedReads?r.sharedReads(i):i()},setStates:n=>{if(m(),!n||typeof n!="object"||!Array.isArray(n.changes))throw new TypeError("a proposal state request needs a changes array");if(n.expectVersion!==r.version())return u({code:"stale-version",message:"the document changed since the expected version was read"});if(n.expectPreviewVersion!==o)return u({code:"stale-preview",message:`the proposals are at preview version ${o}, not ${n.expectPreviewVersion}`});let i=new Map;for(let c of n.changes){if(!c||typeof c.id!="string")throw new TypeError("a state change needs an id");if(c.state!=="proposed"&&c.state!=="accepted"&&c.state!=="rejected")return u({code:"invalid-step",message:`proposal ${c.id} cannot be set to ${JSON.stringify(c.state)}`,proposalId:c.id});if(!e.has(c.id))return u({code:"unknown-proposal",message:`no proposal has id ${c.id}`,proposalId:c.id});let h=i.get(c.id);if(h!==void 0&&h!==c.state)return u({code:"invalid-step",message:`proposal ${c.id} is set to two states`,proposalId:c.id});i.set(c.id,c.state);}let l=false;for(let[c,h]of i){let x=e.get(c);x.record.state!==h&&(x.record={...x.record,state:h},l=true);}return l&&(o+=1,f()),{ok:true,snapshot:y()}},withdraw:n=>{if(m(),!n||typeof n!="object"||!Array.isArray(n.ids))throw new TypeError("a withdrawal request needs an ids array");for(let P of n.ids)if(typeof P!="string")throw new TypeError("a proposal id must be a string");let i=[...new Set(n.ids)].filter(P=>e.has(P));if(i.length===0)return {ok:true,snapshot:y()};if(n.expectVersion!==r.version())return u({code:"stale-version",message:"the document changed since the expected version was read"});let l=new Set(i),c=new Map;for(let[P,{record:k}]of e)if(!l.has(P))for(let T of k.revisionIds)c.set(T,P);let h=new Map;for(let P of i){let{record:k}=e.get(P);for(let T of k.revisionIds){let W=c.get(T);if(W!==void 0)return u({code:"tracked-revision-conflict",message:`proposal ${P} shares revision ${T} with proposal ${W}`,proposalId:P});h.set(T,P);}}let x=V(y())??{},v=[...h.keys()],R=v.filter(P=>x[P]==="accepted"),D=v.filter(P=>x[P]!=="accepted"),w=ae(r,{owned:v,accept:R,reject:D,proposalIds:Object.fromEntries(h),suggested:Object.fromEntries([...h].map(([P,k])=>[P,e.get(k).suggest]))});if(!w.ok)return u(w.failure);let I=false;for(let P of i)I||(I=e.get(P).record.state!=="proposed"),e.delete(P);return I&&(o+=1),f(),{ok:true,snapshot:y()}},snapshot:y,exportState(){return structuredClone(s?.proposals??{previewVersion:o,entries:[...e.values()]})},mirror(n){let i=n===null,l=()=>{let{version:h,...x}=y();return JSON.stringify($(i?{version:h,...x}:x))},c=l();if(n)s=structuredClone(n);else if(s){e.clear();for(let h of s.proposals.entries)e.set(h.record.id,h);o=s.proposals.previewVersion,s=null;}l()!==c&&f();},subscribe(n){if(typeof n!="function")throw new TypeError("proposal listener must be a function");return t.add(n),()=>{t.delete(n);}},reset(){s||e.size===0||([...e.values()].some(({record:n})=>n.state!=="proposed")&&(o+=1),e.clear(),f());},destroy(){s=null,e.clear(),t.clear();}}}function F(r,e){let t=0,o=e.map(s=>{let p={paraId:s.paraId,length:Math.max(0,Math.trunc(s.length)),displayStart:t};return t+=p.length+2,p});return {story:r,paragraphs:o}}function E(r,e){let t=r.paragraphs.find(o=>o.paraId===e.paraId);return !t||e.story!==r.story?r.paragraphs[0]?.displayStart??0:t.displayStart+1+Math.min(Math.max(0,e.offset),t.length)}function be(r,e){if(r.paragraphs.length===0)return null;let t=Math.max(0,Math.trunc(e)),o=r.paragraphs[0];for(let s of r.paragraphs){if(s.displayStart>t)break;o=s;}return {story:r.story,paraId:o.paraId,offset:Math.min(Math.max(0,t-(o.displayStart+1)),o.length)}}function Pe(r,e,t){return E(r,e)-E(r,t)}function we(r,e,t,o){let s=t*o;return {x:r.x*s,y:r.y*s,width:Math.max(1,e.width*t),height:r.height*s}}function Re(r,e){if(!Number.isSafeInteger(r.frameEpoch)||r.frameEpoch!==e.frameEpoch)return null;let t=r.caretRect;return t?!Number.isInteger(t.pageIndex)||t.pageIndex<0||!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.height)||t.height<0||!/^[1-9]\d*$/u.test(t.pageId)?null:e.pages[t.pageIndex]?.pageId.toString()===t.pageId?r:null:r}function J(r){let e=new Map(Object.entries(r).map(([t,o])=>{let s=new Map;for(let p of o.paragraphs)s.has(p.paraId)||s.set(p.paraId,p);return [t,{contentStart:o.contentStart,paragraphs:s}]}));return {positionForLoc:t=>{let o=e.get(t.story),s=o?.paragraphs.get(t.paraId);return !o||!s?null:o.contentStart+s.displayStart+1+Math.min(Math.max(0,t.offset-s.leading),s.length)}}}function K(r,e,t){return r.hasStory(e)?new C(r,e,t):null}function Te(r,e){let t="body";if(typeof r!="number")switch(r.region){case "header":case "footer":if(!r.rId)return null;t=`hf:${r.rId}`;break;case "footnote":case "endnote":if(r.noteId===void 0)return null;t=`${r.region==="footnote"?"fn":"en"}:${r.noteId}`;break}let o=typeof r=="number"?r:r.position,s=e(t);return !s||!Number.isFinite(o)||o<0||o>s.size?null:s.targetAt(o)}var C=class{constructor(e,t,o){b(this,"rootStory",t);b(this,"stories",new Map);b(this,"nodes",new Map);b(this,"tables",[]);b(this,"source");b(this,"paragraphsById",new Map);this.source=o??{segments:s=>e.storySegments(s)},this.buildStory(t,0,0);}get size(){return this.stories.get(this.rootStory)?.size??0}nodeAt(e){return this.nodes.get(e)??null}tableAtPosition(e){let t=null;for(let o of this.tables)e<o.start||e>o.start+o.nodeSize||(!t||o.nodeSize<t.nodeSize)&&(t=o);return t}tableAtStart(e){return this.tables.find(t=>t.start===e)??null}tableStartForLoc(e){return this.stories.get(e.story)?.tables.find(t=>t.tableIndex===e.tableIndex)?.start??null}cellPosition(e,t,o){let s=this.tableAtStart(e);return s?s.cells.find(d=>d.row<=t&&t<d.row+d.rowspan&&d.column<=o&&o<d.column+d.colspan)?.start??null:null}targetAt(e){let t=this.stories.get(this.rootStory)??null;for(let o of this.stories.values())e>=o.contentStart&&e<=o.contentStart+o.size&&(!t||o.depth>t.depth)&&(t=o);return {story:t?.story??this.rootStory,displayPosition:t?this.inputPositionAt(t,e):0,...t?.cell?{cell:t.cell}:{}}}positionForLoc(e){let t=this.stories.get(e.story),o=t?this.paragraphIndex(t).get(e.paraId):void 0;return !t||!o?null:t.contentStart+o.displayStart+1+Math.min(Math.max(0,e.offset-o.leading),o.length)}paragraphIndex(e){let t=this.paragraphsById.get(e);if(!t){t=new Map;for(let o of e.paragraphs)t.has(o.paraId)||t.set(o.paraId,o);this.paragraphsById.set(e,t);}return t}bookmarkPosition(e){for(let t of this.stories.values())for(let o of t.paragraphs){let p=this.nodes.get(t.contentStart+o.displayStart)?.attrs.bookmarks;if(Array.isArray(p)&&p.some(d=>d!=null&&typeof d=="object"&&String(d.name??"")===e))return t.contentStart+o.displayStart}return null}buildStory(e,t,o,s){let p=this.stories.get(e);if(p)return p;let d={story:e,contentStart:t,size:0,depth:o,cell:s,paragraphs:[],tables:[]};this.stories.set(e,d);let y=this.source.segments(e),f=0,u=0,m=0,b=0,g=0,a=0;for(let n of y){if(n.kind==="text"){u+=n.text.length;continue}if(n.kind==="pilcrow"){let l=u+2,c=t+b,h={kind:"paragraph",start:c,nodeSize:l,attrs:{...n.properties,paraId:n.paraId},story:e};this.nodes.set(c,h),d.paragraphs.push({paraId:n.paraId,displayStart:b,inputStart:g,length:u,leading:m}),g+=l+m,f=b+l,b=f,u=0,m=0;continue}if(n.embedKind==="table"){let l=this.buildTable(n,e,a,t+f,o);d.tables.push(l),this.tables.push(l),this.nodes.set(l.start,l),a+=1,f+=l.nodeSize,b=f,m+=1;continue}if(n.embedKind==="blockSdt"){let l=String(n.payload.story??`${e}:sdt0`),c=t+f,h=this.buildStory(l,c+1,o+1,s),x={kind:"blockSdt",start:c,nodeSize:h.size+2,attrs:n.payload,story:e};this.nodes.set(c,x),f+=x.nodeSize,b=f,m+=1;continue}if((n.embedKind==="pageBreak"||n.embedKind==="columnBreak")&&u===0){let l={kind:n.embedKind,start:t+f,nodeSize:1,attrs:n.payload,story:e};this.nodes.set(l.start,l),f+=1,b=f,m+=1;continue}let i=t+b+1+u;this.nodes.set(i,{kind:n.embedKind,start:i,nodeSize:1,attrs:{...n.payload,...n.attributes},story:e}),u+=1;}return d.size=Math.max(f,b+(u>0?u+2:0)),d}inputPositionAt(e,t){let o=Math.max(0,t-e.contentStart),s=e.paragraphs[0];for(let p of e.paragraphs){if(p.displayStart>o)break;s=p;}return s?s.inputStart+s.leading+Math.min(Math.max(0,o-s.displayStart),s.length+1):0}buildTable(e,t,o,s,p){let d=Array.isArray(e.payload.rows)?e.payload.rows:[],y=Array.from({length:d.length},()=>[]),f=[],u=0;return d.forEach((m,b)=>{let g=s+1+u,a=Array.isArray(m.cells)?m.cells:[],n=0,i=0;a.forEach((l,c)=>{for(;y[b]?.[i];)i+=1;let h=ie(l.tcPr),x=q(h.rowspan),v=q(h.colspan),R=String(l.story??`${t}:t${o}:r${b}c${c}`),D=g+1+n,w={story:t,tableIndex:o,row:b,column:i},P=this.buildStory(R,D+1,p+1,w).size+2;f.push({row:b,column:i,rowspan:x,colspan:v,story:R,start:D,contentStart:D+1,nodeSize:P,attrs:h});for(let k=b;k<b+x;k+=1){y[k]??(y[k]=[]);for(let T=i;T<i+v;T+=1)y[k][T]=true;}n+=P,i+=v;}),u+=n+2;}),{kind:"table",start:s,nodeSize:u+2,attrs:e.payload,story:t,tableIndex:o,widthsTwips:Array.isArray(e.payload.grid)?e.payload.grid.filter(m=>typeof m=="number"):[],rowCount:d.length,cells:f}}};function ie(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{}}function q(r){return typeof r=="number"&&Number.isInteger(r)&&r>0?r:1}function B(r,e,t,o="body",s){let p=s?s(t.story):r.hasStory(t.story)?F(t.story,r.paragraphSpans(t.story)):null;if(!p)return null;let d=t.story==="body"||t.story.startsWith("body:")?"body":o;return e(d)?.positionForLoc(t)??(t.story===d?E(p,t):null)}var _=new WeakMap;function L(r,e){let t=_.get(r);return t?.version!==e&&(t={version:e,spans:new Map,segments:new Map,anchors:new Map},_.set(r,t)),t}function A(r,e,t){if(r.has(e))return r.get(e);let o=t();return r.set(e,o),o}function Q(r,e){let t=L(r,e);return t.revisions??(t.revisions=r.listRevisions())}function N(r,e,t){return A(L(r,e).segments,t,()=>r.storySegments(t))}function S(r,e){return {ok:false,failure:{code:r,message:e}}}function z(r){return r==="body"||r.startsWith("body:")}var pe=new Set(["table","blockSdt","pageBreak","columnBreak"]);function Z(r,e){let t=[],o=0,s=0,p=[],d=true,y=0;for(let f of r){if(f.kind==="pilcrow"){t.push({paraId:f.paraId,inlineStart:y,rawLength:o,viewLength:s,spans:p}),y=0,o=0,s=0,p=[],d=true;continue}if(d&&f.kind==="embed"&&pe.has(f.embedKind)){o+=1,y=o;continue}d=false;let u=f.kind==="text"?f.text.length:1;!(f.attributes[e==="accepted"?"del":"ins"]!=null)&&u>0&&(p.push({raw:o,view:s,length:u}),s+=u),o+=u;}return t}function U(r,e){let t=f=>{let u=r.filter(m=>m.paraId===f);return u.length>1?S("ambiguous-target","The paragraph cannot be resolved uniquely"):u[0]??S("missing-target","The paragraph no longer exists")},o=t(e.start.paraId);if("ok"in o)return o;let s=t(e.end.paraId);if("ok"in s)return s;if(!Number.isInteger(e.start.offset)||!Number.isInteger(e.end.offset)||e.start.offset<0||e.end.offset<0||e.start.offset>o.viewLength||e.end.offset>s.viewLength||r.indexOf(o)>r.indexOf(s)||o===s&&e.start.offset>e.end.offset)return S("missing-target","The range is outside the paragraph text");let p=(f,u,m)=>{let b=f.spans.find(g=>m?u>=g.view&&u<g.view+g.length:u>g.view&&u<=g.view+g.length);return b?b.raw+u-b.view:m?f.rawLength:f.inlineStart},d=p(o,e.start.offset,true),y=o===s&&e.start.offset===e.end.offset;return {ok:true,range:{start:{story:e.story,paraId:o.paraId,offset:d},end:{story:e.story,paraId:s.paraId,offset:y?d:p(s,e.end.offset,false)}}}}function ce(r,e){return U(Z(r,e.view),e)}function H(r,e,t){let o=L(r,t),s=A(o.anchors,JSON.stringify(e),()=>r.resolveParagraphAnchor(e));if(s.status==="missing")return S("missing-target","The paragraph no longer exists");if(s.status==="ambiguous")return S("ambiguous-target","The paragraph cannot be resolved uniquely");if(s.status==="unsupported"||s.anchor.kind!=="session"||!z(s.anchor.story))return S("unsupported","The paragraph has no body display position");let{story:p,paraId:d}=s.anchor,y=A(o.spans,p,()=>r.paragraphSpans(p)).filter(f=>f.paraId===d);return y.length>1?S("ambiguous-target","The paragraph cannot be resolved uniquely"):y.length?{ok:true,loc:{story:p,paraId:d,offset:0},length:y[0].length}:S("missing-target","The paragraph no longer exists")}function le(r,e,t,o){let s=t?V(t):void 0;return s?(o??Q(r,e)).filter(({revisionId:p,kind:d})=>d==="deletion"&&s[p]==="accepted"||d==="insertion"&&s[p]==="rejected").map(({story:p,range:d})=>({start:{story:p,...d.start},end:{story:p,...d.end}})):[]}function de(r,e,t,o=null,s){if(e.kind==="range"){if(e.version!==t)return S("stale-version","The document changed after that version");if(!z(e.range.story))return S("unsupported","The range has no body display position");if(!r.hasStory(e.range.story))return S("missing-target","The story no longer exists");let n=ce(N(r,t,e.range.story),e.range);return n.ok?{ok:true,ranges:[n.range],paragraph:{...n.range.start,offset:0}}:n}if(e.kind==="proposal"||e.kind==="revision"){let n=e.kind==="proposal"?o?.proposals.find(c=>c.id===e.id):null;if(e.kind==="proposal"&&!n)return S("unknown-proposal","The proposal is not registered in this document");let i=(s??Q(r,t)).filter(c=>e.kind==="revision"?c.revisionId===e.revisionId:n.revisionIds.includes(c.revisionId));if(e.kind==="revision"&&!i.length)return S("missing-target","The revision no longer exists");let l=i.map(({story:c,range:h})=>({start:{story:c,...h.start},end:{story:c,...h.end}}));if(l.some(c=>!z(c.start.story)))return S("unsupported","The revision has no body display position");if(n){let c=H(r,n.paragraph,t);return c.ok?{ok:true,ranges:l,paragraph:c.loc}:c}return {ok:true,ranges:l,paragraph:{...l[0].start,offset:0}}}let p=H(r,e.paragraph,t);if(!p.ok)return p;if(e.kind==="paragraph")return {ok:true,ranges:[{start:p.loc,end:{...p.loc,offset:p.length}}],paragraph:p.loc};if(!e.text)return S("missing-target","The search text is empty");let d=e.occurrence??"first";if(d!=="first"&&d!=="all"&&(!Number.isInteger(d)||d<1))return S("missing-target","The occurrence must be first, all, or a positive integer");let{story:y,paraId:f}=p.loc,u=r.findText({text:e.text,within:{kind:"paragraph",story:y,paraId:f},view:"accepted",limit:1e4});if(!u.ok){let{code:n,message:i}=u.failure;return S(n==="stale-version"||n==="missing-target"||n==="ambiguous-target"?n:"unsupported",i)}let m=[];for(let{range:n}of [...u.matches].sort((i,l)=>i.range.start.offset-l.range.start.offset))n.start.offset>=(m.at(-1)?.end.offset??0)&&m.push(n);let b=d==="all"?m:m.slice(d==="first"?0:d-1,d==="first"?1:d);if(u.truncated&&(d==="all"||!b.length))return S("unsupported","The search returned too many matches");if(!b.length)return S("missing-target",`The requested search occurrence (${d}) is unavailable`);let g=Z(N(r,t,y),"accepted").filter(n=>n.paraId===f),a=[];for(let n of b){let i=U(g,n);if(!i.ok)return i;a.push(i.range);}return {ok:true,ranges:a,paragraph:p.loc}}var X=new WeakMap;function ee(r){let e=X.get(r);return e===void 0&&(e=JSON.stringify(r.proposals.map(({id:t,revisionIds:o,paragraph:s})=>[t,o,s])),X.set(r,e)),e}function Fe(r,e,t=true){let o=r.version(),s;if(r.proposalRevisions){let g=[...new Set(e.proposals.flatMap(({revisionIds:i})=>i))].sort(),a=JSON.stringify(g),n=L(r,o);n.proposalRevisions?.ids!==a&&(n.proposalRevisions={ids:a,revisions:g.length>0?r.proposalRevisions(g):[]}),s=n.proposalRevisions.revisions;}let p=new Map,d=new Map,y=g=>A(p,g,()=>{if(!r.hasStory(g))return null;let a=r.positionOutline?.(g);return a?J(a):K(r,g,{segments:n=>N(r,o,n)})}),f=g=>A(d,g,()=>r.hasStory(g)?F(g,A(L(r,o).spans,g,()=>r.paragraphSpans(g))):null),u=g=>B(r,y,g,"body",f),m=g=>{let a=u(g.start),n=u(g.end);return a===null||n===null?null:{from:a,to:n}},b=Object.fromEntries(e.proposals.map(({id:g})=>{let a=de(r,{kind:"proposal",id:g},o,e,s);if(!a.ok)return [g,a];let n=[];for(let i of a.ranges){let l=m(i);if(!l)return [g,S("unsupported","The target has no body display position")];n.push(l);}return n.sort((i,l)=>i.from-l.from||i.to-l.to),[g,{ok:true,ranges:n,paragraph:u(a.paragraph)}]}));return {version:o,previewVersion:e.previewVersion,proposals:ee(e),targets:b,navigationTargets:t?Object.fromEntries(e.proposals.map(({id:g,paragraph:a})=>[g,ue(r,a.story,a.paraId)])):void 0,hidden:le(r,o,e,s).map(m).filter(g=>g!==null)}}function Oe(r,e,t,o){if(!r?.navigationTargets||r.version!==e.version||r.previewVersion!==e.previewVersion||r.proposals!==ee(e))return null;let s=e.proposals.find(({paragraph:p})=>p.story===t&&p.paraId===o);return s&&Object.hasOwn(r.navigationTargets,s.id)?r.navigationTargets[s.id]:null}function ue(r,e,t){if(typeof e!="string"||typeof t!="string"||!r.hasStory(e))return "missing-target";let o=r.paragraphIdCount(e,t);if(o===0)return "missing-target";if(o>1)return "ambiguous-target";let s={story:e,paraId:t,offset:0},p=c(r).locToDisplayPoint(s);return !p||p.hfRid?"unsupported":{loc:s,position:p.position}}export{O as a,ge as b,V as c,me as d,F as e,E as f,be as g,Pe as h,we as i,Re as j,J as k,K as l,Te as m,C as n,B as o,S as p,z as q,ce as r,le as s,de as t,ee as u,Fe as v,Oe as w,ue as x};
@@ -1,57 +0,0 @@
1
- import {d as d$1,b,c}from'./chunk-QBMNRD5V.mjs';import {a as a$2,D,v as v$1}from'./chunk-VH7P4734.mjs';import {a as a$3}from'./chunk-EBYC3CX7.mjs';import {a as a$4}from'./chunk-UBUTIWXN.mjs';import {a,b as b$1}from'./chunk-AXFMDV66.mjs';import {a as a$1,d as d$2,e,f as f$1}from'./chunk-GKWXOZZH.mjs';async function U(e,t={}){await a(),await a$1();let n=e instanceof ArrayBuffer?e:await a$2(e),o=t.onProgress??(()=>{});try{o("Extracting DOCX...",0);let r=a$3(n,B(t));return E(t,o),await O(r,t.preloadFonts??!0,o),o("Assembling document...",95),o("Complete",100),r.document}catch(r){let i=r instanceof Error?r.message:String(r);if(i.startsWith("Failed to parse DOCX: "))throw r;let a=k(i),M=a.code==="Container"?i.replace(/^container error: /,""):i,u=new Error(`Failed to parse DOCX: ${M}`,{cause:r});throw Object.assign(u,a),u}}function B(e){return {parseHeadersFooters:e.parseHeadersFooters??true,parseNotes:e.parseNotes??true,detectVariables:false,includeCanonical:false}}function E(e,t){t("Extracted DOCX",10),t("Parsing relationships...",10),t("Parsed relationships",15),t("Parsing theme...",15),t("Parsed theme",20),t("Parsing styles...",20),t("Parsed styles",30),t("Parsing numbering...",30),t("Parsed numbering",35),t("Processing media files...",35),t("Processed media",40),t("Parsing document body...",40),t("Parsed document body",55),e.parseHeadersFooters??true?(t("Parsing headers/footers...",55),t("Parsed headers/footers",65)):t("Skipping headers/footers",65),e.parseNotes??true?(t("Parsing footnotes/endnotes...",65),t("Parsed footnotes/endnotes",75)):t("Skipping footnotes/endnotes",75),t("Parsing comments...",75),t("Parsed comments",80);}async function O(e,t,n){if(!t){n("Skipping font loading",95);return}n("Loading fonts...",80),await R(e.document.package.theme??null,e.document.package.styles,e.document.package.document),await D(e.document.package.fontTable,e.embeddedFonts,e.fontTableRelationshipsXml),n("Loaded fonts",95);}async function R(e,t,n){let o=new Set;e?.fontScheme?.majorFont?.latin&&o.add(e.fontScheme.majorFont.latin),e?.fontScheme?.minorFont?.latin&&o.add(e.fontScheme.minorFont.latin),t?.docDefaults?.rPr?.fontFamily?.ascii&&o.add(t.docDefaults.rPr.fontFamily.ascii);for(let r of t?.styles??[])r.rPr?.fontFamily?.ascii&&o.add(r.rPr.fontFamily.ascii),r.rPr?.fontFamily?.hAnsi&&o.add(r.rPr.fontFamily.hAnsi);for(let r of n.content)if(r.type==="paragraph")for(let i of r.content)i.type==="run"&&(i.formatting?.fontFamily?.ascii&&o.add(i.formatting.fontFamily.ascii),i.formatting?.fontFamily?.hAnsi&&o.add(i.formatting.fontFamily.hAnsi));if(o.size!==0)try{await v$1([...o]);}catch(r){console.warn("Failed to load some fonts:",r);}}function k(e){let t=/(?:unsafe XML|resource limit .* exceeded|malformed XML|invalid relationship) in ([^:]+)(?::| at)/.exec(e)?.[1],n=/ at byte (\d+):/.exec(e)?.[1];return {code:e.startsWith("unsafe XML")?"UnsafeXml":e.startsWith("resource limit")?"ResourceLimit":e.startsWith("malformed XML")?"MalformedXml":e.startsWith("invalid relationship")?"Relationship":e.startsWith("container error")?"Container":e.startsWith("wire.")?"Wire":"Parse",...t?{part:t}:{},...n?{offset:Number(n)}:{}}}var v={seed:"0".repeat(64),now:"2000-01-01T00:00:00.000Z"};function f(e$1,t){let n=JSON.stringify({...t,determinism:v}),o=e$1==="S10"?d$2(n):e$1==="S11"?e(n):f$1(n),r=JSON.parse(o);if(!r||typeof r!="object")throw new TypeError(`${e$1} Rust serializer returned a non-object response`);let i=r;if(i.wireVersion!==1||i.family!==t.family||typeof i.xml!="string")throw new TypeError(`invalid ${e$1} Rust serializer response for ${String(t.family)}`);return i.xml}function J(e){return f("S12",{family:"document",body:e.package.document})}function Z(e){let t=f("S12",{family:"document",body:e}),n="<w:body>",o="</w:body>",r=t.indexOf(n),i=t.lastIndexOf(o);if(r<0||i<r)throw new Error("Rust document serializer omitted w:body");return t.slice(r+n.length,i)}function q(e){return f("S10",{family:"section",properties:e})}async function F(){let e=new Map;e.set("[Content_Types].xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
- <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
3
- <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
4
- <Default Extension="xml" ContentType="application/xml"/>
5
- <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
6
- <Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
7
- <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
8
- <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
9
- </Types>`)),e.set("_rels/.rels",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
10
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
11
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
12
- <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
13
- <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
14
- </Relationships>`)),e.set("word/_rels/document.xml.rels",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
15
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
16
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
17
- </Relationships>`)),e.set("word/document.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
18
- <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
19
- <w:body>
20
- <w:p>
21
- <w:r>
22
- <w:t></w:t>
23
- </w:r>
24
- </w:p>
25
- <w:sectPr>
26
- <w:pgSz w:w="12240" w:h="15840"/>
27
- <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
28
- </w:sectPr>
29
- </w:body>
30
- </w:document>`)),e.set("word/styles.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
31
- <w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
32
- <w:docDefaults>
33
- <w:rPrDefault>
34
- <w:rPr>
35
- <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
36
- <w:sz w:val="22"/>
37
- </w:rPr>
38
- </w:rPrDefault>
39
- <w:pPrDefault>
40
- <w:pPr>
41
- <w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
42
- </w:pPr>
43
- </w:pPrDefault>
44
- </w:docDefaults>
45
- <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
46
- <w:name w:val="Normal"/>
47
- </w:style>
48
- </w:styles>`));let t=new Date().toISOString();return e.set("docProps/core.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
49
- <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
50
- <dc:creator>OpenOOXML DOCX Editor</dc:creator>
51
- <dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>
52
- <dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>
53
- </cp:coreProperties>`)),e.set("docProps/app.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
54
- <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
55
- <Application>OpenOOXML DOCX Editor</Application>
56
- <AppVersion>1.0.0</AppVersion>
57
- </Properties>`)),c(e)}async function A(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");return (await d$1(e,e.originalBuffer,t)).buffer}function I(e){return new Map(Object.entries(b$1(new Uint8Array(e))))}async function pe(e,t,n={}){return N(I(e),t,n)}async function N(e,t,n={}){for(let[o,r]of t)e.set(o,b(r));return c(e)}async function me(e){let t=await F();return A({...e,originalBuffer:t})}async function ge(e,t,n){if(!z(e,t,n))return null;try{return (await d$1(e,t,{updateModifiedDate:!0},{changedParaIds:n.changedParaIds})).buffer}catch{return null}}function z(e,t,n){return n.structuralChange||n.hasUntrackedChanges||!t?false:!d(e.package.document.content)}function d(e){let t=o=>o.content.some(r=>r.type==="drawing"&&r.image?.src?.startsWith("data:")&&!r.image.rId),n=(o,r=false)=>{let i=false;return a$4(o,a=>{i||(i=a.type==="run"&&t(a)||a.type==="hyperlink"&&!!(a.href&&!a.rId&&!a.anchor));},false,r),i};for(let o of e)if(o.type==="paragraph")for(let r of o.content){if(r.type==="run"&&t(r)||r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor)return true;if(r.type==="insertion"||r.type==="deletion"||r.type==="moveFrom"||r.type==="moveTo"){for(let i of r.content)if(i.type==="run"){if(t(i))return true}else if(n(i,true))return true}else if(r.type!=="run"&&n(r))return true}else if(o.type==="table"){for(let r of o.rows)for(let i of r.cells)if(d(i.content))return true}else if(o.type==="blockSdt"&&d(o.content))return true;return false}export{U as a,J as b,Z as c,q as d,A as e,pe as f,me as g,ge as h};
@@ -1 +0,0 @@
1
- import {c}from'./chunk-HGKSOBXK.mjs';function O(e){let t=i.rezip_docx(e);if(t[3])throw y(t[2]);var n=p(t[0],t[1]).slice();return i.__wbindgen_free(t[0],t[1]*1,1),n}function R(e){let t=S(e,i.__wbindgen_malloc),n=b,r=i.unzip_docx(t,n);if(r[2])throw y(r[1]);return y(r[0])}function U(){return {__proto__:null,"./ooxml_opc_bg.js":{__proto__:null,__wbg___wbindgen_string_get_b0ca35b86a603356:function(t,n){let r=n,o=typeof r=="string"?r:void 0;var d=z(o)?0:D(o,i.__wbindgen_malloc,i.__wbindgen_realloc),s=b;A().setInt32(t+4,s,true),A().setInt32(t+0,d,true);},__wbg___wbindgen_throw_344f42d3211c4765:function(t,n){throw new Error(h(t,n))},__wbg_get_78f252d074a84d0b:function(){return W(function(t,n){return Reflect.get(t,n)},arguments)},__wbg_get_unchecked_6e0ad6d2a41b06f6:function(t,n){return t[n>>>0]},__wbg_instanceof_Object_33f20e6f12439f3e:function(t){let n;try{n=t instanceof Object;}catch{n=false;}return n},__wbg_keys_58421f8f96795607:function(t){return Object.keys(t)},__wbg_length_1f0964f4a5e2c6d8:function(t){return t.length},__wbg_length_370319915dc99107:function(t){return t.length},__wbg_new_cd45aabdf6073e84:function(t){return new Uint8Array(t)},__wbg_new_da52cf8fe3429cb2:function(){return new Object},__wbg_new_from_slice_77cdfb7977362f3c:function(t,n){return new Uint8Array(p(t,n))},__wbg_prototypesetcall_4770620bbe4688a0:function(t,n,r){Uint8Array.prototype.set.call(p(t,n),r);},__wbg_set_8535240470bf2500:function(){return W(function(t,n,r){return Reflect.set(t,n,r)},arguments)},__wbindgen_cast_0000000000000001:function(t,n){return h(t,n)},__wbindgen_init_externref_table:function(){let t=i.__wbindgen_externrefs,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,true),t.set(n+3,false);}}}}function j(e){let t=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(t,e),t}function p(e,t){return e=e>>>0,f().subarray(e/1,e/1+t)}var a=null;function A(){return (a===null||a.buffer.detached===true||a.buffer.detached===void 0&&a.buffer!==i.memory.buffer)&&(a=new DataView(i.memory.buffer)),a}function h(e,t){return L(e>>>0,t)}var _=null;function f(){return (_===null||_.byteLength===0)&&(_=new Uint8Array(i.memory.buffer)),_}function W(e,t){try{return e.apply(this,t)}catch(n){let r=j(n);i.__wbindgen_exn_store(r);}}function z(e){return e==null}function S(e,t){let n=t(e.length*1,1)>>>0;return f().set(e,n/1),b=e.length,n}function D(e,t,n){if(n===void 0){let c=l.encode(e),u=t(c.length,1)>>>0;return f().subarray(u,u+c.length).set(c),b=c.length,u}let r=e.length,o=t(r,1)>>>0,d=f(),s=0;for(;s<r;s++){let c=e.charCodeAt(s);if(c>127)break;d[o+s]=c;}if(s!==r){s!==0&&(e=e.slice(s)),o=n(o,r,r=s+e.length*3,1)>>>0;let c=f().subarray(o+s,o+r),u=l.encodeInto(e,c);s+=u.written,o=n(o,r,s,1)>>>0;}return b=s,o}function y(e){let t=i.__wbindgen_externrefs.get(e);return i.__externref_table_dealloc(e),t}var w=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});w.decode();var k=2146435072,g=0;function L(e,t){return g+=t,g>=k&&(w=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),w.decode(),g=t),w.decode(f().subarray(e,e+t))}var l=new TextEncoder;"encodeInto"in l||(l.encodeInto=function(e,t){let n=l.encode(e);return t.set(n),{read:e.length,written:n.length}});var b=0,i;function T(e,t){return i=e.exports,a=null,_=null,i.__wbindgen_start(),i}async function B(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(e.ok&&n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else {let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function M(e){if(i!==void 0)return i;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=U();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return T(n)}async function v(e){if(i!==void 0)return i;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("ooxml-opc requires an explicit module or URL");let t=U();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await B(await e,t);return T(n)}var m=c({label:"ooxml-opc",preloadName:"preloadOpcWasm",assetUrl:()=>new URL("./generated/opc/ooxml_opc_bg.wasm",import.meta.url),initAsync:v,initSync:M});function X(e){return m.preload(e)}function Y(e){return m.ensure(),R(e)}function G(e){return m.ensure(),O(e)}export{X as a,Y as b,G as c};
@@ -1 +0,0 @@
1
- import {b as b$1,c as c$1,h as h$1}from'./chunk-GKWXOZZH.mjs';function B(n){return n.length>=4&&(n[0]===73&&n[1]===73&&n[2]===42&&n[3]===0||n[0]===77&&n[1]===77&&n[2]===0&&n[3]===42)}function R(n,e,t,r){if(!B(n)||n.byteLength>33554432)return {bytes:n,mimeType:e,dataUrl:t};try{let o=r(n);return {bytes:o,mimeType:"image/png",dataUrl:`data:image/png;base64,${N(o)}`}}catch{return {bytes:n,mimeType:e,dataUrl:t}}}function N(n){let e="";for(let t=0;t<n.length;t+=32768)e+=String.fromCharCode(...n.subarray(t,t+32768));return btoa(e)}var U=new Set(["__proto__","constructor","prototype"]);function Z(n,e){return O(b$1(new Uint8Array(n),JSON.stringify(e)),n)}function O(n,e){return C(JSON.parse(n),e)}function C(n,e){h(n,"wire");let t=c(n,"wire");if(p(t,["wireVersion","document","embeddedFontParts","fontTableRelationshipsXml","canonicalBase64","canonicalSha256"],"wire",["fontTableRelationshipsXml","canonicalBase64","canonicalSha256"]),t.wireVersion!==1)throw new TypeError("wire.wireVersion must be 1");let r=X(t.document,e),o=I(t.embeddedFontParts);if((t.canonicalBase64!==void 0||t.canonicalSha256!==void 0)&&(t.canonicalBase64===void 0||t.canonicalSha256===void 0))throw new TypeError("wire canonical fields must be present together");let i=t.canonicalSha256===void 0?void 0:d(t.canonicalSha256,"wire.canonicalSha256");if(i!==void 0&&!/^[0-9a-f]{64}$/.test(i))throw new TypeError("wire.canonicalSha256 is invalid");return {wireVersion:1,document:r,embeddedFonts:o,...t.fontTableRelationshipsXml===void 0?{}:{fontTableRelationshipsXml:d(t.fontTableRelationshipsXml,"wire.fontTableRelationshipsXml")},...t.canonicalBase64===void 0?{}:{rustCanonicalBytes:b(d(t.canonicalBase64,"wire.canonicalBase64")),rustCanonicalSha256:i}}}function X(n,e){let t=c(n,"wire.document");p(t,["package","templateVariables","warnings"],"wire.document",["templateVariables","warnings"]);let o={package:_(t.package),originalBuffer:e};return t.warnings!==void 0&&(o.warnings=J(t.warnings,"wire.document.warnings")),o}function _(n){let e=c(n,"wire.document.package");p(e,["document","styles","theme","numbering","settings","fontTable","headerEntries","footerEntries","footnotes","endnotes","footnoteSeparators","endnoteSeparators","relationshipEntries","mediaEntries","chartEntries"],"wire.document.package",["styles","headerEntries","footerEntries","footnotes","endnotes","footnoteSeparators","endnoteSeparators"]);let o={document:V(e.document),theme:c(e.theme,"wire.document.package.theme"),numbering:c(e.numbering,"wire.document.package.numbering"),settings:c(e.settings,"wire.document.package.settings"),fontTable:c(e.fontTable,"wire.document.package.fontTable"),relationships:x(e.relationshipEntries,"wire.document.package.relationshipEntries"),media:j(e.mediaEntries),charts:g(e.chartEntries,"wire.document.package.chartEntries",(a,i)=>c(a,i))};e.styles!==void 0&&(o.styles=c(e.styles,"wire.document.package.styles"));for(let[a,i]of [["headerEntries","headers"],["footerEntries","footers"]]){let s=e[a];s!==void 0&&(o[i]=g(s,`wire.document.package.${a}`,(f,u)=>c(f,u)));}return e.footnotes!==void 0&&(o.footnotes=m(e.footnotes,"wire.document.package.footnotes")),e.endnotes!==void 0&&(o.endnotes=m(e.endnotes,"wire.document.package.endnotes")),e.footnoteSeparators!==void 0&&(o.footnoteSeparators=m(e.footnoteSeparators,"wire.document.package.footnoteSeparators")),e.endnoteSeparators!==void 0&&(o.endnoteSeparators=m(e.endnoteSeparators,"wire.document.package.endnoteSeparators")),o}function V(n){let e="wire.document.package.document",t=c(n,e);if(p(t,["content","sections","finalSectionProperties","customRootBindings","comments"],e,["sections","finalSectionProperties","customRootBindings","comments"]),!Array.isArray(t.content))throw new TypeError(`${e}.content must be an array`);t.content.forEach((o,a)=>c(o,`${e}.content[${a}]`));let r={content:t.content};if(t.sections!==void 0){if(!Array.isArray(t.sections))throw new TypeError(`${e}.sections must be an array`);r.sections=t.sections.map((o,a)=>{let i=`${e}.sections[${a}]`,s=c(o,i);p(s,["id","properties","contentStart","contentEnd"],i,["id"]);let f=P(s.contentStart,`${i}.contentStart`),u=P(s.contentEnd,`${i}.contentEnd`);if(f>u||u>r.content.length)throw new TypeError(`${i} has an invalid content range`);return {...s.id===void 0?{}:{id:d(s.id,`${i}.id`)},properties:c(s.properties,`${i}.properties`),content:r.content.slice(f,u)}});}return t.finalSectionProperties!==void 0&&(r.finalSectionProperties=c(t.finalSectionProperties,`${e}.finalSectionProperties`)),t.customRootBindings!==void 0&&(r.customRootBindings=m(t.customRootBindings,`${e}.customRootBindings`)),t.comments!==void 0&&(r.comments=m(t.comments,`${e}.comments`)),r}function x(n,e){return g(n,e,(t,r,o)=>W(t,r,o))}function j(n){let e="wire.document.package.mediaEntries";if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let t=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let a=`${e}[${o}]`,i=n[o];if(!Array.isArray(i)||i.length!==2)throw new TypeError(`${a} must be a key/value pair`);let s=d(i[0],`${a}[0]`);if(t.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);let f=`${a}[1]`,u=c(i[1],f);p(u,["path","filename","mimeType","base64","dataUrl"],f,["filename"]);let l=d(u.path,`${f}.path`),y=r.get(l);if(!y){let D=b(d(u.base64,`${f}.base64`)),w=R(D,d(u.mimeType,`${f}.mimeType`),d(u.dataUrl,`${f}.dataUrl`),h$1),k={path:l,...u.filename===void 0?{}:{filename:d(u.filename,`${f}.filename`)},mimeType:w.mimeType,data:M(w.bytes),dataUrl:w.dataUrl};y=k,r.set(l,k);}t.set(s,y);}return t}function I(n){let e="wire.embeddedFontParts";if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let t=new Map;return n.forEach((r,o)=>{let a=`${e}[${o}]`,i=c(r,a);p(i,["path","base64"],a);let s=d(i.path,`${a}.path`);if(t.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);t.set(s,M(b(d(i.base64,`${a}.base64`))));}),t}function g(n,e,t){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let r=new Map;return n.forEach((o,a)=>{let i=`${e}[${a}]`;if(!Array.isArray(o)||o.length!==2)throw new TypeError(`${i} must be a key/value pair`);let s=d(o[0],`${i}[0]`);if(r.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);r.set(s,t(o[1],`${i}[1]`,s));}),r}function J(n,e){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);return n.map((t,r)=>d(t,`${e}[${r}]`))}function m(n,e){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);return n.forEach((t,r)=>c(t,`${e}[${r}]`)),n}function M(n){return Uint8Array.from(n).buffer}function P(n,e){let t=H(n,e);if(!Number.isSafeInteger(t)||t<0)throw new TypeError(`${e} must be a non-negative safe integer`);return t}function v(n,e="word/_rels/document.xml.rels"){let t=JSON.parse(c$1(new TextEncoder().encode(n),e));h(t,"relationshipPart");let r=c(t,"relationshipPart");return p(r,["path","relationships","canonicalBase64","canonicalSha256"],"relationshipPart"),d(r.path,"relationshipPart.path"),x(r.relationships,"relationshipPart.relationships")}function W(n,e,t){let r=c(n,e);p(r,["id","type","target","targetMode"],e,["targetMode"]);let o=d(r.id,`${e}.id`);if(o!==t)throw new TypeError(`${e}.id does not match its map key`);let a={id:o,type:d(r.type,`${e}.type`),target:d(r.target,`${e}.target`)};if(r.targetMode!==void 0){if(r.targetMode!=="External"&&r.targetMode!=="Internal")throw new TypeError(`${e}.targetMode is invalid`);a.targetMode=r.targetMode;}return a}function h(n,e,t=new WeakSet){if(!(n===null||typeof n!="object")){if(t.has(n))throw new TypeError(`${e} contains a cycle`);t.add(n);try{for(let r of Object.keys(n)){if(U.has(r))throw new TypeError(`${e} contains forbidden key ${r}`);h(n[r],`${e}.${r}`,t);}}finally{t.delete(n);}}}function c(n,e){if(n===null||typeof n!="object"||Array.isArray(n))throw new TypeError(`${e} must be an object`);return n}function p(n,e,t,r=[]){let o=new Set(e);for(let i of Object.keys(n))if(!o.has(i))throw new TypeError(`${t} contains unknown key ${i}`);let a=new Set(r);for(let i of e)if(!a.has(i)&&!Object.prototype.hasOwnProperty.call(n,i))throw new TypeError(`${t} is missing ${i}`)}function d(n,e){if(typeof n!="string")throw new TypeError(`${e} must be a string`);return n}function H(n,e){if(typeof n!="number"||!Number.isFinite(n))throw new TypeError(`${e} must be a finite number`);return n}function b(n){let e;try{e=atob(n);}catch{throw new TypeError("wire canonicalBase64 is invalid")}let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t}export{Z as a,O as b,C as c,v as d};