@xwiki/cristal-electron-renderer 1.3.0 → 1.4.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/package.json +17 -17
- package/dist/AttachmentPreview-DNQ6Ebkw.css +0 -1
- package/dist/AttachmentPreview-DmcUO34d.js +0 -2
- package/dist/AttachmentPreview-DmcUO34d.js.map +0 -1
- package/dist/AuthServiceBanner-BArubXdu.css +0 -1
- package/dist/AuthServiceBanner-ChdElfqx.js +0 -2
- package/dist/AuthServiceBanner-ChdElfqx.js.map +0 -1
- package/dist/DeletePage-ttlY0HjN.js +0 -2
- package/dist/DeletePage-ttlY0HjN.js.map +0 -1
- package/dist/GitHubLoginMenu-Csiodp6I.js +0 -2
- package/dist/GitHubLoginMenu-Csiodp6I.js.map +0 -1
- package/dist/LoggedInMenu-DWOuONhZ.js +0 -2
- package/dist/LoggedInMenu-DWOuONhZ.js.map +0 -1
- package/dist/LoginMenu-Bwz_qtz_.js +0 -2
- package/dist/LoginMenu-Bwz_qtz_.js.map +0 -1
- package/dist/MovePage-B-6I8pRk.js +0 -2
- package/dist/MovePage-B-6I8pRk.js.map +0 -1
- package/dist/MovePage-BHS998Jm.css +0 -1
- package/dist/NextcloudLoginMenu-DGCgMCya.css +0 -1
- package/dist/NextcloudLoginMenu-DxWXKyFo.js +0 -2
- package/dist/NextcloudLoginMenu-DxWXKyFo.js.map +0 -1
- package/dist/RenamePage-Db1fLUHy.js +0 -2
- package/dist/RenamePage-Db1fLUHy.js.map +0 -1
- package/dist/SettingsConfigurations-B9GWI5mw.css +0 -1
- package/dist/SettingsConfigurations-DKf33rjI.js +0 -2
- package/dist/SettingsConfigurations-DKf33rjI.js.map +0 -1
- package/dist/c-config-menu-BGV5XXU8.css +0 -1
- package/dist/c-config-menu-CmcdRZXV.js +0 -2
- package/dist/c-config-menu-CmcdRZXV.js.map +0 -1
- package/dist/c-edit-blocknote-DwSRLR1x.js +0 -259
- package/dist/c-edit-blocknote-DwSRLR1x.js.map +0 -1
- package/dist/c-edit-blocknote-xpE8qhtQ.css +0 -1
- package/dist/chunk.24ZZSBUF-BmQPh48m.js +0 -89
- package/dist/chunk.24ZZSBUF-BmQPh48m.js.map +0 -1
- package/dist/chunk.36O46B5H-Cv2poSyf.js +0 -64
- package/dist/chunk.36O46B5H-Cv2poSyf.js.map +0 -1
- package/dist/chunk.3LWOA5DF-D8Va5Pmw.js +0 -77
- package/dist/chunk.3LWOA5DF-D8Va5Pmw.js.map +0 -1
- package/dist/chunk.3RPBFEDE-DI7eSlIl.js +0 -2
- package/dist/chunk.3RPBFEDE-DI7eSlIl.js.map +0 -1
- package/dist/chunk.4TUIT776-BvlNwMXD.js +0 -18
- package/dist/chunk.4TUIT776-BvlNwMXD.js.map +0 -1
- package/dist/chunk.6CTB5ZDJ-9Su7bEUQ.js +0 -2
- package/dist/chunk.6CTB5ZDJ-9Su7bEUQ.js.map +0 -1
- package/dist/chunk.7E4JTYWU-Ci99jpyG.js +0 -75
- package/dist/chunk.7E4JTYWU-Ci99jpyG.js.map +0 -1
- package/dist/chunk.AJ3ENQ5C-zot94vv9.js +0 -2
- package/dist/chunk.AJ3ENQ5C-zot94vv9.js.map +0 -1
- package/dist/chunk.B4BZKR24-B0iVuGLD.js +0 -2
- package/dist/chunk.B4BZKR24-B0iVuGLD.js.map +0 -1
- package/dist/chunk.D5YQDJ7X-_UyNui_V.js +0 -2
- package/dist/chunk.D5YQDJ7X-_UyNui_V.js.map +0 -1
- package/dist/chunk.DFHYNK3F-bS0lNIuO.js +0 -86
- package/dist/chunk.DFHYNK3F-bS0lNIuO.js.map +0 -1
- package/dist/chunk.GMYPQTFK-BT1AAYXJ.js +0 -2
- package/dist/chunk.GMYPQTFK-BT1AAYXJ.js.map +0 -1
- package/dist/chunk.J5ZM7LIC-n6gjp3-L.js +0 -244
- package/dist/chunk.J5ZM7LIC-n6gjp3-L.js.map +0 -1
- package/dist/chunk.JCXLDPQF-BOaK9AtU.js +0 -622
- package/dist/chunk.JCXLDPQF-BOaK9AtU.js.map +0 -1
- package/dist/chunk.JHOXTQXA-CWkZ1weQ.js +0 -24
- package/dist/chunk.JHOXTQXA-CWkZ1weQ.js.map +0 -1
- package/dist/chunk.JQBT7BOV-BKSO0Hfn.js +0 -3378
- package/dist/chunk.JQBT7BOV-BKSO0Hfn.js.map +0 -1
- package/dist/chunk.JXOKFADN-DpK3Q_uU.js +0 -785
- package/dist/chunk.JXOKFADN-DpK3Q_uU.js.map +0 -1
- package/dist/chunk.KPLQLAWP-DUYDfZ7-.js +0 -163
- package/dist/chunk.KPLQLAWP-DUYDfZ7-.js.map +0 -1
- package/dist/chunk.LD4M4QGE-cX1_6HT7.js +0 -2
- package/dist/chunk.LD4M4QGE-cX1_6HT7.js.map +0 -1
- package/dist/chunk.NYIIDP5N-AHr3eTN0.js +0 -2
- package/dist/chunk.NYIIDP5N-AHr3eTN0.js.map +0 -1
- package/dist/chunk.R45OWEVP-WMyXo-Fn.js +0 -181
- package/dist/chunk.R45OWEVP-WMyXo-Fn.js.map +0 -1
- package/dist/chunk.RWUUFNUL-BJhNq5wM.js +0 -2
- package/dist/chunk.RWUUFNUL-BJhNq5wM.js.map +0 -1
- package/dist/chunk.RY756JLP-BUknFjxa.js +0 -22
- package/dist/chunk.RY756JLP-BUknFjxa.js.map +0 -1
- package/dist/chunk.SI4ACBFK-BB831ml8.js +0 -58
- package/dist/chunk.SI4ACBFK-BB831ml8.js.map +0 -1
- package/dist/chunk.TRHSUYII-DFnBKJNh.js +0 -140
- package/dist/chunk.TRHSUYII-DFnBKJNh.js.map +0 -1
- package/dist/chunk.XA43ZQPC-maNlqVLX.js +0 -395
- package/dist/chunk.XA43ZQPC-maNlqVLX.js.map +0 -1
- package/dist/chunk.XSFJLY2D-ldEKWtxN.js +0 -178
- package/dist/chunk.XSFJLY2D-ldEKWtxN.js.map +0 -1
- package/dist/chunk.YHLNUJ7P-BGNuPG1R.js +0 -109
- package/dist/chunk.YHLNUJ7P-BGNuPG1R.js.map +0 -1
- package/dist/chunk.ZGGPD2XJ-DD1S3h7C.js +0 -2
- package/dist/chunk.ZGGPD2XJ-DD1S3h7C.js.map +0 -1
- package/dist/chunk.ZH2AND3P-CzagA8cz.js +0 -288
- package/dist/chunk.ZH2AND3P-CzagA8cz.js.map +0 -1
- package/dist/class-map-DmaCJs8c.js +0 -2
- package/dist/class-map-DmaCJs8c.js.map +0 -1
- package/dist/filesystem-internal-link-serializer-BOne-ZvI.js +0 -2
- package/dist/filesystem-internal-link-serializer-BOne-ZvI.js.map +0 -1
- package/dist/floating-ui.dom-1S43Ew4Q.js +0 -2
- package/dist/floating-ui.dom-1S43Ew4Q.js.map +0 -1
- package/dist/github-CGNzogjY.js +0 -3
- package/dist/github-CGNzogjY.js.map +0 -1
- package/dist/github-internal-link-serializer-BGkdMYJI.js +0 -2
- package/dist/github-internal-link-serializer-BGkdMYJI.js.map +0 -1
- package/dist/hocuspocus-provider.esm-DpwNtHpL.js +0 -2
- package/dist/hocuspocus-provider.esm-DpwNtHpL.js.map +0 -1
- package/dist/if-defined-O-hFrvt0.js +0 -2
- package/dist/if-defined-O-hFrvt0.js.map +0 -1
- package/dist/index-B7HOg_tC.js +0 -254
- package/dist/index-B7HOg_tC.js.map +0 -1
- package/dist/index-BgL5UHSB.css +0 -1
- package/dist/index-DTmXfR9q.js +0 -3
- package/dist/index-DTmXfR9q.js.map +0 -1
- package/dist/index-DWPjg9z3.js +0 -2
- package/dist/index-DWPjg9z3.js.map +0 -1
- package/dist/index.html +0 -13
- package/dist/live-z5w0O4st.js +0 -2
- package/dist/live-z5w0O4st.js.map +0 -1
- package/dist/module-RjUF93sV.js +0 -717
- package/dist/module-RjUF93sV.js.map +0 -1
- package/dist/native-48B9X9Wg.js +0 -2
- package/dist/native-48B9X9Wg.js.map +0 -1
- package/dist/nextcloud-CQ2JbCvQ.js +0 -31
- package/dist/nextcloud-CQ2JbCvQ.js.map +0 -1
- package/dist/nextcloud-internal-link-serializer-qLagTAdg.js +0 -7
- package/dist/nextcloud-internal-link-serializer-qLagTAdg.js.map +0 -1
- package/dist/offline-lGzDTw-r.js +0 -4
- package/dist/offline-lGzDTw-r.js.map +0 -1
- package/dist/query-x48B6FB_.js +0 -2
- package/dist/query-x48B6FB_.js.map +0 -1
- package/dist/shoelace-fOJMLOCp.js +0 -3
- package/dist/shoelace-fOJMLOCp.js.map +0 -1
- package/dist/static-Dm20cmTz.js +0 -3
- package/dist/static-Dm20cmTz.js.map +0 -1
- package/dist/staticBuild-BOgweg16.js +0 -2
- package/dist/staticBuild-BOgweg16.js.map +0 -1
- package/dist/translations-D5nOIu3x.js +0 -2
- package/dist/translations-D5nOIu3x.js.map +0 -1
- package/dist/translations-Ds9OkLNv.js +0 -2
- package/dist/translations-Ds9OkLNv.js.map +0 -1
- package/dist/vuetify-CJV1Jf0o.js +0 -21
- package/dist/vuetify-CJV1Jf0o.js.map +0 -1
- package/dist/vuetify-yTaAqVoQ.css +0 -1
- package/dist/worker-C267fLfn.js +0 -202
- package/dist/worker-C267fLfn.js.map +0 -1
- package/dist/x-alert-BhErtBtU.css +0 -1
- package/dist/x-alert-Bo-c4sd8.js +0 -2
- package/dist/x-alert-Bo-c4sd8.js.map +0 -1
- package/dist/x-alert-DfYpLdml.css +0 -1
- package/dist/x-alert-iPDEBtQL.js +0 -2
- package/dist/x-alert-iPDEBtQL.js.map +0 -1
- package/dist/x-avatar-2efH4gNX.css +0 -1
- package/dist/x-avatar-CBx0PT77.js +0 -2
- package/dist/x-avatar-CBx0PT77.js.map +0 -1
- package/dist/x-avatar-Do0uzcGf.js +0 -2
- package/dist/x-avatar-Do0uzcGf.js.map +0 -1
- package/dist/x-breadcrumb-BMSNlvvi.css +0 -1
- package/dist/x-breadcrumb-HTdiGdCL.js +0 -2
- package/dist/x-breadcrumb-HTdiGdCL.js.map +0 -1
- package/dist/x-breadcrumb-zrKcaFfC.js +0 -2
- package/dist/x-breadcrumb-zrKcaFfC.js.map +0 -1
- package/dist/x-btn-C6CLTqa7.js +0 -2
- package/dist/x-btn-C6CLTqa7.js.map +0 -1
- package/dist/x-btn-DPGq6Sd-.css +0 -1
- package/dist/x-btn-TXMfg-5G.js +0 -2
- package/dist/x-btn-TXMfg-5G.js.map +0 -1
- package/dist/x-btn.vue_vue_type_script_setup_true_lang-CARXp5Xp.js +0 -2
- package/dist/x-btn.vue_vue_type_script_setup_true_lang-CARXp5Xp.js.map +0 -1
- package/dist/x-card-CJQtO6wd.js +0 -2
- package/dist/x-card-CJQtO6wd.js.map +0 -1
- package/dist/x-card-DZkGTPkV.js +0 -2
- package/dist/x-card-DZkGTPkV.js.map +0 -1
- package/dist/x-checkbox-BoqoQxdA.css +0 -1
- package/dist/x-checkbox-COxu3htb.js +0 -2
- package/dist/x-checkbox-COxu3htb.js.map +0 -1
- package/dist/x-checkbox-DykPAWbI.js +0 -2
- package/dist/x-checkbox-DykPAWbI.js.map +0 -1
- package/dist/x-col-Cr4ppY2u.js +0 -2
- package/dist/x-col-Cr4ppY2u.js.map +0 -1
- package/dist/x-container-D1TcVPe4.js +0 -2
- package/dist/x-container-D1TcVPe4.js.map +0 -1
- package/dist/x-dialog-Bk9LE0HR.css +0 -1
- package/dist/x-dialog-DpDwSqtj.js +0 -2
- package/dist/x-dialog-DpDwSqtj.js.map +0 -1
- package/dist/x-dialog-VzzVz38L.css +0 -1
- package/dist/x-dialog-o95lWpug.js +0 -2
- package/dist/x-dialog-o95lWpug.js.map +0 -1
- package/dist/x-divider-BfvWE9xx.js +0 -2
- package/dist/x-divider-BfvWE9xx.js.map +0 -1
- package/dist/x-divider-CyQQBVg0.js +0 -2
- package/dist/x-divider-CyQQBVg0.js.map +0 -1
- package/dist/x-dropdown-BPYmh0ED.js +0 -2
- package/dist/x-dropdown-BPYmh0ED.js.map +0 -1
- package/dist/x-dropdown-C0eWLs8m.js +0 -2
- package/dist/x-dropdown-C0eWLs8m.js.map +0 -1
- package/dist/x-dropdown-CxWpPIwn.css +0 -1
- package/dist/x-dropdown-GNs7ILlc.css +0 -1
- package/dist/x-file-input-BSstA5LD.css +0 -1
- package/dist/x-file-input-C3zWnjnM.js +0 -2
- package/dist/x-file-input-C3zWnjnM.js.map +0 -1
- package/dist/x-file-input-I5f_Xur8.js +0 -2
- package/dist/x-file-input-I5f_Xur8.js.map +0 -1
- package/dist/x-form-CK24VrXN.css +0 -1
- package/dist/x-form-CUJhQDpC.js +0 -2
- package/dist/x-form-CUJhQDpC.js.map +0 -1
- package/dist/x-form-DGUS5Veh.css +0 -1
- package/dist/x-form-DvYxiGYI.js +0 -2
- package/dist/x-form-DvYxiGYI.js.map +0 -1
- package/dist/x-img-B3bwcipR.js +0 -2
- package/dist/x-img-B3bwcipR.js.map +0 -1
- package/dist/x-img-Bmlsvg1a.js +0 -2
- package/dist/x-img-Bmlsvg1a.js.map +0 -1
- package/dist/x-load-BlPeW_ej.css +0 -1
- package/dist/x-load-BsACA7Yh.css +0 -1
- package/dist/x-load-CBeg_T3j.js +0 -2
- package/dist/x-load-CBeg_T3j.js.map +0 -1
- package/dist/x-load-DP6QIpju.js +0 -2
- package/dist/x-load-DP6QIpju.js.map +0 -1
- package/dist/x-menu-BmuGyRjl.css +0 -1
- package/dist/x-menu-fzYlqJyV.js +0 -2
- package/dist/x-menu-fzYlqJyV.js.map +0 -1
- package/dist/x-menu-item-CTnQPDyU.js +0 -2
- package/dist/x-menu-item-CTnQPDyU.js.map +0 -1
- package/dist/x-menu-item-DLbqVWzS.js +0 -2
- package/dist/x-menu-item-DLbqVWzS.js.map +0 -1
- package/dist/x-menu-j6yX563A.js +0 -2
- package/dist/x-menu-j6yX563A.js.map +0 -1
- package/dist/x-menu-label-BLmtnk8J.js +0 -2
- package/dist/x-menu-label-BLmtnk8J.js.map +0 -1
- package/dist/x-menu-label-DXnUzNu1.js +0 -2
- package/dist/x-menu-label-DXnUzNu1.js.map +0 -1
- package/dist/x-menu-label-DhRAj-fk.css +0 -1
- package/dist/x-row-Cr4ppY2u.js +0 -2
- package/dist/x-row-Cr4ppY2u.js.map +0 -1
- package/dist/x-search-B99zXUrg.js +0 -2
- package/dist/x-search-B99zXUrg.js.map +0 -1
- package/dist/x-search-CVyiz17E.js +0 -2
- package/dist/x-search-CVyiz17E.js.map +0 -1
- package/dist/x-select-DpGG8AuD.js +0 -2
- package/dist/x-select-DpGG8AuD.js.map +0 -1
- package/dist/x-select-DrHr7Shp.js +0 -2
- package/dist/x-select-DrHr7Shp.js.map +0 -1
- package/dist/x-tab-c-e3rymA.js +0 -2
- package/dist/x-tab-c-e3rymA.js.map +0 -1
- package/dist/x-tab-grZhQqAi.js +0 -2
- package/dist/x-tab-grZhQqAi.js.map +0 -1
- package/dist/x-tab-group-BwvoSXDb.js +0 -2
- package/dist/x-tab-group-BwvoSXDb.js.map +0 -1
- package/dist/x-tab-group-DKKRxIP0.js +0 -2
- package/dist/x-tab-group-DKKRxIP0.js.map +0 -1
- package/dist/x-tab-panel-BkaSuvQL.js +0 -2
- package/dist/x-tab-panel-BkaSuvQL.js.map +0 -1
- package/dist/x-tab-panel-DIMNu54Y.js +0 -2
- package/dist/x-tab-panel-DIMNu54Y.js.map +0 -1
- package/dist/x-text-field-BdKCeID0.js +0 -2
- package/dist/x-text-field-BdKCeID0.js.map +0 -1
- package/dist/x-text-field-C8txfmgG.js +0 -2
- package/dist/x-text-field-C8txfmgG.js.map +0 -1
- package/dist/x-tree-Ct89gjKs.js +0 -2
- package/dist/x-tree-Ct89gjKs.js.map +0 -1
- package/dist/x-tree-D0WG-8EM.css +0 -1
- package/dist/x-tree-DZgepjwE.js +0 -2
- package/dist/x-tree-DZgepjwE.js.map +0 -1
- package/dist/x-tree-OLo4IKf9.css +0 -1
- package/dist/xwiki-OgNiU9fx.js +0 -4
- package/dist/xwiki-OgNiU9fx.js.map +0 -1
- package/dist/xwiki-internal-link-serializer-Cd8xorru-BvcqTQNz.js +0 -2
- package/dist/xwiki-internal-link-serializer-Cd8xorru-BvcqTQNz.js.map +0 -1
- package/dist/xwiki-logo-color-D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AAE,CAAC,GAAK,EAEnC,CAEA,iBACEtD,EACAyD,EACAC,EACe,CAEf,OAAOC,EAAyB3D,EAAM0D,CAAe,CACvD,CACF,EAnIMb,EAANrD,GAAA,CADCC,EAAA,EAGIC,MAAO,QAAQ,GACfA,MAAO,YAAY,GACnBA,MAAO,+BAA+B,GAEtCA,MAAO,yBAAyB,GAEhCA,MAAO,kCAAkC,IARxCmD,CAAA,EAwIC,IAAAe,GAAA,KAAoB,CACzB,YAAYhE,EAAsB,CAChCA,EACG,KAA2BiE,CAAwB,EACnD,GAAGhB,CAA0B,EAC7B,mBACA,UAAU,QAAQ,CACvB,CACF,EC/JO,MAAMiB,EAAc,CACzB,YAAYlE,EAAsB,CAChC,MAAMS,EAAO,WACbT,EACG,KACC,oCAED,UAAWmE,GACH,SAAY,CACjB,MAAMC,GAAa,MAAA1E,EAAA,6CAAA2E,CAAA,OAAM,QAAO,+CAAmC,sCAAAA,CAAA,8CAChE,6BACH,OAAOC,GAAYtE,EAAWS,EAAM2D,EAAWD,CAAO,CACxD,CACD,EACA,UAAU1D,CAAI,CACnB,CACF,CAUA,SAAS6D,GACPtE,EACAS,EACA2D,EACAD,EACA,CACA,OAAKnE,EAAU,QAAQ,0BAA2B,CAAE,KAAAS,CAAA,CAAY,GAC9DT,EACG,KAA8B,yBAAyB,EACvD,GAAGoE,CAAS,EACZ,UAAU3D,CAAI,EAEZ0D,EAAQ,IAA6B,0BAA2B,CACrE,KAAA1D,CAAA,CACD,CACH,CCtCO,SAAS8D,GAAKvE,EAAsB,CACzC,IAAIwE,EAAoCxE,CAAS,EACjD,IAAIyE,EAAiCzE,CAAS,EAC9C,IAAI0E,GAAkC1E,CAAS,EAC/C,IAAI2E,EAA+B3E,CAAS,EAC5C,IAAI4E,EAAkC5E,CAAS,EAC/C,IAAI6E,GAAkC7E,CAAS,EAC/C,IAAI8E,GAAkC9E,CAAS,CACjD","names":["GitHubLoginMenuUIExtension","authenticationManager","__vitePreload","__vite_default__","__decorateClass","injectable","__decorateParam","ComponentInit$6","container","GitHubPageHierarchyResolver","logger","cristalApp","page","includeHomePage","hierarchy","getPageHierarchyFromPath","ComponentInit$5","name","GitHubPageRevisionManager","alertsService","authenticationManagerProvider","pageData","revisions","currentId","authorization","headers","historyRequestUrl","jsonResponse","commit","error","ComponentInit$4","PageRevisionManagerName","GitHubModelReferenceParser","reference","options","segments","EntityType","AttachmentReference","DocumentReference","SpaceReference","GitHubModelReferenceSerializer","type","SPACE","ATTACHMENT","DOCUMENT","WIKI","spaces","ComponentInit$3","GitHubRemoteURLParser","urlStr","baseURL","baseRestURL","documentReferenceName","file","GitHubRemoteURLSerializer","attachmentReference","ComponentInit$2","GitHubNavigationTreeSource","remoteURLParserProvider","modelReferenceSerializerProvider","id","navigationTree","input","treeNode","parse","currentPageData","it","n","names","_includeTerminal","includeRootNode","getParentNodesIdFromPath","ComponentInit$1","NavigationTreeSourceName","ComponentInit","context","component","GitHubInternalLinkSerializer","bindAndLoad","load","GitHubAuthenticationUIComponentInit","GitHubPageHierarchyComponentInit","GitHubNavigationTreeComponentInit","GitHubPageHistoryComponentInit","ModelReferenceGitHubComponentInit","ModelRemoteURLGitHubComponentInit","UniASTMarkdownGitHubComponentInit"],"ignoreList":[],"sources":["../../../core/authentication/authentication-github-ui/src/GitHubLoginMenuUIExtension.ts","../../../core/authentication/authentication-github-ui/src/index.ts","../../../core/hierarchy/hierarchy-github/src/components/componentsInit.ts","../../../core/history/history-github/src/components/componentsInit.ts","../../../core/history/history-github/src/index.ts","../../../core/model/model-reference/model-reference-github/src/gitHubModelReferenceParser.ts","../../../core/model/model-reference/model-reference-github/src/gitHubModelReferenceSerializer.ts","../../../core/model/model-reference/model-reference-github/src/componentInit.ts","../../../core/model/model-remote-url/model-remote-url-github/src/gitHubRemoteURLParser.ts","../../../core/model/model-remote-url/model-remote-url-github/src/gitHubRemoteURLSerializer.ts","../../../core/model/model-remote-url/model-remote-url-github/src/componentInit.ts","../../../core/navigation-tree/navigation-tree-github/src/components/componentsInit.ts","../../../core/uniast/uniast-markdown-github/src/index.ts","../../../lib/src/default/github.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\nimport type {\n AuthenticationManager,\n AuthenticationManagerProvider,\n} from \"@xwiki/platform-authentication-api\";\nimport type { Component } from \"vue\";\n\n/**\n * Login {@link UIExtension} for the GitHub backend.\n *\n * @since 0.15\n * @beta\n */\n@injectable()\nexport class GitHubLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.githubLoginMenu\";\n uixpName = \"sidebar.actions\";\n order = 2100;\n parameters = {};\n\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManager: AuthenticationManagerProvider,\n ) {}\n\n async component(): Promise<Component> {\n return (await import(\"./vue/GitHubLoginMenu.vue\")).default;\n }\n\n async enabled(): Promise<boolean> {\n const authenticationManager: AuthenticationManager =\n this.authenticationManager.get()!;\n const authenticated: boolean =\n await authenticationManager?.isAuthenticated();\n return !authenticated;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubLoginMenuUIExtension } from \"./GitHubLoginMenuUIExtension\";\nimport { Container } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<UIExtension>(\"UIExtension\")\n .to(GitHubLoginMenuUIExtension)\n .inSingletonScope();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { name } from \"@xwiki/cristal-hierarchy-api\";\nimport { getPageHierarchyFromPath } from \"@xwiki/cristal-hierarchy-default\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type {\n PageHierarchyItem,\n PageHierarchyResolver,\n} from \"@xwiki/cristal-hierarchy-api\";\nimport type { CristalApp, Logger } from \"@xwiki/platform-api\";\nimport type {\n DocumentReference,\n SpaceReference,\n} from \"@xwiki/platform-model-api\";\n\n/**\n * Implementation of PageHierarchyResolver for the GitHub backend.\n *\n * @since 0.9\n * @beta\n **/\n@injectable()\nclass GitHubPageHierarchyResolver implements PageHierarchyResolver {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.FileSystemPageHierarchyResolver\");\n this.cristalApp = cristalApp;\n }\n\n async getPageHierarchy(\n page: DocumentReference | SpaceReference,\n includeHomePage: boolean = true,\n ): Promise<Array<PageHierarchyItem>> {\n const hierarchy: Array<PageHierarchyItem> = includeHomePage\n ? [\n {\n label: \"Home\",\n pageId: this.cristalApp.getWikiConfig().homePage,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: { page: this.cristalApp.getWikiConfig().homePage },\n }).href,\n },\n ]\n : [];\n if (page != null) {\n hierarchy.push(\n ...(await getPageHierarchyFromPath(page, this.cristalApp)),\n );\n }\n return hierarchy;\n }\n}\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<PageHierarchyResolver>(name)\n .to(GitHubPageHierarchyResolver)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type { AlertsService } from \"@xwiki/cristal-alerts-api\";\nimport type {\n PageRevision,\n PageRevisionManager,\n} from \"@xwiki/cristal-history-api\";\nimport type { CristalApp, Logger, PageData } from \"@xwiki/platform-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/platform-authentication-api\";\n\n/**\n * Implementation of PageRevisionManager for the GitHub backend.\n *\n * @since 0.12\n * @beta\n **/\n@injectable()\nclass GitHubPageRevisionManager implements PageRevisionManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"AlertsService\")\n private readonly alertsService: AlertsService,\n @inject(\"AuthenticationManagerProvider\")\n private readonly authenticationManagerProvider: AuthenticationManagerProvider,\n ) {\n this.logger.setModule(\"history-github.GitHubPageRevisionManager\");\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getRevisions(pageData: PageData): Promise<Array<PageRevision>> {\n const revisions: Array<PageRevision> = [];\n if (pageData) {\n const currentId = pageData.id;\n\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/vnd.github+json\",\n };\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n const historyRequestUrl = new URL(\n `${this.cristalApp.getWikiConfig().baseRestURL}/commits`,\n );\n historyRequestUrl.search = new URLSearchParams([\n [\"path\", `${currentId}.md`],\n ]).toString();\n\n try {\n const response = await fetch(historyRequestUrl, {\n headers: headers,\n });\n const jsonResponse: Array<{\n sha: string;\n commit: { author: { name: string; date: string }; message: string };\n author: { avatar_url: string; html_url: string };\n }> = await response.json();\n for (const commit of jsonResponse) {\n revisions.push({\n version: commit.sha.slice(0, 7),\n date: new Date(commit.commit.author.date),\n user: {\n profile: commit.author.html_url,\n name: commit.commit.author.name,\n },\n comment: commit.commit.message,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: currentId,\n revision: commit.sha.slice(0, 7),\n },\n }).href,\n });\n }\n } catch (error) {\n this.logger.error(error);\n this.alertsService.error(\n `Could not load page history for ${pageData.name}.`,\n );\n }\n }\n return revisions;\n }\n}\n\nexport { GitHubPageRevisionManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubPageRevisionManager } from \"./components/componentsInit\";\nimport { name as PageRevisionManagerName } from \"@xwiki/cristal-history-api\";\nimport type { PageRevisionManager } from \"@xwiki/cristal-history-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<PageRevisionManager>(PageRevisionManagerName)\n .to(GitHubPageRevisionManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n }\n}\n\nexport { ComponentInit };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n AttachmentReference,\n DocumentReference,\n EntityType,\n SpaceReference,\n} from \"@xwiki/platform-model-api\";\nimport { injectable } from \"inversify\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type {\n ModelReferenceParser,\n ModelReferenceParserOptions,\n} from \"@xwiki/platform-model-reference-api\";\n\n@injectable()\nexport class GitHubModelReferenceParser implements ModelReferenceParser {\n parse(\n reference: string,\n options?: ModelReferenceParserOptions,\n ): EntityReference {\n if (/^https?:\\/\\//.test(reference)) {\n throw new Error(`[${reference}] is not a valid entity reference`);\n }\n let segments = reference.split(\"/\");\n if (segments[0] == \"\") {\n segments = segments.slice(1);\n }\n if (options?.type === EntityType.ATTACHMENT) {\n return new AttachmentReference(\n segments[segments.length - 1],\n this.buildDocumentReference(segments.slice(0, segments.length - 2)),\n );\n } else {\n return this.buildDocumentReference(segments);\n }\n }\n\n async parseAsync(\n reference: string,\n options?: ModelReferenceParserOptions,\n ): Promise<EntityReference> {\n return this.parse(reference, options);\n }\n\n private buildDocumentReference(segments: string[]) {\n return new DocumentReference(\n segments[segments.length - 1],\n new SpaceReference(undefined, ...segments.slice(0, segments.length - 1)),\n );\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { EntityType } from \"@xwiki/platform-model-api\";\nimport { injectable } from \"inversify\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type { ModelReferenceSerializer } from \"@xwiki/platform-model-reference-api\";\n\n@injectable()\nexport class GitHubModelReferenceSerializer implements ModelReferenceSerializer {\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n serialize(reference?: EntityReference): string | undefined {\n if (!reference) {\n return undefined;\n }\n const type = reference.type;\n const { SPACE, ATTACHMENT, DOCUMENT, WIKI } = EntityType;\n switch (type) {\n case WIKI:\n throw new Error(\"Wiki currently not supported from GitHub\");\n case SPACE: {\n return reference.names.join(\"/\");\n }\n case DOCUMENT: {\n const spaces = this.serialize(reference.space);\n const name = reference.name;\n if (spaces === undefined || spaces == \"\") {\n return name;\n } else {\n return `${spaces}/${name}`;\n }\n }\n case ATTACHMENT: {\n return this.serialize(reference.document) + \"/\" + reference.name;\n }\n default:\n throw new Error(`Unknown reference type [${type}]`);\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubModelReferenceParser } from \"./gitHubModelReferenceParser\";\nimport { GitHubModelReferenceSerializer } from \"./gitHubModelReferenceSerializer\";\nimport type {\n ModelReferenceParser,\n ModelReferenceSerializer,\n} from \"@xwiki/platform-model-reference-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<ModelReferenceParser>(\"ModelReferenceParser\")\n .to(GitHubModelReferenceParser)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<ModelReferenceSerializer>(\"ModelReferenceSerializer\")\n .to(GitHubModelReferenceSerializer)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n AttachmentReference,\n DocumentReference,\n EntityType,\n SpaceReference,\n} from \"@xwiki/platform-model-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type { RemoteURLParser } from \"@xwiki/platform-model-remote-url-api\";\n\n@injectable()\nclass GitHubRemoteURLParser implements RemoteURLParser {\n constructor(@inject(\"CristalApp\") private readonly cristalApp: CristalApp) {}\n\n parse(urlStr: string, type?: EntityType): EntityReference | undefined {\n const baseURL = this.getWikiConfig().baseURL;\n const baseRestURL = this.getWikiConfig().baseRestURL;\n\n if (urlStr.includes(\"://\") && urlStr.startsWith(baseRestURL)) {\n return this.parseSpaceOrPage(urlStr, baseRestURL, type);\n } else if (urlStr.includes(\"://\") && urlStr.startsWith(baseURL)) {\n return this.parseAttachment(urlStr, baseURL);\n } else {\n return undefined;\n }\n }\n\n private parseAttachment(urlStr: string, baseURL: string) {\n const segments = this.computeSegments(urlStr.replace(`${baseURL}/`, \"\"));\n\n if (\n segments.length >= 3 &&\n segments[segments.length - 2] == \"attachments\"\n ) {\n return new AttachmentReference(\n decodeURIComponent(segments[segments.length - 1].split(\"?\")[0]),\n this.buildDocumentReference(\n segments[segments.length - 3].slice(1), // remove the starting dot\n segments.splice(0, segments.length - 3),\n ),\n );\n } else {\n return undefined;\n }\n }\n\n private parseSpaceOrPage(\n urlStr: string,\n baseRestURL: string,\n type:\n | EntityType\n | undefined\n | EntityType.WIKI\n | EntityType.SPACE\n | EntityType.ATTACHMENT,\n ) {\n const segments = this.computeSegments(\n urlStr.replace(`${baseRestURL}/contents/`, \"\").replace(/\\?.*/, \"\"),\n );\n\n if (type === EntityType.DOCUMENT || type === undefined) {\n return this.buildDocumentReference(\n segments[segments.length - 1],\n segments.splice(0, segments.length - 1),\n );\n } else if (type == EntityType.SPACE) {\n return new SpaceReference(undefined, ...segments);\n } else {\n return undefined;\n }\n }\n\n private computeSegments(urlStr: string) {\n let segments = decodeURIComponent(urlStr).split(\"/\");\n if (segments[0] === \"\" || segments[0] === \".\") {\n segments = segments.slice(1);\n }\n\n if (segments[segments.length - 1] === \"\") {\n segments = segments.slice(0, segments.length - 1);\n }\n return segments;\n }\n\n private buildDocumentReference(\n documentReferenceName: string,\n spaces: string[],\n ) {\n return new DocumentReference(\n decodeURIComponent(this.removeExtension(documentReferenceName)),\n spaces.length > 0\n ? new SpaceReference(undefined, ...spaces.map(decodeURIComponent))\n : undefined,\n );\n }\n\n private getWikiConfig() {\n return this.cristalApp.getWikiConfig();\n }\n\n private removeExtension(file: string): string {\n if (!file.includes(\".\")) {\n return file;\n }\n return file.slice(0, file.lastIndexOf(\".\"));\n }\n}\n\nexport { GitHubRemoteURLParser };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { AttachmentReference, EntityType } from \"@xwiki/platform-model-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type { RemoteURLSerializer } from \"@xwiki/platform-model-remote-url-api\";\n\n@injectable()\nclass GitHubRemoteURLSerializer implements RemoteURLSerializer {\n constructor(@inject(\"CristalApp\") private readonly cristalApp: CristalApp) {}\n\n serialize(reference?: EntityReference): string | undefined {\n if (!reference) {\n return undefined;\n }\n switch (reference.type) {\n case EntityType.WIKI:\n throw new Error(\"Not implemented\");\n case EntityType.SPACE: {\n const spaces = reference.names.join(\"/\");\n return `${this.getBaseRestURL()}/contents${spaces}`;\n }\n case EntityType.DOCUMENT: {\n const spaces = reference.space?.names.join(\"/\");\n return `${this.getBaseRestURL()}/contents${spaces}/${reference.name}`;\n }\n case EntityType.ATTACHMENT: {\n return this.serializeAttachmentReference(reference);\n }\n }\n }\n\n private serializeAttachmentReference(\n attachmentReference: AttachmentReference,\n ) {\n const segments = [\n ...(attachmentReference.document.space?.names ?? []),\n \".\" + attachmentReference.document.name,\n \"attachments\",\n attachmentReference.name,\n ]\n .map(encodeURIComponent)\n .join(\"/\");\n return `${this.getBaseURL()}/${segments}`;\n }\n\n private getBaseURL() {\n return this.cristalApp.getWikiConfig().baseURL;\n }\n\n private getBaseRestURL() {\n return this.cristalApp.getWikiConfig().baseRestURL;\n }\n}\n\nexport { GitHubRemoteURLSerializer };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubRemoteURLParser } from \"./gitHubRemoteURLParser\";\nimport { GitHubRemoteURLSerializer } from \"./gitHubRemoteURLSerializer\";\nimport { Container } from \"inversify\";\nimport type {\n RemoteURLParser,\n RemoteURLSerializer,\n} from \"@xwiki/platform-model-remote-url-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<RemoteURLParser>(\"RemoteURLParser\")\n .to(GitHubRemoteURLParser)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<RemoteURLSerializer>(\"RemoteURLSerializer\")\n .to(GitHubRemoteURLSerializer)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { getParentNodesIdFromPath } from \"@xwiki/cristal-navigation-tree-default\";\nimport { EntityType, SpaceReference } from \"@xwiki/platform-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/platform-navigation-tree-api\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/platform-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/platform-authentication-api\";\nimport type { DocumentReference } from \"@xwiki/platform-model-api\";\nimport type { ModelReferenceSerializerProvider } from \"@xwiki/platform-model-reference-api\";\nimport type { RemoteURLParserProvider } from \"@xwiki/platform-model-remote-url-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/platform-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the GitHub backend.\n *\n * @since 0.10\n * @beta\n **/\n@injectable()\nclass GitHubNavigationTreeSource implements NavigationTreeSource {\n constructor(\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private readonly authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParserProvider\")\n private readonly remoteURLParserProvider: RemoteURLParserProvider,\n @inject(\"ModelReferenceSerializerProvider\")\n private readonly modelReferenceSerializerProvider: ModelReferenceSerializerProvider,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-github.components.GitHubNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/vnd.github.raw+json\",\n };\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n try {\n const input = this.cristalApp\n .getWikiConfig()\n .storage.getPageRestURL(currentId, \"\");\n const response = await fetch(input, {\n headers: headers,\n });\n const jsonResponse = await response.json();\n navigationTree.push(\n ...(\n await Promise.all(\n jsonResponse.map(\n async (treeNode: {\n name: string;\n path: string;\n type: string;\n git_url: string;\n url: string;\n }): Promise<NavigationTreeNode | undefined> => {\n const parse = this.remoteURLParserProvider\n .get()!\n .parse(\n treeNode.url,\n treeNode.type === \"dir\"\n ? EntityType.SPACE\n : EntityType.DOCUMENT,\n );\n if (parse?.type === EntityType.DOCUMENT) {\n const modelReferenceSerializer =\n this.modelReferenceSerializerProvider.get()!;\n const page = modelReferenceSerializer.serialize(parse);\n if (!page) {\n throw new Error(\n `Could not serialize page [${treeNode.path}]`,\n );\n }\n const currentPageData = await this.cristalApp.getPage(page);\n return {\n id: page,\n label: this.computeLabel(currentPageData, parse, treeNode),\n location: new SpaceReference(\n parse.space?.wiki,\n ...(parse.space?.names ?? []),\n parse.name,\n ),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page,\n },\n }).href,\n has_children: jsonResponse.some(\n (it: { path: string; type: string }) =>\n it.path === page && it.type == \"dir\",\n ),\n is_terminal: false,\n };\n }\n },\n ),\n )\n ).filter((n: NavigationTreeNode) => n !== undefined),\n );\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n return navigationTree;\n }\n\n /**\n * @param names - a list of objects with a name property\n * @returns the first element that is not undefined with a name that is not undefined or the empty string\n */\n private computeLabel(\n ...names: (\n | {\n name: string | undefined;\n }\n | undefined\n )[]\n ): string {\n return (\n names\n .filter((it) => it?.name !== undefined && it.name !== \"\")\n .map((it) => it!.name)[0] ?? \"\"\n );\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // GitHub implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\n }\n}\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(GitHubNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\nimport type { InternalLinksSerializer } from \"@xwiki/platform-uniast-markdown\";\nimport type { Container, Factory, Newable, ResolutionContext } from \"inversify\";\n\n/**\n * @beta\n * @since 18.2.0RC1\n */\nexport class ComponentInit {\n constructor(container: Container) {\n const name = '\"GitHub\"';\n container\n .bind<Factory<Promise<InternalLinksSerializer>>>(\n \"Factory<InternalLinksSerializer>\",\n )\n .toFactory((context) => {\n return async () => {\n const component = (await import(\"./github-internal-link-serializer\"))\n .GitHubInternalLinkSerializer;\n return bindAndLoad(container, name, component, context);\n };\n })\n .whenNamed(name);\n }\n}\n\n/**\n * Register the component in the container on demand.\n *\n * @param container - the container\n * @param name - the name of the component interface\n * @param component - the actual component to register\n * @param context - the context\n */\nfunction bindAndLoad<T extends InternalLinksSerializer>(\n container: Container,\n name: string,\n component: Newable<T>,\n context: ResolutionContext,\n) {\n if (!container.isBound(\"InternalLinksSerializer\", { name: name })) {\n container\n .bind<InternalLinksSerializer>(\"InternalLinksSerializer\")\n .to(component)\n .whenNamed(name);\n }\n return context.get<InternalLinksSerializer>(\"InternalLinksSerializer\", {\n name: name,\n });\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { ComponentInit as GitHubAuthenticationUIComponentInit } from \"@xwiki/cristal-authentication-github-ui\";\nimport { ComponentInit as GitHubPageHierarchyComponentInit } from \"@xwiki/cristal-hierarchy-github\";\nimport { ComponentInit as GitHubPageHistoryComponentInit } from \"@xwiki/cristal-history-github\";\nimport { ComponentInit as ModelReferenceGitHubComponentInit } from \"@xwiki/cristal-model-reference-github\";\nimport { ComponentInit as ModelRemoteURLGitHubComponentInit } from \"@xwiki/cristal-model-remote-url-github\";\nimport { ComponentInit as GitHubNavigationTreeComponentInit } from \"@xwiki/cristal-navigation-tree-github\";\nimport { ComponentInit as UniASTMarkdownGitHubComponentInit } from \"@xwiki/cristal-uniast-markdown-github\";\nimport type { Container } from \"inversify\";\n\nexport function load(container: Container) {\n new GitHubAuthenticationUIComponentInit(container);\n new GitHubPageHierarchyComponentInit(container);\n new GitHubNavigationTreeComponentInit(container);\n new GitHubPageHistoryComponentInit(container);\n new ModelReferenceGitHubComponentInit(container);\n new ModelRemoteURLGitHubComponentInit(container);\n new UniASTMarkdownGitHubComponentInit(container);\n}\n"],"file":"github-CGNzogjY.js"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ah as o,a9 as p,ad as m}from"./index-B7HOg_tC.js";var l=Object.getOwnPropertyDescriptor,u=(e,r,n,t)=>{for(var c=t>1?void 0:t?l(r,n):r,a=e.length-1,s;a>=0;a--)(s=e[a])&&(c=s(c)||c);return c},f=(e,r)=>(n,t)=>r(n,t,e);let i=class{constructor(e){this.documentService=e}async serialize(e,r,n){const t=await n.convertInlineContents(e),c=this.computeRef(r);return`[${t}](${c})`}async serializeImage(e,r){const n=this.computeRef(e);return``}computeRef(e){if(e.parsedReference){const r=this.documentService.getCurrentDocumentReference().value;let n=e.parsedReference;const t=n.type===o.ATTACHMENT;if(t)n=n.document;else if(n.type!==o.DOCUMENT)throw new Error(`Unexpected type ${n.type} for link serialization`);const c=[...r.space&&r.space.names.length>0?r.space.names.map(()=>".."):["."]].join("/"),a=(t?".":"")+n.name,s=[...n.space?.names??[],a].map(encodeURI).join("/");return t?`${c}/${s}/attachments/${encodeURI(e.parsedReference.name)}`.replace(/^\.\//,""):`${c}/${s}.md`.replace(/^\.\//,"")}else return e.rawReference}};i=u([p(),f(0,m("DocumentService"))],i);export{i as GitHubInternalLinkSerializer};
|
|
2
|
-
//# sourceMappingURL=github-internal-link-serializer-BGkdMYJI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-internal-link-serializer-BGkdMYJI.js","sources":["../../../core/uniast/uniast-markdown-github/src/github-internal-link-serializer.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\nimport { AttachmentReference, EntityType } from \"@xwiki/platform-model-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { DocumentService } from \"@xwiki/platform-document-api\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type { Link, LinkTarget } from \"@xwiki/platform-uniast-api\";\nimport type {\n InternalLinksSerializer,\n UniAstToMarkdownConverter,\n} from \"@xwiki/platform-uniast-markdown\";\n\n/**\n * @since 1.2.0RC1\n */\n@injectable()\nexport class GitHubInternalLinkSerializer implements InternalLinksSerializer {\n constructor(\n @inject(\"DocumentService\")\n private readonly documentService: DocumentService,\n ) {}\n\n async serialize(\n content: Link[\"content\"],\n target: Extract<LinkTarget, { type: \"internal\" }>,\n uniAstToMarkdownConverter: UniAstToMarkdownConverter,\n ): Promise<string> {\n const label =\n await uniAstToMarkdownConverter.convertInlineContents(content);\n\n const ref = this.computeRef(target);\n return `[${label}](${ref})`;\n }\n\n async serializeImage(\n target: Extract<LinkTarget, { type: \"internal\" }>,\n alt?: string,\n ): Promise<string> {\n const ref = this.computeRef(target);\n return ``;\n }\n\n // eslint-disable-next-line max-statements\n private computeRef(\n target: Extract<\n {\n type: \"internal\";\n rawReference: string;\n parsedReference: EntityReference | null;\n },\n { type: \"internal\" }\n >,\n ) {\n if (target.parsedReference) {\n const currentDocumentReference =\n this.documentService.getCurrentDocumentReference().value!;\n let parsedReference = target.parsedReference;\n const isAttachment = parsedReference.type === EntityType.ATTACHMENT;\n if (isAttachment) {\n parsedReference = (parsedReference as AttachmentReference).document;\n } else if (parsedReference.type !== EntityType.DOCUMENT) {\n throw new Error(\n `Unexpected type ${parsedReference.type} for link serialization`,\n );\n }\n\n const down = [\n ...(currentDocumentReference.space &&\n currentDocumentReference.space.names.length > 0\n ? currentDocumentReference.space.names.map(() => \"..\")\n : [\".\"]),\n ].join(\"/\");\n\n const name = (isAttachment ? \".\" : \"\") + parsedReference.name;\n const up = [...(parsedReference.space?.names ?? []), name]\n .map(encodeURI)\n .join(\"/\");\n if (!isAttachment) {\n return `${down}/${up}.md`.replace(/^\\.\\//, \"\");\n } else {\n return `${down}/${up}/attachments/${encodeURI((target.parsedReference as AttachmentReference).name)}`.replace(\n /^\\.\\//,\n \"\",\n );\n }\n } else {\n return target.rawReference;\n }\n }\n}\n"],"names":["GitHubInternalLinkSerializer","documentService","content","target","uniAstToMarkdownConverter","label","ref","alt","currentDocumentReference","parsedReference","isAttachment","EntityType","down","name","up","__decorateClass","injectable","__decorateParam"],"mappings":"8NAiCO,IAAMA,EAAN,KAAsE,CAC3E,YAEmBC,EACjB,CADiB,KAAA,gBAAAA,CAChB,CAEH,MAAM,UACJC,EACAC,EACAC,EACiB,CACjB,MAAMC,EACJ,MAAMD,EAA0B,sBAAsBF,CAAO,EAEzDI,EAAM,KAAK,WAAWH,CAAM,EAClC,MAAO,IAAIE,CAAK,KAAKC,CAAG,GAC1B,CAEA,MAAM,eACJH,EACAI,EACiB,CACjB,MAAMD,EAAM,KAAK,WAAWH,CAAM,EAClC,MAAO,KAAKI,GAAO,EAAE,KAAKD,CAAG,GAC/B,CAGQ,WACNH,EAQA,CACA,GAAIA,EAAO,gBAAiB,CAC1B,MAAMK,EACJ,KAAK,gBAAgB,4BAAA,EAA8B,MACrD,IAAIC,EAAkBN,EAAO,gBAC7B,MAAMO,EAAeD,EAAgB,OAASE,EAAW,WACzD,GAAID,EACFD,EAAmBA,EAAwC,iBAClDA,EAAgB,OAASE,EAAW,SAC7C,MAAM,IAAI,MACR,mBAAmBF,EAAgB,IAAI,yBAAA,EAI3C,MAAMG,EAAO,CACX,GAAIJ,EAAyB,OAC7BA,EAAyB,MAAM,MAAM,OAAS,EAC1CA,EAAyB,MAAM,MAAM,IAAI,IAAM,IAAI,EACnD,CAAC,GAAG,CAAA,EACR,KAAK,GAAG,EAEJK,GAAQH,EAAe,IAAM,IAAMD,EAAgB,KACnDK,EAAK,CAAC,GAAIL,EAAgB,OAAO,OAAS,CAAA,EAAKI,CAAI,EACtD,IAAI,SAAS,EACb,KAAK,GAAG,EACX,OAAKH,EAGI,GAAGE,CAAI,IAAIE,CAAE,gBAAgB,UAAWX,EAAO,gBAAwC,IAAI,CAAC,GAAG,QACpG,QACA,EAAA,EAJK,GAAGS,CAAI,IAAIE,CAAE,MAAM,QAAQ,QAAS,EAAE,CAOjD,KACE,QAAOX,EAAO,YAElB,CACF,EAzEaH,EAANe,EAAA,CADNC,EAAA,EAGIC,MAAO,iBAAiB,CAAA,CAAA,EAFhBjB,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as Be,e as Ve,a as Re,b as He}from"./yjs-VtUl3AlT.js";const je=Math.floor,Fe=(t,e)=>t<e?t:e,Qe=(t,e)=>t>e?t:e,pe=128,L=127,qe=Number.MAX_SAFE_INTEGER,We=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let i=0;i<n;i++)s[i]=e.codePointAt(i);return s},O=typeof TextEncoder<"u"?new TextEncoder:null,ze=t=>O.encode(t),Je=O?ze:We;let k=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});k&&k.decode(new Uint8Array).length===1&&(k=null);const N=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},R=(t,e)=>{for(;e>L;)N(t,pe|L&e),e=je(e/128);N(t,L&e)},W=new Uint8Array(3e4),Ye=W.length/3,Ge=(t,e)=>{if(e.length<Ye){const n=O.encodeInto(e,W).written||0;R(t,n);for(let s=0;s<n;s++)N(t,W[s])}else et(t,Je(e))},Xe=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;R(t,s);for(let i=0;i<s;i++)N(t,n.codePointAt(i))},Ze=O&&O.encodeInto?Ge:Xe,Ke=(t,e)=>{const n=t.cbuf.length,s=t.cpos,i=Fe(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Qe(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},et=(t,e)=>{R(t,e.byteLength),Ke(t,e)},ye=t=>new Error(t),tt=ye("Unexpected end of array"),nt=ye("Integer out of Range"),st=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},it=t=>st(t,Z(t)),oe=t=>t.arr[t.pos++],Z=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const i=t.arr[t.pos++];if(e=e+(i&L)*n,n*=128,i<pe)return e;if(e>qe)throw nt}throw tt},ot=t=>{let e=Z(t);if(e===0)return"";{let n=String.fromCodePoint(oe(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(oe(t));else for(;e>0;){const s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}},rt=t=>k.decode(it(t)),re=k?rt:ot;var E;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(E||(E={}));const at=(t,e)=>{R(t,E.Token),Ze(t,e)},ct=(t,e,n)=>{switch(Z(t)){case E.PermissionDenied:{e(re(t));break}case E.Authenticated:{n(re(t));break}}},ht={code:1009},ae={code:4401,reason:"Unauthorized"},ut={code:4403},ce=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var z;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(z||(z={}));function lt(t){return t||(t={}),{delay:t.delay===void 0?200:t.delay,initialDelay:t.initialDelay===void 0?0:t.initialDelay,minDelay:t.minDelay===void 0?0:t.minDelay,maxDelay:t.maxDelay===void 0?0:t.maxDelay,factor:t.factor===void 0?0:t.factor,maxAttempts:t.maxAttempts===void 0?3:t.maxAttempts,timeout:t.timeout===void 0?0:t.timeout,jitter:t.jitter===!0,initialJitter:t.initialJitter===!0,handleError:t.handleError===void 0?null:t.handleError,handleTimeout:t.handleTimeout===void 0?null:t.handleTimeout,beforeAttempt:t.beforeAttempt===void 0?null:t.beforeAttempt,calculateDelay:t.calculateDelay===void 0?null:t.calculateDelay}}async function F(t){return new Promise(e=>setTimeout(e,t))}function dt(t,e){let n=e.delay;if(n===0)return 0;if(e.factor&&(n*=Math.pow(e.factor,t.attemptNum-1),e.maxDelay!==0&&(n=Math.min(n,e.maxDelay))),e.jitter){const s=Math.ceil(e.minDelay),i=Math.floor(n);n=Math.floor(Math.random()*(i-s+1))+s}return Math.round(n)}async function ft(t,e){const n=lt(e);for(const u of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const r=n[u];if(!Number.isInteger(r)||r<0)throw new Error(`Value for ${u} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const s={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){s.aborted=!0}},i=n.calculateDelay||dt;async function o(){if(n.beforeAttempt&&n.beforeAttempt(s,n),s.aborted){const r=new Error("Attempt aborted");throw r.code="ATTEMPT_ABORTED",r}const u=async r=>{if(n.handleError&&await n.handleError(r,s,n),s.aborted||s.attemptsRemaining===0)throw r;s.attemptNum++;const c=i(s,n);return c&&await F(c),o()};return s.attemptsRemaining>0&&s.attemptsRemaining--,n.timeout?new Promise((r,c)=>{const A=setTimeout(()=>{if(n.handleTimeout)try{r(n.handleTimeout(s,n))}catch(h){c(h)}else{const h=new Error(`Retry timeout (attemptNum: ${s.attemptNum}, timeout: ${n.timeout})`);h.code="ATTEMPT_TIMEOUT",c(h)}},n.timeout);t(s,n).then(h=>{clearTimeout(A),r(h)}).catch(h=>{clearTimeout(A),u(h).then(r).catch(c)})}):t(s,n).catch(u)}const a=n.calculateDelay?n.calculateDelay(s,n):n.initialDelay;if(a&&await F(a),s.attemptNum<1&&n.initialJitter){const u=i(s,n);u&&await F(u)}return o()}var we={};const b=()=>new Map,be=(t,e,n)=>{let s=t.get(e);return s===void 0&&t.set(e,s=n()),s},Se=()=>new Set,gt=Array.from,mt=String.fromCharCode,pt=t=>t.toLowerCase(),yt=/^\s*/g,wt=t=>t.replace(yt,""),bt=/([A-Z])/g,he=(t,e)=>wt(t.replace(bt,n=>`${e}${pt(n)}`)),St=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let i=0;i<n;i++)s[i]=e.codePointAt(i);return s},M=typeof TextEncoder<"u"?new TextEncoder:null,Ct=t=>M.encode(t),vt=M?Ct:St;let U=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});U&&U.decode(new Uint8Array).length===1&&(U=null);const ue=t=>t===void 0?null:t;class At{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Ce=new At,K=!0;try{typeof localStorage<"u"&&localStorage&&(Ce=localStorage,K=!1)}catch{}const ve=Ce,kt=t=>K||addEventListener("storage",t),Ut=t=>K||removeEventListener("storage",t),Dt=Object.keys,Pt=(t,e)=>{const n=[];for(const s in t)n.push(e(t[s],s));return n},le=t=>Dt(t).length,Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Et=(t,e)=>t===e,D=(t,e)=>{if(t==null||e==null)return Et(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!D(t.get(n),e.get(n)))return!1;break}case Object:if(le(t)!==le(e))return!1;for(const n in t)if(!Ot(t,n)||!D(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!D(t[n],e[n]))return!1;break;default:return!1}return!0},Mt=(t,e)=>e.includes(t),S=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Ae=typeof window<"u"&&typeof document<"u"&&!S;let m;const Tt=()=>{if(m===void 0)if(S){m=b();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const s=t[n];s[0]==="-"?(e!==null&&m.set(e,""),e=s):e!==null&&(m.set(e,s),e=null)}e!==null&&m.set(e,"")}else typeof location=="object"?(m=b(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");m.set(`--${he(e,"-")}`,n),m.set(`-${he(e,"-")}`,n)}})):m=b();return m},J=t=>Tt().has(t),Y=t=>ue(S?we[t.toUpperCase()]:ve.getItem(t)),It=t=>J("--"+t)||Y(t)!==null;It("production");const de=S&&Mt(we.FORCE_COLOR,["true","1","2"]);!J("no-colors")&&(!S||process.stdout.isTTY||de)&&(!S||J("color")||de||Y("COLORTERM")!==null||(Y("TERM")||"").includes("color"));const ke=Math.floor,xt=(t,e)=>t<e?t:e,Lt=(t,e)=>t>e?t:e,$t=64,B=128,_t=63,P=127,Ue=Number.MAX_SAFE_INTEGER;class Nt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const ee=()=>new Nt,De=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},te=t=>{const e=new Uint8Array(De(t));let n=0;for(let s=0;s<t.bufs.length;s++){const i=t.bufs[s];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},V=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},f=(t,e)=>{for(;e>P;)V(t,B|P&e),e=ke(e/128);V(t,P&e)},G=new Uint8Array(3e4),Bt=G.length/3,Vt=(t,e)=>{if(e.length<Bt){const n=M.encodeInto(e,G).written||0;f(t,n);for(let s=0;s<n;s++)V(t,G[s])}else v(t,vt(e))},Rt=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;f(t,s);for(let i=0;i<s;i++)V(t,n.codePointAt(i))},g=M&&M.encodeInto?Vt:Rt,Ht=(t,e)=>{const n=t.cbuf.length,s=t.cpos,i=xt(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Lt(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},v=(t,e)=>{f(t,e.byteLength),Ht(t,e)},Pe=t=>new Error(t),Oe=Pe("Unexpected end of array"),Ee=Pe("Integer out of Range");class jt{constructor(e){this.arr=e,this.pos=0}}const Me=t=>new jt(t),Ft=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},H=t=>Ft(t,w(t)),fe=t=>t.arr[t.pos++],w=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const i=t.arr[t.pos++];if(e=e+(i&P)*n,n*=128,i<B)return e;if(e>Ue)throw Ee}throw Oe},Qt=t=>{let e=t.arr[t.pos++],n=e&_t,s=64;const i=(e&$t)>0?-1:1;if((e&B)===0)return i*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&P)*s,s*=128,e<B)return i*n;if(n>Ue)throw Ee}throw Oe},qt=t=>{let e=w(t);if(e===0)return"";{let n=String.fromCodePoint(fe(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(fe(t));else for(;e>0;){const s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}},Wt=t=>U.decode(H(t)),j=U?Wt:qt,zt=t=>{const e=t.pos,n=j(t);return t.pos=e,n},Jt=t=>new Uint8Array(t),Yt=(t,e,n)=>new Uint8Array(t,e,n),Gt=t=>new Uint8Array(t),Xt=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=mt(t[n]);return btoa(e)},Zt=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),Kt=t=>{const e=atob(t),n=Jt(e.length);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return n},en=t=>{const e=Buffer.from(t,"base64");return Yt(e.buffer,e.byteOffset,e.byteLength)},tn=Ae?Xt:Zt,nn=Ae?Kt:en,Te=new Map;class sn{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:nn(n.newValue||"")}),kt(this._onChange)}postMessage(e){ve.setItem(this.room,tn(Gt(e)))}close(){Ut(this._onChange)}}const on=typeof BroadcastChannel>"u"?sn:BroadcastChannel,ne=t=>be(Te,t,()=>{const e=Se(),n=new on(t);return n.onmessage=s=>e.forEach(i=>i(s.data,"broadcastchannel")),{bc:n,subs:e}}),rn=(t,e)=>(ne(t).subs.add(e),e),an=(t,e)=>{const n=ne(t),s=n.subs.delete(e);return s&&n.subs.size===0&&(n.bc.close(),Te.delete(t)),s},cn=(t,e,n=null)=>{const s=ne(t);s.bc.postMessage(e),s.subs.forEach(i=>i(e,n))},hn=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},C=Date.now;class un{constructor(){this._observers=b()}on(e,n){be(this._observers,e,Se).add(n)}once(e,n){const s=(...i)=>{this.off(e,s),n(...i)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return gt((this._observers.get(e)||b()).values()).forEach(s=>s(...n))}destroy(){this._observers=b()}}const Q=3e4;class ln extends un{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=C();this.getLocalState()!==null&&Q/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((i,o)=>{o!==this.clientID&&Q<=n-i.lastUpdated&&this.states.has(o)&&s.push(o)}),s.length>0&&$(this,s,"timeout")},ke(Q/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,s=this.meta.get(n),i=s===void 0?0:s.clock+1,o=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:C()});const a=[],u=[],r=[],c=[];e===null?c.push(n):o==null?e!=null&&a.push(n):(u.push(n),D(o,e)||r.push(n)),(a.length>0||r.length>0||c.length>0)&&this.emit("change",[{added:a,updated:r,removed:c},"local"]),this.emit("update",[{added:a,updated:u,removed:c},"local"])}setLocalStateField(e,n){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[e]:n})}getStates(){return this.states}}const $=(t,e,n)=>{const s=[];for(let i=0;i<e.length;i++){const o=e[i];if(t.states.has(o)){if(t.states.delete(o),o===t.clientID){const a=t.meta.get(o);t.meta.set(o,{clock:a.clock+1,lastUpdated:C()})}s.push(o)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},X=(t,e,n=t.states)=>{const s=e.length,i=ee();f(i,s);for(let o=0;o<s;o++){const a=e[o],u=n.get(a)||null,r=t.meta.get(a).clock;f(i,a),f(i,r),g(i,JSON.stringify(u))}return te(i)},dn=(t,e,n)=>{const s=Me(e),i=C(),o=[],a=[],u=[],r=[],c=w(s);for(let A=0;A<c;A++){const h=w(s);let T=w(s);const y=JSON.parse(j(s)),I=t.meta.get(h),Ne=t.states.get(h),ie=I===void 0?0:I.clock;(ie<T||ie===T&&y===null&&t.states.has(h))&&(y===null?h===t.clientID&&t.getLocalState()!=null?T++:t.states.delete(h):t.states.set(h,y),t.meta.set(h,{clock:T,lastUpdated:i}),I===void 0&&y!==null?o.push(h):I!==void 0&&y===null?r.push(h):y!==null&&(D(y,Ne)||u.push(h),a.push(h)))}(o.length>0||u.length>0||r.length>0)&&t.emit("change",[{added:o,updated:u,removed:r},n]),(o.length>0||a.length>0||r.length>0)&&t.emit("update",[{added:o,updated:a,removed:r},n])};class Ie{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const s=this.callbacks[e];return s&&s.forEach(i=>i.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}const fn=t=>Pt(t,(e,n)=>`${encodeURIComponent(n)}=${encodeURIComponent(e)}`).join("&");var d;(function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"})(d||(d={}));var l;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(l||(l={}));class _{constructor(e){this.data=e,this.encoder=ee(),this.decoder=Me(new Uint8Array(this.data))}peekVarString(){return zt(this.decoder)}readVarUint(){return w(this.decoder)}readVarString(){return j(this.decoder)}readVarUint8Array(){return H(this.decoder)}writeVarUint(e){return f(this.encoder,e)}writeVarString(e){return g(this.encoder,e)}writeVarUint8Array(e){return v(this.encoder,e)}length(){return De(this.encoder)}}class gn extends Ie{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",document:void 0,WebSocketPolyfill:void 0,parameters:{},connect:!0,broadcast:!0,forceSyncInterval:!1,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,quiet:!1,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=l.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={forceSync:null,connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=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("status",this.onStatus.bind(this)),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),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),typeof e.connect<"u"&&(this.shouldConnect=e.connect),this.shouldConnect&&this.connect()}async onOpen(e){this.receivedOnOpenPayload=e}async onStatus(e){this.receivedOnStatusPayload=e}attach(e){let n;return this.configuration.providerMap.set(e.configuration.name,e),this.status===l.Disconnected&&this.shouldConnect&&(n=this.connect()),this.receivedOnOpenPayload&&e.onOpen(this.receivedOnOpenPayload),this.receivedOnStatusPayload&&e.onStatus(this.receivedOnStatusPayload),n}detach(e){this.configuration.providerMap.delete(e.configuration.name)}setConfiguration(e={}){this.configuration={...this.configuration,...e}}async connect(){if(this.status===l.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:ft(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,beforeAttempt:a=>{(!this.shouldConnect||i)&&a.abort()}}).catch(a=>{if(a&&a.code!=="ATTEMPT_ABORTED")throw a}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:s}=e();return this.cancelWebsocketRetry=s,n}attachWebSocketListeners(e,n){const{identifier:s}=e,i=c=>this.emit("message",c),o=c=>this.emit("close",{event:c}),a=c=>this.emit("open",c),u=c=>{n(c)};this.webSocketHandlers[s]={message:i,close:o,open:a,error:u};const r=this.webSocketHandlers[e.identifier];Object.keys(r).forEach(c=>{e.addEventListener(c,r[c])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(s=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(s,n[s]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const s=new this.configuration.WebSocketPolyfill(this.url);s.binaryType="arraybuffer",s.identifier=this.identifier,this.attachWebSocketListeners(s,n),this.webSocket=s,this.status=l.Connecting,this.emit("status",{status:l.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=C();const i=new _(e.data).peekVarString();(n=this.configuration.providerMap.get(i))===null||n===void 0||n.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=l.Connected,this.emit("status",{status:l.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===l.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=C()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){for(;this.configuration.url[this.configuration.url.length-1]==="/";)return this.configuration.url.slice(0,this.configuration.url.length-1);return this.configuration.url}get url(){const e=fn(this.configuration.parameters);return`${this.serverUrl}${e.length===0?"":`?${e}`}`}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch{}}send(e){var n;((n=this.webSocket)===null||n===void 0?void 0:n.readyState)===z.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===l.Connected&&(this.status=l.Disconnected,this.emit("status",{status:l.Disconnected}),this.emit("disconnect",{event:e})),e.code===ae.code&&(e.reason===ae.reason?console.warn("[HocuspocusProvider] An authentication token is required, but you didn’t send one. Try adding a `token` to your HocuspocusProvider configuration. Won’t try again."):console.warn(`[HocuspocusProvider] Connection closed with status Unauthorized: ${e.reason}`),this.shouldConnect=!1),e.code===ut.code&&!this.configuration.quiet){console.warn("[HocuspocusProvider] The provided authentication token isn’t allowed to connect to this server. Will try again.");return}e.code===ht.code&&(console.warn(`[HocuspocusProvider] Connection closed with status MessageTooBig: ${e.reason}`),this.shouldConnect=!1),this.connectionAttempt?this.rejectConnectionAttempt():this.shouldConnect&&this.connect(),!this.shouldConnect&&this.status!==l.Disconnected&&(this.status=l.Disconnected,this.emit("status",{status:l.Disconnected}),this.emit("disconnect",{event:e}))}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const xe=0,se=1,Le=2,mn=(t,e)=>{f(t,xe);const n=Ve(e);v(t,n)},$e=(t,e,n)=>{f(t,se),v(t,Re(e,n))},pn=(t,e,n)=>$e(e,n,H(t)),_e=(t,e,n)=>{try{He(e,H(t),n)}catch(s){console.error("Caught error while handling a Yjs update",s)}},yn=(t,e)=>{f(t,Le),v(t,e)},wn=_e,bn=(t,e,n,s)=>{const i=w(t);switch(i){case xe:pn(t,e,n);break;case se:_e(t,n,s);break;case Le:wn(t,n,s);break;default:throw new Error("Unknown message type")}return i};class p{constructor(){this.encoder=ee()}get(e){return e.encoder}toUint8Array(){return te(this.encoder)}}class ge{constructor(e){this.broadcasted=!1,this.message=e}setBroadcasted(e){return this.broadcasted=e,this}apply(e,n){const{message:s}=this,i=s.readVarUint(),o=s.length();switch(i){case d.Sync:this.applySyncMessage(e,n);break;case d.Awareness:this.applyAwarenessMessage(e);break;case d.Auth:this.applyAuthMessage(e);break;case d.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case d.Stateless:e.receiveStateless(j(s.decoder));break;case d.SyncStatus:this.applySyncStatusMessage(e,Qt(s.decoder)===1);break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}s.length()>o+1&&(this.broadcasted?e.broadcast(p,{encoder:s.encoder}):e.send(p,{encoder:s.encoder}))}applySyncMessage(e,n){const{message:s}=this;s.writeVarUint(d.Sync);const i=bn(s.decoder,s.encoder,e.document,e);n&&i===se&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;dn(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;ct(n.decoder,e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;n.writeVarUint(d.Awareness),n.writeVarUint8Array(X(e.awareness,Array.from(e.awareness.getStates().keys())))}}class me{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return te(this.encoder)}send(e){e?.send(this.create())}broadcast(e){cn(e,this.create())}}class Sn extends p{constructor(){super(...arguments),this.type=d.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return g(this.encoder,e.documentName),f(this.encoder,this.type),at(this.encoder,e.token),this.encoder}}class x extends p{constructor(){super(...arguments),this.type=d.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");g(this.encoder,e.documentName),f(this.encoder,this.type);let n;return e.states===void 0?n=X(e.awareness,e.clients):n=X(e.awareness,e.clients,e.states),v(this.encoder,n),this.encoder}}class Cn extends p{constructor(){super(...arguments),this.type=d.CLOSE,this.description="Ask the server to close the connection"}get(e){return g(this.encoder,e.documentName),f(this.encoder,this.type),this.encoder}}class vn extends p{constructor(){super(...arguments),this.type=d.QueryAwareness,this.description="Queries awareness states"}get(e){return g(this.encoder,e.documentName),f(this.encoder,this.type),this.encoder}}class An extends p{constructor(){super(...arguments),this.type=d.Stateless,this.description="A stateless message"}get(e){var n;return g(this.encoder,e.documentName),f(this.encoder,this.type),g(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class q extends p{constructor(){super(...arguments),this.type=d.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return g(this.encoder,e.documentName),f(this.encoder,this.type),mn(this.encoder,e.document),this.encoder}}class kn extends p{constructor(){super(...arguments),this.type=d.Sync,this.description="Second sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step two message requires document as an argument");return g(this.encoder,e.documentName),f(this.encoder,this.type),$e(this.encoder,e.document),this.encoder}}class Un extends p{constructor(){super(...arguments),this.type=d.Sync,this.description="A document update"}get(e){return g(this.encoder,e.documentName),f(this.encoder,this.type),yn(this.encoder,e.update),this.encoder}}class Dn extends Error{constructor(){super(...arguments),this.code=1001}}class On extends Ie{constructor(e){var n,s,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,parameters:{},broadcast:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onSynced:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,quiet:!1,connect:!0,preserveConnection:!0},this.subscribedToBroadcastChannel=!1,this.isSynced=!1,this.unsyncedChanges=0,this.status=l.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=hn(),this.intervals={forceSync:null},this.isConnected=!0,this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundBroadcastChannelSubscriber=this.broadcastChannelSubscriber.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundOnStatus=this.onStatus.bind(this),this.forwardConnect=o=>this.emit("connect",o),this.forwardOpen=o=>this.emit("open",o),this.forwardClose=o=>this.emit("close",o),this.forwardDisconnect=o=>this.emit("disconnect",o),this.forwardDestroy=o=>this.emit("destroy",o),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Be,this.configuration.awareness=e.awareness!==void 0?e.awareness:new ln(this.document),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("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("open",this.forwardOpen),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("status",this.boundOnStatus),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),(n=this.awareness)===null||n===void 0||n.on("update",()=>{this.emit("awarenessUpdate",{states:ce(this.awareness.getStates())})}),(s=this.awareness)===null||s===void 0||s.on("change",()=>{this.emit("awarenessChange",{states:ce(this.awareness.getStates())})}),this.document.on("update",this.boundDocumentUpdateHandler),(i=this.awareness)===null||i===void 0||i.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.configuration.websocketProvider.attach(this)}onStatus({status:e}){this.status=e,this.configuration.onStatus({status:e}),this.emit("status",{status:e})}setConfiguration(e={}){if(!e.websocketProvider&&e.url){const n=e;this.configuration.websocketProvider=new gn({url:n.url,connect:n.connect,parameters:n.parameters})}this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit("unsyncedChanges",this.unsyncedChanges)}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",this.unsyncedChanges)}decrementUnsyncedChanges(){this.unsyncedChanges-=1,this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",this.unsyncedChanges)}forceSync(){this.resetUnsyncedChanges(),this.send(q,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&$(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(An,{documentName:this.configuration.name,payload:e})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(Un,{update:e,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:e,updated:n,removed:s},i){const o=e.concat(n).concat(s);this.send(x,{awareness:this.awareness,clients:o,documentName:this.configuration.name},!0)}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,this.emit("synced",{state:e}),this.emit("sync",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}get isAuthenticationRequired(){return!!this.configuration.token&&!this.isAuthenticated}async connect(){return this.configuration.broadcast&&this.subscribeToBroadcastChannel(),this.configuration.websocketProvider.shouldConnect=!0,this.configuration.websocketProvider.attach(this)}disconnect(){this.disconnectBroadcastChannel(),this.configuration.websocketProvider.detach(this),this.isConnected=!1,this.configuration.preserveConnection||this.configuration.websocketProvider.disconnect()}async onOpen(e){this.isAuthenticated=!1,this.isConnected=!0,this.emit("open",{event:e});let n;try{n=await this.getToken()}catch(s){this.permissionDeniedHandler(`Failed to get token: ${s}`);return}this.isAuthenticationRequired&&this.send(Sn,{token:n,documentName:this.configuration.name}),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(q,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(x,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n,s=!1){if(!this.isConnected)return;s&&this.mux(()=>{this.broadcast(e,n)});const i=new me(e,n);this.emit("outgoingMessage",{message:i.message}),i.send(this.configuration.websocketProvider)}onMessage(e){const n=new _(e.data),s=n.readVarString();n.writeVarString(s),this.emit("message",{event:e,message:new _(e.data)}),new ge(n).apply(this,!0)}onClose(e){this.isAuthenticated=!1,this.synced=!1,this.awareness&&$(this.awareness,Array.from(this.awareness.getStates().keys()).filter(n=>n!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&($(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.boundDocumentUpdateHandler),this.removeAllListeners(),this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("open",this.forwardOpen),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("status",this.boundOnStatus),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.send(Cn,{documentName:this.configuration.name}),this.disconnect(),!(typeof window>"u"||!("removeEventListener"in window))&&window.removeEventListener("pagehide",this.boundPageHide)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1,this.disconnect(),this.status=l.Disconnected}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated")}get broadcastChannel(){return`${this.configuration.name}`}broadcastChannelSubscriber(e){this.mux(()=>{const n=new _(e),s=n.readVarString();n.writeVarString(s),new ge(n).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(rn(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(q,{document:this.document,documentName:this.configuration.name}),this.broadcast(kn,{document:this.document,documentName:this.configuration.name}),this.broadcast(vn,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(x,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(x,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(an(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(e,n){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new me(e,n).broadcast(this.broadcastChannel)}setAwarenessField(e,n){if(!this.awareness)throw new Dn(`Cannot set awareness field "${e}" to ${JSON.stringify(n)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,n)}}crypto.getRandomValues.bind(crypto);export{Dn as AwarenessError,On as HocuspocusProvider,gn as HocuspocusProviderWebsocket,d as MessageType,l as WebSocketStatus};
|
|
2
|
-
//# sourceMappingURL=hocuspocus-provider.esm-DpwNtHpL.js.map
|