@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-DZ9bdNW4.svg +0 -18
- package/dist/yjs-VtUl3AlT.js +0 -6
- package/dist/yjs-VtUl3AlT.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"native-48B9X9Wg.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./NextcloudLoginMenu-DxWXKyFo.js","./index-B7HOg_tC.js","./index-BgL5UHSB.css","./NextcloudLoginMenu-DGCgMCya.css","./nextcloud-internal-link-serializer-qLagTAdg.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a8 as W,a9 as p,ad as o,af as q,ag as B,ab as V,ah as u,ai as H,aj as O,ak as K,al as _,am as w,an as P,ao as F,ap as X,aq as G}from"./index-B7HOg_tC.js";var J=Object.getOwnPropertyDescriptor,Q=(e,t,r,n)=>{for(var s=n>1?void 0:n?J(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},Y=(e,t)=>(r,n)=>t(r,n,e);let C=class{constructor(e){this.authenticationManager=e}id="sidebar.actions.nextcloudLoginMenu";uixpName="sidebar.actions";order=2100;parameters={};async component(){return(await W(async()=>{const{default:e}=await import("./NextcloudLoginMenu-DxWXKyFo.js");return{default:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).default}async enabled(){return!await this.authenticationManager.get()?.isAuthenticated()}};C=Q([p(),Y(0,o("AuthenticationManagerProvider"))],C);let Z=class{constructor(t){t.bind("UIExtension").to(C).inSingletonScope()}};var ee=Object.getOwnPropertyDescriptor,te=(e,t,r,n)=>{for(var s=n>1?void 0:n?ee(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},z=(e,t)=>(r,n)=>t(r,n,e);let R=class{cristalApp;logger;constructor(e,t){this.logger=e,this.logger.setModule("storage.components.NextcloudPageHierarchyResolver"),this.cristalApp=t}async getPageHierarchy(e,t=!0){let r=t?[{label:"Home",pageId:this.cristalApp.getWikiConfig().homePage,url:this.cristalApp.getRouter().resolve({name:"view",params:{page:this.cristalApp.getWikiConfig().homePage}}).href}]:[];return e!=null&&(r=r.concat(await B(e,this.cristalApp))),r}};R=te([p(),z(0,o("Logger")),z(1,o("CristalApp"))],R);let re=class{constructor(t){t.bind(q).to(R).inSingletonScope().whenNamed("Nextcloud")}};var y={exports:{}},j;function ne(){if(j)return y.exports;j=1;var e=y.exports=function t(r,n){var s;if(r!=null)return n=(n||"").replace(/[^&"<>\']/g,""),s=`([&"<>'])`.replace(new RegExp("["+n+"]","g"),""),r.replace(new RegExp(s,"g"),function(a,i){return t.map[i]})};return e.map={">":">","<":"<","'":"'",'"':""","&":"&"},y.exports}var se=ne();const ae=V(se);var ie=Object.getOwnPropertyDescriptor,oe=(e,t,r,n)=>{for(var s=n>1?void 0:n?ie(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},m=(e,t)=>(r,n)=>t(r,n,e);let S=class{constructor(e,t,r,n,s){this.cristalApp=e,this.authenticationManagerProvider=t,this.remoteURLParserProvider=r,this.modelReferenceSerializerProvider=n,this.httpHeadersProvider=s}async getLinks(e,t){const r=(await this.authenticationManagerProvider.get()?.getUserDetails())?.username;if(!r)return console.error("Could not fetch links to suggest, the user is not properly logged-in."),[];const n=this.cristalApp.getWikiConfig(),s=(n.storageRoot??`/files/${r}/.cristal`).replace("${username}",r),a=await this.httpHeadersProvider.getHeaders();a.set("Content-Type","text/xml");const i={method:"SEARCH",headers:a,body:`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
-
<d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
|
4
|
-
<d:basicsearch>
|
|
5
|
-
<d:select>
|
|
6
|
-
<d:prop>
|
|
7
|
-
<oc:fileid/>
|
|
8
|
-
<d:displayname/>
|
|
9
|
-
<d:getcontenttype/>
|
|
10
|
-
<d:getetag/>
|
|
11
|
-
<oc:size/>
|
|
12
|
-
</d:prop>
|
|
13
|
-
</d:select>
|
|
14
|
-
<d:from>
|
|
15
|
-
<d:scope>
|
|
16
|
-
<d:href>${s}</d:href>
|
|
17
|
-
<d:depth>infinity</d:depth>
|
|
18
|
-
</d:scope>
|
|
19
|
-
</d:from>
|
|
20
|
-
<d:where>
|
|
21
|
-
<d:like>
|
|
22
|
-
<d:prop>
|
|
23
|
-
<d:displayname/>
|
|
24
|
-
</d:prop>
|
|
25
|
-
<d:literal>%${ae(e)}%</d:literal>
|
|
26
|
-
</d:like>
|
|
27
|
-
</d:where>
|
|
28
|
-
<d:orderby/>
|
|
29
|
-
</d:basicsearch>
|
|
30
|
-
</d:searchrequest>`};try{const d=await(await fetch(n.baseRestURL,i)).text(),h=new window.DOMParser().parseFromString(d,"text/xml").getElementsByTagName("d:response"),v=[];for(let l=0;l<h.length;l++){const A=h.item(l).querySelector("href").textContent,T=`${this.cristalApp.getWikiConfig().baseURL}${A}`,g=this.remoteURLParserProvider.get()?.parse(T),U=this.modelReferenceSerializerProvider.get()?.serialize(g);if(!U){console.error(`Unable to resolve [${A}]`);continue}if(g?.type===u.DOCUMENT||g?.type===u.ATTACHMENT){const L=g?.type===u.DOCUMENT?H.PAGE:H.ATTACHMENT;(L==t||t==null)&&v.push({id:A,url:T,reference:U,label:g.name,hint:g.name,type:L})}}return v}catch(c){return console.log(`Failed to search for link with query = [${e}]`,c),[]}}};S=oe([p(),m(0,o("CristalApp")),m(1,o("AuthenticationManagerProvider")),m(2,o("RemoteURLParserProvider")),m(3,o("ModelReferenceSerializerProvider")),m(4,o("HTTPHeadersProvider")),m(4,O("Nextcloud/Authenticated"))],S);let ce=class{constructor(t){t.bind(K).to(S).inSingletonScope().whenNamed("Nextcloud")}};var le=Object.getOwnPropertyDescriptor,de=(e,t,r,n)=>{for(var s=n>1?void 0:n?le(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},$=(e,t)=>(r,n)=>t(r,n,e);let b=class{constructor(e,t,r){this.cristalApp=e,this.documentService=t,this.httpHeadersProvider=r}_regExp=RegExp(/^\.attachments\.(?<id>\d+)\/(?<file>.+)$/);parse(e){if(/^https?:\/\//.test(e))throw new Error(`[${e}] is not a valid entity reference`);return this.innerSynchronousParsing(e)}async parseAsync(e,t){if(/^https?:\/\//.test(e)){const r=this.cristalApp.getWikiConfig().baseURL;if(e.startsWith(r)){const n=e.substring(`${r}/f/`.length);if(parseInt(n,10))return await this.resolveByFileId(e);throw new Error(`[${e}] is not a valid entity reference`)}else throw new Error(`[${e}] is not a valid entity reference`)}else return this.legacyParsing(e,t?.type)}async resolveByFileId(e){const t=this.cristalApp.getWikiConfig().baseURL,r=new URL(`${t}/ocs/v2.php/references/resolve`);r.searchParams.set("reference",e);const n=await this.httpHeadersProvider.getHeaders();n.set("Accept","application/json");const i=(await(await fetch(r,{headers:n})).json()).ocs.data.references[e].richObject.path,c=this.cristalApp.getWikiConfig().storageRoot?.substring(18)||".cristal/";return this.legacyParsing(i.substring(c.length).replace(/\.md$/,""))}legacyParsing(e,t){return t===u.ATTACHMENT?this.relativeAttachmentParsing(e):this.innerSynchronousParsing(e)}innerSynchronousParsing(e){let t=e.split("/");if(t[0]==""&&(t=t.slice(1)),t[t.length-2]=="attachments"){const r=t[t.length-3];return new _(t[t.length-1],new w(r.startsWith(".")?r.substring(1):r,new P(void 0,...t.slice(0,t.length-3))))}else return new w(t[t.length-1],new P(void 0,...t.slice(0,t.length-1)))}async relativeAttachmentParsing(e){const t=this._regExp.exec(e);if(t?.groups?.id&&t?.groups?.file){const r=this.cristalApp.getWikiConfig().baseURL,n=await this.resolveByFileId(`${r}/f/${t.groups.id}`);return new _(t.groups.file,new w(`.attachments.${t.groups.id}`,n.space),{"nextcloud-specific":"true"})}else{const r=this.documentService.getCurrentDocumentReference().value,n=e.split("/"),s=n.slice(0,n.length-3),a=[...r.space?.names??[]];for(;s[0]=="..";)a.pop(),s.shift();return new _(n[n.length-1],new w(n[n.length-3].replace(/^\./,""),new P(void 0,...a,...s)))}}};b=de([p(),$(0,o("CristalApp")),$(1,o("DocumentService")),$(2,o("HTTPHeadersProvider")),$(2,O("Nextcloud/Authenticated"))],b);var ue=Object.getOwnPropertyDescriptor,pe=(e,t,r,n)=>{for(var s=n>1?void 0:n?ue(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s};let N=class{serialize(e){if(!e)return;const t=e.type,{SPACE:r,ATTACHMENT:n,DOCUMENT:s,WIKI:a}=u;switch(t){case a:throw new Error("Wiki currently not supported from Nextcloud");case r:return e.names.join("/");case s:{const i=e,c=this.serialize(i.space),d=i.name;return c===void 0||c==""?d:`${c}/${d}`}case n:{const i=e,c=this.serialize(i.document),d=i.name;return`${c}/attachments/${d}`}default:throw new Error(`Unknown reference type [${t}]`)}}};N=pe([p()],N);let he=class{constructor(t){t.bind("ModelReferenceParser").to(b).inSingletonScope().whenNamed("Nextcloud"),t.bind("ModelReferenceSerializer").to(N).inSingletonScope().whenNamed("Nextcloud")}};var ge=Object.getOwnPropertyDescriptor,me=(e,t,r,n)=>{for(var s=n>1?void 0:n?ge(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},ve=(e,t)=>(r,n)=>t(r,n,e);let D=class{constructor(e){this.cristalApp=e}parse(e){const t=this.getWikiConfig(),r=[...e.matchAll(new RegExp(`^${t.baseRestURL}${t.storageRoot??"/files/${username}/.cristal"}/(.*)`.replace("${username}","([^/]*)"),"g"))][0];if(r===void 0)return;e=r[r.length-1];const n=this.computeSegments(e);return n.length>=3&&n[n.length-2]=="attachments"?this.buildAttachmentReference(n,r.length==3?r[1].toString():void 0):n[n.length-1].endsWith(".md")&&n[n.length-2]!="attachments"?this.buildDocumentReference(n,r.length==3?r[1].toString():void 0):this.buildSpaceReference(n,r.length==3?r[1].toString():void 0)}computeSegments(e){let t=decodeURIComponent(e).split("/");return(t[0]===""||t[0]===".")&&(t=t.slice(1)),t[t.length-1]===""&&(t=t.slice(0,t.length-1)),t}buildAttachmentReference(e,t){const r=e.slice(0,e.length-2),n=[];return n.push(...r.slice(0,r.length-1)),n.push(r[r.length-1].slice(1)),new _(e[e.length-1],this.buildDocumentReference(n,t))}buildDocumentReference(e,t){return new w(this.removeExtension(e[e.length-1]),this.buildSpaceReference(e.slice(0,e.length-1),t))}buildSpaceReference(e,t){return new P(t?new F(t):void 0,...e)}getWikiConfig(){return this.cristalApp.getWikiConfig()}removeExtension(e){return e.includes(".")?e.slice(0,e.lastIndexOf(".")):e}};D=me([p(),ve(0,o("CristalApp"))],D);var fe=Object.getOwnPropertyDescriptor,we=(e,t,r,n)=>{for(var s=n>1?void 0:n?fe(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},k=(e,t)=>(r,n)=>t(r,n,e);let E=class{constructor(e,t){this.cristalApp=e,this.authenticationManagerProvider=t}serialize(e){if(e)switch(e.type){case u.WIKI:throw new Error("Not implemented");case u.SPACE:return this.serializeSpace(e);case u.DOCUMENT:return`${this.serializeDocument(e)}.md`;case u.ATTACHMENT:return this.serializeAttachment(e)}}serializeSpace(e){const t=e.names.length>0?"/"+e.names.join("/"):"",r=this.authenticationManagerProvider.get()?.getUserId?.();return`${this.getRootURL(e.wiki?.name??r??"")}${t}`}serializeDocument(e){return`${this.serializeSpace(e.space)}/${e.name}`}serializeMeta(e){return`${this.serializeSpace(e.space)}/.${e.name}`}serializeAttachment(e){return e.metadata["nextcloud-specific"]==="true"?`${e.document.space?this.serializeSpace(e.document.space)+"/":""}${e.document.name}/${e.name}`:`${this.serializeMeta(e.document)}/attachments/${e.name}`}getRootURL(e){const t=this.cristalApp.getWikiConfig(),r=(t.storageRoot??"/files/${username}/.cristal").replace("${username}",e);return`${t.baseRestURL}${r}`}};E=we([p(),k(0,o("CristalApp")),k(1,o("AuthenticationManagerProvider"))],E);let Pe=class{constructor(t){t.bind("RemoteURLParser").to(D).inSingletonScope().whenNamed("Nextcloud"),t.bind("RemoteURLSerializer").to(E).inSingletonScope().whenNamed("Nextcloud")}};var $e=Object.getOwnPropertyDescriptor,_e=(e,t,r,n)=>{for(var s=n>1?void 0:n?$e(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},f=(e,t)=>(r,n)=>t(r,n,e);let I=class{constructor(e,t,r,n){this.authenticationManagerProvider=r,this.httpHeadersProvider=n,this.logger=e,this.logger.setModule("navigation-tree-nextcloud.components.NextcloudNavigationTreeSource"),this.cristalApp=t}cristalApp;logger;async getChildNodes(e){const t=e||"",r=[],n=t?t.split("/").length:0,s=await this.getSubDirectories(t);for(const a of s){const i=a.split("/");if(i.length==n+1){const c=await this.cristalApp.getPage(a);r.push({id:a,label:c&&c.name?c.name:decodeURI(i[i.length-1]),location:new P(new F((await this.authenticationManagerProvider.get().getUserDetails()).username),...i),url:this.cristalApp.getRouter().resolve({name:"view",params:{page:a}}).href,has_children:s.some(d=>d.startsWith(`${a}/`)),is_terminal:!1})}}return r}async getSubDirectories(e){const t=(await this.authenticationManagerProvider.get()?.getUserDetails())?.username;if(!t)return[];const r=[];try{const n=this.cristalApp.getWikiConfig(),s=new URL(`${n.baseRestURL}${n.storageRoot??`/files/${t}/.cristal`}`.replace("${username}",t)),a=await this.httpHeadersProvider.getHeaders();a.set("Depth","2");const c=await(await fetch(`${s}/${e}`,{method:"PROPFIND",headers:a})).text(),x=new window.DOMParser().parseFromString(c,"text/xml").getElementsByTagName("d:response");for(let h=1;h<x.length;h++){const v=x[h];if(v.getElementsByTagName("d:collection").length===0){let l=v.getElementsByTagName("d:href")[0].textContent.replace(s.pathname,"").split("/");l[0]==""&&(l=l.slice(1)),l[l.length-1]=this.removeExtension(l[l.length-1]),r.push(l.join("/"))}}}catch(n){this.logger.error(n),this.logger.debug("Could not load navigation tree.")}return r}getParentNodesId(e,t,r){return G(e,r)}removeExtension(e){return e.includes(".")?e.slice(0,e.lastIndexOf(".")):e}};I=_e([p(),f(0,o("Logger")),f(1,o("CristalApp")),f(2,o("AuthenticationManagerProvider")),f(3,o("HTTPHeadersProvider")),f(3,O("Nextcloud/Authenticated"))],I);let xe=class{constructor(t){t.bind(X).to(I).inSingletonScope().whenNamed("Nextcloud")}};var Ae=Object.getOwnPropertyDescriptor,ye=(e,t,r,n)=>{for(var s=n>1?void 0:n?Ae(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(s=i(s)||s);return s},Ce=(e,t)=>(r,n)=>t(r,n,e);let M=class{constructor(e){this.authenticationManagerProvider=e}async getHeaders(){const e=await this.authenticationManagerProvider.get()?.getAuthorizationHeader(),t=new Headers({"OCS-APIRequest":"true"});return e&&t.set("Authorization",e),t}};M=ye([p(),Ce(0,o("AuthenticationManagerProvider"))],M);let Re=class{constructor(t){t.bind("HTTPHeadersProvider").to(M).inSingletonScope().whenNamed("Nextcloud/Authenticated")}};class Se{constructor(t){const r="Nextcloud";t.bind("Factory<InternalLinksSerializer>").toFactory(n=>async()=>{const s=(await W(async()=>{const{NextcloudInternalLinkSerializer:a}=await import("./nextcloud-internal-link-serializer-qLagTAdg.js");return{NextcloudInternalLinkSerializer:a}},__vite__mapDeps([4,1,2]),import.meta.url)).NextcloudInternalLinkSerializer;return be(t,r,s,n)}).whenNamed(r)}}function be(e,t,r,n){return e.isBound("InternalLinksSerializer",{name:t})||e.bind("InternalLinksSerializer").to(r).whenNamed(t),n.get("InternalLinksSerializer",{name:t})}function He(e){new Z(e),new ce(e),new re(e),new xe(e),new Pe(e),new he(e),new Re(e),new Se(e)}export{He as load};
|
|
31
|
-
//# sourceMappingURL=nextcloud-CQ2JbCvQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";sUAmCO,IAAMA,EAAN,KAA2D,CAMhE,YAEUC,EACR,CADQ,2BAAAA,CACP,CARH,GAAK,qCACL,SAAW,kBACX,MAAQ,KACR,WAAa,GAOb,MAAM,WAAgC,CACpC,OAAQ,MAAAC,EAAA,wBAAAC,CAAA,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EAC/C,GAAGqG,CAAyC,EAC5C,mBACA,UAAU,yBAAyB,CACxC,CACF,ECVO,MAAMG,EAAc,CACzB,YAAYxG,EAAsB,CAChC,MAAMS,EAAO,YACbT,EACG,KACC,oCAED,UAAWyG,GACH,SAAY,CACjB,MAAMC,GACJ,MAAAhH,EAAA,gDAAAiH,CAAA,OAAM,QAAO,kDAAsC,yCAAAA,CAAA,8CACnD,gCACF,OAAOC,GAAY5G,EAAWS,EAAMiG,EAAWD,CAAO,CACxD,CACD,EACA,UAAUhG,CAAI,CACnB,CACF,CAUA,SAASmG,GACP5G,EACAS,EACAiG,EACAD,EACA,CACA,OAAKzG,EAAU,QAAQ,0BAA2B,CAAE,KAAAS,CAAA,CAAY,GAC9DT,EACG,KAA8B,yBAAyB,EACvD,GAAG0G,CAAS,EACZ,UAAUjG,CAAI,EAEZgG,EAAQ,IAA6B,0BAA2B,CACrE,KAAAhG,CAAA,CACD,CACH,CCtCO,SAASoG,GAAK7G,EAAsB,CACzC,IAAI8G,EAAuC9G,CAAS,EACpD,IAAI+G,GAAkC/G,CAAS,EAC/C,IAAIgH,GAAoChH,CAAS,EACjD,IAAIiH,GAAqCjH,CAAS,EAClD,IAAIkH,GAAqClH,CAAS,EAClD,IAAImH,GAAqCnH,CAAS,EAClD,IAAIoH,GAA+CpH,CAAS,EAC5D,IAAIqH,GAAqCrH,CAAS,CACpD","names":["NextcloudLoginMenuUIExtension","authenticationManager","__vitePreload","__vite_default__","__decorateClass","injectable","__decorateParam","ComponentInit$7","container","NextcloudPageHierarchyResolver","logger","cristalApp","page","includeHomePage","hierarchy","getPageHierarchyFromPath","ComponentInit$6","name","escape","xmlEscapeModule","string","ignore","pattern","str","item","NextcloudLinkSuggestService","authenticationManagerProvider","remoteURLParserProvider","modelReferenceSerializerProvider","httpHeadersProvider","query","linkType","username","config","storageRoot","headers","options","xmlescape","txt","responseNodes","links","i","dHref","url","parsed","reference","EntityType","type","LinkType","e","ComponentInit$5","NextcloudModelReferenceParser","documentService","baseURL","fileid","ocsUrl","path","dirRoot","segments","documentName","AttachmentReference","DocumentReference","SpaceReference","m","resolved","currentDocument","references","spaces","currentSegments","NextcloudModelReferenceSerializer","SPACE","ATTACHMENT","DOCUMENT","WIKI","documentReference","attachmentReference","document","ComponentInit$4","NextcloudRemoteURLParser","urlStr","urlMatch","newSpaces","WikiReference","file","NextcloudRemoteURLSerializer","spaceReference","userId","ComponentInit$3","NextcloudNavigationTreeSource","id","currentId","navigationTree","currentDepth","subdirectories","d","currentPageData","d2","directory","rootUrl","text","responses","response","urlFragments","error","_includeTerminal","includeRootNode","getParentNodesIdFromPath","ComponentInit$2","NavigationTreeSourceName","NextcloudAuthenticatedHTTPHeadersProvider","authorizationHeader","ComponentInit$1","ComponentInit","context","component","NextcloudInternalLinkSerializer","bindAndLoad","load","NextcloudAuthenticationUIComponentInit","NextcloudLinkSuggestComponentInit","NextcloudPageHierarchyComponentInit","NextcloudNavigationTreeComponentInit","ModelRemoteURLNextcloudComponentInit","ModelReferenceNextcloudComponentInit","NextcloudAuthenticatedHTTPHeadersComponentInit","UniASTMarkdownNextcloudComponentInit"],"ignoreList":[3],"sources":["../../../core/authentication/authentication-nextcloud-ui/src/NextcloudLoginMenuUIExtension.ts","../../../core/authentication/authentication-nextcloud-ui/src/index.ts","../../../core/hierarchy/hierarchy-nextcloud/src/components/componentsInit.ts","../../../node_modules/.pnpm/xml-escape@1.1.0/node_modules/xml-escape/index.js","../../../core/link-suggest/link-suggest-nextcloud/src/nextcloudLinkSuggestService.ts","../../../core/link-suggest/link-suggest-nextcloud/src/index.ts","../../../core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceParser.ts","../../../core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceSerializer.ts","../../../core/model/model-reference/model-reference-nextcloud/src/componentInit.ts","../../../core/model/model-remote-url/model-remote-url-nextcloud/src/nextcloudRemoteURLParser.ts","../../../core/model/model-remote-url/model-remote-url-nextcloud/src/nextcloudRemoteURLSerializer.ts","../../../core/model/model-remote-url/model-remote-url-nextcloud/src/componentInit.ts","../../../core/navigation-tree/navigation-tree-nextcloud/src/components/componentsInit.ts","../../../core/nextcloud/http-headers/src/components/NextcloudAuthenticatedHTTPHeadersProvider.ts","../../../core/nextcloud/http-headers/src/index.ts","../../../core/uniast/uniast-markdown-nextcloud/src/index.ts","../../../lib/src/default/nextcloud.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 Nextcloud backend.\n *\n * @since 0.16\n * @beta\n */\n@injectable()\nexport class NextcloudLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.nextcloudLoginMenu\";\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/NextcloudLoginMenu.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 { NextcloudLoginMenuUIExtension } from \"./NextcloudLoginMenuUIExtension\";\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(NextcloudLoginMenuUIExtension)\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 Nextcloud backend.\n *\n * @since 0.10\n * @beta\n **/\n@injectable()\nclass NextcloudPageHierarchyResolver 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.NextcloudPageHierarchyResolver\");\n this.cristalApp = cristalApp;\n }\n\n async getPageHierarchy(\n page: DocumentReference | SpaceReference,\n includeHomePage: boolean = true,\n ): Promise<Array<PageHierarchyItem>> {\n let 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 = hierarchy.concat(\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(NextcloudPageHierarchyResolver)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\n }\n}\n","\n\nvar escape = module.exports = function escape(string, ignore) {\n var pattern;\n\n if (string === null || string === undefined) return;\n\n ignore = (ignore || '').replace(/[^&\"<>\\']/g, '');\n pattern = '([&\"<>\\'])'.replace(new RegExp('[' + ignore + ']', 'g'), '');\n\n return string.replace(new RegExp(pattern, 'g'), function(str, item) {\n return escape.map[item];\n })\n}\n\nvar map = escape.map = {\n '>': '>'\n , '<': '<'\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 { LinkType } from \"@xwiki/platform-link-suggest-api\";\nimport { EntityType } from \"@xwiki/platform-model-api\";\nimport { inject, injectable, named } from \"inversify\";\nimport xmlescape from \"xml-escape\";\nimport type { HTTPHeadersProvider } from \"@xwiki/cristal-nextcloud-http-headers\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/platform-authentication-api\";\nimport type {\n Link,\n LinkSuggestService,\n} from \"@xwiki/platform-link-suggest-api\";\nimport type { ModelReferenceSerializerProvider } from \"@xwiki/platform-model-reference-api\";\nimport type { RemoteURLParserProvider } from \"@xwiki/platform-model-remote-url-api\";\n\n/**\n * @since 0.11\n * @beta\n */\n@injectable()\nexport class NextcloudLinkSuggestService implements LinkSuggestService {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParserProvider\")\n private readonly remoteURLParserProvider: RemoteURLParserProvider,\n @inject(\"ModelReferenceSerializerProvider\")\n private readonly modelReferenceSerializerProvider: ModelReferenceSerializerProvider,\n @inject(\"HTTPHeadersProvider\")\n @named(\"Nextcloud/Authenticated\")\n private readonly httpHeadersProvider: HTTPHeadersProvider,\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 getLinks(query: string, linkType?: LinkType): Promise<Link[]> {\n const username = (\n await this.authenticationManagerProvider.get()?.getUserDetails()\n )?.username;\n if (!username) {\n console.error(\n \"Could not fetch links to suggest, the user is not properly logged-in.\",\n );\n return [];\n }\n\n const config = this.cristalApp.getWikiConfig();\n const storageRoot = (\n config.storageRoot ?? `/files/${username}/.cristal`\n ).replace(\"${username}\", username);\n\n const headers = await this.httpHeadersProvider.getHeaders();\n headers.set(\"Content-Type\", \"text/xml\");\n\n const options = {\n method: \"SEARCH\",\n headers,\n body: `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\">\n <d:basicsearch>\n <d:select>\n <d:prop>\n <oc:fileid/>\n <d:displayname/>\n <d:getcontenttype/>\n <d:getetag/>\n <oc:size/>\n </d:prop>\n </d:select>\n <d:from>\n <d:scope>\n <d:href>${storageRoot}</d:href>\n <d:depth>infinity</d:depth>\n </d:scope>\n </d:from>\n <d:where>\n <d:like>\n <d:prop>\n <d:displayname/>\n </d:prop>\n <d:literal>%${xmlescape(query)}%</d:literal>\n </d:like>\n </d:where>\n <d:orderby/>\n </d:basicsearch>\n</d:searchrequest>`,\n };\n\n try {\n const response = await fetch(config.baseRestURL, options);\n const txt = await response.text();\n const xml = new window.DOMParser().parseFromString(txt, \"text/xml\");\n const responseNodes = xml.getElementsByTagName(\"d:response\");\n\n const links: Link[] = [];\n\n for (let i = 0; i < responseNodes.length; i++) {\n const responseNode = responseNodes.item(i)!;\n const dHref = responseNode.querySelector(\"href\")!.textContent!;\n\n const url = `${this.cristalApp.getWikiConfig().baseURL}${dHref}`;\n const parsed = this.remoteURLParserProvider.get()?.parse(url);\n const reference = this.modelReferenceSerializerProvider\n .get()\n ?.serialize(parsed);\n\n if (!reference) {\n console.error(`Unable to resolve [${dHref}]`);\n continue;\n }\n\n if (\n parsed?.type === EntityType.DOCUMENT ||\n parsed?.type === EntityType.ATTACHMENT\n ) {\n const type =\n parsed?.type === EntityType.DOCUMENT\n ? LinkType.PAGE\n : LinkType.ATTACHMENT;\n if (type == linkType || linkType == undefined) {\n links.push({\n id: dHref,\n url,\n reference,\n label: parsed.name,\n hint: parsed.name,\n type,\n });\n }\n }\n }\n return links;\n } catch (e) {\n console.log(`Failed to search for link with query = [${query}]`, e);\n return [];\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 { NextcloudLinkSuggestService } from \"./nextcloudLinkSuggestService\";\nimport { name } from \"@xwiki/platform-link-suggest-api\";\nimport { Container } from \"inversify\";\nimport type { LinkSuggestService } from \"@xwiki/platform-link-suggest-api\";\n\n/**\n * @since 0.11\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<LinkSuggestService>(name)\n .to(NextcloudLinkSuggestService)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\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 { inject, injectable, named } from \"inversify\";\nimport type { HTTPHeadersProvider } from \"@xwiki/cristal-nextcloud-http-headers\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { DocumentService } from \"@xwiki/platform-document-api\";\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 NextcloudModelReferenceParser implements ModelReferenceParser {\n private readonly _regExp = RegExp(/^\\.attachments\\.(?<id>\\d+)\\/(?<file>.+)$/);\n\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"DocumentService\")\n private readonly documentService: DocumentService,\n @inject(\"HTTPHeadersProvider\")\n @named(\"Nextcloud/Authenticated\")\n private readonly httpHeadersProvider: HTTPHeadersProvider,\n ) {}\n\n parse(reference: string): EntityReference {\n if (/^https?:\\/\\//.test(reference)) {\n throw new Error(`[${reference}] is not a valid entity reference`);\n }\n return this.innerSynchronousParsing(reference);\n }\n\n async parseAsync(\n reference: string,\n options?: ModelReferenceParserOptions,\n ): Promise<EntityReference> {\n if (/^https?:\\/\\//.test(reference)) {\n const baseURL = this.cristalApp.getWikiConfig().baseURL;\n if (reference.startsWith(baseURL)) {\n const fileid = reference.substring(`${baseURL}/f/`.length);\n if (parseInt(fileid, 10)) {\n return await this.resolveByFileId(reference);\n } else {\n throw new Error(`[${reference}] is not a valid entity reference`);\n }\n } else {\n throw new Error(`[${reference}] is not a valid entity reference`);\n }\n } else {\n return this.legacyParsing(reference, options?.type);\n }\n }\n\n private async resolveByFileId(reference: string) {\n const baseURL = this.cristalApp.getWikiConfig().baseURL;\n const ocsUrl = new URL(`${baseURL}/ocs/v2.php/references/resolve`);\n ocsUrl.searchParams.set(\"reference\", reference);\n\n const headers = await this.httpHeadersProvider.getHeaders();\n headers.set(\"Accept\", \"application/json\");\n\n const request = await fetch(ocsUrl, {\n headers,\n });\n const json = await request.json();\n const path = json.ocs.data.references[reference].richObject.path as string;\n const dirRoot =\n this.cristalApp\n .getWikiConfig()\n .storageRoot?.substring(\"/files/${username}\".length) || \".cristal/\";\n // Remove the root directory from the path\n return this.legacyParsing(\n path.substring(dirRoot.length).replace(/\\.md$/, \"\"),\n );\n }\n\n private legacyParsing(reference: string, type?: EntityType) {\n if (type === EntityType.ATTACHMENT) {\n return this.relativeAttachmentParsing(reference);\n } else {\n return this.innerSynchronousParsing(reference);\n }\n }\n\n private innerSynchronousParsing(reference: string) {\n let segments = reference.split(\"/\");\n if (segments[0] == \"\") {\n segments = segments.slice(1);\n }\n if (segments[segments.length - 2] == \"attachments\") {\n const documentName = segments[segments.length - 3];\n return new AttachmentReference(\n segments[segments.length - 1],\n new DocumentReference(\n documentName.startsWith(\".\")\n ? documentName.substring(1)\n : documentName,\n new SpaceReference(\n undefined,\n ...segments.slice(0, segments.length - 3),\n ),\n ),\n );\n } else {\n return new DocumentReference(\n segments[segments.length - 1],\n new SpaceReference(\n undefined,\n ...segments.slice(0, segments.length - 1),\n ),\n );\n }\n }\n\n // eslint-disable-next-line max-statements\n private async relativeAttachmentParsing(\n reference: string,\n ): Promise<AttachmentReference> {\n const m = this._regExp.exec(reference);\n if (m?.groups?.id && m?.groups?.file) {\n const baseURL = this.cristalApp.getWikiConfig().baseURL;\n const resolved = await this.resolveByFileId(\n `${baseURL}/f/${m.groups.id}`,\n );\n return new AttachmentReference(\n m.groups.file,\n new DocumentReference(\n `.attachments.${m.groups.id}`,\n (resolved as DocumentReference).space,\n ),\n {\n \"nextcloud-specific\": \"true\",\n },\n );\n } else {\n const currentDocument =\n this.documentService.getCurrentDocumentReference().value!;\n\n const references = reference.split(\"/\");\n const spaces = references.slice(0, references.length - 3);\n const currentSegments = [...(currentDocument.space?.names ?? [])];\n\n while (spaces[0] == \"..\") {\n currentSegments.pop();\n spaces.shift();\n }\n\n return new AttachmentReference(\n references[references.length - 1],\n new DocumentReference(\n references[references.length - 3].replace(/^\\./, \"\"),\n new SpaceReference(undefined, ...[...currentSegments, ...spaces]),\n ),\n );\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 {\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 { ModelReferenceSerializer } from \"@xwiki/platform-model-reference-api\";\n\n@injectable()\nexport class NextcloudModelReferenceSerializer 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 Nextcloud\");\n case SPACE: {\n const spaceReference = reference as SpaceReference;\n return spaceReference.names.join(\"/\");\n }\n case DOCUMENT: {\n const documentReference = reference as DocumentReference;\n const spaces = this.serialize(documentReference.space);\n const name = documentReference.name;\n if (spaces === undefined || spaces == \"\") {\n return name;\n } else {\n return `${spaces}/${name}`;\n }\n }\n case ATTACHMENT: {\n const attachmentReference = reference as AttachmentReference;\n const document = this.serialize(attachmentReference.document);\n const name = attachmentReference.name;\n return `${document}/attachments/${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 { NextcloudModelReferenceParser } from \"./nextcloudModelReferenceParser\";\nimport { NextcloudModelReferenceSerializer } from \"./nextcloudModelReferenceSerializer\";\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(NextcloudModelReferenceParser)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\n container\n .bind<ModelReferenceSerializer>(\"ModelReferenceSerializer\")\n .to(NextcloudModelReferenceSerializer)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\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 SpaceReference,\n WikiReference,\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 NextcloudRemoteURLParser implements RemoteURLParser {\n constructor(@inject(\"CristalApp\") private readonly cristalApp: CristalApp) {}\n\n parse(urlStr: string): EntityReference | undefined {\n const config = this.getWikiConfig();\n\n // urlMatch will contain either:\n // - [<matchedRemoteUrl>, <username>, <resourceSegments>]\n // - [<macthedRemoteUrl>, <resourceSegments>] (if no \"${username}\" in storageRoot)\n // - undefined (if match failed)\n const urlMatch = [\n ...urlStr.matchAll(\n new RegExp(\n `^${config.baseRestURL}${\n config.storageRoot ?? \"/files/${username}/.cristal\"\n }/(.*)`.replace(\"${username}\", \"([^/]*)\"),\n \"g\",\n ),\n ),\n ][0];\n\n if (urlMatch === undefined) {\n return undefined;\n }\n urlStr = urlMatch[urlMatch.length - 1];\n const segments = this.computeSegments(urlStr);\n\n if (\n segments.length >= 3 &&\n segments[segments.length - 2] == \"attachments\"\n ) {\n return this.buildAttachmentReference(\n segments,\n urlMatch.length == 3 ? urlMatch[1].toString() : undefined,\n );\n } else if (\n segments[segments.length - 1].endsWith(\".md\") &&\n segments[segments.length - 2] != \"attachments\"\n ) {\n return this.buildDocumentReference(\n segments,\n urlMatch.length == 3 ? urlMatch[1].toString() : undefined,\n );\n } else {\n return this.buildSpaceReference(\n segments,\n urlMatch.length == 3 ? urlMatch[1].toString() : undefined,\n );\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 buildAttachmentReference(\n segments: string[],\n username: string | undefined,\n ) {\n const spaces = segments.slice(0, segments.length - 2);\n const newSpaces = [];\n newSpaces.push(...spaces.slice(0, spaces.length - 1));\n newSpaces.push(spaces[spaces.length - 1].slice(1));\n return new AttachmentReference(\n segments[segments.length - 1],\n this.buildDocumentReference(newSpaces, username),\n );\n }\n\n private buildDocumentReference(\n segments: string[],\n username: string | undefined,\n ) {\n return new DocumentReference(\n this.removeExtension(segments[segments.length - 1]),\n this.buildSpaceReference(\n segments.slice(0, segments.length - 1),\n username,\n ),\n );\n }\n\n private buildSpaceReference(spaces: string[], username: string | undefined) {\n return new SpaceReference(\n username ? new WikiReference(username) : undefined,\n ...spaces,\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 { NextcloudRemoteURLParser };\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 { AuthenticationManagerProvider } from \"@xwiki/platform-authentication-api\";\nimport type { EntityReference } from \"@xwiki/platform-model-api\";\nimport type { RemoteURLSerializer } from \"@xwiki/platform-model-remote-url-api\";\n\n@injectable()\nclass NextcloudRemoteURLSerializer implements RemoteURLSerializer {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private readonly authenticationManagerProvider: AuthenticationManagerProvider,\n ) {}\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 return this.serializeSpace(reference);\n case EntityType.DOCUMENT:\n return `${this.serializeDocument(reference)}.md`;\n case EntityType.ATTACHMENT:\n return this.serializeAttachment(reference);\n }\n }\n\n private serializeSpace(spaceReference: SpaceReference) {\n const spaces =\n spaceReference.names.length > 0\n ? \"/\" + spaceReference.names.join(\"/\")\n : \"\";\n const userId = this.authenticationManagerProvider.get()?.getUserId?.();\n return `${this.getRootURL(spaceReference.wiki?.name ?? userId ?? \"\")}${spaces}`;\n }\n\n private serializeDocument(documentReference: DocumentReference) {\n return `${this.serializeSpace(documentReference.space!)}/${documentReference.name}`;\n }\n\n private serializeMeta(documentReference: DocumentReference) {\n return `${this.serializeSpace(documentReference.space!)}/.${documentReference.name}`;\n }\n\n private serializeAttachment(attachmentReference: AttachmentReference) {\n if (attachmentReference.metadata[\"nextcloud-specific\"] === \"true\") {\n const spaceSegments = attachmentReference.document.space!\n ? this.serializeSpace(attachmentReference.document.space) + \"/\"\n : \"\";\n return `${spaceSegments}${attachmentReference.document.name}/${attachmentReference.name}`;\n } else {\n return `${this.serializeMeta(attachmentReference.document)}/attachments/${attachmentReference.name}`;\n }\n }\n\n private getRootURL(username: string) {\n const config = this.cristalApp.getWikiConfig();\n const url = (config.storageRoot ?? \"/files/${username}/.cristal\").replace(\n \"${username}\",\n username,\n );\n return `${config.baseRestURL}${url}`;\n }\n}\n\nexport { NextcloudRemoteURLSerializer };\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 { NextcloudRemoteURLParser } from \"./nextcloudRemoteURLParser\";\nimport { NextcloudRemoteURLSerializer } from \"./nextcloudRemoteURLSerializer\";\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(NextcloudRemoteURLParser)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\n container\n .bind<RemoteURLSerializer>(\"RemoteURLSerializer\")\n .to(NextcloudRemoteURLSerializer)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\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 { SpaceReference, WikiReference } from \"@xwiki/platform-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/platform-navigation-tree-api\";\nimport { Container, inject, injectable, named } from \"inversify\";\nimport type { HTTPHeadersProvider } from \"@xwiki/cristal-nextcloud-http-headers\";\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 {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/platform-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the Nextcloud backend.\n *\n * @since 0.10\n * @beta\n **/\n@injectable()\nclass NextcloudNavigationTreeSource implements NavigationTreeSource {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"HTTPHeadersProvider\")\n @named(\"Nextcloud/Authenticated\")\n private readonly httpHeadersProvider: HTTPHeadersProvider,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-nextcloud.components.NextcloudNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n const currentDepth = currentId ? currentId.split(\"/\").length : 0;\n\n const subdirectories = await this.getSubDirectories(currentId);\n for (const d of subdirectories) {\n const spaces = d.split(\"/\");\n if (spaces.length == currentDepth + 1) {\n const currentPageData = await this.cristalApp.getPage(d);\n navigationTree.push({\n id: d,\n label:\n currentPageData && currentPageData.name\n ? currentPageData.name\n : decodeURI(spaces[spaces.length - 1]),\n location: new SpaceReference(\n new WikiReference(\n (await this.authenticationManagerProvider.get()!.getUserDetails())\n .username!,\n ),\n ...spaces,\n ),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: d,\n },\n }).href,\n has_children: subdirectories.some((d2) => d2.startsWith(`${d}/`)),\n is_terminal: false,\n });\n }\n }\n\n return navigationTree;\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 private async getSubDirectories(directory: string): Promise<Array<string>> {\n const username = (\n await this.authenticationManagerProvider.get()?.getUserDetails()\n )?.username;\n if (!username) {\n return [];\n }\n\n const subdirectories: Array<string> = [];\n try {\n const config = this.cristalApp.getWikiConfig();\n const rootUrl = new URL(\n `${config.baseRestURL}${\n config.storageRoot ?? `/files/${username}/.cristal`\n }`.replace(\"${username}\", username),\n );\n\n const headers = await this.httpHeadersProvider.getHeaders();\n headers.set(\"Depth\", \"2\");\n\n const response = await fetch(`${rootUrl}/${directory}`, {\n method: \"PROPFIND\",\n headers,\n });\n\n const text = await response.text();\n const data = new window.DOMParser().parseFromString(text, \"text/xml\");\n const responses = data.getElementsByTagName(\"d:response\");\n\n for (let i = 1; i < responses.length; i++) {\n const response = responses[i];\n if (response.getElementsByTagName(\"d:collection\").length === 0) {\n let urlFragments = response\n .getElementsByTagName(\"d:href\")[0]\n .textContent!.replace(rootUrl.pathname, \"\")\n .split(\"/\");\n if (urlFragments[0] == \"\") {\n urlFragments = urlFragments.slice(1);\n }\n urlFragments[urlFragments.length - 1] = this.removeExtension(\n urlFragments[urlFragments.length - 1],\n );\n\n subdirectories.push(urlFragments.join(\"/\"));\n }\n }\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n\n return subdirectories;\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // Nextcloud implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\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\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(NextcloudNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"Nextcloud\");\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 { HTTPHeadersProvider } from \"../HTTPHeadersProvider\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/platform-authentication-api\";\n\n/**\n * Provides HTTP headers to perform authenticated requests with Nextcloud's API.\n *\n * @since 0.25.0\n * @beta\n */\n@injectable()\nexport class NextcloudAuthenticatedHTTPHeadersProvider implements HTTPHeadersProvider {\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private readonly authenticationManagerProvider: AuthenticationManagerProvider,\n ) {}\n\n /**\n * Returns the HTTP headers for an authenticated Nextcloud user.\n *\n * @returns the HTTP headers\n */\n async getHeaders(): Promise<Headers> {\n const authorizationHeader = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: Headers = new Headers({\n \"OCS-APIRequest\": \"true\",\n });\n if (authorizationHeader) {\n headers.set(\"Authorization\", authorizationHeader);\n }\n return headers;\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 { NextcloudAuthenticatedHTTPHeadersProvider } from \"./components/NextcloudAuthenticatedHTTPHeadersProvider\";\nimport type { HTTPHeadersProvider } from \"./HTTPHeadersProvider\";\nimport type { Container } from \"inversify\";\n\n/**\n * @since 0.25.0\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<HTTPHeadersProvider>(\"HTTPHeadersProvider\")\n .to(NextcloudAuthenticatedHTTPHeadersProvider)\n .inSingletonScope()\n .whenNamed(\"Nextcloud/Authenticated\");\n }\n}\n\nexport type { HTTPHeadersProvider };\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 = \"Nextcloud\";\n container\n .bind<Factory<Promise<InternalLinksSerializer>>>(\n \"Factory<InternalLinksSerializer>\",\n )\n .toFactory((context) => {\n return async () => {\n const component = (\n await import(\"./nextcloud-internal-link-serializer\")\n ).NextcloudInternalLinkSerializer;\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 NextcloudAuthenticationUIComponentInit } from \"@xwiki/cristal-authentication-nextcloud-ui\";\nimport { ComponentInit as NextcloudPageHierarchyComponentInit } from \"@xwiki/cristal-hierarchy-nextcloud\";\nimport { ComponentInit as NextcloudLinkSuggestComponentInit } from \"@xwiki/cristal-link-suggest-nextcloud\";\nimport { ComponentInit as ModelReferenceNextcloudComponentInit } from \"@xwiki/cristal-model-reference-nextcloud\";\nimport { ComponentInit as ModelRemoteURLNextcloudComponentInit } from \"@xwiki/cristal-model-remote-url-nextcloud\";\nimport { ComponentInit as NextcloudNavigationTreeComponentInit } from \"@xwiki/cristal-navigation-tree-nextcloud\";\nimport { ComponentInit as NextcloudAuthenticatedHTTPHeadersComponentInit } from \"@xwiki/cristal-nextcloud-http-headers\";\nimport { ComponentInit as UniASTMarkdownNextcloudComponentInit } from \"@xwiki/cristal-uniast-markdown-nextcloud\";\nimport type { Container } from \"inversify\";\n\nexport function load(container: Container) {\n new NextcloudAuthenticationUIComponentInit(container);\n new NextcloudLinkSuggestComponentInit(container);\n new NextcloudPageHierarchyComponentInit(container);\n new NextcloudNavigationTreeComponentInit(container);\n new ModelRemoteURLNextcloudComponentInit(container);\n new ModelReferenceNextcloudComponentInit(container);\n new NextcloudAuthenticatedHTTPHeadersComponentInit(container);\n new UniASTMarkdownNextcloudComponentInit(container);\n}\n"],"file":"nextcloud-CQ2JbCvQ.js"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{aY as m,ah as f,a9 as u,ad as i}from"./index-B7HOg_tC.js";var R=Object.getOwnPropertyDescriptor,h=(e,a,r,t)=>{for(var n=t>1?void 0:t?R(a,r):a,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=o(n)||n);return n},p=(e,a)=>(r,t)=>a(r,t,e);let d=class{constructor(e,a,r){this.remoteURLSerializerProvider=e,this.cristalApp=a,this.documentService=r}async serialize(e,a,r){const t=await r.convertInlineContents(e),n=this.remoteURLSerializerProvider.get().serialize(a.parsedReference??void 0),s=await fetch(n,{method:"PROPFIND",body:`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<d:propfind xmlns:d="DAV:">
|
|
3
|
-
<d:prop xmlns:oc="http://owncloud.org/ns">
|
|
4
|
-
<oc:fileid/>
|
|
5
|
-
</d:prop>
|
|
6
|
-
</d:propfind>`,headers:{Authorization:`Basic ${btoa("admin:admin")}`}}),c=new m().parse(await s.text())["d:multistatus"]["d:response"]["d:propstat"]["d:prop"]["oc:fileid"],l=`${this.cristalApp.getWikiConfig().baseURL}/f/${c}`;return`[${t}](${l})`}async serializeImage(e,a){let r;if(e.parsedReference){const t=this.documentService.getCurrentDocumentReference().value;if(e.parsedReference.type==f.ATTACHMENT){const n=e.parsedReference,s=n.document;if(t===s)r=`.${s.name}/attachments/${n.name}`;else{const o=[...t.space&&t.space.names.length>0?t.space.names.map(()=>".."):["."]].join("/"),c=[...n.document.space?.names??[],"."+n.document.name].map(encodeURI).join("/");r=`${o}/${c}/attachments/${encodeURI(n.name)}`}}else throw new Error(`Unexpected type ${e.parsedReference.type} for link serialization`)}else r=e.rawReference;return``}};d=h([u(),p(0,i("RemoteURLSerializerProvider")),p(1,i("CristalApp")),p(2,i("DocumentService"))],d);export{d as NextcloudInternalLinkSerializer};
|
|
7
|
-
//# sourceMappingURL=nextcloud-internal-link-serializer-qLagTAdg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nextcloud-internal-link-serializer-qLagTAdg.js","sources":["../../../core/uniast/uniast-markdown-nextcloud/src/nextcloud-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 { EntityType } from \"@xwiki/platform-model-api\";\nimport { XMLParser } from \"fast-xml-parser\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { DocumentService } from \"@xwiki/platform-document-api\";\nimport type { RemoteURLSerializerProvider } from \"@xwiki/platform-model-remote-url-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 NextcloudInternalLinkSerializer implements InternalLinksSerializer {\n constructor(\n @inject(\"RemoteURLSerializerProvider\")\n private readonly remoteURLSerializerProvider: RemoteURLSerializerProvider,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\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 const urlFromReference = this.remoteURLSerializerProvider\n .get()!\n .serialize(target.parsedReference ?? undefined)!;\n const response = await fetch(urlFromReference, {\n method: \"PROPFIND\",\n body: `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <d:propfind xmlns:d=\"DAV:\">\n <d:prop xmlns:oc=\"http://owncloud.org/ns\">\n <oc:fileid/>\n </d:prop>\n </d:propfind>`,\n headers: {\n Authorization: `Basic ${btoa(\"admin:admin\")}`,\n },\n });\n const xml = new XMLParser().parse(await response.text());\n const fileId =\n xml[\"d:multistatus\"][\"d:response\"][\"d:propstat\"][\"d:prop\"][\"oc:fileid\"];\n const baseURL = this.cristalApp.getWikiConfig().baseURL;\n const url = `${baseURL}/f/${fileId}`;\n return `[${label}](${url})`;\n }\n\n // eslint-disable-next-line max-statements\n async serializeImage(\n target: Extract<LinkTarget, { type: \"internal\" }>,\n alt?: string,\n ): Promise<string> {\n let ref: string;\n if (target.parsedReference) {\n const currentDocumentReference =\n this.documentService.getCurrentDocumentReference().value!;\n if (target.parsedReference.type == EntityType.ATTACHMENT) {\n const parsedReference = target.parsedReference;\n const imageDocumentReference = parsedReference.document;\n if (currentDocumentReference === imageDocumentReference) {\n ref = `.${imageDocumentReference.name}/attachments/${parsedReference.name}`;\n } else {\n const down = [\n ...(currentDocumentReference.space &&\n currentDocumentReference.space.names.length > 0\n ? currentDocumentReference.space.names.map(() => \"..\")\n : [\".\"]),\n ].join(\"/\");\n const up = [\n ...(parsedReference.document.space?.names ?? []),\n \".\" + parsedReference.document.name,\n ]\n .map(encodeURI)\n .join(\"/\");\n ref = `${down}/${up}/attachments/${encodeURI(parsedReference.name)}`;\n }\n } else {\n throw new Error(\n `Unexpected type ${target.parsedReference.type} for link serialization`,\n );\n }\n } else {\n ref = target.rawReference;\n }\n\n return ``;\n }\n}\n"],"names":["NextcloudInternalLinkSerializer","remoteURLSerializerProvider","cristalApp","documentService","content","target","uniAstToMarkdownConverter","label","urlFromReference","response","fileId","XMLParser","url","alt","ref","currentDocumentReference","EntityType","parsedReference","imageDocumentReference","down","up","__decorateClass","injectable","__decorateParam"],"mappings":"sOAmCO,IAAMA,EAAN,KAAyE,CAC9E,YAEmBC,EACsBC,EAEtBC,EACjB,CAJiB,KAAA,4BAAAF,EACsB,KAAA,WAAAC,EAEtB,KAAA,gBAAAC,CAChB,CAEH,MAAM,UACJC,EACAC,EACAC,EACiB,CACjB,MAAMC,EACJ,MAAMD,EAA0B,sBAAsBF,CAAO,EACzDI,EAAmB,KAAK,4BAC3B,IAAA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CACF,EA/Ead,EAANqB,EAAA,CADNC,EAAA,EAGIC,MAAO,6BAA6B,CAAA,EAEpCA,MAAO,YAAY,CAAA,EACnBA,MAAO,iBAAiB,CAAA,CAAA,EALhBvB,CAAA"}
|
package/dist/offline-lGzDTw-r.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{aa as Ao,ab as jo,ac as Io,a9 as zn,ad as et,ae as Do}from"./index-B7HOg_tC.js";var Vt={exports:{}},To=Vt.exports,Dr;function Ro(){return Dr||(Dr=1,(function(p,_){((C,P)=>{p.exports=P()})(To,function(){var C=function(e,t){return(C=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(n,r){n.__proto__=r}:function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}))(e,t)},P=function(){return(P=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function q(e,t,n){for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var B=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Ao,F=Object.keys,N=Array.isArray;function Y(e,t){return typeof t=="object"&&F(t).forEach(function(n){e[n]=t[n]}),e}typeof Promise>"u"||B.Promise||(B.Promise=Promise);var H=Object.getPrototypeOf,oe={}.hasOwnProperty;function $(e,t){return oe.call(e,t)}function Z(e,t){typeof t=="function"&&(t=t(H(e))),(typeof Reflect>"u"?F:Reflect.ownKeys)(t).forEach(function(n){be(e,n,t[n])})}var ve=Object.defineProperty;function be(e,t,n,r){ve(e,t,Y(n&&$(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function Ne(e){return{from:function(t){return e.prototype=Object.create(t.prototype),be(e.prototype,"constructor",e),{extend:Z.bind(null,e.prototype)}}}}var $r=Object.getOwnPropertyDescriptor,Qr=[].slice;function mt(e,t,n){return Qr.call(e,t,n)}function Vn(e,t){return t(e)}function tt(e){if(!e)throw new Error("Assertion Failed")}function $n(e){B.setImmediate?setImmediate(e):setTimeout(e,0)}function de(e,t){if(typeof t=="string"&&$(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,o=t.length;r<o;++r){var i=de(e,t[r]);n.push(i)}return n}var a,u=t.indexOf(".");return u===-1||(a=e[t.substr(0,u)])==null?void 0:de(a,t.substr(u+1))}function ae(e,t,n){if(e&&t!==void 0&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){tt(typeof n!="string"&&"length"in n);for(var r=0,o=t.length;r<o;++r)ae(e,t[r],n[r])}else{var i,a,u=t.indexOf(".");u!==-1?(i=t.substr(0,u),(u=t.substr(u+1))===""?n===void 0?N(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n:ae(a=(a=e[i])&&$(e,i)?a:e[i]={},u,n)):n===void 0?N(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function Qn(e){var t,n={};for(t in e)$(e,t)&&(n[t]=e[t]);return n}var Yr=[].concat;function Yn(e){return Yr.apply([],e)}var ye="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Yn([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return B[e]}),Hn=new Set(ye.map(function(e){return B[e]})),nt=null;function Ee(e){return nt=new WeakMap,e=(function t(n){if(!n||typeof n!="object")return n;var r=nt.get(n);if(r)return r;if(N(n)){r=[],nt.set(n,r);for(var o=0,i=n.length;o<i;++o)r.push(t(n[o]))}else if(Hn.has(n.constructor))r=n;else{var a,u=H(n);for(a in r=u===Object.prototype?{}:Object.create(u),nt.set(n,r),n)$(n,a)&&(r[a]=t(n[a]))}return r})(e),nt=null,e}var Hr={}.toString;function Xt(e){return Hr.call(e).slice(8,-1)}var Jt=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Gr=typeof Jt=="symbol"?function(e){var t;return e!=null&&(t=e[Jt])&&t.apply(e)}:function(){return null};function Ce(e,t){t=e.indexOf(t),0<=t&&e.splice(t,1)}var Le={};function pe(e){var t,n,r,o;if(arguments.length===1){if(N(e))return e.slice();if(this===Le&&typeof e=="string")return[e];if(o=Gr(e))for(n=[];!(r=o.next()).done;)n.push(r.value);else{if(e==null)return[e];if(typeof(t=e.length)!="number")return[e];for(n=new Array(t);t--;)n[t]=e[t]}}else for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var Zt=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},ye=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ue=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ye),Xr={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function We(e,t){this.name=e,this.message=t}function Gn(e,t){return e+". Errors: "+Object.keys(t).map(function(n){return t[n].toString()}).filter(function(n,r,o){return o.indexOf(n)===r}).join(`
|
|
2
|
-
`)}function vt(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Gn(e,t)}function Ue(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=Gn(e,this.failures)}Ne(We).from(Error).extend({toString:function(){return this.name+": "+this.message}}),Ne(vt).from(We),Ne(Ue).from(We);var en=ue.reduce(function(e,t){return e[t]=t+"Error",e},{}),Jr=We,T=ue.reduce(function(e,t){var n=t+"Error";function r(o,i){this.name=n,o?typeof o=="string"?(this.message="".concat(o).concat(i?`
|
|
3
|
-
`+i:""),this.inner=i||null):typeof o=="object"&&(this.message="".concat(o.name," ").concat(o.message),this.inner=o):(this.message=Xr[t]||n,this.inner=null)}return Ne(r).from(Jr),e[t]=r,e},{}),Xn=(T.Syntax=SyntaxError,T.Type=TypeError,T.Range=RangeError,ye.reduce(function(e,t){return e[t+"Error"]=T[t],e},{}));ye=ue.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=T[t]),e},{});function V(){}function rt(e){return e}function Zr(e,t){return e==null||e===rt?t:function(n){return t(e(n))}}function Ke(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function eo(e,t){return e===V?t:function(){var n=e.apply(this,arguments),r=(n!==void 0&&(arguments[0]=n),this.onsuccess),o=this.onerror,i=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return r&&(this.onsuccess=this.onsuccess?Ke(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Ke(o,this.onerror):o),i!==void 0?i:n}}function to(e,t){return e===V?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Ke(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Ke(r,this.onerror):r)}}function no(e,t){return e===V?t:function(o){var r=e.apply(this,arguments),o=(Y(o,r),this.onsuccess),i=this.onerror,a=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return o&&(this.onsuccess=this.onsuccess?Ke(o,this.onsuccess):o),i&&(this.onerror=this.onerror?Ke(i,this.onerror):i),r===void 0?a===void 0?void 0:a:Y(r,a)}}function ro(e,t){return e===V?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function tn(e,t){return e===V?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,o=arguments.length,i=new Array(o);o--;)i[o]=arguments[o];return n.then(function(){return t.apply(r,i)})}return t.apply(this,arguments)}}ye.ModifyError=vt,ye.DexieError=We,ye.BulkError=Ue;var le=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Jn(e){le=e}var ot={},Zn=100,it=typeof Promise>"u"?[]:(ue=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[it=crypto.subtle.digest("SHA-512",new Uint8Array([0])),H(it),ue]:[ue,H(ue),ue]),ue=it[0],Xe=it[1],Xe=Xe&&Xe.then,Ae=ue&&ue.constructor,nn=!!it[2],at=function(e,t){ut.push([e,t]),bt&&(queueMicrotask(io),bt=!1)},rn=!0,bt=!0,je=[],wt=[],on=rt,we={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:V,pgp:!1,env:{},finalize:V},D=we,ut=[],Ie=0,_t=[];function K(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=D;if(typeof e!="function"){if(e!==ot)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&un(this,this._value)}else this._state=null,this._value=null,++t.ref,(function n(r,o){try{o(function(i){if(r._state===null){if(i===r)throw new TypeError("A promise cannot be resolved with itself.");var a=r._lib&&ze();i&&typeof i.then=="function"?n(r,function(u,l){i instanceof K?i._then(u,l):i.then(u,l)}):(r._state=!0,r._value=i,tr(r)),a&&Ve()}},un.bind(null,r))}catch(i){un(r,i)}})(this,e)}var an={get:function(){var e=D,t=Ot;function n(r,o){var i=this,a=!e.global&&(e!==D||t!==Ot),u=a&&!ke(),l=new K(function(m,f){sn(i,new er(rr(r,e,a,u),rr(o,e,a,u),m,f,e))});return this._consoleTask&&(l._consoleTask=this._consoleTask),l}return n.prototype=ot,n},set:function(e){be(this,"then",e&&e.prototype===ot?an:{get:function(){return e},set:an.set})}};function er(e,t,n,r,o){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=o}function un(e,t){var n,r;wt.push(t),e._state===null&&(n=e._lib&&ze(),t=on(t),e._state=!1,e._value=t,r=e,je.some(function(o){return o._value===r._value})||je.push(r),tr(e),n)&&Ve()}function tr(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)sn(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),Ie===0&&(++Ie,at(function(){--Ie==0&&cn()},[]))}function sn(e,t){if(e._state===null)e._listeners.push(t);else{var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Ie,at(oo,[n,e,t])}}function oo(e,t,n){try{var r,o=t._value;!t._state&&wt.length&&(wt=[]),r=le&&t._consoleTask?t._consoleTask.run(function(){return e(o)}):e(o),t._state||wt.indexOf(o)!==-1||(i=>{for(var a=je.length;a;)if(je[--a]._value===i._value)return je.splice(a,1)})(t),n.resolve(r)}catch(i){n.reject(i)}finally{--Ie==0&&cn(),--n.psd.ref||n.psd.finalize()}}function io(){De(we,function(){ze()&&Ve()})}function ze(){var e=rn;return bt=rn=!1,e}function Ve(){var e,t,n;do for(;0<ut.length;)for(e=ut,ut=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(0<ut.length);bt=rn=!0}function cn(){for(var e=je,t=(je=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)}),_t.slice(0)),n=t.length;n;)t[--n]()}function kt(e){return new K(ot,!1,e)}function G(e,t){var n=D;return function(){var r=ze(),o=D;try{return xe(n,!0),e.apply(this,arguments)}catch(i){t&&t(i)}finally{xe(o,!1),r&&Ve()}}}Z(K.prototype,{then:an,_then:function(e,t){sn(this,new er(null,null,e,t,D))},catch:function(e){var t,n;return arguments.length===1?this.then(null,e):(t=e,n=arguments[1],typeof t=="function"?this.then(null,function(r){return(r instanceof t?n:kt)(r)}):this.then(null,function(r){return(r&&r.name===t?n:kt)(r)}))},finally:function(e){return this.then(function(t){return K.resolve(e()).then(function(){return t})},function(t){return K.resolve(e()).then(function(){return kt(t)})})},timeout:function(e,t){var n=this;return e<1/0?new K(function(r,o){var i=setTimeout(function(){return o(new T.Timeout(t))},e);n.then(r,o).finally(clearTimeout.bind(null,i))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&be(K.prototype,Symbol.toStringTag,"Dexie.Promise"),we.env=nr(),Z(K,{all:function(){var e=pe.apply(null,arguments).map(St);return new K(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(o,i){return K.resolve(o).then(function(a){e[i]=a,--r||t(e)},n)})})},resolve:function(e){return e instanceof K?e:e&&typeof e.then=="function"?new K(function(t,n){e.then(t,n)}):new K(ot,!0,e)},reject:kt,race:function(){var e=pe.apply(null,arguments).map(St);return new K(function(t,n){e.map(function(r){return K.resolve(r).then(t,n)})})},PSD:{get:function(){return D},set:function(e){return D=e}},totalEchoes:{get:function(){return Ot}},newPSD:_e,usePSD:De,scheduler:{get:function(){return at},set:function(e){at=e}},rejectionMapper:{get:function(){return on},set:function(e){on=e}},follow:function(e,t){return new K(function(n,r){return _e(function(o,i){var a=D;a.unhandleds=[],a.onunhandled=i,a.finalize=Ke(function(){var u,l=this;u=function(){l.unhandleds.length===0?o():i(l.unhandleds[0])},_t.push(function m(){u(),_t.splice(_t.indexOf(m),1)}),++Ie,at(function(){--Ie==0&&cn()},[])},a.finalize),e()},t,n,r)})}}),Ae&&(Ae.allSettled&&be(K,"allSettled",function(){var e=pe.apply(null,arguments).map(St);return new K(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(o,i){return K.resolve(o).then(function(a){return r[i]={status:"fulfilled",value:a}},function(a){return r[i]={status:"rejected",reason:a}}).then(function(){return--n||t(r)})})})}),Ae.any&&typeof AggregateError<"u"&&be(K,"any",function(){var e=pe.apply(null,arguments).map(St);return new K(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,o=new Array(r);e.forEach(function(i,a){return K.resolve(i).then(function(u){return t(u)},function(u){o[a]=u,--r||n(new AggregateError(o))})})})}),Ae.withResolvers)&&(K.withResolvers=Ae.withResolvers);var ne={awaits:0,echoes:0,id:0},ao=0,xt=[],Pt=0,Ot=0,uo=0;function _e(e,a,n,r){var o=D,i=Object.create(o),a=(i.parent=o,i.ref=0,i.global=!1,i.id=++uo,we.env,i.env=nn?{Promise:K,PromiseProp:{value:K,configurable:!0,writable:!0},all:K.all,race:K.race,allSettled:K.allSettled,any:K.any,resolve:K.resolve,reject:K.reject}:{},a&&Y(i,a),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()},De(i,e,n,r));return i.ref===0&&i.finalize(),a}function $e(){return ne.id||(ne.id=++ao),++ne.awaits,ne.echoes+=Zn,ne.id}function ke(){return!!ne.awaits&&(--ne.awaits==0&&(ne.id=0),ne.echoes=ne.awaits*Zn,!0)}function St(e){return ne.echoes&&e&&e.constructor===Ae?($e(),e.then(function(t){return ke(),t},function(t){return ke(),ee(t)})):e}function so(){var e=xt[xt.length-1];xt.pop(),xe(e,!1)}function xe(e,t){var n,r,o=D;(t?!ne.echoes||Pt++&&e===D:!Pt||--Pt&&e===D)||queueMicrotask(t?function(i){++Ot,ne.echoes&&--ne.echoes!=0||(ne.echoes=ne.awaits=ne.id=0),xt.push(D),xe(i,!0)}.bind(null,e):so),e!==D&&(D=e,o===we&&(we.env=nr()),nn)&&(n=we.env.Promise,r=e.env,o.global||e.global)&&(Object.defineProperty(B,"Promise",r.PromiseProp),n.all=r.all,n.race=r.race,n.resolve=r.resolve,n.reject=r.reject,r.allSettled&&(n.allSettled=r.allSettled),r.any)&&(n.any=r.any)}function nr(){var e=B.Promise;return nn?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(B,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function De(e,t,n,r,o){var i=D;try{return xe(e,!0),t(n,r,o)}finally{xe(i,!1)}}function rr(e,t,n,r){return typeof e!="function"?e:function(){var o=D;n&&$e(),xe(t,!0);try{return e.apply(this,arguments)}finally{xe(o,!1),r&&queueMicrotask(ke)}}}function ln(e){Promise===Ae&&ne.echoes===0?Pt===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}(""+Xe).indexOf("[native code]")===-1&&($e=ke=V);var ee=K.reject,Te="",ge="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",or="String expected.",Qe=[],Et="__dbnames",fn="readonly",hn="readwrite";function Re(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ir={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Ct(e){return typeof e!="string"||/\./.test(e)?function(t){return t}:function(t){return t[e]===void 0&&e in t&&delete(t=Ee(t))[e],t}}function ar(){throw T.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function L(e,t){try{var n=ur(e),r=ur(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":for(var o=sr(e),i=sr(t),a=o.length,u=i.length,l=a<u?a:u,m=0;m<l;++m)if(o[m]!==i[m])return o[m]<i[m]?-1:1;return a===u?0:a<u?-1:1;case"Array":for(var f=e,s=t,d=f.length,y=s.length,h=d<y?d:y,c=0;c<h;++c){var v=L(f[c],s[c]);if(v!==0)return v}return d===y?0:d<y?-1:1}}catch{}return NaN}function ur(e){var t=typeof e;return t=="object"&&(ArrayBuffer.isView(e)||(t=Xt(e))==="ArrayBuffer")?"binary":t}function sr(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function Kt(e,t,n){var r=e.schema.yProps;return r?(t&&0<n.numFailures&&(t=t.filter(function(o,i){return!n.failures[i]})),Promise.all(r.map(function(o){return o=o.updatesTable,t?e.db.table(o).where("k").anyOf(t).delete():e.db.table(o).clear()})).then(function(){return n})):n}cr.prototype.execute=function(e){var t=this["@@propmod"];if(t.add!==void 0){var n=t.add;if(N(n))return q(q([],N(e)?e:[],!0),n).sort();if(typeof n=="number")return(Number(e)||0)+n;if(typeof n=="bigint")try{return BigInt(e)+n}catch{return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(t.remove!==void 0){var r=t.remove;if(N(r))return N(e)?e.filter(function(o){return!r.includes(o)}).sort():[];if(typeof r=="number")return Number(e)-r;if(typeof r=="bigint")try{return BigInt(e)-r}catch{return BigInt(0)-r}throw new TypeError("Invalid subtrahend ".concat(r))}return n=(n=t.replacePrefix)==null?void 0:n[0],n&&typeof e=="string"&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e};var st=cr;function cr(e){this["@@propmod"]=e}function lr(e,t){for(var n=F(t),r=n.length,o=!1,i=0;i<r;++i){var a=n[i],u=t[a],l=de(e,a);u instanceof st?(ae(e,a,u.execute(l)),o=!0):l!==u&&(ae(e,a,u),o=!0)}return o}Q.prototype._trans=function(e,t,n){var r=this._tx||D.trans,o=this.name,i=le&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(e==="readonly"?"read":"write"," ").concat(this.name));function a(m,f,s){if(s.schema[o])return t(s.idbtrans,s);throw new T.NotFound("Table "+o+" not part of transaction")}var u=ze();try{var l=r&&r.db._novip===this.db._novip?r===D.trans?r._promise(e,a,n):_e(function(){return r._promise(e,a,n)},{trans:r,transless:D.transless||D}):(function m(f,s,d,y){if(f.idbdb&&(f._state.openComplete||D.letThrough||f._vip)){var h=f._createTransaction(s,d,f._dbSchema);try{h.create(),f._state.PR1398_maxLoop=3}catch(c){return c.name===en.InvalidState&&f.isOpen()&&0<--f._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),f.close({disableAutoOpen:!1}),f.open().then(function(){return m(f,s,d,y)})):ee(c)}return h._promise(s,function(c,v){return _e(function(){return D.trans=h,y(c,v,h)})}).then(function(c){if(s==="readwrite")try{h.idbtrans.commit()}catch{}return s==="readonly"?c:h._completion.then(function(){return c})})}if(f._state.openComplete)return ee(new T.DatabaseClosed(f._state.dbOpenError));if(!f._state.isBeingOpened){if(!f._state.autoOpen)return ee(new T.DatabaseClosed);f.open().catch(V)}return f._state.dbReadyPromise.then(function(){return m(f,s,d,y)})})(this.db,e,[this.name],a);return i&&(l._consoleTask=i,l=l.catch(function(m){return console.trace(m),ee(m)})),l}finally{u&&Ve()}},Q.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):e==null?ee(new T.Type("Invalid argument to Table.get()")):this._trans("readonly",function(r){return n.core.get({trans:r,key:e}).then(function(o){return n.hook.reading.fire(o)})}).then(t)},Q.prototype.where=function(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(N(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=F(e);if(t.length===1)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(u){if(u.compound&&t.every(function(m){return 0<=u.keyPath.indexOf(m)})){for(var l=0;l<t.length;++l)if(t.indexOf(u.keyPath[l])===-1)return!1;return!0}return!1}).sort(function(u,l){return u.keyPath.length-l.keyPath.length})[0];if(n&&this.db._maxKey!==Te)return a=n.keyPath.slice(0,t.length),this.where(a).equals(a.map(function(u){return e[u]}));!n&&le&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var r=this.schema.idxByName;function o(u,l){return L(u,l)===0}var a=t.reduce(function(f,l){var m=f[0],f=f[1],s=r[l],d=e[l];return[m||s,m||!s?Re(f,s&&s.multi?function(y){return y=de(y,l),N(y)&&y.some(function(h){return o(d,h)})}:function(y){return o(d,de(y,l))}):f]},[null,null]),i=a[0],a=a[1];return i?this.where(i.name).equals(e[i.keyPath]).filter(a):n?this.filter(a):this.where(t).equals("")},Q.prototype.filter=function(e){return this.toCollection().and(e)},Q.prototype.count=function(e){return this.toCollection().count(e)},Q.prototype.offset=function(e){return this.toCollection().offset(e)},Q.prototype.limit=function(e){return this.toCollection().limit(e)},Q.prototype.each=function(e){return this.toCollection().each(e)},Q.prototype.toArray=function(e){return this.toCollection().toArray(e)},Q.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Q.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,N(e)?"[".concat(e.join("+"),"]"):e))},Q.prototype.reverse=function(){return this.toCollection().reverse()},Q.prototype.mapToClass=function(e){for(var t=this.db,n=this.name,r=((this.schema.mappedClass=e).prototype instanceof ar&&(e=(a=>{var u=f,l=a;if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function m(){this.constructor=u}function f(){return a!==null&&a.apply(this,arguments)||this}return C(u,l),u.prototype=l===null?Object.create(l):(m.prototype=l.prototype,new m),Object.defineProperty(f.prototype,"db",{get:function(){return t},enumerable:!1,configurable:!0}),f.prototype.table=function(){return n},f})(e)),new Set),o=e.prototype;o;o=H(o))Object.getOwnPropertyNames(o).forEach(function(a){return r.add(a)});function i(a){if(!a)return a;var u,l=Object.create(e.prototype);for(u in a)if(!r.has(u))try{l[u]=a[u]}catch{}return l}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=i,this.hook("reading",i),e},Q.prototype.defineClass=function(){return this.mapToClass(function(e){Y(this,e)})},Q.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=Ct(i)(e)),this._trans("readwrite",function(u){return n.core.mutate({trans:u,type:"add",keys:t!=null?[t]:null,values:[a]})}).then(function(u){return u.numFailures?K.reject(u.failures[0]):u.lastResult}).then(function(u){if(i)try{ae(e,i,u)}catch{}return u})},Q.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",function(o){return n.core.get({trans:o,key:e}).then(function(i){var a=i??{};return lr(a,t),r&&ae(a,r,e),n.core.mutate({trans:o,type:"put",values:[a],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then(function(u){return u.numFailures?K.reject(u.failures[0]):!!i})})})},Q.prototype.update=function(e,t){return typeof e!="object"||N(e)?this.where(":id").equals(e).modify(t):(e=de(e,this.schema.primKey.keyPath))===void 0?ee(new T.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},Q.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=Ct(i)(e)),this._trans("readwrite",function(u){return n.core.mutate({trans:u,type:"put",values:[a],keys:t!=null?[t]:null})}).then(function(u){return u.numFailures?K.reject(u.failures[0]):u.lastResult}).then(function(u){if(i)try{ae(e,i,u)}catch{}return u})},Q.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then(function(r){return Kt(t,[e],r)}).then(function(r){return r.numFailures?K.reject(r.failures[0]):void 0})})},Q.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:ir}).then(function(n){return Kt(e,null,n)})}).then(function(t){return t.numFailures?K.reject(t.failures[0]):void 0})},Q.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(r){return r.map(function(o){return t.hook.reading.fire(o)})})})},Q.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(a){var u=r.schema.primKey,m=u.auto,u=u.keyPath;if(u&&o)throw new T.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new T.InvalidArgument("Arguments objects and keys must have the same length");var l=e.length,m=u&&m?e.map(Ct(u)):e;return r.core.mutate({trans:a,type:"add",keys:o,values:m,wantResults:i}).then(function(f){var s=f.numFailures,d=f.failures;if(s===0)return i?f.results:f.lastResult;throw new Ue("".concat(r.name,".bulkAdd(): ").concat(s," of ").concat(l," operations failed"),d)})})},Q.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(a){var u=r.schema.primKey,m=u.auto,u=u.keyPath;if(u&&o)throw new T.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new T.InvalidArgument("Arguments objects and keys must have the same length");var l=e.length,m=u&&m?e.map(Ct(u)):e;return r.core.mutate({trans:a,type:"put",keys:o,values:m,wantResults:i}).then(function(f){var s=f.numFailures,d=f.failures;if(s===0)return i?f.results:f.lastResult;throw new Ue("".concat(r.name,".bulkPut(): ").concat(s," of ").concat(l," operations failed"),d)})})},Q.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(a){return a.key}),o=e.map(function(a){return a.changes}),i=[];return this._trans("readwrite",function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then(function(u){var l=[],m=[],f=(e.forEach(function(s,d){var y=s.key,h=s.changes,c=u[d];if(c){for(var v=0,b=Object.keys(h);v<b.length;v++){var g=b[v],w=h[g];if(g===t.schema.primKey.keyPath){if(L(w,y)!==0)throw new T.Constraint("Cannot update primary key in bulkUpdate()")}else ae(c,g,w)}i.push(d),l.push(y),m.push(c)}}),l.length);return n.mutate({trans:a,type:"put",keys:l,values:m,updates:{keys:r,changeSpecs:o}}).then(function(s){var d=s.numFailures,y=s.failures;if(d===0)return f;for(var h=0,c=Object.keys(y);h<c.length;h++){var v,b=c[h],g=i[Number(b)];g!=null&&(v=y[b],delete y[b],y[g]=v)}throw new Ue("".concat(t.name,".bulkUpdate(): ").concat(d," of ").concat(f," operations failed"),y)})})})},Q.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",function(r){return t.core.mutate({trans:r,type:"delete",keys:e}).then(function(o){return Kt(t,e,o)})}).then(function(r){var o=r.numFailures,i=r.failures;if(o===0)return r.lastResult;throw new Ue("".concat(t.name,".bulkDelete(): ").concat(o," of ").concat(n," operations failed"),i)})};var fr=Q;function Q(){}function ct(e){function t(a,u){if(u){for(var l=arguments.length,m=new Array(l-1);--l;)m[l-1]=arguments[l];return n[a].subscribe.apply(null,m),e}if(typeof a=="string")return n[a]}var n={};t.addEventType=i;for(var r=1,o=arguments.length;r<o;++r)i(arguments[r]);return t;function i(a,u,l){var m,f;if(typeof a!="object")return u=u||ro,f={subscribers:[],fire:l=l||V,subscribe:function(s){f.subscribers.indexOf(s)===-1&&(f.subscribers.push(s),f.fire=u(f.fire,s))},unsubscribe:function(s){f.subscribers=f.subscribers.filter(function(d){return d!==s}),f.fire=f.subscribers.reduce(u,l)}},n[a]=t[a]=f;F(m=a).forEach(function(s){var d=m[s];if(N(d))i(s,m[s][0],m[s][1]);else{if(d!=="asap")throw new T.InvalidArgument("Invalid event config");var y=i(s,rt,function(){for(var h=arguments.length,c=new Array(h);h--;)c[h]=arguments[h];y.subscribers.forEach(function(v){$n(function(){v.apply(null,c)})})})}})}}function lt(e,t){return Ne(t).from({prototype:e}),t}function Ye(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function dn(e,t){e.filter=Re(e.filter,t)}function pn(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Re(r(),t())}:t,e.justLimit=n&&!r}function At(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(n)return n;throw new T.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed")}function hr(e,t,n){var r=At(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function jt(e,t,n,r){var o,i,a=e.replayFilter?Re(e.filter,e.replayFilter()):e.filter;return e.or?(o={},i=function(u,l,m){var f,s;a&&!a(l,m,function(d){return l.stop(d)},function(d){return l.fail(d)})||((s=""+(f=l.primaryKey))=="[object ArrayBuffer]"&&(s=""+new Uint8Array(f)),$(o,s))||(o[s]=!0,t(u,l,m))},Promise.all([e.or._iterate(i,n),dr(hr(e,r,n),e.algorithm,i,!e.keysOnly&&e.valueMapper)])):dr(hr(e,r,n),Re(e.algorithm,a),t,!e.keysOnly&&e.valueMapper)}function dr(e,t,n,r){var o=G(r?function(i,a,u){return n(r(i),a,u)}:n);return e.then(function(i){if(i)return i.start(function(){var a=function(){return i.continue()};t&&!t(i,function(u){return a=u},function(u){i.stop(u),a=V},function(u){i.fail(u),a=V})||o(i.value,i,function(u){return a=u}),a()})})}U.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,ee.bind(null,n.error)):n.table._trans("readonly",e).then(t)},U.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,ee.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},U.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Re(t.algorithm,e)},U.prototype._iterate=function(e,t){return jt(this._ctx,e,t,this._ctx.table.core)},U.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Y(n,e),t._ctx=n,t},U.prototype.raw=function(){return this._ctx.valueMapper=null,this},U.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return jt(t,e,n,t.table.core)})},U.prototype.count=function(e){var t=this;return this._read(function(n){var r,o=t._ctx,i=o.table.core;return Ye(o,!0)?i.count({trans:n,query:{index:At(o,i.schema),range:o.range}}).then(function(a){return Math.min(a,o.limit)}):(r=0,jt(o,function(){return++r,!1},n,i).then(function(){return r}))}).then(e)},U.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],o=n.length-1;function i(l,m){return m?i(l[n[m]],m-1):l[r]}var a=this._ctx.dir==="next"?1:-1;function u(l,m){return L(i(l,o),i(m,o))*a}return this.toArray(function(l){return l.sort(u)}).then(t)},U.prototype.toArray=function(e){var t=this;return this._read(function(n){var r,o,i,a=t._ctx;return a.dir==="next"&&Ye(a,!0)&&0<a.limit?(r=a.valueMapper,o=At(a,a.table.core.schema),a.table.core.query({trans:n,limit:a.limit,values:!0,query:{index:o,range:a.range}}).then(function(u){return u=u.result,r?u.map(r):u})):(i=[],jt(a,function(u){return i.push(u)},n,a.table.core).then(function(){return i}))},e)},U.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,Ye(t)?pn(t,function(){var n=e;return function(r,o){return n===0||(n===1?--n:o(function(){r.advance(n),n=0}),!1)}}):pn(t,function(){var n=e;return function(){return--n<0}})),this},U.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),pn(this._ctx,function(){var t=e;return function(n,r,o){return--t<=0&&r(o),0<=t}},!0),this},U.prototype.until=function(e,t){return dn(this._ctx,function(n,r,o){return!e(n.value)||(r(o),t)}),this},U.prototype.first=function(e){return this.limit(1).toArray(function(t){return t[0]}).then(e)},U.prototype.last=function(e){return this.reverse().first(e)},U.prototype.filter=function(e){var t;return dn(this._ctx,function(n){return e(n.value)}),(t=this._ctx).isMatch=Re(t.isMatch,e),this},U.prototype.and=function(e){return this.filter(e)},U.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},U.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},U.prototype.desc=function(){return this.reverse()},U.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.key,r)})},U.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},U.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(n,r){e(r.primaryKey,r)})},U.prototype.keys=function(e){var t=this._ctx,n=(t.keysOnly=!t.isMatch,[]);return this.each(function(r,o){n.push(o.key)}).then(function(){return n}).then(e)},U.prototype.primaryKeys=function(e){var t=this._ctx;if(t.dir==="next"&&Ye(t,!0)&&0<t.limit)return this._read(function(r){var o=At(t,t.table.core.schema);return t.table.core.query({trans:r,values:!1,limit:t.limit,query:{index:o,range:t.range}})}).then(function(r){return r.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(r,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)},U.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},U.prototype.firstKey=function(e){return this.limit(1).keys(function(t){return t[0]}).then(e)},U.prototype.lastKey=function(e){return this.reverse().firstKey(e)},U.prototype.distinct=function(){var e,t=this._ctx,t=t.index&&t.table.schema.idxByName[t.index];return t&&t.multi&&(e={},dn(this._ctx,function(r){var r=r.primaryKey.toString(),o=$(e,r);return e[r]=!0,!o})),this},U.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){function o(c,v){var b=v.failures;d+=c-v.numFailures;for(var g=0,w=F(b);g<w.length;g++){var k=w[g];s.push(b[k])}}var i=typeof e=="function"?e:function(c){return lr(c,e)},a=n.table.core,f=a.schema.primaryKey,u=f.outbound,l=f.extractKey,m=200,f=t.db._options.modifyChunkSize,s=(f&&(m=typeof f=="object"?f[a.name]||f["*"]||200:f),[]),d=0,y=[],h=e===pr;return t.clone().primaryKeys().then(function(c){function v(g){var w=Math.min(m,c.length-g),k=c.slice(g,g+w);return(h?Promise.resolve([]):a.getMany({trans:r,keys:k,cache:"immutable"})).then(function(S){var E=[],x=[],j=u?[]:null,A=h?k:[];if(!h)for(var O=0;O<w;++O){var I=S[O],W={value:Ee(I),primKey:c[g+O]};i.call(W,W.value,W)!==!1&&(W.value==null?A.push(c[g+O]):u||L(l(I),l(W.value))===0?(x.push(W.value),u&&j.push(c[g+O])):(A.push(c[g+O]),E.push(W.value)))}return Promise.resolve(0<E.length&&a.mutate({trans:r,type:"add",values:E}).then(function(z){for(var R in z.failures)A.splice(parseInt(R),1);o(E.length,z)})).then(function(){return(0<x.length||b&&typeof e=="object")&&a.mutate({trans:r,type:"put",keys:j,values:x,criteria:b,changeSpec:typeof e!="function"&&e,isAdditionalChunk:0<g}).then(function(z){return o(x.length,z)})}).then(function(){return(0<A.length||b&&h)&&a.mutate({trans:r,type:"delete",keys:A,criteria:b,isAdditionalChunk:0<g}).then(function(z){return Kt(n.table,A,z)}).then(function(z){return o(A.length,z)})}).then(function(){return c.length>g+w&&v(g+m)})})}var b=Ye(n)&&n.limit===1/0&&(typeof e!="function"||h)&&{index:n.index,range:n.range};return v(0).then(function(){if(0<s.length)throw new vt("Error modifying one or more objects",s,d,y);return c.length})})})},U.prototype.delete=function(){var e=this._ctx,t=e.range;return!Ye(e)||e.table.schema.yProps||!e.isPrimKey&&t.type!==3?this.modify(pr):this._write(function(n){var r=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then(function(i){return e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(function(l){var u=l.failures,l=l.numFailures;if(l)throw new vt("Could not delete some values",Object.keys(u).map(function(m){return u[m]}),i-l);return i-l})})})};var co=U;function U(){}var pr=function(e,t){return t.value=null};function lo(e,t){return e<t?-1:e===t?0:1}function fo(e,t){return t<e?-1:e===t?0:1}function se(e,t,n){return e=e instanceof gr?new e.Collection(e):e,e._ctx.error=new(n||TypeError)(t),e}function He(e){return new e.Collection(e,function(){return yr("")}).limit(0)}function It(y,t,n,r){var o,i,a,u,l,m,f,s=n.length;if(!n.every(function(c){return typeof c=="string"}))return se(y,or);function d(c){o=c==="next"?function(b){return b.toUpperCase()}:function(b){return b.toLowerCase()},i=c==="next"?function(b){return b.toLowerCase()}:function(b){return b.toUpperCase()},a=c==="next"?lo:fo;var v=n.map(function(b){return{lower:i(b),upper:o(b)}}).sort(function(b,g){return a(b.lower,g.lower)});u=v.map(function(b){return b.upper}),l=v.map(function(b){return b.lower}),f=(m=c)==="next"?"":r}d("next");var y=new y.Collection(y,function(){return Pe(u[0],l[s-1]+r)}),h=(y._ondirectionchange=function(c){d(c)},0);return y._addAlgorithm(function(c,v,b){var g=c.key;if(typeof g=="string"){var w=i(g);if(t(w,l,h))return!0;for(var k=null,S=h;S<s;++S){var E=((x,j,A,O,I,W)=>{for(var z=Math.min(x.length,O.length),R=-1,M=0;M<z;++M){var X=j[M];if(X!==O[M])return I(x[M],A[M])<0?x.substr(0,M)+A[M]+A.substr(M+1):I(x[M],O[M])<0?x.substr(0,M)+O[M]+A.substr(M+1):0<=R?x.substr(0,R)+j[R]+A.substr(R+1):null;I(x[M],X)<0&&(R=M)}return z<O.length&&W==="next"?x+A.substr(x.length):z<x.length&&W==="prev"?x.substr(0,A.length):R<0?null:x.substr(0,R)+O[R]+A.substr(R+1)})(g,w,u[S],l[S],a,m);E===null&&k===null?h=S+1:(k===null||0<a(k,E))&&(k=E)}v(k!==null?function(){c.continue(k+f)}:b)}return!1}),y}function Pe(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function yr(e){return{type:1,lower:e,upper:e}}Object.defineProperty(re.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),re.prototype.between=function(e,t,n,r){n=n!==!1,r=r===!0;try{return 0<this._cmp(e,t)||this._cmp(e,t)===0&&(n||r)&&(!n||!r)?He(this):new this.Collection(this,function(){return Pe(e,t,!n,!r)})}catch{return se(this,ge)}},re.prototype.equals=function(e){return e==null?se(this,ge):new this.Collection(this,function(){return yr(e)})},re.prototype.above=function(e){return e==null?se(this,ge):new this.Collection(this,function(){return Pe(e,void 0,!0)})},re.prototype.aboveOrEqual=function(e){return e==null?se(this,ge):new this.Collection(this,function(){return Pe(e,void 0,!1)})},re.prototype.below=function(e){return e==null?se(this,ge):new this.Collection(this,function(){return Pe(void 0,e,!1,!0)})},re.prototype.belowOrEqual=function(e){return e==null?se(this,ge):new this.Collection(this,function(){return Pe(void 0,e)})},re.prototype.startsWith=function(e){return typeof e!="string"?se(this,or):this.between(e,e+Te,!0,!0)},re.prototype.startsWithIgnoreCase=function(e){return e===""?this.startsWith(e):It(this,function(t,n){return t.indexOf(n[0])===0},[e],Te)},re.prototype.equalsIgnoreCase=function(e){return It(this,function(t,n){return t===n[0]},[e],"")},re.prototype.anyOfIgnoreCase=function(){var e=pe.apply(Le,arguments);return e.length===0?He(this):It(this,function(t,n){return n.indexOf(t)!==-1},e,"")},re.prototype.startsWithAnyOfIgnoreCase=function(){var e=pe.apply(Le,arguments);return e.length===0?He(this):It(this,function(t,n){return n.some(function(r){return t.indexOf(r)===0})},e,Te)},re.prototype.anyOf=function(){var e,t,n=this,r=pe.apply(Le,arguments),o=this._cmp;try{r.sort(o)}catch{return se(this,ge)}return r.length===0?He(this):((e=new this.Collection(this,function(){return Pe(r[0],r[r.length-1])}))._ondirectionchange=function(i){o=i==="next"?n._ascending:n._descending,r.sort(o)},t=0,e._addAlgorithm(function(i,a,u){for(var l=i.key;0<o(l,r[t]);)if(++t===r.length)return a(u),!1;return o(l,r[t])===0||(a(function(){i.continue(r[t])}),!1)}),e)},re.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},re.prototype.noneOf=function(){var e=pe.apply(Le,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return se(this,ge)}var t=e.reduce(function(n,r){return n?n.concat([[n[n.length-1][1],r]]):[[-1/0,r]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},re.prototype.inAnyRange=function(e,b){var n=this,r=this._cmp,o=this._ascending,i=this._descending,a=this._min,u=this._max;if(e.length===0)return He(this);if(!e.every(function(g){return g[0]!==void 0&&g[1]!==void 0&&o(g[0],g[1])<=0}))return se(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",T.InvalidArgument);var l=!b||b.includeLowers!==!1,m=b&&b.includeUppers===!0,f,s=o;function d(g,w){return s(g[0],w[0])}try{(f=e.reduce(function(g,w){for(var k=0,S=g.length;k<S;++k){var E=g[k];if(r(w[0],E[1])<0&&0<r(w[1],E[0])){E[0]=a(E[0],w[0]),E[1]=u(E[1],w[1]);break}}return k===S&&g.push(w),g},[])).sort(d)}catch{return se(this,ge)}var y=0,h=m?function(g){return 0<o(g,f[y][1])}:function(g){return 0<=o(g,f[y][1])},c=l?function(g){return 0<i(g,f[y][0])}:function(g){return 0<=i(g,f[y][0])},v=h,b=new this.Collection(this,function(){return Pe(f[0][0],f[f.length-1][1],!l,!m)});return b._ondirectionchange=function(g){s=g==="next"?(v=h,o):(v=c,i),f.sort(d)},b._addAlgorithm(function(g,w,k){for(var S,E=g.key;v(E);)if(++y===f.length)return w(k),!1;return!h(S=E)&&!c(S)||(n._cmp(E,f[y][1])===0||n._cmp(E,f[y][0])===0||w(function(){s===o?g.continue(f[y][0]):g.continue(f[y][1])}),!1)}),b},re.prototype.startsWithAnyOf=function(){var e=pe.apply(Le,arguments);return e.every(function(t){return typeof t=="string"})?e.length===0?He(this):this.inAnyRange(e.map(function(t){return[t,t+Te]})):se(this,"startsWithAnyOf() only works with strings")};var gr=re;function re(){}function fe(e){return G(function(t){return ft(t),e(t.target.error),!1})}function ft(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var ht="storagemutated",yn="x-storagemutated-1",Oe=ct(null,ht),ho=(he.prototype._lock=function(){return tt(!D.global),++this._reculock,this._reculock!==1||D.global||(D.lockOwnerFor=this),this},he.prototype._unlock=function(){if(tt(!D.global),--this._reculock==0)for(D.global||(D.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{De(e[1],e[0])}catch{}}return this},he.prototype._locked=function(){return this._reculock&&D.lockOwnerFor!==this},he.prototype.create=function(e){var t=this;if(this.mode){var n=this.db.idbdb,r=this.db._state.dbOpenError;if(tt(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new T.DatabaseClosed(r);case"MissingAPIError":throw new T.MissingAPI(r.message,r);default:throw new T.OpenFailed(r)}if(!this.active)throw new T.TransactionInactive;tt(this._completion._state===null),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=G(function(o){ft(o),t._reject(e.error)}),e.onabort=G(function(o){ft(o),t.active&&t._reject(new T.Abort(e.error)),t.active=!1,t.on("abort").fire(o)}),e.oncomplete=G(function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Oe.storagemutated.fire(e.mutatedParts)})}return this},he.prototype._promise=function(e,t,n){var r,o=this;return e==="readwrite"&&this.mode!=="readwrite"?ee(new T.ReadOnly("Transaction is readonly")):this.active?this._locked()?new K(function(i,a){o._blockedFuncs.push([function(){o._promise(e,t,n).then(i,a)},D])}):n?_e(function(){var i=new K(function(a,u){o._lock();var l=t(a,u,o);l&&l.then&&l.then(a,u)});return i.finally(function(){return o._unlock()}),i._lib=!0,i}):((r=new K(function(i,a){var u=t(i,a,o);u&&u.then&&u.then(i,a)}))._lib=!0,r):ee(new T.TransactionInactive)},he.prototype._root=function(){return this.parent?this.parent._root():this},he.prototype.waitFor=function(e){var t,n=this._root(),r=K.resolve(e),o=(n._waitingFor?n._waitingFor=n._waitingFor.then(function(){return r}):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),(function i(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=i)})()),n._waitingFor);return new K(function(i,a){r.then(function(u){return n._waitingQueue.push(G(i.bind(null,u)))},function(u){return n._waitingQueue.push(G(a.bind(null,u)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},he.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new T.Abort))},he.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if($(t,e))return t[e];var n=this.schema[e];if(n)return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n;throw new T.NotFound("Table "+e+" not part of transaction")},he);function he(){}function gn(e,t,n,r,o,i,a,u){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:i,src:(n&&!a?"&":"")+(r?"*":"")+(o?"++":"")+mr(t),type:u}}function mr(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function mn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(o){return[o.name,o]},n.reduce(function(o,i,a){return i=r(i,a),i&&(o[i[0]]=i[1]),o},{}))};var r}var dt=function(e){try{return e.only([[]]),dt=function(){return[[]]},[[]]}catch{return dt=function(){return Te},Te}};function vn(e){return e==null?function(){}:typeof e=="string"?(t=e).split(".").length===1?function(n){return n[t]}:function(n){return de(n,t)}:function(n){return de(n,e)};var t}function vr(e){return[].slice.call(e)}var po=0;function pt(e){return e==null?":id":typeof e=="string"?e:"[".concat(e.join("+"),"]")}function yo(e,t,l){function r(h){if(h.type===3)return null;if(h.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var s=h.lower,d=h.upper,y=h.lowerOpen,h=h.upperOpen;return s===void 0?d===void 0?null:t.upperBound(d,!!h):d===void 0?t.lowerBound(s,!!y):t.bound(s,d,!!y,!!h)}function o(f){var s,d=f.name;return{name:d,schema:f,mutate:function(y){var h=y.trans,c=y.type,v=y.keys,b=y.values,g=y.range;return new Promise(function(w,k){w=G(w);var S=h.objectStore(d),E=S.keyPath==null,x=c==="put"||c==="add";if(!x&&c!=="delete"&&c!=="deleteRange")throw new Error("Invalid operation type: "+c);var j,A=(v||b||{length:1}).length;if(v&&b&&v.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(A===0)return w({numFailures:0,failures:{},results:[],lastResult:void 0});function O(J){++z,ft(J)}var I=[],W=[],z=0;if(c==="deleteRange"){if(g.type===4)return w({numFailures:z,failures:W,results:[],lastResult:void 0});g.type===3?I.push(j=S.clear()):I.push(j=S.delete(r(g)))}else{var E=x?E?[b,v]:[b,null]:[v,null],R=E[0],M=E[1];if(x)for(var X=0;X<A;++X)I.push(j=M&&M[X]!==void 0?S[c](R[X],M[X]):S[c](R[X])),j.onerror=O;else for(X=0;X<A;++X)I.push(j=S[c](R[X])),j.onerror=O}function ce(J){J=J.target.result,I.forEach(function(Me,qn){return Me.error!=null&&(W[qn]=Me.error)}),w({numFailures:z,failures:W,results:c==="delete"?v:I.map(function(Me){return Me.result}),lastResult:J})}j.onerror=function(J){O(J),ce(J)},j.onsuccess=ce})},getMany:function(y){var h=y.trans,c=y.keys;return new Promise(function(v,b){v=G(v);for(var g,w=h.objectStore(d),k=c.length,S=new Array(k),E=0,x=0,j=function(I){I=I.target,S[I._pos]=I.result,++x===E&&v(S)},A=fe(b),O=0;O<k;++O)c[O]!=null&&((g=w.get(c[O]))._pos=O,g.onsuccess=j,g.onerror=A,++E);E===0&&v(S)})},get:function(y){var h=y.trans,c=y.key;return new Promise(function(v,b){v=G(v);var g=h.objectStore(d).get(c);g.onsuccess=function(w){return v(w.target.result)},g.onerror=fe(b)})},query:(s=u,function(y){return new Promise(function(h,c){h=G(h);var v,b,g,x=y.trans,w=y.values,k=y.limit,E=y.query,S=k===1/0?void 0:k,j=E.index,E=E.range,x=x.objectStore(d),x=j.isPrimaryKey?x:x.index(j.name),j=r(E);if(k===0)return h({result:[]});s?((E=w?x.getAll(j,S):x.getAllKeys(j,S)).onsuccess=function(A){return h({result:A.target.result})},E.onerror=fe(c)):(v=0,b=!w&&"openKeyCursor"in x?x.openKeyCursor(j):x.openCursor(j),g=[],b.onsuccess=function(A){var O=b.result;return!O||(g.push(w?O.value:O.primaryKey),++v===k)?h({result:g}):void O.continue()},b.onerror=fe(c))})}),openCursor:function(y){var h=y.trans,c=y.values,v=y.query,b=y.reverse,g=y.unique;return new Promise(function(w,k){w=G(w);var x=v.index,S=v.range,E=h.objectStore(d),E=x.isPrimaryKey?E:E.index(x.name),x=b?g?"prevunique":"prev":g?"nextunique":"next",j=!c&&"openKeyCursor"in E?E.openKeyCursor(r(S),x):E.openCursor(r(S),x);j.onerror=fe(k),j.onsuccess=G(function(A){var O,I,W,z,R=j.result;R?(R.___id=++po,R.done=!1,O=R.continue.bind(R),I=(I=R.continuePrimaryKey)&&I.bind(R),W=R.advance.bind(R),z=function(){throw new Error("Cursor not stopped")},R.trans=h,R.stop=R.continue=R.continuePrimaryKey=R.advance=function(){throw new Error("Cursor not started")},R.fail=G(k),R.next=function(){var M=this,X=1;return this.start(function(){return X--?M.continue():M.stop()}).then(function(){return M})},R.start=function(M){function X(){if(j.result)try{M()}catch(J){R.fail(J)}else R.done=!0,R.start=function(){throw new Error("Cursor behind last entry")},R.stop()}var ce=new Promise(function(J,Me){J=G(J),j.onerror=fe(Me),R.fail=Me,R.stop=function(qn){R.stop=R.continue=R.continuePrimaryKey=R.advance=z,J(qn)}});return j.onsuccess=G(function(J){j.onsuccess=X,X()}),R.continue=O,R.continuePrimaryKey=I,R.advance=W,X(),ce},w(R)):w(null)},k)})},count:function(y){var h=y.query,c=y.trans,v=h.index,b=h.range;return new Promise(function(g,w){var k=c.objectStore(d),k=v.isPrimaryKey?k:k.index(v.name),S=r(b),S=S?k.count(S):k.count();S.onsuccess=G(function(E){return g(E.target.result)}),S.onerror=fe(w)})}}}i=l,a=vr((l=e).objectStoreNames);var i,l={schema:{name:l.name,tables:a.map(function(f){return i.objectStore(f)}).map(function(f){var s=f.keyPath,d=f.autoIncrement,h=N(s),y={},h={name:f.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:s==null,compound:h,keyPath:s,autoIncrement:d,unique:!0,extractKey:vn(s)},indexes:vr(f.indexNames).map(function(c){return f.index(c)}).map(function(g){var w=g.name,v=g.unique,b=g.multiEntry,g=g.keyPath,w={name:w,compound:N(g),keyPath:g,unique:v,multiEntry:b,extractKey:vn(g)};return y[pt(g)]=w}),getIndexByKeyPath:function(c){return y[pt(c)]}};return y[":id"]=h.primaryKey,s!=null&&(y[pt(s)]=h.primaryKey),h})},hasGetAll:0<a.length&&"getAll"in i.objectStore(a[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)},a=l.schema,u=l.hasGetAll,l=a.tables.map(o),m={};return l.forEach(function(f){return m[f.name]=f}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(f){if(m[f])return m[f];throw new Error("Table '".concat(f,"' not found"))},MIN_KEY:-1/0,MAX_KEY:dt(t),schema:a}}function go(e,t,n,r){return n=n.IDBKeyRange,t=yo(t,n,r),{dbcore:e.dbcore.reduce(function(o,i){return i=i.create,P(P({},o),i(o))},t)}}function Dt(e,t){var n=t.db,n=go(e._middlewares,n,e._deps,t);e.core=n.dbcore,e.tables.forEach(function(r){var o=r.name;e.core.schema.tables.some(function(i){return i.name===o})&&(r.core=e.core.table(o),e[o]instanceof e.Table)&&(e[o].core=r.core)})}function Tt(e,t,n,r){n.forEach(function(o){var i=r[o];t.forEach(function(a){var u=(function l(m,f){return $r(m,f)||(m=H(m))&&l(m,f)})(a,o);(!u||"value"in u&&u.value===void 0)&&(a===e.Transaction.prototype||a instanceof e.Transaction?be(a,o,{get:function(){return this.table(o)},set:function(l){ve(this,o,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):a[o]=new e.Table(o,i))})})}function bn(e,t){t.forEach(function(n){for(var r in n)n[r]instanceof e.Table&&delete n[r]})}function mo(e,t){return e._cfg.version-t._cfg.version}function vo(e,t,n,r){var o=e._dbSchema,i=(n.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=mn("$meta",wr("")[0],[]),e._storeNames.push("$meta")),e._createTransaction("readwrite",e._storeNames,o)),a=(i.create(n),i._completion.catch(r),i._reject.bind(i)),u=D.transless||D;_e(function(){if(D.trans=i,D.transless=u,t!==0)return Dt(e,n),m=t,((l=i).storeNames.includes("$meta")?l.table("$meta").get("version").then(function(f){return f??m}):K.resolve(m)).then(function(v){var s=e,d=v,y=i,h=n,c=[],v=s._versions,b=s._dbSchema=qt(0,s.idbdb,h);return(v=v.filter(function(g){return g._cfg.version>=d})).length===0?K.resolve():(v.forEach(function(g){c.push(function(){var w,k,S,E=b,x=g._cfg.dbschema,j=(Bt(s,E,h),Bt(s,x,h),b=s._dbSchema=x,wn(E,x)),A=(j.add.forEach(function(O){_n(h,O[0],O[1].primKey,O[1].indexes)}),j.change.forEach(function(O){if(O.recreate)throw new T.Upgrade("Not yet support for changing primary key");var I=h.objectStore(O.name);O.add.forEach(function(W){return Rt(I,W)}),O.change.forEach(function(W){I.deleteIndex(W.name),Rt(I,W)}),O.del.forEach(function(W){return I.deleteIndex(W)})}),g._cfg.contentUpgrade);if(A&&g._cfg.version>d)return Dt(s,h),y._memoizedTables={},w=Qn(x),j.del.forEach(function(O){w[O]=E[O]}),bn(s,[s.Transaction.prototype]),Tt(s,[s.Transaction.prototype],F(w),w),y.schema=w,(k=Zt(A))&&$e(),x=K.follow(function(){var O;(S=A(y))&&k&&(O=ke.bind(null,null),S.then(O,O))}),S&&typeof S.then=="function"?K.resolve(S):x.then(function(){return S})}),c.push(function(w){var k,S,E=g._cfg.dbschema;k=E,S=w,[].slice.call(S.db.objectStoreNames).forEach(function(x){return k[x]==null&&S.db.deleteObjectStore(x)}),bn(s,[s.Transaction.prototype]),Tt(s,[s.Transaction.prototype],s._storeNames,s._dbSchema),y.schema=s._dbSchema}),c.push(function(w){s.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(s.idbdb.version/10)===g._cfg.version?(s.idbdb.deleteObjectStore("$meta"),delete s._dbSchema.$meta,s._storeNames=s._storeNames.filter(function(k){return k!=="$meta"})):w.objectStore("$meta").put(g._cfg.version,"version"))})}),(function g(){return c.length?K.resolve(c.shift()(y.idbtrans)).then(g):K.resolve()})().then(function(){br(b,h)}))}).catch(a);var l,m;F(o).forEach(function(f){_n(n,f,o[f].primKey,o[f].indexes)}),Dt(e,n),K.follow(function(){return e.on.populate.fire(i)}).catch(a)})}function bo(e,t){br(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=qt(0,e.idbdb,t);Bt(e,e._dbSchema,t);for(var r=0,o=wn(n,e._dbSchema).change;r<o.length;r++){var i=(a=>{if(a.change.length||a.recreate)return console.warn("Unable to patch indexes of table ".concat(a.name," because it has changes on the type of index or primary key.")),{value:void 0};var u=t.objectStore(a.name);a.add.forEach(function(l){le&&console.debug("Dexie upgrade patch: Creating missing index ".concat(a.name,".").concat(l.src)),Rt(u,l)})})(o[r]);if(typeof i=="object")return i.value}}function wn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],i=t[n];if(o){var a={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=o.idxByName,l=i.idxByName,m=void 0;for(m in u)l[m]||a.del.push(m);for(m in l){var f=u[m],s=l[m];f?f.src!==s.src&&a.change.push(s):a.add.push(s)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,i])}return r}function _n(e,t,n,r){var o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});r.forEach(function(i){return Rt(o,i)})}function br(e,t){F(e).forEach(function(n){t.db.objectStoreNames.contains(n)||(le&&console.debug("Dexie: Creating missing table",n),_n(t,n,e[n].primKey,e[n].indexes))})}function Rt(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function qt(e,t,n){var r={};return mt(t.objectStoreNames,0).forEach(function(o){for(var i=n.objectStore(o),a=gn(mr(m=i.keyPath),m||"",!0,!1,!!i.autoIncrement,m&&typeof m!="string",!0),u=[],l=0;l<i.indexNames.length;++l){var f=i.index(i.indexNames[l]),m=f.keyPath,f=gn(f.name,m,!!f.unique,!!f.multiEntry,!1,m&&typeof m!="string",!1);u.push(f)}r[o]=mn(o,a,u)}),r}function Bt(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var i=r[o],a=n.objectStore(i);e._hasGetAll="getAll"in a;for(var u=0;u<a.indexNames.length;++u){var l,m=a.indexNames[u],f=a.index(m).keyPath,f=typeof f=="string"?f:"["+mt(f).join("+")+"]";t[i]&&(l=t[i].idxByName[f])&&(l.name=m,delete t[i].idxByName[f],t[i].idxByName[m]=l)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&B.WorkerGlobalScope&&B instanceof B.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function wr(e){return e.split(",").map(function(t,n){var o=t.split(":"),r=(r=o[1])==null?void 0:r.trim(),o=(t=o[0].trim()).replace(/([&*]|\+\+)/g,""),i=/^\[/.test(o)?o.match(/^\[(.*)\]$/)[1].split("+"):o;return gn(o,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),N(i),n===0,r)})}Ge.prototype._createTableSchema=mn,Ge.prototype._parseIndexSyntax=wr,Ge.prototype._parseStoresSpec=function(e,t){var n=this;F(e).forEach(function(r){if(e[r]!==null){var o=n._parseIndexSyntax(e[r]),i=o.shift();if(!i)throw new T.Schema("Invalid schema for table "+r+": "+e[r]);if(i.unique=!0,i.multi)throw new T.Schema("Primary key cannot be multiEntry*");o.forEach(function(a){if(a.auto)throw new T.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new T.Schema("Index must have a name and cannot be an empty string")}),i=n._createTableSchema(r,i,o),t[r]=i}})},Ge.prototype.stores=function(n){var t=this.db,n=(this._cfg.storesSource=this._cfg.storesSource?Y(this._cfg.storesSource,n):n,t._versions),r={},o={};return n.forEach(function(i){Y(r,i._cfg.storesSource),o=i._cfg.dbschema={},i._parseStoresSpec(r,o)}),t._dbSchema=o,bn(t,[t._allTables,t,t.Transaction.prototype]),Tt(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],F(o),o),t._storeNames=F(o),this},Ge.prototype.upgrade=function(e){return this._cfg.contentUpgrade=tn(this._cfg.contentUpgrade||V,e),this};var wo=Ge;function Ge(){}function kn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new me(Et,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function xn(e){return e&&typeof e.databases=="function"}function Pn(e){return _e(function(){return D.letThrough=!0,e()})}function On(e){return!("from"in e)}var ie=function(e,t){var n;if(!this)return n=new ie,e&&"d"in e&&Y(n,e),n;Y(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function yt(e,t,n){var r=L(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(On(e))return Y(e,{from:t,to:n,d:1});var r=e.l,o=e.r;if(L(n,e.from)<0)return r?yt(r,t,n):e.l={from:t,to:n,d:1,l:null,r:null},kr(e);if(0<L(t,e.to))return o?yt(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},kr(e);L(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),0<L(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),t=!e.r,r&&!e.l&>(e,r),o&&t&>(e,o)}}function gt(e,t){On(t)||(function n(r,o){var i=o.from,a=o.l,u=o.r;yt(r,i,o.to),a&&n(r,a),u&&n(r,u)})(e,t)}function _r(e,t){var n=Mt(t),r=n.next();if(!r.done)for(var o=r.value,i=Mt(e),a=i.next(o.from),u=a.value;!r.done&&!a.done;){if(L(u.from,o.to)<=0&&0<=L(u.to,o.from))return!0;L(o.from,u.from)<0?o=(r=n.next(u.from)).value:u=(a=i.next(o.from)).value}return!1}function Mt(e){var t=On(e)?null:{s:0,n:e};return{next:function(n){for(var r=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&L(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||L(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function kr(e){var t,n,r,o=(((o=e.r)==null?void 0:o.d)||0)-(((o=e.l)==null?void 0:o.d)||0),o=1<o?"r":o<-1?"l":"";o&&(t=o=="r"?"l":"r",n=P({},e),r=e[o],e.from=r.from,e.to=r.to,e[o]=r[o],n[o]=r[t],(e[t]=n).d=xr(n)),e.d=xr(e)}function xr(n){var t=n.r,n=n.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function Ft(e,t){return F(t).forEach(function(n){e[n]?gt(e[n],t[n]):e[n]=(function r(o){var i,a,u={};for(i in o)$(o,i)&&(a=o[i],u[i]=!a||typeof a!="object"||Hn.has(a.constructor)?a:r(a));return u})(t[n])}),e}function Sn(e,t){return e.all||t.all||Object.keys(e).some(function(n){return t[n]&&_r(t[n],e[n])})}Z(ie.prototype,((ue={add:function(e){return gt(this,e),this},addKey:function(e){return yt(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return yt(t,n,n)}),this},hasKey:function(e){var t=Mt(this).next(e).value;return t&&L(t.from,e)<=0&&0<=L(t.to,e)}})[Jt]=function(){return Mt(this)},ue));var qe={},En={},Cn=!1;function Nt(e){Ft(En,e),Cn||(Cn=!0,setTimeout(function(){Cn=!1,Kn(En,!(En={}))},0))}function Kn(e,t){t===void 0&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(qe);r<o.length;r++)Pr(u=o[r],e,n,t);else for(var i in e){var a,u,i=/^idb\:\/\/(.*)\/(.*)\//.exec(i);i&&(a=i[1],i=i[2],u=qe["idb://".concat(a,"/").concat(i)])&&Pr(u,e,n,t)}n.forEach(function(l){return l()})}function Pr(e,t,n,r){for(var o=[],i=0,a=Object.entries(e.queries.query);i<a.length;i++){for(var u=a[i],l=u[0],m=[],f=0,s=u[1];f<s.length;f++){var d=s[f];Sn(t,d.obsSet)?d.subscribers.forEach(function(v){return n.add(v)}):r&&m.push(d)}r&&o.push([l,m])}if(r)for(var y=0,h=o;y<h.length;y++){var c=h[y],l=c[0],m=c[1];e.queries.query[l]=m}}function _o(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ee(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,o=Math.round(10*e.verno),i=!1;function a(){if(t.openCanceller!==r)throw new T.DatabaseClosed("db.open() was cancelled")}function u(){return new K(function(d,y){if(a(),!n)throw new T.MissingAPI;var h=e.name,c=t.autoSchema||!o?n.open(h):n.open(h,o);if(!c)throw new T.MissingAPI;c.onerror=fe(y),c.onblocked=G(e._fireOnBlocked),c.onupgradeneeded=G(function(v){var b;f=c.transaction,t.autoSchema&&!e._options.allowEmptyDB?(c.onerror=ft,f.abort(),c.result.close(),(b=n.deleteDatabase(h)).onsuccess=b.onerror=G(function(){y(new T.NoSuchDatabase("Database ".concat(h," doesnt exist")))})):(f.onerror=fe(y),b=v.oldVersion>Math.pow(2,62)?0:v.oldVersion,s=b<1,e.idbdb=c.result,i&&bo(e,f),vo(e,b/10,f,y))},y),c.onsuccess=G(function(){f=null;var v,b,g,w,k,S,E=e.idbdb=c.result,x=mt(E.objectStoreNames);if(0<x.length)try{var j=E.transaction((k=x).length===1?k[0]:k,"readonly");if(t.autoSchema)S=E,w=j,(g=e).verno=S.version/10,w=g._dbSchema=qt(0,S,w),g._storeNames=mt(S.objectStoreNames,0),Tt(g,[g._allTables],F(w),w);else if(Bt(e,e._dbSchema,j),b=j,((b=wn(qt(0,(v=e).idbdb,b),v._dbSchema)).add.length||b.change.some(function(A){return A.add.length||A.change.length}))&&!i)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),E.close(),o=E.version+1,i=!0,d(u());Dt(e,j)}catch{}Qe.push(e),E.onversionchange=G(function(A){t.vcFired=!0,e.on("versionchange").fire(A)}),E.onclose=G(function(){e.close({disableAutoOpen:!1})}),s&&(x=e._deps,k=h,xn(S=x.indexedDB)||k===Et||kn(S,x.IDBKeyRange).put({name:k}).catch(V)),d()},y)}).catch(function(d){switch(d?.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),u();break;case"VersionError":if(0<o)return o=0,u()}return K.reject(d)})}var l,m=t.dbReadyResolve,f=null,s=!1;return K.race([r,(typeof navigator>"u"?K.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(d){function y(){return indexedDB.databases().finally(d)}l=setInterval(y,100),y()}).finally(function(){return clearInterval(l)}):Promise.resolve()).then(u)]).then(function(){return a(),t.onReadyBeingFired=[],K.resolve(Pn(function(){return e.on.ready.fire(e.vip)})).then(function d(){var y;if(0<t.onReadyBeingFired.length)return y=t.onReadyBeingFired.reduce(tn,V),t.onReadyBeingFired=[],K.resolve(Pn(function(){return y(e.vip)})).then(d)})}).finally(function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(d){t.dbOpenError=d;try{f&&f.abort()}catch{}return r===t.openCanceller&&e._close(),ee(d)}).finally(function(){t.openComplete=!0,m()}).then(function(){var d;return s&&(d={},e.tables.forEach(function(y){y.schema.indexes.forEach(function(h){h.name&&(d["idb://".concat(e.name,"/").concat(y.name,"/").concat(h.name)]=new ie(-1/0,[[[]]]))}),d["idb://".concat(e.name,"/").concat(y.name,"/")]=d["idb://".concat(e.name,"/").concat(y.name,"/:dels")]=new ie(-1/0,[[[]]])}),Oe(ht).fire(d),Kn(d,!0)),e})}function An(e){function t(i){return e.next(i)}var n=o(t),r=o(function(i){return e.throw(i)});function o(i){return function(u){var u=i(u),l=u.value;return u.done?l:l&&typeof l.then=="function"?l.then(n,r):N(l)?Promise.all(l).then(n,r):n(l)}}return o(t)()}function Lt(e,t,n){for(var r=N(e)?e.slice():[e],o=0;o<n;++o)r.push(t);return r}var ko={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return P(P({},e),{table:function(r){var n=e.table(r),r=n.schema,o={},i=[];function a(d,y,h){var g=pt(d),c=o[g]=o[g]||[],v=d==null?0:typeof d=="string"?1:d.length,b=0<y,g=P(P({},h),{name:b?"".concat(g,"(virtual-from:").concat(h.name,")"):h.name,lowLevelIndex:h,isVirtual:b,keyTail:y,keyLength:v,extractKey:vn(d),unique:!b&&h.unique});return c.push(g),g.isPrimaryKey||i.push(g),1<v&&a(v===2?d[0]:d.slice(0,v-1),y+1,h),c.sort(function(w,k){return w.keyTail-k.keyTail}),g}var u=a(r.primaryKey.keyPath,0,r.primaryKey);o[":id"]=[u];for(var l=0,m=r.indexes;l<m.length;l++){var f=m[l];a(f.keyPath,0,f)}function s(d){var y,h=d.query.index;return h.isVirtual?P(P({},d),{query:{index:h.lowLevelIndex,range:(y=d.query.range,h=h.keyTail,{type:y.type===1?2:y.type,lower:Lt(y.lower,y.lowerOpen?e.MAX_KEY:e.MIN_KEY,h),lowerOpen:!0,upper:Lt(y.upper,y.upperOpen?e.MIN_KEY:e.MAX_KEY,h),upperOpen:!0})}}):d}return P(P({},n),{schema:P(P({},r),{primaryKey:u,indexes:i,getIndexByKeyPath:function(d){return(d=o[pt(d)])&&d[0]}}),count:function(d){return n.count(s(d))},query:function(d){return n.query(s(d))},openCursor:function(d){var y=d.query.index,h=y.keyTail,c=y.keyLength;return y.isVirtual?n.openCursor(s(d)).then(function(b){return b&&v(b)}):n.openCursor(d);function v(b){return Object.create(b,{continue:{value:function(g){g!=null?b.continue(Lt(g,d.reverse?e.MAX_KEY:e.MIN_KEY,h)):d.unique?b.continue(b.key.slice(0,c).concat(d.reverse?e.MIN_KEY:e.MAX_KEY,h)):b.continue()}},continuePrimaryKey:{value:function(g,w){b.continuePrimaryKey(Lt(g,e.MAX_KEY,h),w)}},primaryKey:{get:function(){return b.primaryKey}},key:{get:function(){var g=b.key;return c===1?g[0]:g.slice(0,c)}},value:{get:function(){return b.value}}})}}})}})}};function jn(e,t,n,r){return n=n||{},r=r||"",F(e).forEach(function(o){var i,a,u;$(t,o)?(i=e[o],a=t[o],typeof i=="object"&&typeof a=="object"&&i&&a?(u=Xt(i))!==Xt(a)?n[r+o]=t[o]:u==="Object"?jn(i,a,n,r+o+"."):i!==a&&(n[r+o]=t[o]):i!==a&&(n[r+o]=t[o])):n[r+o]=void 0}),F(t).forEach(function(o){$(e,o)||(n[r+o]=t[o])}),n}function In(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var xo={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return P(P({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey;return P(P({},n),{mutate:function(o){var i=D.trans,a=i.table(t).hook,u=a.deleting,l=a.creating,m=a.updating;switch(o.type){case"add":if(l.fire===V)break;return i._promise("readwrite",function(){return f(o)},!0);case"put":if(l.fire===V&&m.fire===V)break;return i._promise("readwrite",function(){return f(o)},!0);case"delete":if(u.fire===V)break;return i._promise("readwrite",function(){return f(o)},!0);case"deleteRange":if(u.fire===V)break;return i._promise("readwrite",function(){return(function s(d,y,h){return n.query({trans:d,values:!1,query:{index:r,range:y},limit:h}).then(function(c){var v=c.result;return f({type:"delete",keys:v,trans:d}).then(function(b){return 0<b.numFailures?Promise.reject(b.failures[0]):v.length<h?{failures:[],numFailures:0,lastResult:void 0}:s(d,P(P({},y),{lower:v[v.length-1],lowerOpen:!0}),h)})})})(o.trans,o.range,1e4)},!0)}return n.mutate(o);function f(s){var d,y,h,c=D.trans,v=s.keys||In(r,s);if(v)return(s=s.type==="add"||s.type==="put"?P(P({},s),{keys:v}):P({},s)).type!=="delete"&&(s.values=q([],s.values)),s.keys&&(s.keys=q([],s.keys)),d=n,h=v,((y=s).type==="add"?Promise.resolve([]):d.getMany({trans:y.trans,keys:h,cache:"immutable"})).then(function(b){var g=v.map(function(w,k){var S,E,x,j=b[k],A={onerror:null,onsuccess:null};return s.type==="delete"?u.fire.call(A,w,j,c):s.type==="add"||j===void 0?(S=l.fire.call(A,w,s.values[k],c),w==null&&S!=null&&(s.keys[k]=w=S,r.outbound||ae(s.values[k],r.keyPath,w))):(S=jn(j,s.values[k]),(E=m.fire.call(A,S,w,j,c))&&(x=s.values[k],Object.keys(E).forEach(function(O){$(x,O)?x[O]=E[O]:ae(x,O,E[O])}))),A});return n.mutate(s).then(function(w){for(var k=w.failures,S=w.results,E=w.numFailures,w=w.lastResult,x=0;x<v.length;++x){var j=(S||v)[x],A=g[x];j==null?A.onerror&&A.onerror(k[x]):A.onsuccess&&A.onsuccess(s.type==="put"&&b[x]?s.values[x]:j)}return{failures:k,results:S,numFailures:E,lastResult:w}}).catch(function(w){return g.forEach(function(k){return k.onerror&&k.onerror(w)}),Promise.reject(w)})});throw new Error("Keys missing")}}})}})}};function Or(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],o=0,i=0;o<t.keys.length&&i<e.length;++o)L(t.keys[o],e[i])===0&&(r.push(n?Ee(t.values[o]):t.values[o]),++i);return r.length===e.length?r:null}catch{return null}}var Po={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return P(P({},n),{getMany:function(r){var o;return r.cache?(o=Or(r.keys,r.trans._cache,r.cache==="clone"))?K.resolve(o):n.getMany(r).then(function(i){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Ee(i):i},i}):n.getMany(r)},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}};function Sr(e,t){return e.trans.mode==="readonly"&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!=="disabled"&&!t.schema.primaryKey.outbound}function Er(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Oo={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,n=new ie(e.MIN_KEY,e.MAX_KEY);return P(P({},e),{transaction:function(r,o,i){if(D.subscr&&o!=="readonly")throw new T.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(D.querier));return e.transaction(r,o,i)},table:function(r){function o(v){var c,v=v.query;return[c=v.index,new ie((c=(v=v.range).lower)!=null?c:e.MIN_KEY,(c=v.upper)!=null?c:e.MAX_KEY)]}var i=e.table(r),a=i.schema,u=a.primaryKey,l=a.indexes,m=u.extractKey,f=u.outbound,s=u.autoIncrement&&l.filter(function(h){return h.compound&&h.keyPath.includes(u.keyPath)}),d=P(P({},i),{mutate:function(h){function c(I){return I="idb://".concat(t,"/").concat(r,"/").concat(I),k[I]||(k[I]=new ie)}var v,b,g,w=h.trans,k=h.mutatedParts||(h.mutatedParts={}),S=c(""),E=c(":dels"),x=h.type,A=h.type==="deleteRange"?[h.range]:h.type==="delete"?[h.keys]:h.values.length<50?[In(u,h).filter(function(I){return I}),h.values]:[],j=A[0],A=A[1],O=h.trans._cache;return N(j)?(S.addKeys(j),(x=x==="delete"||j.length===A.length?Or(j,O):null)||E.addKeys(j),(x||A)&&(v=c,b=x,g=A,a.indexes.forEach(function(I){var W=v(I.name||"");function z(M){return M!=null?I.extractKey(M):null}function R(M){I.multiEntry&&N(M)?M.forEach(function(X){return W.addKey(X)}):W.addKey(M)}(b||g).forEach(function(M,J){var ce=b&&z(b[J]),J=g&&z(g[J]);L(ce,J)!==0&&(ce!=null&&R(ce),J!=null)&&R(J)})}))):j?(A={from:(O=j.lower)!=null?O:e.MIN_KEY,to:(x=j.upper)!=null?x:e.MAX_KEY},E.add(A),S.add(A)):(S.add(n),E.add(n),a.indexes.forEach(function(I){return c(I.name).add(n)})),i.mutate(h).then(function(I){return!j||h.type!=="add"&&h.type!=="put"||(S.addKeys(I.results),s&&s.forEach(function(W){for(var z=h.values.map(function(ce){return W.extractKey(ce)}),R=W.keyPath.findIndex(function(ce){return ce===u.keyPath}),M=0,X=I.results.length;M<X;++M)z[M][R]=I.results[M];c(W.name).addKeys(z)})),w.mutatedParts=Ft(w.mutatedParts||{},k),I})}}),y={get:function(h){return[u,new ie(h.key)]},getMany:function(h){return[u,new ie().addKeys(h.keys)]},count:o,query:o,openCursor:o};return F(y).forEach(function(h){d[h]=function(c){var v=D.subscr,b=!!v,g=Sr(D,i)&&Er(h,c)?c.obsSet={}:v;if(b){var w,v=function(A){return A="idb://".concat(t,"/").concat(r,"/").concat(A),g[A]||(g[A]=new ie)},k=v(""),S=v(":dels"),b=y[h](c),E=b[0],b=b[1];if((h==="query"&&E.isPrimaryKey&&!c.values?S:v(E.name||"")).add(b),!E.isPrimaryKey){if(h!=="count")return w=h==="query"&&f&&c.values&&i.query(P(P({},c),{values:!1})),i[h].apply(this,arguments).then(function(A){if(h==="query"){if(f&&c.values)return w.then(function(z){return z=z.result,k.addKeys(z),A});var O=c.values?A.result.map(m):A.result;(c.values?k:S).addKeys(O)}else{var I,W;if(h==="openCursor")return W=c.values,(I=A)&&Object.create(I,{key:{get:function(){return S.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var z=I.primaryKey;return S.addKey(z),z}},value:{get:function(){return W&&k.addKey(I.primaryKey),I.value}}})}return A});S.add(n)}}return i[h].apply(this,arguments)}}),d}})}};function Cr(e,t,n){var r;return n.numFailures===0?t:t.type==="deleteRange"||(r=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1,n.numFailures===r)?null:(r=P({},t),N(r.keys)&&(r.keys=r.keys.filter(function(o,i){return!(i in n.failures)})),"values"in r&&N(r.values)&&(r.values=r.values.filter(function(o,i){return!(i in n.failures)})),r)}function Dn(e,t){return n=e,((r=t).lower===void 0||(r.lowerOpen?0<L(n,r.lower):0<=L(n,r.lower)))&&(n=e,(r=t).upper===void 0||(r.upperOpen?L(n,r.upper)<0:L(n,r.upper)<=0));var n,r}function Kr(e,t,n,r,o,i){var a,u,l,m,f,s;return!n||n.length===0||(a=t.query.index,u=a.multiEntry,l=t.query.range,m=r.schema.primaryKey.extractKey,f=a.extractKey,s=(a.lowLevelIndex||a).extractKey,(r=n.reduce(function(d,y){var h=d,c=[];if(y.type==="add"||y.type==="put")for(var v=new ie,b=y.values.length-1;0<=b;--b){var g,w=y.values[b],k=m(w);!v.hasKey(k)&&(g=f(w),u&&N(g)?g.some(function(A){return Dn(A,l)}):Dn(g,l))&&(v.addKey(k),c.push(w))}switch(y.type){case"add":var S=new ie().addKeys(t.values?d.map(function(O){return m(O)}):d),h=d.concat(t.values?c.filter(function(O){return O=m(O),!S.hasKey(O)&&(S.addKey(O),!0)}):c.map(function(O){return m(O)}).filter(function(O){return!S.hasKey(O)&&(S.addKey(O),!0)}));break;case"put":var E=new ie().addKeys(y.values.map(function(O){return m(O)}));h=d.filter(function(O){return!E.hasKey(t.values?m(O):O)}).concat(t.values?c:c.map(function(O){return m(O)}));break;case"delete":var x=new ie().addKeys(y.keys);h=d.filter(function(O){return!x.hasKey(t.values?m(O):O)});break;case"deleteRange":var j=y.range;h=d.filter(function(O){return!Dn(m(O),j)})}return h},e))===e)?e:(r.sort(function(d,y){return L(s(d),s(y))||L(m(d),m(y))}),t.limit&&t.limit<1/0&&(r.length>t.limit?r.length=t.limit:e.length===t.limit&&r.length<t.limit&&(o.dirty=!0)),i?Object.freeze(r):r)}function Ar(e,t){return L(e.lower,t.lower)===0&&L(e.upper,t.upper)===0&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function So(e,t){return((n,r,o,i)=>{if(n===void 0)return r!==void 0?-1:0;if(r===void 0)return 1;if((n=L(n,r))===0){if(o&&i)return 0;if(o)return 1;if(i)return-1}return n})(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=((n,r,o,i)=>{if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;if((n=L(n,r))===0){if(o&&i)return 0;if(o)return-1;if(i)return 1}return n})(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Eo(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",function(){var o,i;e.subscribers.delete(n),e.subscribers.size===0&&(o=e,i=t,setTimeout(function(){o.subscribers.size===0&&Ce(i,o)},3e3))})}var Co={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name;return P(P({},e),{transaction:function(n,r,o){var i,a,u=e.transaction(n,r,o);return r==="readwrite"&&(o=(i=new AbortController).signal,u.addEventListener("abort",(a=function(l){return function(){if(i.abort(),r==="readwrite"){for(var m=new Set,f=0,s=n;f<s.length;f++){var d=s[f],y=qe["idb://".concat(t,"/").concat(d)];if(y){var h=e.table(d),c=y.optimisticOps.filter(function(I){return I.trans===u});if(u._explicit&&l&&u.mutatedParts)for(var v=0,b=Object.values(y.queries.query);v<b.length;v++)for(var g=0,w=(E=b[v]).slice();g<w.length;g++)Sn((x=w[g]).obsSet,u.mutatedParts)&&(Ce(E,x),x.subscribers.forEach(function(I){return m.add(I)}));else if(0<c.length){y.optimisticOps=y.optimisticOps.filter(function(I){return I.trans!==u});for(var k=0,S=Object.values(y.queries.query);k<S.length;k++)for(var E,x,j,A=0,O=(E=S[k]).slice();A<O.length;A++)(x=O[A]).res!=null&&u.mutatedParts&&(l&&!x.dirty?(j=Object.isFrozen(x.res),j=Kr(x.res,x.req,c,h,x,j),x.dirty?(Ce(E,x),x.subscribers.forEach(function(I){return m.add(I)})):j!==x.res&&(x.res=j,x.promise=K.resolve({result:j}))):(x.dirty&&Ce(E,x),x.subscribers.forEach(function(I){return m.add(I)})))}}}m.forEach(function(I){return I()})}}})(!1),{signal:o}),u.addEventListener("error",a(!1),{signal:o}),u.addEventListener("complete",a(!0),{signal:o})),u},table:function(n){var r=e.table(n),o=r.schema.primaryKey;return P(P({},r),{mutate:function(i){var a,u=D.trans;return!o.outbound&&u.db._options.cache!=="disabled"&&!u.explicit&&u.idbtrans.mode==="readwrite"&&(a=qe["idb://".concat(t,"/").concat(n)])?(u=r.mutate(i),i.type!=="add"&&i.type!=="put"||!(50<=i.values.length||In(o,i).some(function(l){return l==null}))?(a.optimisticOps.push(i),i.mutatedParts&&Nt(i.mutatedParts),u.then(function(l){0<l.numFailures&&(Ce(a.optimisticOps,i),(l=Cr(0,i,l))&&a.optimisticOps.push(l),i.mutatedParts)&&Nt(i.mutatedParts)}),u.catch(function(){Ce(a.optimisticOps,i),i.mutatedParts&&Nt(i.mutatedParts)})):u.then(function(l){var m=Cr(0,P(P({},i),{values:i.values.map(function(f,s){var d;return l.failures[s]?f:(ae(d=(d=o.keyPath)!=null&&d.includes(".")?Ee(f):P({},f),o.keyPath,l.results[s]),d)})}),l);a.optimisticOps.push(m),queueMicrotask(function(){return i.mutatedParts&&Nt(i.mutatedParts)})}),u):r.mutate(i)},query:function(i){var a,u,l,m,f,s,d;return Sr(D,r)&&Er("query",i)?(a=((l=D.trans)==null?void 0:l.db._options.cache)==="immutable",u=(l=D).requery,l=l.signal,s=((y,h,c,v)=>{var b=qe["idb://".concat(y,"/").concat(h)];if(!b)return[];if(!(y=b.queries[c]))return[null,!1,b,null];var g=y[(v.query?v.query.index.name:null)||""];if(!g)return[null,!1,b,null];switch(c){case"query":var w=g.find(function(k){return k.req.limit===v.limit&&k.req.values===v.values&&Ar(k.req.query.range,v.query.range)});return w?[w,!0,b,g]:[g.find(function(k){return("limit"in k.req?k.req.limit:1/0)>=v.limit&&(!v.values||k.req.values)&&So(k.req.query.range,v.query.range)}),!1,b,g];case"count":return w=g.find(function(k){return Ar(k.req.query.range,v.query.range)}),[w,!!w,b,g]}})(t,n,"query",i),d=s[0],m=s[2],f=s[3],d&&s[1]?d.obsSet=i.obsSet:(s=r.query(i).then(function(y){var h=y.result;if(d&&(d.res=h),a){for(var c=0,v=h.length;c<v;++c)Object.freeze(h[c]);Object.freeze(h)}else y.result=Ee(h);return y}).catch(function(y){return f&&d&&Ce(f,d),Promise.reject(y)}),d={obsSet:i.obsSet,promise:s,subscribers:new Set,type:"query",req:i,dirty:!1},f?f.push(d):(f=[d],(m=m||(qe["idb://".concat(t,"/").concat(n)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[i.query.index.name||""]=f)),Eo(d,f,u,l),d.promise.then(function(y){return{result:Kr(y.result,i,m?.optimisticOps,r,d,a)}})):r.query(i)}})}})}};function Wt(e,t){return new Proxy(e,{get:function(n,r,o){return r==="db"?t:Reflect.get(n,r,o)}})}te.prototype.version=function(e){if(isNaN(e)||e<.1)throw new T.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new T.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(r){return r._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(mo),n.stores({}),this._state.autoSchema=!1),n},te.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||D.letThrough||this._vip)?e():new K(function(n,r){if(t._state.openComplete)return r(new T.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void r(new T.DatabaseClosed);t.open().catch(V)}t._state.dbReadyPromise.then(n,r)}).then(e)},te.prototype.use=function(o){var t=o.stack,n=o.create,r=o.level,o=o.name,i=(o&&this.unuse({stack:t,name:o}),this._middlewares[t]||(this._middlewares[t]=[]));return i.push({stack:t,create:n,level:r??10,name:o}),i.sort(function(a,u){return a.level-u.level}),this},te.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(o){return r?o.create!==r:!!n&&o.name!==n})),this},te.prototype.open=function(){var e=this;return De(we,function(){return _o(e)})},te.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state,t=Qe.indexOf(this);if(0<=t&&Qe.splice(t,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new K(function(n){e.dbReadyResolve=n}),e.openCanceller=new K(function(n,r){e.cancelOpen=r}))},te.prototype.close=function(t){var t=(t===void 0?{disableAutoOpen:!0}:t).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new T.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new T.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},te.prototype.delete=function(e){var t=this,n=(e===void 0&&(e={disableAutoOpen:!0}),0<arguments.length&&typeof arguments[0]!="object"),r=this._state;return new K(function(o,i){function a(){t.close(e);var u=t._deps.indexedDB.deleteDatabase(t.name);u.onsuccess=G(function(){var l,m,f;l=t._deps,m=t.name,xn(f=l.indexedDB)||m===Et||kn(f,l.IDBKeyRange).delete(m).catch(V),o()}),u.onerror=fe(i),u.onblocked=t._fireOnBlocked}if(n)throw new T.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},te.prototype.backendDB=function(){return this.idbdb},te.prototype.isOpen=function(){return this.idbdb!==null},te.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"},te.prototype.hasFailed=function(){return this._state.dbOpenError!==null},te.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(te.prototype,"tables",{get:function(){var e=this;return F(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),te.prototype.transaction=function(){var e=function(t,n,r){var o=arguments.length;if(o<2)throw new T.InvalidArgument("Too few arguments");for(var i=new Array(o-1);--o;)i[o-1]=arguments[o];return r=i.pop(),[t,Yn(i),r]}.apply(this,arguments);return this._transaction.apply(this,e)},te.prototype._transaction=function(e,t,n){var r,o,i=this,a=D.trans,u=(a&&a.db===this&&e.indexOf("!")===-1||(a=null),e.indexOf("?")!==-1);e=e.replace("!","").replace("?","");try{if(o=t.map(function(m){if(m=m instanceof i.Table?m.name:m,typeof m!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return m}),e=="r"||e===fn)r=fn;else{if(e!="rw"&&e!=hn)throw new T.InvalidArgument("Invalid transaction mode: "+e);r=hn}if(a){if(a.mode===fn&&r===hn){if(!u)throw new T.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");a=null}a&&o.forEach(function(m){if(a&&a.storeNames.indexOf(m)===-1){if(!u)throw new T.SubTransaction("Table "+m+" not included in parent transaction.");a=null}}),u&&a&&!a.active&&(a=null)}}catch(m){return a?a._promise(null,function(f,s){s(m)}):ee(m)}var l=function m(f,s,d,y,h){return K.resolve().then(function(){var g=D.transless||D,c=f._createTransaction(s,d,f._dbSchema,y),g=(c.explicit=!0,{trans:c,transless:g});if(y)c.idbtrans=y.idbtrans;else try{c.create(),c.idbtrans._explicit=!0,f._state.PR1398_maxLoop=3}catch(w){return w.name===en.InvalidState&&f.isOpen()&&0<--f._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),f.close({disableAutoOpen:!1}),f.open().then(function(){return m(f,s,d,null,h)})):ee(w)}var v,b=Zt(h),g=(b&&$e(),K.follow(function(){var w;(v=h.call(c,c))&&(b?(w=ke.bind(null,null),v.then(w,w)):typeof v.next=="function"&&typeof v.throw=="function"&&(v=An(v)))},g));return(v&&typeof v.then=="function"?K.resolve(v).then(function(w){return c.active?w:ee(new T.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):g.then(function(){return v})).then(function(w){return y&&c._resolve(),c._completion.then(function(){return w})}).catch(function(w){return c._reject(w),ee(w)})})}.bind(null,this,r,o,a,n);return a?a._promise(r,l,"lock"):D.trans?De(D.transless,function(){return i._whenReady(l)}):this._whenReady(l)},te.prototype.table=function(e){if($(this._allTables,e))return this._allTables[e];throw new T.InvalidTable("Table ".concat(e," does not exist"))};var me=te;function te(e,t){var n,r,o,i,a,u=this,l=(this._middlewares={},this.verno=0,te.dependencies),l=(this._options=t=P({addons:te.addons,autoOpen:!0,indexedDB:l.indexedDB,IDBKeyRange:l.IDBKeyRange,cache:"cloned"},t),this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange},t.addons),m=(this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this,{dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:V,dbReadyPromise:null,cancelOpen:V,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:t.autoOpen}),f=(m.dbReadyPromise=new K(function(s){m.dbReadyResolve=s}),m.openCanceller=new K(function(s,d){m.cancelOpen=d}),this._state=m,this.name=e,this.on=ct(this,"populate","blocked","versionchange","close",{ready:[tn,V]}),this.once=function(s,d){var y=function(){for(var h=[],c=0;c<arguments.length;c++)h[c]=arguments[c];u.on(s).unsubscribe(y),d.apply(u,h)};return u.on(s,y)},this.on.ready.subscribe=Vn(this.on.ready.subscribe,function(s){return function(d,y){te.vip(function(){var h,c=u._state;c.openComplete?(c.dbOpenError||K.resolve().then(d),y&&s(d)):c.onReadyBeingFired?(c.onReadyBeingFired.push(d),y&&s(d)):(s(d),h=u,y||s(function v(){h.on.ready.unsubscribe(d),h.on.ready.unsubscribe(v)}))})}}),this.Collection=(n=this,lt(co.prototype,function(v,c){this.db=n;var y=ir,h=null;if(c)try{y=c()}catch(g){h=g}var c=v._ctx,v=c.table,b=v.hook.reading.fire;this._ctx={table:v,index:c.index,isPrimKey:!c.index||v.schema.primKey.keyPath&&c.index===v.schema.primKey.name,range:y,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:h,or:c.or,valueMapper:b!==rt?b:null}})),this.Table=(r=this,lt(fr.prototype,function(s,d,y){this.db=r,this._tx=y,this.name=s,this.schema=d,this.hook=r._allTables[s]?r._allTables[s].hook:ct(null,{creating:[eo,V],reading:[Zr,rt],updating:[no,V],deleting:[to,V]})})),this.Transaction=(o=this,lt(ho.prototype,function(s,d,y,h,c){var v=this;s!=="readonly"&&d.forEach(function(b){b=(b=y[b])==null?void 0:b.yProps,b&&(d=d.concat(b.map(function(g){return g.updatesTable})))}),this.db=o,this.mode=s,this.storeNames=d,this.schema=y,this.chromeTransactionDurability=h,this.idbtrans=null,this.on=ct(this,"complete","error","abort"),this.parent=c||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new K(function(b,g){v._resolve=b,v._reject=g}),this._completion.then(function(){v.active=!1,v.on.complete.fire()},function(b){var g=v.active;return v.active=!1,v.on.error.fire(b),v.parent?v.parent._reject(b):g&&v.idbtrans&&v.idbtrans.abort(),ee(b)})})),this.Version=(i=this,lt(wo.prototype,function(s){this.db=i,this._cfg={version:s,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(a=this,lt(gr.prototype,function(s,d,y){if(this.db=a,this._ctx={table:s,index:d===":id"?null:d,or:y},this._cmp=this._ascending=L,this._descending=function(h,c){return L(c,h)},this._max=function(h,c){return 0<L(h,c)?h:c},this._min=function(h,c){return L(h,c)<0?h:c},this._IDBKeyRange=a._deps.IDBKeyRange,!this._IDBKeyRange)throw new T.MissingAPI})),this.on("versionchange",function(s){0<s.newVersion?console.warn("Another connection wants to upgrade database '".concat(u.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(u.name,"'. Closing db now to resume the delete request.")),u.close({disableAutoOpen:!1})}),this.on("blocked",function(s){!s.newVersion||s.newVersion<s.oldVersion?console.warn("Dexie.delete('".concat(u.name,"') was blocked")):console.warn("Upgrade '".concat(u.name,"' blocked by other connection holding version ").concat(s.oldVersion/10))}),this._maxKey=dt(t.IDBKeyRange),this._createTransaction=function(s,d,y,h){return new u.Transaction(s,d,y,u._options.chromeTransactionDurability,h)},this._fireOnBlocked=function(s){u.on("blocked").fire(s),Qe.filter(function(d){return d.name===u.name&&d!==u&&!d._state.vcFired}).map(function(d){return d.on("versionchange").fire(s)})},this.use(Po),this.use(Co),this.use(Oo),this.use(ko),this.use(xo),new Proxy(this,{get:function(s,d,y){var h;return d==="_vip"||(d==="table"?function(c){return Wt(u.table(c),f)}:(h=Reflect.get(s,d,y))instanceof fr?Wt(h,f):d==="tables"?h.map(function(c){return Wt(c,f)}):d==="_createTransaction"?function(){return Wt(h.apply(this,arguments),f)}:h)}}));this.vip=f,l.forEach(function(s){return s(u)})}var Ut,Xe=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Ko=(Tn.prototype.subscribe=function(e,t,n){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:t,complete:n})},Tn.prototype[Xe]=function(){return this},Tn);function Tn(e){this._subscribe=e}try{Ut={indexedDB:B.indexedDB||B.mozIndexedDB||B.webkitIndexedDB||B.msIndexedDB,IDBKeyRange:B.IDBKeyRange||B.webkitIDBKeyRange}}catch{Ut={indexedDB:null,IDBKeyRange:null}}function jr(e){var t,n=!1,r=new Ko(function(o){var i=Zt(e),a,u=!1,l={},m={},f={get closed(){return u},unsubscribe:function(){u||(u=!0,a&&a.abort(),s&&Oe.storagemutated.unsubscribe(y))}},s=(o.start&&o.start(f),!1),d=function(){return ln(h)},y=function(c){Ft(l,c),Sn(m,l)&&d()},h=function(){var c,v,b;!u&&Ut.indexedDB&&(l={},c={},a&&a.abort(),a=new AbortController,b=(g=>{var w=ze();try{i&&$e();var k=_e(e,g);return k=i?k.finally(ke):k}finally{w&&Ve()}})(v={subscr:c,signal:a.signal,requery:d,querier:e,trans:null}),Promise.resolve(b).then(function(g){n=!0,t=g,u||v.signal.aborted||(l={},(w=>{for(var k in w)if($(w,k))return;return 1})(m=c)||s||(Oe(ht,y),s=!0),ln(function(){return!u&&o.next&&o.next(g)}))},function(g){n=!1,["DatabaseClosedError","AbortError"].includes(g?.name)||u||ln(function(){u||o.error&&o.error(g)})}))};return setTimeout(d,0),f});return r.hasValue=function(){return n},r.getValue=function(){return t},r}var Be=me;function Rn(e){var t=Se;try{Se=!0,Oe.storagemutated.fire(e),Kn(e,!0)}finally{Se=t}}Z(Be,P(P({},ye),{delete:function(e){return new Be(e,{addons:[]}).delete()},exists:function(e){return new Be(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return t=Be.dependencies,n=t.indexedDB,t=t.IDBKeyRange,(xn(n)?Promise.resolve(n.databases()).then(function(r){return r.map(function(o){return o.name}).filter(function(o){return o!==Et})}):kn(n,t).toCollection().primaryKeys()).then(e)}catch{return ee(new T.MissingAPI)}var t,n},defineClass:function(){return function(e){Y(this,e)}},ignoreTransaction:function(e){return D.trans?De(D.transless,e):e()},vip:Pn,async:function(e){return function(){try{var t=An(e.apply(this,arguments));return t&&typeof t.then=="function"?t:K.resolve(t)}catch(n){return ee(n)}}},spawn:function(e,t,n){try{var r=An(e.apply(n,t||[]));return r&&typeof r.then=="function"?r:K.resolve(r)}catch(o){return ee(o)}},currentTransaction:{get:function(){return D.trans||null}},waitFor:function(e,t){return e=K.resolve(typeof e=="function"?Be.ignoreTransaction(e):e).timeout(t||6e4),D.trans?D.trans.waitFor(e):e},Promise:K,debug:{get:function(){return le},set:function(e){Jn(e)}},derive:Ne,extend:Y,props:Z,override:Vn,Events:ct,on:Oe,liveQuery:jr,extendObservabilitySet:Ft,getByKeyPath:de,setByKeyPath:ae,delByKeyPath:function(e,t){typeof t=="string"?ae(e,t,void 0):"length"in t&&[].map.call(t,function(n){ae(e,n,void 0)})},shallowClone:Qn,deepClone:Ee,getObjectDiff:jn,cmp:L,asap:$n,minKey:-1/0,addons:[],connections:Qe,errnames:en,dependencies:Ut,cache:qe,semVer:"4.3.0",version:"4.3.0".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),Be.maxKey=dt(Be.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Oe(ht,function(e){Se||(e=new CustomEvent(yn,{detail:e}),Se=!0,dispatchEvent(e),Se=!1)}),addEventListener(yn,function(e){e=e.detail,Se||Rn(e)}));var Je,Se=!1,Ir=function(){};return typeof BroadcastChannel<"u"&&((Ir=function(){(Je=new BroadcastChannel(yn)).onmessage=function(e){return e.data&&Rn(e.data)}})(),typeof Je.unref=="function"&&Je.unref(),Oe(ht,function(e){Se||Je.postMessage(e)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(e){if(!me.disableBfCache&&e.persisted){le&&console.debug("Dexie: handling persisted pagehide"),Je?.close();for(var t=0,n=Qe;t<n.length;t++)n[t].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!me.disableBfCache&&e.persisted&&(le&&console.debug("Dexie: handling persisted pageshow"),Ir(),Rn({all:new ie(-1/0,[[]])}))})),K.rejectionMapper=function(e,t){return!e||e instanceof We||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Xn[e.name]?e:(t=new Xn[e.name](t||e.message,e),"stack"in e&&be(t,"stack",{get:function(){return this.inner.stack}}),t)},Jn(le),P(me,Object.freeze({__proto__:null,Dexie:me,Entity:ar,PropModification:st,RangeSet:ie,add:function(e){return new st({add:e})},cmp:L,default:me,liveQuery:jr,mergeRanges:gt,rangesOverlap:_r,remove:function(e){return new st({remove:e})},replacePrefix:function(e,t){return new st({replacePrefix:[e,t]})}}),{default:me}),me})})(Vt)),Vt.exports}var qo=Ro();const Fn=jo(qo),Tr=Symbol.for("Dexie"),Qt=globalThis[Tr]||(globalThis[Tr]=Fn);if(Fn.semVer!==Qt.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Fn.semVer} and ${Qt.semVer}`);const{liveQuery:ai,mergeRanges:ui,rangesOverlap:si,RangeSet:ci,cmp:li,Entity:fi,PropModification:hi,replacePrefix:di,add:pi,remove:yi,DexieYProvider:gi}=Qt;class Bo extends Qt{pages;constructor(_){super("pages_"+_),this.version(2).stores({pages:"id, name, content, document, css, js, document.name, document.headline, document.creator"})}}var Mo=Object.getOwnPropertyDescriptor,Fo=(p,_,C,P)=>{for(var q=P>1?void 0:P?Mo(_,C):_,B=p.length-1,F;B>=0;B--)(F=p[B])&&(q=F(q)||q);return q},No=(p,_)=>(C,P)=>_(C,P,p);let Nn=class{pageStorageMap=new Map;logger;constructor(p){this.logger=p,this.logger.setModule("storage.components.dexieOfflineStorage")}getPageStorage(p){let _=this.pageStorageMap.get(p);return _==null&&(_=new Bo(p),this.pageStorageMap.set(p,_)),_}async getPage(p,_){try{this.logger.debug("Ready to load page from local storage",_);const C=this.getPageStorage(p);this.logger.debug("pageStorage is ready, asking for page");const P=await C.pages.get(_),q=new Io;return q.fromObject(P),q}catch(C){this.logger.debug("Exception while trying to read from local storage",C);return}}async savePage(p,_,C){try{await this.getPageStorage(p).pages.put(C.toObject(),_)}catch(P){this.logger.debug("Exception while trying to store in local storage",p,_,C,P)}}async updatePage(p,_,C){try{const P=this.getPageStorage(p);this.logger.debug("Ready to store",C),await P.pages.update(_,C.toObject())}catch(P){this.logger.debug("Exception while trying to store in local storage",p,_,C,P)}}};Nn=Fo([zn(),No(0,et("Logger"))],Nn);var Lo=Object.getOwnPropertyDescriptor,Wo=(p,_,C,P)=>{for(var q=P>1?void 0:P?Lo(_,C):_,B=p.length-1,F;B>=0;B--)(F=p[B])&&(q=F(q)||q);return q},Bn=(p,_)=>(C,P)=>_(C,P,p);let Ln=class{logger;storage;offlineStorage;queueWorker;constructor(p,_,C){this.logger=p,this.logger.setModule("storage.components.wrappingOfflineStorage"),this.offlineStorage=_,this.queueWorker=C}setStorage(p){this.storage=p}getStorage(){return this.storage}setWikiConfig(p){return this.storage.setWikiConfig(p)}getWikiConfig(){return this.storage.getWikiConfig()}async isStorageReady(){return this.storage.isStorageReady()}getPageRestURL(p,_){return this.storage.getPageRestURL(p,_)}getPageFromViewURL(p){return this.storage.getPageFromViewURL(p)}getImageURL(p,_){return this.storage.getImageURL(p,_)}async getPageContent(p,_,C,P){if(this.logger.debug("Trying to get data for page ",p),this.offlineStorage){this.logger.debug("Asking offline storage for ",p);const q=await this.offlineStorage.getPage(this.getWikiConfig().name,p+"_"+_);return q!=null&&q!=null?(this.logger.debug("Loading data from local storage for page",p),(P==null||P)&&this.queueWorker.addToQueue(this.getWikiConfig().name+":"+p+"_"+_),q):(this.logger.debug("Could not find data in local storage for page",p),this.savePageContent(p,_))}else return this.logger.debug("No offline local storage available"),this.storage.getPageContent(p,_)}getAttachments(p){return this.storage.getAttachments(p)}getAttachment(p,_){return this.storage.getAttachment(p,_)}async savePageContent(p,_){const C=await this.storage.getPageContent(p,_);if(C)return C.id=p+"_"+_,this.logger.debug("Saving page to offline storage",p),this.offlineStorage.savePage(this.getWikiConfig().name,p+"_"+_,C),C;throw new Error("Can't save missing page.")}async updatePageContent(p,_){const C=await this.offlineStorage.getPage(this.getWikiConfig().name,p+"_"+_),P=await this.storage.getPageContent(p,_);return C&&P?(P.id=p+"_"+_,this.logger.debug("Saving page to offline storage",p),this.offlineStorage.savePage(this.getWikiConfig().name,p+"_"+_,P),!0):C?.version!=P?.version&&P?(P.id=p+"_"+_,this.logger.debug("Updating page to offline storage",p),this.offlineStorage.updatePage(this.getWikiConfig().name,p+"_"+_,P),!0):(this.logger.debug("Local storage not updated, because version are identical"),!1)}async getPanelContent(p,_,C){return this.storage.getPanelContent(p,_,C)}async getEditField(p,_){return await this.storage.getEditField(p,_)}save(p,_,C,P){return this.storage.save(p,_,C,P)}async saveAttachments(p,_){return this.storage.saveAttachments(p,_)}async delete(p){return this.storage.delete(p)}async move(p,_,C){return this.storage.move(p,_,C)}};Ln=Wo([zn(),Bn(0,et("Logger")),Bn(1,et("OfflineStorage")),Bn(2,et("QueueWorker"))],Ln);let Uo=class{constructor(_){_.bind("WrappingStorage").to(Ln).inSingletonScope(),_.bind("OfflineStorage").to(Nn).inSingletonScope()}};function zo(p){return new SharedWorker(""+new URL("worker-C267fLfn.js",import.meta.url).href,{type:"module",name:p?.name})}const Br=Symbol("Comlink.proxy"),Vo=Symbol("Comlink.endpoint"),$o=Symbol("Comlink.releaseProxy"),Mn=Symbol("Comlink.finalizer"),$t=Symbol("Comlink.thrown"),Mr=p=>typeof p=="object"&&p!==null||typeof p=="function",Qo={canHandle:p=>Mr(p)&&p[Br],serialize(p){const{port1:_,port2:C}=new MessageChannel;return Nr(p,_),[C,[C]]},deserialize(p){return p.start(),Wr(p)}},Yo={canHandle:p=>Mr(p)&&$t in p,serialize({value:p}){let _;return p instanceof Error?_={isError:!0,value:{message:p.message,name:p.name,stack:p.stack}}:_={isError:!1,value:p},[_,[]]},deserialize(p){throw p.isError?Object.assign(new Error(p.value.message),p.value):p.value}},Fr=new Map([["proxy",Qo],["throw",Yo]]);function Ho(p,_){for(const C of p)if(_===C||C==="*"||C instanceof RegExp&&C.test(_))return!0;return!1}function Nr(p,_=globalThis,C=["*"]){_.addEventListener("message",function P(q){if(!q||!q.data)return;if(!Ho(C,q.origin)){console.warn(`Invalid origin '${q.origin}' for comlink proxy`);return}const{id:B,type:F,path:N}=Object.assign({path:[]},q.data),Y=(q.data.argumentList||[]).map(Fe);let H;try{const oe=N.slice(0,-1).reduce((Z,ve)=>Z[ve],p),$=N.reduce((Z,ve)=>Z[ve],p);switch(F){case"GET":H=$;break;case"SET":oe[N.slice(-1)[0]]=Fe(q.data.value),H=!0;break;case"APPLY":H=$.apply(oe,Y);break;case"CONSTRUCT":{const Z=new $(...Y);H=Vr(Z)}break;case"ENDPOINT":{const{port1:Z,port2:ve}=new MessageChannel;Nr(p,ve),H=ei(Z,[Z])}break;case"RELEASE":H=void 0;break;default:return}}catch(oe){H={value:oe,[$t]:0}}Promise.resolve(H).catch(oe=>({value:oe,[$t]:0})).then(oe=>{const[$,Z]=Gt(oe);_.postMessage(Object.assign(Object.assign({},$),{id:B}),Z),F==="RELEASE"&&(_.removeEventListener("message",P),Lr(_),Mn in p&&typeof p[Mn]=="function"&&p[Mn]())}).catch(oe=>{const[$,Z]=Gt({value:new TypeError("Unserializable return value"),[$t]:0});_.postMessage(Object.assign(Object.assign({},$),{id:B}),Z)})}),_.start&&_.start()}function Go(p){return p.constructor.name==="MessagePort"}function Lr(p){Go(p)&&p.close()}function Wr(p,_){const C=new Map;return p.addEventListener("message",function(q){const{data:B}=q;if(!B||!B.id)return;const F=C.get(B.id);if(F)try{F(B)}finally{C.delete(B.id)}}),Wn(p,C,[],_)}function zt(p){if(p)throw new Error("Proxy has been released and is not useable")}function Ur(p){return Ze(p,new Map,{type:"RELEASE"}).then(()=>{Lr(p)})}const Yt=new WeakMap,Ht="FinalizationRegistry"in globalThis&&new FinalizationRegistry(p=>{const _=(Yt.get(p)||0)-1;Yt.set(p,_),_===0&&Ur(p)});function Xo(p,_){const C=(Yt.get(_)||0)+1;Yt.set(_,C),Ht&&Ht.register(p,_,p)}function Jo(p){Ht&&Ht.unregister(p)}function Wn(p,_,C=[],P=function(){}){let q=!1;const B=new Proxy(P,{get(F,N){if(zt(q),N===$o)return()=>{Jo(B),Ur(p),_.clear(),q=!0};if(N==="then"){if(C.length===0)return{then:()=>B};const Y=Ze(p,_,{type:"GET",path:C.map(H=>H.toString())}).then(Fe);return Y.then.bind(Y)}return Wn(p,_,[...C,N])},set(F,N,Y){zt(q);const[H,oe]=Gt(Y);return Ze(p,_,{type:"SET",path:[...C,N].map($=>$.toString()),value:H},oe).then(Fe)},apply(F,N,Y){zt(q);const H=C[C.length-1];if(H===Vo)return Ze(p,_,{type:"ENDPOINT"}).then(Fe);if(H==="bind")return Wn(p,_,C.slice(0,-1));const[oe,$]=Rr(Y);return Ze(p,_,{type:"APPLY",path:C.map(Z=>Z.toString()),argumentList:oe},$).then(Fe)},construct(F,N){zt(q);const[Y,H]=Rr(N);return Ze(p,_,{type:"CONSTRUCT",path:C.map(oe=>oe.toString()),argumentList:Y},H).then(Fe)}});return Xo(B,p),B}function Zo(p){return Array.prototype.concat.apply([],p)}function Rr(p){const _=p.map(Gt);return[_.map(C=>C[0]),Zo(_.map(C=>C[1]))]}const zr=new WeakMap;function ei(p,_){return zr.set(p,_),p}function Vr(p){return Object.assign(p,{[Br]:!0})}function Gt(p){for(const[_,C]of Fr)if(C.canHandle(p)){const[P,q]=C.serialize(p);return[{type:"HANDLER",name:_,value:P},q]}return[{type:"RAW",value:p},zr.get(p)||[]]}function Fe(p){switch(p.type){case"HANDLER":return Fr.get(p.name).deserialize(p.value);case"RAW":return p.value}}function Ze(p,_,C,P){return new Promise(q=>{const B=ti();_.set(B,q),p.start&&p.start(),p.postMessage(Object.assign({id:B},C),P)})}function ti(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var ni=Object.getOwnPropertyDescriptor,ri=(p,_,C,P)=>{for(var q=P>1?void 0:P?ni(_,C):_,B=p.length-1,F;B>=0;B--)(F=p[B])&&(q=F(q)||q);return q},qr=(p,_)=>(C,P)=>_(C,P,p);let Un=class{workerInstance;cristalApp;logger;constructor(p,_){this.initialize(),this.logger=p,this.cristalApp=_}async pageLoaded(p){try{this.logger.debug("Received callback that new document has been loaded",p),await this.cristalApp.getContainer().get(Do).refreshCurrentDocument(),this.logger.debug("Done callback that new document has been loaded",p)}catch(_){this.logger.error("Error calling loadPage",_)}}initialize(){try{if(this.workerInstance==null){const p=new zo({name:"cristal-sharedworker"});this.workerInstance=Wr(p.port);const _=this;this.workerInstance.setPageLoadedCallback(Vr(async C=>{await _.pageLoaded(C)})),console.debug("Worker initialized",this.workerInstance)}else console.debug("Already initialized")}catch(p){console.error("Failed to initialize shared worker",p)}}getStatus(){return this.workerInstance!=null?(console.log("workerInstance is ready"),!0):(console.log("workerInstance is null. Cannot call"),!1)}async increment(){if(this.workerInstance==null)return console.log("workerInstance is null. Cannot call"),-1;{const p=await this.workerInstance.add(1);return console.log("Results from shared worker: ",p),p}}async addToQueue(p){console.log("worker Calling addToQueue",p),this.workerInstance!=null?await this.workerInstance.addToQueue(p):console.log("workerInstance is null. Cannot call")}async getQueueSize(){return console.log("worker Calling getQueueSize"),this.workerInstance==null?-1:await this.workerInstance.getQueueSize()}};Un=ri([zn(),qr(0,et("Logger")),qr(1,et("CristalApp"))],Un);class oi{constructor(_){_.bind("QueueWorker").to(Un)}}function vi(p){new Uo(p),new oi(p)}export{vi as load};
|
|
4
|
-
//# sourceMappingURL=offline-lGzDTw-r.js.map
|