@arbidocs/blocks 0.5.107 → 0.5.108
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.
- package/dist/{ConnectedCallDock-TDYRHPAK.js → ConnectedCallDock-DV4FU376.js} +8 -8
- package/dist/{ConnectedCallDock-TDYRHPAK.js.map → ConnectedCallDock-DV4FU376.js.map} +1 -1
- package/dist/{ConnectedCallDock-H3WWFGXF.cjs → ConnectedCallDock-EM2VVGZK.cjs} +10 -10
- package/dist/{ConnectedCallDock-H3WWFGXF.cjs.map → ConnectedCallDock-EM2VVGZK.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-55O5OUN7.cjs → ConnectedCallRoom-7WEPEWUJ.cjs} +9 -9
- package/dist/{ConnectedCallRoom-55O5OUN7.cjs.map → ConnectedCallRoom-7WEPEWUJ.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-Z6F6WCLH.js → ConnectedCallRoom-RYTZP34O.js} +8 -8
- package/dist/{ConnectedCallRoom-Z6F6WCLH.js.map → ConnectedCallRoom-RYTZP34O.js.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-NVZRVNOS.js → ConnectedNativeDocxComparison-2NDXXZLQ.js} +15 -15
- package/dist/{ConnectedNativeDocxComparison-NVZRVNOS.js.map → ConnectedNativeDocxComparison-2NDXXZLQ.js.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-DGBZJ4XA.cjs → ConnectedNativeDocxComparison-7HOY3AVI.cjs} +16 -16
- package/dist/{ConnectedNativeDocxComparison-DGBZJ4XA.cjs.map → ConnectedNativeDocxComparison-7HOY3AVI.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-R4WINUUB.cjs → ConnectedNativeDocxEditor-CUWDPHXN.cjs} +16 -16
- package/dist/{ConnectedNativeDocxEditor-R4WINUUB.cjs.map → ConnectedNativeDocxEditor-CUWDPHXN.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-RSVBN7DY.js → ConnectedNativeDocxEditor-SPZB6Y27.js} +14 -14
- package/dist/{ConnectedNativeDocxEditor-RSVBN7DY.js.map → ConnectedNativeDocxEditor-SPZB6Y27.js.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-2DFBXE2X.js → ConnectedProductionSetDialog-N3EDG3SU.js} +4 -4
- package/dist/{ConnectedProductionSetDialog-2DFBXE2X.js.map → ConnectedProductionSetDialog-N3EDG3SU.js.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-KYDPQ7SG.cjs → ConnectedProductionSetDialog-XAEFEN3N.cjs} +4 -4
- package/dist/{ConnectedProductionSetDialog-KYDPQ7SG.cjs.map → ConnectedProductionSetDialog-XAEFEN3N.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-HLJ5IIOU.js → ConnectedStreamedWordArtifact-6LTGEAJO.js} +15 -15
- package/dist/ConnectedStreamedWordArtifact-6LTGEAJO.js.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-JQ34AOUU.cjs → ConnectedStreamedWordArtifact-HNCRKZTV.cjs} +16 -16
- package/dist/ConnectedStreamedWordArtifact-HNCRKZTV.cjs.map +1 -0
- package/dist/{DocumentReviewCard-7JSXRJZ2.js → DocumentReviewCard-RJD3CO32.js} +8 -8
- package/dist/{DocumentReviewCard-7JSXRJZ2.js.map → DocumentReviewCard-RJD3CO32.js.map} +1 -1
- package/dist/{DocumentReviewCard-C4HVT3WM.cjs → DocumentReviewCard-VON7LOOY.cjs} +8 -8
- package/dist/{DocumentReviewCard-C4HVT3WM.cjs.map → DocumentReviewCard-VON7LOOY.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-IMQTZWKD.js → FilesViewerDialog-7SJGY72Q.js} +21 -21
- package/dist/{FilesViewerDialog-IMQTZWKD.js.map → FilesViewerDialog-7SJGY72Q.js.map} +1 -1
- package/dist/{FilesViewerDialog-UP7GFHYN.cjs → FilesViewerDialog-VIPTC6OT.cjs} +27 -27
- package/dist/{FilesViewerDialog-UP7GFHYN.cjs.map → FilesViewerDialog-VIPTC6OT.cjs.map} +1 -1
- package/dist/{RechartsRenderer-GIRCW7DB.cjs → RechartsRenderer-THES2SE5.cjs} +6 -5
- package/dist/RechartsRenderer-THES2SE5.cjs.map +1 -0
- package/dist/{RechartsRenderer-23OF4H6X.js → RechartsRenderer-XIZLV6GH.js} +6 -5
- package/dist/RechartsRenderer-XIZLV6GH.js.map +1 -0
- package/dist/{WorkspaceTableView-PJM47B5F.cjs → WorkspaceTableView-FNME7TL6.cjs} +9 -9
- package/dist/{WorkspaceTableView-PJM47B5F.cjs.map → WorkspaceTableView-FNME7TL6.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-YDA7A4UJ.js → WorkspaceTableView-XQ6J2JKI.js} +7 -7
- package/dist/{WorkspaceTableView-YDA7A4UJ.js.map → WorkspaceTableView-XQ6J2JKI.js.map} +1 -1
- package/dist/agents/index.cjs +202 -202
- package/dist/agents/index.js +8 -8
- package/dist/{ai-ADS6YSS2.cjs → ai-3SAMEYBB.cjs} +20 -20
- package/dist/ai-3SAMEYBB.cjs.map +1 -0
- package/dist/{ai-KHWTGBT5.js → ai-OTQWSYVK.js} +12 -12
- package/dist/ai-OTQWSYVK.js.map +1 -0
- package/dist/calls/index.cjs +57 -57
- package/dist/calls/index.js +9 -9
- package/dist/chat/index.cjs +3 -3
- package/dist/chat/index.js +3 -3
- package/dist/{chunk-O27K7KTZ.cjs → chunk-2TBQBF4Y.cjs} +5 -5
- package/dist/{chunk-O27K7KTZ.cjs.map → chunk-2TBQBF4Y.cjs.map} +1 -1
- package/dist/{chunk-YJWAGXYM.js → chunk-4ZA2RSQH.js} +3 -3
- package/dist/{chunk-YJWAGXYM.js.map → chunk-4ZA2RSQH.js.map} +1 -1
- package/dist/{chunk-6A4GNM4T.cjs → chunk-5D2ZINOJ.cjs} +16 -16
- package/dist/{chunk-6A4GNM4T.cjs.map → chunk-5D2ZINOJ.cjs.map} +1 -1
- package/dist/{chunk-BFVCYBND.cjs → chunk-5HXQOM3I.cjs} +5 -5
- package/dist/{chunk-BFVCYBND.cjs.map → chunk-5HXQOM3I.cjs.map} +1 -1
- package/dist/{chunk-GSD5U553.cjs → chunk-5KKT65WU.cjs} +3 -3
- package/dist/{chunk-GSD5U553.cjs.map → chunk-5KKT65WU.cjs.map} +1 -1
- package/dist/{chunk-AVGHTUPE.js → chunk-5PWLXLHY.js} +5 -5
- package/dist/chunk-5PWLXLHY.js.map +1 -0
- package/dist/{chunk-BBWLFK3C.js → chunk-5XIMUQ63.js} +3 -3
- package/dist/{chunk-BBWLFK3C.js.map → chunk-5XIMUQ63.js.map} +1 -1
- package/dist/{chunk-AHMRYY7J.cjs → chunk-6DAJXQZZ.cjs} +13 -13
- package/dist/{chunk-AHMRYY7J.cjs.map → chunk-6DAJXQZZ.cjs.map} +1 -1
- package/dist/{chunk-3PV25ICC.js → chunk-6KKVJ2V6.js} +3 -3
- package/dist/{chunk-3PV25ICC.js.map → chunk-6KKVJ2V6.js.map} +1 -1
- package/dist/{chunk-OLAYDOPC.js → chunk-6LUHNFEE.js} +6 -6
- package/dist/{chunk-OLAYDOPC.js.map → chunk-6LUHNFEE.js.map} +1 -1
- package/dist/{chunk-FSXQHEFQ.cjs → chunk-7CDV7Y4U.cjs} +25 -25
- package/dist/{chunk-FSXQHEFQ.cjs.map → chunk-7CDV7Y4U.cjs.map} +1 -1
- package/dist/{chunk-OAIOOVFN.cjs → chunk-7SJXYEZI.cjs} +36 -36
- package/dist/chunk-7SJXYEZI.cjs.map +1 -0
- package/dist/{chunk-LFYKB7KF.cjs → chunk-7V6APLF7.cjs} +19 -19
- package/dist/{chunk-LFYKB7KF.cjs.map → chunk-7V6APLF7.cjs.map} +1 -1
- package/dist/{chunk-4WMGFGYP.cjs → chunk-AJZ66VJC.cjs} +4 -4
- package/dist/{chunk-4WMGFGYP.cjs.map → chunk-AJZ66VJC.cjs.map} +1 -1
- package/dist/{chunk-KCP42W67.cjs → chunk-ARGQ5YZ5.cjs} +3 -3
- package/dist/{chunk-KCP42W67.cjs.map → chunk-ARGQ5YZ5.cjs.map} +1 -1
- package/dist/{chunk-BH6IKGZ3.js → chunk-AUAHGQY6.js} +5 -5
- package/dist/{chunk-BH6IKGZ3.js.map → chunk-AUAHGQY6.js.map} +1 -1
- package/dist/{chunk-KIXFXCHL.js → chunk-CEOCA7ID.js} +3 -3
- package/dist/{chunk-KIXFXCHL.js.map → chunk-CEOCA7ID.js.map} +1 -1
- package/dist/{chunk-TNKPQ3EF.js → chunk-CIRSOYGK.js} +12 -12
- package/dist/{chunk-TNKPQ3EF.js.map → chunk-CIRSOYGK.js.map} +1 -1
- package/dist/{chunk-BAUZUIHB.js → chunk-COL2TJGO.js} +83 -83
- package/dist/chunk-COL2TJGO.js.map +1 -0
- package/dist/{chunk-XHN5KOI2.cjs → chunk-DRLD4P2C.cjs} +8 -8
- package/dist/{chunk-XHN5KOI2.cjs.map → chunk-DRLD4P2C.cjs.map} +1 -1
- package/dist/{chunk-5AC52BHL.cjs → chunk-DYPFNQTQ.cjs} +140 -140
- package/dist/chunk-DYPFNQTQ.cjs.map +1 -0
- package/dist/{chunk-SCLGUHLU.cjs → chunk-E7TGSOPR.cjs} +4 -4
- package/dist/{chunk-SCLGUHLU.cjs.map → chunk-E7TGSOPR.cjs.map} +1 -1
- package/dist/{chunk-CRLFLMTK.cjs → chunk-EOXA4VJH.cjs} +3 -3
- package/dist/{chunk-CRLFLMTK.cjs.map → chunk-EOXA4VJH.cjs.map} +1 -1
- package/dist/{chunk-DBKZANTC.js → chunk-GA47YVW5.js} +3 -3
- package/dist/{chunk-DBKZANTC.js.map → chunk-GA47YVW5.js.map} +1 -1
- package/dist/{chunk-RCZRI72J.cjs → chunk-GMODJT4N.cjs} +4 -4
- package/dist/{chunk-RCZRI72J.cjs.map → chunk-GMODJT4N.cjs.map} +1 -1
- package/dist/{chunk-22KAKJ3W.cjs → chunk-GS5MFUPC.cjs} +4 -4
- package/dist/{chunk-22KAKJ3W.cjs.map → chunk-GS5MFUPC.cjs.map} +1 -1
- package/dist/{chunk-62OMGQHS.js → chunk-H6W3VXHU.js} +3 -3
- package/dist/{chunk-62OMGQHS.js.map → chunk-H6W3VXHU.js.map} +1 -1
- package/dist/{chunk-DX3Z2COD.cjs → chunk-HUYKO2ES.cjs} +3 -3
- package/dist/{chunk-DX3Z2COD.cjs.map → chunk-HUYKO2ES.cjs.map} +1 -1
- package/dist/{chunk-U5F5P4YU.js → chunk-IK234EFX.js} +12 -12
- package/dist/{chunk-U5F5P4YU.js.map → chunk-IK234EFX.js.map} +1 -1
- package/dist/{chunk-UQ2OBHMV.js → chunk-JUGEFTRC.js} +1010 -1010
- package/dist/chunk-JUGEFTRC.js.map +1 -0
- package/dist/{chunk-CHQMVIHR.js → chunk-LPGBRMYS.js} +36 -36
- package/dist/chunk-LPGBRMYS.js.map +1 -0
- package/dist/{chunk-D35EHOK5.cjs → chunk-M23W7IID.cjs} +12 -12
- package/dist/chunk-M23W7IID.cjs.map +1 -0
- package/dist/{chunk-FPOKWML2.js → chunk-MIVNNQO3.js} +21 -4
- package/dist/chunk-MIVNNQO3.js.map +1 -0
- package/dist/{chunk-WI3BVKEC.cjs → chunk-MNFI66H5.cjs} +5 -5
- package/dist/{chunk-WI3BVKEC.cjs.map → chunk-MNFI66H5.cjs.map} +1 -1
- package/dist/{chunk-T5ZMG6MC.js → chunk-NF4M7PUB.js} +3 -3
- package/dist/{chunk-T5ZMG6MC.js.map → chunk-NF4M7PUB.js.map} +1 -1
- package/dist/{chunk-ZNY5W3VX.js → chunk-NPSFPBIB.js} +3 -3
- package/dist/{chunk-ZNY5W3VX.js.map → chunk-NPSFPBIB.js.map} +1 -1
- package/dist/{chunk-LYW5A35J.js → chunk-OMIYTUVR.js} +12 -12
- package/dist/{chunk-LYW5A35J.js.map → chunk-OMIYTUVR.js.map} +1 -1
- package/dist/{chunk-ZMVF7EYJ.cjs → chunk-PBPO54KZ.cjs} +21 -3
- package/dist/chunk-PBPO54KZ.cjs.map +1 -0
- package/dist/{chunk-7V4OCZS6.cjs → chunk-RA3EGF6K.cjs} +6 -6
- package/dist/{chunk-7V4OCZS6.cjs.map → chunk-RA3EGF6K.cjs.map} +1 -1
- package/dist/{chunk-PL7O3RJJ.cjs → chunk-RKBAY7GZ.cjs} +3 -3
- package/dist/{chunk-PL7O3RJJ.cjs.map → chunk-RKBAY7GZ.cjs.map} +1 -1
- package/dist/{chunk-J3E5CSSC.js → chunk-RKFWBIKS.js} +3 -3
- package/dist/{chunk-J3E5CSSC.js.map → chunk-RKFWBIKS.js.map} +1 -1
- package/dist/{chunk-YLKHTBYA.js → chunk-RRP7MQAO.js} +3 -3
- package/dist/{chunk-YLKHTBYA.js.map → chunk-RRP7MQAO.js.map} +1 -1
- package/dist/{chunk-U6LQ6Z3P.cjs → chunk-SP3IKIPA.cjs} +6 -6
- package/dist/{chunk-U6LQ6Z3P.cjs.map → chunk-SP3IKIPA.cjs.map} +1 -1
- package/dist/{chunk-GX75YCWJ.cjs → chunk-SQUOXOY3.cjs} +560 -560
- package/dist/chunk-SQUOXOY3.cjs.map +1 -0
- package/dist/{chunk-6ZYOUT73.js → chunk-T5LORFHL.js} +7 -7
- package/dist/{chunk-6ZYOUT73.js.map → chunk-T5LORFHL.js.map} +1 -1
- package/dist/{chunk-45OU2UAA.cjs → chunk-TEMTKBBL.cjs} +10 -10
- package/dist/{chunk-45OU2UAA.cjs.map → chunk-TEMTKBBL.cjs.map} +1 -1
- package/dist/{chunk-PHDUN4SG.cjs → chunk-THCMGAFX.cjs} +41 -41
- package/dist/{chunk-PHDUN4SG.cjs.map → chunk-THCMGAFX.cjs.map} +1 -1
- package/dist/{chunk-HTGEAQOA.js → chunk-TOMDMKOD.js} +7 -7
- package/dist/{chunk-HTGEAQOA.js.map → chunk-TOMDMKOD.js.map} +1 -1
- package/dist/{chunk-WJHRWXWJ.js → chunk-TXIAF4PX.js} +3 -3
- package/dist/{chunk-WJHRWXWJ.js.map → chunk-TXIAF4PX.js.map} +1 -1
- package/dist/{chunk-6M5NAAWX.js → chunk-UCSEE52D.js} +3 -3
- package/dist/{chunk-6M5NAAWX.js.map → chunk-UCSEE52D.js.map} +1 -1
- package/dist/{chunk-I7CJDF3V.cjs → chunk-UHMP6S7M.cjs} +104 -103
- package/dist/chunk-UHMP6S7M.cjs.map +1 -0
- package/dist/{chunk-PGCKTXYH.js → chunk-UHUI6A36.js} +3 -3
- package/dist/{chunk-PGCKTXYH.js.map → chunk-UHUI6A36.js.map} +1 -1
- package/dist/{chunk-6KQVTMRL.cjs → chunk-UOGXKHTJ.cjs} +3 -3
- package/dist/{chunk-6KQVTMRL.cjs.map → chunk-UOGXKHTJ.cjs.map} +1 -1
- package/dist/{chunk-7S7YVBFK.js → chunk-VDSDG4FR.js} +3 -3
- package/dist/{chunk-7S7YVBFK.js.map → chunk-VDSDG4FR.js.map} +1 -1
- package/dist/{chunk-3GFQNJYE.js → chunk-VGWCHX6G.js} +104 -103
- package/dist/chunk-VGWCHX6G.js.map +1 -0
- package/dist/{chunk-VY3HTT37.js → chunk-VUH547VQ.js} +3 -3
- package/dist/{chunk-VY3HTT37.js.map → chunk-VUH547VQ.js.map} +1 -1
- package/dist/{chunk-AZCMKGDG.js → chunk-W37PFYFL.js} +4 -4
- package/dist/{chunk-AZCMKGDG.js.map → chunk-W37PFYFL.js.map} +1 -1
- package/dist/{chunk-JGUM4EXE.cjs → chunk-W3IX3GZS.cjs} +8 -8
- package/dist/{chunk-JGUM4EXE.cjs.map → chunk-W3IX3GZS.cjs.map} +1 -1
- package/dist/{chunk-UCA4JLLJ.cjs → chunk-X7GT57KW.cjs} +3 -3
- package/dist/{chunk-UCA4JLLJ.cjs.map → chunk-X7GT57KW.cjs.map} +1 -1
- package/dist/{chunk-IXL2KJOZ.cjs → chunk-XBEGD33U.cjs} +40 -40
- package/dist/{chunk-IXL2KJOZ.cjs.map → chunk-XBEGD33U.cjs.map} +1 -1
- package/dist/{chunk-FDNIK5YS.cjs → chunk-XBKIFGBB.cjs} +8 -8
- package/dist/{chunk-FDNIK5YS.cjs.map → chunk-XBKIFGBB.cjs.map} +1 -1
- package/dist/{chunk-HZE5MHQO.js → chunk-XT7HKQ4H.js} +3 -3
- package/dist/{chunk-HZE5MHQO.js.map → chunk-XT7HKQ4H.js.map} +1 -1
- package/dist/{chunk-M3OK6KGR.js → chunk-ZGQKED5T.js} +3 -3
- package/dist/{chunk-M3OK6KGR.js.map → chunk-ZGQKED5T.js.map} +1 -1
- package/dist/{chunk-NWBCZ4PA.js → chunk-ZKBYG6MN.js} +4 -4
- package/dist/{chunk-NWBCZ4PA.js.map → chunk-ZKBYG6MN.js.map} +1 -1
- package/dist/collaboration/index.cjs +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/docx.cjs +19 -19
- package/dist/connect/docx.js +15 -15
- package/dist/connect/index.cjs +762 -762
- package/dist/connect/index.js +63 -63
- package/dist/connect/viewer.cjs +14 -14
- package/dist/connect/viewer.js +13 -13
- package/dist/connection/dashboards/ConnectedDashboardsPage.d.ts +6 -0
- package/dist/dashboards/chartModel.d.ts +12 -0
- package/dist/dashboards/index.cjs +113 -42
- package/dist/dashboards/index.cjs.map +1 -1
- package/dist/dashboards/index.js +95 -24
- package/dist/dashboards/index.js.map +1 -1
- package/dist/embed/index.cjs +29 -29
- package/dist/embed/index.js +23 -23
- package/dist/facts/index.cjs +43 -43
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/home/index.cjs +31 -31
- package/dist/home/index.js +3 -3
- package/dist/index.cjs +383 -383
- package/dist/index.js +21 -21
- package/dist/settings/index.cjs +153 -153
- package/dist/settings/index.js +4 -4
- package/dist/shell/index.cjs +36 -36
- package/dist/shell/index.js +4 -4
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +19 -19
- package/dist/studio/index.js +14 -14
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +33 -33
- package/dist/workflow-canvas/index.js +22 -22
- package/node_modules/@arbidocs/coedit/package.json +2 -2
- package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +60 -13
- package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +21 -13
- package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{index-Bsg7oIKP.d.ts → chrome-print-CAs51cpq.d.ts} +31 -21
- package/node_modules/@docx-editor.dev/core/dist/{chunk-VDNNLG6X.js → chunk-236O4YQW.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-4HENIAFG.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-SRPILEWV.cjs → chunk-6JPL6ZAS.cjs} +5 -5
- package/node_modules/@docx-editor.dev/core/dist/{chunk-2RC2EPND.js → chunk-6ZQP4HQ7.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{chunk-ZUHOMK52.cjs → chunk-7WQ7AAHW.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{chunk-Z6WBFXJU.js → chunk-BCXH4BXB.js} +3 -3
- package/node_modules/@docx-editor.dev/core/dist/{chunk-QMLCVPCD.cjs → chunk-BY2ACZZ6.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-CAJEXXVG.cjs +4 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-CPWLFPWC.js +30 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-6APGXLBB.cjs → chunk-D7ZMDMPX.cjs} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/chunk-DOHF6FA7.cjs +30 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-DVX32P2P.js +27 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-6EYYL7FL.js → chunk-E4LOMDNL.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-EKLM7NWB.cjs +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-G3K63G7P.cjs +27 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-5CSUYANV.js → chunk-G4HOFIKJ.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{chunk-K5U2PLDP.cjs → chunk-JLVBDYVQ.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-LQX36Z5P.js +7 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-TSLBZ26X.js → chunk-LSZ6KPKK.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{chunk-O2AL2HSJ.cjs → chunk-MM5QBMTE.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{chunk-ETTO6GK3.js → chunk-OMCG63ZF.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-OSFOJTHU.cjs +18 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-E7BQA6UP.js → chunk-RCLZXP3B.js} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-T6K2QYNZ.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-TRGAVV2Y.js +4 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-U4JZVSOE.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-2GO5T2JU.cjs → chunk-UHHYFIDT.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-V3N4SOAK.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/{chunk-6AWEKBLB.cjs → chunk-W35WTWAO.cjs} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-YQ5G6LC7.js +18 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +5 -5
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +4 -4
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +3 -3
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +9 -10
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +2 -2
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +33 -9
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +2 -2
- package/node_modules/@docx-editor.dev/core/dist/{custom-node-writes-cvL5rhcD.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
- package/node_modules/@docx-editor.dev/core/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
- package/node_modules/@docx-editor.dev/core/dist/{document-protection-BAGVGqaP.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/{editor-Ci7IZGmG.d.ts → editor-CZQZmTIU.d.ts} +386 -9
- package/node_modules/@docx-editor.dev/core/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +54 -33
- package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -2
- package/node_modules/@docx-editor.dev/core/dist/export.d.ts +13 -14
- package/node_modules/@docx-editor.dev/core/dist/export.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{font-resolver-BVQB14qT.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
- package/node_modules/@docx-editor.dev/core/dist/{headless-document-view-qH331moE.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/{image-resources-BN-hUgCn.d.ts → image-resources-tXLQShoC.d.ts} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/index.d.ts +65 -20
- package/node_modules/@docx-editor.dev/core/dist/index.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{layout-shaping-BEyuiQOk.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +17 -20
- package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{note-properties-4Y9o6Gyk.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
- package/node_modules/@docx-editor.dev/core/dist/{omml-equation-CuzBL5DD.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/output.d.ts +8 -9
- package/node_modules/@docx-editor.dev/core/dist/output.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{protocol-Bqk4Izjc.d.ts → protocol-DYzzz2ej.d.ts} +2 -2
- package/node_modules/@docx-editor.dev/core/dist/{review-paragraph-order-DT-n6ouC.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{semantic-cell-selection-D9D1KSXq.d.ts → semantic-cell-selection-eYag3P47.d.ts} +4 -211
- package/node_modules/@docx-editor.dev/core/dist/{semantic-interaction-CIC-PooQ.d.ts → semantic-interaction-kR_QB845.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{semantic-paint-BME37OMv.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
- package/node_modules/@docx-editor.dev/core/dist/{semantic-record-queries-CBlZqZNa.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{semantic-records-4B3WwFAi.d.ts → semantic-records-DQmumPgL.d.ts} +1279 -828
- package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/store.d.ts +1466 -1464
- package/node_modules/@docx-editor.dev/core/dist/store.js +1 -1
- package/node_modules/@docx-editor.dev/core/dist/{tree-package-fragment-BeeKxDw8.d.ts → tree-package-store-CovjNARF.d.ts} +83 -83
- package/node_modules/@docx-editor.dev/core/dist/{tree-session-contract-CVbmlMlq.d.ts → tree-session-contract-CZVAGl51.d.ts} +6 -6
- package/node_modules/@docx-editor.dev/core/dist/{types-barrel-D3xCgQX6.d.ts → types-barrel-DuC5QBNC.d.ts} +548 -527
- package/node_modules/@docx-editor.dev/core/package.json +3 -3
- package/node_modules/@docx-editor.dev/react/dist/index.js +3 -3
- package/node_modules/@docx-editor.dev/react/dist/index.mjs +3 -3
- package/node_modules/@docx-editor.dev/react/package.json +4 -4
- package/package.json +8 -8
- package/dist/ConnectedStreamedWordArtifact-HLJ5IIOU.js.map +0 -1
- package/dist/ConnectedStreamedWordArtifact-JQ34AOUU.cjs.map +0 -1
- package/dist/RechartsRenderer-23OF4H6X.js.map +0 -1
- package/dist/RechartsRenderer-GIRCW7DB.cjs.map +0 -1
- package/dist/ai-ADS6YSS2.cjs.map +0 -1
- package/dist/ai-KHWTGBT5.js.map +0 -1
- package/dist/chunk-3GFQNJYE.js.map +0 -1
- package/dist/chunk-5AC52BHL.cjs.map +0 -1
- package/dist/chunk-AVGHTUPE.js.map +0 -1
- package/dist/chunk-BAUZUIHB.js.map +0 -1
- package/dist/chunk-CHQMVIHR.js.map +0 -1
- package/dist/chunk-D35EHOK5.cjs.map +0 -1
- package/dist/chunk-FPOKWML2.js.map +0 -1
- package/dist/chunk-GX75YCWJ.cjs.map +0 -1
- package/dist/chunk-I7CJDF3V.cjs.map +0 -1
- package/dist/chunk-OAIOOVFN.cjs.map +0 -1
- package/dist/chunk-UQ2OBHMV.js.map +0 -1
- package/dist/chunk-ZMVF7EYJ.cjs.map +0 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +0 -28
- package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +0 -18
- package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +0 -2
- package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +0 -18
- package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +0 -28
- package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +0 -2
- package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +0 -2
- package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +0 -2
- package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +0 -27
- package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +0 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +0 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +0 -27
- package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +0 -7
- package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +0 -7
- package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +0 -128
- package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +0 -242
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk6AWEKBLB_cjs=require('./chunk-6AWEKBLB.cjs'),chunk4GBTELJV_cjs=require('./chunk-4GBTELJV.cjs'),chunkZUHOMK52_cjs=require('./chunk-ZUHOMK52.cjs'),chunkJGNVNT2A_cjs=require('./chunk-JGNVNT2A.cjs'),chunkFIJZIQXA_cjs=require('./chunk-FIJZIQXA.cjs');function Ms(t){let e=[];for(let n of t.pages){let o=n.pageFieldSource?.pageNumber??n.index+1,r=chunk4GBTELJV_cjs.ec(o,n.pageFieldSource?.format),a=s=>{for(let u of s)if(u.kind==="paragraph")for(let d of u.lines)e.push({...d.range,pageNumber:o,pageNumberText:r});else for(let d of u.rows)for(let c of d.cells)a(c.blocks);};a(n.fragments),n.header&&a(n.header.fragments),n.footer&&a(n.footer.fragments);for(let s of n.footnotes?.notes??[])a(s.fragments);for(let s of n.endnotes?.notes??[])a(s.fragments);}return {pageCount:t.pages.length,ranges:e}}function Od(t,e,n,o){if(!t||!Number.isInteger(t.pageCount)||t.pageCount<1)return null;let r=chunkFIJZIQXA_cjs.Ta(e,n);if(!r||r.kind!=="paragraph")return null;let a=chunkFIJZIQXA_cjs.hg(r).find(u=>u.node.id===o);if(!a)return null;let s=t.ranges.find(u=>u.paragraphId===n&&u.start<=a.start&&u.end>a.start);return !s||!Number.isInteger(s.pageNumber)||s.pageNumber<1?null:{pageNumber:s.pageNumber,pageNumberText:s.pageNumberText,pageCount:t.pageCount}}function Pd(t){return async e=>{let n=chunk6AWEKBLB_cjs.e(e,{measurer:t.measurer,producer:t.producer,displayMode:"proposed"});if(!n.ok)throw new Error("field pagination could not open the document");try{return Ms(await n.session.layout())}finally{n.session.dispose();}}}var fn=Object.freeze(["default","first","even"]);function ro(t){return t.kind==="body"||t.kind==="header"||t.kind==="footer"}var Ct=Object.freeze({kind:"body"});function G(t){switch(t.kind){case "body":return "body";case "note":return `note:${t.noteKind}:${String(t.noteId)}`;case "textbox":return `textbox:${G(t.owner)}:${String(t.shapeId)}`;default:return `${t.kind}:${String(t.sectionIndex)}:${t.variant}`}}function ao(t){if(typeof t!="object"||t===null)return false;let e=t;return e.kind==="body"?true:e.kind==="textbox"?ao(e.owner)&&ro(e.owner)&&Number.isInteger(e.shapeId)&&e.shapeId>=0:e.kind==="note"?(e.noteKind==="footnote"||e.noteKind==="endnote")&&Number.isInteger(e.noteId):e.kind!=="header"&&e.kind!=="footer"?false:Number.isInteger(e.sectionIndex)&&e.sectionIndex>=0&&fn.includes(e.variant)}function te(t){return t.kind==="note"||t.kind==="textbox"}var Hs=["getTables","getTable","getTableRows","getTableCells","getTableCell","getTableCellProperties","getTableCellBody","getFields","getField","getInlinePictures","getInlinePicture","getShapes","getShape","getShapeBody","getChangeTrackingMode","getDocument","getDocumentProperty","getBody","getParagraphs","getRange","getSpanParagraphs","getText","getSpanText","getParagraphId","search","getFont","getParagraphFormat","getStyle","getSections","getPageSetup","getFurniture","getNotes","getNoteBody","getNoteText","getNoteKind","getLists","getListId","getListById","getListParagraphs","getParagraphList","getListLevel","getHyperlink","getBookmarks","getBookmarkName","getBookmarkRange","getComments","getCommentReplies","getCommentId","getCommentAuthor","getCommentDate","getCommentText","getCommentRange","getCommentResolved","getRevisions","getRevisionType","getRevisionAuthor","getRevisionDate","getRevisionRange","getContentControls","getContentControlById","getContentControlsByTag","getContentControlsByTitle","getContentControlTag","getContentControlTitle","getContentControlFileId","getContentControlSubtype","getContentControlLock","getContentControlIsBound","getContentControlPlaceholderShown","getContentControlTemporary","getContentControlText","getContentControlParagraphs","getContentControlRange"],ma=["removeDocumentInformation","setDocumentProperties","insertTableRows","insertTable","updateTable","updateTableCell","setInlinePicture","deleteInlinePicture","insertField","setFieldCode","deleteField","updateFieldResult","insertInlinePicture","insertBreak","setChangeTrackingMode","proposeInsertion","proposeDeletion","proposeReplacement","insertText","replaceSpan","replaceStoryBlocks","insertParagraph","splitParagraph","deleteParagraph","selectSpan","selectBookmark","setFont","setParagraphFormat","setStyle","setPageSetup","deleteNote","setListLevel","startNewList","attachToList","detachFromList","setListLevelFormat","insertListParagraph","setHyperlink","insertComment","setCommentResolved","replyToComment","deleteComment","acceptRevision","rejectRevision","resolveRevisionBatch","setRevisionAuthorBatch","acceptAllRevisions","rejectAllRevisions","setContentControlValue","setContentControlProperties","deleteContentControl","insertContentControlText","insertContentControl","insertCustomNode"],fa=["removeDocumentInformation","insertTableRows","resolveRevisionBatch","setRevisionAuthorBatch","insertTable","insertInlinePicture","insertBreak","startNewList","deleteNote","insertComment","setCommentResolved","replyToComment","insertCustomNode"],Fs=new Set(fa);function gn(t){return Fs.has(t.op)&&!(t.op==="insertBreak"&&t.breakType==="Line")||t.op==="updateTable"&&["addRows","addColumns","deleteRows","deleteColumns","delete"].includes(t.mutation.kind)}var Ds=new Set(ma);function zt(t){return Ds.has(t.op)}var Bs="http://schemas.openxmlformats.org/drawingml/2006/picture",js="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",_s="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",Vs=4096,Us=65536;function Ws(t){return t&&t.kind!=="textValue"?t:null}function hn(t,e,n){return t.kind!=="textValue"&&t.namespaceUri===e&&t.localName===n}function ee(t,e,n){return Ws(t.children.find(o=>hn(o,e,n)))}function $s(t){let e=t.children.find(p=>p.kind==="anchoredDrawing"||p.kind==="inlineDrawing"||hn(p,chunkFIJZIQXA_cjs.sa,"anchor")||hn(p,chunkFIJZIQXA_cjs.sa,"inline"));if(!e||e.kind==="textValue")return null;let n=ee(e,chunkFIJZIQXA_cjs.sa,"docPr"),o=n?chunkFIJZIQXA_cjs.ka(n.attributes,"id"):void 0;if(!n||o===void 0||!/^\d{1,10}$/.test(o)||Number(o)>4294967295)return "malformed";let r=chunkFIJZIQXA_cjs.ka(n.attributes,"name")??"",a=ee(e,chunkFIJZIQXA_cjs.ra,"graphic"),s=a?ee(a,chunkFIJZIQXA_cjs.ra,"graphicData"):null,u=s?chunkFIJZIQXA_cjs.ka(s.attributes,"uri"):void 0,d="Unsupported",c=null;if(s&&u===chunkFIJZIQXA_cjs.ia){let p=ee(s,chunkFIJZIQXA_cjs.ia,"wsp"),f=p?ee(p,chunkFIJZIQXA_cjs.ia,"txbx"):null;c=f?ee(f,chunkFIJZIQXA_cjs.la,"txbxContent"):null;let x=p?ee(p,chunkFIJZIQXA_cjs.ia,"cNvSpPr"):null,g=x?chunkFIJZIQXA_cjs.ka(x.attributes,"txBox"):void 0;d=p?g==="1"||g==="true"?"TextBox":"GeometricShape":"Unsupported";}else u===Bs?d="Picture":u===js?d="Group":u===_s&&(d="Canvas");return {read:{id:Number(o),name:r,type:d},root:c}}function yn(t,e){let n=[],o=new Set;for(let r of e){if(r.kind==="textValue")continue;let a=chunkFIJZIQXA_cjs.sd(chunkFIJZIQXA_cjs.gj(t,r),r),s=[];for(let d=r.children.length-1;d>=0;d-=1)s.push({node:r.children[d],scope:a});let u=0;for(;s.length>0;){if(++u>Us)return {ok:false,reason:"truncated"};let{node:d,scope:c}=s.pop();if(d.kind==="textValue"||d.kind==="paragraph")continue;let p=chunkFIJZIQXA_cjs.sd(c,d),f=chunkFIJZIQXA_cjs.rd(d),x=d.kind==="drawing"||hn(d,chunkFIJZIQXA_cjs.la,"drawing")?d:f?chunkFIJZIQXA_cjs.Ld(d,p).drawing:null;if(!(f&&!x)){if(x){let g=$s(x);if(g==="malformed")return {ok:false,reason:"malformed"};if(g){if(o.has(g.read.id))return {ok:false,reason:"duplicates"};if(n.length>=Vs)return {ok:false,reason:"truncated"};o.add(g.read.id),n.push({...g.read,hostParagraphId:r.id,textboxRoot:g.root,alternate:f?d:null});}continue}for(let g=d.children.length-1;g>=0;g-=1)s.push({node:d.children[g],scope:p});}}}return {ok:true,shapes:Object.freeze(n)}}var Ks=63360;function Bt(t){return Math.round(chunkFIJZIQXA_cjs.ld(chunkFIJZIQXA_cjs.jd(t))*100)/100}function zs(t,e){if(typeof t!="number"||!Number.isFinite(t))return null;let n=chunkFIJZIQXA_cjs.md(chunkFIJZIQXA_cjs.kd(t));return n>Ks||n<0||n===0&&!e?null:n}var Gs=[["pageWidth","pageWidthTwips",false],["pageHeight","pageHeightTwips",false],["topMargin","marginTopTwips",true],["rightMargin","marginRightTwips",true],["bottomMargin","marginBottomTwips",true],["leftMargin","marginLeftTwips",true]];function ga(t){if(typeof t!="object"||t===null)return {ok:false,reason:"that is not a page setup",detail:"not-an-object"};let e=t,n={},o=0;for(let[a,s,u]of Gs){let d=e[a];if(d===void 0)continue;let c=zs(d,u);if(c===null)return {ok:false,reason:`that is not a value for ${a}`,detail:String(d)};n[s]=c,o+=1;}let r=e.orientation;if(r!==void 0){if(r!=="portrait"&&r!=="landscape")return {ok:false,reason:"that is not an orientation",detail:String(r)};n.orientation=r,o+=1;}return o===0?{ok:false,reason:"that page setup names nothing to write",detail:"empty"}:{ok:true,value:n}}function Xs(t){let e=chunkFIJZIQXA_cjs.Ik(t),n=e.widthTwips>e.heightTwips?"landscape":"portrait";return Object.freeze({pageWidth:Bt(e.widthTwips),pageHeight:Bt(e.heightTwips),orientation:n,topMargin:Bt(e.topTwips),rightMargin:Bt(e.rightTwips),bottomMargin:Bt(e.bottomTwips),leftMargin:Bt(e.leftTwips),headerDistance:Bt(e.headerTwips),footerDistance:Bt(e.footerTwips),gutter:Bt(e.gutterTwips)})}function Ys(t,e){if(!e)return null;let n=null,o=(r,a,s)=>{if(n!==null||r.kind==="textValue"||s>64)return;let u=r.kind==="paragraph"?r.id:a;if(r.id===e.id){n=u;return}for(let d of r.children)o(d,u,s+1);};return o(t.root,null,0),n}function ha(t,e,n){let o=chunkFIJZIQXA_cjs.cf(e.root);return Object.freeze(o.map((r,a)=>{let s=n[a];return Object.freeze({index:a,markParagraphId:Ys(e,r),pageSetup:Xs(r),titlePage:s?.titlePage??false,evenAndOddHeaders:s?.evenAndOddHeaders??false})}))}var ya=new WeakMap,Js=0;function Qs(t){if(!t)return;let e=ya.get(t);return e||(e={...t,cacheKey:`formatting-${++Js}`},ya.set(t,e)),e}function kn(t){let e=new WeakMap;return (n,o,r,a)=>{let s=Qs(a),u=chunkFIJZIQXA_cjs.Ua(n,o.id),d;for(;u&&u.kind!=="table";){if(u.localName==="txbxContent")return;u.kind==="tableCell"&&(d=u.id),u=chunkFIJZIQXA_cjs.Ua(n,u.id);}if(!u||!d)return;let c=u,p=c.kind==="table"?c.children.find(x=>x.localName==="tblPr")??c:c,f=e.get(p);if(!f||f.table!==c||f.mode!==r||f.filter!==s){let x=new Map,g=chunk4GBTELJV_cjs.Ud(u,1,0,t,r,s);for(let A of g?.rows??[])for(let v of A.cells)x.set(v.id,v.styleFormatting);f={table:c,mode:r,filter:s,cells:x},e.set(p,f);}return f.cells.get(d)}}var ge={},ka=new WeakMap;function Zs(t,e){let n=t&&t.kind!=="textValue"?t.children.filter(r=>r.kind==="textValue"||r.localName!=="pStyle"):[];return {...t??{kind:"generic",id:"",localName:"pPr",attributes:[]},children:[{kind:"generic",id:"",namespaceUri:chunkFIJZIQXA_cjs.la,localName:"pStyle",prefix:"w",attributes:[{namespaceUri:chunkFIJZIQXA_cjs.la,localName:"val",prefix:"w",value:e}],children:[]},...n]}}function qs(t){let e=chunk4GBTELJV_cjs.hd(t.styles,void 0,t.settings),n=kn(e),o=chunk4GBTELJV_cjs.wc(chunk4GBTELJV_cjs.lc(t.numbering),e);return (r,a,s,u)=>{let d=chunkFIJZIQXA_cjs.Bh(a,"paragraphProperties","pPr"),c=u===void 0?d:Zs(d,u),p=chunk4GBTELJV_cjs.vc(chunk4GBTELJV_cjs.id(e,c).paragraphPropertyNodes),f=p?chunk4GBTELJV_cjs.mc(o,p.numId,p.ilvl):null,x=chunk4GBTELJV_cjs.jd(e,c,n(r,a,s),f?chunk4GBTELJV_cjs.pb(f.level):void 0);return chunk4GBTELJV_cjs.sd(x.inheritedParagraphProperties)}}function xa(t,e,n,o,r){let a=ka.get(t.styles??ge);a||ka.set(t.styles??ge,a=new WeakMap);let s=a.get(t.settings??ge);s||a.set(t.settings??ge,s=new WeakMap);let u=s.get(t.numbering??ge);return u||s.set(t.numbering??ge,u=qs(t)),u(e,n,o,r)}var tl=255,el="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";function nl(t){let e=(t.relationships.get(t.mainDocumentPart)??[]).find(o=>o.type===el),n;if(e){let o=chunkFIJZIQXA_cjs.J(e);o.mode==="Internal"&&o.target.ok&&(n=t.parts.get(o.target.partName));}return n??=t.parts.get("/word/numbering.xml"),n?.root??null}function ba(t){let e=chunkFIJZIQXA_cjs.bd(t),n={styles:e?.root??null,settings:chunkFIJZIQXA_cjs.Tg(t)?.root??null,numbering:nl(t)},o=(u,d,c)=>xa(n,u,d,"proposed",c);if(!e)return Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false,inheritsRtl:o});let r=new Map,a=new Map,s=null;for(let u of chunkFIJZIQXA_cjs.ad(e).values())if(u.type==="paragraph"){if(r.set(u.styleId,u.name),u.name!==null){let d=u.name.trim().toLowerCase();a.has(d)||a.set(d,u.styleId);}u.isDefault&&s===null&&(s=u.styleId);}return Object.freeze({nameOf:u=>r.get(u)??null,idOf:u=>a.get(u.trim().toLowerCase())??null,defaultId:s,present:true,inheritsRtl:o})}function xn(t,e,n){let o=chunkFIJZIQXA_cjs.Ta(t,e);if(!o||o.kind!=="paragraph")return null;let r=ol(chunkFIJZIQXA_cjs.eg(chunkFIJZIQXA_cjs.cg(o),"pStyle"));return r!==null?n.nameOf(r):n.defaultId===null?null:n.nameOf(n.defaultId)}function ol(t){if(!t)return null;for(let e of t.attributes)if(e.localName==="val")return e.value;return null}function bn(t,e){if(typeof t!="string"||t.trim().length===0)return {ok:false,detail:"style: not a name"};if(t.length>tl)return {ok:false,detail:"style: name too long"};if(!chunkFIJZIQXA_cjs.T(t))return {ok:false,detail:"style: not valid XML text"};if(!e.present)return {ok:false,detail:"style: this document defines no styles"};let n=e.idOf(t);return n===null?{ok:false,detail:"style: this document defines no paragraph style with that name"}:{ok:true,styleId:n}}function Aa(t,e,n){return e>=n?null:{text:t.text.slice(e-t.rawStart,n-t.rawStart),rawStart:e,rawEnd:n,...t.symbol?{symbol:true}:{},...t.symbol&&t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{}}}function rl(t,e){let n=[],o=0;for(let r of t){for(;o<e.length&&e[o].end<=r.rawStart;)o+=1;let a=r.rawEnd-r.rawStart;if(r.text.length!==a||r.resultRuns||r.symbolOffsets){let d=e[o];(!d||d.start>=r.rawEnd)&&n.push(r);continue}let s=r.rawStart;for(;o<e.length;){let d=e[o];if(d.end<=s){o+=1;continue}if(d.start>=r.rawEnd)break;let c=Aa(r,s,Math.min(d.start,r.rawEnd));if(c&&n.push(c),s=Math.max(s,d.end),d.end<=r.rawEnd&&(o+=1),s>=r.rawEnd)break}let u=Aa(r,s,r.rawEnd);u&&n.push(u);}return n}function io(t,e){return e.map(n=>{if(!n.text.includes(`
|
|
2
|
-
`))return n;let r=n.text.length===n.rawEnd-n.rawStart&&!n.resultRuns?n.text.replaceAll(`
|
|
3
|
-
`,(a,s)=>t[n.rawStart+s]):n.text.replaceAll(`
|
|
4
|
-
`,chunkFIJZIQXA_cjs.kh);return {...n,text:r}})}function An(t,e,n){let o=chunkFIJZIQXA_cjs.Yi(t,e);if(n==="model")return chunkZUHOMK52_cjs.b(o);let r=chunkZUHOMK52_cjs.c(t,e,n);if(n==="allMarkup")return chunkZUHOMK52_cjs.a(io(o,r));let a=al(t);if(a.length===0)return chunkZUHOMK52_cjs.a(io(o,r));let s=rl(r,a);return chunkZUHOMK52_cjs.a(io(o,s))}function al(t){let e=chunkFIJZIQXA_cjs.jg(t),n=[],o=(a,s)=>{if(!(s>64||a.kind==="textValue")){if(a.kind==="revisionInsert"||a.kind==="revisionMoveTo"){let u=e.spanOf(a);u&&u.end>u.start&&n.push({start:u.start,end:u.end});return}for(let u of a.children)o(u,s+1);}};o(t,0),n.sort((a,s)=>a.start-s.start||s.end-a.end);let r=[];for(let a of n){let s=r[r.length-1];s&&a.start<=s.end?s.end=Math.max(s.end,a.end):r.push({...a});}return r}var so="\r",il=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false,inheritsRtl:()=>false}),sl=Object.freeze([]),ll=Object.freeze([]),va=Object.freeze([]),Oa=Object.freeze({ok:true,shapes:[]}),dl=Object.freeze({package:null,body:null,story:()=>null,storyOf:()=>null,sections:()=>ll,furniture:()=>va,noteIds:()=>({ok:true,ids:Pa}),shapes:()=>Oa,styles:()=>il});function ul(t){return t.kind==="textValue"?sl:Object.freeze(t.children.filter(e=>e.kind!=="textValue").map(e=>{let n=[];chunkFIJZIQXA_cjs.Sc([e],n,0);let o=e.kind==="paragraph"?"paragraph":e.kind==="table"?"table":"other",r=e.kind==="paragraph"&&chunkFIJZIQXA_cjs.eg(chunkFIJZIQXA_cjs.cg(e),"sectPr")!==void 0;return Object.freeze({id:e.id,kind:o,paragraphIds:Object.freeze(n.map(a=>a.id)),removable:o!=="other"&&!r})}))}function He(t,e,n,o,r){let a=chunkFIJZIQXA_cjs.Rc(o),s=Object.freeze(a.map(g=>g.id)),u=new Map,d=new Map;a.forEach((g,A)=>{u.set(g.id,A),d.set(g.id,g);});let c=new Map,p=g=>{if(!u.has(g))return null;let A=c.get(g);if(A!==void 0)return A;let v=chunkFIJZIQXA_cjs.Vi(e,g)??"";return c.set(g,v),v},f=new Map,x=(g,A="allMarkup")=>{let v=d.get(g);if(!v||v.kind!=="paragraph")return null;let I=`${g}:${A}`,w=f.get(I);if(w)return w;let O=An(v,p(g)??"",A);return f.set(I,O),O};return {story:t,part:e,root:o,scope:n,paragraphIds:s,blocks:ul(o),has:g=>u.has(g),indexOf:g=>u.get(g)??-1,paragraph(g){let A=d.get(g);return A?{nodeId:g,paraId:chunkFIJZIQXA_cjs.wb(A),text:x(g)?.text??""}:null},node:g=>d.get(g)??null,rawText:p,paragraphText:(g,A)=>x(g,A)?.text??null,projectedText:x,text:g=>s.map(A=>x(A,g)?.text??"").join(so),styles:r}}function vn(t,e){let n=He(t.story,t.part,t.scope,e,t.styles);return {...n,indexOf:o=>n.has(o)?t.indexOf(o):-1}}function he(t){let e=t.parts.get(t.mainDocumentPart);if(!e)return dl;let n,o=()=>n??=ba(t),r,a=()=>r??=chunkFIJZIQXA_cjs.ef(t),s,u=new Map,d=new Map,c=new Map,p=O=>{let H=G(O),M=c.get(H);if(M)return M;let N=v(O),E=N?N.paragraphIds.flatMap(_=>{let z=N.node(_);return z?[z]:[]}):[],R=N?yn(N.part,E):Oa;return c.set(H,R),R},f=O=>{let H=d.get(O);if(H)return H;let M=chunkFIJZIQXA_cjs.ch(t,O);if(!M){let K={ok:true,ids:Pa};return d.set(O,K),K}let N=[],E=new Set,R=new Set,_=0,z=false;for(let K of M.root.children){if(chunkFIJZIQXA_cjs.xc(K)!==O)continue;if(_+=1,K.kind!=="note"){z=true;continue}if(!chunkFIJZIQXA_cjs.Ac(K))continue;let Z=chunkFIJZIQXA_cjs.yc(K);if(Z===null){z=true;continue}E.has(Z)?R.add(Z):(E.add(Z),N.push(Z));}let $=_>chunkFIJZIQXA_cjs.Hc?{ok:false,reason:"truncated"}:z?{ok:false,reason:"malformed"}:R.size>0?{ok:false,reason:"duplicates",duplicateIds:Object.freeze([...R])}:{ok:true,ids:Object.freeze(N)};return d.set(O,$),$},x=O=>{let H=a()[O.sectionIndex];return H?(O.kind==="header"?H.headers:H.footers).get(O.variant)??null:null},g=O=>{if(O.kind==="body"){let M=chunkFIJZIQXA_cjs.Qc(e);return M?He(O,e,{kind:"body"},M,o):null}if(O.kind==="note"){let M=f(O.noteKind);if(!M.ok||!M.ids.includes(O.noteId))return null;let N=chunkFIJZIQXA_cjs.ch(t,O.noteKind);if(!N)return null;let E=chunkFIJZIQXA_cjs.Lc(N.root,O.noteId);return !E||!chunkFIJZIQXA_cjs.Ac(E)?null:He(O,N,{kind:"notesPart",noteKind:O.noteKind},E,o)}if(O.kind==="textbox"){let M=A(O.owner),N=p(O.owner);if(!M||!N.ok)return null;let E=N.shapes.find(R=>R.id===O.shapeId);return E?.textboxRoot?He(O,M.part,M.scope,E.textboxRoot,o):null}let H=x(O);return H?He(O,H.part,{kind:"headerFooter",rId:H.rId},H.part.root,o):null},A=O=>v(O),v=O=>{let H=G(O);if(u.has(H))return u.get(H)??null;let M=g(O);return u.set(H,M),M},I=(O,H)=>{let M=p(O);if(!M.ok)return null;for(let N of M.shapes){if(!N.textboxRoot)continue;let E={kind:"textbox",owner:O,shapeId:N.id};if(v(E)?.has(H))return E}return null};return {package:t,get body(){return v(Ct)},story:v,storyOf:O=>{if(v(Ct)?.has(O))return Ct;let M=[{kind:"body"}];for(let[N]of a().entries())for(let E of ["header","footer"])for(let R of fn){let _={kind:E,sectionIndex:N,variant:R};if(v(_)){if(v(_).has(O))return _;M.push(_);}}for(let N of ["footnote","endnote"]){let E=f(N);if(E.ok)for(let R of E.ids){let _={kind:"note",noteKind:N,noteId:R};if(v(_)?.has(O))return _}}for(let N of M){let E=I(N,O);if(E)return E}return null},sections:()=>s??=ha(t,e,a()),furniture(O){let H=a()[O];if(!H)return va;let M=[];for(let N of ["header","footer"]){let E=N==="header"?H.headers:H.footers;for(let R of fn){let _=E.get(R);_&&M.push(Object.freeze({kind:N,variant:R,declared:!_.inherited}));}}return Object.freeze(M)},noteIds:f,shapes:p,styles:o}}var Pa=Object.freeze([]);function Ia(t,e,n){let o=r=>({state:n,step:{ok:false,error:{code:"unsupported-capability",message:r,detail:"changeTrackingMode"}}});return t.op==="getChangeTrackingMode"||t.op==="setChangeTrackingMode"?e?t.op==="getChangeTrackingMode"?{state:n,step:{ok:true,kind:"query",value:{kind:"text",text:n.mode}}}:t.mode!=="Off"&&t.mode!=="TrackMineOnly"?o("TrackAll requires shared tracking enforcement for every peer and is not supported"):t.mode==="TrackMineOnly"&&(typeof t.author!="string"||!t.author.trim()||!chunkFIJZIQXA_cjs.T(t.author))?o("TrackMineOnly requires a non-empty XML-safe runtime author"):{state:{mode:t.mode,...t.mode==="TrackMineOnly"?{author:t.author.trim()}:{}},step:{ok:true,kind:"query",value:{kind:"applied"}}}:o("this host does not support runtime-local change tracking"):n.mode==="Off"||lo(t)?null:o(`${t.op} does not support TrackMineOnly; no permanent edit was applied`)}function lo(t){return !zt(t)||t.op==="setChangeTrackingMode"||t.op==="insertText"?true:t.op==="insertBreak"?t.breakType==="Line"&&!(t.location==="Replace"&&"body"in t.span):t.op==="insertTable"||t.op==="insertTableRows"||t.op==="updateTable"||t.op==="updateTableCell"||t.op==="replaceSpan"&&!("body"in t.span)||t.op==="deleteParagraph"?true:["insertContentControl","setContentControlProperties","startNewList","setListLevelFormat","attachToList","detachFromList","setListLevel","insertParagraph","setFont","setStyle","setParagraphFormat","proposeInsertion","proposeDeletion","proposeReplacement","insertComment","replyToComment","deleteComment","setCommentResolved","acceptRevision","rejectRevision","resolveRevisionBatch","setRevisionAuthorBatch","acceptAllRevisions","rejectAllRevisions","selectSpan","selectBookmark"].includes(t.op)}function Ra(t,e,n){if(!n||!["setFont","setStyle","setParagraphFormat","insertParagraph","attachToList","detachFromList","setListLevel"].includes(t.op)||!e.ok||e.kind!=="command")return e;let o={author:n,date:new Date().toISOString()};return {...e,ops:e.ops.map(r=>{if(r.op==="insertText")return {...r,revision:o};if(r.op==="splitParagraph")return {op:"splitParagraphMany",paragraphId:r.paragraphId,offsets:[r.offset],revision:o};if(r.op==="setRunProperties"||r.op==="setParagraphProperties"||r.op==="setParagraphMarkProperties"||r.op==="setListNumbering"||r.op==="setListLevel")return {...r,revision:o};throw new Error("Formatting plan contains an operation without property revision support")})}}function cl(){let t=globalThis.crypto,e=t?.getRandomValues;if(typeof e!="function")throw new Error("automation: no secure random source. globalThis.crypto.getRandomValues is required to scope document handles to one host.");let n=e.call(t,new Uint8Array(16)),o="";for(let r of n)o+=r.toString(16).padStart(2,"0");return o}function pl(t){return typeof t=="object"&&t!==null&&"kind"in t&&"ref"in t}function Sa(){let t=new Map,e=new Map,n=new Map,o=new Map,r=cl(),a=null,s=(d,c)=>{let p=(o.get(d)??0)+1;o.set(d,p);let f=`${d}:${r}:${String(p)}`;return t.set(f,c),Object.freeze({kind:d,ref:f})},u=(d,c,p)=>{let f=`${d}\0${c}`,x=n.get(f);if(x)return Object.freeze({kind:d,ref:x});let g=s(d,p);return n.set(f,g.ref),g};return {document(){return a??=s("document",{kind:"document"}),a},body(d,c){return u("body",`${G(d)}:${c??""}`,{kind:"body",story:d,...c?{rootNodeId:c}:{}})},table(d,c){return u("table",`${G(c)}:${d}`,{kind:"table",nodeId:d,story:c})},tableRow(d,c){return u("tableRow",`${G(c)}:${d}`,{kind:"tableRow",nodeId:d,story:c})},tableCell(d,c){return u("tableCell",`${G(c)}:${d}`,{kind:"tableCell",nodeId:d,story:c})},field(d,c,p){return u("field",`${G(p)}:${c}`,{kind:"field",paragraphId:d,fieldNodeId:c,story:p})},inlinePicture(d,c){return u("inlinePicture",`${G(c)}:${d}`,{kind:"inlinePicture",drawingNodeId:d,story:c})},shape(d,c){return u("shape",`${G(c)}:${String(d)}`,{kind:"shape",shapeId:d,owner:c})},paragraph(d,c){let p=e.get(d);if(p)return Object.freeze({kind:"paragraph",ref:p});let f=s("paragraph",{kind:"paragraph",paragraphId:d,story:c});return e.set(d,f.ref),f},section(d){return u("section",String(d),{kind:"section",index:d})},note(d,c){return u("note",`${d}:${String(c)}`,{kind:"note",noteKind:d,noteId:c})},comment(d,c){return u("comment",`${G(c)}\0${d}`,{kind:"comment",commentId:d,story:c})},revision(d,c){return u("revision",`${G(c)}\0${d}`,{kind:"revision",revisionId:d,story:c})},bookmark(d,c){return u("bookmark",`${G(c)}\0${d}`,{kind:"bookmark",name:d,story:c})},list(d,c){return u("list",`${G(c)}\0${d}`,{kind:"list",numId:d,story:c})},contentControl(d,c){return u("contentControl",`${G(c)}\0${d}`,{kind:"contentControl",nodeId:d,story:c})},retargetRevisions(d,c){let p=x=>`revision\0${G(d)}\0${x}`,f=c.flatMap(({from:x,to:g})=>{let A=x===g?void 0:n.get(p(x));return A?[{ref:A,from:x,to:g}]:[]});for(let{from:x}of f)n.delete(p(x));for(let{ref:x,to:g}of f)n.has(p(g))||(n.set(p(g),x),t.set(x,{kind:"revision",revisionId:g,story:d}));},retarget(d,c){let p=e.get(d);if(!p||d===c)return;let f=t.get(p);!f||f.kind!=="paragraph"||(e.delete(d),t.set(p,{kind:"paragraph",paragraphId:c,story:f.story}),e.has(c)||e.set(c,p));},resolve(d,c){if(!pl(d)||d.kind!==c||typeof d.ref!="string")return null;let p=t.get(d.ref);return !p||p.kind!==c?null:p}}}function Tt(t,e){return {ok:false,code:t,detail:e}}function Nt(t){return {ok:true,value:t}}function ut(t,e,n,o){let r=n.resolve(t,e);if(!r||r.kind!=="body"&&r.kind!=="paragraph")return Tt("invalid-handle",`not-a-${e}-handle`);let a=o.story(r.story);if(!a)return Tt("invalid-handle",`no-such-story:${G(r.story)}`);if(r.kind==="body"&&r.rootNodeId){let s=chunkFIJZIQXA_cjs.Ta(a.part,r.rootNodeId);return !s||s.kind!=="tableCell"?Tt("invalid-handle","cell no longer exists"):Nt(vn(a,s))}return Nt(a)}function ct(t,e,n){let o=e.resolve(t,"paragraph");if(!o||o.kind!=="paragraph")return Tt("invalid-handle","not-a-paragraph-handle");let r=n.story(o.story);if(!r)return Tt("invalid-handle",`no-such-story:${G(o.story)}`);let a=r.indexOf(o.paragraphId);return a<0?Tt("invalid-handle","paragraph-not-in-body"):Nt({story:o.story,paragraphId:o.paragraphId,index:a,offset:0})}function ml(t,e,n){let o=ct(t.paragraph,e,n);if(!o.ok)return o;let a=(n.story(o.value.story)?.rawText(o.value.paragraphId)??"").length,{offset:s}=t;return !Number.isInteger(s)||s<0||s>a?Tt("invalid-offset",`offset ${String(s)} outside 0..${String(a)}`):Nt({...o.value,offset:s})}function ye(t,e,n){if("paragraph"in t){if(!("at"in t))return ml(t,e,n);let u=ct(t.paragraph,e,n);if(!u.ok||t.at==="start")return u;let c=(n.story(u.value.story)?.rawText(u.value.paragraphId)??"").length;return Nt({...u.value,offset:c})}let o=ut(t.body,"body",e,n);if(!o.ok)return o;let r=o.value.paragraphIds;if(r.length===0)return Tt("invalid-offset","empty-story");if(t.at==="start")return Nt({story:o.value.story,paragraphId:r[0],index:o.value.indexOf(r[0]),offset:0});let a=r.length-1,s=r[a];return Nt({story:o.value.story,paragraphId:s,index:o.value.indexOf(s),offset:(o.value.rawText(s)??"").length})}function fl(t,e){return t.index<e.index||t.index===e.index&&t.offset<=e.offset}function gl(t){let e=t.paragraphIds;if(e.length===0)return null;let n=e.length-1,o=e[n];return {start:{story:t.story,paragraphId:e[0],index:t.indexOf(e[0]),offset:0},end:{story:t.story,paragraphId:o,index:t.indexOf(o),offset:(t.rawText(o)??"").length}}}function J(t,e,n){if("body"in t){let a=ut(t.body,"body",e,n);return a.ok?Nt(gl(a.value)):a}if("paragraph"in t){let a=ct(t.paragraph,e,n);if(!a.ok)return a;let u=(n.story(a.value.story)?.rawText(a.value.paragraphId)??"").length;return Nt({start:a.value,end:{...a.value,offset:u}})}let o=ye(t.start,e,n);if(!o.ok)return o;let r=ye(t.end,e,n);return r.ok?G(o.value.story)!==G(r.value.story)?Tt("invalid-handle","span-crosses-stories"):fl(o.value,r.value)?Nt({start:o.value,end:r.value}):Tt("invalid-offset","span-start-after-end"):r}function ot(t,e,n){if("body"in t)return ut(t.body,"body",e,n);if("paragraph"in t)return ut(t.paragraph,"paragraph",e,n);let o=t.start;return "paragraph"in o?ut(o.paragraph,"paragraph",e,n):ut(o.body,"body",e,n)}function On(t,e,n){if("paragraph"in t)return ct(t.paragraph,e,n);let o=ut(t.body,"body",e,n);if(!o.ok)return o;let r=o.value.paragraphIds;if(r.length===0)return Tt("invalid-offset","empty-story");let a=t.at==="first"?0:r.length-1;return Nt({story:o.value.story,paragraphId:r[a],index:a,offset:0})}function At(t,e){if(!t)return [];let n=e.paragraphIds,o=n[t.start.index]===t.start.paragraphId?t.start.index:n.indexOf(t.start.paragraphId),r=n[t.end.index]===t.end.paragraphId?t.end.index:n.indexOf(t.end.paragraphId);return o<0||r<o?[]:n.slice(o,r+1)}function ne(t,e){if(!t)return [];let n=At(t,e),o=n.length-1;return n.map((r,a)=>{let s=(e.rawText(r)??"").length,u=a===0?t.start.offset:0,d=a===o?t.end.offset:s;return {paragraphId:r,start:u,end:d,whole:u===0&&d===s}})}function wa(t,e,n,o="allMarkup"){if(!t)return "";let r=At(t,e);return r.length===1?e.projectedText(t.start.paragraphId,o)?.sliceRaw(t.start.offset,t.end.offset)??"":r.map((a,s)=>{let u=e.projectedText(a,o);if(!u)return "";let d=(e.rawText(a)??"").length;return s===0?u.sliceRaw(t.start.offset,d):s===r.length-1?u.sliceRaw(0,t.end.offset):u.text}).join(n)}function jt(t,e){return {start:{paragraph:e.paragraph(t.start.paragraphId,t.start.story),offset:t.start.offset},end:{paragraph:e.paragraph(t.end.paragraphId,t.end.story),offset:t.end.offset}}}var hl=new Set(["TextBox","GeometricShape","Picture","Group","Canvas","Unsupported"]),Mt=(t,e,n)=>({ok:false,error:{code:t,message:e,...n===void 0?{}:{detail:n}}}),uo=t=>({ok:true,kind:"query",value:t});function yl(t,e,n){let o=e.resolve(t,"shape");if(!o||o.kind!=="shape")return Mt("invalid-handle","that handle does not name a shape","shape");let r=n.shapes(o.owner);if(!r.ok)return Mt("ambiguous-document","shape identities in that story are not completely and unambiguously enumerable",r.reason);let a=r.shapes.find(s=>s.id===o.shapeId);return a?{owner:o.owner,shape:a}:Mt("invalid-handle","that shape is not in this document",G(o.owner))}function Ca(t,e,n){if(t.op==="getShapes"){let a=t.types;if(a!==void 0&&(!Array.isArray(a)||a.some(p=>!hl.has(p))))return Mt("unsupported-content","unknown shape type","types");if(!("body"in t.span)&&!("paragraph"in t.span))return Mt("unsupported-content","shapes are listed for a body or a paragraph only");let s=J(t.span,e,n),u=ot(t.span,e,n);if(!s.ok||!u.ok)return Mt("invalid-handle","that range no longer exists","span");let d=n.shapes(u.value.story);if(!d.ok)return Mt("ambiguous-document","shape identities in that story are not completely and unambiguously enumerable",d.reason);let c=new Set(s.value?At(s.value,u.value):[]);return uo({kind:"handles",handles:d.shapes.filter(p=>c.has(p.hostParagraphId)&&(!a||a.includes(p.type))).map(p=>e.shape(p.id,u.value.story))})}let o=yl(t.shape,e,n);if("ok"in o)return o;if(t.op==="getShape"){let{id:a,name:s,type:u}=o.shape;return uo({kind:"shape",shape:{id:a,name:s,type:u}})}if(!o.shape.textboxRoot)return Mt("unsupported-content","that shape holds no text story of its own",o.shape.type);if(!ro(o.owner))return Mt("unsupported-content","text boxes are reachable in the body, headers and footers only",G(o.owner));let r={kind:"textbox",owner:o.owner,shapeId:o.shape.id};return n.story(r)?uo({kind:"handle",handle:e.body(r)}):Mt("invalid-handle","that text box is not in this document",G(r))}var co="http://schemas.openxmlformats.org/package/2006/relationships",Ta="http://schemas.openxmlformats.org/officeDocument/2006/relationships",kl=[{type:"application/vnd.openxmlformats-package.core-properties+xml",namespace:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",root:"coreProperties",relationship:`${co}/metadata/core-properties`},{type:"application/vnd.openxmlformats-officedocument.extended-properties+xml",namespace:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",root:"Properties",relationship:`${Ta}/extended-properties`},{type:"application/vnd.openxmlformats-officedocument.custom-properties+xml",namespace:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",root:"Properties",relationship:`${Ta}/custom-properties`}];function po(t){let e=new Map;for(let o of kl){let r=[...new Set([...t.parts.keys(),...t.partBytes.keys()])].filter(d=>chunkFIJZIQXA_cjs.Ie(t,d)===o.type);if(r.length>1)return null;let a=(t.relationships.get("/")??[]).filter(d=>d.type===o.relationship);if(a.length>1)return null;let s=a[0];if(s){if(s.targetMode!=="Internal")return null;let d=chunkFIJZIQXA_cjs.B("/",s.rawTarget);if(!d.ok||r.length!==1||chunkFIJZIQXA_cjs.z(d.partName)!==chunkFIJZIQXA_cjs.z(r[0]))return null}if(r.length===0)continue;let u=t.parts.get(r[0]);if(!u||u.root.namespaceUri!==o.namespace||u.root.localName!==o.root||(t.relationships.get(u.name)?.length??0)>0||t.parts.has(chunkFIJZIQXA_cjs.Je(u.name))||t.partBytes.has(chunkFIJZIQXA_cjs.Je(u.name)))return null;e.set(chunkFIJZIQXA_cjs.z(u.name),{part:u,relationship:o.relationship});}if(e.size===0)return t;if(!chunkFIJZIQXA_cjs.Vd(t,new Set(e.keys())))return null;for(let[o,r]of t.relationships)for(let a of r){if(a.targetMode==="External")continue;let s=chunkFIJZIQXA_cjs.B(o,a.rawTarget),u=s.ok&&e.get(chunkFIJZIQXA_cjs.z(s.partName));if(!u)continue;if(o!=="/"||a.type!==u.relationship)return null;let d=t.parts.get(chunkFIJZIQXA_cjs.Je(o));if(!d||d.root.namespaceUri!==co||d.root.localName!=="Relationships")return null;let c=d.root.children.filter(f=>f.kind!=="textValue"&&f.attributes.some(x=>x.namespaceUri===""&&x.localName==="Id"&&x.value===a.id));if(c.length!==1)return null;let p=c[0];if(p.kind==="textValue"||p.namespaceUri!==co||p.localName!=="Relationship"||p.attributes.some(f=>f.namespaceUri!==""||!["Id","Type","Target","TargetMode"].includes(f.localName))||p.children.some(f=>f.kind!=="textValue"||!chunkFIJZIQXA_cjs.Ud(f.value)))return null}let n=t;for(let{part:o}of e.values()){let r=chunkFIJZIQXA_cjs.Me(n,o.name);if(!r.ok||r.pkg.contentTypes.overrides.has(chunkFIJZIQXA_cjs.z(o.name)))return null;n=r.pkg;}return n}var ke="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Pn="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",Fe="http://purl.org/dc/elements/1.1/",mo="application/vnd.openxmlformats-package.core-properties+xml",fo={author:[Fe,"creator"],title:[Fe,"title"],subject:[Fe,"subject"],comments:[Fe,"description"],keywords:[ke,"keywords"],category:[ke,"category"]},Na={...fo,lastAuthor:[ke,"lastModifiedBy"]},Ea=Object.keys(Na);function In(t){let e=(t.relationships.get("/")??[]).find(o=>o.type===Pn);if(!e||e.targetMode!=="Internal")return null;let n=chunkFIJZIQXA_cjs.B("/",e.rawTarget);return n.ok?t.parts.get(n.partName)??null:null}function La(t,e){let n=In(t),[o,r]=Na[e],a=n?.root.children.find(s=>s.kind!=="textValue"&&s.namespaceUri===o&&s.localName===r);return a&&a.kind!=="textValue"?a.children.map(s=>s.kind==="textValue"?s.value:"").join(""):""}function go(t){if(!t||typeof t!="object"||Array.isArray(t))return false;let e=Object.entries(t);return e.length>0&&e.every(([n,o])=>Object.hasOwn(fo,n)&&typeof o=="string"&&o.length<=4096&&chunkFIJZIQXA_cjs.T(o))}function ho(t,e){if(!go(e)||(t.relationships.get("/")??[]).filter(u=>u.type===Pn).length>1)return null;let n=In(t);if(n&&(n.contentType!==mo||n.root.namespaceUri!==ke||n.root.localName!=="coreProperties")||!n&&(t.relationships.get("/")??[]).some(u=>u.type===Pn))return null;let o=n?.name??"/docProps/core.xml";if(!n&&(t.parts.has(o)||t.partBytes.has(o)))return null;let r=chunkFIJZIQXA_cjs.Ia(`<cp:coreProperties xmlns:cp="${ke}" xmlns:dc="${Fe}">${Object.entries(e).map(([u,d])=>{let[c,p]=fo[u],f=c===ke?"cp":"dc";return `<${f}:${p}>${chunkFIJZIQXA_cjs.R(d)}</${f}:${p}>`}).join("")}</cp:coreProperties>`,{name:o,contentType:mo});if(!r.ok)return null;if(n){let u=n,d=chunkFIJZIQXA_cjs.Ra(n),c=p=>p.kind==="textValue"?{...p,id:d()}:{...p,id:d(),children:p.children.map(c)};for(let p of r.part.root.children){if(p.kind==="textValue")continue;let f=u.root.children.filter(A=>A.kind!=="textValue"&&A.namespaceUri===p.namespaceUri&&A.localName===p.localName);if(f.length>1)return null;let x=f[0],g;if(x&&x.kind!=="textValue"){if(x.children.some(w=>w.kind!=="textValue"))return null;let A=x.children.length===1&&x.children[0]?.kind==="textValue"?x.children[0]:null,v=p.children.find(w=>w.kind==="textValue"),I=A&&v?.kind==="textValue"?[{...A,value:v.value}]:p.children.map(c);g=chunkFIJZIQXA_cjs.Za(u,x.id,{...x,children:I});}else {let A=Array.from(u.root.children);A.push(c(p)),g=chunkFIJZIQXA_cjs.Xa(u,u.root.id,A);}if(!g.ok)return null;u=g.part;}return chunkFIJZIQXA_cjs.Fe(t,u)}let a=chunkFIJZIQXA_cjs.Pe(t,o,r.part.root,mo);if(!a.parts.has(o))return null;let s=chunkFIJZIQXA_cjs.Oe(a,"/",Pn,o.slice(1));return s.ok?s.pkg:null}function Ma(t,e,n,o=true){let r=u=>({ok:false,error:{code:"unsupported-content",message:u}});if(!e.package)return r("document unavailable");if(t.op==="getDocumentProperty")return Ea.includes(t.name)?{ok:true,kind:"query",value:{kind:"text",text:La(e.package,t.name)}}:r("unsupported document property");if(t.op==="removeDocumentInformation"){if(t.removeDocInfoType!=="DocumentProperties"||!o)return {ok:false,error:{code:"unsupported-capability",message:"Only direct DocumentProperties removal outside collaboration is supported."}};if(!po(e.package))return {ok:false,error:{code:"unsupported-capability",message:"Document property parts have unsupported structure or dependencies."}};let u=n();return u||{ok:true,kind:"command",story:Ct,ops:[],packageEdits:[d=>{let c=po(d);if(!c)throw new Error("Document property parts changed");return c}],answer:()=>({kind:"applied"})}}if(!go(t.values))return r("invalid document property values");if(!o&&!In(e.package))return {ok:false,error:{code:"unsupported-capability",message:"Create document properties before joining collaboration; concurrent core-part creation cannot merge safely."}};let a={...t.values};if(!ho(e.package,a))return {ok:false,error:{code:"unsupported-capability",message:"the core properties part cannot be updated safely"}};let s=n();return s||{ok:true,kind:"command",story:Ct,ops:[],packageEdits:[u=>{let d=ho(u,a);if(!d)throw new Error("Document properties package changed");return d}],answer:()=>({kind:"applied"})}}function Ha(t,e){let n=[],o=new Set,r=a=>{if(a.kind!=="textValue"){if(a.namespaceUri===chunkFIJZIQXA_cjs.la&&a.localName===`${e}Reference`){let s=chunkFIJZIQXA_cjs.yc(a)??Number.NaN;o.has(s)||(n.push(s),o.add(s));}for(let s of a.children)r(s);}};return r(t),n}var Fa={},Da=new WeakMap;function Ba(t,e=null,n="all-markup",o){let r=t??Fa,a=Da.get(r);a||Da.set(r,a=new WeakMap);let s=e??Fa,u=a.get(s);u||a.set(s,u=xl(t,e));let d=u;return (c,p,f,x,g=n,A=o)=>d(c,p,f,x,g,A)}function xl(t,e){let n=chunk4GBTELJV_cjs.hd(t,void 0,e),o=kn(n),r=new WeakMap;return (a,s,u,d,c="all-markup",p)=>{let f=o(d,a,c,p),x=r.get(a);if(!x||x.cellStyle!==f){let w=chunk4GBTELJV_cjs.id(n,chunkFIJZIQXA_cjs.Bh(a,"paragraphProperties","pPr"),f);x={cellStyle:f,inherited:w},r.set(a,x);}let{inherited:g}=x,A=u?g.markRunProperties:chunk4GBTELJV_cjs.ld(g.runProperties,chunk4GBTELJV_cjs.kb(s),n),v=false,I=false;for(let w of A){if(w.localName!=="rtl"&&w.localName!=="cs")continue;let O=w.attributes?.val,H=O===void 0||["1","true","on"].includes(O);w.localName==="rtl"?v=H:I=H;}return v||I}}function ja(t,e=()=>null,n=()=>"all-markup",o=()=>{}){return {runPropertyEdits(...r){return chunkFIJZIQXA_cjs.Qh(r[0],r[1],r[2],r[3],r[4],r[5],r[6],Ba(t(),e(),n(),o()))},mergedParagraphMarkProperties(...r){return chunkFIJZIQXA_cjs.Lh(r[0],r[1],r[2],Ba(t(),e(),n(),o()))}}}var _t=chunkFIJZIQXA_cjs.kh,Gt=/[\r\n\f\u2028\u2029]/;function xe(t,e,n){return n.length?[{op:"insertText",paragraphId:t,offset:e,text:n}]:[]}function yo(t){return t.replaceAll(_t,`
|
|
5
|
-
`)}var bl={ok:false,error:{code:"unsupported-content",message:"a single-line control cannot hold a line break",detail:"line-break-in-single-line-control"}};function Al(t,e){return e.includes(_t)&&!chunkFIJZIQXA_cjs.lh(chunkFIJZIQXA_cjs.Zb(t))?bl:null}function Xt(t,e,n,o,r=_t){if(!r.includes(_t))return null;let a=chunkFIJZIQXA_cjs.Ta(t,e);if(!chunkFIJZIQXA_cjs.gg(a))return null;let s=chunkFIJZIQXA_cjs.vk(t,a,n,o);return s?Al(s,r):null}function Rn(t){return t.replaceAll(`
|
|
6
|
-
`,_t)}function _a(t,e){let n=t.rawText(e)??"",o=t.node(e);return o?.kind==="paragraph"?chunkFIJZIQXA_cjs.Yi(o,n):n}function vl(t){return t?.kind!=="paragraph"?false:t.children.every(e=>e.namespaceUri!==chunkFIJZIQXA_cjs.la?false:e.localName==="pPr"?true:e.kind==="run"&&e.children.every(n=>n.namespaceUri===chunkFIJZIQXA_cjs.la&&(n.localName==="rPr"||n.localName==="t"&&n.children.every(o=>o.kind==="textValue"))))}function ko(t,e,n){return vl(chunkFIJZIQXA_cjs.Ta(t,e))&&chunkFIJZIQXA_cjs.tk(t,e,n)===null}function Va(t,e,n,o){let r=chunkFIJZIQXA_cjs.tk(t,e,n);if(!r)return null;let a=n===r.offset?chunkFIJZIQXA_cjs.el(t,{op:"insertText",paragraphId:e,offset:n,text:o}):null;return a?.ok&&chunkFIJZIQXA_cjs.Vi(a.part,e)?.slice(n,n+o.length)===yo(o)?null:{ok:false,error:{code:"unsupported-capability",message:"insert at the placeholder start or replace the complete prompt",detail:"placeholder-insertion-offset"}}}function Ol(t,e,n){return t.start===t.end?e<t.start&&t.start<n:e===n?t.start<e&&e<t.end:Math.max(t.start,e)<Math.min(t.end,n)}var Sn=class{#t=new Map;has(e){return this.#t.has(e)}append(e,n,o,r,a=false){let s=this.#t.get(e)??[];if(s.some(f=>Ol(f,n,o)))return null;let u=n,d=o;for(let f of s){let x=f.length-(f.end-f.start);f.end<=n&&!(a&&f.start===n&&f.end===n)&&(u+=x),(f.end<o||f.end===o&&f.start!==f.end)&&(d+=x);}n===o&&(d=u);let c=r-(o-n);for(let f of s)o<=f.start&&!(n===o&&f.start===f.end&&n===f.start&&!a)&&(f.result.start+=c,f.result.end+=c);let p={start:u,end:u+r};return s.push({start:n,end:o,length:r,result:p}),this.#t.set(e,s),{start:u,end:d,result:p}}};function Ua(t,e,n,o,r=false){let a=e.start.paragraphId,s=t.append(a,e.start.offset,e.end.offset,n.length,r);return s?{ok:true,kind:"command",ops:Wa(a,s.start,s.end,n),story:e.start.story,answer:()=>({kind:"span",span:jt({start:{...e.start,offset:s.result.start},end:{...e.start,offset:s.result.end}},o)})}:{ok:false,error:{code:"conflicting-operations",message:"text edits overlap in the batch snapshot",detail:a}}}function Wa(t,e,n,o){let r=[];return o.length&&r.push({op:"insertText",paragraphId:t,offset:e,text:o,...n>e?{bias:"right"}:{}}),n>e&&r.push({op:"deleteText",paragraphId:t,start:e+o.length,end:n+o.length}),r}function $a(t,e,n,o){let r=e.start.paragraphId,a=chunkFIJZIQXA_cjs.Vi(t,r),s=chunkFIJZIQXA_cjs.tk(t,r,e.start.offset),u=s&&n.length?[{op:"insertText",paragraphId:r,offset:e.start.offset,text:n,bias:"right"}]:Wa(r,e.start.offset,e.end.offset,n),d=t;for(let p of u){let f=chunkFIJZIQXA_cjs.el(d,p);if(!f.ok)return {ok:false,error:{code:"unsupported-content",message:"that replacement cannot preserve the targeted text safely",detail:f.reason}};d=f.part;}let c=chunkFIJZIQXA_cjs.Vi(d,r);return a===null||c!==a.slice(0,e.start.offset)+yo(n)+a.slice(e.end.offset)?{ok:false,error:{code:s?"unsupported-capability":"unsupported-content",message:s?"replace the complete placeholder prompt to avoid consuming unrelated text":"that replacement changes the expected text positions",detail:r}}:{ok:true,kind:"command",ops:u,story:e.start.story,answer:()=>({kind:"span",span:jt({start:e.start,end:{...e.start,offset:e.start.offset+n.length}},o)})}}function za(t,e,n){let o=_a(t,e);return {text:o,occurrences:Pl(o,n)}}var Ka=/\s/;function Pl(t,e){let n=[],o=0;for(;o<t.length;){let r=null;for(let a of e){let s=Rn(a),u=t.indexOf(s,o);u<0||(!r||u<r.start||u===r.start&&s.length>r.length)&&(r={start:u,length:s.length});}if(!r)break;n.push(r),o=r.start+r.length;}return n}function Ga(t,e,n){let o=e[n]?.markParagraphId??null;if(o!==null)return o;let r=t.paragraphIds,a=r[r.length-1];return a===void 0||new Set(e.map(u=>u.markParagraphId).filter(u=>u!==null)).has(a)?null:a}function Xa(t,e){for(let n of [t.start,t.end]){let o=e.rawText(n.paragraphId);if(o===null||n.offset>o.length)return false}return true}function Ya(t,e,n){let o=e,r=n;for(;o<r&&Ka.test(t[o]);)o+=1;for(;r>o&&Ka.test(t[r-1]);)r-=1;return [o,r]}function be(t){let e=t.kind==="contentControl"?chunkFIJZIQXA_cjs.Xb(t):t;return e?chunkFIJZIQXA_cjs.$b(e).map(n=>n.node):[]}var Ja=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),Qa=new Set(["whole","content","start","end","before","after"]),Za=new Set(["richText","plainText","dropDownList","comboBox","date"]),Il=4096;function qa(t,e,n){let{type:o}=t;return ["richText","plainText","comboBox","untyped"].includes(o)?typeof e!="string"?{code:"unsupported-content",message:"text is required",detail:"text"}:e.includes(chunkFIJZIQXA_cjs.kh)&&!chunkFIJZIQXA_cjs.lh(t)?{code:"unsupported-content",message:"a single-line control cannot hold a line break",detail:"line-break-in-single-line-control"}:n!=="replace"&&n!=="start"&&n!=="end"?{code:"unsupported-content",message:"that is not a place to insert at",detail:String(n)}:null:{code:"unsupported-capability",message:"this control requires a typed value rather than a text insertion",detail:o}}function ti(t){let e=(r,a)=>({ok:false,code:"unsupported-content",message:r,detail:a});if(typeof t!="object"||t===null||!("kind"in t))return e("a control value states its kind","value");let n=t,o=n.kind;if(o==="text"||o==="listItem"){let r=o==="text"?n.text:n.value;return typeof r!="string"?e("that value is not a string",String(o)):r.length>Il?e("that value is too long",String(r.length)):{ok:true,value:o==="text"?{kind:"text",text:r}:{kind:"listItem",value:r}}}if(o==="checkbox"){let r=n.checked;return typeof r!="boolean"?e("a checkbox is checked or not","checked"):{ok:true,value:{kind:"checkbox",checked:r}}}if(o==="date"){let r=n.iso;return typeof r!="string"?e("a date is an ISO-8601 string","iso"):r.length>64?e("that is not a date",String(r.length)):{ok:true,value:{kind:"date",iso:r}}}return e("that is not a value any control accepts",String(o))}function wn(t,e,n){return {code:t,message:e,detail:n}}function ei(t,e=false){if(typeof t.author!="string"||!t.author.trim()||!chunkFIJZIQXA_cjs.T(t.author))return wn("unsupported-content","proposals need a non-empty XML-safe author","author");let n=t.op==="proposeInsertion";return !(t.op==="proposeDeletion")&&(typeof t.text!="string"||!e&&!t.text.length||Gt.test(t.text)||!chunkFIJZIQXA_cjs.mh(t.text))?wn("unsupported-content","proposals need non-empty inline XML-safe text","text"):n&&t.where!=="Before"&&t.where!=="After"?wn("unsupported-content","insertion needs Before or After","where"):null}function Ae(t,e,n,o,r,a=false,s){let u=chunkFIJZIQXA_cjs.ek(t.part),d=new Set;if(u.some(p=>p.revisionKind==="structural"))for(let p=chunkFIJZIQXA_cjs.Ua(t.part,e);p!==null&&(d.add(p.id),p.id!==t.root.id);p=chunkFIJZIQXA_cjs.Ua(t.part,p.id));return u.some(p=>{if(r&&p.author===r&&(["insert","paragraphMark","format"].includes(p.revisionKind)||a&&["delete","replace"].includes(p.revisionKind)))return false;if(p.revisionKind==="structural"){let x=chunkFIJZIQXA_cjs.wj(p),g=0;for(let A of x){let v=chunkFIJZIQXA_cjs.Ua(t.part,A),I=v&&chunkFIJZIQXA_cjs.Ua(t.part,v.id),w=I?.kind==="tableRow"?"trPr":I?.kind==="tableCell"?"tcPr":null;if(!(!I||!w||chunkFIJZIQXA_cjs.eg(I,w)?.id!==v?.id)){if(d.has(I.id))return true;g+=1;}}if(x.length>0&&g===x.length)return false}let f=s!==void 0&&p.author===s;return p.ranges.some(x=>{let g=t.indexOf(x.start.paragraphId),A=t.indexOf(x.end.paragraphId),v=t.indexOf(e);if(g<0||A<0||v<g||v>A)return false;let I=v===g?x.start.offset:0,w=v===A?x.end.offset:1/0;return n<w&&o>I?true:n>w||o<I?false:!f||n!==w?true:!(p.revisionKind==="insert"||p.revisionKind==="replace"||p.revisionKind==="paragraphMark"&&p.markDirection==="insert")})})?wn("unsupported-revision","proposal touches or overlaps a pending revision","span"):null}function ni(t,e,n,o,r,a){let s=!!o,u=(A,v,I)=>({ok:false,error:{code:A,message:v,...I?{detail:I}:{}}});if(s&&r===false)return u("unsupported-capability","tracked content-control creation is unsupported in collaboration");let d=J(t.span,e,n);if(!d.ok)return u(d.code,"that span is not a place",d.detail);if(!d.value)return u("invalid-offset","that story holds nothing to wrap","empty-story");let c=ot(t.span,e,n),p=c.ok?c.value:null;if(!p)return u("invalid-handle","that story is not in this document");let f=d.value;if(f.start.paragraphId!==f.end.paragraphId)return u("unsupported-content","wrapping several paragraphs in one control is not supported here","multi-paragraph");if(!Za.has(t.subtype))return u("unsupported-content","that control type cannot be inserted",t.subtype);if(s){if(!chunkFIJZIQXA_cjs.uk(p.part,f.start.paragraphId,f.start.offset,f.end.offset))return u("unsupported-capability","tracked controls require a nonempty ordinary text range without existing review markup");let A=Ae(p,f.start.paragraphId,f.start.offset,f.end.offset);if(A)return {ok:false,error:A}}let x=new Set(be(p.root).map(A=>A.id)),g=a(p,f.start.paragraphId);return g||{ok:true,kind:"command",story:p.story,ops:[{op:"insertContentControl",paragraphId:f.start.paragraphId,start:f.start.offset,end:f.end.offset,type:t.subtype,...s?{revision:{author:o,date:new Date().toISOString()}}:{},...t.tag===void 0?{}:{tag:t.tag},...t.title===void 0?{}:{alias:t.title}}],answer:A=>{if(!t.returnHandle)return {kind:"applied"};let v=A.story(p.story),I=v&&be(v.root).find(w=>!x.has(w.id));if(!I)throw new Error("content control insertion did not create a control");return {kind:"handle",handle:e.contentControl(I.id,p.story)}}}}function oi(t,e,n){let o=chunkFIJZIQXA_cjs.Ta(t,e);if(!o||o.kind!=="contentControl")return false;let r=s=>s.kind==="textValue"||!s.kind.startsWith("revision")&&!s.localName.endsWith("Change")&&s.children.every(r);if(!r(o))return false;let a=chunkFIJZIQXA_cjs.Ua(t,e);return a?.kind==="revisionInsert"&&a.attributes.some(s=>s.namespaceUri===chunkFIJZIQXA_cjs.la&&s.localName==="author"&&s.value===n)}function ri(t){if(t.length>128)return null;let e=t.trim(),n=new Set,o=[];for(;e;){let r=/^\\([ohzu])(?:\s+"([1-9])-([1-9])")?(?=\s|$)/.exec(e);if(!r)return null;let[,a,s,u]=r;if(n.has(a)||(a==="o"?!s||Number(s)>Number(u):s))return null;n.add(a),o.push(r[0]),e=e.slice(r[0].length).trimStart();}return ["TOC",...o].join(" ")}function Cn(t,e){let n=chunkFIJZIQXA_cjs.Ta(t,e);if(!n||n.kind!=="paragraph")return [];let o=chunkFIJZIQXA_cjs.hg(n);return chunkFIJZIQXA_cjs.Zk(n).flatMap(r=>{let a=o.find(u=>u.node.id===r.fieldNodeId),s=chunkFIJZIQXA_cjs.Ta(t,r.fieldNodeId);return a?[{paragraphId:e,fieldNodeId:r.fieldNodeId,code:r.instruction,start:a.start,end:a.end,rewritable:r.rewritable,locked:!!s&&chunkFIJZIQXA_cjs.yf(s,"fldLock")===true}]:[]})}function ai(t){let e=chunkFIJZIQXA_cjs.S(t),n=chunkFIJZIQXA_cjs.Ia(`<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:fldSimple w:instr="${e}"><w:r><w:t/></w:r></w:fldSimple></w:p></w:body></w:document>`,{name:"/word/document.xml",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"});if(!n.ok)throw new Error("could not build a field");let o=n.part.root.children.find(a=>a.kind==="body"),r=o&&chunkFIJZIQXA_cjs.Rc(o)[0];if(!r||r.kind!=="paragraph")throw new Error("could not build a field paragraph");return r}var yt=(t,e="unsupported-content")=>({ok:false,error:{code:e,message:t}});function ii(t,e,n,o,r){if(t.op==="getFields"||t.op==="insertField"){let p=J(t.span,e,n),f=ot(t.span,e,n);if(!p.ok||!f.ok)return yt("that field range no longer exists","invalid-handle");let x=f.value;if(t.op==="getFields")return {ok:true,kind:"query",value:{kind:"handles",handles:ne(p.value,x).flatMap(N=>Cn(x.part,N.paragraphId).filter(E=>E.start>=N.start&&E.end<=N.end)).map(N=>e.field(N.paragraphId,N.fieldNodeId,x.story))}};if(!p.value)return yt("insert a paragraph before inserting a field");if(t.removeFormatting!==void 0&&t.removeFormatting!==false)return yt("removeFormatting is not supported");if(t.text!==void 0&&typeof t.text!="string")return yt("field text must be a string");if(t.fieldType!==void 0&&typeof t.fieldType!="string")return yt("field type must be a string");let g=t.fieldType??"Empty",A=null;if(g==="Page"||g==="NumPages"){if(t.text!==void 0&&t.text.trim()!=="")return yt("field switches are not supported");A=g==="Page"?"PAGE":"NUMPAGES";}else g==="TOC"?A=ri(t.text??""):g==="Empty"&&(A=chunkFIJZIQXA_cjs.al(t.text??""));if(!A)return yt("only PAGE, NUMPAGES, and TOC with supported switches can be inserted");let{start:v,end:I}=p.value;if(!["Before","After","Start","End","Replace"].includes(t.location))return yt("unsupported field insert location");if(t.location==="Replace"&&v.paragraphId!==I.paragraphId)return yt("field replacement requires one paragraph");let w=t.location==="After"||t.location==="End"?I:v,O=o(x,w.paragraphId);if(O)return O;let H=[];return t.location==="Replace"&&I.offset>v.offset&&H.push({op:"deleteText",paragraphId:v.paragraphId,start:v.offset,end:I.offset}),H.push({op:"insertFragment",paragraphId:w.paragraphId,offset:w.offset,blocks:[ai(A)],lastMarkCovered:false}),{ok:true,kind:"command",story:x.story,ops:H,answer:M=>{let N=M.story(x.story)?.part,E=N&&Cn(N,w.paragraphId).find(R=>R.start===w.offset);if(!E)throw new Error("inserted field was not committed");return {kind:"handle",handle:e.field(w.paragraphId,E.fieldNodeId,x.story)}}}}let a=e.resolve(t.field,"field");if(!a||a.kind!=="field")return yt("that is not a field handle","invalid-handle");let s=n.story(a.story),u=s&&Cn(s.part,a.paragraphId).find(p=>p.fieldNodeId===a.fieldNodeId);if(!s||!s.has(a.paragraphId)||!u)return yt("that field no longer exists","invalid-handle");if(t.op==="getField")return {ok:true,kind:"query",value:{kind:"field",field:{code:u.code}}};if(u.locked||chunkFIJZIQXA_cjs.Zf(s.part,a.fieldNodeId).content||chunkFIJZIQXA_cjs.ag(s.part,a.fieldNodeId))return yt("field is protected");let d=o(s,a.paragraphId,t.op==="updateFieldResult");if(d)return d;let c=[];if(t.op==="deleteField")c.push({op:"deleteText",paragraphId:a.paragraphId,start:u.start,end:u.end});else if(t.op==="setFieldCode"){if(!chunkFIJZIQXA_cjs.al(u.code)||!chunkFIJZIQXA_cjs.al(t.code))return yt("only PAGE and NUMPAGES code writes are supported");c.push({op:"setFieldCode",paragraphId:a.paragraphId,fieldNodeId:a.fieldNodeId,code:t.code});}else {let p=chunkFIJZIQXA_cjs.al(u.code);if(!p||!u.rewritable)return yt("this field result cannot be evaluated","unsupported-capability");let f=r?.(s.story,a.paragraphId,a.fieldNodeId);if(!f||!Number.isInteger(f.pageNumber)||f.pageNumber<1||!Number.isInteger(f.pageCount)||f.pageCount<1)return yt("field update requires actual semantic pagination","unsupported-capability");let x=p==="PAGE"?f.pageNumberText??String(f.pageNumber):String(f.pageCount);c.push({op:"refreshFieldResults",updates:[{paragraphId:a.paragraphId,fieldNodeId:a.fieldNodeId,text:x}]});}return {ok:true,kind:"command",story:s.story,ops:c,answer:()=>({kind:"applied"})}}var pt=(t,e)=>({ok:false,error:{code:t,message:e,detail:e}}),oe=t=>({ok:true,kind:"query",value:t}),Rl=new Set(["insertTableRows","getTables","getTable","getTableRows","getTableCells","getTableCell","getTableCellProperties","getTableCellBody","updateTable","updateTableCell","insertTable"]);function De(t){let e=new Set,n=[t];for(;n.length;){let o=n.pop();o.kind==="paragraph"&&e.add(o.id),o.kind!=="textValue"&&n.push(...o.children);}return e}function si(t,e){let n=De(t);return [...De(e)].filter(o=>!n.has(o)).length}function Sl(t,e){let n=[{node:t}];for(;n.length;){let{node:o,table:r}=n.pop();if(o.id===e)return r;if(o.kind==="textValue")continue;let a=o.kind==="table"?o:r;for(let s of o.children)n.push({node:s,table:a});}}function li(t){let e=t.package&&chunkFIJZIQXA_cjs.bd(t.package);return e?[...chunkFIJZIQXA_cjs.ad(e).values()].filter(n=>n.type==="table"):[]}function di(t,e){if(!Rl.has(t.op))return null;let{handles:n,reads:o}=e;if(t.op==="getTables"||t.op==="insertTable"){let f=t.op==="getTables"?t.scope:t.span,x=ot(f,n,o);if(!x.ok)return pt(x.code,x.detail);let g=J(f,n,o);if(!g.ok)return pt(g.code,g.detail);let A=x.value;if(t.op==="getTables"){let H=g.value,M=chunkFIJZIQXA_cjs.bj(A.root).filter(N=>{if("body"in f)return true;if(!H)return false;let E=[...De(N)].sort((z,$)=>A.indexOf(z)-A.indexOf($)),R=E[0],_=E[E.length-1];return !R||!_?false:A.indexOf(R)>=H.start.index&&A.indexOf(_)<=H.end.index});return oe({kind:"handles",handles:M.map(N=>n.table(N.id,A.story))})}if(!g.value)return pt("invalid-offset","empty-table-insertion-range");if(!["Before","After"].includes(t.location))return pt("unsupported-content","table-insertion-location");let v=t.location==="Before"?g.value.start:g.value.end,I=chunkFIJZIQXA_cjs.fj(A,v.paragraphId,v.offset,t.rowCount,t.columnCount,t.values,e.trackingAuthor?{author:e.trackingAuthor,date:new Date().toISOString()}:void 0);if(!I.ok)return pt("unsupported-content",I.reason);let w=e.admitWrite(A,si(A.part.root,I.resultPart.root),[v.paragraphId]);if(w)return w;let O=new Set(chunkFIJZIQXA_cjs.bj(A.root).map(H=>H.id));return {ok:true,kind:"command",story:A.story,ops:[{op:"authorTable",action:{kind:"insert",paragraphId:v.paragraphId,offset:v.offset,rowCount:t.rowCount,columnCount:t.columnCount,...t.values?{values:t.values}:{}},...e.trackingAuthor?{revision:{author:e.trackingAuthor,date:new Date().toISOString()}}:{}}],answer:H=>{let M=H.story(A.story),N=M&&chunkFIJZIQXA_cjs.bj(M.root).find(E=>!O.has(E.id));return N?{kind:"handle",handle:n.table(N.id,A.story)}:{kind:"applied"}}}}let r=t.op==="getTableCells"||t.op==="insertTableRows"?"tableRow":"cell"in t?"tableCell":"table",a=t.op==="getTableCells"||t.op==="insertTableRows"?t.row:"cell"in t?t.cell:"table"in t?t.table:{kind:"document",ref:""},s=n.resolve(a,r);if(!s||!("nodeId"in s)||!("story"in s))return pt("invalid-handle","unknown-table-object");let u=o.story(s.story);if(!u)return pt("invalid-handle","missing-table-story");let d=chunkFIJZIQXA_cjs.Ta(u.part,s.nodeId);if(!d||d.kind!==r)return pt("invalid-handle","deleted-table-object");let c=r==="table"?d:Sl(u.root,s.nodeId);if(!c)return pt("invalid-handle","missing-parent-table");let p=chunkFIJZIQXA_cjs.cj(u,c.id);if(!p)return pt("unsupported-content","unsupported-table-topology");switch(t.op){case "getTable":return oe({kind:"table",table:{values:p.values,headerRowCount:p.headerRowCount,rowCount:p.rowIds.length,columnCount:p.columnCount,style:li(o).find(f=>f.styleId===p.styleId)?.name??""}});case "getTableRows":return oe({kind:"handles",handles:p.rowIds.map(f=>n.tableRow(f,u.story))});case "getTableCells":{let f=p.rowIds.indexOf(s.nodeId);return oe({kind:"handles",handles:(p.cellIds[f]??[]).map(x=>n.tableCell(x,u.story))})}case "getTableCell":{if(!Number.isInteger(t.rowIndex)||!Number.isInteger(t.cellIndex))return pt("invalid-offset","invalid-cell-index");let f=p.cellIds[t.rowIndex]?.[t.cellIndex];return f?oe({kind:"handle",handle:n.tableCell(f,u.story)}):pt("invalid-handle","cell-not-found")}case "getTableCellBody":return oe({kind:"handle",handle:n.body(u.story,s.nodeId)});case "getTableCellProperties":{let f=chunkFIJZIQXA_cjs.dj(u,c.id,s.nodeId);return f?oe({kind:"tableCell",cell:{value:f.value,columnWidth:f.columnWidth,shadingColor:f.shadingColor,verticalAlignment:f.verticalAlignment}}):pt("invalid-handle","cell-not-found")}case "insertTableRows":case "updateTable":case "updateTableCell":{let f=t.op==="insertTableRows"?{kind:"insertRows",rowId:s.nodeId,location:t.location,count:t.count,...t.values?{values:t.values}:{}}:t.op==="updateTable"?t.mutation:{...t.properties,kind:"cell",cellId:s.nodeId};if(f.kind==="properties"&&f.styleId!==void 0){let I=f.styleId;if(typeof I!="string"||I.trim().length===0)return pt("unsupported-content","invalid-table-style-name");let w=li(o).find(O=>O.name?.trim().toLowerCase()===I.trim().toLowerCase());if(!w)return pt("unsupported-content","table-style-not-defined");f={...f,styleId:w.styleId};}let x=e.trackingAuthor?{author:e.trackingAuthor,date:new Date().toISOString()}:void 0;if(x&&e.trackedRangeReplacement===false&&(f.kind==="values"||f.kind==="cell"&&f.value!==void 0))return pt("unsupported-capability","tracked table value replacement is unsupported in collaboration");let g=chunkFIJZIQXA_cjs.ej(u,c.id,f,x);if(!g.ok)return pt(g.reason==="unsupported-revision"?"unsupported-revision":g.reason==="tracked-table-deletion-unsupported"||g.reason==="unsupported-tracked-table-operation"?"unsupported-capability":"unsupported-content",g.reason);let A=e.admitWrite(u,si(u.part.root,g.resultPart.root),f.kind==="values"?[...De(c)]:f.kind==="cell"&&f.value!==void 0?[...De(d)]:[]);if(A)return A;let v=new Set(p.rowIds);return {ok:true,kind:"command",story:u.story,ops:[{op:"authorTable",action:{kind:"existing",tableId:c.id,mutation:f},...x?{revision:x}:{}}],answer:I=>{if(f.kind!=="addRows"&&f.kind!=="insertRows")return {kind:"applied"};let w=I.story(u.story);return {kind:"handles",handles:((w&&chunkFIJZIQXA_cjs.cj(w,c.id))?.rowIds??[]).filter(H=>!v.has(H)).map(H=>n.tableRow(H,u.story))}}}}default:return pt("unsupported-content","unknown-table-operation")}}var Tn=t=>({ok:false,error:{code:"unsupported-content",message:t}});function xo(t){if(!(typeof t!="object"||t===null)){if("body"in t)return t.body;if("start"in t&&"end"in t)return xo(t.start)??xo(t.end)}}function wl(t){if(t.op==="getText")return t.target;if("body"in t)return t.body;let e=t;for(let n of ["span","scope","at","anchor","paragraph"]){let o=xo(e[n]);if(o)return o}}function ui(t,e){let n=chunkFIJZIQXA_cjs.Ng(t,{op:"createHeaderFooter",sectionIndex:e.sectionIndex,kind:e.kind,variant:e.variant,...e.variant==="first"?{titlePage:true}:{},...e.variant==="even"?{evenAndOddHeaders:true}:{}});return n.ok&&n.createdPartName?n:null}function Cl(t,e){let n=ui(t,e),o=n&&n.package.parts.get(n.createdPartName);if(!n||!o)return null;let r={...o.root,children:[]};return he(chunkFIJZIQXA_cjs.Fe(n.package,{...o,root:r}))}function ci(t,e,n){let o=wl(t);if(!o)return null;let r=e.handles.resolve(o,"body");if(!r||r.kind!=="body"||r.story.kind!=="header"&&r.story.kind!=="footer")return null;let a=r.story,s=e.reads.package;if(!s||e.reads.story(a))return null;if(!e.reads.sections()[a.sectionIndex])return Tn("that section no longer exists");if(t.op!=="insertText"&&t.op!=="replaceSpan"&&t.op!=="insertParagraph"){let c=Cl(s,a);if(!c)return Tn("cannot read this header or footer");let p=n(c).plan(t);return !p.ok||p.kind==="query"?p:p.kind!=="command"||p.ops.length||p.lifecycle||p.packageEdits?.length||p.relate?Tn("this header or footer does not exist yet; write text to create it"):{ok:true,kind:"query",value:p.answer(c)}}let u=c=>{let p=ui(c,a);if(!p)return null;let f=he(p.package),x=n(f),g=x.plan(t);if(!g.ok||g.kind!=="command"||g.relate||g.lifecycle||g.packageEdits?.length)return null;let A=p.package.parts.get(p.createdPartName);if(!A)return null;for(let I of g.ops){let w=chunkFIJZIQXA_cjs.el(A,I);if(!w.ok)return null;A=w.part;}let v=chunkFIJZIQXA_cjs.Fe(p.package,A);return x.settle(he(v)).ok?{pkg:v,planner:x,step:g}:null},d=u(s);return d?{ok:true,kind:"command",story:{kind:"body"},ops:[],solitary:true,packageEdits:[c=>{let p=u(c);if(!p)throw new Error("header/footer creation changed during transaction");return d=p,p.pkg}],answer:c=>d.step.answer(c)}:Tn("cannot create this header or footer with that content")}var Tl=20*1024*1024;function Nl(t){if(typeof t!="string"||t.length===0||t.length>Math.ceil(Tl/3)*4||t.length%4!==0)return null;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=t.endsWith("==")?2:t.endsWith("=")?1:0,o=new Uint8Array(t.length/4*3-n),r=0;for(let a=0;a<t.length;a+=4){let s=a+4===t.length,u=s?4-n:4,d=[0,0,0,0];for(let p=0;p<u;p++){let f=e.indexOf(t[a+p]);if(f<0)return null;d[p]=f;}if(s&&(n===2&&(d[1]&15)!==0||n===1&&(d[2]&3)!==0))return null;let c=d[0]<<18|d[1]<<12|d[2]<<6|d[3];r<o.length&&(o[r++]=c>>>16),r<o.length&&(o[r++]=c>>>8),r<o.length&&(o[r++]=c);}return o}function pi(t,e,n,o,r){let a=Nl(r);if(!a)return {ok:false,detail:"picture: invalid or oversized base64 (20 MiB maximum)"};let s=chunkFIJZIQXA_cjs.de(a);if(s!=="image/png"&&s!=="image/jpeg")return {ok:false,detail:"picture: only PNG and JPEG are supported"};if(!El(a,s))return {ok:false,detail:"picture: truncated raster container"};let u=chunkFIJZIQXA_cjs.ie(a,s);if(!u||u.pixelWidth*u.pixelHeight>4e7)return {ok:false,detail:"picture: invalid or oversized raster dimensions"};let d=u.pixelWidth*72/(u.dpiX??96),c=u.pixelHeight*72/(u.dpiY??96),p=chunkFIJZIQXA_cjs.we(d),f=chunkFIJZIQXA_cjs.we(c);if(p===null||f===null)return {ok:false,detail:"picture: invalid physical dimensions"};let x=chunkFIJZIQXA_cjs.te(t,e,{bytes:a,mime:s});if(!x.ok)return {ok:false,detail:`picture: ${x.reason}`};let g=chunkFIJZIQXA_cjs.xe({docPrId:x.docPrId,lockAspectRatio:true,relationshipId:x.relationshipId,extentEmu:{cx:p,cy:f}});return {ok:true,docPrId:x.docPrId,ops:[{op:"insertDrawing",paragraphId:n,offset:o,drawing:g}],packageEdits:[A=>{let v=chunkFIJZIQXA_cjs.te(A,e,{bytes:a,mime:s});if(!v.ok||v.relationshipId!==x.relationshipId||v.docPrId!==x.docPrId||v.partName!==x.partName)throw new Error("picture allocation changed during the batch");return v.pkg}]}}function mi(t,e){return chunkFIJZIQXA_cjs.Od(t).find(n=>n.drawingNodeId===e&&n.kind==="inline"&&n.picture!==null)??null}function fi(t){return {width:t.extentEmu.cx/chunkFIJZIQXA_cjs.ve,height:t.extentEmu.cy/chunkFIJZIQXA_cjs.ve,lockAspectRatio:t.locks.changeAspect,altTextDescription:t.description}}function gi(t,e){let n=new Set(chunkFIJZIQXA_cjs.Od(t).filter(r=>r.kind==="inline"&&r.picture!==null).map(r=>r.drawingNodeId)),o=[];for(let r of e){let a=chunkFIJZIQXA_cjs.Ta(t,r.paragraphId);if(!(!a||a.kind!=="paragraph"))for(let s of chunkFIJZIQXA_cjs.hg(a))s.start>=r.start&&s.end<=r.end&&n.has(s.node.id)&&o.push(s.node.id);}return o}function hi(t,e){let n=[],o=t.drawingNodeId;if(e.lockAspectRatio!==void 0&&typeof e.lockAspectRatio!="boolean")return {ok:false,detail:"lockAspectRatio: not a boolean"};let r=e.lockAspectRatio??t.locks.changeAspect;if(e.lockAspectRatio===false&&n.push({op:"setDrawingLocks",drawingNodeId:o,locks:{changeAspect:false}}),e.width!==void 0||e.height!==void 0){let a=e.width??t.extentEmu.cx/chunkFIJZIQXA_cjs.ve,s=e.height??t.extentEmu.cy/chunkFIJZIQXA_cjs.ve;if(r){let c=t.extentEmu.cx/t.extentEmu.cy;if(e.width!==void 0&&e.height!==void 0&&Math.abs(a/s-c)>1e-6)return {ok:false,detail:"picture: width and height disagree with the locked aspect ratio"};e.width!==void 0&&e.height===void 0&&(s=a/c),e.height!==void 0&&e.width===void 0&&(a=s*c);}let u=chunkFIJZIQXA_cjs.we(a),d=chunkFIJZIQXA_cjs.we(s);if(u===null||d===null)return {ok:false,detail:"picture: dimensions must be finite positive points"};n.push({op:"resizeDrawing",drawingNodeId:o,extentEmu:{cx:u,cy:d}});}if(e.lockAspectRatio===true&&n.push({op:"setDrawingLocks",drawingNodeId:o,locks:{changeAspect:true}}),e.altTextDescription!==void 0){if(typeof e.altTextDescription!="string"||e.altTextDescription.length>32767||!chunkFIJZIQXA_cjs.T(e.altTextDescription))return {ok:false,detail:"altTextDescription: invalid XML text or length"};n.push({op:"setDrawingMetadata",drawingNodeId:o,title:t.title,description:e.altTextDescription});}return n.length?{ok:true,ops:n}:{ok:false,detail:"picture: no properties requested"}}function El(t,e){if(e==="image/jpeg")return t.length>=4&&t[t.length-2]===255&&t[t.length-1]===217;let n=new DataView(t.buffer,t.byteOffset,t.byteLength),o=8,r=false;for(;o+12<=t.length;){let a=n.getUint32(o);if(a>t.length-o-12)return false;let s=String.fromCharCode(t[o+4],t[o+5],t[o+6],t[o+7]);if(s==="IDAT"&&a>0&&(r=true),o+=a+12,s==="IEND")return r&&a===0&&o===t.length}return false}var Et=(t,e="unsupported-content")=>({ok:false,error:{code:e,message:t}});function yi(t,e,n,o){if(t.op==="getInlinePictures"||t.op==="insertInlinePicture"){let p=J(t.span,e,n),f=ot(t.span,e,n);if(!p.ok||!f.ok)return Et("that picture range no longer exists","invalid-handle");let x=f.value;if(t.op==="getInlinePictures")return {ok:true,kind:"query",value:{kind:"handles",handles:gi(x.part,ne(p.value,x)).map(M=>e.inlinePicture(M,x.story))}};if(!p.value||!n.package)return Et("insert a paragraph before inserting a picture");let{start:g,end:A}=p.value;if(!["Before","After","Start","End","Replace"].includes(t.location))return Et("unsupported picture insert location");if(t.location==="Replace"&&g.paragraphId!==A.paragraphId)return Et("picture replacement requires a single paragraph");let v=t.location==="After"||t.location==="End"?A:g;if(chunkFIJZIQXA_cjs.Zf(x.part,v.paragraphId).content||chunkFIJZIQXA_cjs.ag(x.part,v.paragraphId))return Et("picture insertion is inside protected content");let I=chunkFIJZIQXA_cjs.Ta(x.part,v.paragraphId);if(I?.kind==="paragraph"){for(let M of chunkFIJZIQXA_cjs.hg(I))if((t.location==="Replace"?M.start<A.offset&&M.end>g.offset:M.start<v.offset&&M.end>v.offset)&&(chunkFIJZIQXA_cjs.Zf(x.part,M.node.id).content||chunkFIJZIQXA_cjs.ag(x.part,M.node.id)))return Et("picture insertion touches protected content")}let w=o(x,v.paragraphId);if(w)return w;let O=pi(n.package,x.part.name,v.paragraphId,v.offset,t.base64);if(!O.ok)return Et(O.detail);let H=[];return t.location==="Replace"&&A.offset>g.offset&&H.push({op:"deleteText",paragraphId:g.paragraphId,start:g.offset,end:A.offset}),H.push(...O.ops),{ok:true,kind:"command",story:x.story,ops:H,packageEdits:O.packageEdits,answer:M=>{let N=M.story(x.story)?.part,E=N&&chunkFIJZIQXA_cjs.Od(N).find(R=>R.docPrId===O.docPrId&&R.kind==="inline");if(!E)throw new Error("inserted picture was not committed");return {kind:"handle",handle:e.inlinePicture(E.drawingNodeId,x.story)}}}}let r=e.resolve(t.picture,"inlinePicture");if(!r||r.kind!=="inlinePicture")return Et("that is not a picture handle","invalid-handle");let a=n.story(r.story),s=a&&mi(a.part,r.drawingNodeId);if(!a||!s)return Et("that inline picture no longer exists","invalid-handle");if(t.op==="getInlinePicture")return {ok:true,kind:"query",value:{kind:"inlinePicture",picture:fi(s)}};let u=chunkFIJZIQXA_cjs.Ta(a.part,r.drawingNodeId);for(;u&&u.kind!=="paragraph";)u=chunkFIJZIQXA_cjs.fg(a.part,u.id);if(!u||!a.has(u.id))return Et("picture is outside this story","invalid-handle");let d=o(a,u.id);if(d)return d;let c=t.op==="deleteInlinePicture"?{ok:true,ops:[{op:"deleteDrawing",drawingNodeId:r.drawingNodeId}]}:hi(s,t.properties);return c.ok?{ok:true,kind:"command",story:a.story,ops:c.ops,answer:()=>({kind:"applied"})}:Et(c.detail)}function ki(t,e,n,o){let r=x=>({ok:false,error:{code:"unsupported-content",message:x}});if(t.breakType!=="Page"&&t.breakType!=="SectionNext")return r("only Line, Page, and SectionNext breaks are supported");if(!["Before","After","Start","End","Replace"].includes(t.location))return r("invalid break insertion location");let a=J(t.span,e,n);if(!a.ok)return {ok:false,error:{code:a.code,message:a.detail}};let s=a.value;if(!s)return r("empty story has no break position");let u=t.location==="After"||t.location==="End"?s.end:s.start,d=n.story(u.story);if(!d)return r("missing story");if(t.location==="Replace"&&s.start.paragraphId!==s.end.paragraphId)return r("break replacement must remain in one paragraph");let c=t.breakType==="SectionNext";if(c&&(d.story.kind!=="body"||chunkFIJZIQXA_cjs.Fk(d.part,u.paragraphId)))return r("section breaks require a body paragraph outside a table");let p=o(d,u.paragraphId,c?1:0);if(p)return p;let f=[];return t.location==="Replace"&&s.end.offset>s.start.offset&&f.push({op:"deleteText",paragraphId:u.paragraphId,start:s.start.offset,end:s.end.offset}),c?f.push({op:"splitParagraph",paragraphId:u.paragraphId,offset:u.offset},{op:"setSectionMark",paragraphId:u.paragraphId,breakType:"nextPage"}):f.push({op:"insertPageBreak",paragraphId:u.paragraphId,offset:u.offset}),{ok:true,kind:"command",story:d.story,ops:f,answer:()=>({kind:"applied"})}}function xi(t,e){if(t.op!=="insertBreak"||t.breakType!=="Line")return null;let{span:n,location:o}=t,r=u=>"body"in n?{body:n.body,at:u}:"paragraph"in n?{paragraph:n.paragraph,at:u}:u==="start"?n.start:n.end,a=o==="Replace"?{op:"replaceSpan",span:n,text:_t}:o==="Before"||o==="Start"?{op:"insertText",at:r("start"),text:_t}:o==="After"||o==="End"?{op:"insertText",at:r("end"),text:_t}:null;if(!a)return {ok:false,error:{code:"unsupported-content",message:"invalid break insertion location"}};let s=e(a);return s.ok&&s.kind==="command"?{...s,answer:()=>({kind:"applied"})}:s}var Ht=(t,e)=>t.children.find(n=>n.kind!=="textValue"&&n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName===e),Lt=(t,e)=>t.attributes.find(n=>n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName===e)?.value,Nn=t=>t.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">"),bo=t=>typeof t=="string"&&t.length<=255&&!/[\x00-\x08\x0b\x0c\x0e-\x1f\uFFFE\uFFFF]/.test(t),bi={None:"none",Arabic:"decimal",UpperRoman:"upperRoman",LowerRoman:"lowerRoman",UpperLetter:"upperLetter",LowerLetter:"lowerLetter"},Ai={Solid:["\uF0B7","Symbol"],Hollow:["o","Courier New"],Square:["\uF0A7","Wingdings"],Diamonds:["\uF076","Wingdings"],Arrow:["\uF0D8","Wingdings"],Checkmark:["\uF0FC","Wingdings"]};function Ao(t){let e=chunkFIJZIQXA_cjs.Ag(t,"bullet");if(!e)return null;let n=e.pkg;for(let o=0;o<=8;o+=1)if(!Be(n,e.numId,o)){let r=En(n,e.numId,o,{bullet:o%3===0?"Solid":o%3===1?"Hollow":"Square"});if(!r)return null;n=r;}return {pkg:n,numId:e.numId}}function Be(t,e,n){let o=t.parts.get("/word/numbering.xml")?.root;if(!o)return false;let r=o.children,a=r.find(c=>c.kind!=="textValue"&&c.namespaceUri===chunkFIJZIQXA_cjs.la&&c.localName==="num"&&Lt(c,"numId")===e);if(!a)return false;let s=a.children.find(c=>c.kind!=="textValue"&&c.namespaceUri===chunkFIJZIQXA_cjs.la&&c.localName==="lvlOverride"&&Lt(c,"ilvl")===String(n));if(s&&Ht(s,"lvl"))return true;let u=Ht(a,"abstractNumId"),d=u&&r.find(c=>c.kind!=="textValue"&&c.namespaceUri===chunkFIJZIQXA_cjs.la&&c.localName==="abstractNum"&&Lt(c,"abstractNumId")===Lt(u,"val"));return !!d&&!Ht(d,"numStyleLink")&&d.children.some(c=>c.kind!=="textValue"&&c.namespaceUri===chunkFIJZIQXA_cjs.la&&c.localName==="lvl"&&Lt(c,"ilvl")===String(n))}function vo(t,e){if(!Number.isInteger(t)||t<0||t>8||!e||typeof e!="object")return false;if(e.bullet!==void 0){if(e.numbering!==void 0)return false;if(e.bullet==="Custom"){if(!Number.isInteger(e.charCode)||e.charCode<1||e.charCode>65535||e.charCode>=55296&&e.charCode<=57343||!bo(String.fromCharCode(e.charCode)))return false}else if(!Object.hasOwn(Ai,e.bullet))return false;if(e.fontName!==void 0&&(!bo(e.fontName)||!e.fontName.trim()))return false}if(e.numbering!==void 0&&!Object.hasOwn(bi,e.numbering)||e.formatString!==void 0&&(!Array.isArray(e.formatString)||e.formatString.length>32||e.formatString.some(o=>typeof o=="number"?!Number.isInteger(o)||o<0||o>t:!bo(o)||/%[1-9]/.test(o)))||e.startingNumber!==void 0&&(!Number.isInteger(e.startingNumber)||e.startingNumber<0||e.startingNumber>2147483647))return false;for(let o of [e.textIndent,e.bulletNumberPictureIndent])if(o!==void 0&&(!Number.isFinite(o)||Math.abs(o)>1584))return false;let n=["bullet","charCode","fontName","numbering","formatString","startingNumber","textIndent","bulletNumberPictureIndent"];return Object.keys(e).some(o=>!n.includes(o))||e.bullet===void 0&&(e.charCode!==void 0||e.fontName!==void 0)||e.numbering===void 0&&e.formatString!==void 0?false:Object.keys(e).length>0}function En(t,e,n,o){if(!vo(n,o))return null;let r=t.parts.get("/word/numbering.xml");if(!r)return null;let a=r.root.children.find(R=>R.kind!=="textValue"&&R.namespaceUri===chunkFIJZIQXA_cjs.la&&R.localName==="num"&&Lt(R,"numId")===e),s=a&&Ht(a,"abstractNumId");if(!a||!s)return null;let u=r.root.children.find(R=>R.kind!=="textValue"&&R.namespaceUri===chunkFIJZIQXA_cjs.la&&R.localName==="abstractNum"&&Lt(R,"abstractNumId")===Lt(s,"val"));if(!u||Ht(u,"numStyleLink"))return null;let d=a.children.find(R=>R.kind!=="textValue"&&R.namespaceUri===chunkFIJZIQXA_cjs.la&&R.localName==="lvlOverride"&&Lt(R,"ilvl")===String(n)),c=(d&&Ht(d,"lvl"))??u.children.find(R=>R.kind!=="textValue"&&R.namespaceUri===chunkFIJZIQXA_cjs.la&&R.localName==="lvl"&&Lt(R,"ilvl")===String(n));if(c&&Ht(c,"lvlPicBulletId"))return null;let p=chunkFIJZIQXA_cjs.Ra(r),f=R=>R.kind==="textValue"?{...R,id:p()}:{...R,id:p(),children:R.children.map(f)},x=R=>{let _=chunkFIJZIQXA_cjs.Ia(`<w:numbering xmlns:w="${chunkFIJZIQXA_cjs.la}">${R}</w:numbering>`,{name:r.name,contentType:r.contentType}),z=_.ok?_.part.root.children[0]:void 0;return z&&z.kind!=="textValue"?f(z):null};if(c??=x(`<w:lvl w:ilvl="${n}"><w:start w:val="1"/><w:numFmt w:val="decimal"/><w:lvlText w:val="%${n+1}."/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(n+1)}" w:hanging="360"/></w:pPr></w:lvl>`)??void 0,!c)return null;let g=[...c.children],A=["start","numFmt","lvlRestart","pStyle","isLgl","suff","lvlText","lvlPicBulletId","legacy","lvlJc","pPr","rPr"],v=(R,_)=>{let z=x(_);if(!z)return false;let $=g.findIndex(K=>K.kind!=="textValue"&&K.namespaceUri===chunkFIJZIQXA_cjs.la&&K.localName===R);if($>=0){let K=g[$];g.splice($,1,{...K,attributes:[...K.attributes.filter(Z=>!z.attributes.some(Q=>Q.namespaceUri===Z.namespaceUri&&Q.localName===Z.localName)),...z.attributes]});}else {let K=g.findIndex(Z=>Z.kind!=="textValue"&&Z.namespaceUri===chunkFIJZIQXA_cjs.la&&A.indexOf(Z.localName)>A.indexOf(R));g.splice(K<0?g.length:K,0,z);}return true};if(o.startingNumber!==void 0&&!v("start",`<w:start w:val="${o.startingNumber}"/>`))return null;if(o.numbering!==void 0){let R=o.formatString?.map(_=>typeof _=="number"?`%${_+1}`:_).join("")??(o.numbering==="None"?"":`%${n+1}.`);if(!v("numFmt",`<w:numFmt w:val="${bi[o.numbering]}"/>`)||!v("lvlText",`<w:lvlText w:val="${Nn(R)}"/>`))return null}if(o.numbering!==void 0&&(g=g.map(R=>R.kind!=="textValue"&&R.namespaceUri===chunkFIJZIQXA_cjs.la&&R.localName==="rPr"?{...R,children:R.children.filter(_=>_.kind==="textValue"||_.namespaceUri!==chunkFIJZIQXA_cjs.la||_.localName!=="rFonts")}:R)),o.bullet!==void 0){let[R,_]=o.bullet==="Custom"?[String.fromCharCode(o.charCode),o.fontName??"Symbol"]:Ai[o.bullet];if(!v("numFmt",'<w:numFmt w:val="bullet"/>')||!v("lvlText",`<w:lvlText w:val="${Nn(R)}"/>`))return null;let z=Ht(c,"rPr"),$=x(`<w:rFonts w:ascii="${Nn(_)}" w:hAnsi="${Nn(_)}"/>`);if(!$)return null;let K=z?.children.filter(at=>at.kind==="textValue"||at.namespaceUri!==chunkFIJZIQXA_cjs.la||at.localName!=="rFonts")??[],Z=z?{...z,children:[$,...K]}:x("<w:rPr/>");if(!Z)return null;let Q=g.findIndex(at=>at.kind!=="textValue"&&at.namespaceUri===chunkFIJZIQXA_cjs.la&&at.localName==="rPr");Q<0?g.push({...Z,children:[$,...K]}):g[Q]={...Z,children:[$,...K]};}if(o.textIndent!==void 0||o.bulletNumberPictureIndent!==void 0){let R=Ht(c,"pPr"),_=R&&Ht(R,"ind"),z=_?.attributes.filter(W=>W.namespaceUri!==chunkFIJZIQXA_cjs.la||!["left","start","firstLine","hanging"].includes(W.localName))??[],$=o.textIndent===void 0?String(chunkFIJZIQXA_cjs.nd(Lt(_??c,"left"))??0):String(Math.round(o.textIndent*20)),K=o.bulletNumberPictureIndent,Z=K===void 0?_?.attributes.filter(W=>W.namespaceUri===chunkFIJZIQXA_cjs.la&&["firstLine","hanging"].includes(W.localName))??[]:[],Q=x(`<w:ind w:left="${$}"${K===void 0?"":` w:${K<0?"hanging":"firstLine"}="${Math.abs(Math.round(K*20))}"`}/>`);if(!Q)return null;let at={...Q,attributes:[...z,...Z,...Q.attributes]},gt=R?.children.filter(W=>W.kind==="textValue"||W.namespaceUri!==chunkFIJZIQXA_cjs.la||W.localName!=="ind")??[],xt=R??x("<w:pPr/>");if(!xt)return null;let lt=_?R.children.indexOf(_):-1,dt=[...gt],Rt=["contextualSpacing","mirrorIndents","suppressOverlap","jc","textDirection","textAlignment","textboxTightWrap","outlineLvl","divId","cnfStyle","rPr","sectPr","pPrChange"],Ot=dt.findIndex(W=>W.kind!=="textValue"&&W.namespaceUri===chunkFIJZIQXA_cjs.la&&Rt.includes(W.localName));dt.splice(lt>=0?lt:Ot>=0?Ot:dt.length,0,at);let Vt={...xt,children:dt},U=g.findIndex(W=>W.kind!=="textValue"&&W.namespaceUri===chunkFIJZIQXA_cjs.la&&W.localName==="pPr");if(U>=0)g[U]=Vt;else {let W=g.findIndex(Pt=>Pt.kind!=="textValue"&&Pt.localName==="rPr"&&Pt.namespaceUri===chunkFIJZIQXA_cjs.la);g.splice(W<0?g.length:W,0,Vt);}}let I=f({...c,children:g}),w=d?.children.filter(R=>R.kind==="textValue"||R.namespaceUri!==chunkFIJZIQXA_cjs.la||R.localName!=="lvl"&&(o.startingNumber===void 0||R.localName!=="startOverride"))??[],O=d??x(`<w:lvlOverride w:ilvl="${n}"/>`);if(!O)return null;let H={...O,children:[...w,I]},M=[...a.children],N=d?M.indexOf(d):-1;N>=0?M[N]=H:M.push(H);let E=chunkFIJZIQXA_cjs.Za(r,a.id,{...a,children:M});return E.ok?chunkFIJZIQXA_cjs.Fe(t,E.part):null}function re(t,e){return t&&"children"in t?t.children.find(n=>n.kind!=="textValue"&&n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName===e):void 0}function Oo(t,e){return t&&"attributes"in t?t.attributes.find(n=>n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName===e)?.value:void 0}function vi(t,e,n,o){return e.length>0&&e.every(r=>{let a=re(chunkFIJZIQXA_cjs.Ta(t.part,r)??void 0,"pPr");if(Oo(re(re(a,"rPr"),"ins"),"author")===o)return true;let s=re(a,"pPrChange"),u=re(s,"pPr");return Oo(s,"author")===o&&Oo(re(re(u,"numPr"),"numId"),"val")!==n})}var ve=8;function Oi(t){if(!t||t.kind==="textValue")return null;for(let e of t.attributes)if(e.namespaceUri===chunkFIJZIQXA_cjs.la&&e.localName==="val")return e.value;return null}function Ln(t){let e=chunkFIJZIQXA_cjs.eg(chunkFIJZIQXA_cjs.cg(t),"numPr");if(!e)return null;let n=Oi(chunkFIJZIQXA_cjs.eg(e,"numId"));if(n===null||!/^\d{1,10}$/.test(n)||n==="0")return null;let o=Oi(chunkFIJZIQXA_cjs.eg(e,"ilvl")),r=o===null?0:Number(o);return !Number.isInteger(r)||r<0||r>ve?null:{numId:n,level:r}}function ae(t){let e=new Map;for(let n of t.paragraphIds){let o=t.node(n);if(!o)continue;let r=Ln(o);if(!r)continue;let a=e.get(r.numId);a?a.push(n):e.set(r.numId,[n]);}return Object.freeze([...e].map(([n,o])=>Object.freeze({numId:n,paragraphIds:Object.freeze(o)})))}function je(t,e){let n=t.node(e);return n?Ln(n):null}var kt=t=>({ok:false,error:{code:"unsupported-content",message:t}});function Ll(t,e){if(t.root.namespaceUri!==chunkFIJZIQXA_cjs.la||t.root.localName!=="styles")return false;let n=[t.root];for(;n.length;){let o=n.pop();if(o.kind!=="textValue"){if(o.namespaceUri===chunkFIJZIQXA_cjs.la&&o.localName==="numId"&&o.attributes.some(r=>r.namespaceUri===chunkFIJZIQXA_cjs.la&&r.localName==="val"&&r.value===e))return true;for(let r of o.children)n.push(r);}}return false}function Pi(t,e,n,o,r){let a=n.package;if(!a)return kt("no document");if(t.op==="setListLevelFormat"){let g=e.resolve(t.list,"list");if(!g||g.kind!=="list")return kt("that is not a list");let A=n.story(g.story),v=A&&ae(A).find(I=>I.numId===g.numId);if(!A||!v)return kt("that list no longer exists");if(r&&!vi(A,v.paragraphIds,g.numId,r))return {ok:false,error:{code:"unsupported-capability",message:"Only a newly proposed list definition can change while tracking"}};if(!vo(t.level,t.format))return kt("invalid list level format");for(let I of a.parts.values()){if(Ll(I,g.numId))return kt("list is referenced by a style");for(let w of chunkFIJZIQXA_cjs.Oc(I))for(let O of chunkFIJZIQXA_cjs.Rc(w.root))if(Ln(O)?.numId===g.numId&&!A.has(O.id))return kt("list is shared across stories")}for(let I of v.paragraphIds){if(chunkFIJZIQXA_cjs.Zf(A.part,I).content||chunkFIJZIQXA_cjs.ag(A.part,I))return kt("list contains protected content");let w=o(A,I,{numId:g.numId,level:t.level});if(w)return w}return En(a,g.numId,t.level,t.format)?{ok:true,kind:"command",story:A.story,ops:[],packageEdits:[I=>{let w=En(I,g.numId,t.level,t.format);if(!w)throw new Error("list definition changed during transaction");return w}],answer:()=>({kind:"applied"})}:kt("cannot format this list")}let s=ct(t.paragraph,e,n);if(!s.ok)return {ok:false,error:{code:s.code,message:s.detail}};let u=n.story(s.value.story);if(!u)return kt("missing story");let d=o(u,s.value.paragraphId);if(d)return d;let c=null,p=0,f=[];if(t.op==="startNewList"){let g=Ao(a);if(!g)return kt("cannot create numbering definition");let A=s.value.paragraphId;if(!chunkFIJZIQXA_cjs.el(u.part,{op:"setListNumbering",paragraphId:A,numId:g.numId,level:0}).ok)return kt("cannot number this paragraph");let I=g.numId;return {ok:true,kind:"command",story:u.story,ops:[],packageEdits:[w=>{let O=Ao(w),H=O?.pkg.parts.get(u.part.name);if(!O||!H)throw new Error("cannot create numbering definition");let M=chunkFIJZIQXA_cjs.el(H,{op:"setListNumbering",paragraphId:A,numId:O.numId,level:0,...r?{revision:{author:r,date:new Date().toISOString()}}:{}});if(!M.ok)throw new Error("cannot number this paragraph");return I=O.numId,chunkFIJZIQXA_cjs.Fe(O.pkg,M.part)}],answer:()=>({kind:"handle",handle:e.list(I,u.story)})}}else if(t.op==="attachToList"){if(!Number.isSafeInteger(t.listId)||t.listId<=0||!Number.isInteger(t.level)||t.level<0||t.level>8)return kt("invalid list identity or level");if(c=String(t.listId),p=t.level,!Be(a,c,p))return kt("list level is not defined; configure that level first");if(!ae(u).some(g=>g.numId===c))return kt("that list does not exist in this story")}let x=c;return {ok:true,kind:"command",story:u.story,ops:[{op:"setListNumbering",paragraphId:s.value.paragraphId,numId:t.op==="detachFromList"?"0":c,level:p}],packageEdits:f,answer:()=>x===null?{kind:"applied"}:{kind:"handle",handle:e.list(x,u.story)}}}var Po=Object.freeze({None:"none",Single:"single",Word:"words",Double:"double",Thick:"thick",Dotted:"dotted",DottedHeavy:"dottedHeavy",DashLine:"dash",DashLineHeavy:"dashedHeavy",DashLineLong:"dashLong",DashLineLongHeavy:"dashLongHeavy",DotDashLine:"dotDash",DotDashLineHeavy:"dashDotHeavy",TwoDotDashLine:"dotDotDash",TwoDotDashLineHeavy:"dashDotDotHeavy",Wave:"wave",WaveHeavy:"wavyHeavy",WaveDouble:"wavyDouble"}),Ii=[["Yellow","yellow","#FFFF00"],["Lime","green","#00FF00"],["Turquoise","cyan","#00FFFF"],["Pink","magenta","#FF00FF"],["Blue","blue","#0000FF"],["Red","red","#FF0000"],["DarkBlue","darkBlue","#000080"],["Teal","darkCyan","#008080"],["Green","darkGreen","#008000"],["Purple","darkMagenta","#800080"],["DarkRed","darkRed","#800000"],["Olive","darkYellow","#808000"],["Gray","darkGray","#808080"],["LightGray","lightGray","#C0C0C0"],["Black","black","#000000"],["White","white","#FFFFFF"]];function Ri(t){return Object.entries(Po).find(([,e])=>e===t)?.[0]??null}function Si(t){return Ii.find(([,e])=>e===t)?.[2]??null}function wi(t){let e=[];if(t.underline!==void 0){let n=typeof t.underline=="string"&&Object.hasOwn(Po,t.underline)?Po[t.underline]:void 0;if(!n)return {ok:false,detail:"underline: unsupported underline style"};e.push({localName:"u",attributes:{val:n}});}if(t.strikeThrough!==void 0){if(typeof t.strikeThrough!="boolean")return {ok:false,detail:"strikeThrough: not a boolean"};e.push({localName:"strike",attributes:{val:t.strikeThrough?"1":"0"}});}for(let n of ["subscript","superscript"])if(t[n]!==void 0&&typeof t[n]!="boolean")return {ok:false,detail:`${n}: not a boolean`};if(t.subscript===true&&t.superscript===true)return {ok:false,detail:"subscript and superscript are mutually exclusive"};if(t.highlightColor!==void 0){let n=t.highlightColor,o=typeof n=="string"?Ii.find(([r,,a])=>r.toLowerCase()===n.toLowerCase()||a===n.toUpperCase()):void 0;if(n!==null&&!o)return {ok:false,detail:"highlightColor: use an exact Word palette color or null to clear"};e.push({localName:"highlight",attributes:{val:o?.[1]??"none"}});}return {ok:true,value:e}}var Ml=31680,Hl=1999,Fl=Object.freeze({bold:null,italic:null,underline:null,strikeThrough:null,highlightColor:null,subscript:null,superscript:null,name:null,size:null,color:null});function mt(t,e){if(!t)return null;for(let n of t.attributes)if(n.localName===e)return n.value;return null}function Hn(t){if(!t)return null;let e=mt(t,"val");if(e===null)return true;let n=e.trim().toLowerCase();return !(n==="0"||n==="false"||n==="off"||n==="none")}function Dl(t){if(t===null)return null;let e=t.trim();return /^[0-9a-fA-F]{6}$/.test(e)?`#${e.toUpperCase()}`:null}function Bl(t){if(t===null)return null;let e=Number(t.trim());return !Number.isFinite(e)||e<=0?null:e/2}function ie(t){let e=chunkFIJZIQXA_cjs.nd(t??void 0);return e===null?null:chunkFIJZIQXA_cjs.ld(chunkFIJZIQXA_cjs.jd(e))}function Ft(t){if(t.length===0)return null;let e=t[0];if(e===null)return null;for(let n of t)if(n!==e)return null;return e}function Ni(t,e,n=chunkFIJZIQXA_cjs.th){let o=[];for(let r of e)for(let a of chunkFIJZIQXA_cjs.Sh(t,r.paragraphId,r.start,r.end,n))o.push(chunkFIJZIQXA_cjs.dg(a));return o.length===0?Fl:{bold:Ft(o.map(r=>Hn(chunkFIJZIQXA_cjs.eg(r,"b")))),italic:Ft(o.map(r=>Hn(chunkFIJZIQXA_cjs.eg(r,"i")))),underline:Ft(o.map(r=>Ri(mt(chunkFIJZIQXA_cjs.eg(r,"u"),"val")))),strikeThrough:Ft(o.map(r=>Hn(chunkFIJZIQXA_cjs.eg(r,"strike")))),highlightColor:Ft(o.map(r=>Si(mt(chunkFIJZIQXA_cjs.eg(r,"highlight"),"val")))),subscript:Ft(o.map(r=>Ti(r,"subscript"))),superscript:Ft(o.map(r=>Ti(r,"superscript"))),name:Ft(o.map(r=>{let a=chunkFIJZIQXA_cjs.eg(r,"rFonts"),s=mt(a,"ascii");return s===null||s.length===0?null:s})),size:Ft(o.map(r=>Bl(mt(chunkFIJZIQXA_cjs.eg(r,"sz"),"val")))),color:Ft(o.map(r=>Dl(mt(chunkFIJZIQXA_cjs.eg(r,"color"),"val"))))}}var jl=Object.freeze({left:"Left",start:"Left",center:"Centered",right:"Right",end:"Right",both:"Justified",distribute:"Justified"}),_l=Object.freeze({Left:"left",Centered:"center",Right:"right",Justified:"both"});function Ei(t){let e=null;for(let n of t?.children??[]){if(n.kind==="textValue"||n.localName!=="bidi")continue;let o=mt(n,"val");e=o===null||["1","true","on"].includes(o);}return e}function Vl(t){let e=mt(chunkFIJZIQXA_cjs.eg(t,"jc"),"val");return e===null?"Unknown":jl[e.trim().toLowerCase()]??"Unknown"}function Li(t,e,n){let o=chunkFIJZIQXA_cjs.Ta(t,e);if(!o||o.kind!=="paragraph")return null;let r=chunkFIJZIQXA_cjs.cg(o),a=chunkFIJZIQXA_cjs.eg(r,"spacing"),s=chunkFIJZIQXA_cjs.eg(r,"ind");return {alignment:Vl(r),style:xn(t,e,n),firstLineIndent:Ul(s),leftIndent:ie(mt(s,"left")??mt(s,"start")),rightIndent:ie(mt(s,"right")??mt(s,"end")),lineSpacing:ie(mt(a,"line")),spaceBefore:ie(mt(a,"before")),spaceAfter:ie(mt(a,"after")),widowControl:Hn(chunkFIJZIQXA_cjs.eg(r,"widowControl")),readingOrder:Ei(r)??n.inheritsRtl(t,o)?"RightToLeft":"LeftToRight"}}function Ul(t){let e=ie(mt(t,"hanging"));if(e!==null&&e>0)return -e;let n=ie(mt(t,"firstLine"));return n!==null?n:e===null?null:-e}function Mn(t,e){if(typeof t!="number"||!Number.isFinite(t))return {ok:false,detail:`${e}: not a measurement`};let n=chunkFIJZIQXA_cjs.md(chunkFIJZIQXA_cjs.kd(t));return Math.abs(n)>Ml?{ok:false,detail:`${e}: out of range`}:{ok:true,value:n}}function Mi(t){let e=wi(t);if(!e.ok)return e;let n=e.value;if(t.bold!==void 0){if(typeof t.bold!="boolean")return {ok:false,detail:"bold: not a boolean"};n.push({localName:"b",...t.bold?{}:{attributes:{val:"0"}}});}if(t.italic!==void 0){if(typeof t.italic!="boolean")return {ok:false,detail:"italic: not a boolean"};n.push({localName:"i",...t.italic?{}:{attributes:{val:"0"}}});}if(t.name!==void 0){let o=t.name;if(typeof o!="string"||o.length===0||o.length>128)return {ok:false,detail:"name: not a font name"};if(!chunkFIJZIQXA_cjs.T(o))return {ok:false,detail:"name: not valid XML text"};n.push({localName:"rFonts",attributes:{ascii:o,hAnsi:o}});}if(t.size!==void 0){let o=t.size;if(typeof o!="number"||!Number.isFinite(o)||o<=0)return {ok:false,detail:"size: not a positive number of points"};let r=Math.round(o*2);if(r<1||r>Hl)return {ok:false,detail:"size: out of range"};n.push({localName:"sz",attributes:{val:String(r)}}),n.push({localName:"szCs",attributes:{val:String(r)}});}if(t.color!==void 0){let o=t.color;if(typeof o!="string"||!/^#[0-9a-fA-F]{6}$/.test(o.trim()))return {ok:false,detail:"color: not a #RRGGBB triplet"};n.push({localName:"color",attributes:{val:o.trim().slice(1).toUpperCase()}});}return n.length===0&&t.subscript===void 0&&t.superscript===void 0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:n}}function Hi(t,e,n,o){let r=chunkFIJZIQXA_cjs.Ta(t,e);if(!r||r.kind!=="paragraph")return {ok:false,detail:"not a paragraph"};let a=chunkFIJZIQXA_cjs.cg(r),s=[],u;if(n.style!==void 0){let O=bn(n.style,o);if(!O.ok)return {ok:false,detail:O.detail};u=O.styleId,s.push({localName:"pStyle",attributes:{val:O.styleId}});}if(n.alignment!==void 0){let O=_l[n.alignment];if(O===void 0)return {ok:false,detail:`alignment: ${String(n.alignment)}`};s.push({localName:"jc",attributes:{val:O}});}let d=chunkFIJZIQXA_cjs.eg(a,"ind"),c=Ci(d),p=false;if(n.firstLineIndent!==void 0){let O=Mn(n.firstLineIndent,"firstLineIndent");if(!O.ok)return O;delete c.firstLine,delete c.hanging,O.value<0?c.hanging=String(-O.value):c.firstLine=String(O.value),p=true;}for(let[O,H,M]of [["leftIndent","left","start"],["rightIndent","right","end"]]){let N=n[O];if(N===void 0)continue;let E=Mn(N,O);if(!E.ok)return E;delete c[M],c[H]=String(E.value),p=true;}p&&s.push({localName:"ind",attributes:c});let f=chunkFIJZIQXA_cjs.eg(a,"spacing"),x=Ci(f),g=false;for(let[O,H]of [["spaceBefore","before"],["spaceAfter","after"]]){let M=n[O];if(M===void 0)continue;let N=Mn(M,O);if(!N.ok)return N;if(N.value<0)return {ok:false,detail:`${O}: out of range`};x[H]=String(N.value),g=true;}if(n.lineSpacing!==void 0){let O=Mn(n.lineSpacing,"lineSpacing");if(!O.ok)return O;if(O.value<=0)return {ok:false,detail:"lineSpacing: out of range"};x.line=String(O.value),x.lineRule??="auto",g=true;}if(g&&s.push({localName:"spacing",attributes:x}),n.widowControl!==void 0){if(typeof n.widowControl!="boolean")return {ok:false,detail:"widowControl: not a boolean"};s.push({localName:"widowControl",...n.widowControl?{}:{attributes:{val:"0"}}});}let A=false;if(n.readingOrder!==void 0){if(n.readingOrder!=="RightToLeft"&&n.readingOrder!=="LeftToRight")return {ok:false,detail:`readingOrder: ${String(n.readingOrder)}`};let O=n.readingOrder==="RightToLeft",H=Ei(a),M=o.inheritsRtl(t,r,u);(H??M)!==O&&(M===O?A=true:s.push({localName:"bidi",...O?{}:{attributes:{val:"0"}}}));}if(s.length===0&&!A&&n.readingOrder===void 0)return {ok:false,detail:"no formatting was asked for"};let v=chunkFIJZIQXA_cjs.Dh(t,e),I=chunkFIJZIQXA_cjs.Fh(v,s),w=A?I.filter(O=>O.localName!=="bidi"):I;return {ok:true,value:w,unchanged:Wl(v,w)}}function Wl(t,e){if(t.length!==e.length)return false;let n=r=>JSON.stringify([r.localName,Object.entries(r.attributes??{}).sort(([a],[s])=>a<s?-1:a>s?1:0)]),o=new Set(t.map(n));return e.every(r=>o.has(n(r)))}function Ci(t){let e=Object.create(null);if(!t)return e;for(let n of t.attributes)e[n.localName]=n.value;return e}function Io(t,e){if(e.subscript===void 0&&e.superscript===void 0)return [...t];let n=t.find(r=>r.localName==="vertAlign")?.attributes?.val,o=e.subscript===true?"subscript":e.superscript===true?"superscript":n==="subscript"&&e.subscript===false||n==="superscript"&&e.superscript===false?"baseline":n??"baseline";return chunkFIJZIQXA_cjs.Fh(t,[{localName:"vertAlign",attributes:{val:o}}])}function Ti(t,e){let n=mt(chunkFIJZIQXA_cjs.eg(t,"vertAlign"),"val");return n===null?null:n===e}function Fi(){let t=false,e=false,n=false,o=false;return {conflict(r){let a=zt(r),s=gn(r),u=r.op==="deleteComment",d=r.op==="updateFieldResult";return a&&(d&&t&&!o||o&&!d)?{message:"field result updates require a batch without other edits; sync document edits before updating fields",detail:r.op}:s&&t||e&&a?{message:"that command commits on its own and cannot share a batch",detail:r.op}:u&&t&&!n||n&&a&&!u?{message:"comment deletions may share a batch only with other comment deletions",detail:r.op}:null},note(r){zt(r)&&(t=true,gn(r)&&(e=true),r.op==="deleteComment"&&(n=true),r.op==="updateFieldResult"&&(o=true));},get hasCommands(){return t}}}var $l=256,Di=1e4;function Ro(t,e){if(t.kind!=="textValue"){for(let n of t.attributes)if(n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName===e)return n.value}}function Kl(t){return t.startsWith("_")}function So(t){let e=new Map,n=[],o=new Set;for(let r of t.paragraphIds){let a=t.node(r);if(a?.kind!=="paragraph")continue;let s=chunkFIJZIQXA_cjs.jg(a),u=d=>{if(d.kind!=="textValue"){if(d.kind==="bookmarkStart"){if(n.length>=Di||e.size>=Di)return;let c=Ro(d,"id"),p=Ro(d,"name");if(c===void 0||p===void 0||p.length===0||p.length>$l||Kl(p)||o.has(p)||e.has(c))return;let f=s.spanOf(d)?.start??0;e.set(c,{name:p,start:{paragraphId:r,offset:f}});return}if(d.kind==="bookmarkEnd"){let c=Ro(d,"id");if(c===void 0)return;let p=e.get(c);if(!p)return;e.delete(c),o.add(p.name);let f=s.spanOf(d)?.start??0;n.push(Object.freeze({name:p.name,start:p.start,end:{paragraphId:r,offset:f}}));return}for(let c of d.children)u(c);}};for(let d of a.children)u(d);}return Object.freeze(n)}function wo(t,e){return So(t).find(n=>n.name===e)??null}function Bi(t,e){let n=t.node(e);if(n?.kind!=="paragraph")return Object.freeze([]);let o=chunkFIJZIQXA_cjs.jg(n),r=[],a=(s,u)=>{if(!(s.kind==="textValue"||u>32)){if(chunkFIJZIQXA_cjs.yd(s)){let d=o.spanOf(s);d&&r.push(Object.freeze({id:s.id,paragraphId:e,start:d.start,end:d.end}));return}for(let d of s.children)a(d,u+1);}};for(let s of n.children)a(s,0);return Object.freeze(r)}function ji(t,e,n){let o=chunkFIJZIQXA_cjs.Bd(n,r=>chunkFIJZIQXA_cjs.Ig(t,e,r));if(o.kind==="external")return o.href;if(o.kind==="internal"){let r=chunkFIJZIQXA_cjs.zd(n);return r===void 0||r.length===0?null:`#${r}`}return null}function _i(t,e,n,o,r){let a=Math.min(r?.limit??2e3,2e3),s=[],u=At(e,t),d=u.length-1;for(let[c,p]of u.entries()){if(a<=0)break;let f=t.projectedText(p,r?.projection??"allMarkup");if(!f)continue;let x=f.findOccurrences(Rn(o),a,{matchCase:r?.matchCase===true,wholeWord:r?.matchWholeWord===true,...c===0&&e?{from:f.projectedOffset(e.start.offset)}:{},...c===d&&e?{to:f.projectedOffset(e.end.offset)}:{}});for(let g of x.matches){if(c===0&&e&&g.rawStart<e.start.offset||c===d&&e&&g.rawEnd>e.end.offset)continue;let A=n.paragraph(p,t.story);s.push({start:{paragraph:A,offset:g.rawStart},end:{paragraph:A,offset:g.rawEnd}}),a-=1;}}return {ok:true,spans:s}}var Wi=256,zl=1<<22,Vi=new WeakMap,Gl={story:new Map,copy:new Set};function Xl(t){return t.kind!=="textValue"&&t.namespaceUri===chunkFIJZIQXA_cjs.la&&t.localName==="txbxContent"}function Yl(t){let e=t.children.find(r=>r.kind!=="textValue"&&r.namespaceUri===chunkFIJZIQXA_cjs.oa&&r.localName==="Fallback");if(!e||e.kind==="textValue")return null;let n=null,o=[{node:e,depth:0}];for(;o.length>0;){let{node:r,depth:a}=o.pop();if(!(r.kind==="textValue"||a>Wi)){if(Xl(r)){if(n)return null;n=r;continue}for(let s of r.children)o.push({node:s,depth:a+1});}}return n}function Ui(t,e,n,o,r){let a=[{node:t,depth:0}];for(;a.length>0;){let{node:s,depth:u}=a.pop();if(--o.left<0||u>Wi)return false;if(s.kind!=="textValue"){n.set(s.id,e),r?.add(s.id);for(let d of s.children)a.push({node:d,depth:u+1});}}return true}function _e(t){let e=Vi.get(t.root);if(e)return e;let n={left:zl},o=yn(t,chunkFIJZIQXA_cjs.Rc(chunkFIJZIQXA_cjs.Qc(t)??t.root)),r=new Map,a=new Set,s=o.ok;for(let d of o.ok?o.shapes:[]){if(!s)break;let c=d.textboxRoot;if(!c)continue;s=Ui(c,c.id,r,n);let p=d.alternate?Yl(d.alternate):null;s&&p&&(s=Ui(p,c.id,r,n,a));}let u=!s||r.size===0?Gl:{story:r,copy:a};return Vi.set(t.root,u),u}function $i(t,e,n,o){return e.length===0?n===null&&o():n===null?e.every(r=>!t.story.has(r))&&o():e.every(r=>t.story.get(r)===n)&&e.some(r=>!t.copy.has(r))}var Jl={insert:"Insert",delete:"Delete",replace:"Replace",moveFrom:"MovedFrom",moveTo:"MovedTo",format:"Property",paragraphMark:"ParagraphProperty"};function Ki(t,e){return e.length===0?!te(t.story):e.every(n=>t.has(n.start.paragraphId))}function Ql(t,e){if(t.story.kind==="note")return Ki(t,e.ranges);let n=_e(t.part),o=t.story.kind==="textbox"&&t.root.kind!=="textValue"?t.root.id:null;return $i(n,chunkFIJZIQXA_cjs.wj(e),o,()=>Ki(t,e.ranges))}function Fn(t){return Object.freeze(chunkFIJZIQXA_cjs.ek(t.part).filter(e=>Ql(t,e)))}function Co(t){let e=[];for(let n of Fn(t)){if(n.readOnly)continue;let o=n.structuralChanges?.length===1?n.structuralChanges[0]:void 0,r=n.revisionKind==="structural"?o==="rowInsert"?"Insert":o==="rowDelete"?"Delete":void 0:Jl[n.revisionKind];r!==void 0&&e.push(Object.freeze({id:n.id,type:r,author:n.author,date:n.date??"",item:n}));}return Object.freeze(e)}function Zl(t,e){let n=t;for(let o=0;n!==void 0&&o<=64;o+=1){if(n.parentId===void 0)return n.range!==null;n=e.get(n.parentId);}return false}var ql=Object.freeze({items:Object.freeze([]),roots:Object.freeze([]),byId:()=>null,textOf:()=>""});function zi(t,e){let n=t.parts.get(chunkJGNVNT2A_cjs.aa(t,e.part.name));if(!n)return ql;let o=t.parts.get(chunkJGNVNT2A_cjs.ba(t,e.part.name)),r=chunkFIJZIQXA_cjs.$h(n),a=o?chunkFIJZIQXA_cjs.ai(o):new Map,s=chunkFIJZIQXA_cjs.Zh(e.part).filter(f=>e.has(f.start.paragraphId)),u=chunkFIJZIQXA_cjs.fk(r,s,a),d=new Map(u.map(f=>[f.id,f])),c=u.filter(f=>Zl(f,d)),p=new Map(c.map(f=>[f.id,f]));return Object.freeze({items:Object.freeze(c),roots:Object.freeze(c.filter(f=>f.parentId===void 0)),byId:f=>p.get(f)??null,textOf:f=>{let x=p.get(f);return x?chunkFIJZIQXA_cjs.Mj(x.comment):""}})}var td=64,Gi=new WeakMap;function To(t,e){if(t.kind==="textValue")return -1;let n=Gi.get(t);if(!n){let o=new Map;t.children.forEach((r,a)=>{o.has(r.id)||o.set(r.id,a);}),n=o,Gi.set(t,n);}return n.get(e)??-1}var ed=new Set(["drawing","pict","object","AlternateContent","txbxContent"]),Dn=(t,e)=>({code:"unsupported-capability",message:t,detail:e});function Xi(t,e){let n=chunkFIJZIQXA_cjs.Ta(t,e);if(!n||n.kind!=="paragraph")return null;if(chunkFIJZIQXA_cjs.eg(chunkFIJZIQXA_cjs.cg(n),"sectPr"))return Dn("a tracked deletion cannot remove a section break","section-mark");let o=false,r=0,a=false,s=false,u=(d,c)=>{if(!(d.kind==="textValue"||s)){if(c>td){s=true;return}if(!(chunkFIJZIQXA_cjs.ja(d.kind)||ed.has(d.localName))){if(d.kind==="contentControl"&&(o=true),d.kind==="fldChar"){let p=chunkFIJZIQXA_cjs.of(d);p==="begin"?r+=1:p==="end"&&(r===0?a=true:r-=1);}for(let p of d.children)u(p,c+1);}}};for(let d of n.children)u(d,0);return s?Dn("the paragraph nests content too deeply to check","depth"):o?Dn("a tracked paragraph deletion cannot remove an inline content control","control"):a||r>0?Dn("a field crosses this paragraph mark","cross-paragraph-field"):null}function Yi(t,e){let n=chunkFIJZIQXA_cjs.Ua(t,e);if(!n)return null;let o=To(n,e);if(o<0)return null;for(let r=o+1;r<n.children.length;r+=1){let a=n.children[r];if(a.kind==="paragraph")return a;if(!chunkFIJZIQXA_cjs.Oj(a))return null}return null}function Ji(t,e){if(e.length<2)return true;let n=chunkFIJZIQXA_cjs.Ua(t,e[0]);if(!n)return false;let o=n.children,r=To(n,e[0]);if(r<0)return false;for(let a=1;a<e.length;a+=1){let s=r+1;for(;s<o.length&&o[s].kind!=="paragraph"&&chunkFIJZIQXA_cjs.Oj(o[s]);)s+=1;if(o[s]?.id!==e[a])return false;r=s;}return true}function Qi(t,e,n){let o=chunkFIJZIQXA_cjs.Ua(t,e);if(!o)return false;let r=To(o,e);for(let a=r-1;a>=0;a-=1){let s=o.children[a];if(s.kind==="paragraph")return chunkFIJZIQXA_cjs.cl(s,"del")?.author===n;if(!chunkFIJZIQXA_cjs.Oj(s))return false}return false}function qi(t,e,n,o){if(t.op==="insertText")return {op:"proposeInsertion",span:{start:t.at,end:t.at},text:t.text,where:"Before",author:e};if(t.op==="replaceSpan")return {op:"proposeReplacement",span:t.span,text:t.text,author:e};if(t.op!=="deleteParagraph")return t;let r=ct(t.paragraph,n,o);if(!r.ok)return {ok:false,error:{code:r.code,message:"that handle does not name a paragraph",detail:r.detail}};let{story:a,paragraphId:s,index:u}=r.value,d=o.story(a),c=d?.paragraphIds[u+1];return !d||c===void 0||Yi(d.part,s)?.id!==c?{ok:false,error:{code:"unsupported-capability",message:"a tracked paragraph deletion needs a next paragraph in the same container",detail:"paragraph"}}:{op:"proposeDeletion",span:{start:{paragraph:t.paragraph,offset:0},end:{paragraph:n.paragraph(c,a),offset:0}},author:e}}function Zi(t,e,n){return Qi(t,e,n.trim())?{ok:false,error:{code:"unsupported-revision",message:"a deletion beside the author's pending deletion would review as one decision",detail:"span"}}:null}function ts(t,e,n,o,r,a=true){let s=(E,R,_)=>({ok:false,error:{code:E,message:R,..._===void 0?{}:{detail:_}}}),u=E=>jt(E,n),d=E=>({ok:true,kind:"query",value:E}),c=ei(t,e);if(c)return {ok:false,error:c};let p=t.op==="proposeInsertion",f=t.op==="proposeDeletion",x=J(t.span,n,o);if(!x.ok)return s(x.code,"that span is not a place",x.detail);let g=x.value;if(g&&e&&!p&&g.start.paragraphId!==g.end.paragraphId){if(!a&&!f&&t.text!=="")return s("unsupported-capability","tracked paragraph-range replacement is unsupported in collaboration","span");let E=ot(t.span,n,o);if(!E.ok)return s(E.code,"that story is not a place",E.detail);let R=E.value,_=R.indexOf(g.start.paragraphId),z=R.indexOf(g.end.paragraphId),$=R.paragraphIds.slice(_,z+1);if(!Ji(R.part,$))return s("unsupported-content","tracked ranges require adjacent sibling paragraphs","span");if(g.start.offset===0){let lt=Zi(R.part,$[0],t.author);if(lt)return lt}let K={author:t.author.trim(),date:new Date().toISOString()},Z=[],Q=[];for(let lt=0;lt<$.length;lt++){let dt=$[lt],Rt=lt===0?g.start.offset:0,Ot=lt===$.length-1?g.end.offset:(R.rawText(dt)??"").length,Vt=Ae(R,dt,Rt,Ot)??(lt<$.length-1?Xi(R.part,dt):null);if(Vt)return {ok:false,error:Vt};let W=Ot>Rt||lt<$.length-1?r(R,dt):null;if(W)return W;Ot>Rt&&Z.push({op:"deleteText",paragraphId:dt,start:Rt,end:Ot,revision:K}),lt<$.length-1&&Q.push({op:"setParagraphMarkRevision",paragraphId:dt,kind:"del",revision:K});}Z.push(...Q);let at={...g.start,offset:(R.rawText($[0])??"").length},gt=f?"":t.text,xt=Xt(R.part,$[0],g.start.offset,at.offset,gt);return xt||(gt&&Z.push({op:"insertText",paragraphId:$[0],offset:at.offset,text:gt,revision:K}),{ok:true,kind:"command",ops:Z,story:R.story,answer:()=>({kind:"span",span:u({start:at,end:{...at,offset:at.offset+gt.length}})})})}if(!g||g.start.paragraphId!==g.end.paragraphId)return s("unsupported-content","proposals require a single paragraph range","span");if(!e&&!p&&g.start.offset===g.end.offset)return s("unsupported-content","deletion and replacement need a non-empty range","span");let A=ot(t.span,n,o);if(!A.ok)return s(A.code,"that story is not a place",A.detail);let v=g.start.paragraphId,I=p&&t.where==="After"?g.end.offset:g.start.offset,w=p?I:g.end.offset;if(e&&!p&&w>I&&I===0){let E=Zi(A.value.part,v,t.author);if(E)return E}if(e&&!f&&I===w&&t.text==="")return d({kind:"span",span:u({start:g.start,end:g.start})});let O=Ae(A.value,v,I,w,e&&p?t.author.trim():void 0,p&&I===(A.value.rawText(v)??"").length,e&&!p&&w>I?t.author.trim():void 0);if(O)return {ok:false,error:O};if(!f){let E=Xt(A.value.part,v,I,w,t.text);if(E)return E}let H=r(A.value,v);if(H)return H;let M={author:t.author.trim(),date:new Date().toISOString()},N=[];return !p&&w>I&&N.push({op:"deleteText",paragraphId:v,start:I,end:w,revision:M}),!f&&t.text.length>0&&N.push({op:"insertText",paragraphId:v,offset:p?I:w,text:t.text,revision:M}),{ok:true,kind:"command",ops:N,story:A.value.story,answer:()=>{if(!e)return {kind:"applied"};let E={...g.start,offset:p?I:w};return {kind:"span",span:u({start:E,end:{...E,offset:E.offset+(f?0:t.text.length)}})}}}}function es(t,e,n){return Ae(t,e,0,(t.rawText(e)??"").length,n,true)}var ns=5e4;function Bn(t,e,n){if("body"in t){let o=ut(t.body,"body",e,n);return o.ok?{ok:true,reads:o.value}:{ok:false,code:o.code,message:"that handle does not name a body",detail:o.detail}}return e.resolve(t.document,"document")?n.body?{ok:true,reads:n.body}:{ok:false,code:"document-unavailable",message:"this host holds no document"}:{ok:false,code:"invalid-handle",message:"that handle does not name a document",detail:"document"}}function nd(t,e){if(e.root.kind!=="textValue"&&chunkFIJZIQXA_cjs.Zj({...e.part,root:e.root}).length===0)return [];let n=t.op,o=_e(e.part),r=()=>chunkFIJZIQXA_cjs.Zj(e.part).map(d=>d.node.id),a=d=>{let c=[];for(let p=0;p<d.length;p+=ns)c.push({op:n,siteNodeIds:d.slice(p,p+ns)});return c};if(e.story.kind==="textbox"){let d=e.root.id,c=o.copy.size?r().filter(p=>o.copy.has(p)&&o.story.get(p)===d):[];return [{op:n,scopeRootId:d},...a(c)]}if(te(e.story))return [{op:n,scopeRootId:e.root.id}];if(o.story.size===0)return [{op:n}];let s=r(),u=s.filter(d=>!o.story.has(d));return u.length===s.length?[{op:n}]:a(u)}function os(t,e,n){let o=Bn({op:"acceptAllRevisions",body:t.body},e,n);if(!o.ok)return o;if(t.revisions!==void 0&&!Array.isArray(t.revisions))return {ok:false,code:"unsupported-content",message:"invalid revision batch"};let r=t.revisions===void 0?void 0:[];r===void 0&&!te(o.reads.story)&&_e(o.reads.part).story.size>0&&(r=Fn(o.reads).map(chunkFIJZIQXA_cjs.xj));for(let s of t.revisions??[]){let u=e.resolve(s,"revision");if(!u||u.kind!=="revision"||G(u.story)!==G(o.reads.story))return {ok:false,code:"invalid-handle",message:"revision does not belong to this story"};r.push(`revision-${u.revisionId}`);}let a=te(o.reads.story)?o.reads.root:void 0;return {ok:true,reads:o.reads,keys:r,scopeRoot:a}}function od(t,e,n){let o=os(t,e,n);if(!o.ok)return o;if(!["accept","reject"].includes(t.action))return {ok:false,code:"unsupported-content",message:"invalid revision batch"};let r=chunkJGNVNT2A_cjs.va(o.reads.part,t.action,o.keys,o.scopeRoot);return {ok:true,reads:o.reads,...r}}function rd(t,e,n){let o={author:t.author,...t.date===void 0?{}:{date:t.date}};if(typeof t.author!="string"||t.date!==void 0&&typeof t.date!="string"||chunkFIJZIQXA_cjs.jk(o)||t.authors!==void 0&&(t.revisions!==void 0||!Array.isArray(t.authors)||t.authors.some(s=>typeof s!="string")))return {ok:false,code:"unsupported-content",message:"author must be nonblank text, date an xsd:dateTime, and authors a list without revisions"};let r=os(t,e,n);if(!r.ok)return r;let a=chunkFIJZIQXA_cjs.kk(r.reads.part,o,r.keys,r.scopeRoot,t.authors);return {ok:true,reads:r.reads,...a}}function ad(t,e,n,o){let r=Bn({op:"acceptAllRevisions",body:t},n,o);if(!r.ok)throw new Error("resolved story disappeared");let a=Fn(r.reads).length;return {kind:"revisionBatch",result:{...e,remaining:a}}}function rs(t,e,n,o){if(t.op==="setRevisionAuthorBatch"){let s=rd(t,e,n);if(!s.ok)return {ok:false,error:{code:s.code,message:s.message}};let u=o(s.reads);return u||{ok:true,kind:"command",story:s.reads.story,ops:s.ops,answer:d=>{let c=Bn({op:"acceptAllRevisions",body:t.body},e,d);if(!c.ok)throw new Error("reattributed story disappeared");let p=s.finish(c.reads.part),f="revision-";return e.retargetRevisions(s.reads.story,p.updated.flatMap(({previousKey:x,key:g})=>x.startsWith(f)&&g.startsWith(f)?[{from:x.slice(f.length),to:g.slice(f.length)}]:[])),{kind:"revisionAuthors",result:p}}}}if(t.op==="resolveRevisionBatch"){let s=od(t,e,n);if(!s.ok)return {ok:false,error:{code:s.code,message:s.message}};let u=o(s.reads);return u||{ok:true,kind:"command",story:s.reads.story,ops:s.ops,answer:d=>ad(t.body,s.result,e,d)}}let r=Bn(t,e,n);if(!r.ok)return {ok:false,error:{code:r.code,message:r.message,detail:r.detail}};let a=o(r.reads);return a||{ok:true,kind:"command",story:r.reads.story,ops:nd(t,r.reads),answer:()=>({kind:"applied"})}}function as(t,e,n){let o=chunkJGNVNT2A_cjs.va(t.part,n,[chunkFIJZIQXA_cjs.xj(e)],te(t.story)?t.root:void 0);return o.result.skipped.length?[]:o.ops}var id=/[\r\n\u2028\u2029]/u,ss=Object.freeze({kind:"applied"});function se(t,e,n){return {ok:false,error:Object.freeze(n===void 0?{code:t,message:e}:{code:t,message:e,detail:n})}}function No(t,e){return se("unsupported-content",t==="author"?"a comment records who wrote it":t==="date"?"a comment date must be a valid ISO-8601 instant":e==="reply"?"a reply says something":"a comment says something",t)}function Eo(t){return chunkJGNVNT2A_cjs.U(t.author)?No("author",t.kind):chunkJGNVNT2A_cjs.V(t.text)?No("text",t.kind):typeof t.text=="string"&&id.test(t.text)?se("unsupported-content",t.kind==="reply"?"a reply is one paragraph in this slice":"a comment is one paragraph in this slice","text"):chunkJGNVNT2A_cjs.X(t.date)?No("date",t.kind):null}function Lo(t){if(t===void 0)return;let e=chunkJGNVNT2A_cjs.W(t);return e.ok?e.value:void 0}function is(t,e){let n=chunkFIJZIQXA_cjs.Ta(t.part,e);for(;n;){if(n.kind==="tableCell"||n.kind!=="textValue"&&n.namespaceUri===chunkFIJZIQXA_cjs.la&&n.localName==="tc")return n.id;n=chunkFIJZIQXA_cjs.Ua(t.part,n.id);}return null}function ls(t,e,n,o){let r=Eo({author:t.author,text:t.text,date:t.date,kind:"comment"});if(r)return r;let a=J(t.span,e,n);if(!a.ok)return se(a.code,"that span is not a place",a.detail);if(a.value===null)return se("invalid-handle","an empty story has no comment anchor");let s=ot(t.span,e,n);if(!s.ok)return se(s.code,"that span is not a place",s.detail);if(s.value.story.kind==="textbox")return se("unsupported-content","a comment cannot be anchored in a text box");let u=a.value;if(is(s.value,u.start.paragraphId)!==is(s.value,u.end.paragraphId))return se("unsupported-content","a comment range cannot cross a table-cell boundary");let d=o(s.value);if(d)return d;let c=Lo(t.date);return {ok:true,kind:"commentWrite",write:{kind:"create",anchor:{paragraphId:u.start.paragraphId,start:u.start.offset,end:u.end.offset,...u.end.paragraphId===u.start.paragraphId?{}:{endParagraphId:u.end.paragraphId}},text:t.text,author:t.author,...c===void 0?{}:{date:c}},story:s.value.story,answer:(f,x)=>x===void 0?ss:{kind:"handle",handle:e.comment(x,s.value.story)}}}function ds(t,e,n){let o=n(e);if(o)return o;let r=e.story;return {ok:true,kind:"commentWrite",write:{kind:"delete",commentId:t.id,...t.parentId===void 0?{}:{parentCommentId:t.parentId},...r.kind==="note"?{noteId:r.noteId}:{}},story:r,answer:()=>ss}}var sd=1e4;function us(t,e){let n=[],o=e.kind==="contentControl"?chunkFIJZIQXA_cjs.Xb(e):e;if(!o)return n;for(let r of chunkFIJZIQXA_cjs.$b(o))if(!(r.ancestors.length>0)){if(n.length>=sd)break;n.push(gs(t,r.node));}return n}function cs(t,e){for(let n of chunkFIJZIQXA_cjs.$b(t.root))if(n.node.id===e)return gs(t,n.node);return null}function ps(t,e){for(let n of chunkFIJZIQXA_cjs.$b(t.root))if(n.node.id===e)return n.node;return null}function ms(t,e){for(let n of t.paragraphIds){let o=t.node(n);if(!(!o||o.kind!=="paragraph")&&chunkFIJZIQXA_cjs.$b(o).some(r=>r.node.id===e))return o}return null}function jn(t,e){let n=hs(e);if(n.length>0){let a=n[0],s=n[n.length-1],u=t.rawText(s);return u===null||!t.has(a)?null:{start:{paragraphId:a,offset:0},end:{paragraphId:s,offset:u.length}}}let o=ms(t,e.id);if(!o)return null;let r=chunkFIJZIQXA_cjs.jg(o).spanOf(e);return r?{start:{paragraphId:o.id,offset:r.start},end:{paragraphId:o.id,offset:r.end}}:null}function ld(t,e,n){let o=ms(t,e.id),r=chunkFIJZIQXA_cjs.Xb(e);if(!o||!r)return null;let a={...o,children:r.children},s=chunkFIJZIQXA_cjs.Wi(a);return An(a,s,n).text}function fs(t,e,n="allMarkup"){if(n==="allMarkup")return chunkFIJZIQXA_cjs.bc(e,chunkFIJZIQXA_cjs.kh);let o=ld(t,e,n);if(o!==null)return o;let r=jn(t,e);if(!r)return "";let a=t.indexOf(r.start.paragraphId),s=t.indexOf(r.end.paragraphId);if(a<0||s<a)return "";let u=[];for(let d=a;d<=s;d+=1){let c=t.paragraphIds[d],p=t.projectedText(c,n),f=t.rawText(c);if(!p||f===null)return "";u.push(p.sliceRaw(d===a?r.start.offset:0,d===s?r.end.offset:f.length));}return u.join("\r")}function gs(t,e){return {nodeId:e.id,properties:chunkFIJZIQXA_cjs.Zb(e),lock:chunkFIJZIQXA_cjs.mk(t.part,e.id),paragraphIds:hs(e)}}function hs(t){let e=chunkFIJZIQXA_cjs.Xb(t);if(!e)return [];let n=[];return chunkFIJZIQXA_cjs.Sc(e.children,n,0),n.map(o=>o.id)}var dd=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),ud=4096,ys=64;function ks(t){if(t===void 0)return {ok:true,value:null};if(typeof t!="object"||t===null)return {ok:false,field:"payload"};let e=t;for(let n of ["namespaceUri","rootLocalName","nodeId"]){let o=e[n];if(typeof o!="string"||o.length===0||o.length>ud)return {ok:false,field:n}}return typeof e.label!="string"||e.label.length>chunkJGNVNT2A_cjs.ga?{ok:false,field:"label"}:typeof e.data!="string"||e.data.length===0||e.data.length>chunkJGNVNT2A_cjs.fa?{ok:false,field:"data"}:{ok:true,value:{namespaceUri:e.namespaceUri,rootLocalName:e.rootLocalName,nodeId:e.nodeId,label:e.label,data:e.data}}}function xs(t){let e=t.at!==void 0,n=t.span!==void 0;return e===n?{message:"a custom node goes at a position or over a span, not both",detail:e?"at+span":"no-place"}:typeof t.tag!="string"||t.tag.length===0?{message:"a custom node carries its identity in its tag",detail:"tag"}:t.tag.length>ys?{message:`w:tag caps at ${String(ys)} characters; a longer payload belongs in the store`,detail:"tag"}:typeof t.text!="string"||t.text.length===0?{message:"a custom node shows some text",detail:"text"}:t.lock!==void 0&&!dd.has(t.lock)?{message:"that is not a lock",detail:String(t.lock)}:null}function bs(t,e,n,o){return {paragraphId:e.paragraphId,offset:e.offset,...n.offset>e.offset?{replaceUntil:n.offset}:{},tag:t.tag,text:t.text,...t.title===void 0?{}:{alias:t.title},...t.lock===void 0||t.lock==="unlocked"?{}:{lock:t.lock},...o===null?{}:{payload:o}}}function As(t,e,n){if(t.span){let r=J(t.span,e,n);return r.ok?r.value?r.value.start.paragraphId!==r.value.end.paragraphId?{code:"unsupported-content",message:"a custom node wraps text inside one paragraph",detail:"multi-paragraph"}:{range:r.value}:{code:"invalid-offset",message:"that story holds nothing to wrap",detail:"empty-story"}:{code:r.code,message:"that span is not a place",detail:r.detail}}let o=ye(t.at,e,n);return o.ok?{range:{start:o.value,end:o.value}}:{code:o.code,message:"that is not a place",detail:o.detail}}var cd=16,pd=64;function md(t,e,n){return Object.freeze(n===void 0?{code:t,message:e}:{code:t,message:e,detail:n})}function y(t,e,n){return {ok:false,error:md(t,e,n)}}var st=Object.freeze({kind:"applied"});function D(t){return {ok:true,kind:"query",value:t}}function Mo(t){let{runPropertyEdits:e,mergedParagraphMarkProperties:n}=ja(()=>t.reads.package?chunkFIJZIQXA_cjs.bd(t.reads.package)?.root??null:null,()=>t.reads.package?chunkFIJZIQXA_cjs.Tg(t.reads.package)?.root??null:null,()=>t.displayMode??"proposed"),{handles:o,capabilities:r}=t,a=t.reads,s=new Map,u=new Map,d=l=>{let h=`${G(l.story)}:${l.root.id}`,b=s.get(h);if(b)return b;let P=new Map,C=l.paragraphIds.map(i=>{let m={id:i};return P.set(i,m),m}),L={externalCreatedCount:0,reads:l,order:C,slotById:P,created:[],restructured:new Set,touched:new Set,textEdits:new Sn,formatted:new Set,selected:new Set,retargets:[]};return s.set(h,L),L},c=[],p=Fi(),f=false,x=null,g=l=>x===null?(x=l,null):x===l?null:y("conflicting-operations","one batch writes into one story",`${G(x.reads.story)} then ${G(l.reads.story)}`),A=l=>g(d(l)),v=l=>{let h=a.package;return h===null?null:zi(h,l)},I=l=>{let h=o.resolve(l,"comment");if(!h||h.kind!=="comment")return {ok:false,planned:y("invalid-handle","that handle does not name a comment","comment")};let b=a.story(h.story);if(!b)return {ok:false,planned:y("invalid-handle","that story is not in this document")};let C=v(b)?.byId(h.commentId)??null;return C?{ok:true,reads:b,item:C}:{ok:false,planned:y("invalid-handle","this document no longer holds that comment",h.commentId)}},w=l=>{let h=o.resolve(l,"revision");if(!h||h.kind!=="revision")return {ok:false,planned:y("invalid-handle","that handle does not name a tracked change","revision")};let b=a.story(h.story);if(!b)return {ok:false,planned:y("invalid-handle","that story is not in this document")};let P=Co(b).find(C=>C.id===h.revisionId)??null;return P?{ok:true,reads:b,item:P}:{ok:false,planned:y("invalid-handle","this document no longer holds that tracked change",h.revisionId)}},O=(l,h)=>{let b=l.rawText(h.start.paragraphId),P=l.rawText(h.end.paragraphId);if(b===null||P===null)return null;let C={story:l.story,paragraphId:h.start.paragraphId,index:l.indexOf(h.start.paragraphId),offset:Math.min(h.start.offset,b.length)},L={story:l.story,paragraphId:h.end.paragraphId,index:l.indexOf(h.end.paragraphId),offset:Math.min(h.end.offset,P.length)};return z({start:C,end:L})},H=(l,h)=>l.order.indexOf(h),M=(l,h)=>l.selected.has(h)?y("conflicting-operations","this batch selects a paragraph it also edits",h):null,N=(l,h)=>{let b=M(l,h);return b||(l.restructured.has(h)||l.touched.has(h)?y("conflicting-operations","another operation in this batch already changes that paragraph",h):(l.restructured.add(h),l.touched.add(h),null))},E=(l,h)=>{let b=M(l,h);return b||(l.restructured.has(h)||l.textEdits.has(h)?y("conflicting-operations","another operation in this batch restructures that paragraph",h):(l.touched.add(h),null))},R=(l,h,b)=>{let P=`${b}:${h}`;if(l.formatted.has(P))return y("conflicting-operations","another operation in this batch already writes that formatting",h);let C=E(l,h);return C||(l.formatted.add(P),null)},_=(l,h)=>{let b={id:null};return l.order.splice(h,0,b),l.created.push(b),b},z=l=>jt(l,o),$=l=>l===null?null:a.story(l.start.story),K=l=>l===void 0||l==="allMarkup"||l==="original"||l==="model",Z=(l,h,b,P)=>{if(!K(P?.projection))return y("unsupported-content","unknown text projection","projection");if(P?.matchWildcards===true)return y("unsupported-capability","wildcard search is not implemented","matchWildcards");if(P?.ignorePunct===true)return y("unsupported-capability","ignoring punctuation is not implemented","ignorePunct");if(P?.ignoreSpace===true)return y("unsupported-capability","ignoring whitespace is not implemented","ignoreSpace");if(!chunkJGNVNT2A_cjs.sa(b))return y("unsupported-content","that is not a query this host will scan for","text");let C=P?.limit;if(C!==void 0&&(!Number.isInteger(C)||C<0))return y("invalid-offset","limit must be a non-negative integer",String(C));let L=_i(l,h,o,b,P);return L.ok?D({kind:"spans",spans:L.spans}):y("invalid-offset","projection mapping failed",L.paragraphId)},Q=(l,h,b,P=false)=>{let C=h.start.paragraphId,L=l.textEdits.has(C)?M(l,C):l.touched.has(C)?y("conflicting-operations","text edits cannot share a paragraph with other edits",C):E(l,C);return L||Ua(l.textEdits,h,b,o,P)},at=(l,h,b,P=false)=>{if(typeof b!="string"||Gt.test(b))return y("unsupported-content","insertText needs text without paragraph marks","text");let C=Xt(l.reads.part,h.paragraphId,h.offset,h.offset,b);if(C)return C;let L=g(l);if(L)return L;let i=t.replacementLanding?.(h.paragraphId,h.offset,h.offset)!=null,m=!i&&Va(l.reads.part,h.paragraphId,h.offset,b);if(m)return m;if(!i&&ko(l.reads.part,h.paragraphId,h.offset))return Q(l,{start:h,end:h},b,P);let k=N(l,h.paragraphId);return k||{ok:true,kind:"command",ops:xe(h.paragraphId,h.offset,b),story:l.reads.story,answer:()=>({kind:"span",span:z({start:h,end:{...h,offset:h.offset+b.length}})})}},gt=(l,h,b)=>{let P=l.reads;if(typeof b!="string")return y("unsupported-content","replaceSpan needs text","text");if(Gt.test(b))return y("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let C=At(h,P),L=h.start.paragraphId,i=[],m=C.length===1?h.end.offset:h.start.offset,k=Xt(P.part,L,h.start.offset,m,b);if(k)return k;let S=g(l);if(S)return S;let T=C.length===1?h.end.offset:(P.rawText(L)??"").length,F=t.replacementLanding?.(L,h.start.offset,T);if(C.length===1&&F==null&&ko(P.part,L,h.start.offset))return Q(l,h,b);if(C.length===1){let rt=N(l,L);if(rt)return rt;if(F==null)return $a(P.part,h,b,o);h.end.offset>h.start.offset&&i.push({op:"deleteText",paragraphId:L,start:h.start.offset,end:h.end.offset});}else {for(let et of C){let nt=N(l,et);if(nt)return nt}let rt=h.end.paragraphId,V=(P.rawText(L)??"").length;h.start.offset<V&&i.push({op:"deleteText",paragraphId:L,start:h.start.offset,end:V}),h.end.offset>0&&i.push({op:"deleteText",paragraphId:rt,start:0,end:h.end.offset});for(let et of C.slice(1,-1))i.push({op:"deleteBlock",blockId:et});i.push({op:"joinParagraphs",firstId:L,secondId:rt});for(let et of C.slice(1)){let nt=l.slotById.get(et);nt&&l.order.splice(H(l,nt),1);}}let B=F??h.start.offset;i.push(...xe(L,B,b));let q={...h.start,paragraphId:L,offset:B},X=()=>({kind:"span",span:z({start:q,end:{...q,offset:q.offset+b.length}})});return {ok:true,kind:"command",ops:i,story:l.reads.story,answer:X}},xt=(l,h)=>{let b=l.reads;if(typeof h!="string")return y("unsupported-content","replaceSpan needs text","text");if(Gt.test(h))return y("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let P=b.blocks,C=P.filter(V=>V.removable),L=P.filter(V=>!V.removable).flatMap(V=>V.paragraphIds),i=L.length===0?C.find(V=>V.kind==="paragraph"):void 0;if(!i&&L.length===0)return y("invalid-offset","that story holds no paragraph this host can write into","no-top-level-paragraph");let m=g(l);if(m)return m;for(let V of b.paragraphIds){let et=N(l,V);if(et)return et}let k=[],S=(i?[i.id]:[...L]).sort((V,et)=>b.indexOf(V)-b.indexOf(et)),T=S[0],F=(b.rawText(T)??"").length;for(let V of S){let et=(b.rawText(V)??"").length;et>0&&k.push({op:"deleteText",paragraphId:V,start:0,end:et});}for(let V of C)V.id!==i?.id&&k.push({op:"deleteBlock",blockId:V.id});let B=t.replacementLanding?.(T,0,F)??0,q=Xt(b.part,T,0,F,h);if(q)return q;k.push(...xe(T,B,h));for(let V of C)if(V.id!==i?.id)for(let et of V.paragraphIds){let nt=l.slotById.get(et);nt&&l.order.splice(H(l,nt),1);}let X={story:b.story,paragraphId:T,index:b.indexOf(T),offset:B},rt=()=>({kind:"span",span:z({start:X,end:{...X,offset:B+h.length}})});return {ok:true,kind:"command",ops:k,story:b.story,answer:rt}},lt=(l,h)=>{if(!Array.isArray(h)||h.length<1||h.length>1e4||h.some(P=>typeof P!="string"||Gt.test(P))||!chunkFIJZIQXA_cjs.nh(h))return y("unsupported-content","replaceStoryBlocks needs 1-10000 valid XML text strings without paragraph marks","paragraphs");let b=g(l);if(b)return b;for(let P of l.reads.paragraphIds){let C=N(l,P);if(C)return C}l.order.splice(0,l.order.length);for(let P=0;P<h.length;P+=1)_(l,P);return {ok:true,kind:"command",ops:[{op:"replaceStoryBlocks",storyRootId:l.reads.root.id,paragraphs:h}],story:l.reads.story,answer:()=>st}},dt=(l,h,b,P)=>{let C=l.reads;if(typeof P!="string")return y("unsupported-content","insertParagraph needs text","text");if(Gt.test(P))return y("unsupported-content","a paragraph mark inside a paragraph\u2019s text is not written by this host","paragraph-mark-in-text");let L=g(l);if(L)return L;let i=N(l,h.paragraphId);if(i)return i;let m=l.slotById.get(h.paragraphId);if(!m)return y("invalid-handle","that paragraph is not in the body");let k=(C.rawText(h.paragraphId)??"").length,S=b==="after"?k:0,T=Xt(C.part,h.paragraphId,S,S,P);if(T)return T;let F=[];b==="after"?(F.push(...xe(h.paragraphId,k,P)),F.push({op:"splitParagraph",paragraphId:h.paragraphId,offset:k})):(F.push(...xe(h.paragraphId,0,P)),F.push({op:"splitParagraph",paragraphId:h.paragraphId,offset:P.length}));let B=_(l,H(l,m)+1);b==="before"&&l.retargets.push({from:h.paragraphId,slot:B});let q=()=>{let X=b==="after"?B.id:h.paragraphId;return X===null?st:{kind:"handle",handle:o.paragraph(X,C.story)}};return {ok:true,kind:"command",ops:F,story:C.story,answer:q}},Rt=(l,h,b,P,C)=>{let L=l.reads;if(!Array.isArray(b)||b.length===0)return y("unsupported-content","split needs at least one delimiter","delimiters");if(b.length>cd)return y("unsupported-content","too many delimiters",String(b.length));for(let V of b){if(typeof V!="string"||V.length===0)return y("unsupported-content","a delimiter must be a non-empty string","delimiters");if(V.length>pd)return y("unsupported-content","that delimiter is too long","delimiters")}let i=g(l);if(i)return i;let m=N(l,h.paragraphId);if(m)return m;let k=l.slotById.get(h.paragraphId);if(!k)return y("invalid-handle","that paragraph is not in the body");let{text:S,occurrences:T}=za(L,h.paragraphId,b),F=[],B=[],q=[];if(T.length===0)q.push(S);else if(P){for(let nt of [...T].reverse())F.push({op:"deleteText",paragraphId:h.paragraphId,start:nt.start,end:nt.start+nt.length});let V=0,et=0;for(let nt of T){let Vn=nt.start-V;B.push(Vn),q.push(S.slice(et,nt.start)),et=nt.start+nt.length,V+=nt.length;}q.push(S.slice(et));}else {let V=0;for(let et of T){let nt=et.start+et.length;B.push(nt),q.push(S.slice(V,nt)),V=nt;}q.push(S.slice(V));}B.length>0&&F.push({op:"splitParagraphMany",paragraphId:h.paragraphId,offsets:B});let X=[k];for(let V=0;V<B.length;V+=1)X.push(_(l,H(l,k)+1+V));let rt=V=>{let et=V.story(L.story),nt=[];return X.forEach((Vn,Ns)=>{let Un=Vn.id;if(Un===null)return;let Wn=et?.rawText(Un)??q[Ns]??"",[Es,Ls]=C?Ya(Wn,0,Wn.length):[0,Wn.length],jo=o.paragraph(Un,L.story);nt.push({start:{paragraph:jo,offset:Es},end:{paragraph:jo,offset:Ls}});}),{kind:"spans",spans:nt}};return {ok:true,kind:"command",ops:F,story:L.story,answer:rt}},Ot=(l,h)=>{let b=g(l);if(b)return b;let P=N(l,h.paragraphId);if(P)return P;let C=l.slotById.get(h.paragraphId);return C&&l.order.splice(H(l,C),1),{ok:true,kind:"command",ops:[{op:"deleteBlock",blockId:h.paragraphId}],story:l.reads.story,answer:()=>st}},Vt=(l,h,b)=>{let P=l.reads,C=P.part,L=g(l);if(L)return L;let i=Mi(b??{});if(!i.ok)return y("unsupported-content","that is not formatting this host writes",i.detail);let m=[];for(let k of ne(h,P)){if(k.end<=k.start&&!k.whole)continue;let S=R(l,k.paragraphId,"runs");if(S)return S;for(let T of e(C,k.paragraphId,k.start,k.end,i.value.filter(F=>F.localName!=="vertAlign"),t.displayMode))m.push({op:"setRunProperties",paragraphId:k.paragraphId,start:T.start,end:T.end,properties:Io(T.properties,b),...T.targetRunIds?{targetRunIds:T.targetRunIds}:{}});k.whole&&m.push({op:"setParagraphMarkProperties",paragraphId:k.paragraphId,properties:Io(n(C,k.paragraphId,i.value.filter(T=>T.localName!=="vertAlign")),b)});}return m.length===0?y("invalid-offset","that range covers no characters to format","collapsed-range"):{ok:true,kind:"command",ops:m,story:P.story,answer:()=>st}},U=(l,h,b)=>{let P=l.reads,C=P.part,L=g(l);if(L)return L;let i=bn(b,P.styles());if(!i.ok)return y("unsupported-content","that is not a style this document has",i.detail);let m={localName:"pStyle",attributes:{val:i.styleId}},k=[];for(let S of At(h,P)){let T=R(l,S,"paragraph");if(T)return T;k.push({op:"setParagraphProperties",paragraphId:S,properties:chunkFIJZIQXA_cjs.Fh(chunkFIJZIQXA_cjs.Dh(C,S),m)});}return k.length===0?y("invalid-offset","that story holds no paragraph to style","empty-story"):{ok:true,kind:"command",ops:k,story:P.story,answer:()=>st}},W=(l,h,b)=>{let P=l.reads,C=P.part,L=g(l);if(L)return L;let i=Hi(C,h.paragraphId,b??{},P.styles());if(!i.ok)return y("unsupported-content","that is not paragraph formatting this host writes",i.detail);let m=R(l,h.paragraphId,"paragraph");return m||{ok:true,kind:"command",ops:i.unchanged?[]:[{op:"setParagraphProperties",paragraphId:h.paragraphId,properties:i.value}],story:P.story,answer:()=>st}},Pt=(l,h)=>{let b=a.body;if(!b)return y("document-unavailable","this host holds no document right now");let P=a.sections();if(!P[l])return y("invalid-handle","that section is not in this document");let L=ga(h);if(!L.ok)return y("unsupported-content",L.reason,L.detail);let i=Ga(b,P,l);if(i===null)return y("unsupported-content","that section holds no paragraph to address it by","no-anchor");let m=d(b),k=g(m);return k||{ok:true,kind:"command",ops:[{op:"setSectionProperties",...L.value,anchorParagraphId:i}],story:Ct,answer:()=>st}},it=(l,h)=>({ok:true,kind:"command",ops:[{op:"deleteNote",noteKind:l,noteId:h}],story:Ct,lifecycle:true,answer:()=>st}),St=l=>{let h=o.resolve(l,"list");if(!h||h.kind!=="list")return y("invalid-handle","that handle does not name a list","list");let b=a.story(h.story);if(!b)return y("invalid-handle","that story is not in this document");let P=ae(b).find(C=>C.numId===h.numId);return P?{ok:true,plan:d(b),list:P}:y("invalid-handle","this story numbers nothing with that list",h.numId)},Ie=l=>{if(typeof l!="object"||l===null)return y("invalid-handle","that is not a scope a control lives in","scope");let h=l;if("body"in l){let b=ut(h.body,"body",o,a);return b.ok?{reads:b.value,node:b.value.root}:y(b.code,"that handle does not name a body",b.detail)}if("contentControl"in l){let b=bt(h.contentControl);return "control"in b?{reads:b.reads,node:b.node}:b}return y("invalid-handle","that is not a scope a control lives in","scope")},bt=l=>{let h=o.resolve(l,"contentControl");if(!h||h.kind!=="contentControl")return y("invalid-handle","that handle does not name a content control","contentControl");let b=a.story(h.story);if(!b)return y("invalid-handle","that story is not in this document");let P=cs(b,h.nodeId),C=ps(b,h.nodeId);return !P||!C?y("invalid-handle","this document no longer holds that content control"):{reads:b,control:P,node:C}},ws=(l,h,b)=>{if(!Number.isInteger(b)||b<0||b>ve)return y("invalid-offset",`a list level is 0 to ${String(ve)}`,String(b));let P=je(l.reads,h);if(!P)return y("unsupported-content","that paragraph is not in a list",h);if(!a.package||!Be(a.package,P.numId,b))return y("unsupported-content","list level is not defined; configure that level first",h);let C=g(l);if(C)return C;let L=R(l,h,"paragraph");return L||{ok:true,kind:"command",ops:[{op:"setListLevel",paragraphId:h,level:b}],story:l.reads.story,answer:()=>st}},Cs=(l,h,b,P)=>{if(b!=="start"&&b!=="end")return y("unknown-operation","a list takes an item at its start or its end",String(b));let C=l.reads,L=b==="start"?h.paragraphIds[0]:h.paragraphIds[h.paragraphIds.length-1];if(L===void 0)return y("invalid-handle","that list holds no paragraph");let i={story:C.story,paragraphId:L,index:C.indexOf(L)};return dt(l,i,b==="start"?"before":"after",P)},Ho=(l,h)=>{if(h.start.paragraphId!==h.end.paragraphId)return null;for(let b of Bi(l,h.start.paragraphId))if(b.start<=h.start.offset&&b.end>=h.end.offset)return b;return null},Ts=(l,h,b)=>{if(typeof b!="string")return y("unsupported-content","a hyperlink target is a string","target");let P=l.reads,C=Ho(P,h),L=h.start.paragraphId===h.end.paragraphId&&h.start.offset===h.end.offset,i=C&&(h.start.offset!==C.start||h.end.offset!==C.end),m=i?{range:{start:h.start.offset,end:h.end.offset}}:{};if(i){let X=P.node(C.paragraphId),rt=X?.kind==="paragraph"?X.children.find(V=>V.id===C.id):void 0;if(L||!rt||!chunkFIJZIQXA_cjs.Ui(rt)||X?.kind!=="paragraph"||!X.children.some(V=>V.id===C.id))return y("unsupported-capability","partial hyperlink edits require ordinary text in a paragraph")}if(b.length===0){if(!C)return y("unsupported-content","that text is not a link","no-link");let X=g(l);if(X)return X;let rt=E(l,C.paragraphId);return rt||{ok:true,kind:"command",ops:[{op:"removeHyperlink",linkId:C.id,...m}],story:P.story,answer:()=>st}}let k={},S=null;if(b.startsWith("#")){let X=b.slice(1);if(X.length===0||!wo(P,X))return y("unsupported-content","this document declares no such bookmark",b);k={anchor:X};}else {if(chunkFIJZIQXA_cjs.Gg(b)===null)return y("unsupported-content","this engine will not author that target","target");S=b;}let T=g(l);if(T)return T;let F=X=>S===null?{ok:true,kind:"command",ops:[X(k)],story:P.story,answer:()=>st}:{ok:true,kind:"command",ops:[],relate:{url:S,ops:rt=>[X({relationshipId:rt})]},story:P.story,answer:()=>st};if(C){let X=E(l,C.paragraphId);return X||F(rt=>({op:"setHyperlinkTarget",linkId:C.id,...m,...rt}))}if(L)return y("unsupported-content","a link with no text has nothing to click","collapsed");if(h.start.paragraphId!==h.end.paragraphId)return y("unsupported-content","a link lives inside one paragraph","crosses-paragraph-mark");let B=E(l,h.start.paragraphId);if(B)return B;let q=P.styles().idOf("hyperlink");return F(X=>({op:"insertHyperlink",paragraphId:h.start.paragraphId,start:h.start.offset,end:h.end.offset,...X,...q===null?{}:{styleId:q}}))},Fo=(l,h,b)=>{let P=l.reads;if(!r.selection||!t.select)return y("unsupported-capability","this host has no reader to move","selection");if(b!=="select"&&b!=="start"&&b!=="end")return y("unknown-operation","that is not a selection mode",String(b));let C=At(h,P);for(let L of C)if(l.touched.has(L))return y("conflicting-operations","this batch edits a paragraph the selection covers",L);for(let L of C)l.selected.add(L);return c.push({range:h,mode:b}),{ok:true,kind:"command",ops:[],story:P.story,answer:()=>st}},Do=l=>{let h=o.resolve(l,"bookmark");if(!h||h.kind!=="bookmark")return y("invalid-handle","that handle does not name a bookmark","bookmark");let b=a.story(h.story);if(!b)return y("invalid-handle","that story is not in this document");let P=wo(b,h.name);if(!P)return y("invalid-handle","this document no longer declares that bookmark",h.name);let C=L=>({story:b.story,paragraphId:L.paragraphId,index:b.indexOf(L.paragraphId),offset:L.offset});return {reads:b,range:{start:C(P.start),end:C(P.end)}}},Bo=(l,h)=>{let b=xi(l,i=>Bo(i,h));if(b)return b;let P=ci(l,t,i=>Mo({...t,reads:i}));if(P)return h&&P.ok&&P.kind==="command"?y("unsupported-content","header/footer creation cannot be tracked"):P;let C=di(l,{trackingAuthor:h,trackedRangeReplacement:t.trackedRangeReplacement,handles:o,reads:a,admitWrite:(i,m,k)=>{let S=d(i),T=g(S);if(T)return T;for(let F of k){let B=N(S,F);if(B)return B}return S.externalCreatedCount+=m,null}});if(C)return C;let L=h!==void 0;if(L){let i=qi(l,h,o,a);if("ok"in i)return i;l=i;}switch(l.op){case "getFields":case "getField":case "setFieldCode":case "deleteField":case "updateFieldResult":case "insertField":return ii(l,o,a,(i,m,k)=>{let S=d(i);return g(S)??(k?null:N(S,m))},t.fieldPageContext);case "getShapes":case "getShape":case "getShapeBody":return Ca(l,o,a);case "getInlinePictures":case "getInlinePicture":case "setInlinePicture":case "deleteInlinePicture":case "insertInlinePicture":return yi(l,o,a,(i,m)=>{let k=d(i);return g(k)??N(k,m)});case "insertBreak":return ki(l,o,a,(i,m,k)=>{let S=d(i),T=g(S)??N(S,m);return T||(S.externalCreatedCount+=k),T});case "startNewList":case "attachToList":case "detachFromList":case "setListLevelFormat":return Pi(l,o,a,(i,m,k)=>{let S=d(i);return g(S)??R(S,m,k?`list:${k.numId}:${k.level}`:"paragraph")},h);case "removeDocumentInformation":case "getDocumentProperty":case "setDocumentProperties":return Ma(l,a,()=>g(d(a.body)),!t.collaborative);case "getDocument":return D({kind:"handle",handle:o.document()});case "getBody":return o.resolve(l.document,"document")?a.body?D({kind:"handle",handle:o.body(Ct)}):y("document-unavailable","this host holds no document right now"):y("invalid-handle","that handle does not name a document","document");case "getParagraphs":{let i=ut(l.body,"body",o,a);return i.ok?D({kind:"handles",handles:i.value.paragraphIds.map(m=>o.paragraph(m,i.value.story))}):y(i.code,"that handle does not name a body",i.detail)}case "getRange":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","empty story");if(!["Whole","Content","Start","End"].includes(l.location))return y("unsupported-content","unsupported range location");let m=i.value,k=l.location==="Start"?{start:m.start,end:m.start}:l.location==="End"?{start:m.end,end:m.end}:m;return D({kind:"span",span:jt(k,o)})}case "getSpanParagraphs":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.span,o,a);return m.ok?D({kind:"handles",handles:At(i.value,m.value).map(k=>o.paragraph(k,m.value.story))}):y(m.code,"that span is not a place",m.detail)}case "getText":{if(!K(l.projection))return y("unsupported-content","unknown text projection","projection");if(o.resolve(l.target,"body")){let S=ut(l.target,"body",o,a);return S.ok?D({kind:"text",text:S.value.text(l.projection??"allMarkup")}):y(S.code,"that handle does not name a body",S.detail)}let m=ct(l.target,o,a);if(!m.ok)return y(m.code,"that handle does not name a body or a paragraph",m.detail);let k=a.story(m.value.story);return D({kind:"text",text:k?.paragraphText(m.value.paragraphId,l.projection??"allMarkup")??""})}case "getSpanText":{if(!K(l.projection))return y("unsupported-content","unknown text projection","projection");let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.span,o,a);return m.ok?D({kind:"text",text:wa(i.value,m.value,so,l.projection??"allMarkup")}):y(m.code,"that span is not a place",m.detail)}case "getParagraphId":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let k=a.story(i.value.story)?.paragraph(i.value.paragraphId);return D({kind:"text",text:k?.paraId??""})}case "search":{let i=J(l.scope,o,a);if(!i.ok)return y(i.code,"that is not a scope to search",i.detail);let m=ot(l.scope,o,a);return m.ok?Z(m.value,i.value,l.text,l.options):y(m.code,"that is not a scope to search",m.detail)}case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":return ts(l,L,o,a,(i,m)=>{let k=d(i);return g(k)??N(k,m)},t.trackedRangeReplacement!==false);case "insertText":{let i=ye(l.at,o,a);if(!i.ok)return y(i.code,"that is not a place to insert at",i.detail);let m=a.story(i.value.story);return m?at(d(m),i.value,l.text,"at"in l.at&&l.at.at==="start"):y("invalid-handle","that story is not in this document")}case "replaceSpan":{if("body"in l.span){let k=ut(l.span.body,"body",o,a);return k.ok?xt(d(k.value),l.text):y(k.code,"that handle does not name a body",k.detail)}let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","that story holds no paragraph to write into","empty-story");let m=$(i.value);return m?gt(d(m),i.value,l.text):y("invalid-handle","that story is not in this document")}case "replaceStoryBlocks":{let i=ut(l.body,"body",o,a);return i.ok?lt(d(i.value),l.paragraphs):y(i.code,"that handle does not name a body",i.detail)}case "insertParagraph":{let i=On(l.anchor,o,a);if(!i.ok)return y(i.code,"that is not a paragraph to insert beside",i.detail);if(l.where!=="before"&&l.where!=="after")return y("unknown-operation","that is not a place to insert",String(l.where));let m=a.story(i.value.story);if(!m)return y("invalid-handle","that story is not in this document");let k=L&&es(m,i.value.paragraphId,h);return k?{ok:false,error:k}:dt(d(m),i.value,l.where,l.text)}case "splitParagraph":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let m=a.story(i.value.story);return m?Rt(d(m),i.value,l.delimiters,l.trimDelimiters===true,l.trimSpacing===true):y("invalid-handle","that story is not in this document")}case "getFont":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.span,o,a);if(!m.ok)return y(m.code,"that span is not a place",m.detail);let k=ne(i.value,m.value);return D({kind:"font",font:Ni(m.value.part,k,t.displayMode)})}case "setFont":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","that story holds no paragraph to format","empty-story");let m=$(i.value);return m?Vt(d(m),i.value,l.font):y("invalid-handle","that story is not in this document")}case "getStyle":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.span,o,a);if(!m.ok)return y(m.code,"that span is not a place",m.detail);let k=m.value.part,S=m.value.styles(),T=At(i.value,m.value).map(B=>xn(k,B,S)),F=T.length>0&&T.every(B=>B!==null&&B===T[0])?T[0]:null;return D({kind:"style",name:F})}case "setStyle":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","that story holds no paragraph to style","empty-story");let m=$(i.value);return m?U(d(m),i.value,l.name):y("invalid-handle","that story is not in this document")}case "getParagraphFormat":{let i=On(l.paragraph,o,a);if(!i.ok)return y(i.code,"that is not a paragraph",i.detail);let m=a.story(i.value.story);if(!m)return y("document-unavailable","this host holds no document right now");let k=Li(m.part,i.value.paragraphId,m.styles());return k?D({kind:"paragraphFormat",format:k}):y("invalid-handle","that handle does not name a paragraph")}case "setParagraphFormat":{let i=On(l.paragraph,o,a);if(!i.ok)return y(i.code,"that is not a paragraph",i.detail);let m=a.story(i.value.story);return m?W(d(m),i.value,l.format):y("invalid-handle","that story is not in this document")}case "deleteParagraph":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let m=a.story(i.value.story);return m?Ot(d(m),i.value):y("invalid-handle","that story is not in this document")}case "getSections":return o.resolve(l.document,"document")?D({kind:"handles",handles:a.sections().map(i=>o.section(i.index))}):y("invalid-handle","that handle does not name a document","document");case "getPageSetup":{let i=o.resolve(l.section,"section");if(!i||i.kind!=="section")return y("invalid-handle","that handle does not name a section","section");let m=a.sections()[i.index];return m?D({kind:"pageSetup",setup:m.pageSetup}):y("invalid-handle","that section is not in this document")}case "setPageSetup":{let i=o.resolve(l.section,"section");return !i||i.kind!=="section"?y("invalid-handle","that handle does not name a section","section"):Pt(i.index,l.setup)}case "getFurniture":{let i=o.resolve(l.section,"section");if(!i||i.kind!=="section")return y("invalid-handle","that handle does not name a section","section");if(l.kind!=="header"&&l.kind!=="footer")return y("unknown-operation","that is not furniture",String(l.kind));let m={kind:l.kind,sectionIndex:i.index,variant:l.variant};return ao(m)?a.sections()[i.index]?D({kind:"handle",handle:o.body(m)}):y("invalid-handle","that section no longer exists"):y("unknown-operation","that is not a furniture variant",String(l.variant))}case "getNotes":{if(!o.resolve(l.document,"document"))return y("invalid-handle","that handle does not name a document","document");if(l.noteKind!=="footnote"&&l.noteKind!=="endnote")return y("unknown-operation","that is not a kind of note",String(l.noteKind));let i=l.noteKind,m=a.noteIds(i);if(!m.ok)return y("ambiguous-document",`${i} identities are not completely and unambiguously enumerable`,m.reason==="duplicates"?m.duplicateIds.join(","):m.reason);let k=m.ids;if(l.scope){let S=ut(l.scope,"body",o,a);if(!S.ok)return y(S.code,"that handle does not name a body",S.detail);let T=Ha(S.value.root,i),F=new Set(m.ids);if(T.some(B=>!F.has(B)))return y("ambiguous-document","a note reference has no matching note");k=T;}return D({kind:"handles",handles:k.map(S=>o.note(i,S))})}case "getNoteBody":case "getNoteText":{let i=o.resolve(l.note,"note");if(!i||i.kind!=="note")return y("invalid-handle","that handle does not name a note","note");let m=i,k=a.story(m);return k?l.op==="getNoteText"?D({kind:"text",text:k.text(l.projection)}):D({kind:"handle",handle:o.body(m)}):y("invalid-handle","that note is not in this document",G(m))}case "getNoteKind":{let i=o.resolve(l.note,"note");return !i||i.kind!=="note"?y("invalid-handle","that handle does not name a note","note"):D({kind:"text",text:i.noteKind})}case "deleteNote":{let i=o.resolve(l.note,"note");if(!i||i.kind!=="note")return y("invalid-handle","that handle does not name a note","note");let m=a.noteIds(i.noteKind);return m.ok?m.ids.includes(i.noteId)?it(i.noteKind,i.noteId):y("invalid-handle","that note is not in this document"):y("ambiguous-document",`${i.noteKind} identities are not completely and unambiguously enumerable`,m.reason==="duplicates"?m.duplicateIds.join(","):m.reason)}case "getLists":{let i=ut(l.body,"body",o,a);return i.ok?D({kind:"handles",handles:ae(i.value).map(m=>o.list(m.numId,i.value.story))}):y(i.code,"that handle does not name a body",i.detail)}case "getListId":{let i=St(l.list);return "list"in i?D({kind:"number",value:Number(i.list.numId)}):i}case "getListById":{let i=ut(l.body,"body",o,a);if(!i.ok)return y(i.code,"that handle does not name a body",i.detail);if(!Number.isInteger(l.id)||l.id<=0)return y("unsupported-content","a list is numbered from one",String(l.id));let m=String(l.id),k=ae(i.value).find(S=>S.numId===m);return k?D({kind:"handle",handle:o.list(k.numId,i.value.story)}):y("invalid-handle","no list in that story carries that number",m)}case "getListParagraphs":{let i=St(l.list);if(!("list"in i))return i;let m=l.level;if(m!==void 0&&(!Number.isInteger(m)||m<0||m>ve))return y("invalid-offset",`a list level is 0 to ${String(ve)}`,String(m));let k=i.plan.reads,S=m===void 0?i.list.paragraphIds:i.list.paragraphIds.filter(T=>je(k,T)?.level===m);return D({kind:"handles",handles:S.map(T=>o.paragraph(T,k.story))})}case "getParagraphList":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let m=a.story(i.value.story);if(!m)return y("invalid-handle","that story is not in this document");let k=je(m,i.value.paragraphId);return k?D({kind:"handle",handle:o.list(k.numId,m.story)}):y("unsupported-content","that paragraph is not in a list",i.value.paragraphId)}case "getListLevel":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let m=a.story(i.value.story);if(!m)return y("invalid-handle","that story is not in this document");let k=je(m,i.value.paragraphId);return k?D({kind:"number",value:k.level}):y("unsupported-content","that paragraph is not in a list",i.value.paragraphId)}case "setListLevel":{let i=ct(l.paragraph,o,a);if(!i.ok)return y(i.code,"that handle does not name a paragraph",i.detail);let m=a.story(i.value.story);return m?ws(d(m),i.value.paragraphId,l.level):y("invalid-handle","that story is not in this document")}case "insertListParagraph":{let i=St(l.list);return "list"in i?Cs(i.plan,i.list,l.where,l.text):i}case "getHyperlink":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.span,o,a);if(!m.ok)return y(m.code,"that span is not a place",m.detail);let k=a.package;if(!k||!i.value)return D({kind:"text",text:""});let S=Ho(m.value,i.value);if(!S)return D({kind:"text",text:""});let T=chunkFIJZIQXA_cjs.Ta(m.value.part,S.id),F=T?ji(k,m.value.part.name,T):null;return D({kind:"text",text:F??""})}case "setHyperlink":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","that story holds no text to link","empty-story");let m=$(i.value);return m?Ts(d(m),i.value,l.target):y("invalid-handle","that story is not in this document")}case "getBookmarks":{let i=J(l.scope,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);let m=ot(l.scope,o,a);if(!m.ok)return y(m.code,"that span is not a place",m.detail);let k=m.value,S=i.value,T=S===null?null:new Set(At(S,k)),F=So(k).filter(B=>{if(!T||!T.has(B.start.paragraphId)&&!T.has(B.end.paragraphId)||S===null)return false;let q=B.start.paragraphId===S.end.paragraphId&&B.start.offset>S.end.offset,X=B.end.paragraphId===S.start.paragraphId&&B.end.offset<S.start.offset;return !q&&!X});return D({kind:"handles",handles:F.map(B=>o.bookmark(B.name,k.story))})}case "getBookmarkName":{let i=o.resolve(l.bookmark,"bookmark");return !i||i.kind!=="bookmark"?y("invalid-handle","that handle does not name a bookmark","bookmark"):D({kind:"text",text:i.name})}case "getBookmarkRange":{let i=Do(l.bookmark);return "reads"in i?D({kind:"span",span:z(i.range)}):i}case "getComments":{let i=J(l.scope,o,a);if(!i.ok)return y(i.code,"that scope is not a place",i.detail);let m=ot(l.scope,o,a);if(!m.ok)return y(m.code,"that scope names no story",m.detail);let k=m.value,S=v(k);if(!S)return y("document-unavailable","this host holds no document");let T=i.value,F=S.roots.filter(B=>{if(!T)return true;let q=B.range;if(!q)return false;let X=k.indexOf(q.start.paragraphId),rt=k.indexOf(q.end.paragraphId),V=k.indexOf(T.start.paragraphId),et=k.indexOf(T.end.paragraphId);return rt<V||X>et?false:rt===V&&X===V&&et===V?q.end.offset>T.start.offset&&q.start.offset<T.end.offset:true});return D({kind:"handles",handles:F.map(B=>o.comment(B.id,k.story))})}case "getCommentReplies":{let i=I(l.comment);return i.ok?D({kind:"handles",handles:i.item.replyIds.map(m=>o.comment(m,i.reads.story))}):i.planned}case "getCommentId":{let i=I(l.comment);return i.ok?D({kind:"text",text:i.item.id}):i.planned}case "getCommentAuthor":{let i=I(l.comment);return i.ok?D({kind:"text",text:i.item.comment.author}):i.planned}case "getCommentDate":{let i=I(l.comment);return i.ok?D({kind:"text",text:i.item.comment.date??""}):i.planned}case "getCommentText":{let i=I(l.comment);if(!i.ok)return i.planned;let m=v(i.reads);return D({kind:"text",text:m?.textOf(i.item.id)??""})}case "getCommentRange":{let i=I(l.comment);if(!i.ok)return i.planned;let m=i.item.range;if(!m||i.item.orphaned)return y("invalid-handle","that comment has no range in this document");let k=O(i.reads,m);return k?D({kind:"span",span:k}):y("invalid-handle","that comment\u2019s range is no longer in the story")}case "getCommentResolved":{let i=I(l.comment);return i.ok?D({kind:"flag",value:i.item.resolved}):i.planned}case "insertComment":return ls(l,o,a,A);case "setCommentResolved":{let i=I(l.comment);if(!i.ok)return i.planned;if(typeof l.resolved!="boolean")return y("unsupported-content","resolved is a yes or a no",String(l.resolved));let m=g(d(i.reads));return m||{ok:true,kind:"commentWrite",write:{kind:"resolve",commentId:i.item.id,resolved:l.resolved},story:i.reads.story,answer:()=>st}}case "replyToComment":{let i=I(l.comment);if(!i.ok)return i.planned;let m=Eo({author:l.author,text:l.text,date:l.date,kind:"reply"});if(m)return m;let k=i.item.range;if(!k||i.item.orphaned)return y("invalid-handle","that comment has no range to reply over");let S=g(d(i.reads));if(S)return S;let T=i.reads.story,F=Lo(l.date);return {ok:true,kind:"commentWrite",write:{kind:"reply",parentCommentId:i.item.id,anchor:{paragraphId:k.start.paragraphId,start:k.start.offset,end:k.end.offset,...k.end.paragraphId===k.start.paragraphId?{}:{endParagraphId:k.end.paragraphId}},text:l.text,author:l.author,...F===void 0?{}:{date:F}},story:i.reads.story,answer:(B,q)=>q===void 0?st:{kind:"handle",handle:o.comment(q,T)}}}case "deleteComment":{let i=I(l.comment);return i.ok?ds(i.item,i.reads,m=>g(d(m))):i.planned}case "getRevisions":{let i=ut(l.body,"body",o,a);if(!i.ok)return y(i.code,"that handle does not name a body",i.detail);let m=i.value;return D({kind:"handles",handles:Co(m).map(k=>o.revision(k.id,m.story))})}case "getRevisionType":{let i=w(l.revision);return i.ok?D({kind:"text",text:i.item.type}):i.planned}case "getRevisionAuthor":{let i=w(l.revision);return i.ok?D({kind:"text",text:i.item.author}):i.planned}case "getRevisionDate":{let i=w(l.revision);return i.ok?D({kind:"text",text:i.item.date}):i.planned}case "getRevisionRange":{let i=w(l.revision);if(!i.ok)return i.planned;let[m]=i.item.item.ranges;if(!m)return y("invalid-handle","that change covers no characters");let k=O(i.reads,m);return k?D({kind:"span",span:k}):y("invalid-handle","that change\u2019s range is no longer in the story")}case "acceptRevision":case "rejectRevision":{let i=w(l.revision);if(!i.ok)return i.planned;let m=d(i.reads),k=g(m);if(k)return k;let S=as(i.reads,i.item.item,l.op==="acceptRevision"?"accept":"reject");return S.length?{ok:true,kind:"command",story:i.reads.story,ops:S,answer:()=>st}:y("unsupported-revision","the table decision has unresolved dependencies")}case "resolveRevisionBatch":case "setRevisionAuthorBatch":case "acceptAllRevisions":case "rejectAllRevisions":return rs(l,o,a,i=>g(d(i)));case "selectSpan":{let i=J(l.span,o,a);if(!i.ok)return y(i.code,"that span is not a place",i.detail);if(!i.value)return y("invalid-offset","that story holds no paragraph to select","empty-story");let m=$(i.value);return m?Fo(d(m),i.value,l.mode):y("invalid-handle","that story is not in this document")}case "selectBookmark":{let i=Do(l.bookmark);return "reads"in i?Fo(d(i.reads),i.range,l.mode):i}case "getContentControls":{let i=Ie(l.scope);return "reads"in i?D({kind:"handles",handles:us(i.reads,i.node).map(m=>o.contentControl(m.nodeId,i.reads.story))}):i}case "getContentControlById":{let i=Ie(l.scope);if(!("reads"in i))return i;if(!Number.isInteger(l.id))return y("unsupported-content","a control id is a whole number",String(l.id));let m=be(i.node).find(k=>chunkFIJZIQXA_cjs.Zb(k).id===l.id);return m?D({kind:"handle",handle:o.contentControl(m.id,i.reads.story)}):y("invalid-handle","no control in that scope carries that id",String(l.id))}case "getContentControlsByTag":case "getContentControlsByTitle":{let i=Ie(l.scope);if(!("reads"in i))return i;let m=l.op==="getContentControlsByTag"?l.tag:l.title;if(typeof m!="string"||m.length===0)return y("unsupported-content","a tag or title to match is required",l.op);let k=be(i.node).filter(S=>{let T=chunkFIJZIQXA_cjs.Zb(S);return l.op==="getContentControlsByTag"?T.tag===m:T.alias===m});return D({kind:"handles",handles:k.map(S=>o.contentControl(S.id,i.reads.story))})}case "getContentControlTag":case "getContentControlTitle":case "getContentControlFileId":case "getContentControlSubtype":case "getContentControlLock":{let i=bt(l.contentControl);if(!("control"in i))return i;let m=i.control.properties;if(l.op==="getContentControlLock")return D({kind:"text",text:i.control.lock});if(l.op==="getContentControlSubtype")return D({kind:"text",text:m.type});if(l.op==="getContentControlFileId")return D({kind:"text",text:m.id===void 0?"":String(m.id)});let k=l.op==="getContentControlTag"?m.tag:m.alias;return D({kind:"text",text:k??""})}case "getContentControlIsBound":case "getContentControlPlaceholderShown":case "getContentControlTemporary":{let i=bt(l.contentControl);if(!("control"in i))return i;let m=l.op==="getContentControlIsBound"?i.control.properties.dataBinding!==void 0:l.op==="getContentControlPlaceholderShown"?i.control.properties.showingPlaceholder:i.control.properties.temporary;return D({kind:"flag",value:m})}case "getContentControlText":{let i=bt(l.contentControl);return "control"in i?D({kind:"text",text:fs(i.reads,i.node,l.projection)}):i}case "getContentControlParagraphs":{let i=bt(l.contentControl);return "control"in i?D({kind:"handles",handles:i.control.paragraphIds.map(m=>o.paragraph(m,i.reads.story))}):i}case "getContentControlRange":{let i=bt(l.contentControl);if(!("control"in i))return i;let m=l.location??"whole";if(!Qa.has(m))return y("unsupported-content","that is not a place in a control",m);let k=jn(i.reads,i.node);if(!k)return y("unsupported-content","that control holds nothing addressable","empty");let S=m==="start"||m==="before"?k.start:k.end,T=m!=="whole"&&m!=="content",F=B=>({story:i.reads.story,paragraphId:B.paragraphId,index:i.reads.indexOf(B.paragraphId),offset:B.offset});return D({kind:"span",span:jt(T?{start:F(S),end:F(S)}:{start:F(k.start),end:F(k.end)},o)})}case "setContentControlValue":{let i=bt(l.contentControl);if(!("control"in i))return i;let m=ti(l.value);if(!m.ok)return y(m.code,m.message,m.detail);let k=d(i.reads),S=g(k);return S||{ok:true,kind:"command",story:i.reads.story,ops:[{op:"setContentControlValue",controlId:i.control.nodeId,value:m.value}],answer:()=>st}}case "setContentControlProperties":{let i=bt(l.contentControl);if(!("control"in i))return i;if(L&&(!oi(i.reads.part,i.control.nodeId,h)||l.lock!==void 0||l.cannotEdit!==void 0||l.cannotDelete!==void 0))return y("unsupported-capability","tracked control metadata requires an own pending insertion; locks require direct edits");if(l.tag===void 0&&l.title===void 0&&l.lock===void 0&&l.cannotEdit===void 0&&l.cannotDelete===void 0)return y("unsupported-content","nothing to write","no-properties");if(l.lock!==void 0&&!Ja.has(l.lock))return y("unsupported-content","that is not a lock this schema declares",l.lock);for(let T of [l.cannotEdit,l.cannotDelete])if(T!==void 0&&typeof T!="boolean")return y("unsupported-content","lock flags must be boolean");let m=d(i.reads),k=l.lock;if(l.cannotEdit!==void 0||l.cannotDelete!==void 0){let T=k??u.get(m)?.get(i.control.nodeId)??i.control.properties.lock,F=l.cannotEdit??(T==="contentLocked"||T==="sdtContentLocked"),B=l.cannotDelete??(T==="sdtLocked"||T==="sdtContentLocked");k=F?B?"sdtContentLocked":"contentLocked":B?"sdtLocked":"unlocked";}let S=g(m);if(S)return S;if(k!==void 0){let T=u.get(m)??new Map;T.set(i.control.nodeId,k),u.set(m,T);}return {ok:true,kind:"command",story:i.reads.story,ops:[{op:"setContentControlProperties",controlId:i.control.nodeId,...l.tag===void 0?{}:{tag:l.tag},...l.title===void 0?{}:{alias:l.title},...k===void 0?{}:{lock:k}}],answer:()=>st}}case "insertContentControlText":{let i=bt(l.contentControl);if(!("control"in i))return i;let m=qa(i.control.properties,l.text,l.at);if(m)return {ok:false,error:m};let k=d(i.reads),S=g(k);if(S)return S;let T=jn(i.reads,i.node);if(!T)return y("unsupported-content","that control holds nothing addressable","empty");let F=l.at==="end"?T.end:T.start,B=()=>({kind:"span",span:z({start:{story:i.reads.story,paragraphId:F.paragraphId,index:i.reads.indexOf(F.paragraphId),offset:F.offset},end:{story:i.reads.story,paragraphId:F.paragraphId,index:i.reads.indexOf(F.paragraphId),offset:F.offset+l.text.length}})});return l.at==="replace"?{ok:true,kind:"command",story:i.reads.story,ops:[{op:"setContentControlValue",controlId:i.control.nodeId,value:{kind:"text",text:l.text}}],answer:B}:{ok:true,kind:"command",story:i.reads.story,ops:l.text.length===0?[]:[{op:"insertText",paragraphId:F.paragraphId,offset:F.offset,text:l.text,inside:i.node.id}],answer:B}}case "deleteContentControl":{let i=bt(l.contentControl);if(!("control"in i))return i;if(typeof l.keepContent!="boolean")return y("unsupported-content","keepContent is required","keepContent");let m=d(i.reads),k=g(m);return k||{ok:true,kind:"command",story:i.reads.story,ops:[{op:"removeContentControl",controlId:i.control.nodeId,keepContent:l.keepContent}],answer:()=>st}}case "insertContentControl":return ni(l,o,a,h,t.trackedRangeReplacement,(i,m)=>{let k=d(i);return g(k)??N(k,m)});case "insertCustomNode":{let i=xs(l);if(i)return y("unsupported-content",i.message,i.detail);let m=ks(l.payload);if(!m.ok)return y("unsupported-content","that payload cannot be written",m.field);let k=As(l,o,a);if("code"in k)return y(k.code,k.message,k.detail);let{start:S,end:T}=k.range,F=$(k.range);if(!F)return y("invalid-handle","that story is not in this document");let B=g(d(F));return B||{ok:true,kind:"customNodeWrite",story:F.story,write:bs(l,S,T,m.value),answer:()=>st}}default:return y("unknown-operation","this host does not implement that operation",String(l.op))}};return {plan(l,h){if(f&&zt(l))return y("conflicting-operations","header/footer creation must commit alone");let b=p.conflict(l);if(b)return y("conflicting-operations",b.message,b.detail);let P=Bo(l,h);if(P.ok&&P.kind==="command"&&P.solitary){if(p.hasCommands)return y("conflicting-operations","header/footer creation must commit alone");f=true;}return P.ok&&P.kind!=="query"&&p.note(l),P},get hasCommands(){return p.hasCommands},get writeScope(){return x?.reads.scope??null},settle(l){let h=x;if(h){let b=l.story(h.reads.story),P=b&&chunkFIJZIQXA_cjs.Ta(b.part,h.reads.root.id),C=b&&P&&P.id!==b.root.id?vn(b,P):b;if(!C)return {ok:false,detail:`the story this batch wrote is gone: ${G(h.reads.story)}`};let L=new Set(h.reads.paragraphIds),i=C.paragraphIds.filter(k=>!L.has(k));if(i.length!==h.created.length+h.externalCreatedCount)return {ok:false,detail:`planned ${String(h.created.length+h.externalCreatedCount)} new paragraphs, the transaction made ${String(i.length)}`};h.order.filter(k=>k.id===null).forEach((k,S)=>{k.id=i[S]??null;});for(let k of h.retargets)k.slot.id&&o.retarget(k.from,k.slot.id);}for(let b of c){let P=l.story(b.range.start.story);!P||!Xa(b.range,P)||t.select?.(b.range,b.mode);}return {ok:true}}}}var fd=4e6,gd=16e6,vs=12;function Oe(t){if(t===null||typeof t!="object")return false;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Pe(t){return "paragraph"in t&&typeof t.offset=="number"}function Os(t=fd,e=gd){let n=new Map,o=[],r=0,a=0,s=(u,d)=>u.length+d.text.length;return {record(u,d,c){let p=n.get(d),f=p?.at(-1);if(p&&(n.delete(d),n.set(d,p)),f&&f.text===c){u>f.to&&(f.to=u);return}let x={from:u,to:u,text:c};if(a+=s(d,x),!p||!f)n.set(d,[x]);else for(p.push(x),a-=s(d,f),o.push({key:d,record:f}),r+=f.text.length;r>t&&o.length>0;){let g=o.shift();r-=g.record.text.length;let A=n.get(g.key);A?.[0]===g.record&&A.shift();}for(;a>e&&n.size>1;){let[g,A]=n.entries().next().value;n.delete(g);let v=A.at(-1);v&&(a-=s(g,v));}},clear(){n.clear(),o.length=0,r=0,a=0;},size(){return n.size},at(u,d){let c=n.get(d);if(c)for(let p=c.length-1;p>=0;p-=1){let f=c[p];if(f.from<=u)return u<=f.to?f.text:void 0}}}}function le(t,e,n){let o=ct(t.paragraph,e,n);if(!o.ok)return null;let r=n.story(o.value.story),a=r?.rawText(o.value.paragraphId);return a==null||!r?null:{id:o.value.paragraphId,text:a,story:r}}var Ps=t=>`next\0${t}`,Is=(t,e)=>`between\0${t}\0${e}`;function Rs(t,e,n,o){let r=le(t,n,o),a=le(e,n,o);if(!r||!a||r.id===a.id||r.story!==a.story)return null;let s=r.story.indexOf(r.id),u=r.story.indexOf(a.id);if(s<0||u<=s)return null;let d=r.story.paragraphIds.slice(s+1,u);return {key:Is(r.id,a.id),ids:d,texts:d.map(c=>r.story.rawText(c)??"")}}function Ve(t,e,n,o,r,a=0){if(a>vs)return t;if(Array.isArray(t)){let c=false,p=t.map(f=>{let x=Ve(f,e,n,o,r,a+1);return x!==f&&(c=true),x});return c?Object.freeze(p):t}if(!Oe(t))return t;let{start:s,end:u}=t;if(Oe(s)&&Pe(s)&&Oe(u)&&Pe(u)){let c=Rs(s,u,o,r);c&&(n.record(e,c.key,c.ids.join("\0")),c.ids.forEach((p,f)=>n.record(e,p,c.texts[f])));}if(Pe(t)){let c=le(t,o,r);if(!c)return t;n.record(e,c.id,c.text);let p=c.story.indexOf(c.id);return n.record(e,Ps(c.id),c.story.paragraphIds[p+1]??""),Object.freeze({...t,readAt:e})}let d=null;for(let[c,p]of Object.entries(t)){let f=Ve(p,e,n,o,r,a+1);f!==p&&(d??={...t},d[c]=f);}return d?Object.freeze(d):t}function _n(t,e,n=0){if(n>vs)return;if(Array.isArray(t)){for(let a of t)_n(a,e,n+1);return}if(!Oe(t))return;if(Pe(t)){t.readAt!==void 0&&e.push({endpoint:t});return}let{start:o,end:r}=t;if(Oe(o)&&Pe(o)&&Oe(r)&&Pe(r)){o.readAt!==void 0&&e.push({endpoint:o,end:r}),r.readAt!==void 0&&e.push({endpoint:r});for(let[a,s]of Object.entries(t))a!=="start"&&a!=="end"&&_n(s,e,n+1);return}for(let a of Object.values(t))_n(a,e,n+1);}function Ss(t,e,n,o,r){let a=[];_n(t,a);for(let{endpoint:s,end:u}of a){if(s.readAt===e)continue;if(typeof s.readAt!="number"||!Number.isSafeInteger(s.readAt))return "invalid-read-revision";if(s.readAt>e)return `read-at ${String(s.readAt)} was never read: the document is at revision ${String(e)}`;let d=le(s,o,r);if(!d)continue;let c=n.at(s.readAt,d.id);if(c===void 0)return `read-at ${String(s.readAt)} is no longer checkable`;let p=d.text,f=s.offset;if(!Number.isInteger(f)||f<0||f>c.length)continue;let x=u!==void 0&&le(u,o,r)?.id!==d.id;if(x?c!==p:p.length<f||c.slice(0,f)!==p.slice(0,f))return x?`the paragraph a span starts in changed since revision ${String(s.readAt)}`:`text before offset ${String(f)} changed since revision ${String(s.readAt)}`;if(x){let g=hd(s,u,s.readAt,n,o,r);if(g)return g}}return null}function hd(t,e,n,o,r,a){let s=le(t,r,a),u=le(e,r,a);if(!s||!u)return null;let d=Rs(t,e,r,a),c=Is(s.id,u.id),p=o.at(n,c)??(o.at(n,Ps(s.id))===u.id?"":void 0);if(p===void 0)return `the paragraphs a span covers are no longer checkable at revision ${String(n)}`;if(!d||d.ids.join("\0")!==p)return `a paragraph was inserted or removed inside a span since revision ${String(n)}`;for(let[f,x]of d.ids.entries())if(o.at(n,x)!==d.texts[f])return `a paragraph inside a span changed since revision ${String(n)}`;return null}var yd=Object.freeze({status:"skipped"});function ft(t,e,n){return Object.freeze(n===void 0?{code:t,message:e}:{code:t,message:e,detail:n})}function kd(t){if(t==="review-module-required"||t==="automation-structural-tracking-unsupported")return ft("unsupported-capability","this edit requires a supported review mode",t);let e=t==="unsupported-revision"||t.startsWith("unsupported-revision:");return ft(e?"unsupported-revision":"transaction-refused",e?"that story contains a tracked change this engine cannot resolve":"the document store refused the transaction",t)}function vt(t,e,n,o){return {ok:false,results:t.map((r,a)=>a===e?{status:"error",error:n}:yd),revision:o,changed:false}}function xg(t){let{port:e}=t,n=Object.freeze({...t.capabilities}),o=Sa(),r=new Set,a=false,s={mode:"Off"},u=0,d=null,c=null,p=Os(),f=n.events?e.subscribe(()=>{if(a)return;let v=Object.freeze({revision:e.revision()});if(u>0)d=v;else for(let I of [...r])I(v);}):()=>{},x=v=>{if(c&&c.pkg===v)return c.value;let I=he(v);return c={pkg:v,value:I},I},g=v=>{let I=Array.isArray(v?.operations)?v.operations:[],w=e.revision();if(a)return vt(I,0,ft("disposed","this host was disposed"),w);if(!n.document)return vt(I,0,ft("unsupported-capability","this host has no document","document"),w);let O=e.currentPackage();if(!O)return vt(I,0,ft("document-unavailable","this host holds no document right now"),w);if(v.expectedRevision!==void 0&&v.expectedRevision!==w)return vt(I,0,ft("stale-revision","the document moved since that revision",`expected ${String(v.expectedRevision)}, at ${w}`),w);let H=x(O);for(let U=0;U<I.length;U+=1){let W=Ss(I[U],w,p,o,H);if(W)return vt(I,U,W==="invalid-read-revision"?ft("invalid-offset","an endpoint carries an invalid readAt",W):ft("stale-revision","that range was read before its text changed",W),w)}let M=Mo({handles:o,reads:H,capabilities:n,collaborative:e.collaborative?.()??false,trackedRangeReplacement:e.trackedRangeReplacement?.()??true,...e.revisionDisplayMode?{displayMode:e.revisionDisplayMode()}:{},...e.replacementLanding?{replacementLanding:e.replacementLanding.bind(e)}:{},...e.fieldPageContext?{fieldPageContext:e.fieldPageContext.bind(e)}:{},...e.select?{select:e.select.bind(e)}:{}}),N=[],E=[],R=null,_=[],z=[],$=null,K,Z=null,Q=-1,at=false,gt=s;for(let U=0;U<I.length;U+=1){let W=I[U];if(e.suggesting?.()&&W.op!=="replaceSpan"&&(!lo(W)||!gt.author&&["insertContentControl","setContentControlProperties","startNewList","setListLevelFormat","insertTable","insertTableRows","updateTable","updateTableCell"].includes(W.op)))return vt(I,U,ft("unsupported-capability","this operation has no supported tracked form in suggesting mode"),w);let Pt=Ia(W,e.localChangeTracking===true,gt),it=Pt?.step??Ra(W,M.plan(W,gt.author),gt.author);if(Pt&&(gt=Pt.state),!it.ok)return vt(I,U,it.error,w);if(N.push(it),it.kind==="command")if(gt.author&&(it.packageEdits?.length||W.op==="setContentControlProperties")&&(at=true),W.op==="setRevisionAuthorBatch"&&(at=true),it.packageEdits&&_.push(...it.packageEdits),Q<0&&(Q=U),it.lifecycle)R=it.ops[0]??null;else if(it.relate){let St=it.relate;E.push(Ie=>{let bt=Ie(St.url);return bt===null?null:St.ops(bt)});}else {let{ops:St}=it;E.push(()=>St);}else it.kind==="commentWrite"?(Q<0&&(Q=U),z.push(it.write),$=M.writeScope??{kind:"body"}):it.kind==="customNodeWrite"&&(Q<0&&(Q=U),Z={write:it.write,scope:M.writeScope??{kind:"body"}});}let xt=false;if(z.length>0){let U=e.applyCommentWrites(z,$??{kind:"body"});if(!U.ok)return vt(I,Q<0?0:Q,ft("transaction-refused","the document store refused the comment write",U.reason),w);xt=U.changed,K=U.commentId;}if(Z){let U=e.applyCustomNodeWrite(Z.write,Z.scope);if(!U.ok)return vt(I,Q<0?0:Q,ft("transaction-refused","the document store refused the custom-node write",U.reason),w);xt=U.changed;}if(R){let U=e.applyLifecycle(R);if(!U.ok)return vt(I,Q<0?0:Q,ft("transaction-refused","the document store refused the transaction",U.reason),w);xt=U.changed;}if(E.length>0){let U=e.apply(W=>{let Pt=[];for(let it of E){let St=it(W);if(St===null)return null;Pt.push(...St);}return Pt},M.writeScope??{kind:"body"},_,at);if(!U.ok)return vt(I,Q<0?0:Q,kd(U.reason),w);xt=U.changed;}let lt=e.currentPackage();if(!lt)return vt(I,0,ft("document-unavailable","this host holds no document right now"),w);let dt=x(lt),Rt=M.settle(dt);if(!Rt.ok)return vt(I,Q<0?0:Q,ft("transaction-refused","the transaction did not produce the document the batch planned",Rt.detail),e.revision());s=gt;let Ot=e.revision();return {ok:true,results:N.map(U=>({status:"ok",value:U.kind==="query"?Ve(U.value,w,p,o,H):Ve(U.kind==="customNodeWrite"?U.answer(dt):U.answer(dt,K),Ot,p,o,dt)})),revision:Ot,changed:xt}};return {capabilities:n,revision:()=>e.revision(),execute:v=>{u+=1;try{return g(v)}finally{if(u-=1,u===0&&d){let I=d;d=null;for(let w of [...r])w(I);}}},...e.prepare?{prepare:e.prepare.bind(e)}:{},save(){if(a)return {ok:false,error:ft("disposed","this host was disposed")};if(!n.save)return {ok:false,error:ft("unsupported-capability","this host cannot save","save")};let v=e.save();return v?{ok:true,bytes:v}:{ok:false,error:ft("document-unavailable","this host holds no document right now")}},subscribe(v){return a||!n.events?()=>{}:(r.add(v),()=>{r.delete(v);})},dispose(){a||(a=true,r.clear(),f(),e.dispose(),c=null,p.clear());}}}
|
|
7
|
-
exports.a=Ba;exports.b=ja;exports.c=Ms;exports.d=Od;exports.e=Pd;exports.f=fn;exports.g=he;exports.h=Hs;exports.i=ma;exports.j=fa;exports.k=gn;exports.l=zt;exports.m=xg;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* When the review pane opens by itself.
|
|
3
|
-
*
|
|
4
|
-
* - `'auto'`: the pane opens when a document with review items loads, and when a tracked
|
|
5
|
-
* change is made while it is closed, in both cases when the pane has items to list. With
|
|
6
|
-
* `revisionsIn: 'balloons'` the pane lists no tracked change and no reply to one, so
|
|
7
|
-
* tracked changes and their replies alone do not open it.
|
|
8
|
-
* - `'manual'`: the pane stays closed until the host or the user opens it. Use it when the
|
|
9
|
-
* host shows review items its own way, such as in balloons or margin markers.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
type ReviewPaneOpening = 'auto' | 'manual';
|
|
14
|
-
/**
|
|
15
|
-
* What the open review pane does when its full card column does not fit beside the page at
|
|
16
|
-
* the page's zoom.
|
|
17
|
-
*
|
|
18
|
-
* - `'float'`: the pane shrinks to a strip of markers, and the open card floats over the
|
|
19
|
-
* page.
|
|
20
|
-
* - `'shrinkPage'`: under a fit zoom mode, the page may shrink down to the mode's
|
|
21
|
-
* `minZoom` (or 10%) so that the full column fits. The pane changes to the marker strip
|
|
22
|
-
* only when the column does not fit at that floor either. A fixed zoom behaves as
|
|
23
|
-
* `'float'`.
|
|
24
|
-
* - `'scroll'`: the page keeps the size it has beside the closed pane's marker strip, and
|
|
25
|
-
* the full column stands beside it. The document and the column scroll together: the
|
|
26
|
-
* viewport scrolls sideways to reach the cards.
|
|
27
|
-
*
|
|
28
|
-
* The setting applies to the review pane only. The navigation pane stays docked at its side
|
|
29
|
-
* in every mode: it never scrolls with the document, and it takes its room beside the page
|
|
30
|
-
* exactly as it does with no review pane.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
type ReviewPaneOverflow = 'float' | 'shrinkPage' | 'scroll';
|
|
35
|
-
/**
|
|
36
|
-
* Where tracked changes open.
|
|
37
|
-
*
|
|
38
|
-
* - `'pane'`: the review pane lists tracked changes as cards beside the comments.
|
|
39
|
-
* - `'balloons'`: the pane lists comments only, except comments that reply to a tracked
|
|
40
|
-
* change: the change's balloon shows those. A tracked change opens in a balloon at its
|
|
41
|
-
* text when the reader clicks it, or when Next Change, Previous Change, or
|
|
42
|
-
* `setActiveReviewItem(key, { announce: true })` reaches it.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
|
-
type RevisionDisplay = 'pane' | 'balloons';
|
|
47
|
-
/**
|
|
48
|
-
* How a collapsed comment marker looks.
|
|
49
|
-
*
|
|
50
|
-
* - `'initials'`: a badge with the thread author's initials in the author's color, a reply
|
|
51
|
-
* count, and a check mark when the thread is resolved.
|
|
52
|
-
* - `'icon'`: the comment icon.
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
type CommentMarkerStyle = 'initials' | 'icon';
|
|
57
|
-
/**
|
|
58
|
-
* Review pane settings to change. Every field is optional, and an omitted field keeps its
|
|
59
|
-
* current value.
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
interface ReviewPaneOptions {
|
|
64
|
-
/** Default `'auto'`. */
|
|
65
|
-
readonly opening?: ReviewPaneOpening;
|
|
66
|
-
/** Default `'float'`. */
|
|
67
|
-
readonly overflow?: ReviewPaneOverflow;
|
|
68
|
-
/** Default `'pane'`. */
|
|
69
|
-
readonly revisionsIn?: RevisionDisplay;
|
|
70
|
-
/** Default `'icon'`. */
|
|
71
|
-
readonly commentMarkers?: CommentMarkerStyle;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* The review pane settings in force, with every field resolved.
|
|
75
|
-
*
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
interface ResolvedReviewPane {
|
|
79
|
-
/** When the pane opens by itself. */
|
|
80
|
-
readonly opening: ReviewPaneOpening;
|
|
81
|
-
/** What the open pane does when its card column does not fit beside the page. */
|
|
82
|
-
readonly overflow: ReviewPaneOverflow;
|
|
83
|
-
/** Where tracked changes open. */
|
|
84
|
-
readonly revisionsIn: RevisionDisplay;
|
|
85
|
-
/** How a collapsed comment marker looks. */
|
|
86
|
-
readonly commentMarkers: CommentMarkerStyle;
|
|
87
|
-
}
|
|
88
|
-
/** The settings an editor starts with when nothing sets them. @public */
|
|
89
|
-
declare const DEFAULT_REVIEW_PANE: ResolvedReviewPane;
|
|
90
|
-
/**
|
|
91
|
-
* Merge `options` over `base`. Throws a `TypeError` for an unknown field or value, so a
|
|
92
|
-
* misspelled setting fails loudly instead of being ignored. Returns `base` itself when
|
|
93
|
-
* nothing changes, so the snapshot keeps its reference.
|
|
94
|
-
*
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
declare function resolveReviewPane(options: ReviewPaneOptions | undefined, base?: ResolvedReviewPane): ResolvedReviewPane;
|
|
98
|
-
/**
|
|
99
|
-
* The fields of a review item that decide whether the review pane lists it. A
|
|
100
|
-
* `ReviewItem` and a review item placement both have them.
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
interface ReviewPaneItemFields {
|
|
105
|
-
/** The item kind, as `ReviewItem.kind` gives it. */
|
|
106
|
-
readonly kind: 'revision' | 'comment' | 'custom';
|
|
107
|
-
/** For a comment, the tracked change it replies to. */
|
|
108
|
-
readonly parentRevisionId?: string;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Whether the review pane lists a card for `item` under `revisionsIn`.
|
|
112
|
-
*
|
|
113
|
-
* With `'balloons'`, a balloon at the text shows every tracked change and every comment
|
|
114
|
-
* that replies to a tracked change, so the pane lists neither. Give the item as an
|
|
115
|
-
* unfiltered `getReviewItems()` read returns it: a query that excludes revision kinds
|
|
116
|
-
* removes `parentRevisionId` from replies to the changes it drops.
|
|
117
|
-
*
|
|
118
|
-
* The engine applies this rule to every review item when it decides whether the pane opens
|
|
119
|
-
* by itself or closes after a settings change. A review pane must apply the same rule before
|
|
120
|
-
* its own filters, such as a hidden kind or a host filter. Those filters can hide every card,
|
|
121
|
-
* and then the pane that the engine opens is empty.
|
|
122
|
-
*
|
|
123
|
-
* @public
|
|
124
|
-
*/
|
|
125
|
-
declare function reviewPaneListsItem(revisionsIn: RevisionDisplay, item: ReviewPaneItemFields): boolean;
|
|
126
|
-
|
|
127
|
-
export { DEFAULT_REVIEW_PANE as D, reviewPaneListsItem as f, resolveReviewPane as r };
|
|
128
|
-
export type { CommentMarkerStyle as C, ReviewPaneOptions as R, ResolvedReviewPane as a, ReviewPaneOverflow as b, ReviewPaneItemFields as c, ReviewPaneOpening as d, RevisionDisplay as e };
|