@phtngyn/cms 0.2.0-beta.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -10
- package/README.md +59 -401
- package/drizzle/20261003215543_initial/migration.sql +251 -0
- package/drizzle/20261003215543_initial/snapshot.json +1941 -0
- package/package.json +75 -71
- package/src/Authoring.d.ts +41 -49
- package/src/Authoring.js +1 -1
- package/src/Blocks-BrxSemnd.js +40 -0
- package/src/Client.d.ts +8186 -0
- package/src/Client.js +41 -0
- package/src/Collections.d.ts +142 -0
- package/src/Collections.js +142 -0
- package/src/Config-CMiwciub.js +130 -0
- package/src/Config.d.ts +172 -0
- package/src/Config.js +2 -0
- package/src/Configuration-Dk2k3OIc.js +73 -0
- package/src/DataTransfer-BmECvPHB.js +488 -0
- package/src/Database-DSsNCGft.d.ts +3 -0
- package/src/Delivery.d.ts +28 -0
- package/src/Delivery.js +7 -0
- package/src/Document-CKXMSEf1.js +293 -0
- package/src/Document-TgwYKJZM.d.ts +220 -0
- package/src/DocumentRenderer-Wz2xaNyf.js +394 -0
- package/src/EditorSchema-wrDv-id6.js +296 -0
- package/src/Fields-BegSgYhj.d.ts +166 -0
- package/src/Fields-ioGaMEh9.js +130 -0
- package/src/Forms-BuKAXQxr.d.ts +203 -0
- package/src/Forms.d.ts +48 -11
- package/src/Forms.js +342 -7
- package/src/I18n-Ckf9h0rC.js +154 -0
- package/src/I18n.d.ts +45 -2
- package/src/I18n.js +2 -1
- package/src/Image-CJWPLnhP.js +110 -0
- package/src/Links-CJYyy7rC.js +28 -0
- package/src/Links-Dx1yOni8.d.ts +28 -0
- package/src/Locales-Ch7a5xuA.js +67 -0
- package/src/Locales-jwbmJaOp.d.ts +43 -0
- package/src/Locales.d.ts +3 -0
- package/src/Locales.js +3 -0
- package/src/Media-BQ0uL4w7.d.ts +15 -0
- package/src/Media-DSyvd14o.js +87 -0
- package/src/Module.d.ts +2 -10
- package/src/Module.js +1039 -162
- package/src/Operations.d.ts +57 -0
- package/src/Operations.js +263 -0
- package/src/People-DvNZauWw.js +69 -0
- package/src/PreviewFocus-C_EelZO5.js +104 -0
- package/src/Query-C0kGJF5_.d.ts +261 -0
- package/src/RevisionPreview-IVwbJ9Wy.js +133 -0
- package/src/Routes-BaZvm2LE.js +126 -0
- package/src/Routes-DM1rRp3r.d.ts +15 -0
- package/src/S3MediaObjects-y-WacEi9.js +193 -0
- package/src/Seo-BcpqxoAs.d.ts +57 -0
- package/src/Seo-CjNUtUkj.js +254 -0
- package/src/StudioApi-CXLwwocX.js +833 -0
- package/src/StudioErrors-T5zLGQ1M.js +117 -0
- package/src/StudioErrors-kq-E44lQ.d.ts +104 -0
- package/src/StudioServer.d.ts +20 -0
- package/src/StudioServer.js +34 -0
- package/src/answers-DcTg0Xv2.js +41 -0
- package/src/cli.js +681 -187
- package/src/contracts-rprW3ZOB.js +130 -0
- package/src/forms-3xuf0Ym7.d.ts +206 -0
- package/src/localeConfiguration-BPbkLi7-.js +32 -0
- package/src/localeContext-DhF3SPvM.js +59 -0
- package/src/locales-6OD4XGIZ.js +12 -0
- package/src/nuxtDelivery-BYX_Cddb.js +466 -0
- package/src/plugin-DTYuDaQu.js +7171 -0
- package/src/previewContext-dt3ZUh-w.js +4 -0
- package/src/previewRegions-CXjk5cbP.js +145 -0
- package/src/previewSource-fb-q3ESM.js +144 -0
- package/src/rendering-D9LVeEKX.js +47 -0
- package/src/rolldown-runtime-8H4AJuhK.js +14 -0
- package/src/runtime/CmsImage.js +38 -0
- package/src/runtime/DocumentPage.vue +10 -0
- package/src/runtime/DocumentPageContent.js +48 -0
- package/src/runtime/DocumentRenderer.d.ts +129 -0
- package/src/runtime/DocumentRenderer.js +2 -0
- package/src/runtime/api.js +48 -6
- package/src/runtime/delivery/useCmsDocument.js +2 -0
- package/src/runtime/delivery/useCmsDocumentQuery.js +2 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +2 -114
- package/src/runtime/delivery/useCmsLocale.js +10 -0
- package/src/runtime/plugin.js +2 -40
- package/src/runtime/preview.css +85 -0
- package/src/runtime/preview.js +277 -0
- package/src/runtime/previewSource.js +82 -0
- package/src/runtime/revisionPrivacy.js +13 -0
- package/src/runtime/studio.js +10 -0
- package/src/runtime/studioIcons.js +36 -0
- package/src/validation-3pggwcnm.js +396 -0
- package/src/validation-DpUwPC8Y.js +224 -0
- package/studio/THIRD-PARTY-LICENSES.md +2406 -0
- package/studio/chunks/AccountPage-DL3DitDM.js +288 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.br +0 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.gz +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js +584 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.br +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.gz +0 -0
- package/studio/chunks/Alert-D0D24z_a.js +335 -0
- package/studio/chunks/Alert-D0D24z_a.js.br +0 -0
- package/studio/chunks/Alert-D0D24z_a.js.gz +0 -0
- package/studio/chunks/Badge-BBFs88TI.js +346 -0
- package/studio/chunks/Badge-BBFs88TI.js.br +0 -0
- package/studio/chunks/Badge-BBFs88TI.js.gz +0 -0
- package/studio/chunks/Button-BT3ztSPx.js +14319 -0
- package/studio/chunks/Button-BT3ztSPx.js.br +0 -0
- package/studio/chunks/Button-BT3ztSPx.js.gz +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js +246 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.br +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.gz +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js +1745 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.br +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.gz +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js +18 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.br +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.gz +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js +2413 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.br +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.gz +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js +26063 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.br +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.gz +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js +4400 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.br +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.gz +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js +7799 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.br +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.gz +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js +198 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.br +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.gz +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js +552 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.br +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.gz +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js +271 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.br +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.gz +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js +101 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.br +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.gz +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js +923 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.br +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.gz +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js +837 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.br +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.gz +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js +1173 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.br +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.gz +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js +265 -0
- package/studio/chunks/Modal-D6hSvxHd.js.br +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js.gz +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js +277 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.br +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.gz +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js +573 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.br +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.gz +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js +783 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.br +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.gz +0 -0
- package/studio/chunks/Popover-B63bkTMS.js +128 -0
- package/studio/chunks/Popover-B63bkTMS.js.br +0 -0
- package/studio/chunks/Popover-B63bkTMS.js.gz +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js +255 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.br +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.gz +0 -0
- package/studio/chunks/Routes-DLYHmulE.js +102 -0
- package/studio/chunks/Routes-DLYHmulE.js.br +0 -0
- package/studio/chunks/Routes-DLYHmulE.js.gz +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js +95 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.br +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.gz +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js +332 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.br +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.gz +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js +14646 -0
- package/studio/chunks/Search-BEgCe9Aj.js.br +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js.gz +0 -0
- package/studio/chunks/Select-B50WZMW-.js +2145 -0
- package/studio/chunks/Select-B50WZMW-.js.br +0 -0
- package/studio/chunks/Select-B50WZMW-.js.gz +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js +2109 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.br +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.gz +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js +846 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.br +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.gz +0 -0
- package/studio/chunks/Skeleton-COz8dcrw.js +39 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.br +2 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.gz +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js +289 -0
- package/studio/chunks/Slideover-QMMHAAys.js.br +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js.gz +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js +80 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.br +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.gz +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js +2524 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.br +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.gz +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js +484 -0
- package/studio/chunks/Switch-qKl1aDn7.js.br +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js.gz +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js +29 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.br +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.gz +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js +693 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.br +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.gz +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js +12 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.br +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.gz +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js +2349 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.br +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.gz +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js +113 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.br +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.gz +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js +10 -0
- package/studio/chunks/arrays-CUJkmV4I.js.br +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js.gz +0 -0
- package/studio/chunks/base-DkTekJe8.js +213 -0
- package/studio/chunks/base-DkTekJe8.js.br +0 -0
- package/studio/chunks/base-DkTekJe8.js.gz +0 -0
- package/studio/chunks/content-DUGl3N4d.js +6012 -0
- package/studio/chunks/content-DUGl3N4d.js.br +0 -0
- package/studio/chunks/content-DUGl3N4d.js.gz +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js +227 -0
- package/studio/chunks/destinations-DPIQVQa6.js.br +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js.gz +0 -0
- package/studio/chunks/en-073cjKW4.js +152 -0
- package/studio/chunks/en-073cjKW4.js.br +0 -0
- package/studio/chunks/en-073cjKW4.js.gz +0 -0
- package/studio/chunks/en-Bn8mxPuf.js +134 -0
- package/studio/chunks/en-Bn8mxPuf.js.br +0 -0
- package/studio/chunks/en-Bn8mxPuf.js.gz +0 -0
- package/studio/chunks/en-C9OiaUDZ.js +251 -0
- package/studio/chunks/en-C9OiaUDZ.js.br +0 -0
- package/studio/chunks/en-C9OiaUDZ.js.gz +0 -0
- package/studio/chunks/en-CHAR6jzx.js +147 -0
- package/studio/chunks/en-CHAR6jzx.js.br +0 -0
- package/studio/chunks/en-CHAR6jzx.js.gz +0 -0
- package/studio/chunks/en-Cq4N1vEF.js +93 -0
- package/studio/chunks/en-Cq4N1vEF.js.br +2 -0
- package/studio/chunks/en-Cq4N1vEF.js.gz +0 -0
- package/studio/chunks/en-D2hRqlse.js +140 -0
- package/studio/chunks/en-D2hRqlse.js.br +0 -0
- package/studio/chunks/en-D2hRqlse.js.gz +0 -0
- package/studio/chunks/en-DiUC3-j6.js +144 -0
- package/studio/chunks/en-DiUC3-j6.js.br +0 -0
- package/studio/chunks/en-DiUC3-j6.js.gz +0 -0
- package/studio/chunks/english-Cs_Adu-u.js +8 -0
- package/studio/chunks/english-Cs_Adu-u.js.br +0 -0
- package/studio/chunks/english-Cs_Adu-u.js.gz +0 -0
- package/studio/chunks/esm-D6DqSiL1.js +752 -0
- package/studio/chunks/esm-D6DqSiL1.js.br +0 -0
- package/studio/chunks/esm-D6DqSiL1.js.gz +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js +23 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.br +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.gz +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js +1007 -0
- package/studio/chunks/iconify-DR9ryCPv.js.br +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js.gz +0 -0
- package/studio/chunks/icons-D2MsAaXq.js +183 -0
- package/studio/chunks/icons-D2MsAaXq.js.br +0 -0
- package/studio/chunks/icons-D2MsAaXq.js.gz +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js +26 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.br +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.gz +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js +238 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.br +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.gz +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js +17 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.br +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.gz +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js +77 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.br +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.gz +0 -0
- package/studio/chunks/notifications-OKOLc40v.js +110 -0
- package/studio/chunks/notifications-OKOLc40v.js.br +0 -0
- package/studio/chunks/notifications-OKOLc40v.js.gz +0 -0
- package/studio/chunks/operations-CjNHyrEX.js +57 -0
- package/studio/chunks/operations-CjNHyrEX.js.br +0 -0
- package/studio/chunks/operations-CjNHyrEX.js.gz +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js +1733 -0
- package/studio/chunks/overlay-DnqFLZTc.js.br +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js.gz +0 -0
- package/studio/chunks/presentation-DF83w0hE.js +57 -0
- package/studio/chunks/presentation-DF83w0hE.js.br +0 -0
- package/studio/chunks/presentation-DF83w0hE.js.gz +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js +4557 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.br +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.gz +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js +76 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.br +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.gz +0 -0
- package/studio/chunks/status-DQv6ihkU.js +38 -0
- package/studio/chunks/status-DQv6ihkU.js.br +0 -0
- package/studio/chunks/status-DQv6ihkU.js.gz +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js +4953 -0
- package/studio/chunks/studioContext-I8HozGU1.js.br +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js.gz +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js +73 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.br +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.gz +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js +1095 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.br +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.gz +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js +62 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.br +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.gz +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js +189 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.br +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.gz +0 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js +16 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.br +3 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.gz +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js +87 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.br +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.gz +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js +8 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.br +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.gz +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js +154 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.br +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.gz +0 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js +44 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.br +8 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.gz +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js +35 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.br +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.gz +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js +16 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.br +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.gz +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js +298 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.br +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.gz +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js +79 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.br +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.gz +0 -0
- package/studio/chunks/utils-mdScC0v0.js +59 -0
- package/studio/chunks/utils-mdScC0v0.js.br +0 -0
- package/studio/chunks/utils-mdScC0v0.js.gz +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js +781 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.br +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.gz +0 -0
- package/studio/help/64f767fe29c2-save-and-publish.svg +7 -0
- package/studio/host.css +1 -1
- package/studio/host.css.br +0 -0
- package/studio/host.css.gz +0 -0
- package/studio/host.js +8757 -39178
- package/studio/host.js.br +0 -0
- package/studio/host.js.gz +0 -0
- package/CHANGELOG.md +0 -13
- package/bin/cms.mjs +0 -2
- package/src/ApplicationTypes.d.ts +0 -84
- package/src/ApplicationTypes.js +0 -1
- package/src/Configuration-Da5B2PVH.js +0 -1191
- package/src/Configuration-Da5B2PVH.js.map +0 -1
- package/src/Configuration.d.ts +0 -82
- package/src/Configuration.js +0 -8
- package/src/Configuration.js.map +0 -1
- package/src/Content.d.ts +0 -68
- package/src/Content.js +0 -373
- package/src/Content.js.map +0 -1
- package/src/ContentTransfer-BxwswWn3.js +0 -86
- package/src/ContentTransfer-BxwswWn3.js.map +0 -1
- package/src/ContentTransfer-Z9FHyLez.d.ts +0 -72
- package/src/DocumentEngine-hh_IGPXO.js +0 -978
- package/src/DocumentEngine-hh_IGPXO.js.map +0 -1
- package/src/DocumentModel.d.ts +0 -52
- package/src/DocumentModel.js +0 -66
- package/src/DocumentModel.js.map +0 -1
- package/src/Forms-CX-hwmJF.js +0 -391
- package/src/Forms-CX-hwmJF.js.map +0 -1
- package/src/Forms-CfNPTiCr.js +0 -110
- package/src/Forms-CfNPTiCr.js.map +0 -1
- package/src/Forms-R0HoTR-o.d.ts +0 -92
- package/src/Forms.js.map +0 -1
- package/src/HttpPaths-c9nLZ9H2.js +0 -21
- package/src/HttpPaths-c9nLZ9H2.js.map +0 -1
- package/src/I18n-zbqpWxki.d.ts +0 -29
- package/src/Media-j1bTritO.js +0 -112
- package/src/Media-j1bTritO.js.map +0 -1
- package/src/Module.js.map +0 -1
- package/src/References-CCPDAPve.js +0 -45
- package/src/References-CCPDAPve.js.map +0 -1
- package/src/S3MediaObjects-Dwhl2deX.js +0 -2742
- package/src/S3MediaObjects-Dwhl2deX.js.map +0 -1
- package/src/Seo-402YumpT.d.ts +0 -198
- package/src/cli/content.js +0 -101
- package/src/cli/content.js.map +0 -1
- package/src/cli.js.map +0 -1
- package/src/connection-BP80q4d-.js +0 -92
- package/src/connection-BP80q4d-.js.map +0 -1
- package/src/dev-lifecycle-CjDq63Ft.js +0 -535
- package/src/dev-lifecycle-CjDq63Ft.js.map +0 -1
- package/src/installation-DYNQQBD3.js +0 -9114
- package/src/installation-DYNQQBD3.js.map +0 -1
- package/src/internal/application-types.js +0 -43
- package/src/internal/application-types.js.map +0 -1
- package/src/internal/authoring-catalog.js +0 -158
- package/src/internal/authoring-catalog.js.map +0 -1
- package/src/internal/authoring-compiler.js +0 -146
- package/src/internal/authoring-compiler.js.map +0 -1
- package/src/internal/authoring-metadata.js +0 -191
- package/src/internal/authoring-metadata.js.map +0 -1
- package/src/internal/cms-config.js +0 -45
- package/src/internal/cms-config.js.map +0 -1
- package/src/internal/configuration.js +0 -228
- package/src/internal/configuration.js.map +0 -1
- package/src/internal/dev-lifecycle.js +0 -3
- package/src/internal/diagnostics.js +0 -47
- package/src/internal/diagnostics.js.map +0 -1
- package/src/internal/document-model.js +0 -376
- package/src/internal/document-model.js.map +0 -1
- package/src/internal/field-metadata.js +0 -7
- package/src/internal/field-metadata.js.map +0 -1
- package/src/internal/form-capabilities.js +0 -12
- package/src/internal/form-capabilities.js.map +0 -1
- package/src/internal/i18n.js +0 -73
- package/src/internal/i18n.js.map +0 -1
- package/src/internal/studio-app.js +0 -68
- package/src/internal/studio-app.js.map +0 -1
- package/src/location-CMNGO3lU.js +0 -35
- package/src/location-CMNGO3lU.js.map +0 -1
- package/src/metadata-DN9_K6Yl.js +0 -201
- package/src/metadata-DN9_K6Yl.js.map +0 -1
- package/src/models-5j67LMqW.js +0 -131
- package/src/models-5j67LMqW.js.map +0 -1
- package/src/models-VmGmG19-.js +0 -628
- package/src/models-VmGmG19-.js.map +0 -1
- package/src/runtime/api.js.map +0 -1
- package/src/runtime/blocks.js +0 -30
- package/src/runtime/blocks.js.map +0 -1
- package/src/runtime/collaboration.js +0 -45
- package/src/runtime/collaboration.js.map +0 -1
- package/src/runtime/delivery/DocumentField.js +0 -23
- package/src/runtime/delivery/DocumentField.js.map +0 -1
- package/src/runtime/delivery/DocumentRenderer.js +0 -61
- package/src/runtime/delivery/DocumentRenderer.js.map +0 -1
- package/src/runtime/delivery/DocumentScope.js +0 -41
- package/src/runtime/delivery/DocumentScope.js.map +0 -1
- package/src/runtime/delivery/blocks.js +0 -8
- package/src/runtime/delivery/blocks.js.map +0 -1
- package/src/runtime/delivery/context.js +0 -12
- package/src/runtime/delivery/context.js.map +0 -1
- package/src/runtime/delivery/document-page.js +0 -21
- package/src/runtime/delivery/document-page.js.map +0 -1
- package/src/runtime/delivery/document.js +0 -43
- package/src/runtime/delivery/document.js.map +0 -1
- package/src/runtime/delivery/error.js +0 -11
- package/src/runtime/delivery/error.js.map +0 -1
- package/src/runtime/delivery/plugin.js +0 -99
- package/src/runtime/delivery/plugin.js.map +0 -1
- package/src/runtime/delivery/preview.d.ts +0 -11
- package/src/runtime/delivery/preview.js +0 -6
- package/src/runtime/delivery/preview.js.map +0 -1
- package/src/runtime/delivery/types.d.ts +0 -2
- package/src/runtime/delivery/types.js +0 -1
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +0 -67
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +0 -1
- package/src/runtime/delivery/useDocument.d.ts +0 -6
- package/src/runtime/delivery/useDocument.js +0 -23
- package/src/runtime/delivery/useDocument.js.map +0 -1
- package/src/runtime/delivery/useDocumentQuery.d.ts +0 -7
- package/src/runtime/delivery/useDocumentQuery.js +0 -29
- package/src/runtime/delivery/useDocumentQuery.js.map +0 -1
- package/src/runtime/forms/document.js +0 -38
- package/src/runtime/forms/document.js.map +0 -1
- package/src/runtime/forms/useCmsForm.js +0 -257
- package/src/runtime/forms/useCmsForm.js.map +0 -1
- package/src/runtime/i18n/translator.js +0 -51
- package/src/runtime/i18n/translator.js.map +0 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +0 -13
- package/src/runtime/i18n/useCmsI18n.js +0 -38
- package/src/runtime/i18n/useCmsI18n.js.map +0 -1
- package/src/runtime/installation.js +0 -3
- package/src/runtime/plugin.js.map +0 -1
- package/src/runtime/preview/CmsStudioPreviewMarker.js +0 -29
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +0 -1
- package/src/runtime/preview/comark-document.js +0 -37
- package/src/runtime/preview/comark-document.js.map +0 -1
- package/src/runtime/preview/connection.js +0 -3
- package/src/runtime/preview/controller.js +0 -265
- package/src/runtime/preview/controller.js.map +0 -1
- package/src/runtime/preview/crypto.js +0 -16
- package/src/runtime/preview/crypto.js.map +0 -1
- package/src/runtime/preview/overlay.js +0 -122
- package/src/runtime/preview/overlay.js.map +0 -1
- package/src/runtime/preview/plugin.client.js +0 -68
- package/src/runtime/preview/plugin.client.js.map +0 -1
- package/src/runtime/preview/preview.css +0 -91
- package/src/runtime/preview/protocol.d.ts +0 -16
- package/src/runtime/preview/protocol.js +0 -23
- package/src/runtime/preview/protocol.js.map +0 -1
- package/src/runtime/preview/regions.js +0 -142
- package/src/runtime/preview/regions.js.map +0 -1
- package/src/runtime/preview/store.js +0 -4
- package/src/runtime/sitemap-entries.js +0 -17
- package/src/runtime/sitemap-entries.js.map +0 -1
- package/src/runtime/sitemap.js +0 -23
- package/src/runtime/sitemap.js.map +0 -1
- package/src/runtime/studio-app.js +0 -17
- package/src/runtime/studio-app.js.map +0 -1
- package/src/runtime/studio-document.js +0 -46
- package/src/runtime/studio-document.js.map +0 -1
- package/src/runtime/studio-entry.js +0 -19
- package/src/runtime/studio-entry.js.map +0 -1
- package/src/runtime/studio-navigation.js +0 -11
- package/src/runtime/studio-navigation.js.map +0 -1
- package/src/scalars-CA6kyipS.d.ts +0 -7
- package/src/scalars-CVZqT3L0.js +0 -22
- package/src/scalars-CVZqT3L0.js.map +0 -1
- package/src/store-X1e1o_MF.js +0 -209
- package/src/store-X1e1o_MF.js.map +0 -1
- package/src/types-DZ0IV-Ow.d.ts +0 -101
- package/studio/CreateDocumentDialog-BpjBYGfI.js +0 -335
- package/studio/SelectMenu-KiXwx4Y_.js +0 -34032
- package/studio/collaboration-DcK2F6v9.js +0 -4566
- package/studio/editor-P2rB7Csp.js +0 -30128
- package/studio/rolldown-runtime-Dy4uBu1J.js +0 -11
|
@@ -1,4566 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/map.js
|
|
2
|
-
var e = () => /* @__PURE__ */ new Map(), t = (t) => {
|
|
3
|
-
let n = e();
|
|
4
|
-
return t.forEach((e, t) => {
|
|
5
|
-
n.set(t, e);
|
|
6
|
-
}), n;
|
|
7
|
-
}, n = (e, t, n) => {
|
|
8
|
-
let r = e.get(t);
|
|
9
|
-
return r === void 0 && e.set(t, r = n()), r;
|
|
10
|
-
}, r = (e, t) => {
|
|
11
|
-
let n = [];
|
|
12
|
-
for (let [r, i] of e) n.push(t(i, r));
|
|
13
|
-
return n;
|
|
14
|
-
}, i = (e, t) => {
|
|
15
|
-
for (let [n, r] of e) if (t(r, n)) return !0;
|
|
16
|
-
return !1;
|
|
17
|
-
}, a = () => /* @__PURE__ */ new Set(), o = (e) => e[e.length - 1], s = (e, t) => {
|
|
18
|
-
for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
19
|
-
}, c = Array.from, l = (e, t) => {
|
|
20
|
-
for (let n = 0; n < e.length; n++) if (!t(e[n], n, e)) return !1;
|
|
21
|
-
return !0;
|
|
22
|
-
}, u = (e, t) => {
|
|
23
|
-
for (let n = 0; n < e.length; n++) if (t(e[n], n, e)) return !0;
|
|
24
|
-
return !1;
|
|
25
|
-
}, d = (e, t) => {
|
|
26
|
-
let n = Array(e);
|
|
27
|
-
for (let r = 0; r < e; r++) n[r] = t(r, n);
|
|
28
|
-
return n;
|
|
29
|
-
}, f = Array.isArray, ee = class {
|
|
30
|
-
constructor() {
|
|
31
|
-
this._observers = e();
|
|
32
|
-
}
|
|
33
|
-
on(e, t) {
|
|
34
|
-
return n(this._observers, e, a).add(t), t;
|
|
35
|
-
}
|
|
36
|
-
once(e, t) {
|
|
37
|
-
let n = (...r) => {
|
|
38
|
-
this.off(e, n), t(...r);
|
|
39
|
-
};
|
|
40
|
-
this.on(e, n);
|
|
41
|
-
}
|
|
42
|
-
off(e, t) {
|
|
43
|
-
let n = this._observers.get(e);
|
|
44
|
-
n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
|
|
45
|
-
}
|
|
46
|
-
emit(t, n) {
|
|
47
|
-
return c((this._observers.get(t) || e()).values()).forEach((e) => e(...n));
|
|
48
|
-
}
|
|
49
|
-
destroy() {
|
|
50
|
-
this._observers = e();
|
|
51
|
-
}
|
|
52
|
-
}, te = class {
|
|
53
|
-
constructor() {
|
|
54
|
-
this._observers = e();
|
|
55
|
-
}
|
|
56
|
-
on(e, t) {
|
|
57
|
-
n(this._observers, e, a).add(t);
|
|
58
|
-
}
|
|
59
|
-
once(e, t) {
|
|
60
|
-
let n = (...r) => {
|
|
61
|
-
this.off(e, n), t(...r);
|
|
62
|
-
};
|
|
63
|
-
this.on(e, n);
|
|
64
|
-
}
|
|
65
|
-
off(e, t) {
|
|
66
|
-
let n = this._observers.get(e);
|
|
67
|
-
n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
|
|
68
|
-
}
|
|
69
|
-
emit(t, n) {
|
|
70
|
-
return c((this._observers.get(t) || e()).values()).forEach((e) => e(...n));
|
|
71
|
-
}
|
|
72
|
-
destroy() {
|
|
73
|
-
this._observers = e();
|
|
74
|
-
}
|
|
75
|
-
}, p = Math.floor, ne = Math.abs, re = (e, t) => e < t ? e : t, m = (e, t) => e > t ? e : t;
|
|
76
|
-
Number.isNaN;
|
|
77
|
-
var ie = (e) => e === 0 ? 1 / e < 0 : e < 0, ae = 1 << 29, oe = 2 ** 53 - 1, se = -(2 ** 53 - 1), ce = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && p(e) === e);
|
|
78
|
-
Number.isNaN, Number.parseInt;
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/string.js
|
|
81
|
-
var le = String.fromCharCode;
|
|
82
|
-
String.fromCodePoint, le(65535);
|
|
83
|
-
var ue = (e) => e.toLowerCase(), de = /^\s*/g, fe = (e) => e.replace(de, ""), pe = /([A-Z])/g, me = (e, t) => fe(e.replace(pe, (e) => `${t}${ue(e)}`)), he = (e) => {
|
|
84
|
-
let t = unescape(encodeURIComponent(e)), n = t.length, r = new Uint8Array(n);
|
|
85
|
-
for (let e = 0; e < n; e++) r[e] = t.codePointAt(e);
|
|
86
|
-
return r;
|
|
87
|
-
}, ge = typeof TextEncoder < "u" ? new TextEncoder() : null, _e = ge ? (e) => ge.encode(e) : he, ve = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
|
|
88
|
-
fatal: !0,
|
|
89
|
-
ignoreBOM: !0
|
|
90
|
-
});
|
|
91
|
-
/* c8 ignore start */
|
|
92
|
-
ve && ve.decode(/* @__PURE__ */ new Uint8Array()).length === 1 &&
|
|
93
|
-
/* c8 ignore next */
|
|
94
|
-
(ve = null);
|
|
95
|
-
var ye = (e, t) => d(t, () => e).join(""), be = class {
|
|
96
|
-
constructor() {
|
|
97
|
-
this.cpos = 0, this.cbuf = /* @__PURE__ */ new Uint8Array(100), this.bufs = [];
|
|
98
|
-
}
|
|
99
|
-
}, h = () => new be(), xe = (e) => {
|
|
100
|
-
let t = h();
|
|
101
|
-
return e(t), g(t);
|
|
102
|
-
}, Se = (e) => {
|
|
103
|
-
let t = e.cpos;
|
|
104
|
-
for (let n = 0; n < e.bufs.length; n++) t += e.bufs[n].length;
|
|
105
|
-
return t;
|
|
106
|
-
}, g = (e) => {
|
|
107
|
-
let t = new Uint8Array(Se(e)), n = 0;
|
|
108
|
-
for (let r = 0; r < e.bufs.length; r++) {
|
|
109
|
-
let i = e.bufs[r];
|
|
110
|
-
t.set(i, n), n += i.length;
|
|
111
|
-
}
|
|
112
|
-
return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
|
|
113
|
-
}, Ce = (e, t) => {
|
|
114
|
-
let n = e.cbuf.length;
|
|
115
|
-
n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(m(n, t) * 2), e.cpos = 0);
|
|
116
|
-
}, _ = (e, t) => {
|
|
117
|
-
let n = e.cbuf.length;
|
|
118
|
-
e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
|
|
119
|
-
}, we = _, v = (e, t) => {
|
|
120
|
-
for (; t > 127;) _(e, 128 | 127 & t), t = p(t / 128);
|
|
121
|
-
_(e, 127 & t);
|
|
122
|
-
}, Te = (e, t) => {
|
|
123
|
-
let n = ie(t);
|
|
124
|
-
for (n && (t = -t), _(e, (t > 63 ? 128 : 0) | (n ? 64 : 0) | 63 & t), t = p(t / 64); t > 0;) _(e, (t > 127 ? 128 : 0) | 127 & t), t = p(t / 128);
|
|
125
|
-
}, Ee = /* @__PURE__ */ new Uint8Array(3e4), De = Ee.length / 3, y = ge && ge.encodeInto ? (e, t) => {
|
|
126
|
-
if (t.length < De) {
|
|
127
|
-
/* c8 ignore next */
|
|
128
|
-
let n = ge.encodeInto(t, Ee).written || 0;
|
|
129
|
-
v(e, n);
|
|
130
|
-
for (let t = 0; t < n; t++) _(e, Ee[t]);
|
|
131
|
-
} else b(e, _e(t));
|
|
132
|
-
} : (e, t) => {
|
|
133
|
-
let n = unescape(encodeURIComponent(t)), r = n.length;
|
|
134
|
-
v(e, r);
|
|
135
|
-
for (let t = 0; t < r; t++) _(e, n.codePointAt(t));
|
|
136
|
-
}, Oe = (e, t) => {
|
|
137
|
-
let n = e.cbuf.length, r = e.cpos, i = re(n - r, t.length), a = t.length - i;
|
|
138
|
-
e.cbuf.set(t.subarray(0, i), r), e.cpos += i, a > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(m(n * 2, a)), e.cbuf.set(t.subarray(i)), e.cpos = a);
|
|
139
|
-
}, b = (e, t) => {
|
|
140
|
-
v(e, t.byteLength), Oe(e, t);
|
|
141
|
-
}, ke = (e, t) => {
|
|
142
|
-
Ce(e, t);
|
|
143
|
-
let n = new DataView(e.cbuf.buffer, e.cpos, t);
|
|
144
|
-
return e.cpos += t, n;
|
|
145
|
-
}, Ae = (e, t) => ke(e, 4).setFloat32(0, t, !1), je = (e, t) => ke(e, 8).setFloat64(0, t, !1), Me = (e, t) => ke(e, 8).setBigInt64(0, t, !1), Ne = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Pe = (e) => (Ne.setFloat32(0, e), Ne.getFloat32(0) === e), Fe = (e, t) => {
|
|
146
|
-
switch (typeof t) {
|
|
147
|
-
case "string":
|
|
148
|
-
_(e, 119), y(e, t);
|
|
149
|
-
break;
|
|
150
|
-
case "number":
|
|
151
|
-
ce(t) && ne(t) <= 2147483647 ? (_(e, 125), Te(e, t)) : Pe(t) ? (_(e, 124), Ae(e, t)) : (_(e, 123), je(e, t));
|
|
152
|
-
break;
|
|
153
|
-
case "bigint":
|
|
154
|
-
_(e, 122), Me(e, t);
|
|
155
|
-
break;
|
|
156
|
-
case "object":
|
|
157
|
-
if (t === null) _(e, 126);
|
|
158
|
-
else if (f(t)) {
|
|
159
|
-
_(e, 117), v(e, t.length);
|
|
160
|
-
for (let n = 0; n < t.length; n++) Fe(e, t[n]);
|
|
161
|
-
} else if (t instanceof Uint8Array) _(e, 116), b(e, t);
|
|
162
|
-
else {
|
|
163
|
-
_(e, 118);
|
|
164
|
-
let n = Object.keys(t);
|
|
165
|
-
v(e, n.length);
|
|
166
|
-
for (let r = 0; r < n.length; r++) {
|
|
167
|
-
let i = n[r];
|
|
168
|
-
y(e, i), Fe(e, t[i]);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
case "boolean":
|
|
173
|
-
_(e, t ? 120 : 121);
|
|
174
|
-
break;
|
|
175
|
-
default: _(e, 127);
|
|
176
|
-
}
|
|
177
|
-
}, Ie = class extends be {
|
|
178
|
-
constructor(e) {
|
|
179
|
-
super(), this.w = e, this.s = null, this.count = 0;
|
|
180
|
-
}
|
|
181
|
-
write(e) {
|
|
182
|
-
this.s === e ? this.count++ : (this.count > 0 && v(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e);
|
|
183
|
-
}
|
|
184
|
-
}, Le = (e) => {
|
|
185
|
-
e.count > 0 && (Te(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && v(e.encoder, e.count - 2));
|
|
186
|
-
}, Re = class {
|
|
187
|
-
constructor() {
|
|
188
|
-
this.encoder = new be(), this.s = 0, this.count = 0;
|
|
189
|
-
}
|
|
190
|
-
write(e) {
|
|
191
|
-
this.s === e ? this.count++ : (Le(this), this.count = 1, this.s = e);
|
|
192
|
-
}
|
|
193
|
-
toUint8Array() {
|
|
194
|
-
return Le(this), g(this.encoder);
|
|
195
|
-
}
|
|
196
|
-
}, ze = (e) => {
|
|
197
|
-
if (e.count > 0) {
|
|
198
|
-
let t = e.diff * 2 + (e.count === 1 ? 0 : 1);
|
|
199
|
-
Te(e.encoder, t), e.count > 1 && v(e.encoder, e.count - 2);
|
|
200
|
-
}
|
|
201
|
-
}, Be = class {
|
|
202
|
-
constructor() {
|
|
203
|
-
this.encoder = new be(), this.s = 0, this.count = 0, this.diff = 0;
|
|
204
|
-
}
|
|
205
|
-
write(e) {
|
|
206
|
-
this.diff === e - this.s ? (this.s = e, this.count++) : (ze(this), this.count = 1, this.diff = e - this.s, this.s = e);
|
|
207
|
-
}
|
|
208
|
-
toUint8Array() {
|
|
209
|
-
return ze(this), g(this.encoder);
|
|
210
|
-
}
|
|
211
|
-
}, Ve = class {
|
|
212
|
-
constructor() {
|
|
213
|
-
this.sarr = [], this.s = "", this.lensE = new Re();
|
|
214
|
-
}
|
|
215
|
-
write(e) {
|
|
216
|
-
this.s += e, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(e.length);
|
|
217
|
-
}
|
|
218
|
-
toUint8Array() {
|
|
219
|
-
let e = new be();
|
|
220
|
-
return this.sarr.push(this.s), this.s = "", y(e, this.sarr.join("")), Oe(e, this.lensE.toUint8Array()), g(e);
|
|
221
|
-
}
|
|
222
|
-
}, x = (e) => Error(e), S = () => {
|
|
223
|
-
throw x("Method unimplemented");
|
|
224
|
-
}, C = () => {
|
|
225
|
-
throw x("Unexpected case");
|
|
226
|
-
}, He = x("Unexpected end of array"), Ue = x("Integer out of Range"), We = class {
|
|
227
|
-
constructor(e) {
|
|
228
|
-
this.arr = e, this.pos = 0;
|
|
229
|
-
}
|
|
230
|
-
}, w = (e) => new We(e), Ge = (e) => e.pos !== e.arr.length, Ke = (e, t) => {
|
|
231
|
-
let n = new Uint8Array(e.arr.buffer, e.pos + e.arr.byteOffset, t);
|
|
232
|
-
return e.pos += t, n;
|
|
233
|
-
}, T = (e) => Ke(e, E(e)), qe = (e) => e.arr[e.pos++], E = (e) => {
|
|
234
|
-
let t = 0, n = 1, r = e.arr.length;
|
|
235
|
-
for (; e.pos < r;) {
|
|
236
|
-
let r = e.arr[e.pos++];
|
|
237
|
-
if (t += (r & 127) * n, n *= 128, r < 128) return t;
|
|
238
|
-
/* c8 ignore start */
|
|
239
|
-
if (t > oe) throw Ue;
|
|
240
|
-
}
|
|
241
|
-
throw He;
|
|
242
|
-
}, Je = (e) => {
|
|
243
|
-
let t = e.arr[e.pos++], n = t & 63, r = 64, i = (t & 64) > 0 ? -1 : 1;
|
|
244
|
-
if (!(t & 128)) return i * n;
|
|
245
|
-
let a = e.arr.length;
|
|
246
|
-
for (; e.pos < a;) {
|
|
247
|
-
if (t = e.arr[e.pos++], n += (t & 127) * r, r *= 128, t < 128) return i * n;
|
|
248
|
-
/* c8 ignore start */
|
|
249
|
-
if (n > oe) throw Ue;
|
|
250
|
-
}
|
|
251
|
-
throw He;
|
|
252
|
-
}, D = ve ? (e) => ve.decode(T(e)) : (e) => {
|
|
253
|
-
let t = E(e);
|
|
254
|
-
if (t === 0) return "";
|
|
255
|
-
{
|
|
256
|
-
let n = String.fromCodePoint(qe(e));
|
|
257
|
-
if (--t < 100) for (; t--;) n += String.fromCodePoint(qe(e));
|
|
258
|
-
else for (; t > 0;) {
|
|
259
|
-
let r = t < 1e4 ? t : 1e4, i = e.arr.subarray(e.pos, e.pos + r);
|
|
260
|
-
e.pos += r, n += String.fromCodePoint.apply(null, i), t -= r;
|
|
261
|
-
}
|
|
262
|
-
return decodeURIComponent(escape(n));
|
|
263
|
-
}
|
|
264
|
-
}, Ye = (e) => {
|
|
265
|
-
let t = e.pos, n = D(e);
|
|
266
|
-
return e.pos = t, n;
|
|
267
|
-
}, Xe = (e, t) => {
|
|
268
|
-
let n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
|
|
269
|
-
return e.pos += t, n;
|
|
270
|
-
}, Ze = [
|
|
271
|
-
(e) => void 0,
|
|
272
|
-
(e) => null,
|
|
273
|
-
Je,
|
|
274
|
-
(e) => Xe(e, 4).getFloat32(0, !1),
|
|
275
|
-
(e) => Xe(e, 8).getFloat64(0, !1),
|
|
276
|
-
(e) => Xe(e, 8).getBigInt64(0, !1),
|
|
277
|
-
(e) => !1,
|
|
278
|
-
(e) => !0,
|
|
279
|
-
D,
|
|
280
|
-
(e) => {
|
|
281
|
-
let t = E(e), n = {};
|
|
282
|
-
for (let r = 0; r < t; r++) {
|
|
283
|
-
let t = D(e);
|
|
284
|
-
n[t] = Qe(e);
|
|
285
|
-
}
|
|
286
|
-
return n;
|
|
287
|
-
},
|
|
288
|
-
(e) => {
|
|
289
|
-
let t = E(e), n = [];
|
|
290
|
-
for (let r = 0; r < t; r++) n.push(Qe(e));
|
|
291
|
-
return n;
|
|
292
|
-
},
|
|
293
|
-
T
|
|
294
|
-
], Qe = (e) => Ze[127 - qe(e)](e), $e = class extends We {
|
|
295
|
-
constructor(e, t) {
|
|
296
|
-
super(e), this.reader = t, this.s = null, this.count = 0;
|
|
297
|
-
}
|
|
298
|
-
read() {
|
|
299
|
-
return this.count === 0 && (this.s = this.reader(this), this.count = Ge(this) ? E(this) + 1 : -1), this.count--, this.s;
|
|
300
|
-
}
|
|
301
|
-
}, et = class extends We {
|
|
302
|
-
constructor(e) {
|
|
303
|
-
super(e), this.s = 0, this.count = 0;
|
|
304
|
-
}
|
|
305
|
-
read() {
|
|
306
|
-
if (this.count === 0) {
|
|
307
|
-
this.s = Je(this);
|
|
308
|
-
let e = ie(this.s);
|
|
309
|
-
this.count = 1, e && (this.s = -this.s, this.count = E(this) + 2);
|
|
310
|
-
}
|
|
311
|
-
return this.count--, this.s;
|
|
312
|
-
}
|
|
313
|
-
}, tt = class extends We {
|
|
314
|
-
constructor(e) {
|
|
315
|
-
super(e), this.s = 0, this.count = 0, this.diff = 0;
|
|
316
|
-
}
|
|
317
|
-
read() {
|
|
318
|
-
if (this.count === 0) {
|
|
319
|
-
let e = Je(this), t = e & 1;
|
|
320
|
-
this.diff = p(e / 2), this.count = 1, t && (this.count = E(this) + 2);
|
|
321
|
-
}
|
|
322
|
-
return this.s += this.diff, this.count--, this.s;
|
|
323
|
-
}
|
|
324
|
-
}, nt = class {
|
|
325
|
-
constructor(e) {
|
|
326
|
-
this.decoder = new et(e), this.str = D(this.decoder), this.spos = 0;
|
|
327
|
-
}
|
|
328
|
-
read() {
|
|
329
|
-
let e = this.spos + this.decoder.read(), t = this.str.slice(this.spos, e);
|
|
330
|
-
return this.spos = e, t;
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
crypto.subtle;
|
|
334
|
-
var rt = crypto.getRandomValues.bind(crypto), it = Math.random, at = () => rt(/* @__PURE__ */ new Uint32Array(1))[0], ot = (e) => e[p(it() * e.length)], st = "10000000-1000-4000-8000-100000000000", ct = () => st.replace(/[018]/g, (e) => (e ^ at() & 15 >> e / 4).toString(16)), O = Date.now, lt = (e) => new Promise(e);
|
|
335
|
-
Promise.all.bind(Promise);
|
|
336
|
-
//#endregion
|
|
337
|
-
//#region ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/conditions.js
|
|
338
|
-
/* c8 ignore next */
|
|
339
|
-
var ut = (e) => e === void 0 ? null : e, dt = new class {
|
|
340
|
-
constructor() {
|
|
341
|
-
this.map = /* @__PURE__ */ new Map();
|
|
342
|
-
}
|
|
343
|
-
setItem(e, t) {
|
|
344
|
-
this.map.set(e, t);
|
|
345
|
-
}
|
|
346
|
-
getItem(e) {
|
|
347
|
-
return this.map.get(e);
|
|
348
|
-
}
|
|
349
|
-
}();
|
|
350
|
-
/* c8 ignore start */
|
|
351
|
-
try {
|
|
352
|
-
typeof localStorage < "u" && localStorage && (dt = localStorage);
|
|
353
|
-
} catch {}
|
|
354
|
-
/* c8 ignore stop */
|
|
355
|
-
/* c8 ignore next */
|
|
356
|
-
var ft = dt, pt = Symbol("Equality"), mt = (e, t) => e === t || !!e?.[pt]?.(t) || !1, ht = (e) => typeof e == "object", gt = Object.assign, _t = Object.keys, vt = (e, t) => {
|
|
357
|
-
for (let n in e) t(e[n], n);
|
|
358
|
-
}, yt = (e) => _t(e).length, bt = (e) => {
|
|
359
|
-
for (let t in e) return !1;
|
|
360
|
-
return !0;
|
|
361
|
-
}, xt = (e, t) => {
|
|
362
|
-
for (let n in e) if (!t(e[n], n)) return !1;
|
|
363
|
-
return !0;
|
|
364
|
-
}, St = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Ct = (e, t) => e === t || yt(e) === yt(t) && xt(e, (e, n) => (e !== void 0 || St(t, n)) && mt(t[n], e)), wt = Object.freeze, Tt = (e) => {
|
|
365
|
-
for (let t in e) {
|
|
366
|
-
let n = e[t];
|
|
367
|
-
(typeof n == "object" || typeof n == "function") && Tt(e[t]);
|
|
368
|
-
}
|
|
369
|
-
return wt(e);
|
|
370
|
-
}, Et = (e, t, n = 0) => {
|
|
371
|
-
try {
|
|
372
|
-
for (; n < e.length; n++) e[n](...t);
|
|
373
|
-
} finally {
|
|
374
|
-
n < e.length && Et(e, t, n + 1);
|
|
375
|
-
}
|
|
376
|
-
}, Dt = (e) => e, Ot = (e, t) => {
|
|
377
|
-
if (e === t) return !0;
|
|
378
|
-
if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object)) return !1;
|
|
379
|
-
if (e[pt] != null) return e[pt](t);
|
|
380
|
-
switch (e.constructor) {
|
|
381
|
-
case ArrayBuffer: e = new Uint8Array(e), t = new Uint8Array(t);
|
|
382
|
-
case Uint8Array:
|
|
383
|
-
if (e.byteLength !== t.byteLength) return !1;
|
|
384
|
-
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
385
|
-
break;
|
|
386
|
-
case Set:
|
|
387
|
-
if (e.size !== t.size) return !1;
|
|
388
|
-
for (let n of e) if (!t.has(n)) return !1;
|
|
389
|
-
break;
|
|
390
|
-
case Map:
|
|
391
|
-
if (e.size !== t.size) return !1;
|
|
392
|
-
for (let n of e.keys()) if (!t.has(n) || !Ot(e.get(n), t.get(n))) return !1;
|
|
393
|
-
break;
|
|
394
|
-
case void 0:
|
|
395
|
-
case Object:
|
|
396
|
-
if (yt(e) !== yt(t)) return !1;
|
|
397
|
-
for (let n in e) if (!St(e, n) || !Ot(e[n], t[n])) return !1;
|
|
398
|
-
break;
|
|
399
|
-
case Array:
|
|
400
|
-
if (e.length !== t.length) return !1;
|
|
401
|
-
for (let n = 0; n < e.length; n++) if (!Ot(e[n], t[n])) return !1;
|
|
402
|
-
break;
|
|
403
|
-
default: return !1;
|
|
404
|
-
}
|
|
405
|
-
return !0;
|
|
406
|
-
}, kt = (e, t) => t.includes(e), At = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", jt = typeof window < "u" && typeof document < "u" && !At;
|
|
407
|
-
typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
408
|
-
var k, Mt = [], Nt = () => {
|
|
409
|
-
if (k === void 0) {
|
|
410
|
-
if (At) {
|
|
411
|
-
k = e();
|
|
412
|
-
let t = process.argv, n = null;
|
|
413
|
-
for (let e = 0; e < t.length; e++) {
|
|
414
|
-
let r = t[e];
|
|
415
|
-
r[0] === "-" ? (n !== null && k.set(n, ""), n = r) : n === null ? Mt.push(r) : (k.set(n, r), n = null);
|
|
416
|
-
}
|
|
417
|
-
n !== null && k.set(n, "");
|
|
418
|
-
} else typeof location == "object" ? (k = e(), (location.search || "?").slice(1).split("&").forEach((e) => {
|
|
419
|
-
if (e.length !== 0) {
|
|
420
|
-
let [t, n] = e.split("=");
|
|
421
|
-
k.set(`--${me(t, "-")}`, n), k.set(`-${me(t, "-")}`, n);
|
|
422
|
-
}
|
|
423
|
-
})) : k = e();
|
|
424
|
-
}
|
|
425
|
-
return k;
|
|
426
|
-
}, Pt = (e) => Nt().has(e), Ft = (e) => ut(At ? process.env[e.toUpperCase().replaceAll("-", "_")] : ft.getItem(e)), It = (e) => Pt("--" + e) || Ft(e) !== null, Lt = It("production"), Rt = At && kt(process.env.FORCE_COLOR, [
|
|
427
|
-
"true",
|
|
428
|
-
"1",
|
|
429
|
-
"2"
|
|
430
|
-
]) || !Pt("--no-colors") && !It("no-color") && (!At || process.stdout.isTTY) && (!At || Pt("--color") || Ft("COLORTERM") !== null || (Ft("TERM") || "").includes("color")), zt = (e) => new Uint8Array(e), Bt = jt ? (e) => {
|
|
431
|
-
let t = "";
|
|
432
|
-
for (let n = 0; n < e.byteLength; n++) t += le(e[n]);
|
|
433
|
-
return btoa(t);
|
|
434
|
-
} : (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), Vt = (e) => {
|
|
435
|
-
let t = zt(e.byteLength);
|
|
436
|
-
return t.set(e), t;
|
|
437
|
-
}, Ht = (e) => xe((t) => Fe(t, e)), Ut = class {
|
|
438
|
-
constructor(e, t) {
|
|
439
|
-
this.left = e, this.right = t;
|
|
440
|
-
}
|
|
441
|
-
}, A = (e, t) => new Ut(e, t), Wt = (e) => e.next() >= .5, Gt = (e, t, n) => p(e.next() * (n + 1 - t) + t), Kt = (e, t, n) => p(e.next() * (n + 1 - t) + t), qt = (e, t, n) => Kt(e, t, n), Jt = (e) => le(qt(e, 97, 122)), Yt = (e, t = 0, n = 20) => {
|
|
442
|
-
let r = qt(e, t, n), i = "";
|
|
443
|
-
for (let t = 0; t < r; t++) i += Jt(e);
|
|
444
|
-
return i;
|
|
445
|
-
}, Xt = (e, t) => t[qt(e, 0, t.length - 1)], Zt = Symbol("0schema"), Qt = class {
|
|
446
|
-
constructor() {
|
|
447
|
-
this._rerrs = [];
|
|
448
|
-
}
|
|
449
|
-
extend(e, t, n, r = null) {
|
|
450
|
-
this._rerrs.push({
|
|
451
|
-
path: e,
|
|
452
|
-
expected: t,
|
|
453
|
-
has: n,
|
|
454
|
-
message: r
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
toString() {
|
|
458
|
-
let e = [];
|
|
459
|
-
for (let t = this._rerrs.length - 1; t > 0; t--) {
|
|
460
|
-
let n = this._rerrs[t];
|
|
461
|
-
/* c8 ignore next */
|
|
462
|
-
e.push(ye(" ", (this._rerrs.length - t) * 2) + `${n.path == null ? "" : `[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`);
|
|
463
|
-
}
|
|
464
|
-
return e.join("\n");
|
|
465
|
-
}
|
|
466
|
-
}, $t = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[pt] ? mt(e, t) : f(e) ? l(e, (e) => u(t, (t) => $t(e, t))) : ht(e) ? xt(e, (e, n) => $t(e, t[n])) : !1, j = class {
|
|
467
|
-
static _dilutes = !1;
|
|
468
|
-
extends(e) {
|
|
469
|
-
let [t, n] = [this.shape, e.shape];
|
|
470
|
-
return this.constructor._dilutes && ([n, t] = [t, n]), $t(t, n);
|
|
471
|
-
}
|
|
472
|
-
equals(e) {
|
|
473
|
-
return this.constructor === e.constructor && Ot(this.shape, e.shape);
|
|
474
|
-
}
|
|
475
|
-
[Zt]() {
|
|
476
|
-
return !0;
|
|
477
|
-
}
|
|
478
|
-
[pt](e) {
|
|
479
|
-
return this.equals(e);
|
|
480
|
-
}
|
|
481
|
-
validate(e) {
|
|
482
|
-
return this.check(e);
|
|
483
|
-
}
|
|
484
|
-
/* c8 ignore start */
|
|
485
|
-
check(e, t) {
|
|
486
|
-
S();
|
|
487
|
-
}
|
|
488
|
-
/* c8 ignore stop */
|
|
489
|
-
get nullable() {
|
|
490
|
-
return jn(this, Kn);
|
|
491
|
-
}
|
|
492
|
-
get optional() {
|
|
493
|
-
return new ln(this);
|
|
494
|
-
}
|
|
495
|
-
cast(e) {
|
|
496
|
-
return Xn(e, this), e;
|
|
497
|
-
}
|
|
498
|
-
expect(e) {
|
|
499
|
-
return Xn(e, this), e;
|
|
500
|
-
}
|
|
501
|
-
}, en = class extends j {
|
|
502
|
-
constructor(e, t) {
|
|
503
|
-
super(), this.shape = e, this._c = t;
|
|
504
|
-
}
|
|
505
|
-
check(e, t = void 0) {
|
|
506
|
-
let n = e?.constructor === this.shape && (this._c == null || this._c(e));
|
|
507
|
-
return !n && t?.extend(null, this.shape.name, e?.constructor.name, e?.constructor === this.shape ? "Check failed" : "Constructor match failed"), n;
|
|
508
|
-
}
|
|
509
|
-
}, M = (e, t = null) => new en(e, t);
|
|
510
|
-
M(en);
|
|
511
|
-
var tn = class extends j {
|
|
512
|
-
constructor(e) {
|
|
513
|
-
super(), this.shape = e;
|
|
514
|
-
}
|
|
515
|
-
check(e, t) {
|
|
516
|
-
let n = this.shape(e);
|
|
517
|
-
return !n && t?.extend(null, "custom prop", e?.constructor.name, "failed to check custom prop"), n;
|
|
518
|
-
}
|
|
519
|
-
}, N = (e) => new tn(e);
|
|
520
|
-
M(tn);
|
|
521
|
-
var nn = class extends j {
|
|
522
|
-
constructor(e) {
|
|
523
|
-
super(), this.shape = e;
|
|
524
|
-
}
|
|
525
|
-
check(e, t) {
|
|
526
|
-
let n = this.shape.some((t) => t === e);
|
|
527
|
-
return !n && t?.extend(null, this.shape.join(" | "), e.toString()), n;
|
|
528
|
-
}
|
|
529
|
-
}, rn = (...e) => new nn(e), an = M(nn), on = RegExp.escape || ((e) => e.replace(/[().|&,$^[\]]/g, (e) => "\\" + e)), sn = (e) => {
|
|
530
|
-
if (Vn.check(e)) return [on(e)];
|
|
531
|
-
if (an.check(e)) return e.shape.map((e) => e + "");
|
|
532
|
-
if (Bn.check(e)) return ["[+-]?\\d+.?\\d*"];
|
|
533
|
-
if (Hn.check(e)) return [".*"];
|
|
534
|
-
if (Mn.check(e)) return e.shape.map(sn).flat(1);
|
|
535
|
-
/* c8 ignore next 2 */
|
|
536
|
-
C();
|
|
537
|
-
};
|
|
538
|
-
M(class extends j {
|
|
539
|
-
constructor(e) {
|
|
540
|
-
super(), this.shape = e, this._r = RegExp("^" + e.map(sn).map((e) => `(${e.join("|")})`).join("") + "$");
|
|
541
|
-
}
|
|
542
|
-
check(e, t) {
|
|
543
|
-
let n = this._r.exec(e) != null;
|
|
544
|
-
return !n && t?.extend(null, this._r.toString(), e.toString(), "String doesn't match string template."), n;
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
var cn = Symbol("optional"), ln = class extends j {
|
|
548
|
-
constructor(e) {
|
|
549
|
-
super(), this.shape = e;
|
|
550
|
-
}
|
|
551
|
-
check(e, t) {
|
|
552
|
-
let n = e === void 0 || this.shape.check(e);
|
|
553
|
-
return !n && t?.extend(null, "undefined (optional)", "()"), n;
|
|
554
|
-
}
|
|
555
|
-
get [cn]() {
|
|
556
|
-
return !0;
|
|
557
|
-
}
|
|
558
|
-
}, un = M(ln), dn = class extends j {
|
|
559
|
-
check(e, t) {
|
|
560
|
-
return t?.extend(null, "never", typeof e), !1;
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
new dn(), M(dn);
|
|
564
|
-
var fn = class e extends j {
|
|
565
|
-
constructor(e, t = !1) {
|
|
566
|
-
super(), this.shape = e, this._isPartial = t;
|
|
567
|
-
}
|
|
568
|
-
static _dilutes = !0;
|
|
569
|
-
get partial() {
|
|
570
|
-
return new e(this.shape, !0);
|
|
571
|
-
}
|
|
572
|
-
check(e, t) {
|
|
573
|
-
return e == null ?
|
|
574
|
-
/* c8 ignore next */
|
|
575
|
-
(t?.extend(null, "object", "null"), !1) : xt(this.shape, (n, r) => {
|
|
576
|
-
let i = this._isPartial && !St(e, r) || n.check(e[r], t);
|
|
577
|
-
return !i && t?.extend(r.toString(), n.toString(), typeof e[r], "Object property does not match"), i;
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
}, pn = (e) => new fn(e), mn = M(fn), hn = N((e) => e != null && (e.constructor === Object || e.constructor == null)), gn = class extends j {
|
|
581
|
-
constructor(e, t) {
|
|
582
|
-
super(), this.shape = {
|
|
583
|
-
keys: e,
|
|
584
|
-
values: t
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
check(e, t) {
|
|
588
|
-
return e != null && xt(e, (n, r) => {
|
|
589
|
-
let i = this.shape.keys.check(r, t);
|
|
590
|
-
return !i && t?.extend(r + "", "Record", typeof e, i ? "Key doesn't match schema" : "Value doesn't match value"), i && this.shape.values.check(n, t);
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
}, _n = (e, t) => new gn(e, t), vn = M(gn), yn = class extends j {
|
|
594
|
-
constructor(e) {
|
|
595
|
-
super(), this.shape = e;
|
|
596
|
-
}
|
|
597
|
-
check(e, t) {
|
|
598
|
-
return e != null && xt(this.shape, (n, r) => {
|
|
599
|
-
let i = n.check(e[r], t);
|
|
600
|
-
return !i && t?.extend(r.toString(), "Tuple", typeof n), i;
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}, bn = (...e) => new yn(e);
|
|
604
|
-
M(yn);
|
|
605
|
-
var xn = class extends j {
|
|
606
|
-
constructor(e) {
|
|
607
|
-
super(), this.shape = e.length === 1 ? e[0] : new An(e);
|
|
608
|
-
}
|
|
609
|
-
check(e, t) {
|
|
610
|
-
let n = f(e) && l(e, (e) => this.shape.check(e));
|
|
611
|
-
return !n && t?.extend(null, "Array", ""), n;
|
|
612
|
-
}
|
|
613
|
-
}, Sn = (...e) => new xn(e), Cn = M(xn), wn = N((e) => f(e)), Tn = class extends j {
|
|
614
|
-
constructor(e, t) {
|
|
615
|
-
super(), this.shape = e, this._c = t;
|
|
616
|
-
}
|
|
617
|
-
check(e, t) {
|
|
618
|
-
let n = e instanceof this.shape && (this._c == null || this._c(e));
|
|
619
|
-
return !n && t?.extend(null, this.shape.name, e?.constructor.name), n;
|
|
620
|
-
}
|
|
621
|
-
}, En = (e, t = null) => new Tn(e, t);
|
|
622
|
-
M(Tn);
|
|
623
|
-
var Dn = En(j), On = M(class extends j {
|
|
624
|
-
constructor(e) {
|
|
625
|
-
super(), this.len = e.length - 1, this.args = bn(...e.slice(-1)), this.res = e[this.len];
|
|
626
|
-
}
|
|
627
|
-
check(e, t) {
|
|
628
|
-
let n = e.constructor === Function && e.length <= this.len;
|
|
629
|
-
return !n && t?.extend(null, "function", typeof e), n;
|
|
630
|
-
}
|
|
631
|
-
}), kn = N((e) => typeof e == "function");
|
|
632
|
-
M(class extends j {
|
|
633
|
-
constructor(e) {
|
|
634
|
-
super(), this.shape = e;
|
|
635
|
-
}
|
|
636
|
-
check(e, t) {
|
|
637
|
-
let n = l(this.shape, (n) => n.check(e, t));
|
|
638
|
-
return !n && t?.extend(null, "Intersectinon", typeof e), n;
|
|
639
|
-
}
|
|
640
|
-
}, (e) => e.shape.length > 0);
|
|
641
|
-
var An = class extends j {
|
|
642
|
-
static _dilutes = !0;
|
|
643
|
-
constructor(e) {
|
|
644
|
-
super(), this.shape = e;
|
|
645
|
-
}
|
|
646
|
-
check(e, t) {
|
|
647
|
-
let n = u(this.shape, (n) => n.check(e, t));
|
|
648
|
-
return t?.extend(null, "Union", typeof e), n;
|
|
649
|
-
}
|
|
650
|
-
}, jn = (...e) => e.findIndex((e) => Mn.check(e)) >= 0 ? jn(...e.map((e) => Yn(e)).map((e) => Mn.check(e) ? e.shape : [e]).flat(1)) : e.length === 1 ? e[0] : new An(e), Mn = M(An), Nn = () => !0, Pn = N(Nn), Fn = M(tn, (e) => e.shape === Nn), In = N((e) => typeof e == "bigint"), Ln = N((e) => e === In), Rn = N((e) => typeof e == "symbol");
|
|
651
|
-
N((e) => e === Rn);
|
|
652
|
-
var zn = N((e) => typeof e == "number"), Bn = N((e) => e === zn), Vn = N((e) => typeof e == "string"), Hn = N((e) => e === Vn), Un = N((e) => typeof e == "boolean"), Wn = N((e) => e === Un), Gn = rn(void 0);
|
|
653
|
-
M(nn, (e) => e.shape.length === 1 && e.shape[0] === void 0), rn(void 0);
|
|
654
|
-
var Kn = rn(null), qn = M(nn, (e) => e.shape.length === 1 && e.shape[0] === null);
|
|
655
|
-
M(Uint8Array), M(en, (e) => e.shape === Uint8Array);
|
|
656
|
-
var Jn = jn(zn, Vn, Kn, Gn, In, Un, Rn);
|
|
657
|
-
(() => {
|
|
658
|
-
let e = Sn(Pn), t = _n(Vn, Pn), n = jn(zn, Vn, Kn, Un, e, t);
|
|
659
|
-
return e.shape = n, t.shape.values = n, n;
|
|
660
|
-
})();
|
|
661
|
-
var Yn = (e) => {
|
|
662
|
-
if (Dn.check(e)) return e;
|
|
663
|
-
if (hn.check(e)) {
|
|
664
|
-
let t = {};
|
|
665
|
-
for (let n in e) t[n] = Yn(e[n]);
|
|
666
|
-
return pn(t);
|
|
667
|
-
}
|
|
668
|
-
if (wn.check(e)) return jn(...e.map(Yn));
|
|
669
|
-
if (Jn.check(e)) return rn(e);
|
|
670
|
-
if (kn.check(e)) return M(e);
|
|
671
|
-
/* c8 ignore next */
|
|
672
|
-
C();
|
|
673
|
-
}, Xn = Lt ? () => {} : (e, t) => {
|
|
674
|
-
let n = new Qt();
|
|
675
|
-
if (!t.check(e, n)) throw x(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`);
|
|
676
|
-
}, Zn = class {
|
|
677
|
-
constructor(e) {
|
|
678
|
-
this.patterns = [], this.$state = e;
|
|
679
|
-
}
|
|
680
|
-
if(e, t) {
|
|
681
|
-
return this.patterns.push({
|
|
682
|
-
if: Yn(e),
|
|
683
|
-
h: t
|
|
684
|
-
}), this;
|
|
685
|
-
}
|
|
686
|
-
else(e) {
|
|
687
|
-
return this.if(Pn, e);
|
|
688
|
-
}
|
|
689
|
-
done() {
|
|
690
|
-
return (e, t) => {
|
|
691
|
-
for (let n = 0; n < this.patterns.length; n++) {
|
|
692
|
-
let r = this.patterns[n];
|
|
693
|
-
if (r.if.check(e)) return r.h(e, t);
|
|
694
|
-
}
|
|
695
|
-
throw x("Unhandled pattern");
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
}, Qn = ((e) => new Zn(e))(Pn).if(Bn, (e, t) => Gt(t, se, oe)).if(Hn, (e, t) => Yt(t)).if(Wn, (e, t) => Wt(t)).if(Ln, (e, t) => BigInt(Gt(t, se, oe))).if(Mn, (e, t) => $n(t, Xt(t, e.shape))).if(mn, (e, t) => {
|
|
699
|
-
let n = {};
|
|
700
|
-
for (let r in e.shape) {
|
|
701
|
-
let i = e.shape[r];
|
|
702
|
-
if (un.check(i)) {
|
|
703
|
-
if (Wt(t)) continue;
|
|
704
|
-
i = i.shape;
|
|
705
|
-
}
|
|
706
|
-
n[r] = Qn(i, t);
|
|
707
|
-
}
|
|
708
|
-
return n;
|
|
709
|
-
}).if(Cn, (e, t) => {
|
|
710
|
-
let n = [], r = Kt(t, 0, 42);
|
|
711
|
-
for (let i = 0; i < r; i++) n.push($n(t, e.shape));
|
|
712
|
-
return n;
|
|
713
|
-
}).if(an, (e, t) => Xt(t, e.shape)).if(qn, (e, t) => null).if(On, (e, t) => {
|
|
714
|
-
let n = $n(t, e.res);
|
|
715
|
-
return () => n;
|
|
716
|
-
}).if(Fn, (e, t) => $n(t, Xt(t, [
|
|
717
|
-
zn,
|
|
718
|
-
Vn,
|
|
719
|
-
Kn,
|
|
720
|
-
Gn,
|
|
721
|
-
In,
|
|
722
|
-
Un,
|
|
723
|
-
Sn(zn),
|
|
724
|
-
_n(jn("a", "b", "c"), zn)
|
|
725
|
-
]))).if(vn, (e, t) => {
|
|
726
|
-
let n = {}, r = Gt(t, 0, 3);
|
|
727
|
-
for (let i = 0; i < r; i++) {
|
|
728
|
-
let r = $n(t, e.shape.keys);
|
|
729
|
-
n[r] = $n(t, e.shape.values);
|
|
730
|
-
}
|
|
731
|
-
return n;
|
|
732
|
-
}).done(), $n = (e, t) => Qn(Yn(t), e), P = typeof document < "u" ? document : {};
|
|
733
|
-
N((e) => e.nodeType === ir), typeof DOMParser < "u" && new DOMParser(), N((e) => e.nodeType === tr), N((e) => e.nodeType === nr);
|
|
734
|
-
var er = (e) => r(e, (e, t) => `${t}:${e};`).join(""), tr = P.ELEMENT_NODE, nr = P.TEXT_NODE;
|
|
735
|
-
P.CDATA_SECTION_NODE, P.COMMENT_NODE;
|
|
736
|
-
var rr = P.DOCUMENT_NODE;
|
|
737
|
-
P.DOCUMENT_TYPE_NODE;
|
|
738
|
-
var ir = P.DOCUMENT_FRAGMENT_NODE;
|
|
739
|
-
N((e) => e.nodeType === rr);
|
|
740
|
-
/* c8 ignore stop */
|
|
741
|
-
//#endregion
|
|
742
|
-
//#region ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/eventloop.js
|
|
743
|
-
var ar = ((e) => class {
|
|
744
|
-
constructor(e) {
|
|
745
|
-
this._ = e;
|
|
746
|
-
}
|
|
747
|
-
destroy() {
|
|
748
|
-
e(this._);
|
|
749
|
-
}
|
|
750
|
-
})(clearTimeout), or = (e, t) => new ar(setTimeout(t, e)), F = Symbol, sr = F(), cr = F(), lr = F(), ur = F(), dr = F(), fr = F(), pr = F(), mr = F(), hr = F(), gr = (e) => {
|
|
751
|
-
e.length === 1 && e[0]?.constructor === Function && (e = e[0]());
|
|
752
|
-
let t = [], n = [], r = 0;
|
|
753
|
-
for (; r < e.length; r++) {
|
|
754
|
-
let n = e[r];
|
|
755
|
-
if (n === void 0) break;
|
|
756
|
-
if (n.constructor === String || n.constructor === Number) t.push(n);
|
|
757
|
-
else if (n.constructor === Object) break;
|
|
758
|
-
}
|
|
759
|
-
for (r > 0 && n.push(t.join("")); r < e.length; r++) {
|
|
760
|
-
let t = e[r];
|
|
761
|
-
t instanceof Symbol || n.push(t);
|
|
762
|
-
}
|
|
763
|
-
return n;
|
|
764
|
-
};
|
|
765
|
-
O();
|
|
766
|
-
/* c8 ignore stop */
|
|
767
|
-
//#endregion
|
|
768
|
-
//#region ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/logging.js
|
|
769
|
-
var _r = {
|
|
770
|
-
[sr]: A("font-weight", "bold"),
|
|
771
|
-
[cr]: A("font-weight", "normal"),
|
|
772
|
-
[lr]: A("color", "blue"),
|
|
773
|
-
[dr]: A("color", "green"),
|
|
774
|
-
[ur]: A("color", "grey"),
|
|
775
|
-
[fr]: A("color", "red"),
|
|
776
|
-
[pr]: A("color", "purple"),
|
|
777
|
-
[mr]: A("color", "orange"),
|
|
778
|
-
[hr]: A("color", "black")
|
|
779
|
-
}, vr = Rt ? (t) => {
|
|
780
|
-
t.length === 1 && t[0]?.constructor === Function && (t = t[0]());
|
|
781
|
-
let n = [], r = [], i = e(), a = [], o = 0;
|
|
782
|
-
for (; o < t.length; o++) {
|
|
783
|
-
let e = t[o], a = _r[e];
|
|
784
|
-
if (a !== void 0) i.set(a.left, a.right);
|
|
785
|
-
else {
|
|
786
|
-
if (e === void 0) break;
|
|
787
|
-
if (e.constructor === String || e.constructor === Number) {
|
|
788
|
-
let t = er(i);
|
|
789
|
-
o > 0 || t.length > 0 ? (n.push("%c" + e), r.push(t)) : n.push(e);
|
|
790
|
-
} else break;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
for (o > 0 && (a = r, a.unshift(n.join(""))); o < t.length; o++) {
|
|
794
|
-
let e = t[o];
|
|
795
|
-
e instanceof Symbol || a.push(e);
|
|
796
|
-
}
|
|
797
|
-
return a;
|
|
798
|
-
} : gr, yr = (...e) => {
|
|
799
|
-
/* c8 ignore next */
|
|
800
|
-
console.log(...vr(e)), xr.forEach((t) => t.print(e));
|
|
801
|
-
}, br = (...e) => {
|
|
802
|
-
console.warn(...vr(e)), e.unshift(mr), xr.forEach((t) => t.print(e));
|
|
803
|
-
}, xr = a(), Sr = (e) => ({
|
|
804
|
-
[Symbol.iterator]() {
|
|
805
|
-
return this;
|
|
806
|
-
},
|
|
807
|
-
next: e
|
|
808
|
-
}), Cr = (e, t) => Sr(() => {
|
|
809
|
-
let n;
|
|
810
|
-
do
|
|
811
|
-
n = e.next();
|
|
812
|
-
while (!n.done && !t(n.value));
|
|
813
|
-
return n;
|
|
814
|
-
}), wr = (e, t) => Sr(() => {
|
|
815
|
-
let { done: n, value: r } = e.next();
|
|
816
|
-
return {
|
|
817
|
-
done: n,
|
|
818
|
-
value: n ? void 0 : t(r)
|
|
819
|
-
};
|
|
820
|
-
}), Tr = class {
|
|
821
|
-
constructor(e, t) {
|
|
822
|
-
this.clock = e, this.len = t;
|
|
823
|
-
}
|
|
824
|
-
}, Er = class {
|
|
825
|
-
constructor() {
|
|
826
|
-
this.clients = /* @__PURE__ */ new Map();
|
|
827
|
-
}
|
|
828
|
-
}, Dr = (e, t, n) => t.clients.forEach((t, r) => {
|
|
829
|
-
let i = e.doc.store.clients.get(r);
|
|
830
|
-
if (i != null) {
|
|
831
|
-
let r = i[i.length - 1], a = r.id.clock + r.length;
|
|
832
|
-
for (let r = 0, o = t[r]; r < t.length && o.clock < a; o = t[++r]) Vi(e, i, o.clock, o.len, n);
|
|
833
|
-
}
|
|
834
|
-
}), Or = (e, t) => {
|
|
835
|
-
let n = 0, r = e.length - 1;
|
|
836
|
-
for (; n <= r;) {
|
|
837
|
-
let i = p((n + r) / 2), a = e[i], o = a.clock;
|
|
838
|
-
if (o <= t) {
|
|
839
|
-
if (t < o + a.len) return i;
|
|
840
|
-
n = i + 1;
|
|
841
|
-
} else r = i - 1;
|
|
842
|
-
}
|
|
843
|
-
return null;
|
|
844
|
-
}, kr = (e, t) => {
|
|
845
|
-
let n = e.clients.get(t.client);
|
|
846
|
-
return n !== void 0 && Or(n, t.clock) !== null;
|
|
847
|
-
}, Ar = (e) => {
|
|
848
|
-
e.clients.forEach((e) => {
|
|
849
|
-
e.sort((e, t) => e.clock - t.clock);
|
|
850
|
-
let t, n;
|
|
851
|
-
for (t = 1, n = 1; t < e.length; t++) {
|
|
852
|
-
let r = e[n - 1], i = e[t];
|
|
853
|
-
r.clock + r.len >= i.clock ? e[n - 1] = new Tr(r.clock, m(r.len, i.clock + i.len - r.clock)) : (n < t && (e[n] = i), n++);
|
|
854
|
-
}
|
|
855
|
-
e.length = n;
|
|
856
|
-
});
|
|
857
|
-
}, jr = (e) => {
|
|
858
|
-
let t = new Er();
|
|
859
|
-
for (let n = 0; n < e.length; n++) e[n].clients.forEach((r, i) => {
|
|
860
|
-
if (!t.clients.has(i)) {
|
|
861
|
-
let a = r.slice();
|
|
862
|
-
for (let t = n + 1; t < e.length; t++) s(a, e[t].clients.get(i) || []);
|
|
863
|
-
t.clients.set(i, a);
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
return Ar(t), t;
|
|
867
|
-
}, Mr = (e, t, r, i) => {
|
|
868
|
-
n(e.clients, t, () => []).push(new Tr(r, i));
|
|
869
|
-
}, Nr = () => new Er(), Pr = (e) => {
|
|
870
|
-
let t = Nr();
|
|
871
|
-
return e.clients.forEach((e, n) => {
|
|
872
|
-
let r = [];
|
|
873
|
-
for (let t = 0; t < e.length; t++) {
|
|
874
|
-
let n = e[t];
|
|
875
|
-
if (n.deleted) {
|
|
876
|
-
let i = n.id.clock, a = n.length;
|
|
877
|
-
if (t + 1 < e.length) for (let n = e[t + 1]; t + 1 < e.length && n.deleted; n = e[++t + 1]) a += n.length;
|
|
878
|
-
r.push(new Tr(i, a));
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
r.length > 0 && t.clients.set(n, r);
|
|
882
|
-
}), t;
|
|
883
|
-
}, Fr = (e, t) => {
|
|
884
|
-
v(e.restEncoder, t.clients.size), c(t.clients.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
|
|
885
|
-
e.resetDsCurVal(), v(e.restEncoder, t);
|
|
886
|
-
let r = n.length;
|
|
887
|
-
v(e.restEncoder, r);
|
|
888
|
-
for (let t = 0; t < r; t++) {
|
|
889
|
-
let r = n[t];
|
|
890
|
-
e.writeDsClock(r.clock), e.writeDsLen(r.len);
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
}, Ir = (e) => {
|
|
894
|
-
let t = new Er(), r = E(e.restDecoder);
|
|
895
|
-
for (let i = 0; i < r; i++) {
|
|
896
|
-
e.resetDsCurVal();
|
|
897
|
-
let r = E(e.restDecoder), i = E(e.restDecoder);
|
|
898
|
-
if (i > 0) {
|
|
899
|
-
let a = n(t.clients, r, () => []);
|
|
900
|
-
for (let t = 0; t < i; t++) a.push(new Tr(e.readDsClock(), e.readDsLen()));
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return t;
|
|
904
|
-
}, Lr = (e, t, n) => {
|
|
905
|
-
let r = new Er(), i = E(e.restDecoder);
|
|
906
|
-
for (let a = 0; a < i; a++) {
|
|
907
|
-
e.resetDsCurVal();
|
|
908
|
-
let i = E(e.restDecoder), a = E(e.restDecoder), o = n.clients.get(i) || [], s = L(n, i);
|
|
909
|
-
for (let n = 0; n < a; n++) {
|
|
910
|
-
let n = e.readDsClock(), a = n + e.readDsLen();
|
|
911
|
-
if (n < s) {
|
|
912
|
-
s < a && Mr(r, i, s, a - s);
|
|
913
|
-
let e = R(o, n), c = o[e];
|
|
914
|
-
for (!c.deleted && c.id.clock < n && (o.splice(e + 1, 0, Xo(t, c, n - c.id.clock)), e++); e < o.length && (c = o[e++], c.id.clock < a);) c.deleted || (a < c.id.clock + c.length && o.splice(e, 0, Xo(t, c, a - c.id.clock)), c.delete(t));
|
|
915
|
-
} else Mr(r, i, n, a - n);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
if (r.clients.size > 0) {
|
|
919
|
-
let e = new qr();
|
|
920
|
-
return v(e.restEncoder, 0), Fr(e, r), e.toUint8Array();
|
|
921
|
-
}
|
|
922
|
-
return null;
|
|
923
|
-
}, Rr = at, zr = class e extends ee {
|
|
924
|
-
constructor({ guid: e = ct(), collectionid: t = null, gc: n = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) {
|
|
925
|
-
super(), this.gc = n, this.gcFilter = r, this.clientID = Rr(), this.guid = e, this.collectionid = t, this.share = /* @__PURE__ */ new Map(), this.store = new Pi(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = lt((e) => {
|
|
926
|
-
this.on("load", () => {
|
|
927
|
-
this.isLoaded = !0, e(this);
|
|
928
|
-
});
|
|
929
|
-
});
|
|
930
|
-
let s = () => lt((e) => {
|
|
931
|
-
let t = (n) => {
|
|
932
|
-
(n === void 0 || n === !0) && (this.off("sync", t), e());
|
|
933
|
-
};
|
|
934
|
-
this.on("sync", t);
|
|
935
|
-
});
|
|
936
|
-
this.on("sync", (e) => {
|
|
937
|
-
e === !1 && this.isSynced && (this.whenSynced = s()), this.isSynced = e === void 0 || e === !0, this.isSynced && !this.isLoaded && this.emit("load", [this]);
|
|
938
|
-
}), this.whenSynced = s();
|
|
939
|
-
}
|
|
940
|
-
load() {
|
|
941
|
-
let e = this._item;
|
|
942
|
-
e !== null && !this.shouldLoad && B(e.parent.doc, (e) => {
|
|
943
|
-
e.subdocsLoaded.add(this);
|
|
944
|
-
}, null, !0), this.shouldLoad = !0;
|
|
945
|
-
}
|
|
946
|
-
getSubdocs() {
|
|
947
|
-
return this.subdocs;
|
|
948
|
-
}
|
|
949
|
-
getSubdocGuids() {
|
|
950
|
-
return new Set(c(this.subdocs).map((e) => e.guid));
|
|
951
|
-
}
|
|
952
|
-
transact(e, t = null) {
|
|
953
|
-
return B(this, e, t);
|
|
954
|
-
}
|
|
955
|
-
get(e, t = U) {
|
|
956
|
-
let r = n(this.share, e, () => {
|
|
957
|
-
let e = new t();
|
|
958
|
-
return e._integrate(this, null), e;
|
|
959
|
-
}), i = r.constructor;
|
|
960
|
-
if (t !== U && i !== t) {
|
|
961
|
-
if (i === U) {
|
|
962
|
-
let n = new t();
|
|
963
|
-
n._map = r._map, r._map.forEach((e) => {
|
|
964
|
-
for (; e !== null; e = e.left) e.parent = n;
|
|
965
|
-
}), n._start = r._start;
|
|
966
|
-
for (let e = n._start; e !== null; e = e.right) e.parent = n;
|
|
967
|
-
return n._length = r._length, this.share.set(e, n), n._integrate(this, null), n;
|
|
968
|
-
}
|
|
969
|
-
throw Error(`Type with the name ${e} has already been defined with a different constructor`);
|
|
970
|
-
}
|
|
971
|
-
return r;
|
|
972
|
-
}
|
|
973
|
-
getArray(e = "") {
|
|
974
|
-
return this.get(e, Ha);
|
|
975
|
-
}
|
|
976
|
-
getText(e = "") {
|
|
977
|
-
return this.get(e, co);
|
|
978
|
-
}
|
|
979
|
-
getMap(e = "") {
|
|
980
|
-
return this.get(e, Ga);
|
|
981
|
-
}
|
|
982
|
-
getXmlElement(e = "") {
|
|
983
|
-
return this.get(e, mo);
|
|
984
|
-
}
|
|
985
|
-
getXmlFragment(e = "") {
|
|
986
|
-
return this.get(e, fo);
|
|
987
|
-
}
|
|
988
|
-
toJSON() {
|
|
989
|
-
let e = {};
|
|
990
|
-
return this.share.forEach((t, n) => {
|
|
991
|
-
e[n] = t.toJSON();
|
|
992
|
-
}), e;
|
|
993
|
-
}
|
|
994
|
-
destroy() {
|
|
995
|
-
this.isDestroyed = !0, c(this.subdocs).forEach((e) => e.destroy());
|
|
996
|
-
let t = this._item;
|
|
997
|
-
if (t !== null) {
|
|
998
|
-
this._item = null;
|
|
999
|
-
let n = t.content;
|
|
1000
|
-
n.doc = new e({
|
|
1001
|
-
guid: this.guid,
|
|
1002
|
-
...n.opts,
|
|
1003
|
-
shouldLoad: !1
|
|
1004
|
-
}), n.doc._item = t, B(t.parent.doc, (e) => {
|
|
1005
|
-
let r = n.doc;
|
|
1006
|
-
t.deleted || e.subdocsAdded.add(r), e.subdocsRemoved.add(this);
|
|
1007
|
-
}, null, !0);
|
|
1008
|
-
}
|
|
1009
|
-
this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
|
|
1010
|
-
}
|
|
1011
|
-
}, Br = class {
|
|
1012
|
-
constructor(e) {
|
|
1013
|
-
this.restDecoder = e;
|
|
1014
|
-
}
|
|
1015
|
-
resetDsCurVal() {}
|
|
1016
|
-
readDsClock() {
|
|
1017
|
-
return E(this.restDecoder);
|
|
1018
|
-
}
|
|
1019
|
-
readDsLen() {
|
|
1020
|
-
return E(this.restDecoder);
|
|
1021
|
-
}
|
|
1022
|
-
}, Vr = class extends Br {
|
|
1023
|
-
readLeftID() {
|
|
1024
|
-
return I(E(this.restDecoder), E(this.restDecoder));
|
|
1025
|
-
}
|
|
1026
|
-
readRightID() {
|
|
1027
|
-
return I(E(this.restDecoder), E(this.restDecoder));
|
|
1028
|
-
}
|
|
1029
|
-
readClient() {
|
|
1030
|
-
return E(this.restDecoder);
|
|
1031
|
-
}
|
|
1032
|
-
readInfo() {
|
|
1033
|
-
return qe(this.restDecoder);
|
|
1034
|
-
}
|
|
1035
|
-
readString() {
|
|
1036
|
-
return D(this.restDecoder);
|
|
1037
|
-
}
|
|
1038
|
-
readParentInfo() {
|
|
1039
|
-
return E(this.restDecoder) === 1;
|
|
1040
|
-
}
|
|
1041
|
-
readTypeRef() {
|
|
1042
|
-
return E(this.restDecoder);
|
|
1043
|
-
}
|
|
1044
|
-
readLen() {
|
|
1045
|
-
return E(this.restDecoder);
|
|
1046
|
-
}
|
|
1047
|
-
readAny() {
|
|
1048
|
-
return Qe(this.restDecoder);
|
|
1049
|
-
}
|
|
1050
|
-
readBuf() {
|
|
1051
|
-
return Vt(T(this.restDecoder));
|
|
1052
|
-
}
|
|
1053
|
-
readJSON() {
|
|
1054
|
-
return JSON.parse(D(this.restDecoder));
|
|
1055
|
-
}
|
|
1056
|
-
readKey() {
|
|
1057
|
-
return D(this.restDecoder);
|
|
1058
|
-
}
|
|
1059
|
-
}, Hr = class {
|
|
1060
|
-
constructor(e) {
|
|
1061
|
-
this.dsCurrVal = 0, this.restDecoder = e;
|
|
1062
|
-
}
|
|
1063
|
-
resetDsCurVal() {
|
|
1064
|
-
this.dsCurrVal = 0;
|
|
1065
|
-
}
|
|
1066
|
-
readDsClock() {
|
|
1067
|
-
return this.dsCurrVal += E(this.restDecoder), this.dsCurrVal;
|
|
1068
|
-
}
|
|
1069
|
-
readDsLen() {
|
|
1070
|
-
let e = E(this.restDecoder) + 1;
|
|
1071
|
-
return this.dsCurrVal += e, e;
|
|
1072
|
-
}
|
|
1073
|
-
}, Ur = class extends Hr {
|
|
1074
|
-
constructor(e) {
|
|
1075
|
-
super(e), this.keys = [], E(e), this.keyClockDecoder = new tt(T(e)), this.clientDecoder = new et(T(e)), this.leftClockDecoder = new tt(T(e)), this.rightClockDecoder = new tt(T(e)), this.infoDecoder = new $e(T(e), qe), this.stringDecoder = new nt(T(e)), this.parentInfoDecoder = new $e(T(e), qe), this.typeRefDecoder = new et(T(e)), this.lenDecoder = new et(T(e));
|
|
1076
|
-
}
|
|
1077
|
-
readLeftID() {
|
|
1078
|
-
return new gi(this.clientDecoder.read(), this.leftClockDecoder.read());
|
|
1079
|
-
}
|
|
1080
|
-
readRightID() {
|
|
1081
|
-
return new gi(this.clientDecoder.read(), this.rightClockDecoder.read());
|
|
1082
|
-
}
|
|
1083
|
-
readClient() {
|
|
1084
|
-
return this.clientDecoder.read();
|
|
1085
|
-
}
|
|
1086
|
-
readInfo() {
|
|
1087
|
-
return this.infoDecoder.read();
|
|
1088
|
-
}
|
|
1089
|
-
readString() {
|
|
1090
|
-
return this.stringDecoder.read();
|
|
1091
|
-
}
|
|
1092
|
-
readParentInfo() {
|
|
1093
|
-
return this.parentInfoDecoder.read() === 1;
|
|
1094
|
-
}
|
|
1095
|
-
readTypeRef() {
|
|
1096
|
-
return this.typeRefDecoder.read();
|
|
1097
|
-
}
|
|
1098
|
-
readLen() {
|
|
1099
|
-
return this.lenDecoder.read();
|
|
1100
|
-
}
|
|
1101
|
-
readAny() {
|
|
1102
|
-
return Qe(this.restDecoder);
|
|
1103
|
-
}
|
|
1104
|
-
readBuf() {
|
|
1105
|
-
return T(this.restDecoder);
|
|
1106
|
-
}
|
|
1107
|
-
readJSON() {
|
|
1108
|
-
return Qe(this.restDecoder);
|
|
1109
|
-
}
|
|
1110
|
-
readKey() {
|
|
1111
|
-
let e = this.keyClockDecoder.read();
|
|
1112
|
-
if (e < this.keys.length) return this.keys[e];
|
|
1113
|
-
{
|
|
1114
|
-
let e = this.stringDecoder.read();
|
|
1115
|
-
return this.keys.push(e), e;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}, Wr = class {
|
|
1119
|
-
constructor() {
|
|
1120
|
-
this.restEncoder = h();
|
|
1121
|
-
}
|
|
1122
|
-
toUint8Array() {
|
|
1123
|
-
return g(this.restEncoder);
|
|
1124
|
-
}
|
|
1125
|
-
resetDsCurVal() {}
|
|
1126
|
-
writeDsClock(e) {
|
|
1127
|
-
v(this.restEncoder, e);
|
|
1128
|
-
}
|
|
1129
|
-
writeDsLen(e) {
|
|
1130
|
-
v(this.restEncoder, e);
|
|
1131
|
-
}
|
|
1132
|
-
}, Gr = class extends Wr {
|
|
1133
|
-
writeLeftID(e) {
|
|
1134
|
-
v(this.restEncoder, e.client), v(this.restEncoder, e.clock);
|
|
1135
|
-
}
|
|
1136
|
-
writeRightID(e) {
|
|
1137
|
-
v(this.restEncoder, e.client), v(this.restEncoder, e.clock);
|
|
1138
|
-
}
|
|
1139
|
-
writeClient(e) {
|
|
1140
|
-
v(this.restEncoder, e);
|
|
1141
|
-
}
|
|
1142
|
-
writeInfo(e) {
|
|
1143
|
-
we(this.restEncoder, e);
|
|
1144
|
-
}
|
|
1145
|
-
writeString(e) {
|
|
1146
|
-
y(this.restEncoder, e);
|
|
1147
|
-
}
|
|
1148
|
-
writeParentInfo(e) {
|
|
1149
|
-
v(this.restEncoder, +!!e);
|
|
1150
|
-
}
|
|
1151
|
-
writeTypeRef(e) {
|
|
1152
|
-
v(this.restEncoder, e);
|
|
1153
|
-
}
|
|
1154
|
-
writeLen(e) {
|
|
1155
|
-
v(this.restEncoder, e);
|
|
1156
|
-
}
|
|
1157
|
-
writeAny(e) {
|
|
1158
|
-
Fe(this.restEncoder, e);
|
|
1159
|
-
}
|
|
1160
|
-
writeBuf(e) {
|
|
1161
|
-
b(this.restEncoder, e);
|
|
1162
|
-
}
|
|
1163
|
-
writeJSON(e) {
|
|
1164
|
-
y(this.restEncoder, JSON.stringify(e));
|
|
1165
|
-
}
|
|
1166
|
-
writeKey(e) {
|
|
1167
|
-
y(this.restEncoder, e);
|
|
1168
|
-
}
|
|
1169
|
-
}, Kr = class {
|
|
1170
|
-
constructor() {
|
|
1171
|
-
this.restEncoder = h(), this.dsCurrVal = 0;
|
|
1172
|
-
}
|
|
1173
|
-
toUint8Array() {
|
|
1174
|
-
return g(this.restEncoder);
|
|
1175
|
-
}
|
|
1176
|
-
resetDsCurVal() {
|
|
1177
|
-
this.dsCurrVal = 0;
|
|
1178
|
-
}
|
|
1179
|
-
writeDsClock(e) {
|
|
1180
|
-
let t = e - this.dsCurrVal;
|
|
1181
|
-
this.dsCurrVal = e, v(this.restEncoder, t);
|
|
1182
|
-
}
|
|
1183
|
-
writeDsLen(e) {
|
|
1184
|
-
e === 0 && C(), v(this.restEncoder, e - 1), this.dsCurrVal += e;
|
|
1185
|
-
}
|
|
1186
|
-
}, qr = class extends Kr {
|
|
1187
|
-
constructor() {
|
|
1188
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Be(), this.clientEncoder = new Re(), this.leftClockEncoder = new Be(), this.rightClockEncoder = new Be(), this.infoEncoder = new Ie(we), this.stringEncoder = new Ve(), this.parentInfoEncoder = new Ie(we), this.typeRefEncoder = new Re(), this.lenEncoder = new Re();
|
|
1189
|
-
}
|
|
1190
|
-
toUint8Array() {
|
|
1191
|
-
let e = h();
|
|
1192
|
-
return v(e, 0), b(e, this.keyClockEncoder.toUint8Array()), b(e, this.clientEncoder.toUint8Array()), b(e, this.leftClockEncoder.toUint8Array()), b(e, this.rightClockEncoder.toUint8Array()), b(e, g(this.infoEncoder)), b(e, this.stringEncoder.toUint8Array()), b(e, g(this.parentInfoEncoder)), b(e, this.typeRefEncoder.toUint8Array()), b(e, this.lenEncoder.toUint8Array()), Oe(e, g(this.restEncoder)), g(e);
|
|
1193
|
-
}
|
|
1194
|
-
writeLeftID(e) {
|
|
1195
|
-
this.clientEncoder.write(e.client), this.leftClockEncoder.write(e.clock);
|
|
1196
|
-
}
|
|
1197
|
-
writeRightID(e) {
|
|
1198
|
-
this.clientEncoder.write(e.client), this.rightClockEncoder.write(e.clock);
|
|
1199
|
-
}
|
|
1200
|
-
writeClient(e) {
|
|
1201
|
-
this.clientEncoder.write(e);
|
|
1202
|
-
}
|
|
1203
|
-
writeInfo(e) {
|
|
1204
|
-
this.infoEncoder.write(e);
|
|
1205
|
-
}
|
|
1206
|
-
writeString(e) {
|
|
1207
|
-
this.stringEncoder.write(e);
|
|
1208
|
-
}
|
|
1209
|
-
writeParentInfo(e) {
|
|
1210
|
-
this.parentInfoEncoder.write(+!!e);
|
|
1211
|
-
}
|
|
1212
|
-
writeTypeRef(e) {
|
|
1213
|
-
this.typeRefEncoder.write(e);
|
|
1214
|
-
}
|
|
1215
|
-
writeLen(e) {
|
|
1216
|
-
this.lenEncoder.write(e);
|
|
1217
|
-
}
|
|
1218
|
-
writeAny(e) {
|
|
1219
|
-
Fe(this.restEncoder, e);
|
|
1220
|
-
}
|
|
1221
|
-
writeBuf(e) {
|
|
1222
|
-
b(this.restEncoder, e);
|
|
1223
|
-
}
|
|
1224
|
-
writeJSON(e) {
|
|
1225
|
-
Fe(this.restEncoder, e);
|
|
1226
|
-
}
|
|
1227
|
-
writeKey(e) {
|
|
1228
|
-
let t = this.keyMap.get(e);
|
|
1229
|
-
t === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(e)) : this.keyClockEncoder.write(t);
|
|
1230
|
-
}
|
|
1231
|
-
}, Jr = (e, t, n, r) => {
|
|
1232
|
-
r = m(r, t[0].id.clock);
|
|
1233
|
-
let i = R(t, r);
|
|
1234
|
-
v(e.restEncoder, t.length - i), e.writeClient(n), v(e.restEncoder, r);
|
|
1235
|
-
let a = t[i];
|
|
1236
|
-
a.write(e, r - a.id.clock);
|
|
1237
|
-
for (let n = i + 1; n < t.length; n++) t[n].write(e, 0);
|
|
1238
|
-
}, Yr = (e, t, n) => {
|
|
1239
|
-
let r = /* @__PURE__ */ new Map();
|
|
1240
|
-
n.forEach((e, n) => {
|
|
1241
|
-
L(t, n) > e && r.set(n, e);
|
|
1242
|
-
}), Fi(t).forEach((e, t) => {
|
|
1243
|
-
n.has(t) || r.set(t, 0);
|
|
1244
|
-
}), v(e.restEncoder, r.size), c(r.entries()).sort((e, t) => t[0] - e[0]).forEach(([n, r]) => {
|
|
1245
|
-
Jr(e, t.clients.get(n), n, r);
|
|
1246
|
-
});
|
|
1247
|
-
}, Xr = (t, n) => {
|
|
1248
|
-
let r = e(), i = E(t.restDecoder);
|
|
1249
|
-
for (let e = 0; e < i; e++) {
|
|
1250
|
-
let e = E(t.restDecoder), i = Array(e), a = t.readClient(), o = E(t.restDecoder);
|
|
1251
|
-
r.set(a, {
|
|
1252
|
-
i: 0,
|
|
1253
|
-
refs: i
|
|
1254
|
-
});
|
|
1255
|
-
for (let r = 0; r < e; r++) {
|
|
1256
|
-
let e = t.readInfo();
|
|
1257
|
-
switch (31 & e) {
|
|
1258
|
-
case 0: {
|
|
1259
|
-
let e = t.readLen();
|
|
1260
|
-
i[r] = new G(I(a, o), e), o += e;
|
|
1261
|
-
break;
|
|
1262
|
-
}
|
|
1263
|
-
case 10: {
|
|
1264
|
-
let e = E(t.restDecoder);
|
|
1265
|
-
i[r] = new X(I(a, o), e), o += e;
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
default: {
|
|
1269
|
-
let s = !(e & 192), c = new Y(I(a, o), null, (e & 128) == 128 ? t.readLeftID() : null, null, (e & 64) == 64 ? t.readRightID() : null, s ? t.readParentInfo() ? n.get(t.readString()) : t.readLeftID() : null, s && (e & 32) == 32 ? t.readString() : null, $o(t, e));
|
|
1270
|
-
i[r] = c, o += c.length;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
return r;
|
|
1276
|
-
}, Zr = (e, t, r) => {
|
|
1277
|
-
let i = [], a = c(r.keys()).sort((e, t) => e - t);
|
|
1278
|
-
if (a.length === 0) return null;
|
|
1279
|
-
let o = () => {
|
|
1280
|
-
if (a.length === 0) return null;
|
|
1281
|
-
let e = r.get(a[a.length - 1]);
|
|
1282
|
-
for (; e.refs.length === e.i;) if (a.pop(), a.length > 0) e = r.get(a[a.length - 1]);
|
|
1283
|
-
else return null;
|
|
1284
|
-
return e;
|
|
1285
|
-
}, s = o();
|
|
1286
|
-
if (s === null) return null;
|
|
1287
|
-
let l = new Pi(), u = /* @__PURE__ */ new Map(), d = (e, t) => {
|
|
1288
|
-
let n = u.get(e);
|
|
1289
|
-
(n == null || n > t) && u.set(e, t);
|
|
1290
|
-
}, f = s.refs[s.i++], ee = /* @__PURE__ */ new Map(), te = () => {
|
|
1291
|
-
for (let e of i) {
|
|
1292
|
-
let t = e.id.client, n = r.get(t);
|
|
1293
|
-
n ? (n.i--, l.clients.set(t, n.refs.slice(n.i)), r.delete(t), n.i = 0, n.refs = []) : l.clients.set(t, [e]), a = a.filter((e) => e !== t);
|
|
1294
|
-
}
|
|
1295
|
-
i.length = 0;
|
|
1296
|
-
};
|
|
1297
|
-
for (;;) {
|
|
1298
|
-
if (f.constructor !== X) {
|
|
1299
|
-
let a = n(ee, f.id.client, () => L(t, f.id.client)) - f.id.clock;
|
|
1300
|
-
if (a < 0) i.push(f), d(f.id.client, f.id.clock - 1), te();
|
|
1301
|
-
else {
|
|
1302
|
-
let n = f.getMissing(e, t);
|
|
1303
|
-
if (n !== null) {
|
|
1304
|
-
i.push(f);
|
|
1305
|
-
let e = r.get(n) || {
|
|
1306
|
-
refs: [],
|
|
1307
|
-
i: 0
|
|
1308
|
-
};
|
|
1309
|
-
if (e.refs.length === e.i) d(n, L(t, n)), te();
|
|
1310
|
-
else {
|
|
1311
|
-
f = e.refs[e.i++];
|
|
1312
|
-
continue;
|
|
1313
|
-
}
|
|
1314
|
-
} else (a === 0 || a < f.length) && (f.integrate(e, a), ee.set(f.id.client, f.id.clock + f.length));
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
if (i.length > 0) f = i.pop();
|
|
1318
|
-
else if (s !== null && s.i < s.refs.length) f = s.refs[s.i++];
|
|
1319
|
-
else {
|
|
1320
|
-
if (s = o(), s === null) break;
|
|
1321
|
-
f = s.refs[s.i++];
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
if (l.clients.size > 0) {
|
|
1325
|
-
let e = new qr();
|
|
1326
|
-
return Yr(e, l, /* @__PURE__ */ new Map()), v(e.restEncoder, 0), {
|
|
1327
|
-
missing: u,
|
|
1328
|
-
update: e.toUint8Array()
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
|
-
return null;
|
|
1332
|
-
}, Qr = (e, t) => Yr(e, t.doc.store, t.beforeState), $r = (e, t, n, r = new Ur(e)) => B(t, (e) => {
|
|
1333
|
-
e.local = !1;
|
|
1334
|
-
let t = !1, n = e.doc, i = n.store, a = Zr(e, i, Xr(r, n)), o = i.pendingStructs;
|
|
1335
|
-
if (o) {
|
|
1336
|
-
for (let [e, n] of o.missing) if (n < L(i, e)) {
|
|
1337
|
-
t = !0;
|
|
1338
|
-
break;
|
|
1339
|
-
}
|
|
1340
|
-
if (a) {
|
|
1341
|
-
for (let [e, t] of a.missing) {
|
|
1342
|
-
let n = o.missing.get(e);
|
|
1343
|
-
(n == null || n > t) && o.missing.set(e, t);
|
|
1344
|
-
}
|
|
1345
|
-
o.update = ia([o.update, a.update]);
|
|
1346
|
-
}
|
|
1347
|
-
} else i.pendingStructs = a;
|
|
1348
|
-
let s = Lr(r, e, i);
|
|
1349
|
-
if (i.pendingDs) {
|
|
1350
|
-
let t = new Ur(w(i.pendingDs));
|
|
1351
|
-
E(t.restDecoder);
|
|
1352
|
-
let n = Lr(t, e, i);
|
|
1353
|
-
i.pendingDs = s && n ? ia([s, n]) : s || n;
|
|
1354
|
-
} else i.pendingDs = s;
|
|
1355
|
-
if (t) {
|
|
1356
|
-
let t = i.pendingStructs.update;
|
|
1357
|
-
i.pendingStructs = null, ei(e.doc, t);
|
|
1358
|
-
}
|
|
1359
|
-
}, n, !1), ei = (e, t, n, r = Ur) => {
|
|
1360
|
-
let i = w(t);
|
|
1361
|
-
$r(i, e, n, new r(i));
|
|
1362
|
-
}, ti = (e, t, n) => ei(e, t, n, Vr), ni = (e, t, n = /* @__PURE__ */ new Map()) => {
|
|
1363
|
-
Yr(e, t.store, n), Fr(e, Pr(t.store));
|
|
1364
|
-
}, ri = (e, t = new Uint8Array([0]), n = new qr()) => {
|
|
1365
|
-
ni(n, e, oi(t));
|
|
1366
|
-
let r = [n.toUint8Array()];
|
|
1367
|
-
if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(aa(e.store.pendingStructs.update, t)), r.length > 1) {
|
|
1368
|
-
if (n.constructor === Gr) return na(r.map((e, t) => t === 0 ? e : la(e)));
|
|
1369
|
-
if (n.constructor === qr) return ia(r);
|
|
1370
|
-
}
|
|
1371
|
-
return r[0];
|
|
1372
|
-
}, ii = (e, t) => ri(e, t, new Gr()), ai = (e) => {
|
|
1373
|
-
let t = /* @__PURE__ */ new Map(), n = E(e.restDecoder);
|
|
1374
|
-
for (let r = 0; r < n; r++) {
|
|
1375
|
-
let n = E(e.restDecoder), r = E(e.restDecoder);
|
|
1376
|
-
t.set(n, r);
|
|
1377
|
-
}
|
|
1378
|
-
return t;
|
|
1379
|
-
}, oi = (e) => ai(new Br(w(e))), si = (e, t) => (v(e.restEncoder, t.size), c(t.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
|
|
1380
|
-
v(e.restEncoder, t), v(e.restEncoder, n);
|
|
1381
|
-
}), e), ci = (e, t) => si(e, Fi(t.store)), li = (e, t = new Kr()) => (e instanceof Map ? si(t, e) : ci(t, e), t.toUint8Array()), ui = (e) => li(e, new Wr()), di = class {
|
|
1382
|
-
constructor() {
|
|
1383
|
-
this.l = [];
|
|
1384
|
-
}
|
|
1385
|
-
}, fi = () => new di(), pi = (e, t) => e.l.push(t), mi = (e, t) => {
|
|
1386
|
-
let n = e.l, r = n.length;
|
|
1387
|
-
e.l = n.filter((e) => t !== e), r === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
1388
|
-
}, hi = (e, t, n) => Et(e.l, [t, n]), gi = class {
|
|
1389
|
-
constructor(e, t) {
|
|
1390
|
-
this.client = e, this.clock = t;
|
|
1391
|
-
}
|
|
1392
|
-
}, _i = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, I = (e, t) => new gi(e, t), vi = (e) => {
|
|
1393
|
-
for (let [t, n] of e.doc.share.entries()) if (n === e) return t;
|
|
1394
|
-
throw C();
|
|
1395
|
-
}, yi = (e, t) => {
|
|
1396
|
-
for (; t !== null;) {
|
|
1397
|
-
if (t.parent === e) return !0;
|
|
1398
|
-
t = t.parent._item;
|
|
1399
|
-
}
|
|
1400
|
-
return !1;
|
|
1401
|
-
}, bi = class {
|
|
1402
|
-
constructor(e, t, n, r = 0) {
|
|
1403
|
-
this.type = e, this.tname = t, this.item = n, this.assoc = r;
|
|
1404
|
-
}
|
|
1405
|
-
}, xi = (e) => new bi(e.type == null ? null : I(e.type.client, e.type.clock), e.tname ?? null, e.item == null ? null : I(e.item.client, e.item.clock), e.assoc == null ? 0 : e.assoc), Si = class {
|
|
1406
|
-
constructor(e, t, n = 0) {
|
|
1407
|
-
this.type = e, this.index = t, this.assoc = n;
|
|
1408
|
-
}
|
|
1409
|
-
}, Ci = (e, t, n = 0) => new Si(e, t, n), wi = (e, t, n) => {
|
|
1410
|
-
let r = null, i = null;
|
|
1411
|
-
return e._item === null ? i = vi(e) : r = I(e._item.id.client, e._item.id.clock), new bi(r, i, t, n);
|
|
1412
|
-
}, Ti = (e, t, n = 0) => {
|
|
1413
|
-
let r = e._start;
|
|
1414
|
-
if (n < 0) {
|
|
1415
|
-
if (t === 0) return wi(e, null, n);
|
|
1416
|
-
t--;
|
|
1417
|
-
}
|
|
1418
|
-
for (; r !== null;) {
|
|
1419
|
-
if (!r.deleted && r.countable) {
|
|
1420
|
-
if (r.length > t) return wi(e, I(r.id.client, r.id.clock + t), n);
|
|
1421
|
-
t -= r.length;
|
|
1422
|
-
}
|
|
1423
|
-
if (r.right === null && n < 0) return wi(e, r.lastId, n);
|
|
1424
|
-
r = r.right;
|
|
1425
|
-
}
|
|
1426
|
-
return wi(e, null, n);
|
|
1427
|
-
}, Ei = (e, t) => {
|
|
1428
|
-
let n = Li(e, t);
|
|
1429
|
-
return {
|
|
1430
|
-
item: n,
|
|
1431
|
-
diff: t.clock - n.id.clock
|
|
1432
|
-
};
|
|
1433
|
-
}, Di = (e, t, n = !0) => {
|
|
1434
|
-
let r = t.store, i = e.item, a = e.type, o = e.tname, s = e.assoc, c = null, l = 0;
|
|
1435
|
-
if (i !== null) {
|
|
1436
|
-
if (L(r, i.client) <= i.clock) return null;
|
|
1437
|
-
let e = n ? Jo(r, i) : Ei(r, i), t = e.item;
|
|
1438
|
-
if (!(t instanceof Y)) return null;
|
|
1439
|
-
if (c = t.parent, c._item === null || !c._item.deleted) {
|
|
1440
|
-
l = t.deleted || !t.countable ? 0 : e.diff + (s >= 0 ? 0 : 1);
|
|
1441
|
-
let n = t.left;
|
|
1442
|
-
for (; n !== null;) !n.deleted && n.countable && (l += n.length), n = n.left;
|
|
1443
|
-
}
|
|
1444
|
-
} else {
|
|
1445
|
-
if (o !== null) c = t.get(o);
|
|
1446
|
-
else if (a !== null) {
|
|
1447
|
-
if (L(r, a.client) <= a.clock) return null;
|
|
1448
|
-
let { item: e } = n ? Jo(r, a) : { item: Li(r, a) };
|
|
1449
|
-
if (e instanceof Y && e.content instanceof J) c = e.content.type;
|
|
1450
|
-
else return null;
|
|
1451
|
-
} else throw C();
|
|
1452
|
-
l = s >= 0 ? c._length : 0;
|
|
1453
|
-
}
|
|
1454
|
-
return Ci(c, l, e.assoc);
|
|
1455
|
-
}, Oi = (e, t) => e === t || e !== null && t !== null && e.tname === t.tname && _i(e.item, t.item) && _i(e.type, t.type) && e.assoc === t.assoc, ki = class {
|
|
1456
|
-
constructor(e, t) {
|
|
1457
|
-
this.ds = e, this.sv = t;
|
|
1458
|
-
}
|
|
1459
|
-
}, Ai = (e, t) => new ki(e, t);
|
|
1460
|
-
Ai(Nr(), /* @__PURE__ */ new Map());
|
|
1461
|
-
var ji = (e) => Ai(Pr(e.store), Fi(e.store)), Mi = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !kr(t.ds, e.id), Ni = (e, t) => {
|
|
1462
|
-
let r = n(e.meta, Ni, a), i = e.doc.store;
|
|
1463
|
-
r.has(t) || (t.sv.forEach((t, n) => {
|
|
1464
|
-
t < L(i, n) && z(e, I(n, t));
|
|
1465
|
-
}), Dr(e, t.ds, (e) => {}), r.add(t));
|
|
1466
|
-
}, Pi = class {
|
|
1467
|
-
constructor() {
|
|
1468
|
-
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
1469
|
-
}
|
|
1470
|
-
}, Fi = (e) => {
|
|
1471
|
-
let t = /* @__PURE__ */ new Map();
|
|
1472
|
-
return e.clients.forEach((e, n) => {
|
|
1473
|
-
let r = e[e.length - 1];
|
|
1474
|
-
t.set(n, r.id.clock + r.length);
|
|
1475
|
-
}), t;
|
|
1476
|
-
}, L = (e, t) => {
|
|
1477
|
-
let n = e.clients.get(t);
|
|
1478
|
-
if (n === void 0) return 0;
|
|
1479
|
-
let r = n[n.length - 1];
|
|
1480
|
-
return r.id.clock + r.length;
|
|
1481
|
-
}, Ii = (e, t) => {
|
|
1482
|
-
let n = e.clients.get(t.id.client);
|
|
1483
|
-
if (n === void 0) n = [], e.clients.set(t.id.client, n);
|
|
1484
|
-
else {
|
|
1485
|
-
let e = n[n.length - 1];
|
|
1486
|
-
if (e.id.clock + e.length !== t.id.clock) throw C();
|
|
1487
|
-
}
|
|
1488
|
-
n.push(t);
|
|
1489
|
-
}, R = (e, t) => {
|
|
1490
|
-
let n = 0, r = e.length - 1, i = e[r], a = i.id.clock;
|
|
1491
|
-
if (a === t) return r;
|
|
1492
|
-
let o = p(t / (a + i.length - 1) * r);
|
|
1493
|
-
for (; n <= r;) {
|
|
1494
|
-
if (i = e[o], a = i.id.clock, a <= t) {
|
|
1495
|
-
if (t < a + i.length) return o;
|
|
1496
|
-
n = o + 1;
|
|
1497
|
-
} else r = o - 1;
|
|
1498
|
-
o = p((n + r) / 2);
|
|
1499
|
-
}
|
|
1500
|
-
throw C();
|
|
1501
|
-
}, Li = (e, t) => {
|
|
1502
|
-
let n = e.clients.get(t.client);
|
|
1503
|
-
return n[R(n, t.clock)];
|
|
1504
|
-
}, Ri = (e, t, n) => {
|
|
1505
|
-
let r = R(t, n), i = t[r];
|
|
1506
|
-
return i.id.clock < n && i instanceof Y ? (t.splice(r + 1, 0, Xo(e, i, n - i.id.clock)), r + 1) : r;
|
|
1507
|
-
}, z = (e, t) => {
|
|
1508
|
-
let n = e.doc.store.clients.get(t.client);
|
|
1509
|
-
return n[Ri(e, n, t.clock)];
|
|
1510
|
-
}, zi = (e, t, n) => {
|
|
1511
|
-
let r = t.clients.get(n.client), i = R(r, n.clock), a = r[i];
|
|
1512
|
-
return n.clock !== a.id.clock + a.length - 1 && a.constructor !== G && r.splice(i + 1, 0, Xo(e, a, n.clock - a.id.clock + 1)), a;
|
|
1513
|
-
}, Bi = (e, t, n) => {
|
|
1514
|
-
let r = e.clients.get(t.id.client);
|
|
1515
|
-
r[R(r, t.id.clock)] = n;
|
|
1516
|
-
}, Vi = (e, t, n, r, i) => {
|
|
1517
|
-
if (r === 0) return;
|
|
1518
|
-
let a = n + r, o = Ri(e, t, n), s;
|
|
1519
|
-
do
|
|
1520
|
-
s = t[o++], a < s.id.clock + s.length && Ri(e, t, a), i(s);
|
|
1521
|
-
while (o < t.length && t[o].id.clock < a);
|
|
1522
|
-
}, Hi = class {
|
|
1523
|
-
constructor(e, t, n) {
|
|
1524
|
-
this.doc = e, this.deleteSet = new Er(), this.beforeState = Fi(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = t, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
1525
|
-
}
|
|
1526
|
-
}, Ui = (e, t) => t.deleteSet.clients.size === 0 && !i(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (Ar(t.deleteSet), Qr(e, t), Fr(e, t.deleteSet), !0), Wi = (e, t, r) => {
|
|
1527
|
-
let i = t._item;
|
|
1528
|
-
(i === null || i.id.clock < (e.beforeState.get(i.id.client) || 0) && !i.deleted) && n(e.changed, t, a).add(r);
|
|
1529
|
-
}, Gi = (e, t) => {
|
|
1530
|
-
let n = e[t], r = e[t - 1], i = t;
|
|
1531
|
-
for (; i > 0; n = r, r = e[--i - 1]) {
|
|
1532
|
-
if (r.deleted === n.deleted && r.constructor === n.constructor && r.mergeWith(n)) {
|
|
1533
|
-
n instanceof Y && n.parentSub !== null && n.parent._map.get(n.parentSub) === n && n.parent._map.set(n.parentSub, r);
|
|
1534
|
-
continue;
|
|
1535
|
-
}
|
|
1536
|
-
break;
|
|
1537
|
-
}
|
|
1538
|
-
let a = t - i;
|
|
1539
|
-
return a && e.splice(t + 1 - a, a), a;
|
|
1540
|
-
}, Ki = (e, t, n) => {
|
|
1541
|
-
for (let [r, i] of e.clients.entries()) {
|
|
1542
|
-
let e = t.clients.get(r);
|
|
1543
|
-
for (let r = i.length - 1; r >= 0; r--) {
|
|
1544
|
-
let a = i[r], o = a.clock + a.len;
|
|
1545
|
-
for (let r = R(e, a.clock), i = e[r]; r < e.length && i.id.clock < o; i = e[++r]) {
|
|
1546
|
-
let i = e[r];
|
|
1547
|
-
if (a.clock + a.len <= i.id.clock) break;
|
|
1548
|
-
i instanceof Y && i.deleted && !i.keep && n(i) && i.gc(t, !1);
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
}, qi = (e, t) => {
|
|
1553
|
-
e.clients.forEach((e, n) => {
|
|
1554
|
-
let r = t.clients.get(n);
|
|
1555
|
-
for (let t = e.length - 1; t >= 0; t--) {
|
|
1556
|
-
let n = e[t], i = re(r.length - 1, 1 + R(r, n.clock + n.len - 1));
|
|
1557
|
-
for (let e = i, t = r[e]; e > 0 && t.id.clock >= n.clock; t = r[e]) e -= 1 + Gi(r, e);
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
}, Ji = (e, t) => {
|
|
1561
|
-
if (t < e.length) {
|
|
1562
|
-
let n = e[t], r = n.doc, i = r.store, a = n.deleteSet, o = n._mergeStructs;
|
|
1563
|
-
try {
|
|
1564
|
-
Ar(a), n.afterState = Fi(n.doc.store), r.emit("beforeObserverCalls", [n, r]);
|
|
1565
|
-
let e = [];
|
|
1566
|
-
n.changed.forEach((t, r) => e.push(() => {
|
|
1567
|
-
(r._item === null || !r._item.deleted) && r._callObserver(n, t);
|
|
1568
|
-
})), e.push(() => {
|
|
1569
|
-
n.changedParentTypes.forEach((t, r) => {
|
|
1570
|
-
r._dEH.l.length > 0 && (r._item === null || !r._item.deleted) && (t = t.filter((e) => e.target._item === null || !e.target._item.deleted), t.forEach((e) => {
|
|
1571
|
-
e.currentTarget = r, e._path = null;
|
|
1572
|
-
}), t.sort((e, t) => e.path.length - t.path.length), e.push(() => {
|
|
1573
|
-
hi(r._dEH, t, n);
|
|
1574
|
-
}));
|
|
1575
|
-
}), e.push(() => r.emit("afterTransaction", [n, r])), e.push(() => {
|
|
1576
|
-
n._needFormattingCleanup && ao(n);
|
|
1577
|
-
});
|
|
1578
|
-
}), Et(e, []);
|
|
1579
|
-
} finally {
|
|
1580
|
-
r.gc && Ki(a, i, r.gcFilter), qi(a, i), n.afterState.forEach((e, t) => {
|
|
1581
|
-
let r = n.beforeState.get(t) || 0;
|
|
1582
|
-
if (r !== e) {
|
|
1583
|
-
let e = i.clients.get(t), n = m(R(e, r), 1);
|
|
1584
|
-
for (let t = e.length - 1; t >= n;) t -= 1 + Gi(e, t);
|
|
1585
|
-
}
|
|
1586
|
-
});
|
|
1587
|
-
for (let e = o.length - 1; e >= 0; e--) {
|
|
1588
|
-
let { client: t, clock: n } = o[e].id, r = i.clients.get(t), a = R(r, n);
|
|
1589
|
-
a + 1 < r.length && Gi(r, a + 1) > 1 || a > 0 && Gi(r, a);
|
|
1590
|
-
}
|
|
1591
|
-
if (!n.local && n.afterState.get(r.clientID) !== n.beforeState.get(r.clientID) && (yr(mr, sr, "[yjs] ", cr, fr, "Changed the client-id because another client seems to be using it."), r.clientID = Rr()), r.emit("afterTransactionCleanup", [n, r]), r._observers.has("update")) {
|
|
1592
|
-
let e = new Gr();
|
|
1593
|
-
Ui(e, n) && r.emit("update", [
|
|
1594
|
-
e.toUint8Array(),
|
|
1595
|
-
n.origin,
|
|
1596
|
-
r,
|
|
1597
|
-
n
|
|
1598
|
-
]);
|
|
1599
|
-
}
|
|
1600
|
-
if (r._observers.has("updateV2")) {
|
|
1601
|
-
let e = new qr();
|
|
1602
|
-
Ui(e, n) && r.emit("updateV2", [
|
|
1603
|
-
e.toUint8Array(),
|
|
1604
|
-
n.origin,
|
|
1605
|
-
r,
|
|
1606
|
-
n
|
|
1607
|
-
]);
|
|
1608
|
-
}
|
|
1609
|
-
let { subdocsAdded: s, subdocsLoaded: c, subdocsRemoved: l } = n;
|
|
1610
|
-
(s.size > 0 || l.size > 0 || c.size > 0) && (s.forEach((e) => {
|
|
1611
|
-
e.clientID = r.clientID, e.collectionid ??= r.collectionid, r.subdocs.add(e);
|
|
1612
|
-
}), l.forEach((e) => r.subdocs.delete(e)), r.emit("subdocs", [
|
|
1613
|
-
{
|
|
1614
|
-
loaded: c,
|
|
1615
|
-
added: s,
|
|
1616
|
-
removed: l
|
|
1617
|
-
},
|
|
1618
|
-
r,
|
|
1619
|
-
n
|
|
1620
|
-
]), l.forEach((e) => e.destroy())), e.length <= t + 1 ? (r._transactionCleanups = [], r.emit("afterAllTransactions", [r, e])) : Ji(e, t + 1);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
}, B = (e, t, n = null, r = !0) => {
|
|
1624
|
-
let i = e._transactionCleanups, a = !1, o = null;
|
|
1625
|
-
e._transaction === null && (a = !0, e._transaction = new Hi(e, n, r), i.push(e._transaction), i.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
|
|
1626
|
-
try {
|
|
1627
|
-
o = t(e._transaction);
|
|
1628
|
-
} finally {
|
|
1629
|
-
if (a) {
|
|
1630
|
-
let t = e._transaction === i[0];
|
|
1631
|
-
e._transaction = null, t && Ji(i, 0);
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
return o;
|
|
1635
|
-
}, Yi = class {
|
|
1636
|
-
constructor(e, t) {
|
|
1637
|
-
this.insertions = t, this.deletions = e, this.meta = /* @__PURE__ */ new Map();
|
|
1638
|
-
}
|
|
1639
|
-
}, Xi = (e, t, n) => {
|
|
1640
|
-
Dr(e, n.deletions, (n) => {
|
|
1641
|
-
n instanceof Y && t.scope.some((t) => t === e.doc || yi(t, n)) && Yo(n, !1);
|
|
1642
|
-
});
|
|
1643
|
-
}, Zi = (e, t, n) => {
|
|
1644
|
-
let r = null, i = e.doc, a = e.scope;
|
|
1645
|
-
B(i, (n) => {
|
|
1646
|
-
for (; t.length > 0 && e.currStackItem === null;) {
|
|
1647
|
-
let r = i.store, o = t.pop(), s = /* @__PURE__ */ new Set(), c = [], l = !1;
|
|
1648
|
-
Dr(n, o.insertions, (e) => {
|
|
1649
|
-
if (e instanceof Y) {
|
|
1650
|
-
if (e.redone !== null) {
|
|
1651
|
-
let { item: t, diff: i } = Jo(r, e.id);
|
|
1652
|
-
i > 0 && (t = z(n, I(t.id.client, t.id.clock + i))), e = t;
|
|
1653
|
-
}
|
|
1654
|
-
!e.deleted && a.some((t) => t === n.doc || yi(t, e)) && c.push(e);
|
|
1655
|
-
}
|
|
1656
|
-
}), Dr(n, o.deletions, (e) => {
|
|
1657
|
-
e instanceof Y && a.some((t) => t === n.doc || yi(t, e)) && !kr(o.insertions, e.id) && s.add(e);
|
|
1658
|
-
}), s.forEach((t) => {
|
|
1659
|
-
l = Qo(n, t, s, o.insertions, e.ignoreRemoteMapChanges, e) !== null || l;
|
|
1660
|
-
});
|
|
1661
|
-
for (let t = c.length - 1; t >= 0; t--) {
|
|
1662
|
-
let r = c[t];
|
|
1663
|
-
e.deleteFilter(r) && (r.delete(n), l = !0);
|
|
1664
|
-
}
|
|
1665
|
-
e.currStackItem = l ? o : null;
|
|
1666
|
-
}
|
|
1667
|
-
n.changed.forEach((e, t) => {
|
|
1668
|
-
e.has(null) && t._searchMarker && (t._searchMarker.length = 0);
|
|
1669
|
-
}), r = n;
|
|
1670
|
-
}, e);
|
|
1671
|
-
let o = e.currStackItem;
|
|
1672
|
-
if (o != null) {
|
|
1673
|
-
let t = r.changedParentTypes;
|
|
1674
|
-
e.emit("stack-item-popped", [{
|
|
1675
|
-
stackItem: o,
|
|
1676
|
-
type: n,
|
|
1677
|
-
changedParentTypes: t,
|
|
1678
|
-
origin: e
|
|
1679
|
-
}, e]), e.currStackItem = null;
|
|
1680
|
-
}
|
|
1681
|
-
return o;
|
|
1682
|
-
}, Qi = class extends ee {
|
|
1683
|
-
constructor(e, { captureTimeout: t = 500, captureTransaction: n = (e) => !0, deleteFilter: r = () => !0, trackedOrigins: i = /* @__PURE__ */ new Set([null]), ignoreRemoteMapChanges: a = !1, doc: o = f(e) ? e[0].doc : e instanceof zr ? e : e.doc } = {}) {
|
|
1684
|
-
super(), this.scope = [], this.doc = o, this.addToScope(e), this.deleteFilter = r, i.add(this), this.trackedOrigins = i, this.captureTransaction = n, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.currStackItem = null, this.lastChange = 0, this.ignoreRemoteMapChanges = a, this.captureTimeout = t, this.afterTransactionHandler = (e) => {
|
|
1685
|
-
if (!this.captureTransaction(e) || !this.scope.some((t) => e.changedParentTypes.has(t) || t === this.doc) || !this.trackedOrigins.has(e.origin) && (!e.origin || !this.trackedOrigins.has(e.origin.constructor))) return;
|
|
1686
|
-
let t = this.undoing, n = this.redoing, r = t ? this.redoStack : this.undoStack;
|
|
1687
|
-
t ? this.stopCapturing() : n || this.clear(!1, !0);
|
|
1688
|
-
let i = new Er();
|
|
1689
|
-
e.afterState.forEach((t, n) => {
|
|
1690
|
-
let r = e.beforeState.get(n) || 0, a = t - r;
|
|
1691
|
-
a > 0 && Mr(i, n, r, a);
|
|
1692
|
-
});
|
|
1693
|
-
let a = O(), o = !1;
|
|
1694
|
-
if (this.lastChange > 0 && a - this.lastChange < this.captureTimeout && r.length > 0 && !t && !n) {
|
|
1695
|
-
let t = r[r.length - 1];
|
|
1696
|
-
t.deletions = jr([t.deletions, e.deleteSet]), t.insertions = jr([t.insertions, i]);
|
|
1697
|
-
} else r.push(new Yi(e.deleteSet, i)), o = !0;
|
|
1698
|
-
!t && !n && (this.lastChange = a), Dr(e, e.deleteSet, (t) => {
|
|
1699
|
-
t instanceof Y && this.scope.some((n) => n === e.doc || yi(n, t)) && Yo(t, !0);
|
|
1700
|
-
});
|
|
1701
|
-
let s = [{
|
|
1702
|
-
stackItem: r[r.length - 1],
|
|
1703
|
-
origin: e.origin,
|
|
1704
|
-
type: t ? "redo" : "undo",
|
|
1705
|
-
changedParentTypes: e.changedParentTypes
|
|
1706
|
-
}, this];
|
|
1707
|
-
o ? this.emit("stack-item-added", s) : this.emit("stack-item-updated", s);
|
|
1708
|
-
}, this.destroy = this.destroy.bind(this), this.doc.on("afterTransaction", this.afterTransactionHandler), this.doc.on("destroy", this.destroy);
|
|
1709
|
-
}
|
|
1710
|
-
addToScope(e) {
|
|
1711
|
-
let t = new Set(this.scope);
|
|
1712
|
-
e = f(e) ? e : [e], e.forEach((e) => {
|
|
1713
|
-
t.has(e) || (t.add(e), (e instanceof U ? e.doc !== this.doc : e !== this.doc) && br("[yjs#509] Not same Y.Doc"), this.scope.push(e));
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
addTrackedOrigin(e) {
|
|
1717
|
-
this.trackedOrigins.add(e);
|
|
1718
|
-
}
|
|
1719
|
-
removeTrackedOrigin(e) {
|
|
1720
|
-
this.trackedOrigins.delete(e);
|
|
1721
|
-
}
|
|
1722
|
-
clear(e = !0, t = !0) {
|
|
1723
|
-
(e && this.canUndo() || t && this.canRedo()) && this.doc.transact((n) => {
|
|
1724
|
-
e && (this.undoStack.forEach((e) => Xi(n, this, e)), this.undoStack = []), t && (this.redoStack.forEach((e) => Xi(n, this, e)), this.redoStack = []), this.emit("stack-cleared", [{
|
|
1725
|
-
undoStackCleared: e,
|
|
1726
|
-
redoStackCleared: t
|
|
1727
|
-
}]);
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
stopCapturing() {
|
|
1731
|
-
this.lastChange = 0;
|
|
1732
|
-
}
|
|
1733
|
-
undo() {
|
|
1734
|
-
this.undoing = !0;
|
|
1735
|
-
let e;
|
|
1736
|
-
try {
|
|
1737
|
-
e = Zi(this, this.undoStack, "undo");
|
|
1738
|
-
} finally {
|
|
1739
|
-
this.undoing = !1;
|
|
1740
|
-
}
|
|
1741
|
-
return e;
|
|
1742
|
-
}
|
|
1743
|
-
redo() {
|
|
1744
|
-
this.redoing = !0;
|
|
1745
|
-
let e;
|
|
1746
|
-
try {
|
|
1747
|
-
e = Zi(this, this.redoStack, "redo");
|
|
1748
|
-
} finally {
|
|
1749
|
-
this.redoing = !1;
|
|
1750
|
-
}
|
|
1751
|
-
return e;
|
|
1752
|
-
}
|
|
1753
|
-
canUndo() {
|
|
1754
|
-
return this.undoStack.length > 0;
|
|
1755
|
-
}
|
|
1756
|
-
canRedo() {
|
|
1757
|
-
return this.redoStack.length > 0;
|
|
1758
|
-
}
|
|
1759
|
-
destroy() {
|
|
1760
|
-
this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), this.doc.off("destroy", this.destroy), super.destroy();
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
function* $i(e) {
|
|
1764
|
-
let t = E(e.restDecoder);
|
|
1765
|
-
for (let n = 0; n < t; n++) {
|
|
1766
|
-
let t = E(e.restDecoder), n = e.readClient(), r = E(e.restDecoder);
|
|
1767
|
-
for (let i = 0; i < t; i++) {
|
|
1768
|
-
let t = e.readInfo();
|
|
1769
|
-
if (t === 10) {
|
|
1770
|
-
let t = E(e.restDecoder);
|
|
1771
|
-
yield new X(I(n, r), t), r += t;
|
|
1772
|
-
} else if (31 & t) {
|
|
1773
|
-
let i = !(t & 192), a = new Y(I(n, r), null, (t & 128) == 128 ? e.readLeftID() : null, null, (t & 64) == 64 ? e.readRightID() : null, i ? e.readParentInfo() ? e.readString() : e.readLeftID() : null, i && (t & 32) == 32 ? e.readString() : null, $o(e, t));
|
|
1774
|
-
yield a, r += a.length;
|
|
1775
|
-
} else {
|
|
1776
|
-
let t = e.readLen();
|
|
1777
|
-
yield new G(I(n, r), t), r += t;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
var ea = class {
|
|
1783
|
-
constructor(e, t) {
|
|
1784
|
-
this.gen = $i(e), this.curr = null, this.done = !1, this.filterSkips = t, this.next();
|
|
1785
|
-
}
|
|
1786
|
-
next() {
|
|
1787
|
-
do
|
|
1788
|
-
this.curr = this.gen.next().value || null;
|
|
1789
|
-
while (this.filterSkips && this.curr !== null && this.curr.constructor === X);
|
|
1790
|
-
return this.curr;
|
|
1791
|
-
}
|
|
1792
|
-
}, ta = class {
|
|
1793
|
-
constructor(e) {
|
|
1794
|
-
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = e, this.clientStructs = [];
|
|
1795
|
-
}
|
|
1796
|
-
}, na = (e) => ia(e, Vr, Gr), ra = (e, t) => {
|
|
1797
|
-
if (e.constructor === G) {
|
|
1798
|
-
let { client: n, clock: r } = e.id;
|
|
1799
|
-
return new G(I(n, r + t), e.length - t);
|
|
1800
|
-
}
|
|
1801
|
-
if (e.constructor === X) {
|
|
1802
|
-
let { client: n, clock: r } = e.id;
|
|
1803
|
-
return new X(I(n, r + t), e.length - t);
|
|
1804
|
-
}
|
|
1805
|
-
{
|
|
1806
|
-
let n = e, { client: r, clock: i } = n.id;
|
|
1807
|
-
return new Y(I(r, i + t), null, I(r, i + t - 1), null, n.rightOrigin, n.parent, n.parentSub, n.content.splice(t));
|
|
1808
|
-
}
|
|
1809
|
-
}, ia = (e, t = Ur, n = qr) => {
|
|
1810
|
-
if (e.length === 1) return e[0];
|
|
1811
|
-
let r = e.map((e) => new t(w(e))), i = r.map((e) => new ea(e, !0)), a = null, o = new n(), s = new ta(o);
|
|
1812
|
-
for (; i = i.filter((e) => e.curr !== null), i.sort((e, t) => {
|
|
1813
|
-
if (e.curr.id.client === t.curr.id.client) {
|
|
1814
|
-
let n = e.curr.id.clock - t.curr.id.clock;
|
|
1815
|
-
return n === 0 ? e.curr.constructor === t.curr.constructor ? 0 : e.curr.constructor === X ? 1 : -1 : n;
|
|
1816
|
-
}
|
|
1817
|
-
return t.curr.id.client - e.curr.id.client;
|
|
1818
|
-
}), i.length !== 0;) {
|
|
1819
|
-
let e = i[0], t = e.curr.id.client;
|
|
1820
|
-
if (a !== null) {
|
|
1821
|
-
let n = e.curr, r = !1;
|
|
1822
|
-
for (; n !== null && n.id.clock + n.length <= a.struct.id.clock + a.struct.length && n.id.client >= a.struct.id.client;) n = e.next(), r = !0;
|
|
1823
|
-
if (n === null || n.id.client !== t || r && n.id.clock > a.struct.id.clock + a.struct.length) continue;
|
|
1824
|
-
if (t !== a.struct.id.client) V(s, a.struct, a.offset), a = {
|
|
1825
|
-
struct: n,
|
|
1826
|
-
offset: 0
|
|
1827
|
-
}, e.next();
|
|
1828
|
-
else if (a.struct.id.clock + a.struct.length < n.id.clock) {
|
|
1829
|
-
if (a.struct.constructor === X) a.struct.length = n.id.clock + n.length - a.struct.id.clock;
|
|
1830
|
-
else {
|
|
1831
|
-
V(s, a.struct, a.offset);
|
|
1832
|
-
let e = n.id.clock - a.struct.id.clock - a.struct.length;
|
|
1833
|
-
a = {
|
|
1834
|
-
struct: new X(I(t, a.struct.id.clock + a.struct.length), e),
|
|
1835
|
-
offset: 0
|
|
1836
|
-
};
|
|
1837
|
-
}
|
|
1838
|
-
} else {
|
|
1839
|
-
let t = a.struct.id.clock + a.struct.length - n.id.clock;
|
|
1840
|
-
t > 0 && (a.struct.constructor === X ? a.struct.length -= t : n = ra(n, t)), a.struct.mergeWith(n) || (V(s, a.struct, a.offset), a = {
|
|
1841
|
-
struct: n,
|
|
1842
|
-
offset: 0
|
|
1843
|
-
}, e.next());
|
|
1844
|
-
}
|
|
1845
|
-
} else a = {
|
|
1846
|
-
struct: e.curr,
|
|
1847
|
-
offset: 0
|
|
1848
|
-
}, e.next();
|
|
1849
|
-
for (let n = e.curr; n !== null && n.id.client === t && n.id.clock === a.struct.id.clock + a.struct.length && n.constructor !== X; n = e.next()) V(s, a.struct, a.offset), a = {
|
|
1850
|
-
struct: n,
|
|
1851
|
-
offset: 0
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
return a !== null && (V(s, a.struct, a.offset), a = null), sa(s), Fr(o, jr(r.map((e) => Ir(e)))), o.toUint8Array();
|
|
1855
|
-
}, aa = (e, t, n = Ur, r = qr) => {
|
|
1856
|
-
let i = oi(t), a = new r(), o = new ta(a), s = new n(w(e)), c = new ea(s, !1);
|
|
1857
|
-
for (; c.curr;) {
|
|
1858
|
-
let e = c.curr, t = e.id.client, n = i.get(t) || 0;
|
|
1859
|
-
if (c.curr.constructor === X) {
|
|
1860
|
-
c.next();
|
|
1861
|
-
continue;
|
|
1862
|
-
}
|
|
1863
|
-
if (e.id.clock + e.length > n) for (V(o, e, m(n - e.id.clock, 0)), c.next(); c.curr && c.curr.id.client === t;) V(o, c.curr, 0), c.next();
|
|
1864
|
-
else for (; c.curr && c.curr.id.client === t && c.curr.id.clock + c.curr.length <= n;) c.next();
|
|
1865
|
-
}
|
|
1866
|
-
return sa(o), Fr(a, Ir(s)), a.toUint8Array();
|
|
1867
|
-
}, oa = (e) => {
|
|
1868
|
-
e.written > 0 && (e.clientStructs.push({
|
|
1869
|
-
written: e.written,
|
|
1870
|
-
restEncoder: g(e.encoder.restEncoder)
|
|
1871
|
-
}), e.encoder.restEncoder = h(), e.written = 0);
|
|
1872
|
-
}, V = (e, t, n) => {
|
|
1873
|
-
e.written > 0 && e.currClient !== t.id.client && oa(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), v(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
|
|
1874
|
-
}, sa = (e) => {
|
|
1875
|
-
oa(e);
|
|
1876
|
-
let t = e.encoder.restEncoder;
|
|
1877
|
-
v(t, e.clientStructs.length);
|
|
1878
|
-
for (let n = 0; n < e.clientStructs.length; n++) {
|
|
1879
|
-
let r = e.clientStructs[n];
|
|
1880
|
-
v(t, r.written), Oe(t, r.restEncoder);
|
|
1881
|
-
}
|
|
1882
|
-
}, ca = (e, t, n, r) => {
|
|
1883
|
-
let i = new n(w(e)), a = new ea(i, !1), o = new r(), s = new ta(o);
|
|
1884
|
-
for (let e = a.curr; e !== null; e = a.next()) V(s, t(e), 0);
|
|
1885
|
-
return sa(s), Fr(o, Ir(i)), o.toUint8Array();
|
|
1886
|
-
}, la = (e) => ca(e, Dt, Ur, Gr), ua = "You must not compute changes after the event-handler fired.", da = class {
|
|
1887
|
-
constructor(e, t) {
|
|
1888
|
-
this.target = e, this.currentTarget = e, this.transaction = t, this._changes = null, this._keys = null, this._delta = null, this._path = null;
|
|
1889
|
-
}
|
|
1890
|
-
get path() {
|
|
1891
|
-
return this._path ||= fa(this.currentTarget, this.target);
|
|
1892
|
-
}
|
|
1893
|
-
deletes(e) {
|
|
1894
|
-
return kr(this.transaction.deleteSet, e.id);
|
|
1895
|
-
}
|
|
1896
|
-
get keys() {
|
|
1897
|
-
if (this._keys === null) {
|
|
1898
|
-
if (this.transaction.doc._transactionCleanups.length === 0) throw x(ua);
|
|
1899
|
-
let e = /* @__PURE__ */ new Map(), t = this.target;
|
|
1900
|
-
this.transaction.changed.get(t).forEach((n) => {
|
|
1901
|
-
if (n !== null) {
|
|
1902
|
-
let r = t._map.get(n), i, a;
|
|
1903
|
-
if (this.adds(r)) {
|
|
1904
|
-
let e = r.left;
|
|
1905
|
-
for (; e !== null && this.adds(e);) e = e.left;
|
|
1906
|
-
if (this.deletes(r)) {
|
|
1907
|
-
if (e !== null && this.deletes(e)) i = "delete", a = o(e.content.getContent());
|
|
1908
|
-
else return;
|
|
1909
|
-
} else e !== null && this.deletes(e) ? (i = "update", a = o(e.content.getContent())) : (i = "add", a = void 0);
|
|
1910
|
-
} else if (this.deletes(r)) i = "delete", a = o(r.content.getContent());
|
|
1911
|
-
else return;
|
|
1912
|
-
e.set(n, {
|
|
1913
|
-
action: i,
|
|
1914
|
-
oldValue: a
|
|
1915
|
-
});
|
|
1916
|
-
}
|
|
1917
|
-
}), this._keys = e;
|
|
1918
|
-
}
|
|
1919
|
-
return this._keys;
|
|
1920
|
-
}
|
|
1921
|
-
get delta() {
|
|
1922
|
-
return this.changes.delta;
|
|
1923
|
-
}
|
|
1924
|
-
adds(e) {
|
|
1925
|
-
return e.id.clock >= (this.transaction.beforeState.get(e.id.client) || 0);
|
|
1926
|
-
}
|
|
1927
|
-
get changes() {
|
|
1928
|
-
let e = this._changes;
|
|
1929
|
-
if (e === null) {
|
|
1930
|
-
if (this.transaction.doc._transactionCleanups.length === 0) throw x(ua);
|
|
1931
|
-
let t = this.target, n = a(), r = a(), i = [];
|
|
1932
|
-
if (e = {
|
|
1933
|
-
added: n,
|
|
1934
|
-
deleted: r,
|
|
1935
|
-
delta: i,
|
|
1936
|
-
keys: this.keys
|
|
1937
|
-
}, this.transaction.changed.get(t).has(null)) {
|
|
1938
|
-
let e = null, a = () => {
|
|
1939
|
-
e && i.push(e);
|
|
1940
|
-
};
|
|
1941
|
-
for (let i = t._start; i !== null; i = i.right) i.deleted ? this.deletes(i) && !this.adds(i) && ((e === null || e.delete === void 0) && (a(), e = { delete: 0 }), e.delete += i.length, r.add(i)) : this.adds(i) ? ((e === null || e.insert === void 0) && (a(), e = { insert: [] }), e.insert = e.insert.concat(i.content.getContent()), n.add(i)) : ((e === null || e.retain === void 0) && (a(), e = { retain: 0 }), e.retain += i.length);
|
|
1942
|
-
e !== null && e.retain === void 0 && a();
|
|
1943
|
-
}
|
|
1944
|
-
this._changes = e;
|
|
1945
|
-
}
|
|
1946
|
-
return e;
|
|
1947
|
-
}
|
|
1948
|
-
}, fa = (e, t) => {
|
|
1949
|
-
let n = [];
|
|
1950
|
-
for (; t._item !== null && t !== e;) {
|
|
1951
|
-
if (t._item.parentSub !== null) n.unshift(t._item.parentSub);
|
|
1952
|
-
else {
|
|
1953
|
-
let e = 0, r = t._item.parent._start;
|
|
1954
|
-
for (; r !== t._item && r !== null;) !r.deleted && r.countable && (e += r.length), r = r.right;
|
|
1955
|
-
n.unshift(e);
|
|
1956
|
-
}
|
|
1957
|
-
t = t._item.parent;
|
|
1958
|
-
}
|
|
1959
|
-
return n;
|
|
1960
|
-
}, H = () => {
|
|
1961
|
-
br("Invalid access: Add Yjs type to a document before reading data.");
|
|
1962
|
-
}, pa = 80, ma = 0, ha = class {
|
|
1963
|
-
constructor(e, t) {
|
|
1964
|
-
e.marker = !0, this.p = e, this.index = t, this.timestamp = ma++;
|
|
1965
|
-
}
|
|
1966
|
-
}, ga = (e) => {
|
|
1967
|
-
e.timestamp = ma++;
|
|
1968
|
-
}, _a = (e, t, n) => {
|
|
1969
|
-
e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = ma++;
|
|
1970
|
-
}, va = (e, t, n) => {
|
|
1971
|
-
if (e.length >= pa) {
|
|
1972
|
-
let r = e.reduce((e, t) => e.timestamp < t.timestamp ? e : t);
|
|
1973
|
-
return _a(r, t, n), r;
|
|
1974
|
-
}
|
|
1975
|
-
{
|
|
1976
|
-
let r = new ha(t, n);
|
|
1977
|
-
return e.push(r), r;
|
|
1978
|
-
}
|
|
1979
|
-
}, ya = (e, t) => {
|
|
1980
|
-
if (e._start === null || t === 0 || e._searchMarker === null) return null;
|
|
1981
|
-
let n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((e, n) => ne(t - e.index) < ne(t - n.index) ? e : n), r = e._start, i = 0;
|
|
1982
|
-
for (n !== null && (r = n.p, i = n.index, ga(n)); r.right !== null && i < t;) {
|
|
1983
|
-
if (!r.deleted && r.countable) {
|
|
1984
|
-
if (t < i + r.length) break;
|
|
1985
|
-
i += r.length;
|
|
1986
|
-
}
|
|
1987
|
-
r = r.right;
|
|
1988
|
-
}
|
|
1989
|
-
for (; r.left !== null && i > t;) r = r.left, !r.deleted && r.countable && (i -= r.length);
|
|
1990
|
-
for (; r.left !== null && r.left.id.client === r.id.client && r.left.id.clock + r.left.length === r.id.clock;) r = r.left, !r.deleted && r.countable && (i -= r.length);
|
|
1991
|
-
return n !== null && ne(n.index - i) < r.parent.length / pa ? (_a(n, r, i), n) : va(e._searchMarker, r, i);
|
|
1992
|
-
}, ba = (e, t, n) => {
|
|
1993
|
-
for (let r = e.length - 1; r >= 0; r--) {
|
|
1994
|
-
let i = e[r];
|
|
1995
|
-
if (n > 0) {
|
|
1996
|
-
let t = i.p;
|
|
1997
|
-
for (t.marker = !1; t && (t.deleted || !t.countable);) t = t.left, t && !t.deleted && t.countable && (i.index -= t.length);
|
|
1998
|
-
if (t === null || t.marker === !0) {
|
|
1999
|
-
e.splice(r, 1);
|
|
2000
|
-
continue;
|
|
2001
|
-
}
|
|
2002
|
-
i.p = t, t.marker = !0;
|
|
2003
|
-
}
|
|
2004
|
-
(t < i.index || n > 0 && t === i.index) && (i.index = m(t, i.index + n));
|
|
2005
|
-
}
|
|
2006
|
-
}, xa = (e, t, r) => {
|
|
2007
|
-
let i = e, a = t.changedParentTypes;
|
|
2008
|
-
for (; n(a, e, () => []).push(r), e._item !== null;) e = e._item.parent;
|
|
2009
|
-
hi(i._eH, r, t);
|
|
2010
|
-
}, U = class {
|
|
2011
|
-
constructor() {
|
|
2012
|
-
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = fi(), this._dEH = fi(), this._searchMarker = null;
|
|
2013
|
-
}
|
|
2014
|
-
get parent() {
|
|
2015
|
-
return this._item ? this._item.parent : null;
|
|
2016
|
-
}
|
|
2017
|
-
_integrate(e, t) {
|
|
2018
|
-
this.doc = e, this._item = t;
|
|
2019
|
-
}
|
|
2020
|
-
_copy() {
|
|
2021
|
-
throw S();
|
|
2022
|
-
}
|
|
2023
|
-
clone() {
|
|
2024
|
-
throw S();
|
|
2025
|
-
}
|
|
2026
|
-
_write(e) {}
|
|
2027
|
-
get _first() {
|
|
2028
|
-
let e = this._start;
|
|
2029
|
-
for (; e !== null && e.deleted;) e = e.right;
|
|
2030
|
-
return e;
|
|
2031
|
-
}
|
|
2032
|
-
_callObserver(e, t) {
|
|
2033
|
-
!e.local && this._searchMarker && (this._searchMarker.length = 0);
|
|
2034
|
-
}
|
|
2035
|
-
observe(e) {
|
|
2036
|
-
pi(this._eH, e);
|
|
2037
|
-
}
|
|
2038
|
-
observeDeep(e) {
|
|
2039
|
-
pi(this._dEH, e);
|
|
2040
|
-
}
|
|
2041
|
-
unobserve(e) {
|
|
2042
|
-
mi(this._eH, e);
|
|
2043
|
-
}
|
|
2044
|
-
unobserveDeep(e) {
|
|
2045
|
-
mi(this._dEH, e);
|
|
2046
|
-
}
|
|
2047
|
-
toJSON() {}
|
|
2048
|
-
}, Sa = (e, t, n) => {
|
|
2049
|
-
e.doc ?? H(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
|
|
2050
|
-
let r = n - t, i = [], a = e._start;
|
|
2051
|
-
for (; a !== null && r > 0;) {
|
|
2052
|
-
if (a.countable && !a.deleted) {
|
|
2053
|
-
let e = a.content.getContent();
|
|
2054
|
-
if (e.length <= t) t -= e.length;
|
|
2055
|
-
else {
|
|
2056
|
-
for (let n = t; n < e.length && r > 0; n++) i.push(e[n]), r--;
|
|
2057
|
-
t = 0;
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
a = a.right;
|
|
2061
|
-
}
|
|
2062
|
-
return i;
|
|
2063
|
-
}, Ca = (e) => {
|
|
2064
|
-
e.doc ?? H();
|
|
2065
|
-
let t = [], n = e._start;
|
|
2066
|
-
for (; n !== null;) {
|
|
2067
|
-
if (n.countable && !n.deleted) {
|
|
2068
|
-
let e = n.content.getContent();
|
|
2069
|
-
for (let n = 0; n < e.length; n++) t.push(e[n]);
|
|
2070
|
-
}
|
|
2071
|
-
n = n.right;
|
|
2072
|
-
}
|
|
2073
|
-
return t;
|
|
2074
|
-
}, wa = (e, t) => {
|
|
2075
|
-
let n = [], r = e._start;
|
|
2076
|
-
for (; r !== null;) {
|
|
2077
|
-
if (r.countable && Mi(r, t)) {
|
|
2078
|
-
let e = r.content.getContent();
|
|
2079
|
-
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2080
|
-
}
|
|
2081
|
-
r = r.right;
|
|
2082
|
-
}
|
|
2083
|
-
return n;
|
|
2084
|
-
}, Ta = (e, t) => {
|
|
2085
|
-
let n = 0, r = e._start;
|
|
2086
|
-
for (e.doc ?? H(); r !== null;) {
|
|
2087
|
-
if (r.countable && !r.deleted) {
|
|
2088
|
-
let i = r.content.getContent();
|
|
2089
|
-
for (let r = 0; r < i.length; r++) t(i[r], n++, e);
|
|
2090
|
-
}
|
|
2091
|
-
r = r.right;
|
|
2092
|
-
}
|
|
2093
|
-
}, Ea = (e, t) => {
|
|
2094
|
-
let n = [];
|
|
2095
|
-
return Ta(e, (r, i) => {
|
|
2096
|
-
n.push(t(r, i, e));
|
|
2097
|
-
}), n;
|
|
2098
|
-
}, Da = (e) => {
|
|
2099
|
-
let t = e._start, n = null, r = 0;
|
|
2100
|
-
return {
|
|
2101
|
-
[Symbol.iterator]() {
|
|
2102
|
-
return this;
|
|
2103
|
-
},
|
|
2104
|
-
next: () => {
|
|
2105
|
-
if (n === null) {
|
|
2106
|
-
for (; t !== null && t.deleted;) t = t.right;
|
|
2107
|
-
if (t === null) return {
|
|
2108
|
-
done: !0,
|
|
2109
|
-
value: void 0
|
|
2110
|
-
};
|
|
2111
|
-
n = t.content.getContent(), r = 0, t = t.right;
|
|
2112
|
-
}
|
|
2113
|
-
let e = n[r++];
|
|
2114
|
-
return n.length <= r && (n = null), {
|
|
2115
|
-
done: !1,
|
|
2116
|
-
value: e
|
|
2117
|
-
};
|
|
2118
|
-
}
|
|
2119
|
-
};
|
|
2120
|
-
}, Oa = (e, t) => {
|
|
2121
|
-
e.doc ?? H();
|
|
2122
|
-
let n = ya(e, t), r = e._start;
|
|
2123
|
-
for (n !== null && (r = n.p, t -= n.index); r !== null; r = r.right) if (!r.deleted && r.countable) {
|
|
2124
|
-
if (t < r.length) return r.content.getContent()[t];
|
|
2125
|
-
t -= r.length;
|
|
2126
|
-
}
|
|
2127
|
-
}, ka = (e, t, n, r) => {
|
|
2128
|
-
let i = n, a = e.doc, o = a.clientID, s = a.store, c = n === null ? t._start : n.right, l = [], u = () => {
|
|
2129
|
-
l.length > 0 && (i = new Y(I(o, L(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Io(l)), i.integrate(e, 0), l = []);
|
|
2130
|
-
};
|
|
2131
|
-
r.forEach((n) => {
|
|
2132
|
-
if (n === null) l.push(n);
|
|
2133
|
-
else switch (n.constructor) {
|
|
2134
|
-
case Number:
|
|
2135
|
-
case Object:
|
|
2136
|
-
case Boolean:
|
|
2137
|
-
case Array:
|
|
2138
|
-
case String:
|
|
2139
|
-
l.push(n);
|
|
2140
|
-
break;
|
|
2141
|
-
default: switch (u(), n.constructor) {
|
|
2142
|
-
case Uint8Array:
|
|
2143
|
-
case ArrayBuffer:
|
|
2144
|
-
i = new Y(I(o, L(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Co(new Uint8Array(n))), i.integrate(e, 0);
|
|
2145
|
-
break;
|
|
2146
|
-
case zr:
|
|
2147
|
-
i = new Y(I(o, L(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Oo(n)), i.integrate(e, 0);
|
|
2148
|
-
break;
|
|
2149
|
-
default: if (n instanceof U) i = new Y(I(o, L(s, o)), i, i && i.lastId, c, c && c.id, t, null, new J(n)), i.integrate(e, 0);
|
|
2150
|
-
else throw Error("Unexpected content type in insert operation");
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
}), u();
|
|
2154
|
-
}, Aa = () => x("Length exceeded!"), ja = (e, t, n, r) => {
|
|
2155
|
-
if (n > t._length) throw Aa();
|
|
2156
|
-
if (n === 0) return t._searchMarker && ba(t._searchMarker, n, r.length), ka(e, t, null, r);
|
|
2157
|
-
let i = n, a = ya(t, n), o = t._start;
|
|
2158
|
-
for (a !== null && (o = a.p, n -= a.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right) if (!o.deleted && o.countable) {
|
|
2159
|
-
if (n <= o.length) {
|
|
2160
|
-
n < o.length && z(e, I(o.id.client, o.id.clock + n));
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2163
|
-
n -= o.length;
|
|
2164
|
-
}
|
|
2165
|
-
return t._searchMarker && ba(t._searchMarker, i, r.length), ka(e, t, o, r);
|
|
2166
|
-
}, Ma = (e, t, n) => {
|
|
2167
|
-
let r = (t._searchMarker || []).reduce((e, t) => t.index > e.index ? t : e, {
|
|
2168
|
-
index: 0,
|
|
2169
|
-
p: t._start
|
|
2170
|
-
}).p;
|
|
2171
|
-
if (r) for (; r.right;) r = r.right;
|
|
2172
|
-
return ka(e, t, r, n);
|
|
2173
|
-
}, Na = (e, t, n, r) => {
|
|
2174
|
-
if (r === 0) return;
|
|
2175
|
-
let i = n, a = r, o = ya(t, n), s = t._start;
|
|
2176
|
-
for (o !== null && (s = o.p, n -= o.index); s !== null && n > 0; s = s.right) !s.deleted && s.countable && (n < s.length && z(e, I(s.id.client, s.id.clock + n)), n -= s.length);
|
|
2177
|
-
for (; r > 0 && s !== null;) s.deleted || (r < s.length && z(e, I(s.id.client, s.id.clock + r)), s.delete(e), r -= s.length), s = s.right;
|
|
2178
|
-
if (r > 0) throw Aa();
|
|
2179
|
-
t._searchMarker && ba(t._searchMarker, i, -a + r);
|
|
2180
|
-
}, Pa = (e, t, n) => {
|
|
2181
|
-
let r = t._map.get(n);
|
|
2182
|
-
r !== void 0 && r.delete(e);
|
|
2183
|
-
}, Fa = (e, t, n, r) => {
|
|
2184
|
-
let i = t._map.get(n) || null, a = e.doc, o = a.clientID, s;
|
|
2185
|
-
if (r == null) s = new Io([r]);
|
|
2186
|
-
else switch (r.constructor) {
|
|
2187
|
-
case Number:
|
|
2188
|
-
case Object:
|
|
2189
|
-
case Boolean:
|
|
2190
|
-
case Array:
|
|
2191
|
-
case String:
|
|
2192
|
-
case Date:
|
|
2193
|
-
case BigInt:
|
|
2194
|
-
s = new Io([r]);
|
|
2195
|
-
break;
|
|
2196
|
-
case Uint8Array:
|
|
2197
|
-
s = new Co(r);
|
|
2198
|
-
break;
|
|
2199
|
-
case zr:
|
|
2200
|
-
s = new Oo(r);
|
|
2201
|
-
break;
|
|
2202
|
-
default: if (r instanceof U) s = new J(r);
|
|
2203
|
-
else throw Error("Unexpected content type");
|
|
2204
|
-
}
|
|
2205
|
-
new Y(I(o, L(a.store, o)), i, i && i.lastId, null, null, t, n, s).integrate(e, 0);
|
|
2206
|
-
}, Ia = (e, t) => {
|
|
2207
|
-
e.doc ?? H();
|
|
2208
|
-
let n = e._map.get(t);
|
|
2209
|
-
return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
|
|
2210
|
-
}, La = (e) => {
|
|
2211
|
-
let t = {};
|
|
2212
|
-
return e.doc ?? H(), e._map.forEach((e, n) => {
|
|
2213
|
-
e.deleted || (t[n] = e.content.getContent()[e.length - 1]);
|
|
2214
|
-
}), t;
|
|
2215
|
-
}, Ra = (e, t) => {
|
|
2216
|
-
e.doc ?? H();
|
|
2217
|
-
let n = e._map.get(t);
|
|
2218
|
-
return n !== void 0 && !n.deleted;
|
|
2219
|
-
}, za = (e, t) => {
|
|
2220
|
-
let n = {};
|
|
2221
|
-
return e._map.forEach((e, r) => {
|
|
2222
|
-
let i = e;
|
|
2223
|
-
for (; i !== null && (!t.sv.has(i.id.client) || i.id.clock >= (t.sv.get(i.id.client) || 0));) i = i.left;
|
|
2224
|
-
i !== null && Mi(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
|
|
2225
|
-
}), n;
|
|
2226
|
-
}, Ba = (e) => (e.doc ?? H(), Cr(e._map.entries(), (e) => !e[1].deleted)), Va = class extends da {}, Ha = class e extends U {
|
|
2227
|
-
constructor() {
|
|
2228
|
-
super(), this._prelimContent = [], this._searchMarker = [];
|
|
2229
|
-
}
|
|
2230
|
-
static from(t) {
|
|
2231
|
-
let n = new e();
|
|
2232
|
-
return n.push(t), n;
|
|
2233
|
-
}
|
|
2234
|
-
_integrate(e, t) {
|
|
2235
|
-
super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
|
|
2236
|
-
}
|
|
2237
|
-
_copy() {
|
|
2238
|
-
return new e();
|
|
2239
|
-
}
|
|
2240
|
-
clone() {
|
|
2241
|
-
let t = new e();
|
|
2242
|
-
return t.insert(0, this.toArray().map((e) => e instanceof U ? e.clone() : e)), t;
|
|
2243
|
-
}
|
|
2244
|
-
get length() {
|
|
2245
|
-
return this.doc ?? H(), this._length;
|
|
2246
|
-
}
|
|
2247
|
-
_callObserver(e, t) {
|
|
2248
|
-
super._callObserver(e, t), xa(this, e, new Va(this, e));
|
|
2249
|
-
}
|
|
2250
|
-
insert(e, t) {
|
|
2251
|
-
this.doc === null ? this._prelimContent.splice(e, 0, ...t) : B(this.doc, (n) => {
|
|
2252
|
-
ja(n, this, e, t);
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
push(e) {
|
|
2256
|
-
this.doc === null ? this._prelimContent.push(...e) : B(this.doc, (t) => {
|
|
2257
|
-
Ma(t, this, e);
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
2260
|
-
unshift(e) {
|
|
2261
|
-
this.insert(0, e);
|
|
2262
|
-
}
|
|
2263
|
-
delete(e, t = 1) {
|
|
2264
|
-
this.doc === null ? this._prelimContent.splice(e, t) : B(this.doc, (n) => {
|
|
2265
|
-
Na(n, this, e, t);
|
|
2266
|
-
});
|
|
2267
|
-
}
|
|
2268
|
-
get(e) {
|
|
2269
|
-
return Oa(this, e);
|
|
2270
|
-
}
|
|
2271
|
-
toArray() {
|
|
2272
|
-
return Ca(this);
|
|
2273
|
-
}
|
|
2274
|
-
slice(e = 0, t = this.length) {
|
|
2275
|
-
return Sa(this, e, t);
|
|
2276
|
-
}
|
|
2277
|
-
toJSON() {
|
|
2278
|
-
return this.map((e) => e instanceof U ? e.toJSON() : e);
|
|
2279
|
-
}
|
|
2280
|
-
map(e) {
|
|
2281
|
-
return Ea(this, e);
|
|
2282
|
-
}
|
|
2283
|
-
forEach(e) {
|
|
2284
|
-
Ta(this, e);
|
|
2285
|
-
}
|
|
2286
|
-
[Symbol.iterator]() {
|
|
2287
|
-
return Da(this);
|
|
2288
|
-
}
|
|
2289
|
-
_write(e) {
|
|
2290
|
-
e.writeTypeRef(Bo);
|
|
2291
|
-
}
|
|
2292
|
-
}, Ua = (e) => new Ha(), Wa = class extends da {
|
|
2293
|
-
constructor(e, t, n) {
|
|
2294
|
-
super(e, t), this.keysChanged = n;
|
|
2295
|
-
}
|
|
2296
|
-
}, Ga = class e extends U {
|
|
2297
|
-
constructor(e) {
|
|
2298
|
-
super(), this._prelimContent = null, this._prelimContent = e === void 0 ? /* @__PURE__ */ new Map() : new Map(e);
|
|
2299
|
-
}
|
|
2300
|
-
_integrate(e, t) {
|
|
2301
|
-
super._integrate(e, t), this._prelimContent.forEach((e, t) => {
|
|
2302
|
-
this.set(t, e);
|
|
2303
|
-
}), this._prelimContent = null;
|
|
2304
|
-
}
|
|
2305
|
-
_copy() {
|
|
2306
|
-
return new e();
|
|
2307
|
-
}
|
|
2308
|
-
clone() {
|
|
2309
|
-
let t = new e();
|
|
2310
|
-
return this.forEach((e, n) => {
|
|
2311
|
-
t.set(n, e instanceof U ? e.clone() : e);
|
|
2312
|
-
}), t;
|
|
2313
|
-
}
|
|
2314
|
-
_callObserver(e, t) {
|
|
2315
|
-
xa(this, e, new Wa(this, e, t));
|
|
2316
|
-
}
|
|
2317
|
-
toJSON() {
|
|
2318
|
-
this.doc ?? H();
|
|
2319
|
-
let e = {};
|
|
2320
|
-
return this._map.forEach((t, n) => {
|
|
2321
|
-
if (!t.deleted) {
|
|
2322
|
-
let r = t.content.getContent()[t.length - 1];
|
|
2323
|
-
e[n] = r instanceof U ? r.toJSON() : r;
|
|
2324
|
-
}
|
|
2325
|
-
}), e;
|
|
2326
|
-
}
|
|
2327
|
-
get size() {
|
|
2328
|
-
return [...Ba(this)].length;
|
|
2329
|
-
}
|
|
2330
|
-
keys() {
|
|
2331
|
-
return wr(Ba(this), (e) => e[0]);
|
|
2332
|
-
}
|
|
2333
|
-
values() {
|
|
2334
|
-
return wr(Ba(this), (e) => e[1].content.getContent()[e[1].length - 1]);
|
|
2335
|
-
}
|
|
2336
|
-
entries() {
|
|
2337
|
-
return wr(Ba(this), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]);
|
|
2338
|
-
}
|
|
2339
|
-
forEach(e) {
|
|
2340
|
-
this.doc ?? H(), this._map.forEach((t, n) => {
|
|
2341
|
-
t.deleted || e(t.content.getContent()[t.length - 1], n, this);
|
|
2342
|
-
});
|
|
2343
|
-
}
|
|
2344
|
-
[Symbol.iterator]() {
|
|
2345
|
-
return this.entries();
|
|
2346
|
-
}
|
|
2347
|
-
delete(e) {
|
|
2348
|
-
this.doc === null ? this._prelimContent.delete(e) : B(this.doc, (t) => {
|
|
2349
|
-
Pa(t, this, e);
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
set(e, t) {
|
|
2353
|
-
return this.doc === null ? this._prelimContent.set(e, t) : B(this.doc, (n) => {
|
|
2354
|
-
Fa(n, this, e, t);
|
|
2355
|
-
}), t;
|
|
2356
|
-
}
|
|
2357
|
-
get(e) {
|
|
2358
|
-
return Ia(this, e);
|
|
2359
|
-
}
|
|
2360
|
-
has(e) {
|
|
2361
|
-
return Ra(this, e);
|
|
2362
|
-
}
|
|
2363
|
-
clear() {
|
|
2364
|
-
this.doc === null ? this._prelimContent.clear() : B(this.doc, (e) => {
|
|
2365
|
-
this.forEach(function(t, n, r) {
|
|
2366
|
-
Pa(e, r, n);
|
|
2367
|
-
});
|
|
2368
|
-
});
|
|
2369
|
-
}
|
|
2370
|
-
_write(e) {
|
|
2371
|
-
e.writeTypeRef(Vo);
|
|
2372
|
-
}
|
|
2373
|
-
}, Ka = (e) => new Ga(), W = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && Ct(e, t), qa = class {
|
|
2374
|
-
constructor(e, t, n, r) {
|
|
2375
|
-
this.left = e, this.right = t, this.index = n, this.currentAttributes = r;
|
|
2376
|
-
}
|
|
2377
|
-
forward() {
|
|
2378
|
-
switch (this.right === null && C(), this.right.content.constructor) {
|
|
2379
|
-
case K:
|
|
2380
|
-
this.right.deleted || Za(this.currentAttributes, this.right.content);
|
|
2381
|
-
break;
|
|
2382
|
-
default: this.right.deleted || (this.index += this.right.length);
|
|
2383
|
-
}
|
|
2384
|
-
this.left = this.right, this.right = this.right.right;
|
|
2385
|
-
}
|
|
2386
|
-
}, Ja = (e, t, n) => {
|
|
2387
|
-
for (; t.right !== null && n > 0;) {
|
|
2388
|
-
switch (t.right.content.constructor) {
|
|
2389
|
-
case K:
|
|
2390
|
-
t.right.deleted || Za(t.currentAttributes, t.right.content);
|
|
2391
|
-
break;
|
|
2392
|
-
default: t.right.deleted || (n < t.right.length && z(e, I(t.right.id.client, t.right.id.clock + n)), t.index += t.right.length, n -= t.right.length);
|
|
2393
|
-
}
|
|
2394
|
-
t.left = t.right, t.right = t.right.right;
|
|
2395
|
-
}
|
|
2396
|
-
return t;
|
|
2397
|
-
}, Ya = (e, t, n, r) => {
|
|
2398
|
-
let i = /* @__PURE__ */ new Map(), a = r ? ya(t, n) : null;
|
|
2399
|
-
return a ? Ja(e, new qa(a.p.left, a.p, a.index, i), n - a.index) : Ja(e, new qa(null, t._start, 0, i), n);
|
|
2400
|
-
}, Xa = (e, t, n, r) => {
|
|
2401
|
-
for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === K && W(r.get(n.right.content.key), n.right.content.value));) n.right.deleted || r.delete(n.right.content.key), n.forward();
|
|
2402
|
-
let i = e.doc, a = i.clientID;
|
|
2403
|
-
r.forEach((r, o) => {
|
|
2404
|
-
let s = n.left, c = n.right, l = new Y(I(a, L(i.store, a)), s, s && s.lastId, c, c && c.id, t, null, new K(o, r));
|
|
2405
|
-
l.integrate(e, 0), n.right = l, n.forward();
|
|
2406
|
-
});
|
|
2407
|
-
}, Za = (e, t) => {
|
|
2408
|
-
let { key: n, value: r } = t;
|
|
2409
|
-
r === null ? e.delete(n) : e.set(n, r);
|
|
2410
|
-
}, Qa = (e, t) => {
|
|
2411
|
-
for (; e.right !== null && (e.right.deleted || e.right.content.constructor === K && W(t[e.right.content.key] ?? null, e.right.content.value));) e.forward();
|
|
2412
|
-
}, $a = (e, t, n, r) => {
|
|
2413
|
-
let i = e.doc, a = i.clientID, o = /* @__PURE__ */ new Map();
|
|
2414
|
-
for (let s in r) {
|
|
2415
|
-
let c = r[s], l = n.currentAttributes.get(s) ?? null;
|
|
2416
|
-
if (!W(l, c)) {
|
|
2417
|
-
o.set(s, l);
|
|
2418
|
-
let { left: r, right: u } = n;
|
|
2419
|
-
n.right = new Y(I(a, L(i.store, a)), r, r && r.lastId, u, u && u.id, t, null, new K(s, c)), n.right.integrate(e, 0), n.forward();
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
return o;
|
|
2423
|
-
}, eo = (e, t, n, r, i) => {
|
|
2424
|
-
n.currentAttributes.forEach((e, t) => {
|
|
2425
|
-
i[t] === void 0 && (i[t] = null);
|
|
2426
|
-
});
|
|
2427
|
-
let a = e.doc, o = a.clientID;
|
|
2428
|
-
Qa(n, i);
|
|
2429
|
-
let s = $a(e, t, n, i), c = r.constructor === String ? new q(r) : r instanceof U ? new J(r) : new Ao(r), { left: l, right: u, index: d } = n;
|
|
2430
|
-
t._searchMarker && ba(t._searchMarker, n.index, c.getLength()), u = new Y(I(o, L(a.store, o)), l, l && l.lastId, u, u && u.id, t, null, c), u.integrate(e, 0), n.right = u, n.index = d, n.forward(), Xa(e, t, n, s);
|
|
2431
|
-
}, to = (e, t, n, r, i) => {
|
|
2432
|
-
let a = e.doc, o = a.clientID;
|
|
2433
|
-
Qa(n, i);
|
|
2434
|
-
let s = $a(e, t, n, i);
|
|
2435
|
-
iterationLoop: for (; n.right !== null && (r > 0 || s.size > 0 && (n.right.deleted || n.right.content.constructor === K));) {
|
|
2436
|
-
if (!n.right.deleted) switch (n.right.content.constructor) {
|
|
2437
|
-
case K: {
|
|
2438
|
-
let { key: t, value: a } = n.right.content, o = i[t];
|
|
2439
|
-
if (o !== void 0) {
|
|
2440
|
-
if (W(o, a)) s.delete(t);
|
|
2441
|
-
else {
|
|
2442
|
-
if (r === 0) break iterationLoop;
|
|
2443
|
-
s.set(t, a);
|
|
2444
|
-
}
|
|
2445
|
-
n.right.delete(e);
|
|
2446
|
-
} else n.currentAttributes.set(t, a);
|
|
2447
|
-
break;
|
|
2448
|
-
}
|
|
2449
|
-
default: r < n.right.length && z(e, I(n.right.id.client, n.right.id.clock + r)), r -= n.right.length;
|
|
2450
|
-
}
|
|
2451
|
-
n.forward();
|
|
2452
|
-
}
|
|
2453
|
-
if (r > 0) {
|
|
2454
|
-
let i = "";
|
|
2455
|
-
for (; r > 0; r--) i += "\n";
|
|
2456
|
-
n.right = new Y(I(o, L(a.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new q(i)), n.right.integrate(e, 0), n.forward();
|
|
2457
|
-
}
|
|
2458
|
-
Xa(e, t, n, s);
|
|
2459
|
-
}, no = (t, n, r, i, a) => {
|
|
2460
|
-
let o = n, s = e();
|
|
2461
|
-
for (; o && (!o.countable || o.deleted);) {
|
|
2462
|
-
if (!o.deleted && o.content.constructor === K) {
|
|
2463
|
-
let e = o.content;
|
|
2464
|
-
s.set(e.key, e);
|
|
2465
|
-
}
|
|
2466
|
-
o = o.right;
|
|
2467
|
-
}
|
|
2468
|
-
let c = 0, l = !1;
|
|
2469
|
-
for (; n !== o;) {
|
|
2470
|
-
if (r === n && (l = !0), !n.deleted) {
|
|
2471
|
-
let e = n.content;
|
|
2472
|
-
switch (e.constructor) {
|
|
2473
|
-
case K: {
|
|
2474
|
-
let { key: r, value: o } = e, u = i.get(r) ?? null;
|
|
2475
|
-
(s.get(r) !== e || u === o) && (n.delete(t), c++, !l && (a.get(r) ?? null) === o && u !== o && (u === null ? a.delete(r) : a.set(r, u))), !l && !n.deleted && Za(a, e);
|
|
2476
|
-
break;
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
n = n.right;
|
|
2481
|
-
}
|
|
2482
|
-
return c;
|
|
2483
|
-
}, ro = (e, t) => {
|
|
2484
|
-
for (; t && t.right && (t.right.deleted || !t.right.countable);) t = t.right;
|
|
2485
|
-
let n = /* @__PURE__ */ new Set();
|
|
2486
|
-
for (; t && (t.deleted || !t.countable);) {
|
|
2487
|
-
if (!t.deleted && t.content.constructor === K) {
|
|
2488
|
-
let r = t.content.key;
|
|
2489
|
-
n.has(r) ? t.delete(e) : n.add(r);
|
|
2490
|
-
}
|
|
2491
|
-
t = t.left;
|
|
2492
|
-
}
|
|
2493
|
-
}, io = (n) => {
|
|
2494
|
-
let r = 0;
|
|
2495
|
-
return B(n.doc, (i) => {
|
|
2496
|
-
let a = n._start, o = n._start, s = e(), c = t(s);
|
|
2497
|
-
for (; o;) {
|
|
2498
|
-
if (o.deleted === !1) switch (o.content.constructor) {
|
|
2499
|
-
case K:
|
|
2500
|
-
Za(c, o.content);
|
|
2501
|
-
break;
|
|
2502
|
-
default: r += no(i, a, o, s, c), s = t(c), a = o;
|
|
2503
|
-
}
|
|
2504
|
-
o = o.right;
|
|
2505
|
-
}
|
|
2506
|
-
}), r;
|
|
2507
|
-
}, ao = (e) => {
|
|
2508
|
-
let t = /* @__PURE__ */ new Set(), n = e.doc;
|
|
2509
|
-
for (let [r, i] of e.afterState.entries()) {
|
|
2510
|
-
let a = e.beforeState.get(r) || 0;
|
|
2511
|
-
i !== a && Vi(e, n.store.clients.get(r), a, i, (e) => {
|
|
2512
|
-
!e.deleted && e.content.constructor === K && e.constructor !== G && t.add(e.parent);
|
|
2513
|
-
});
|
|
2514
|
-
}
|
|
2515
|
-
B(n, (n) => {
|
|
2516
|
-
Dr(e, e.deleteSet, (e) => {
|
|
2517
|
-
if (e instanceof G || !e.parent._hasFormatting || t.has(e.parent)) return;
|
|
2518
|
-
let r = e.parent;
|
|
2519
|
-
e.content.constructor === K ? t.add(r) : ro(n, e);
|
|
2520
|
-
});
|
|
2521
|
-
for (let e of t) io(e);
|
|
2522
|
-
});
|
|
2523
|
-
}, oo = (e, n, r) => {
|
|
2524
|
-
let i = r, a = t(n.currentAttributes), o = n.right;
|
|
2525
|
-
for (; r > 0 && n.right !== null;) {
|
|
2526
|
-
if (n.right.deleted === !1) switch (n.right.content.constructor) {
|
|
2527
|
-
case J:
|
|
2528
|
-
case Ao:
|
|
2529
|
-
case q: r < n.right.length && z(e, I(n.right.id.client, n.right.id.clock + r)), r -= n.right.length, n.right.delete(e);
|
|
2530
|
-
}
|
|
2531
|
-
n.forward();
|
|
2532
|
-
}
|
|
2533
|
-
o && no(e, o, n.right, a, n.currentAttributes);
|
|
2534
|
-
let s = (n.left || n.right).parent;
|
|
2535
|
-
return s._searchMarker && ba(s._searchMarker, n.index, -i + r), n;
|
|
2536
|
-
}, so = class extends da {
|
|
2537
|
-
constructor(e, t, n) {
|
|
2538
|
-
super(e, t), this.childListChanged = !1, this.keysChanged = /* @__PURE__ */ new Set(), n.forEach((e) => {
|
|
2539
|
-
e === null ? this.childListChanged = !0 : this.keysChanged.add(e);
|
|
2540
|
-
});
|
|
2541
|
-
}
|
|
2542
|
-
get changes() {
|
|
2543
|
-
if (this._changes === null) {
|
|
2544
|
-
let e = {
|
|
2545
|
-
keys: this.keys,
|
|
2546
|
-
delta: this.delta,
|
|
2547
|
-
added: /* @__PURE__ */ new Set(),
|
|
2548
|
-
deleted: /* @__PURE__ */ new Set()
|
|
2549
|
-
};
|
|
2550
|
-
this._changes = e;
|
|
2551
|
-
}
|
|
2552
|
-
return this._changes;
|
|
2553
|
-
}
|
|
2554
|
-
get delta() {
|
|
2555
|
-
if (this._delta === null) {
|
|
2556
|
-
let e = this.target.doc, t = [];
|
|
2557
|
-
B(e, (e) => {
|
|
2558
|
-
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = this.target._start, a = null, o = {}, s = "", c = 0, l = 0, u = () => {
|
|
2559
|
-
if (a !== null) {
|
|
2560
|
-
let e = null;
|
|
2561
|
-
switch (a) {
|
|
2562
|
-
case "delete":
|
|
2563
|
-
l > 0 && (e = { delete: l }), l = 0;
|
|
2564
|
-
break;
|
|
2565
|
-
case "insert":
|
|
2566
|
-
(typeof s == "object" || s.length > 0) && (e = { insert: s }, n.size > 0 && (e.attributes = {}, n.forEach((t, n) => {
|
|
2567
|
-
t !== null && (e.attributes[n] = t);
|
|
2568
|
-
}))), s = "";
|
|
2569
|
-
break;
|
|
2570
|
-
case "retain": c > 0 && (e = { retain: c }, bt(o) || (e.attributes = gt({}, o))), c = 0;
|
|
2571
|
-
}
|
|
2572
|
-
e && t.push(e), a = null;
|
|
2573
|
-
}
|
|
2574
|
-
};
|
|
2575
|
-
for (; i !== null;) {
|
|
2576
|
-
switch (i.content.constructor) {
|
|
2577
|
-
case J:
|
|
2578
|
-
case Ao:
|
|
2579
|
-
this.adds(i) ? this.deletes(i) || (u(), a = "insert", s = i.content.getContent()[0], u()) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += 1) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += 1);
|
|
2580
|
-
break;
|
|
2581
|
-
case q:
|
|
2582
|
-
this.adds(i) ? this.deletes(i) || (a !== "insert" && (u(), a = "insert"), s += i.content.str) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += i.length) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += i.length);
|
|
2583
|
-
break;
|
|
2584
|
-
case K: {
|
|
2585
|
-
let { key: t, value: s } = i.content;
|
|
2586
|
-
if (this.adds(i)) this.deletes(i) || (W(n.get(t) ?? null, s) ? s !== null && i.delete(e) : (a === "retain" && u(), W(s, r.get(t) ?? null) ? delete o[t] : o[t] = s));
|
|
2587
|
-
else if (this.deletes(i)) {
|
|
2588
|
-
r.set(t, s);
|
|
2589
|
-
let e = n.get(t) ?? null;
|
|
2590
|
-
W(e, s) || (a === "retain" && u(), o[t] = e);
|
|
2591
|
-
} else if (!i.deleted) {
|
|
2592
|
-
r.set(t, s);
|
|
2593
|
-
let n = o[t];
|
|
2594
|
-
n !== void 0 && (W(n, s) ? n !== null && i.delete(e) : (a === "retain" && u(), s === null ? delete o[t] : o[t] = s));
|
|
2595
|
-
}
|
|
2596
|
-
i.deleted || (a === "insert" && u(), Za(n, i.content));
|
|
2597
|
-
break;
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
i = i.right;
|
|
2601
|
-
}
|
|
2602
|
-
for (u(); t.length > 0;) {
|
|
2603
|
-
let e = t[t.length - 1];
|
|
2604
|
-
if (e.retain !== void 0 && e.attributes === void 0) t.pop();
|
|
2605
|
-
else break;
|
|
2606
|
-
}
|
|
2607
|
-
}), this._delta = t;
|
|
2608
|
-
}
|
|
2609
|
-
return this._delta;
|
|
2610
|
-
}
|
|
2611
|
-
}, co = class e extends U {
|
|
2612
|
-
constructor(e) {
|
|
2613
|
-
super(), this._pending = e === void 0 ? [] : [() => this.insert(0, e)], this._searchMarker = [], this._hasFormatting = !1;
|
|
2614
|
-
}
|
|
2615
|
-
get length() {
|
|
2616
|
-
return this.doc ?? H(), this._length;
|
|
2617
|
-
}
|
|
2618
|
-
_integrate(e, t) {
|
|
2619
|
-
super._integrate(e, t);
|
|
2620
|
-
try {
|
|
2621
|
-
this._pending.forEach((e) => e());
|
|
2622
|
-
} catch (e) {
|
|
2623
|
-
console.error(e);
|
|
2624
|
-
}
|
|
2625
|
-
this._pending = null;
|
|
2626
|
-
}
|
|
2627
|
-
_copy() {
|
|
2628
|
-
return new e();
|
|
2629
|
-
}
|
|
2630
|
-
clone() {
|
|
2631
|
-
let t = new e();
|
|
2632
|
-
return t.applyDelta(this.toDelta()), t;
|
|
2633
|
-
}
|
|
2634
|
-
_callObserver(e, t) {
|
|
2635
|
-
super._callObserver(e, t);
|
|
2636
|
-
let n = new so(this, e, t);
|
|
2637
|
-
xa(this, e, n), !e.local && this._hasFormatting && (e._needFormattingCleanup = !0);
|
|
2638
|
-
}
|
|
2639
|
-
toString() {
|
|
2640
|
-
this.doc ?? H();
|
|
2641
|
-
let e = "", t = this._start;
|
|
2642
|
-
for (; t !== null;) !t.deleted && t.countable && t.content.constructor === q && (e += t.content.str), t = t.right;
|
|
2643
|
-
return e;
|
|
2644
|
-
}
|
|
2645
|
-
toJSON() {
|
|
2646
|
-
return this.toString();
|
|
2647
|
-
}
|
|
2648
|
-
applyDelta(e, { sanitize: t = !0 } = {}) {
|
|
2649
|
-
this.doc === null ? this._pending.push(() => this.applyDelta(e)) : B(this.doc, (n) => {
|
|
2650
|
-
let r = new qa(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
2651
|
-
for (let i = 0; i < e.length; i++) {
|
|
2652
|
-
let a = e[i];
|
|
2653
|
-
if (a.insert !== void 0) {
|
|
2654
|
-
let o = !t && typeof a.insert == "string" && i === e.length - 1 && r.right === null && a.insert.slice(-1) === "\n" ? a.insert.slice(0, -1) : a.insert;
|
|
2655
|
-
(typeof o != "string" || o.length > 0) && eo(n, this, r, o, a.attributes || {});
|
|
2656
|
-
} else a.retain === void 0 ? a.delete !== void 0 && oo(n, r, a.delete) : to(n, this, r, a.retain, a.attributes || {});
|
|
2657
|
-
}
|
|
2658
|
-
});
|
|
2659
|
-
}
|
|
2660
|
-
toDelta(e, t, n) {
|
|
2661
|
-
this.doc ?? H();
|
|
2662
|
-
let r = [], i = /* @__PURE__ */ new Map(), a = this.doc, o = "", s = this._start;
|
|
2663
|
-
function c() {
|
|
2664
|
-
if (o.length > 0) {
|
|
2665
|
-
let e = {}, t = !1;
|
|
2666
|
-
i.forEach((n, r) => {
|
|
2667
|
-
t = !0, e[r] = n;
|
|
2668
|
-
});
|
|
2669
|
-
let n = { insert: o };
|
|
2670
|
-
t && (n.attributes = e), r.push(n), o = "";
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
let l = () => {
|
|
2674
|
-
for (; s !== null;) {
|
|
2675
|
-
if (Mi(s, e) || t !== void 0 && Mi(s, t)) switch (s.content.constructor) {
|
|
2676
|
-
case q: {
|
|
2677
|
-
let r = i.get("ychange");
|
|
2678
|
-
e !== void 0 && !Mi(s, e) ? (r === void 0 || r.user !== s.id.client || r.type !== "removed") && (c(), i.set("ychange", n ? n("removed", s.id) : { type: "removed" })) : t !== void 0 && !Mi(s, t) ? (r === void 0 || r.user !== s.id.client || r.type !== "added") && (c(), i.set("ychange", n ? n("added", s.id) : { type: "added" })) : r !== void 0 && (c(), i.delete("ychange")), o += s.content.str;
|
|
2679
|
-
break;
|
|
2680
|
-
}
|
|
2681
|
-
case J:
|
|
2682
|
-
case Ao: {
|
|
2683
|
-
c();
|
|
2684
|
-
let e = { insert: s.content.getContent()[0] };
|
|
2685
|
-
if (i.size > 0) {
|
|
2686
|
-
let t = {};
|
|
2687
|
-
e.attributes = t, i.forEach((e, n) => {
|
|
2688
|
-
t[n] = e;
|
|
2689
|
-
});
|
|
2690
|
-
}
|
|
2691
|
-
r.push(e);
|
|
2692
|
-
break;
|
|
2693
|
-
}
|
|
2694
|
-
case K: Mi(s, e) && (c(), Za(i, s.content));
|
|
2695
|
-
}
|
|
2696
|
-
s = s.right;
|
|
2697
|
-
}
|
|
2698
|
-
c();
|
|
2699
|
-
};
|
|
2700
|
-
return e || t ? B(a, (n) => {
|
|
2701
|
-
e && Ni(n, e), t && Ni(n, t), l();
|
|
2702
|
-
}, "cleanup") : l(), r;
|
|
2703
|
-
}
|
|
2704
|
-
insert(e, t, n) {
|
|
2705
|
-
if (t.length <= 0) return;
|
|
2706
|
-
let r = this.doc;
|
|
2707
|
-
r === null ? this._pending.push(() => this.insert(e, t, n)) : B(r, (r) => {
|
|
2708
|
-
let i = Ya(r, this, e, !n);
|
|
2709
|
-
n || (n = {}, i.currentAttributes.forEach((e, t) => {
|
|
2710
|
-
n[t] = e;
|
|
2711
|
-
})), eo(r, this, i, t, n);
|
|
2712
|
-
});
|
|
2713
|
-
}
|
|
2714
|
-
insertEmbed(e, t, n) {
|
|
2715
|
-
let r = this.doc;
|
|
2716
|
-
r === null ? this._pending.push(() => this.insertEmbed(e, t, n || {})) : B(r, (r) => {
|
|
2717
|
-
let i = Ya(r, this, e, !n);
|
|
2718
|
-
eo(r, this, i, t, n || {});
|
|
2719
|
-
});
|
|
2720
|
-
}
|
|
2721
|
-
delete(e, t) {
|
|
2722
|
-
if (t === 0) return;
|
|
2723
|
-
let n = this.doc;
|
|
2724
|
-
n === null ? this._pending.push(() => this.delete(e, t)) : B(n, (n) => {
|
|
2725
|
-
oo(n, Ya(n, this, e, !0), t);
|
|
2726
|
-
});
|
|
2727
|
-
}
|
|
2728
|
-
format(e, t, n) {
|
|
2729
|
-
if (t === 0) return;
|
|
2730
|
-
let r = this.doc;
|
|
2731
|
-
r === null ? this._pending.push(() => this.format(e, t, n)) : B(r, (r) => {
|
|
2732
|
-
let i = Ya(r, this, e, !1);
|
|
2733
|
-
i.right !== null && to(r, this, i, t, n);
|
|
2734
|
-
});
|
|
2735
|
-
}
|
|
2736
|
-
removeAttribute(e) {
|
|
2737
|
-
this.doc === null ? this._pending.push(() => this.removeAttribute(e)) : B(this.doc, (t) => {
|
|
2738
|
-
Pa(t, this, e);
|
|
2739
|
-
});
|
|
2740
|
-
}
|
|
2741
|
-
setAttribute(e, t) {
|
|
2742
|
-
this.doc === null ? this._pending.push(() => this.setAttribute(e, t)) : B(this.doc, (n) => {
|
|
2743
|
-
Fa(n, this, e, t);
|
|
2744
|
-
});
|
|
2745
|
-
}
|
|
2746
|
-
getAttribute(e) {
|
|
2747
|
-
return Ia(this, e);
|
|
2748
|
-
}
|
|
2749
|
-
getAttributes() {
|
|
2750
|
-
return La(this);
|
|
2751
|
-
}
|
|
2752
|
-
_write(e) {
|
|
2753
|
-
e.writeTypeRef(Ho);
|
|
2754
|
-
}
|
|
2755
|
-
}, lo = (e) => new co(), uo = class {
|
|
2756
|
-
constructor(e, t = () => !0) {
|
|
2757
|
-
this._filter = t, this._root = e, this._currentNode = e._start, this._firstCall = !0, e.doc ?? H();
|
|
2758
|
-
}
|
|
2759
|
-
[Symbol.iterator]() {
|
|
2760
|
-
return this;
|
|
2761
|
-
}
|
|
2762
|
-
next() {
|
|
2763
|
-
let e = this._currentNode, t = e && e.content && e.content.type;
|
|
2764
|
-
if (e !== null && (!this._firstCall || e.deleted || !this._filter(t))) do
|
|
2765
|
-
if (t = e.content.type, !e.deleted && (t.constructor === mo || t.constructor === fo) && t._start !== null) e = t._start;
|
|
2766
|
-
else for (; e !== null;) {
|
|
2767
|
-
let t = e.next;
|
|
2768
|
-
if (t !== null) {
|
|
2769
|
-
e = t;
|
|
2770
|
-
break;
|
|
2771
|
-
}
|
|
2772
|
-
e = e.parent === this._root ? null : e.parent._item;
|
|
2773
|
-
}
|
|
2774
|
-
while (e !== null && (e.deleted || !this._filter(e.content.type)));
|
|
2775
|
-
return this._firstCall = !1, e === null ? {
|
|
2776
|
-
value: void 0,
|
|
2777
|
-
done: !0
|
|
2778
|
-
} : (this._currentNode = e, {
|
|
2779
|
-
value: e.content.type,
|
|
2780
|
-
done: !1
|
|
2781
|
-
});
|
|
2782
|
-
}
|
|
2783
|
-
}, fo = class e extends U {
|
|
2784
|
-
constructor() {
|
|
2785
|
-
super(), this._prelimContent = [];
|
|
2786
|
-
}
|
|
2787
|
-
get firstChild() {
|
|
2788
|
-
let e = this._first;
|
|
2789
|
-
return e ? e.content.getContent()[0] : null;
|
|
2790
|
-
}
|
|
2791
|
-
_integrate(e, t) {
|
|
2792
|
-
super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
|
|
2793
|
-
}
|
|
2794
|
-
_copy() {
|
|
2795
|
-
return new e();
|
|
2796
|
-
}
|
|
2797
|
-
clone() {
|
|
2798
|
-
let t = new e();
|
|
2799
|
-
return t.insert(0, this.toArray().map((e) => e instanceof U ? e.clone() : e)), t;
|
|
2800
|
-
}
|
|
2801
|
-
get length() {
|
|
2802
|
-
return this.doc ?? H(), this._prelimContent === null ? this._length : this._prelimContent.length;
|
|
2803
|
-
}
|
|
2804
|
-
createTreeWalker(e) {
|
|
2805
|
-
return new uo(this, e);
|
|
2806
|
-
}
|
|
2807
|
-
querySelector(e) {
|
|
2808
|
-
e = e.toUpperCase();
|
|
2809
|
-
let t = new uo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e).next();
|
|
2810
|
-
return t.done ? null : t.value;
|
|
2811
|
-
}
|
|
2812
|
-
querySelectorAll(e) {
|
|
2813
|
-
return e = e.toUpperCase(), c(new uo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e));
|
|
2814
|
-
}
|
|
2815
|
-
_callObserver(e, t) {
|
|
2816
|
-
xa(this, e, new go(this, t, e));
|
|
2817
|
-
}
|
|
2818
|
-
toString() {
|
|
2819
|
-
return Ea(this, (e) => e.toString()).join("");
|
|
2820
|
-
}
|
|
2821
|
-
toJSON() {
|
|
2822
|
-
return this.toString();
|
|
2823
|
-
}
|
|
2824
|
-
toDOM(e = document, t = {}, n) {
|
|
2825
|
-
let r = e.createDocumentFragment();
|
|
2826
|
-
return n !== void 0 && n._createAssociation(r, this), Ta(this, (i) => {
|
|
2827
|
-
r.insertBefore(i.toDOM(e, t, n), null);
|
|
2828
|
-
}), r;
|
|
2829
|
-
}
|
|
2830
|
-
insert(e, t) {
|
|
2831
|
-
this.doc === null ? this._prelimContent.splice(e, 0, ...t) : B(this.doc, (n) => {
|
|
2832
|
-
ja(n, this, e, t);
|
|
2833
|
-
});
|
|
2834
|
-
}
|
|
2835
|
-
insertAfter(e, t) {
|
|
2836
|
-
if (this.doc !== null) B(this.doc, (n) => {
|
|
2837
|
-
let r = e && e instanceof U ? e._item : e;
|
|
2838
|
-
ka(n, this, r, t);
|
|
2839
|
-
});
|
|
2840
|
-
else {
|
|
2841
|
-
let n = this._prelimContent, r = e === null ? 0 : n.findIndex((t) => t === e) + 1;
|
|
2842
|
-
if (r === 0 && e !== null) throw x("Reference item not found");
|
|
2843
|
-
n.splice(r, 0, ...t);
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
delete(e, t = 1) {
|
|
2847
|
-
this.doc === null ? this._prelimContent.splice(e, t) : B(this.doc, (n) => {
|
|
2848
|
-
Na(n, this, e, t);
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
toArray() {
|
|
2852
|
-
return Ca(this);
|
|
2853
|
-
}
|
|
2854
|
-
push(e) {
|
|
2855
|
-
this.insert(this.length, e);
|
|
2856
|
-
}
|
|
2857
|
-
unshift(e) {
|
|
2858
|
-
this.insert(0, e);
|
|
2859
|
-
}
|
|
2860
|
-
get(e) {
|
|
2861
|
-
return Oa(this, e);
|
|
2862
|
-
}
|
|
2863
|
-
slice(e = 0, t = this.length) {
|
|
2864
|
-
return Sa(this, e, t);
|
|
2865
|
-
}
|
|
2866
|
-
forEach(e) {
|
|
2867
|
-
Ta(this, e);
|
|
2868
|
-
}
|
|
2869
|
-
_write(e) {
|
|
2870
|
-
e.writeTypeRef(Wo);
|
|
2871
|
-
}
|
|
2872
|
-
}, po = (e) => new fo(), mo = class e extends fo {
|
|
2873
|
-
constructor(e = "UNDEFINED") {
|
|
2874
|
-
super(), this.nodeName = e, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
2875
|
-
}
|
|
2876
|
-
get nextSibling() {
|
|
2877
|
-
let e = this._item ? this._item.next : null;
|
|
2878
|
-
return e ? e.content.type : null;
|
|
2879
|
-
}
|
|
2880
|
-
get prevSibling() {
|
|
2881
|
-
let e = this._item ? this._item.prev : null;
|
|
2882
|
-
return e ? e.content.type : null;
|
|
2883
|
-
}
|
|
2884
|
-
_integrate(e, t) {
|
|
2885
|
-
super._integrate(e, t), this._prelimAttrs.forEach((e, t) => {
|
|
2886
|
-
this.setAttribute(t, e);
|
|
2887
|
-
}), this._prelimAttrs = null;
|
|
2888
|
-
}
|
|
2889
|
-
_copy() {
|
|
2890
|
-
return new e(this.nodeName);
|
|
2891
|
-
}
|
|
2892
|
-
clone() {
|
|
2893
|
-
let t = new e(this.nodeName);
|
|
2894
|
-
return vt(this.getAttributes(), (e, n) => {
|
|
2895
|
-
t.setAttribute(n, e);
|
|
2896
|
-
}), t.insert(0, this.toArray().map((e) => e instanceof U ? e.clone() : e)), t;
|
|
2897
|
-
}
|
|
2898
|
-
toString() {
|
|
2899
|
-
let e = this.getAttributes(), t = [], n = [];
|
|
2900
|
-
for (let t in e) n.push(t);
|
|
2901
|
-
n.sort();
|
|
2902
|
-
let r = n.length;
|
|
2903
|
-
for (let i = 0; i < r; i++) {
|
|
2904
|
-
let r = n[i];
|
|
2905
|
-
t.push(r + "=\"" + e[r] + "\"");
|
|
2906
|
-
}
|
|
2907
|
-
let i = this.nodeName.toLocaleLowerCase();
|
|
2908
|
-
return `<${i}${t.length > 0 ? " " + t.join(" ") : ""}>${super.toString()}</${i}>`;
|
|
2909
|
-
}
|
|
2910
|
-
removeAttribute(e) {
|
|
2911
|
-
this.doc === null ? this._prelimAttrs.delete(e) : B(this.doc, (t) => {
|
|
2912
|
-
Pa(t, this, e);
|
|
2913
|
-
});
|
|
2914
|
-
}
|
|
2915
|
-
setAttribute(e, t) {
|
|
2916
|
-
this.doc === null ? this._prelimAttrs.set(e, t) : B(this.doc, (n) => {
|
|
2917
|
-
Fa(n, this, e, t);
|
|
2918
|
-
});
|
|
2919
|
-
}
|
|
2920
|
-
getAttribute(e) {
|
|
2921
|
-
return Ia(this, e);
|
|
2922
|
-
}
|
|
2923
|
-
hasAttribute(e) {
|
|
2924
|
-
return Ra(this, e);
|
|
2925
|
-
}
|
|
2926
|
-
getAttributes(e) {
|
|
2927
|
-
return e ? za(this, e) : La(this);
|
|
2928
|
-
}
|
|
2929
|
-
toDOM(e = document, t = {}, n) {
|
|
2930
|
-
let r = e.createElement(this.nodeName), i = this.getAttributes();
|
|
2931
|
-
for (let e in i) {
|
|
2932
|
-
let t = i[e];
|
|
2933
|
-
typeof t == "string" && r.setAttribute(e, t);
|
|
2934
|
-
}
|
|
2935
|
-
return Ta(this, (i) => {
|
|
2936
|
-
r.appendChild(i.toDOM(e, t, n));
|
|
2937
|
-
}), n !== void 0 && n._createAssociation(r, this), r;
|
|
2938
|
-
}
|
|
2939
|
-
_write(e) {
|
|
2940
|
-
e.writeTypeRef(Uo), e.writeKey(this.nodeName);
|
|
2941
|
-
}
|
|
2942
|
-
}, ho = (e) => new mo(e.readKey()), go = class extends da {
|
|
2943
|
-
constructor(e, t, n) {
|
|
2944
|
-
super(e, n), this.childListChanged = !1, this.attributesChanged = /* @__PURE__ */ new Set(), t.forEach((e) => {
|
|
2945
|
-
e === null ? this.childListChanged = !0 : this.attributesChanged.add(e);
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2948
|
-
}, _o = class e extends Ga {
|
|
2949
|
-
constructor(e) {
|
|
2950
|
-
super(), this.hookName = e;
|
|
2951
|
-
}
|
|
2952
|
-
_copy() {
|
|
2953
|
-
return new e(this.hookName);
|
|
2954
|
-
}
|
|
2955
|
-
clone() {
|
|
2956
|
-
let t = new e(this.hookName);
|
|
2957
|
-
return this.forEach((e, n) => {
|
|
2958
|
-
t.set(n, e);
|
|
2959
|
-
}), t;
|
|
2960
|
-
}
|
|
2961
|
-
toDOM(e = document, t = {}, n) {
|
|
2962
|
-
let r = t[this.hookName], i;
|
|
2963
|
-
return i = r === void 0 ? document.createElement(this.hookName) : r.createDom(this), i.setAttribute("data-yjs-hook", this.hookName), n !== void 0 && n._createAssociation(i, this), i;
|
|
2964
|
-
}
|
|
2965
|
-
_write(e) {
|
|
2966
|
-
e.writeTypeRef(Go), e.writeKey(this.hookName);
|
|
2967
|
-
}
|
|
2968
|
-
}, vo = (e) => new _o(e.readKey()), yo = class e extends co {
|
|
2969
|
-
get nextSibling() {
|
|
2970
|
-
let e = this._item ? this._item.next : null;
|
|
2971
|
-
return e ? e.content.type : null;
|
|
2972
|
-
}
|
|
2973
|
-
get prevSibling() {
|
|
2974
|
-
let e = this._item ? this._item.prev : null;
|
|
2975
|
-
return e ? e.content.type : null;
|
|
2976
|
-
}
|
|
2977
|
-
_copy() {
|
|
2978
|
-
return new e();
|
|
2979
|
-
}
|
|
2980
|
-
clone() {
|
|
2981
|
-
let t = new e();
|
|
2982
|
-
return t.applyDelta(this.toDelta()), t;
|
|
2983
|
-
}
|
|
2984
|
-
toDOM(e = document, t, n) {
|
|
2985
|
-
let r = e.createTextNode(this.toString());
|
|
2986
|
-
return n !== void 0 && n._createAssociation(r, this), r;
|
|
2987
|
-
}
|
|
2988
|
-
toString() {
|
|
2989
|
-
return this.toDelta().map((e) => {
|
|
2990
|
-
let t = [];
|
|
2991
|
-
for (let n in e.attributes) {
|
|
2992
|
-
let r = [];
|
|
2993
|
-
for (let t in e.attributes[n]) r.push({
|
|
2994
|
-
key: t,
|
|
2995
|
-
value: e.attributes[n][t]
|
|
2996
|
-
});
|
|
2997
|
-
r.sort((e, t) => e.key < t.key ? -1 : 1), t.push({
|
|
2998
|
-
nodeName: n,
|
|
2999
|
-
attrs: r
|
|
3000
|
-
});
|
|
3001
|
-
}
|
|
3002
|
-
t.sort((e, t) => e.nodeName < t.nodeName ? -1 : 1);
|
|
3003
|
-
let n = "";
|
|
3004
|
-
for (let e = 0; e < t.length; e++) {
|
|
3005
|
-
let r = t[e];
|
|
3006
|
-
n += `<${r.nodeName}`;
|
|
3007
|
-
for (let e = 0; e < r.attrs.length; e++) {
|
|
3008
|
-
let t = r.attrs[e];
|
|
3009
|
-
n += ` ${t.key}="${t.value}"`;
|
|
3010
|
-
}
|
|
3011
|
-
n += ">";
|
|
3012
|
-
}
|
|
3013
|
-
n += e.insert;
|
|
3014
|
-
for (let e = t.length - 1; e >= 0; e--) n += `</${t[e].nodeName}>`;
|
|
3015
|
-
return n;
|
|
3016
|
-
}).join("");
|
|
3017
|
-
}
|
|
3018
|
-
toJSON() {
|
|
3019
|
-
return this.toString();
|
|
3020
|
-
}
|
|
3021
|
-
_write(e) {
|
|
3022
|
-
e.writeTypeRef(Ko);
|
|
3023
|
-
}
|
|
3024
|
-
}, bo = (e) => new yo(), xo = class {
|
|
3025
|
-
constructor(e, t) {
|
|
3026
|
-
this.id = e, this.length = t;
|
|
3027
|
-
}
|
|
3028
|
-
get deleted() {
|
|
3029
|
-
throw S();
|
|
3030
|
-
}
|
|
3031
|
-
mergeWith(e) {
|
|
3032
|
-
return !1;
|
|
3033
|
-
}
|
|
3034
|
-
write(e, t, n) {
|
|
3035
|
-
throw S();
|
|
3036
|
-
}
|
|
3037
|
-
integrate(e, t) {
|
|
3038
|
-
throw S();
|
|
3039
|
-
}
|
|
3040
|
-
}, So = 0, G = class extends xo {
|
|
3041
|
-
get deleted() {
|
|
3042
|
-
return !0;
|
|
3043
|
-
}
|
|
3044
|
-
delete() {}
|
|
3045
|
-
mergeWith(e) {
|
|
3046
|
-
return this.constructor === e.constructor && (this.length += e.length, !0);
|
|
3047
|
-
}
|
|
3048
|
-
integrate(e, t) {
|
|
3049
|
-
t > 0 && (this.id.clock += t, this.length -= t), Ii(e.doc.store, this);
|
|
3050
|
-
}
|
|
3051
|
-
write(e, t) {
|
|
3052
|
-
e.writeInfo(So), e.writeLen(this.length - t);
|
|
3053
|
-
}
|
|
3054
|
-
getMissing(e, t) {
|
|
3055
|
-
return null;
|
|
3056
|
-
}
|
|
3057
|
-
}, Co = class e {
|
|
3058
|
-
constructor(e) {
|
|
3059
|
-
this.content = e;
|
|
3060
|
-
}
|
|
3061
|
-
getLength() {
|
|
3062
|
-
return 1;
|
|
3063
|
-
}
|
|
3064
|
-
getContent() {
|
|
3065
|
-
return [this.content];
|
|
3066
|
-
}
|
|
3067
|
-
isCountable() {
|
|
3068
|
-
return !0;
|
|
3069
|
-
}
|
|
3070
|
-
copy() {
|
|
3071
|
-
return new e(this.content);
|
|
3072
|
-
}
|
|
3073
|
-
splice(e) {
|
|
3074
|
-
throw S();
|
|
3075
|
-
}
|
|
3076
|
-
mergeWith(e) {
|
|
3077
|
-
return !1;
|
|
3078
|
-
}
|
|
3079
|
-
integrate(e, t) {}
|
|
3080
|
-
delete(e) {}
|
|
3081
|
-
gc(e) {}
|
|
3082
|
-
write(e, t) {
|
|
3083
|
-
e.writeBuf(this.content);
|
|
3084
|
-
}
|
|
3085
|
-
getRef() {
|
|
3086
|
-
return 3;
|
|
3087
|
-
}
|
|
3088
|
-
}, wo = (e) => new Co(e.readBuf()), To = class e {
|
|
3089
|
-
constructor(e) {
|
|
3090
|
-
this.len = e;
|
|
3091
|
-
}
|
|
3092
|
-
getLength() {
|
|
3093
|
-
return this.len;
|
|
3094
|
-
}
|
|
3095
|
-
getContent() {
|
|
3096
|
-
return [];
|
|
3097
|
-
}
|
|
3098
|
-
isCountable() {
|
|
3099
|
-
return !1;
|
|
3100
|
-
}
|
|
3101
|
-
copy() {
|
|
3102
|
-
return new e(this.len);
|
|
3103
|
-
}
|
|
3104
|
-
splice(t) {
|
|
3105
|
-
let n = new e(this.len - t);
|
|
3106
|
-
return this.len = t, n;
|
|
3107
|
-
}
|
|
3108
|
-
mergeWith(e) {
|
|
3109
|
-
return this.len += e.len, !0;
|
|
3110
|
-
}
|
|
3111
|
-
integrate(e, t) {
|
|
3112
|
-
Mr(e.deleteSet, t.id.client, t.id.clock, this.len), t.markDeleted();
|
|
3113
|
-
}
|
|
3114
|
-
delete(e) {}
|
|
3115
|
-
gc(e) {}
|
|
3116
|
-
write(e, t) {
|
|
3117
|
-
e.writeLen(this.len - t);
|
|
3118
|
-
}
|
|
3119
|
-
getRef() {
|
|
3120
|
-
return 1;
|
|
3121
|
-
}
|
|
3122
|
-
}, Eo = (e) => new To(e.readLen()), Do = (e, t) => new zr({
|
|
3123
|
-
guid: e,
|
|
3124
|
-
...t,
|
|
3125
|
-
shouldLoad: t.shouldLoad || t.autoLoad || !1
|
|
3126
|
-
}), Oo = class e {
|
|
3127
|
-
constructor(e) {
|
|
3128
|
-
e._item && console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."), this.doc = e;
|
|
3129
|
-
let t = {};
|
|
3130
|
-
this.opts = t, e.gc || (t.gc = !1), e.autoLoad && (t.autoLoad = !0), e.meta !== null && (t.meta = e.meta);
|
|
3131
|
-
}
|
|
3132
|
-
getLength() {
|
|
3133
|
-
return 1;
|
|
3134
|
-
}
|
|
3135
|
-
getContent() {
|
|
3136
|
-
return [this.doc];
|
|
3137
|
-
}
|
|
3138
|
-
isCountable() {
|
|
3139
|
-
return !0;
|
|
3140
|
-
}
|
|
3141
|
-
copy() {
|
|
3142
|
-
return new e(Do(this.doc.guid, this.opts));
|
|
3143
|
-
}
|
|
3144
|
-
splice(e) {
|
|
3145
|
-
throw S();
|
|
3146
|
-
}
|
|
3147
|
-
mergeWith(e) {
|
|
3148
|
-
return !1;
|
|
3149
|
-
}
|
|
3150
|
-
integrate(e, t) {
|
|
3151
|
-
this.doc._item = t, e.subdocsAdded.add(this.doc), this.doc.shouldLoad && e.subdocsLoaded.add(this.doc);
|
|
3152
|
-
}
|
|
3153
|
-
delete(e) {
|
|
3154
|
-
e.subdocsAdded.has(this.doc) ? e.subdocsAdded.delete(this.doc) : e.subdocsRemoved.add(this.doc);
|
|
3155
|
-
}
|
|
3156
|
-
gc(e) {}
|
|
3157
|
-
write(e, t) {
|
|
3158
|
-
e.writeString(this.doc.guid), e.writeAny(this.opts);
|
|
3159
|
-
}
|
|
3160
|
-
getRef() {
|
|
3161
|
-
return 9;
|
|
3162
|
-
}
|
|
3163
|
-
}, ko = (e) => new Oo(Do(e.readString(), e.readAny())), Ao = class e {
|
|
3164
|
-
constructor(e) {
|
|
3165
|
-
this.embed = e;
|
|
3166
|
-
}
|
|
3167
|
-
getLength() {
|
|
3168
|
-
return 1;
|
|
3169
|
-
}
|
|
3170
|
-
getContent() {
|
|
3171
|
-
return [this.embed];
|
|
3172
|
-
}
|
|
3173
|
-
isCountable() {
|
|
3174
|
-
return !0;
|
|
3175
|
-
}
|
|
3176
|
-
copy() {
|
|
3177
|
-
return new e(this.embed);
|
|
3178
|
-
}
|
|
3179
|
-
splice(e) {
|
|
3180
|
-
throw S();
|
|
3181
|
-
}
|
|
3182
|
-
mergeWith(e) {
|
|
3183
|
-
return !1;
|
|
3184
|
-
}
|
|
3185
|
-
integrate(e, t) {}
|
|
3186
|
-
delete(e) {}
|
|
3187
|
-
gc(e) {}
|
|
3188
|
-
write(e, t) {
|
|
3189
|
-
e.writeJSON(this.embed);
|
|
3190
|
-
}
|
|
3191
|
-
getRef() {
|
|
3192
|
-
return 5;
|
|
3193
|
-
}
|
|
3194
|
-
}, jo = (e) => new Ao(e.readJSON()), K = class e {
|
|
3195
|
-
constructor(e, t) {
|
|
3196
|
-
this.key = e, this.value = t;
|
|
3197
|
-
}
|
|
3198
|
-
getLength() {
|
|
3199
|
-
return 1;
|
|
3200
|
-
}
|
|
3201
|
-
getContent() {
|
|
3202
|
-
return [];
|
|
3203
|
-
}
|
|
3204
|
-
isCountable() {
|
|
3205
|
-
return !1;
|
|
3206
|
-
}
|
|
3207
|
-
copy() {
|
|
3208
|
-
return new e(this.key, this.value);
|
|
3209
|
-
}
|
|
3210
|
-
splice(e) {
|
|
3211
|
-
throw S();
|
|
3212
|
-
}
|
|
3213
|
-
mergeWith(e) {
|
|
3214
|
-
return !1;
|
|
3215
|
-
}
|
|
3216
|
-
integrate(e, t) {
|
|
3217
|
-
let n = t.parent;
|
|
3218
|
-
n._searchMarker = null, n._hasFormatting = !0;
|
|
3219
|
-
}
|
|
3220
|
-
delete(e) {}
|
|
3221
|
-
gc(e) {}
|
|
3222
|
-
write(e, t) {
|
|
3223
|
-
e.writeKey(this.key), e.writeJSON(this.value);
|
|
3224
|
-
}
|
|
3225
|
-
getRef() {
|
|
3226
|
-
return 6;
|
|
3227
|
-
}
|
|
3228
|
-
}, Mo = (e) => new K(e.readKey(), e.readJSON()), No = class e {
|
|
3229
|
-
constructor(e) {
|
|
3230
|
-
this.arr = e;
|
|
3231
|
-
}
|
|
3232
|
-
getLength() {
|
|
3233
|
-
return this.arr.length;
|
|
3234
|
-
}
|
|
3235
|
-
getContent() {
|
|
3236
|
-
return this.arr;
|
|
3237
|
-
}
|
|
3238
|
-
isCountable() {
|
|
3239
|
-
return !0;
|
|
3240
|
-
}
|
|
3241
|
-
copy() {
|
|
3242
|
-
return new e(this.arr);
|
|
3243
|
-
}
|
|
3244
|
-
splice(t) {
|
|
3245
|
-
let n = new e(this.arr.slice(t));
|
|
3246
|
-
return this.arr = this.arr.slice(0, t), n;
|
|
3247
|
-
}
|
|
3248
|
-
mergeWith(e) {
|
|
3249
|
-
return this.arr = this.arr.concat(e.arr), !0;
|
|
3250
|
-
}
|
|
3251
|
-
integrate(e, t) {}
|
|
3252
|
-
delete(e) {}
|
|
3253
|
-
gc(e) {}
|
|
3254
|
-
write(e, t) {
|
|
3255
|
-
let n = this.arr.length;
|
|
3256
|
-
e.writeLen(n - t);
|
|
3257
|
-
for (let r = t; r < n; r++) {
|
|
3258
|
-
let t = this.arr[r];
|
|
3259
|
-
e.writeString(t === void 0 ? "undefined" : JSON.stringify(t));
|
|
3260
|
-
}
|
|
3261
|
-
}
|
|
3262
|
-
getRef() {
|
|
3263
|
-
return 2;
|
|
3264
|
-
}
|
|
3265
|
-
}, Po = (e) => {
|
|
3266
|
-
let t = e.readLen(), n = [];
|
|
3267
|
-
for (let r = 0; r < t; r++) {
|
|
3268
|
-
let t = e.readString();
|
|
3269
|
-
t === "undefined" ? n.push(void 0) : n.push(JSON.parse(t));
|
|
3270
|
-
}
|
|
3271
|
-
return new No(n);
|
|
3272
|
-
}, Fo = Ft("node_env") === "development", Io = class e {
|
|
3273
|
-
constructor(e) {
|
|
3274
|
-
this.arr = e, Fo && Tt(e);
|
|
3275
|
-
}
|
|
3276
|
-
getLength() {
|
|
3277
|
-
return this.arr.length;
|
|
3278
|
-
}
|
|
3279
|
-
getContent() {
|
|
3280
|
-
return this.arr;
|
|
3281
|
-
}
|
|
3282
|
-
isCountable() {
|
|
3283
|
-
return !0;
|
|
3284
|
-
}
|
|
3285
|
-
copy() {
|
|
3286
|
-
return new e(this.arr);
|
|
3287
|
-
}
|
|
3288
|
-
splice(t) {
|
|
3289
|
-
let n = new e(this.arr.slice(t));
|
|
3290
|
-
return this.arr = this.arr.slice(0, t), n;
|
|
3291
|
-
}
|
|
3292
|
-
mergeWith(e) {
|
|
3293
|
-
return this.arr = this.arr.concat(e.arr), !0;
|
|
3294
|
-
}
|
|
3295
|
-
integrate(e, t) {}
|
|
3296
|
-
delete(e) {}
|
|
3297
|
-
gc(e) {}
|
|
3298
|
-
write(e, t) {
|
|
3299
|
-
let n = this.arr.length;
|
|
3300
|
-
e.writeLen(n - t);
|
|
3301
|
-
for (let r = t; r < n; r++) {
|
|
3302
|
-
let t = this.arr[r];
|
|
3303
|
-
e.writeAny(t);
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
getRef() {
|
|
3307
|
-
return 8;
|
|
3308
|
-
}
|
|
3309
|
-
}, Lo = (e) => {
|
|
3310
|
-
let t = e.readLen(), n = [];
|
|
3311
|
-
for (let r = 0; r < t; r++) n.push(e.readAny());
|
|
3312
|
-
return new Io(n);
|
|
3313
|
-
}, q = class e {
|
|
3314
|
-
constructor(e) {
|
|
3315
|
-
this.str = e;
|
|
3316
|
-
}
|
|
3317
|
-
getLength() {
|
|
3318
|
-
return this.str.length;
|
|
3319
|
-
}
|
|
3320
|
-
getContent() {
|
|
3321
|
-
return this.str.split("");
|
|
3322
|
-
}
|
|
3323
|
-
isCountable() {
|
|
3324
|
-
return !0;
|
|
3325
|
-
}
|
|
3326
|
-
copy() {
|
|
3327
|
-
return new e(this.str);
|
|
3328
|
-
}
|
|
3329
|
-
splice(t) {
|
|
3330
|
-
let n = new e(this.str.slice(t));
|
|
3331
|
-
this.str = this.str.slice(0, t);
|
|
3332
|
-
let r = this.str.charCodeAt(t - 1);
|
|
3333
|
-
return r >= 55296 && r <= 56319 && (this.str = this.str.slice(0, t - 1) + "�", n.str = "�" + n.str.slice(1)), n;
|
|
3334
|
-
}
|
|
3335
|
-
mergeWith(e) {
|
|
3336
|
-
return this.str += e.str, !0;
|
|
3337
|
-
}
|
|
3338
|
-
integrate(e, t) {}
|
|
3339
|
-
delete(e) {}
|
|
3340
|
-
gc(e) {}
|
|
3341
|
-
write(e, t) {
|
|
3342
|
-
e.writeString(t === 0 ? this.str : this.str.slice(t));
|
|
3343
|
-
}
|
|
3344
|
-
getRef() {
|
|
3345
|
-
return 4;
|
|
3346
|
-
}
|
|
3347
|
-
}, Ro = (e) => new q(e.readString()), zo = [
|
|
3348
|
-
Ua,
|
|
3349
|
-
Ka,
|
|
3350
|
-
lo,
|
|
3351
|
-
ho,
|
|
3352
|
-
po,
|
|
3353
|
-
vo,
|
|
3354
|
-
bo
|
|
3355
|
-
], Bo = 0, Vo = 1, Ho = 2, Uo = 3, Wo = 4, Go = 5, Ko = 6, J = class e {
|
|
3356
|
-
constructor(e) {
|
|
3357
|
-
this.type = e;
|
|
3358
|
-
}
|
|
3359
|
-
getLength() {
|
|
3360
|
-
return 1;
|
|
3361
|
-
}
|
|
3362
|
-
getContent() {
|
|
3363
|
-
return [this.type];
|
|
3364
|
-
}
|
|
3365
|
-
isCountable() {
|
|
3366
|
-
return !0;
|
|
3367
|
-
}
|
|
3368
|
-
copy() {
|
|
3369
|
-
return new e(this.type._copy());
|
|
3370
|
-
}
|
|
3371
|
-
splice(e) {
|
|
3372
|
-
throw S();
|
|
3373
|
-
}
|
|
3374
|
-
mergeWith(e) {
|
|
3375
|
-
return !1;
|
|
3376
|
-
}
|
|
3377
|
-
integrate(e, t) {
|
|
3378
|
-
this.type._integrate(e.doc, t);
|
|
3379
|
-
}
|
|
3380
|
-
delete(e) {
|
|
3381
|
-
let t = this.type._start;
|
|
3382
|
-
for (; t !== null;) t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e), t = t.right;
|
|
3383
|
-
this.type._map.forEach((t) => {
|
|
3384
|
-
t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e);
|
|
3385
|
-
}), e.changed.delete(this.type);
|
|
3386
|
-
}
|
|
3387
|
-
gc(e) {
|
|
3388
|
-
let t = this.type._start;
|
|
3389
|
-
for (; t !== null;) t.gc(e, !0), t = t.right;
|
|
3390
|
-
this.type._start = null, this.type._map.forEach((t) => {
|
|
3391
|
-
for (; t !== null;) t.gc(e, !0), t = t.left;
|
|
3392
|
-
}), this.type._map = /* @__PURE__ */ new Map();
|
|
3393
|
-
}
|
|
3394
|
-
write(e, t) {
|
|
3395
|
-
this.type._write(e);
|
|
3396
|
-
}
|
|
3397
|
-
getRef() {
|
|
3398
|
-
return 7;
|
|
3399
|
-
}
|
|
3400
|
-
}, qo = (e) => new J(zo[e.readTypeRef()](e)), Jo = (e, t) => {
|
|
3401
|
-
let n = t, r = 0, i;
|
|
3402
|
-
do
|
|
3403
|
-
r > 0 && (n = I(n.client, n.clock + r)), i = Li(e, n), r = n.clock - i.id.clock, n = i.redone;
|
|
3404
|
-
while (n !== null && i instanceof Y);
|
|
3405
|
-
return {
|
|
3406
|
-
item: i,
|
|
3407
|
-
diff: r
|
|
3408
|
-
};
|
|
3409
|
-
}, Yo = (e, t) => {
|
|
3410
|
-
for (; e !== null && e.keep !== t;) e.keep = t, e = e.parent._item;
|
|
3411
|
-
}, Xo = (e, t, n) => {
|
|
3412
|
-
let { client: r, clock: i } = t.id, a = new Y(I(r, i + n), t, I(r, i + n - 1), t.right, t.rightOrigin, t.parent, t.parentSub, t.content.splice(n));
|
|
3413
|
-
return t.deleted && a.markDeleted(), t.keep && (a.keep = !0), t.redone !== null && (a.redone = I(t.redone.client, t.redone.clock + n)), t.right = a, a.right !== null && (a.right.left = a), e._mergeStructs.push(a), a.parentSub !== null && a.right === null && a.parent._map.set(a.parentSub, a), t.length = n, a;
|
|
3414
|
-
}, Zo = (e, t) => u(e, (e) => kr(e.deletions, t)), Qo = (e, t, n, r, i, a) => {
|
|
3415
|
-
let o = e.doc, s = o.store, c = o.clientID, l = t.redone;
|
|
3416
|
-
if (l !== null) return z(e, l);
|
|
3417
|
-
let u = t.parent._item, d = null, f;
|
|
3418
|
-
if (u !== null && u.deleted === !0) {
|
|
3419
|
-
if (u.redone === null && (!n.has(u) || Qo(e, u, n, r, i, a) === null)) return null;
|
|
3420
|
-
for (; u.redone !== null;) u = z(e, u.redone);
|
|
3421
|
-
}
|
|
3422
|
-
let ee = u === null ? t.parent : u.content.type;
|
|
3423
|
-
if (t.parentSub === null) {
|
|
3424
|
-
for (d = t.left, f = t; d !== null;) {
|
|
3425
|
-
let t = d;
|
|
3426
|
-
for (; t !== null && t.parent._item !== u;) t = t.redone === null ? null : z(e, t.redone);
|
|
3427
|
-
if (t !== null && t.parent._item === u) {
|
|
3428
|
-
d = t;
|
|
3429
|
-
break;
|
|
3430
|
-
}
|
|
3431
|
-
d = d.left;
|
|
3432
|
-
}
|
|
3433
|
-
for (; f !== null;) {
|
|
3434
|
-
let t = f;
|
|
3435
|
-
for (; t !== null && t.parent._item !== u;) t = t.redone === null ? null : z(e, t.redone);
|
|
3436
|
-
if (t !== null && t.parent._item === u) {
|
|
3437
|
-
f = t;
|
|
3438
|
-
break;
|
|
3439
|
-
}
|
|
3440
|
-
f = f.right;
|
|
3441
|
-
}
|
|
3442
|
-
} else {
|
|
3443
|
-
if (f = null, t.right && !i) {
|
|
3444
|
-
for (d = t; d !== null && d.right !== null && (d.right.redone || kr(r, d.right.id) || Zo(a.undoStack, d.right.id) || Zo(a.redoStack, d.right.id));) for (d = d.right; d.redone;) d = z(e, d.redone);
|
|
3445
|
-
if (d && d.right !== null) return null;
|
|
3446
|
-
} else d = ee._map.get(t.parentSub) || null;
|
|
3447
|
-
d !== null && d.parent._item !== u && (d = ee._map.get(t.parentSub) || null);
|
|
3448
|
-
}
|
|
3449
|
-
let te = I(c, L(s, c)), p = new Y(te, d, d && d.lastId, f, f && f.id, ee, t.parentSub, t.content.copy());
|
|
3450
|
-
return t.redone = te, Yo(p, !0), p.integrate(e, 0), p;
|
|
3451
|
-
}, Y = class e extends xo {
|
|
3452
|
-
constructor(e, t, n, r, i, a, o, s) {
|
|
3453
|
-
super(e, s.getLength()), this.origin = n, this.left = t, this.right = r, this.rightOrigin = i, this.parent = a, this.parentSub = o, this.redone = null, this.content = s, this.info = this.content.isCountable() ? 2 : 0;
|
|
3454
|
-
}
|
|
3455
|
-
set marker(e) {
|
|
3456
|
-
(this.info & 8) > 0 !== e && (this.info ^= 8);
|
|
3457
|
-
}
|
|
3458
|
-
get marker() {
|
|
3459
|
-
return (this.info & 8) > 0;
|
|
3460
|
-
}
|
|
3461
|
-
get keep() {
|
|
3462
|
-
return (this.info & 1) > 0;
|
|
3463
|
-
}
|
|
3464
|
-
set keep(e) {
|
|
3465
|
-
this.keep !== e && (this.info ^= 1);
|
|
3466
|
-
}
|
|
3467
|
-
get countable() {
|
|
3468
|
-
return (this.info & 2) > 0;
|
|
3469
|
-
}
|
|
3470
|
-
get deleted() {
|
|
3471
|
-
return (this.info & 4) > 0;
|
|
3472
|
-
}
|
|
3473
|
-
set deleted(e) {
|
|
3474
|
-
this.deleted !== e && (this.info ^= 4);
|
|
3475
|
-
}
|
|
3476
|
-
markDeleted() {
|
|
3477
|
-
this.info |= 4;
|
|
3478
|
-
}
|
|
3479
|
-
getMissing(t, n) {
|
|
3480
|
-
if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= L(n, this.origin.client)) return this.origin.client;
|
|
3481
|
-
if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= L(n, this.rightOrigin.client)) return this.rightOrigin.client;
|
|
3482
|
-
if (this.parent && this.parent.constructor === gi && this.id.client !== this.parent.client && this.parent.clock >= L(n, this.parent.client)) return this.parent.client;
|
|
3483
|
-
if (this.origin &&= (this.left = zi(t, n, this.origin), this.left.lastId), this.rightOrigin &&= (this.right = z(t, this.rightOrigin), this.right.id), this.left && this.left.constructor === G || this.right && this.right.constructor === G) this.parent = null;
|
|
3484
|
-
else if (!this.parent) this.left && this.left.constructor === e ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === e && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
3485
|
-
else if (this.parent.constructor === gi) {
|
|
3486
|
-
let e = Li(n, this.parent);
|
|
3487
|
-
this.parent = e.constructor === G ? null : e.content.type;
|
|
3488
|
-
}
|
|
3489
|
-
return null;
|
|
3490
|
-
}
|
|
3491
|
-
integrate(e, t) {
|
|
3492
|
-
if (t > 0 && (this.id.clock += t, this.left = zi(e, e.doc.store, I(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(t), this.length -= t), this.parent) {
|
|
3493
|
-
if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
|
|
3494
|
-
let t = this.left, n;
|
|
3495
|
-
if (t !== null) n = t.right;
|
|
3496
|
-
else if (this.parentSub !== null) for (n = this.parent._map.get(this.parentSub) || null; n !== null && n.left !== null;) n = n.left;
|
|
3497
|
-
else n = this.parent._start;
|
|
3498
|
-
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
3499
|
-
for (; n !== null && n !== this.right;) {
|
|
3500
|
-
if (i.add(n), r.add(n), _i(this.origin, n.origin)) {
|
|
3501
|
-
if (n.id.client < this.id.client) t = n, r.clear();
|
|
3502
|
-
else if (_i(this.rightOrigin, n.rightOrigin)) break;
|
|
3503
|
-
} else if (n.origin !== null && i.has(Li(e.doc.store, n.origin))) r.has(Li(e.doc.store, n.origin)) || (t = n, r.clear());
|
|
3504
|
-
else break;
|
|
3505
|
-
n = n.right;
|
|
3506
|
-
}
|
|
3507
|
-
this.left = t;
|
|
3508
|
-
}
|
|
3509
|
-
if (this.left !== null) {
|
|
3510
|
-
let e = this.left.right;
|
|
3511
|
-
this.right = e, this.left.right = this;
|
|
3512
|
-
} else {
|
|
3513
|
-
let e;
|
|
3514
|
-
if (this.parentSub !== null) for (e = this.parent._map.get(this.parentSub) || null; e !== null && e.left !== null;) e = e.left;
|
|
3515
|
-
else e = this.parent._start, this.parent._start = this;
|
|
3516
|
-
this.right = e;
|
|
3517
|
-
}
|
|
3518
|
-
this.right === null ? this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)) : this.right.left = this, this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Ii(e.doc.store, this), this.content.integrate(e, this), Wi(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e);
|
|
3519
|
-
} else new G(this.id, this.length).integrate(e, 0);
|
|
3520
|
-
}
|
|
3521
|
-
get next() {
|
|
3522
|
-
let e = this.right;
|
|
3523
|
-
for (; e !== null && e.deleted;) e = e.right;
|
|
3524
|
-
return e;
|
|
3525
|
-
}
|
|
3526
|
-
get prev() {
|
|
3527
|
-
let e = this.left;
|
|
3528
|
-
for (; e !== null && e.deleted;) e = e.left;
|
|
3529
|
-
return e;
|
|
3530
|
-
}
|
|
3531
|
-
get lastId() {
|
|
3532
|
-
return this.length === 1 ? this.id : I(this.id.client, this.id.clock + this.length - 1);
|
|
3533
|
-
}
|
|
3534
|
-
mergeWith(e) {
|
|
3535
|
-
if (this.constructor === e.constructor && _i(e.origin, this.lastId) && this.right === e && _i(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) {
|
|
3536
|
-
let t = this.parent._searchMarker;
|
|
3537
|
-
return t && t.forEach((t) => {
|
|
3538
|
-
t.p === e && (t.p = this, !this.deleted && this.countable && (t.index -= this.length));
|
|
3539
|
-
}), e.keep && (this.keep = !0), this.right = e.right, this.right !== null && (this.right.left = this), this.length += e.length, !0;
|
|
3540
|
-
}
|
|
3541
|
-
return !1;
|
|
3542
|
-
}
|
|
3543
|
-
delete(e) {
|
|
3544
|
-
if (!this.deleted) {
|
|
3545
|
-
let t = this.parent;
|
|
3546
|
-
this.countable && this.parentSub === null && (t._length -= this.length), this.markDeleted(), Mr(e.deleteSet, this.id.client, this.id.clock, this.length), Wi(e, t, this.parentSub), this.content.delete(e);
|
|
3547
|
-
}
|
|
3548
|
-
}
|
|
3549
|
-
gc(e, t) {
|
|
3550
|
-
if (!this.deleted) throw C();
|
|
3551
|
-
this.content.gc(e), t ? Bi(e, this, new G(this.id, this.length)) : this.content = new To(this.length);
|
|
3552
|
-
}
|
|
3553
|
-
write(e, t) {
|
|
3554
|
-
let n = t > 0 ? I(this.id.client, this.id.clock + t - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, a = this.content.getRef() & 31 | (n === null ? 0 : 128) | (r === null ? 0 : 64) | (i === null ? 0 : 32);
|
|
3555
|
-
if (e.writeInfo(a), n !== null && e.writeLeftID(n), r !== null && e.writeRightID(r), n === null && r === null) {
|
|
3556
|
-
let t = this.parent;
|
|
3557
|
-
if (t._item !== void 0) {
|
|
3558
|
-
let n = t._item;
|
|
3559
|
-
if (n === null) {
|
|
3560
|
-
let n = vi(t);
|
|
3561
|
-
e.writeParentInfo(!0), e.writeString(n);
|
|
3562
|
-
} else e.writeParentInfo(!1), e.writeLeftID(n.id);
|
|
3563
|
-
} else t.constructor === String ? (e.writeParentInfo(!0), e.writeString(t)) : t.constructor === gi ? (e.writeParentInfo(!1), e.writeLeftID(t)) : C();
|
|
3564
|
-
i !== null && e.writeString(i);
|
|
3565
|
-
}
|
|
3566
|
-
this.content.write(e, t);
|
|
3567
|
-
}
|
|
3568
|
-
}, $o = (e, t) => es[t & 31](e), es = [
|
|
3569
|
-
() => {
|
|
3570
|
-
C();
|
|
3571
|
-
},
|
|
3572
|
-
Eo,
|
|
3573
|
-
Po,
|
|
3574
|
-
wo,
|
|
3575
|
-
Ro,
|
|
3576
|
-
jo,
|
|
3577
|
-
Mo,
|
|
3578
|
-
qo,
|
|
3579
|
-
Lo,
|
|
3580
|
-
ko,
|
|
3581
|
-
() => {
|
|
3582
|
-
C();
|
|
3583
|
-
}
|
|
3584
|
-
], ts = 10, X = class extends xo {
|
|
3585
|
-
get deleted() {
|
|
3586
|
-
return !0;
|
|
3587
|
-
}
|
|
3588
|
-
delete() {}
|
|
3589
|
-
mergeWith(e) {
|
|
3590
|
-
return this.constructor === e.constructor && (this.length += e.length, !0);
|
|
3591
|
-
}
|
|
3592
|
-
integrate(e, t) {
|
|
3593
|
-
C();
|
|
3594
|
-
}
|
|
3595
|
-
write(e, t) {
|
|
3596
|
-
e.writeInfo(ts), v(e.restEncoder, this.length - t);
|
|
3597
|
-
}
|
|
3598
|
-
getMissing(e, t) {
|
|
3599
|
-
return null;
|
|
3600
|
-
}
|
|
3601
|
-
}, ns = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, rs = "__ $YJS$ __";
|
|
3602
|
-
ns[rs] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"), ns[rs] = !0;
|
|
3603
|
-
//#endregion
|
|
3604
|
-
//#region ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.32/node_modules/y-protocols/awareness.js
|
|
3605
|
-
var is = 3e4, as = class extends te {
|
|
3606
|
-
constructor(e) {
|
|
3607
|
-
super(), this.doc = e, this.clientID = e.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => {
|
|
3608
|
-
let e = O();
|
|
3609
|
-
this.getLocalState() !== null && 15e3 <= e - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
3610
|
-
let t = [];
|
|
3611
|
-
this.meta.forEach((n, r) => {
|
|
3612
|
-
r !== this.clientID && 3e4 <= e - n.lastUpdated && this.states.has(r) && t.push(r);
|
|
3613
|
-
}), t.length > 0 && os(this, t, "timeout");
|
|
3614
|
-
}, p(is / 10)), e.on("destroy", () => {
|
|
3615
|
-
this.destroy();
|
|
3616
|
-
}), this.setLocalState({});
|
|
3617
|
-
}
|
|
3618
|
-
destroy() {
|
|
3619
|
-
this.emit("destroy", [this]), this.setLocalState(null), super.destroy(), clearInterval(this._checkInterval);
|
|
3620
|
-
}
|
|
3621
|
-
getLocalState() {
|
|
3622
|
-
return this.states.get(this.clientID) || null;
|
|
3623
|
-
}
|
|
3624
|
-
setLocalState(e) {
|
|
3625
|
-
let t = this.clientID, n = this.meta.get(t), r = n === void 0 ? 0 : n.clock + 1, i = this.states.get(t);
|
|
3626
|
-
e === null ? this.states.delete(t) : this.states.set(t, e), this.meta.set(t, {
|
|
3627
|
-
clock: r,
|
|
3628
|
-
lastUpdated: O()
|
|
3629
|
-
});
|
|
3630
|
-
let a = [], o = [], s = [], c = [];
|
|
3631
|
-
e === null ? c.push(t) : i == null ? e != null && a.push(t) : (o.push(t), Ot(i, e) || s.push(t)), (a.length > 0 || s.length > 0 || c.length > 0) && this.emit("change", [{
|
|
3632
|
-
added: a,
|
|
3633
|
-
updated: s,
|
|
3634
|
-
removed: c
|
|
3635
|
-
}, "local"]), this.emit("update", [{
|
|
3636
|
-
added: a,
|
|
3637
|
-
updated: o,
|
|
3638
|
-
removed: c
|
|
3639
|
-
}, "local"]);
|
|
3640
|
-
}
|
|
3641
|
-
setLocalStateField(e, t) {
|
|
3642
|
-
let n = this.getLocalState();
|
|
3643
|
-
n !== null && this.setLocalState({
|
|
3644
|
-
...n,
|
|
3645
|
-
[e]: t
|
|
3646
|
-
});
|
|
3647
|
-
}
|
|
3648
|
-
getStates() {
|
|
3649
|
-
return this.states;
|
|
3650
|
-
}
|
|
3651
|
-
}, os = (e, t, n) => {
|
|
3652
|
-
let r = [];
|
|
3653
|
-
for (let n = 0; n < t.length; n++) {
|
|
3654
|
-
let i = t[n];
|
|
3655
|
-
if (e.states.has(i)) {
|
|
3656
|
-
if (e.states.delete(i), i === e.clientID) {
|
|
3657
|
-
let t = e.meta.get(i);
|
|
3658
|
-
e.meta.set(i, {
|
|
3659
|
-
clock: t.clock + 1,
|
|
3660
|
-
lastUpdated: O()
|
|
3661
|
-
});
|
|
3662
|
-
}
|
|
3663
|
-
r.push(i);
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
r.length > 0 && (e.emit("change", [{
|
|
3667
|
-
added: [],
|
|
3668
|
-
updated: [],
|
|
3669
|
-
removed: r
|
|
3670
|
-
}, n]), e.emit("update", [{
|
|
3671
|
-
added: [],
|
|
3672
|
-
updated: [],
|
|
3673
|
-
removed: r
|
|
3674
|
-
}, n]));
|
|
3675
|
-
}, ss = (e, t, n = e.states) => {
|
|
3676
|
-
let r = t.length, i = h();
|
|
3677
|
-
v(i, r);
|
|
3678
|
-
for (let a = 0; a < r; a++) {
|
|
3679
|
-
let r = t[a], o = n.get(r) || null, s = e.meta.get(r).clock;
|
|
3680
|
-
v(i, r), v(i, s), y(i, JSON.stringify(o));
|
|
3681
|
-
}
|
|
3682
|
-
return g(i);
|
|
3683
|
-
}, cs = (e, t, n) => {
|
|
3684
|
-
let r = w(t), i = O(), a = [], o = [], s = [], c = [], l = E(r);
|
|
3685
|
-
for (let t = 0; t < l; t++) {
|
|
3686
|
-
let t = E(r), n = E(r), l = JSON.parse(D(r)), u = e.meta.get(t), d = e.states.get(t), f = u === void 0 ? 0 : u.clock;
|
|
3687
|
-
(f < n || f === n && l === null && e.states.has(t)) && (l === null ? t === e.clientID && e.getLocalState() != null ? n++ : e.states.delete(t) : e.states.set(t, l), e.meta.set(t, {
|
|
3688
|
-
clock: n,
|
|
3689
|
-
lastUpdated: i
|
|
3690
|
-
}), u === void 0 && l !== null ? a.push(t) : u !== void 0 && l === null ? c.push(t) : l !== null && (Ot(l, d) || s.push(t), o.push(t)));
|
|
3691
|
-
}
|
|
3692
|
-
(a.length > 0 || s.length > 0 || c.length > 0) && e.emit("change", [{
|
|
3693
|
-
added: a,
|
|
3694
|
-
updated: s,
|
|
3695
|
-
removed: c
|
|
3696
|
-
}, n]), (a.length > 0 || o.length > 0 || c.length > 0) && e.emit("update", [{
|
|
3697
|
-
added: a,
|
|
3698
|
-
updated: o,
|
|
3699
|
-
removed: c
|
|
3700
|
-
}, n]);
|
|
3701
|
-
}, ls = () => {
|
|
3702
|
-
let e = !0;
|
|
3703
|
-
return (t, n) => {
|
|
3704
|
-
if (e) {
|
|
3705
|
-
e = !1;
|
|
3706
|
-
try {
|
|
3707
|
-
t();
|
|
3708
|
-
} finally {
|
|
3709
|
-
e = !0;
|
|
3710
|
-
}
|
|
3711
|
-
} else n !== void 0 && n();
|
|
3712
|
-
};
|
|
3713
|
-
}, us = /[\uD800-\uDBFF]/, ds = /[\uDC00-\uDFFF]/, fs = (e, t) => {
|
|
3714
|
-
let n = 0, r = 0;
|
|
3715
|
-
for (; n < e.length && n < t.length && e[n] === t[n];) n++;
|
|
3716
|
-
for (n > 0 && us.test(e[n - 1]) && n--; r + n < e.length && r + n < t.length && e[e.length - r - 1] === t[t.length - r - 1];) r++;
|
|
3717
|
-
return r > 0 && ds.test(e[e.length - r]) && r--, {
|
|
3718
|
-
index: n,
|
|
3719
|
-
remove: e.length - n - r,
|
|
3720
|
-
insert: t.slice(n, t.length - r)
|
|
3721
|
-
};
|
|
3722
|
-
}, Z = (e, t) => e >>> t | e << 32 - t, ps = (e) => Z(e, 2) ^ Z(e, 13) ^ Z(e, 22), ms = (e) => Z(e, 6) ^ Z(e, 11) ^ Z(e, 25), hs = (e) => Z(e, 7) ^ Z(e, 18) ^ e >>> 3, gs = (e) => Z(e, 17) ^ Z(e, 19) ^ e >>> 10, _s = new Uint32Array([
|
|
3723
|
-
1116352408,
|
|
3724
|
-
1899447441,
|
|
3725
|
-
3049323471,
|
|
3726
|
-
3921009573,
|
|
3727
|
-
961987163,
|
|
3728
|
-
1508970993,
|
|
3729
|
-
2453635748,
|
|
3730
|
-
2870763221,
|
|
3731
|
-
3624381080,
|
|
3732
|
-
310598401,
|
|
3733
|
-
607225278,
|
|
3734
|
-
1426881987,
|
|
3735
|
-
1925078388,
|
|
3736
|
-
2162078206,
|
|
3737
|
-
2614888103,
|
|
3738
|
-
3248222580,
|
|
3739
|
-
3835390401,
|
|
3740
|
-
4022224774,
|
|
3741
|
-
264347078,
|
|
3742
|
-
604807628,
|
|
3743
|
-
770255983,
|
|
3744
|
-
1249150122,
|
|
3745
|
-
1555081692,
|
|
3746
|
-
1996064986,
|
|
3747
|
-
2554220882,
|
|
3748
|
-
2821834349,
|
|
3749
|
-
2952996808,
|
|
3750
|
-
3210313671,
|
|
3751
|
-
3336571891,
|
|
3752
|
-
3584528711,
|
|
3753
|
-
113926993,
|
|
3754
|
-
338241895,
|
|
3755
|
-
666307205,
|
|
3756
|
-
773529912,
|
|
3757
|
-
1294757372,
|
|
3758
|
-
1396182291,
|
|
3759
|
-
1695183700,
|
|
3760
|
-
1986661051,
|
|
3761
|
-
2177026350,
|
|
3762
|
-
2456956037,
|
|
3763
|
-
2730485921,
|
|
3764
|
-
2820302411,
|
|
3765
|
-
3259730800,
|
|
3766
|
-
3345764771,
|
|
3767
|
-
3516065817,
|
|
3768
|
-
3600352804,
|
|
3769
|
-
4094571909,
|
|
3770
|
-
275423344,
|
|
3771
|
-
430227734,
|
|
3772
|
-
506948616,
|
|
3773
|
-
659060556,
|
|
3774
|
-
883997877,
|
|
3775
|
-
958139571,
|
|
3776
|
-
1322822218,
|
|
3777
|
-
1537002063,
|
|
3778
|
-
1747873779,
|
|
3779
|
-
1955562222,
|
|
3780
|
-
2024104815,
|
|
3781
|
-
2227730452,
|
|
3782
|
-
2361852424,
|
|
3783
|
-
2428436474,
|
|
3784
|
-
2756734187,
|
|
3785
|
-
3204031479,
|
|
3786
|
-
3329325298
|
|
3787
|
-
]), vs = new Uint32Array([
|
|
3788
|
-
1779033703,
|
|
3789
|
-
3144134277,
|
|
3790
|
-
1013904242,
|
|
3791
|
-
2773480762,
|
|
3792
|
-
1359893119,
|
|
3793
|
-
2600822924,
|
|
3794
|
-
528734635,
|
|
3795
|
-
1541459225
|
|
3796
|
-
]), ys = class {
|
|
3797
|
-
constructor() {
|
|
3798
|
-
let e = /* @__PURE__ */ new ArrayBuffer(320);
|
|
3799
|
-
this._H = new Uint32Array(e, 0, 8), this._H.set(vs), this._W = new Uint32Array(e, 64, 64);
|
|
3800
|
-
}
|
|
3801
|
-
_updateHash() {
|
|
3802
|
-
let e = this._H, t = this._W;
|
|
3803
|
-
for (let e = 16; e < 64; e++) t[e] = gs(t[e - 2]) + t[e - 7] + hs(t[e - 15]) + t[e - 16];
|
|
3804
|
-
let n = e[0], r = e[1], i = e[2], a = e[3], o = e[4], s = e[5], c = e[6], l = e[7];
|
|
3805
|
-
for (let e = 0, u, d; e < 64; e++) u = l + ms(o) + (o & s ^ ~o & c) + _s[e] + t[e] >>> 0, d = ps(n) + (n & r ^ n & i ^ r & i) >>> 0, l = c, c = s, s = o, o = a + u >>> 0, a = i, i = r, r = n, n = u + d >>> 0;
|
|
3806
|
-
e[0] += n, e[1] += r, e[2] += i, e[3] += a, e[4] += o, e[5] += s, e[6] += c, e[7] += l;
|
|
3807
|
-
}
|
|
3808
|
-
digest(e) {
|
|
3809
|
-
let t = 0;
|
|
3810
|
-
for (; t + 56 <= e.length;) {
|
|
3811
|
-
let n = 0;
|
|
3812
|
-
for (; n < 16 && t + 3 < e.length; n++) this._W[n] = e[t++] << 24 | e[t++] << 16 | e[t++] << 8 | e[t++];
|
|
3813
|
-
if (t % 64 != 0) {
|
|
3814
|
-
for (this._W.fill(0, n, 16); t < e.length;) this._W[n] |= e[t] << (3 - t % 4) * 8, t++;
|
|
3815
|
-
this._W[n] |= 128 << (3 - t % 4) * 8;
|
|
3816
|
-
}
|
|
3817
|
-
this._updateHash();
|
|
3818
|
-
}
|
|
3819
|
-
let n = t % 64 != 0;
|
|
3820
|
-
this._W.fill(0, 0, 16);
|
|
3821
|
-
let r = 0;
|
|
3822
|
-
for (; t < e.length; r++) for (let n = 3; n >= 0 && t < e.length; n--) this._W[r] |= e[t++] << n * 8;
|
|
3823
|
-
n || (this._W[r - (t % 4 == 0 ? 0 : 1)] |= 128 << (3 - t % 4) * 8), this._W[14] = e.byteLength / ae, this._W[15] = e.byteLength * 8, this._updateHash();
|
|
3824
|
-
let i = /* @__PURE__ */ new Uint8Array(32);
|
|
3825
|
-
for (let e = 0; e < this._H.length; e++) for (let t = 0; t < 4; t++) i[e * 4 + t] = this._H[e] >>> (3 - t) * 8;
|
|
3826
|
-
return i;
|
|
3827
|
-
}
|
|
3828
|
-
}, bs = (e) => new ys().digest(e), xs = /* @__PURE__ */ function(e) {
|
|
3829
|
-
return e[e.Token = 0] = "Token", e[e.PermissionDenied = 1] = "PermissionDenied", e[e.Authenticated = 2] = "Authenticated", e;
|
|
3830
|
-
}({}), Ss = (e, t) => {
|
|
3831
|
-
v(e, xs.Token), y(e, t);
|
|
3832
|
-
}, Cs = (e, t, n, r) => {
|
|
3833
|
-
switch (E(e)) {
|
|
3834
|
-
case xs.Token:
|
|
3835
|
-
t();
|
|
3836
|
-
break;
|
|
3837
|
-
case xs.PermissionDenied:
|
|
3838
|
-
n(D(e));
|
|
3839
|
-
break;
|
|
3840
|
-
case xs.Authenticated: r(D(e));
|
|
3841
|
-
}
|
|
3842
|
-
}, ws = (e) => Array.from(e.entries()).map(([e, t]) => ({
|
|
3843
|
-
clientId: e,
|
|
3844
|
-
...t
|
|
3845
|
-
})), Ts = "\0";
|
|
3846
|
-
function Es(e, t) {
|
|
3847
|
-
return e + Ts + t;
|
|
3848
|
-
}
|
|
3849
|
-
function Ds(e) {
|
|
3850
|
-
let t = e.indexOf(Ts);
|
|
3851
|
-
return t === -1 ? {
|
|
3852
|
-
documentName: e,
|
|
3853
|
-
sessionId: null
|
|
3854
|
-
} : {
|
|
3855
|
-
documentName: e.substring(0, t),
|
|
3856
|
-
sessionId: e.substring(t + 1)
|
|
3857
|
-
};
|
|
3858
|
-
}
|
|
3859
|
-
var Os = /* @__PURE__ */ function(e) {
|
|
3860
|
-
return e[e.Connecting = 0] = "Connecting", e[e.Open = 1] = "Open", e[e.Closing = 2] = "Closing", e[e.Closed = 3] = "Closed", e;
|
|
3861
|
-
}({});
|
|
3862
|
-
//#endregion
|
|
3863
|
-
//#region ../../node_modules/.pnpm/@lifeomic+attempt@3.1.0/node_modules/@lifeomic/attempt/dist/es6/src/index.js
|
|
3864
|
-
function ks(e) {
|
|
3865
|
-
return e ||= {}, {
|
|
3866
|
-
delay: e.delay === void 0 ? 200 : e.delay,
|
|
3867
|
-
initialDelay: e.initialDelay === void 0 ? 0 : e.initialDelay,
|
|
3868
|
-
minDelay: e.minDelay === void 0 ? 0 : e.minDelay,
|
|
3869
|
-
maxDelay: e.maxDelay === void 0 ? 0 : e.maxDelay,
|
|
3870
|
-
factor: e.factor === void 0 ? 0 : e.factor,
|
|
3871
|
-
maxAttempts: e.maxAttempts === void 0 ? 3 : e.maxAttempts,
|
|
3872
|
-
timeout: e.timeout === void 0 ? 0 : e.timeout,
|
|
3873
|
-
jitter: e.jitter === !0,
|
|
3874
|
-
initialJitter: e.initialJitter === !0,
|
|
3875
|
-
handleError: e.handleError === void 0 ? null : e.handleError,
|
|
3876
|
-
handleTimeout: e.handleTimeout === void 0 ? null : e.handleTimeout,
|
|
3877
|
-
beforeAttempt: e.beforeAttempt === void 0 ? null : e.beforeAttempt,
|
|
3878
|
-
calculateDelay: e.calculateDelay === void 0 ? null : e.calculateDelay
|
|
3879
|
-
};
|
|
3880
|
-
}
|
|
3881
|
-
async function As(e) {
|
|
3882
|
-
return new Promise((t) => setTimeout(t, e));
|
|
3883
|
-
}
|
|
3884
|
-
function js(e, t) {
|
|
3885
|
-
let n = t.delay;
|
|
3886
|
-
if (n === 0) return 0;
|
|
3887
|
-
if (t.factor && (n *= t.factor ** (e.attemptNum - 1), t.maxDelay !== 0 && (n = Math.min(n, t.maxDelay))), t.jitter) {
|
|
3888
|
-
let e = Math.ceil(t.minDelay);
|
|
3889
|
-
n = Math.floor(Math.random() * (Math.floor(n) - e + 1)) + e;
|
|
3890
|
-
}
|
|
3891
|
-
return Math.round(n);
|
|
3892
|
-
}
|
|
3893
|
-
async function Ms(e, t) {
|
|
3894
|
-
let n = ks(t);
|
|
3895
|
-
for (let e of [
|
|
3896
|
-
"delay",
|
|
3897
|
-
"initialDelay",
|
|
3898
|
-
"minDelay",
|
|
3899
|
-
"maxDelay",
|
|
3900
|
-
"maxAttempts",
|
|
3901
|
-
"timeout"
|
|
3902
|
-
]) {
|
|
3903
|
-
let t = n[e];
|
|
3904
|
-
if (!Number.isInteger(t) || t < 0) throw Error(`Value for ${e} must be an integer greater than or equal to 0`);
|
|
3905
|
-
}
|
|
3906
|
-
if (n.factor.constructor !== Number || n.factor < 0) throw Error("Value for factor must be a number greater than or equal to 0");
|
|
3907
|
-
if (n.delay < n.minDelay) throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);
|
|
3908
|
-
let r = {
|
|
3909
|
-
attemptNum: 0,
|
|
3910
|
-
attemptsRemaining: n.maxAttempts ? n.maxAttempts : -1,
|
|
3911
|
-
aborted: !1,
|
|
3912
|
-
abort() {
|
|
3913
|
-
r.aborted = !0;
|
|
3914
|
-
}
|
|
3915
|
-
}, i = n.calculateDelay || js;
|
|
3916
|
-
async function a() {
|
|
3917
|
-
if (n.beforeAttempt && n.beforeAttempt(r, n), r.aborted) {
|
|
3918
|
-
let e = /* @__PURE__ */ Error("Attempt aborted");
|
|
3919
|
-
throw e.code = "ATTEMPT_ABORTED", e;
|
|
3920
|
-
}
|
|
3921
|
-
let t = async (e) => {
|
|
3922
|
-
if (n.handleError && await n.handleError(e, r, n), r.aborted || r.attemptsRemaining === 0) throw e;
|
|
3923
|
-
r.attemptNum++;
|
|
3924
|
-
let t = i(r, n);
|
|
3925
|
-
return t && await As(t), a();
|
|
3926
|
-
};
|
|
3927
|
-
return r.attemptsRemaining > 0 && r.attemptsRemaining--, n.timeout ? new Promise((i, a) => {
|
|
3928
|
-
let o = setTimeout(() => {
|
|
3929
|
-
if (n.handleTimeout) try {
|
|
3930
|
-
i(n.handleTimeout(r, n));
|
|
3931
|
-
} catch (e) {
|
|
3932
|
-
a(e);
|
|
3933
|
-
}
|
|
3934
|
-
else {
|
|
3935
|
-
let e = /* @__PURE__ */ Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);
|
|
3936
|
-
e.code = "ATTEMPT_TIMEOUT", a(e);
|
|
3937
|
-
}
|
|
3938
|
-
}, n.timeout);
|
|
3939
|
-
e(r, n).then((e) => {
|
|
3940
|
-
clearTimeout(o), i(e);
|
|
3941
|
-
}).catch((e) => {
|
|
3942
|
-
clearTimeout(o), t(e).then(i).catch(a);
|
|
3943
|
-
});
|
|
3944
|
-
}) : e(r, n).catch(t);
|
|
3945
|
-
}
|
|
3946
|
-
let o = n.calculateDelay ? n.calculateDelay(r, n) : n.initialDelay;
|
|
3947
|
-
if (o && await As(o), r.attemptNum < 1 && n.initialJitter) {
|
|
3948
|
-
let e = i(r, n);
|
|
3949
|
-
e && await As(e);
|
|
3950
|
-
}
|
|
3951
|
-
return a();
|
|
3952
|
-
}
|
|
3953
|
-
var Ns = (e, t) => {
|
|
3954
|
-
v(e, 0), b(e, ui(t));
|
|
3955
|
-
}, Ps = (e, t, n) => {
|
|
3956
|
-
v(e, 1), b(e, ii(t, n));
|
|
3957
|
-
}, Fs = (e, t, n) => Ps(t, n, T(e)), Is = (e, t, n, r) => {
|
|
3958
|
-
try {
|
|
3959
|
-
ti(t, T(e), n);
|
|
3960
|
-
} catch (e) {
|
|
3961
|
-
r?.(e), console.error("Caught error while handling a Yjs update", e);
|
|
3962
|
-
}
|
|
3963
|
-
}, Ls = (e, t) => {
|
|
3964
|
-
v(e, 2), b(e, t);
|
|
3965
|
-
}, Rs = Is, zs = (e, t, n, r, i) => {
|
|
3966
|
-
let a = E(e);
|
|
3967
|
-
switch (a) {
|
|
3968
|
-
case 0:
|
|
3969
|
-
Fs(e, t, n);
|
|
3970
|
-
break;
|
|
3971
|
-
case 1:
|
|
3972
|
-
Is(e, n, r, i);
|
|
3973
|
-
break;
|
|
3974
|
-
case 2:
|
|
3975
|
-
Rs(e, n, r, i);
|
|
3976
|
-
break;
|
|
3977
|
-
default: throw Error("Unknown message type");
|
|
3978
|
-
}
|
|
3979
|
-
return a;
|
|
3980
|
-
}, Bs = class {
|
|
3981
|
-
constructor() {
|
|
3982
|
-
this.callbacks = {};
|
|
3983
|
-
}
|
|
3984
|
-
on(e, t) {
|
|
3985
|
-
return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
|
|
3986
|
-
}
|
|
3987
|
-
emit(e, ...t) {
|
|
3988
|
-
let n = this.callbacks[e];
|
|
3989
|
-
return n && n.forEach((e) => e.apply(this, t)), this;
|
|
3990
|
-
}
|
|
3991
|
-
off(e, t) {
|
|
3992
|
-
let n = this.callbacks[e];
|
|
3993
|
-
return n && (t ? this.callbacks[e] = n.filter((e) => e !== t) : delete this.callbacks[e]), this;
|
|
3994
|
-
}
|
|
3995
|
-
removeAllListeners() {
|
|
3996
|
-
this.callbacks = {};
|
|
3997
|
-
}
|
|
3998
|
-
}, Vs = class {
|
|
3999
|
-
constructor(e) {
|
|
4000
|
-
this.data = e, this.encoder = h(), this.decoder = w(new Uint8Array(this.data));
|
|
4001
|
-
}
|
|
4002
|
-
peekVarString() {
|
|
4003
|
-
return Ye(this.decoder);
|
|
4004
|
-
}
|
|
4005
|
-
readVarUint() {
|
|
4006
|
-
return E(this.decoder);
|
|
4007
|
-
}
|
|
4008
|
-
readVarString() {
|
|
4009
|
-
return D(this.decoder);
|
|
4010
|
-
}
|
|
4011
|
-
readVarUint8Array() {
|
|
4012
|
-
return T(this.decoder);
|
|
4013
|
-
}
|
|
4014
|
-
writeVarUint(e) {
|
|
4015
|
-
return v(this.encoder, e);
|
|
4016
|
-
}
|
|
4017
|
-
writeVarString(e) {
|
|
4018
|
-
return y(this.encoder, e);
|
|
4019
|
-
}
|
|
4020
|
-
writeVarUint8Array(e) {
|
|
4021
|
-
return b(this.encoder, e);
|
|
4022
|
-
}
|
|
4023
|
-
length() {
|
|
4024
|
-
return Se(this.encoder);
|
|
4025
|
-
}
|
|
4026
|
-
}, Q = /* @__PURE__ */ function(e) {
|
|
4027
|
-
return e[e.Sync = 0] = "Sync", e[e.Awareness = 1] = "Awareness", e[e.Auth = 2] = "Auth", e[e.QueryAwareness = 3] = "QueryAwareness", e[e.Stateless = 5] = "Stateless", e[e.CLOSE = 7] = "CLOSE", e[e.SyncStatus = 8] = "SyncStatus", e[e.Ping = 9] = "Ping", e[e.Pong = 10] = "Pong", e;
|
|
4028
|
-
}({}), $ = /* @__PURE__ */ function(e) {
|
|
4029
|
-
return e.Connecting = "connecting", e.Connected = "connected", e.Disconnected = "disconnected", e;
|
|
4030
|
-
}({}), Hs = class {
|
|
4031
|
-
constructor() {
|
|
4032
|
-
this.encoder = h();
|
|
4033
|
-
}
|
|
4034
|
-
get(e) {
|
|
4035
|
-
return e.encoder;
|
|
4036
|
-
}
|
|
4037
|
-
toUint8Array() {
|
|
4038
|
-
return g(this.encoder);
|
|
4039
|
-
}
|
|
4040
|
-
}, Us = class extends Hs {
|
|
4041
|
-
constructor(...e) {
|
|
4042
|
-
super(...e), this.type = Q.CLOSE, this.description = "Ask the server to close the connection";
|
|
4043
|
-
}
|
|
4044
|
-
get(e) {
|
|
4045
|
-
return y(this.encoder, e.documentName), v(this.encoder, this.type), this.encoder;
|
|
4046
|
-
}
|
|
4047
|
-
}, Ws = class e extends Bs {
|
|
4048
|
-
static {
|
|
4049
|
-
this.DEDUPLICATABLE_TYPES = /* @__PURE__ */ new Set([Q.Awareness, Q.QueryAwareness]);
|
|
4050
|
-
}
|
|
4051
|
-
constructor(e) {
|
|
4052
|
-
super(), this.messageQueue = [], this.configuration = {
|
|
4053
|
-
url: "",
|
|
4054
|
-
autoConnect: !0,
|
|
4055
|
-
preserveTrailingSlash: !1,
|
|
4056
|
-
document: void 0,
|
|
4057
|
-
WebSocketPolyfill: void 0,
|
|
4058
|
-
messageReconnectTimeout: 3e4,
|
|
4059
|
-
delay: 1e3,
|
|
4060
|
-
initialDelay: 0,
|
|
4061
|
-
factor: 2,
|
|
4062
|
-
maxAttempts: 0,
|
|
4063
|
-
minDelay: 1e3,
|
|
4064
|
-
maxDelay: 3e4,
|
|
4065
|
-
jitter: !0,
|
|
4066
|
-
timeout: 0,
|
|
4067
|
-
onOpen: () => null,
|
|
4068
|
-
onConnect: () => null,
|
|
4069
|
-
onMessage: () => null,
|
|
4070
|
-
onOutgoingMessage: () => null,
|
|
4071
|
-
onStatus: () => null,
|
|
4072
|
-
onDisconnect: () => null,
|
|
4073
|
-
onClose: () => null,
|
|
4074
|
-
onMaxAttemptsFailed: () => null,
|
|
4075
|
-
onDestroy: () => null,
|
|
4076
|
-
onAwarenessUpdate: () => null,
|
|
4077
|
-
onAwarenessChange: () => null,
|
|
4078
|
-
handleTimeout: null,
|
|
4079
|
-
providerMap: /* @__PURE__ */ new Map()
|
|
4080
|
-
}, this.webSocket = null, this.webSocketHandlers = {}, this.shouldConnect = !0, this.status = $.Disconnected, this.lastMessageReceived = 0, this.identifier = 0, this.intervals = { connectionChecker: null }, this.connectionAttempt = null, this.receivedOnOpenPayload = void 0, this.closeTries = 0, this.setConfiguration(e), this.configuration.WebSocketPolyfill = e.WebSocketPolyfill ? e.WebSocketPolyfill : WebSocket, this.on("open", this.configuration.onOpen), this.on("open", this.onOpen.bind(this)), this.on("connect", this.configuration.onConnect), this.on("message", this.configuration.onMessage), this.on("outgoingMessage", this.configuration.onOutgoingMessage), this.on("status", this.configuration.onStatus), this.on("disconnect", this.configuration.onDisconnect), this.on("close", this.configuration.onClose), this.on("maxAttemptsFailed", this.configuration.onMaxAttemptsFailed), this.on("destroy", this.configuration.onDestroy), this.on("awarenessUpdate", this.configuration.onAwarenessUpdate), this.on("awarenessChange", this.configuration.onAwarenessChange), this.on("close", this.onClose.bind(this)), this.on("message", this.onMessage.bind(this)), this.intervals.connectionChecker = setInterval(this.checkConnection.bind(this), this.configuration.messageReconnectTimeout / 10), this.shouldConnect && this.connect();
|
|
4081
|
-
}
|
|
4082
|
-
async onOpen(e) {
|
|
4083
|
-
this.status = $.Connected, this.emit("status", { status: $.Connected }), this.cancelWebsocketRetry = void 0, this.receivedOnOpenPayload = e;
|
|
4084
|
-
}
|
|
4085
|
-
attach(e) {
|
|
4086
|
-
let t = e.effectiveName, n = this.configuration.providerMap.get(t);
|
|
4087
|
-
if (n && n !== e && n.isAuthenticated) throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);
|
|
4088
|
-
this.configuration.providerMap.set(t, e), this.status === $.Disconnected && this.shouldConnect && this.connect(), this.receivedOnOpenPayload && this.status === $.Connected && e.onOpen(this.receivedOnOpenPayload);
|
|
4089
|
-
}
|
|
4090
|
-
detach(e) {
|
|
4091
|
-
let t = e.effectiveName;
|
|
4092
|
-
this.configuration.providerMap.has(t) && (e.send(Us, { documentName: t }), this.configuration.providerMap.delete(t));
|
|
4093
|
-
}
|
|
4094
|
-
setConfiguration(e = {}) {
|
|
4095
|
-
this.configuration = {
|
|
4096
|
-
...this.configuration,
|
|
4097
|
-
...e
|
|
4098
|
-
}, this.configuration.autoConnect || (this.shouldConnect = !1);
|
|
4099
|
-
}
|
|
4100
|
-
async connect() {
|
|
4101
|
-
if (this.status === $.Connected) return;
|
|
4102
|
-
this.cancelWebsocketRetry &&= (this.cancelWebsocketRetry(), void 0), this.receivedOnOpenPayload = void 0, this.shouldConnect = !0;
|
|
4103
|
-
let { retryPromise: e, cancelFunc: t } = (() => {
|
|
4104
|
-
let e = !1;
|
|
4105
|
-
return {
|
|
4106
|
-
retryPromise: Ms(this.createWebSocketConnection.bind(this), {
|
|
4107
|
-
delay: this.configuration.delay,
|
|
4108
|
-
initialDelay: this.configuration.initialDelay,
|
|
4109
|
-
factor: this.configuration.factor,
|
|
4110
|
-
maxAttempts: this.configuration.maxAttempts,
|
|
4111
|
-
minDelay: this.configuration.minDelay,
|
|
4112
|
-
maxDelay: this.configuration.maxDelay,
|
|
4113
|
-
jitter: this.configuration.jitter,
|
|
4114
|
-
timeout: this.configuration.timeout,
|
|
4115
|
-
handleTimeout: this.configuration.handleTimeout,
|
|
4116
|
-
beforeAttempt: (t) => {
|
|
4117
|
-
(!this.shouldConnect || e) && t.abort();
|
|
4118
|
-
}
|
|
4119
|
-
}).catch((e) => {
|
|
4120
|
-
e?.code !== "ATTEMPT_ABORTED" && this.emit("maxAttemptsFailed", { error: e });
|
|
4121
|
-
}),
|
|
4122
|
-
cancelFunc: () => {
|
|
4123
|
-
e = !0;
|
|
4124
|
-
}
|
|
4125
|
-
};
|
|
4126
|
-
})();
|
|
4127
|
-
return this.cancelWebsocketRetry = t, e;
|
|
4128
|
-
}
|
|
4129
|
-
attachWebSocketListeners(e, t) {
|
|
4130
|
-
let { identifier: n } = e, r = (e) => this.emit("message", e), i = (e) => this.emit("close", { event: e }), a = (e) => this.emit("open", e), o = (e) => {
|
|
4131
|
-
t(e);
|
|
4132
|
-
};
|
|
4133
|
-
this.webSocketHandlers[n] = {
|
|
4134
|
-
message: r,
|
|
4135
|
-
close: i,
|
|
4136
|
-
open: a,
|
|
4137
|
-
error: o
|
|
4138
|
-
};
|
|
4139
|
-
let s = this.webSocketHandlers[e.identifier];
|
|
4140
|
-
Object.keys(s).forEach((t) => {
|
|
4141
|
-
e.addEventListener(t, s[t]);
|
|
4142
|
-
});
|
|
4143
|
-
}
|
|
4144
|
-
cleanupWebSocket() {
|
|
4145
|
-
if (!this.webSocket) return;
|
|
4146
|
-
let { identifier: e } = this.webSocket, t = this.webSocketHandlers[e];
|
|
4147
|
-
Object.keys(t).forEach((n) => {
|
|
4148
|
-
this.webSocket?.removeEventListener(n, t[n]), delete this.webSocketHandlers[e];
|
|
4149
|
-
}), this.webSocket.close(), this.webSocket = null;
|
|
4150
|
-
}
|
|
4151
|
-
createWebSocketConnection() {
|
|
4152
|
-
return new Promise((e, t) => {
|
|
4153
|
-
this.webSocket && (this.messageQueue = [], this.cleanupWebSocket()), this.lastMessageReceived = 0, this.identifier += 1;
|
|
4154
|
-
let n = new this.configuration.WebSocketPolyfill(this.url);
|
|
4155
|
-
n.binaryType = "arraybuffer", n.identifier = this.identifier, this.attachWebSocketListeners(n, t), this.webSocket = n, this.status = $.Connecting, this.emit("status", { status: $.Connecting }), this.connectionAttempt = {
|
|
4156
|
-
resolve: e,
|
|
4157
|
-
reject: t
|
|
4158
|
-
};
|
|
4159
|
-
});
|
|
4160
|
-
}
|
|
4161
|
-
onMessage(e) {
|
|
4162
|
-
this.resolveConnectionAttempt(), this.lastMessageReceived = O();
|
|
4163
|
-
let t = new Uint8Array(e.data);
|
|
4164
|
-
if (t.length === 1 && t[0] === Q.Ping) {
|
|
4165
|
-
this.sendPong();
|
|
4166
|
-
return;
|
|
4167
|
-
}
|
|
4168
|
-
let n = new Vs(t).peekVarString();
|
|
4169
|
-
this.configuration.providerMap.get(n)?.onMessage(e);
|
|
4170
|
-
}
|
|
4171
|
-
sendPong() {
|
|
4172
|
-
let e = h();
|
|
4173
|
-
v(e, Q.Pong), this.send(g(e));
|
|
4174
|
-
}
|
|
4175
|
-
resolveConnectionAttempt() {
|
|
4176
|
-
this.connectionAttempt && (this.connectionAttempt.resolve(), this.connectionAttempt = null, this.status = $.Connected, this.emit("status", { status: $.Connected }), this.emit("connect"), this.messageQueue.forEach((e) => this.send(e)), this.messageQueue = []);
|
|
4177
|
-
}
|
|
4178
|
-
stopConnectionAttempt() {
|
|
4179
|
-
this.connectionAttempt = null;
|
|
4180
|
-
}
|
|
4181
|
-
rejectConnectionAttempt(e) {
|
|
4182
|
-
this.connectionAttempt?.reject(e), this.connectionAttempt = null;
|
|
4183
|
-
}
|
|
4184
|
-
checkConnection() {
|
|
4185
|
-
this.status === $.Connected && this.lastMessageReceived && (this.configuration.messageReconnectTimeout >= O() - this.lastMessageReceived || (this.closeTries += 1, this.closeTries > 2 ? (this.onClose({ event: {
|
|
4186
|
-
code: 4408,
|
|
4187
|
-
reason: "forced"
|
|
4188
|
-
} }), this.closeTries = 0) : (this.webSocket?.close(), this.messageQueue = [])));
|
|
4189
|
-
}
|
|
4190
|
-
get serverUrl() {
|
|
4191
|
-
if (this.configuration.preserveTrailingSlash) return this.configuration.url;
|
|
4192
|
-
let e = this.configuration.url;
|
|
4193
|
-
for (; e[e.length - 1] === "/";) e = e.slice(0, e.length - 1);
|
|
4194
|
-
return e;
|
|
4195
|
-
}
|
|
4196
|
-
get url() {
|
|
4197
|
-
return this.serverUrl;
|
|
4198
|
-
}
|
|
4199
|
-
disconnect() {
|
|
4200
|
-
if (this.shouldConnect = !1, this.webSocket !== null) try {
|
|
4201
|
-
this.webSocket.close(), this.messageQueue = [];
|
|
4202
|
-
} catch (e) {
|
|
4203
|
-
console.error(e);
|
|
4204
|
-
}
|
|
4205
|
-
}
|
|
4206
|
-
parseQueuedMessage(e) {
|
|
4207
|
-
try {
|
|
4208
|
-
let t = w(e);
|
|
4209
|
-
return {
|
|
4210
|
-
documentName: D(t),
|
|
4211
|
-
messageType: E(t)
|
|
4212
|
-
};
|
|
4213
|
-
} catch {
|
|
4214
|
-
return null;
|
|
4215
|
-
}
|
|
4216
|
-
}
|
|
4217
|
-
addToQueue(t) {
|
|
4218
|
-
if (t instanceof Uint8Array) {
|
|
4219
|
-
let n = this.parseQueuedMessage(t);
|
|
4220
|
-
n && e.DEDUPLICATABLE_TYPES.has(n.messageType) && (this.messageQueue = this.messageQueue.filter((e) => {
|
|
4221
|
-
if (!(e instanceof Uint8Array)) return !0;
|
|
4222
|
-
let t = this.parseQueuedMessage(e);
|
|
4223
|
-
return !t || t.documentName !== n.documentName || t.messageType !== n.messageType;
|
|
4224
|
-
}));
|
|
4225
|
-
}
|
|
4226
|
-
this.messageQueue.push(t);
|
|
4227
|
-
}
|
|
4228
|
-
send(e) {
|
|
4229
|
-
this.webSocket?.readyState === Os.Open ? this.webSocket.send(e) : this.addToQueue(e);
|
|
4230
|
-
}
|
|
4231
|
-
onClose({ event: e }) {
|
|
4232
|
-
this.closeTries = 0, this.cleanupWebSocket(), this.connectionAttempt && this.rejectConnectionAttempt(/* @__PURE__ */ Error(`WebSocket closed before the connection was established (code: ${e?.code}, reason: ${e?.reason || "none"})`)), this.status = $.Disconnected, this.emit("status", { status: $.Disconnected }), this.emit("disconnect", { event: e }), !this.cancelWebsocketRetry && this.shouldConnect && setTimeout(() => {
|
|
4233
|
-
this.connect();
|
|
4234
|
-
}, this.configuration.delay);
|
|
4235
|
-
}
|
|
4236
|
-
destroy() {
|
|
4237
|
-
this.emit("destroy"), clearInterval(this.intervals.connectionChecker), this.stopConnectionAttempt(), this.disconnect(), this.removeAllListeners(), this.cleanupWebSocket();
|
|
4238
|
-
}
|
|
4239
|
-
}, Gs = class {
|
|
4240
|
-
constructor(e) {
|
|
4241
|
-
this.message = e;
|
|
4242
|
-
}
|
|
4243
|
-
apply(e, t) {
|
|
4244
|
-
let { message: n } = this, r = n.readVarUint(), i = n.length();
|
|
4245
|
-
switch (r) {
|
|
4246
|
-
case Q.Sync:
|
|
4247
|
-
this.applySyncMessage(e, t);
|
|
4248
|
-
break;
|
|
4249
|
-
case Q.Awareness:
|
|
4250
|
-
this.applyAwarenessMessage(e);
|
|
4251
|
-
break;
|
|
4252
|
-
case Q.Auth:
|
|
4253
|
-
this.applyAuthMessage(e);
|
|
4254
|
-
break;
|
|
4255
|
-
case Q.QueryAwareness:
|
|
4256
|
-
this.applyQueryAwarenessMessage(e);
|
|
4257
|
-
break;
|
|
4258
|
-
case Q.Stateless:
|
|
4259
|
-
e.receiveStateless(D(n.decoder));
|
|
4260
|
-
break;
|
|
4261
|
-
case Q.SyncStatus:
|
|
4262
|
-
this.applySyncStatusMessage(e, Je(n.decoder) === 1);
|
|
4263
|
-
break;
|
|
4264
|
-
case Q.CLOSE: {
|
|
4265
|
-
let t = {
|
|
4266
|
-
code: 1e3,
|
|
4267
|
-
reason: D(n.decoder)
|
|
4268
|
-
};
|
|
4269
|
-
e.onClose(), e.configuration.onClose({ event: t }), e.forwardClose({ event: t });
|
|
4270
|
-
break;
|
|
4271
|
-
}
|
|
4272
|
-
default: console.error(`Can’t apply message of unknown type: ${r}`);
|
|
4273
|
-
}
|
|
4274
|
-
n.length() > i + 1 && e.send(Hs, { encoder: n.encoder });
|
|
4275
|
-
}
|
|
4276
|
-
applySyncMessage(e, t) {
|
|
4277
|
-
let { message: n } = this;
|
|
4278
|
-
n.writeVarUint(Q.Sync);
|
|
4279
|
-
let r = zs(n.decoder, n.encoder, e.document, e);
|
|
4280
|
-
t && r === 1 && (e.synced = !0);
|
|
4281
|
-
}
|
|
4282
|
-
applySyncStatusMessage(e, t) {
|
|
4283
|
-
t && e.decrementUnsyncedChanges();
|
|
4284
|
-
}
|
|
4285
|
-
applyAwarenessMessage(e) {
|
|
4286
|
-
if (!e.awareness) return;
|
|
4287
|
-
let { message: t } = this;
|
|
4288
|
-
cs(e.awareness, t.readVarUint8Array(), e);
|
|
4289
|
-
}
|
|
4290
|
-
applyAuthMessage(e) {
|
|
4291
|
-
let { message: t } = this;
|
|
4292
|
-
Cs(t.decoder, e.sendToken.bind(e), e.permissionDeniedHandler.bind(e), e.authenticatedHandler.bind(e));
|
|
4293
|
-
}
|
|
4294
|
-
applyQueryAwarenessMessage(e) {
|
|
4295
|
-
if (!e.awareness) return;
|
|
4296
|
-
let { message: t } = this;
|
|
4297
|
-
t.writeVarUint(Q.Awareness), t.writeVarUint8Array(ss(e.awareness, Array.from(e.awareness.getStates().keys())));
|
|
4298
|
-
}
|
|
4299
|
-
}, Ks = class {
|
|
4300
|
-
constructor(e, t = {}) {
|
|
4301
|
-
this.message = new e(), this.encoder = this.message.get(t);
|
|
4302
|
-
}
|
|
4303
|
-
create() {
|
|
4304
|
-
return g(this.encoder);
|
|
4305
|
-
}
|
|
4306
|
-
send(e) {
|
|
4307
|
-
e?.send(this.create());
|
|
4308
|
-
}
|
|
4309
|
-
}, qs = "4.7.0", Js = class extends Hs {
|
|
4310
|
-
constructor(...e) {
|
|
4311
|
-
super(...e), this.type = Q.Auth, this.description = "Authentication";
|
|
4312
|
-
}
|
|
4313
|
-
get(e) {
|
|
4314
|
-
if (e.token === void 0) throw Error("The authentication message requires `token` as an argument.");
|
|
4315
|
-
return y(this.encoder, e.documentName), v(this.encoder, this.type), Ss(this.encoder, e.token), y(this.encoder, qs), this.encoder;
|
|
4316
|
-
}
|
|
4317
|
-
}, Ys = class extends Hs {
|
|
4318
|
-
constructor(...e) {
|
|
4319
|
-
super(...e), this.type = Q.Awareness, this.description = "Awareness states update";
|
|
4320
|
-
}
|
|
4321
|
-
get(e) {
|
|
4322
|
-
if (e.awareness === void 0) throw Error("The awareness message requires awareness as an argument");
|
|
4323
|
-
if (e.clients === void 0) throw Error("The awareness message requires clients as an argument");
|
|
4324
|
-
y(this.encoder, e.documentName), v(this.encoder, this.type);
|
|
4325
|
-
let t;
|
|
4326
|
-
return t = e.states === void 0 ? ss(e.awareness, e.clients) : ss(e.awareness, e.clients, e.states), b(this.encoder, t), this.encoder;
|
|
4327
|
-
}
|
|
4328
|
-
}, Xs = class extends Hs {
|
|
4329
|
-
constructor(...e) {
|
|
4330
|
-
super(...e), this.type = Q.Stateless, this.description = "A stateless message";
|
|
4331
|
-
}
|
|
4332
|
-
get(e) {
|
|
4333
|
-
return y(this.encoder, e.documentName), v(this.encoder, this.type), y(this.encoder, e.payload ?? ""), this.encoder;
|
|
4334
|
-
}
|
|
4335
|
-
}, Zs = class extends Hs {
|
|
4336
|
-
constructor(...e) {
|
|
4337
|
-
super(...e), this.type = Q.Sync, this.description = "First sync step";
|
|
4338
|
-
}
|
|
4339
|
-
get(e) {
|
|
4340
|
-
if (e.document === void 0) throw Error("The sync step one message requires document as an argument");
|
|
4341
|
-
return y(this.encoder, e.documentName), v(this.encoder, this.type), Ns(this.encoder, e.document), this.encoder;
|
|
4342
|
-
}
|
|
4343
|
-
}, Qs = class extends Hs {
|
|
4344
|
-
constructor(...e) {
|
|
4345
|
-
super(...e), this.type = Q.Sync, this.description = "A document update";
|
|
4346
|
-
}
|
|
4347
|
-
get(e) {
|
|
4348
|
-
return y(this.encoder, e.documentName), v(this.encoder, this.type), Ls(this.encoder, e.update), this.encoder;
|
|
4349
|
-
}
|
|
4350
|
-
}, $s = class extends Error {
|
|
4351
|
-
constructor(...e) {
|
|
4352
|
-
super(...e), this.code = 1001;
|
|
4353
|
-
}
|
|
4354
|
-
}, ec = class extends Bs {
|
|
4355
|
-
get effectiveName() {
|
|
4356
|
-
return this.configuration.sessionAwareness ? Es(this.configuration.name, this.sessionId) : this.configuration.name;
|
|
4357
|
-
}
|
|
4358
|
-
constructor(e) {
|
|
4359
|
-
super(), this.configuration = {
|
|
4360
|
-
name: "",
|
|
4361
|
-
document: void 0,
|
|
4362
|
-
awareness: void 0,
|
|
4363
|
-
token: null,
|
|
4364
|
-
sessionAwareness: !1,
|
|
4365
|
-
forceSyncInterval: !1,
|
|
4366
|
-
flushDelay: !1,
|
|
4367
|
-
onAuthenticated: () => null,
|
|
4368
|
-
onAuthenticationFailed: () => null,
|
|
4369
|
-
onOpen: () => null,
|
|
4370
|
-
onConnect: () => null,
|
|
4371
|
-
onMessage: () => null,
|
|
4372
|
-
onOutgoingMessage: () => null,
|
|
4373
|
-
onSynced: () => null,
|
|
4374
|
-
onStatus: () => null,
|
|
4375
|
-
onDisconnect: () => null,
|
|
4376
|
-
onClose: () => null,
|
|
4377
|
-
onDestroy: () => null,
|
|
4378
|
-
onAwarenessUpdate: () => null,
|
|
4379
|
-
onAwarenessChange: () => null,
|
|
4380
|
-
onStateless: () => null,
|
|
4381
|
-
onUnsyncedChanges: () => null
|
|
4382
|
-
}, this.isSynced = !1, this.unsyncedChanges = 0, this.isAuthenticated = !1, this.authorizedScope = void 0, this.manageSocket = !1, this._isAttached = !1, this.pendingUpdates = [], this.pendingAwarenessClients = /* @__PURE__ */ new Set(), this.flushTimeout = null, this.sessionId = Math.random().toString(36).slice(2), this.intervals = { forceSync: null }, this.boundDocumentUpdateHandler = this.documentUpdateHandler.bind(this), this.boundAwarenessUpdateHandler = this.awarenessUpdateHandler.bind(this), this.boundPageHide = this.pageHide.bind(this), this.boundOnOpen = this.onOpen.bind(this), this.boundOnClose = this.onClose.bind(this), this.forwardConnect = () => this.emit("connect"), this.forwardStatus = (e) => this.emit("status", e), this.forwardClose = (e) => this.emit("close", e), this.forwardDisconnect = (e) => this.emit("disconnect", e), this.forwardDestroy = () => this.emit("destroy"), this.setConfiguration(e), this.configuration.document = e.document ? e.document : new zr(), this.configuration.awareness = e.awareness === void 0 ? new as(this.document) : e.awareness, this.on("open", this.configuration.onOpen), this.on("message", this.configuration.onMessage), this.on("outgoingMessage", this.configuration.onOutgoingMessage), this.on("synced", this.configuration.onSynced), this.on("destroy", this.configuration.onDestroy), this.on("awarenessUpdate", this.configuration.onAwarenessUpdate), this.on("awarenessChange", this.configuration.onAwarenessChange), this.on("stateless", this.configuration.onStateless), this.on("unsyncedChanges", this.configuration.onUnsyncedChanges), this.on("authenticated", this.configuration.onAuthenticated), this.on("authenticationFailed", this.configuration.onAuthenticationFailed), this.awareness?.on("update", () => {
|
|
4383
|
-
this.emit("awarenessUpdate", { states: ws(this.awareness.getStates()) });
|
|
4384
|
-
}), this.awareness?.on("change", () => {
|
|
4385
|
-
this.emit("awarenessChange", { states: ws(this.awareness.getStates()) });
|
|
4386
|
-
}), this.document.on("update", this.boundDocumentUpdateHandler), this.awareness?.on("update", this.boundAwarenessUpdateHandler), this.registerEventListeners(), this.configuration.forceSyncInterval && typeof this.configuration.forceSyncInterval == "number" && (this.intervals.forceSync = setInterval(this.forceSync.bind(this), this.configuration.forceSyncInterval)), this.manageSocket && this.attach();
|
|
4387
|
-
}
|
|
4388
|
-
setConfiguration(e = {}) {
|
|
4389
|
-
e.websocketProvider || (this.manageSocket = !0, this.configuration.websocketProvider = new Ws(e)), this.configuration = {
|
|
4390
|
-
...this.configuration,
|
|
4391
|
-
...e
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4394
|
-
get document() {
|
|
4395
|
-
return this.configuration.document;
|
|
4396
|
-
}
|
|
4397
|
-
get isAttached() {
|
|
4398
|
-
return this._isAttached;
|
|
4399
|
-
}
|
|
4400
|
-
get awareness() {
|
|
4401
|
-
return this.configuration.awareness;
|
|
4402
|
-
}
|
|
4403
|
-
get hasUnsyncedChanges() {
|
|
4404
|
-
return this.unsyncedChanges > 0;
|
|
4405
|
-
}
|
|
4406
|
-
resetUnsyncedChanges() {
|
|
4407
|
-
this.unsyncedChanges = 1, this.emit("unsyncedChanges", { number: this.unsyncedChanges });
|
|
4408
|
-
}
|
|
4409
|
-
incrementUnsyncedChanges() {
|
|
4410
|
-
this.unsyncedChanges += 1, this.emit("unsyncedChanges", { number: this.unsyncedChanges });
|
|
4411
|
-
}
|
|
4412
|
-
decrementUnsyncedChanges() {
|
|
4413
|
-
this.unsyncedChanges > 0 && --this.unsyncedChanges, this.unsyncedChanges === 0 && (this.synced = !0), this.emit("unsyncedChanges", { number: this.unsyncedChanges });
|
|
4414
|
-
}
|
|
4415
|
-
forceSync() {
|
|
4416
|
-
this.resetUnsyncedChanges(), this.send(Zs, {
|
|
4417
|
-
document: this.document,
|
|
4418
|
-
documentName: this.effectiveName
|
|
4419
|
-
});
|
|
4420
|
-
}
|
|
4421
|
-
pageHide() {
|
|
4422
|
-
this.awareness && os(this.awareness, [this.document.clientID], "page hide");
|
|
4423
|
-
}
|
|
4424
|
-
registerEventListeners() {
|
|
4425
|
-
typeof window > "u" || !("addEventListener" in window) || window.addEventListener("pagehide", this.boundPageHide);
|
|
4426
|
-
}
|
|
4427
|
-
sendStateless(e) {
|
|
4428
|
-
this.send(Xs, {
|
|
4429
|
-
documentName: this.effectiveName,
|
|
4430
|
-
payload: e
|
|
4431
|
-
});
|
|
4432
|
-
}
|
|
4433
|
-
async sendToken() {
|
|
4434
|
-
let e;
|
|
4435
|
-
try {
|
|
4436
|
-
e = await this.getToken();
|
|
4437
|
-
} catch (e) {
|
|
4438
|
-
this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);
|
|
4439
|
-
return;
|
|
4440
|
-
}
|
|
4441
|
-
this.send(Js, {
|
|
4442
|
-
token: e ?? "",
|
|
4443
|
-
documentName: this.effectiveName
|
|
4444
|
-
});
|
|
4445
|
-
}
|
|
4446
|
-
get batchingEnabled() {
|
|
4447
|
-
return !!this.configuration.flushDelay && typeof this.configuration.flushDelay == "number";
|
|
4448
|
-
}
|
|
4449
|
-
documentUpdateHandler(e, t) {
|
|
4450
|
-
if (t !== this) {
|
|
4451
|
-
if (!this.batchingEnabled) {
|
|
4452
|
-
this.incrementUnsyncedChanges(), this.send(Qs, {
|
|
4453
|
-
update: e,
|
|
4454
|
-
documentName: this.effectiveName
|
|
4455
|
-
});
|
|
4456
|
-
return;
|
|
4457
|
-
}
|
|
4458
|
-
this.pendingUpdates.length === 0 && this.incrementUnsyncedChanges(), this.pendingUpdates.push(e), this.scheduleFlush();
|
|
4459
|
-
}
|
|
4460
|
-
}
|
|
4461
|
-
awarenessUpdateHandler({ added: e, updated: t, removed: n }, r) {
|
|
4462
|
-
if (r === this) return;
|
|
4463
|
-
let i = e.concat(t).concat(n);
|
|
4464
|
-
if (!this.batchingEnabled) {
|
|
4465
|
-
this.send(Ys, {
|
|
4466
|
-
awareness: this.awareness,
|
|
4467
|
-
clients: i,
|
|
4468
|
-
documentName: this.effectiveName
|
|
4469
|
-
});
|
|
4470
|
-
return;
|
|
4471
|
-
}
|
|
4472
|
-
for (let e of i) this.pendingAwarenessClients.add(e);
|
|
4473
|
-
this.scheduleFlush();
|
|
4474
|
-
}
|
|
4475
|
-
scheduleFlush() {
|
|
4476
|
-
this.flushTimeout === null && (this.flushTimeout = setTimeout(() => {
|
|
4477
|
-
this.flushTimeout = null, this.flushPendingUpdates();
|
|
4478
|
-
}, this.configuration.flushDelay));
|
|
4479
|
-
}
|
|
4480
|
-
flushPendingUpdates() {
|
|
4481
|
-
if (this.flushTimeout !== null && (clearTimeout(this.flushTimeout), this.flushTimeout = null), this.pendingUpdates.length > 0) {
|
|
4482
|
-
let e = this.pendingUpdates.length === 1 ? this.pendingUpdates[0] : na(this.pendingUpdates);
|
|
4483
|
-
this.pendingUpdates = [], this.send(Qs, {
|
|
4484
|
-
update: e,
|
|
4485
|
-
documentName: this.effectiveName
|
|
4486
|
-
});
|
|
4487
|
-
}
|
|
4488
|
-
if (this.pendingAwarenessClients.size > 0) {
|
|
4489
|
-
let e = Array.from(this.pendingAwarenessClients);
|
|
4490
|
-
this.pendingAwarenessClients.clear(), this.send(Ys, {
|
|
4491
|
-
awareness: this.awareness,
|
|
4492
|
-
clients: e,
|
|
4493
|
-
documentName: this.effectiveName
|
|
4494
|
-
});
|
|
4495
|
-
}
|
|
4496
|
-
}
|
|
4497
|
-
get synced() {
|
|
4498
|
-
return this.isSynced;
|
|
4499
|
-
}
|
|
4500
|
-
set synced(e) {
|
|
4501
|
-
this.isSynced !== e && (this.isSynced = e, e && this.emit("synced", { state: e }));
|
|
4502
|
-
}
|
|
4503
|
-
receiveStateless(e) {
|
|
4504
|
-
this.emit("stateless", { payload: e });
|
|
4505
|
-
}
|
|
4506
|
-
async connect() {
|
|
4507
|
-
if (this.manageSocket) return this.configuration.websocketProvider.connect();
|
|
4508
|
-
console.warn("HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.");
|
|
4509
|
-
}
|
|
4510
|
-
disconnect() {
|
|
4511
|
-
if (this.manageSocket) return this.configuration.websocketProvider.disconnect();
|
|
4512
|
-
console.warn("HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.");
|
|
4513
|
-
}
|
|
4514
|
-
async onOpen(e) {
|
|
4515
|
-
this.isAuthenticated = !1, this.emit("open", { event: e }), await this.sendToken(), this.startSync();
|
|
4516
|
-
}
|
|
4517
|
-
async getToken() {
|
|
4518
|
-
return typeof this.configuration.token == "function" ? await this.configuration.token() : this.configuration.token;
|
|
4519
|
-
}
|
|
4520
|
-
startSync() {
|
|
4521
|
-
this.resetUnsyncedChanges(), this.send(Zs, {
|
|
4522
|
-
document: this.document,
|
|
4523
|
-
documentName: this.effectiveName
|
|
4524
|
-
}), this.awareness && this.awareness.getLocalState() !== null && this.send(Ys, {
|
|
4525
|
-
awareness: this.awareness,
|
|
4526
|
-
clients: [this.document.clientID],
|
|
4527
|
-
documentName: this.effectiveName
|
|
4528
|
-
});
|
|
4529
|
-
}
|
|
4530
|
-
send(e, t) {
|
|
4531
|
-
if (!this._isAttached) return;
|
|
4532
|
-
let n = new Ks(e, t);
|
|
4533
|
-
this.emit("outgoingMessage", { message: n.message }), n.send(this.configuration.websocketProvider);
|
|
4534
|
-
}
|
|
4535
|
-
onMessage(e) {
|
|
4536
|
-
let t = new Vs(e.data), { documentName: n } = Ds(t.readVarString());
|
|
4537
|
-
t.writeVarString(this.effectiveName), this.emit("message", {
|
|
4538
|
-
event: e,
|
|
4539
|
-
message: new Vs(e.data)
|
|
4540
|
-
}), new Gs(t).apply(this, !0);
|
|
4541
|
-
}
|
|
4542
|
-
onClose() {
|
|
4543
|
-
this.isAuthenticated = !1, this.synced = !1, this.flushTimeout !== null && (clearTimeout(this.flushTimeout), this.flushTimeout = null), this.pendingUpdates = [], this.pendingAwarenessClients.clear(), this.awareness && os(this.awareness, Array.from(this.awareness.getStates().keys()).filter((e) => e !== this.document.clientID), this);
|
|
4544
|
-
}
|
|
4545
|
-
destroy() {
|
|
4546
|
-
this.emit("destroy"), this.intervals.forceSync && clearInterval(this.intervals.forceSync), this.awareness && (os(this.awareness, [this.document.clientID], "provider destroy"), this.awareness.off("update", this.boundAwarenessUpdateHandler), this.awareness.destroy()), this.flushPendingUpdates(), this.document.off("update", this.boundDocumentUpdateHandler), this.removeAllListeners(), this.detach(), this.manageSocket && this.configuration.websocketProvider.destroy(), !(typeof window > "u" || !("removeEventListener" in window)) && window.removeEventListener("pagehide", this.boundPageHide);
|
|
4547
|
-
}
|
|
4548
|
-
detach() {
|
|
4549
|
-
this.configuration.websocketProvider.off("connect", this.configuration.onConnect), this.configuration.websocketProvider.off("connect", this.forwardConnect), this.configuration.websocketProvider.off("status", this.forwardStatus), this.configuration.websocketProvider.off("status", this.configuration.onStatus), this.configuration.websocketProvider.off("open", this.boundOnOpen), this.configuration.websocketProvider.off("close", this.boundOnClose), this.configuration.websocketProvider.off("close", this.configuration.onClose), this.configuration.websocketProvider.off("close", this.forwardClose), this.configuration.websocketProvider.off("disconnect", this.configuration.onDisconnect), this.configuration.websocketProvider.off("disconnect", this.forwardDisconnect), this.configuration.websocketProvider.off("destroy", this.configuration.onDestroy), this.configuration.websocketProvider.off("destroy", this.forwardDestroy), this.configuration.websocketProvider.detach(this), this._isAttached = !1;
|
|
4550
|
-
}
|
|
4551
|
-
attach() {
|
|
4552
|
-
this._isAttached ||= (this.configuration.websocketProvider.on("connect", this.configuration.onConnect), this.configuration.websocketProvider.on("connect", this.forwardConnect), this.configuration.websocketProvider.on("status", this.configuration.onStatus), this.configuration.websocketProvider.on("status", this.forwardStatus), this.configuration.websocketProvider.on("open", this.boundOnOpen), this.configuration.websocketProvider.on("close", this.boundOnClose), this.configuration.websocketProvider.on("close", this.configuration.onClose), this.configuration.websocketProvider.on("close", this.forwardClose), this.configuration.websocketProvider.on("disconnect", this.configuration.onDisconnect), this.configuration.websocketProvider.on("disconnect", this.forwardDisconnect), this.configuration.websocketProvider.on("destroy", this.configuration.onDestroy), this.configuration.websocketProvider.on("destroy", this.forwardDestroy), this.configuration.websocketProvider.attach(this), !0);
|
|
4553
|
-
}
|
|
4554
|
-
permissionDeniedHandler(e) {
|
|
4555
|
-
this.emit("authenticationFailed", { reason: e }), this.isAuthenticated = !1;
|
|
4556
|
-
}
|
|
4557
|
-
authenticatedHandler(e) {
|
|
4558
|
-
this.isAuthenticated = !0, this.authorizedScope = e, this.emit("authenticated", { scope: e });
|
|
4559
|
-
}
|
|
4560
|
-
setAwarenessField(e, t) {
|
|
4561
|
-
if (!this.awareness) throw new $s(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);
|
|
4562
|
-
this.awareness.setLocalStateField(e, t);
|
|
4563
|
-
}
|
|
4564
|
-
};
|
|
4565
|
-
//#endregion
|
|
4566
|
-
export { vi as A, jt as B, I as C, ii as D, Ai as E, wa as F, C as G, _t as H, or as I, a as J, m as K, P as L, yi as M, Dr as N, ui as O, ji as P, Ht as R, Nr as S, Ti as T, ot as U, xt as V, S as W, n as X, e as Y, yo as _, K as a, Oi as b, zr as c, ki as d, Qi as f, fo as g, mo as h, ls as i, kr as j, R as k, Y as l, co as m, bs as n, q as o, Ga as p, re as q, fs as r, J as s, ec as t, bi as u, ti as v, xi as w, Di as x, ei as y, Bt as z };
|